AvatarBuilderCameraFragment.java
4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package com.bitstrips.imoji.abv3.camera;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import com.bitstrips.imoji.InjectorApplication;
import com.bitstrips.imoji.hardware.CameraUtils;
import com.bitstrips.imoji.hardware.CameraUtils.BitmapCallback;
import com.bitstrips.imoji.hardware.CameraUtils.CameraDetails;
import com.bitstrips.imoji.ui.views.CameraPreview;
import javax.inject.Inject;
public class AvatarBuilderCameraFragment
extends Fragment
{
private static final String b = AvatarBuilderCameraFragment.class.getSimpleName();
@Inject
CameraUtils a;
private CameraUtils.CameraDetails c;
private CameraPreview d;
private View e;
private int f;
private boolean g;
private boolean h;
private void b()
{
if (!this.h)
{
getListener().onCameraStarted();
this.h = true;
}
this.c = this.a.openFrontFacingCamera();
if (this.c == null)
{
c();
return;
}
this.d.attachCamera(this.c.camera);
this.e.setEnabled(true);
}
private void c()
{
getListener().onCameraFailed();
}
public static AvatarBuilderCameraFragment createFragment(int paramInt, boolean paramBoolean)
{
AvatarBuilderCameraFragment localAvatarBuilderCameraFragment = new AvatarBuilderCameraFragment();
Bundle localBundle = new Bundle();
localBundle.putInt("ARGUMENT_MAX_IMAGE_SIZE", paramInt);
localBundle.putBoolean("ARGUMENT_USE_BIGGER_SELFIE", paramBoolean);
localAvatarBuilderCameraFragment.setArguments(localBundle);
return localAvatarBuilderCameraFragment;
}
public AvatarBuilderCameraFragmentListener getListener()
{
return (AvatarBuilderCameraFragmentListener)getActivity();
}
public void onCreate(@Nullable Bundle paramBundle)
{
super.onCreate(paramBundle);
((InjectorApplication)getContext().getApplicationContext()).inject(this);
}
@Nullable
public View onCreateView(LayoutInflater paramLayoutInflater, @Nullable ViewGroup paramViewGroup, @Nullable Bundle paramBundle)
{
paramViewGroup = paramLayoutInflater.inflate(2130903105, paramViewGroup, false);
this.e = paramViewGroup.findViewById(2131689702);
this.e.setClickable(true);
this.e.setEnabled(false);
this.e.setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
AvatarBuilderCameraFragment.a(AvatarBuilderCameraFragment.this);
}
});
this.h = false;
if (getArguments() != null) {}
for (paramLayoutInflater = getArguments();; paramLayoutInflater = new Bundle())
{
this.f = paramLayoutInflater.getInt("ARGUMENT_MAX_IMAGE_SIZE", 768);
this.g = paramLayoutInflater.getBoolean("ARGUMENT_USE_BIGGER_SELFIE", true);
this.d = ((CameraPreview)paramViewGroup.findViewById(2131689622));
paramViewGroup.findViewById(2131689703).setOnClickListener(new View.OnClickListener()
{
public final void onClick(View paramAnonymousView)
{
AvatarBuilderCameraFragment.this.getListener().onCameraCancel();
}
});
return paramViewGroup;
}
}
public void onPause()
{
super.onPause();
if (this.c != null)
{
this.a.releaseCamera(this.c);
this.c = null;
this.d.releaseCamera();
this.e.setEnabled(false);
}
}
public void onRequestPermissionsResult(int paramInt, @NonNull String[] paramArrayOfString, @NonNull int[] paramArrayOfInt)
{
if (paramInt == 1)
{
if (this.a.hasPermissions()) {
b();
}
}
else {
return;
}
getListener().onCameraPermissionDenied();
}
public void onResume()
{
super.onResume();
if (this.a.hasPermissions())
{
b();
return;
}
this.a.requestPermissions(getActivity(), 1);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/camera/AvatarBuilderCameraFragment.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/