f.java
7.43 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
package com.instabug.library;
import android.app.Activity;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffColorFilter;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
import com.instabug.library.internal.b.b;
import com.instabug.library.util.InstabugSDKLogger;
import com.instabug.library.util.k;
import com.instabug.library.util.l;
import java.util.Timer;
import java.util.TimerTask;
public class f
extends Fragment
implements View.OnTouchListener
{
private ImageView a;
private boolean b = false;
private ImageView c;
private PorterDuffColorFilter d;
private Timer e;
private b f;
private int g;
private TimerTask h = new a();
private TextView i;
private TextView j;
private boolean k;
private boolean l = false;
private b m;
public static Fragment a(String paramString)
{
f localf = new f();
Bundle localBundle = new Bundle();
localBundle.putString("com.instabug.library.audio_attachment_path", paramString);
localf.setArguments(localBundle);
return localf;
}
private void a()
{
k.a(this, "android.permission.RECORD_AUDIO", 1, new Runnable()new Runnable
{
public final void run()
{
if (f.a(f.this))
{
InstabugSDKLogger.d(f.this, "Shouldn't try to explain why get this permission, either first time or never again selected OR permission not in manifest");
Toast.makeText(f.this.getContext(), f.b(f.this), 0).show();
Instabug.setShouldAudioRecordingOptionAppear(false);
return;
}
f.c(f.this);
}
}, new Runnable()
{
public final void run()
{
InstabugSDKLogger.d(f.this, "Audio recording permission already granted before");
f.d(f.this);
}
});
}
private void b()
{
if (this.m != null) {
this.m.a(getArguments().getString("com.instabug.library.audio_attachment_path"));
}
}
private boolean c()
{
try
{
this.h.cancel();
this.e.cancel();
this.h = new a();
this.e = new Timer();
this.b = false;
this.a.setImageResource(R.drawable.instabug_record_default_bk);
this.c.setColorFilter(this.d);
this.i.setText(String.format("00:%02d", new Object[] { Integer.valueOf(0) }));
this.j.setText(l.a(IBGCustomTextPlaceHolder.Key.VOICE_MESSAGE_PRESS_AND_HOLD_TO_RECORD, getString(R.string.instabug_str_hold_to_record)));
this.f.b();
int n = this.g;
return n > 3;
}
catch (RuntimeException localRuntimeException)
{
if (this.g > 1) {
Toast.makeText(getActivity(), "Unknown error occurred", 0).show();
}
InstabugSDKLogger.e(this, "Error capturing audio stream", localRuntimeException);
}
return false;
}
private String d()
{
return l.a(IBGCustomTextPlaceHolder.Key.AUDIO_RECORDING_PERMISSION_DENIED, getString(R.string.instabug_audio_recorder_permission_denied));
}
public void onAttach(Activity paramActivity)
{
super.onAttach(paramActivity);
try
{
this.m = ((b)paramActivity);
return;
}
catch (ClassCastException localClassCastException)
{
throw new ClassCastException(paramActivity.toString() + " must implement InstabugAudioRecordingFragment.Callbacks");
}
}
@Nullable
public View onCreateView(LayoutInflater paramLayoutInflater, ViewGroup paramViewGroup, Bundle paramBundle)
{
this.k = false;
this.e = new Timer();
this.f = new b(getArguments().getString("com.instabug.library.audio_attachment_path"));
paramLayoutInflater = paramLayoutInflater.inflate(R.layout.instabug_lyt_record_audio, paramViewGroup, false);
paramLayoutInflater.findViewById(R.id.instabug_btn_record_audio).setOnTouchListener(this);
this.a = ((ImageView)paramLayoutInflater.findViewById(R.id.instabug_bk_record_audio));
this.c = ((ImageView)paramLayoutInflater.findViewById(R.id.instabug_img_record_audio));
this.d = new PorterDuffColorFilter(Instabug.getSettingsBundle().y(), PorterDuff.Mode.SRC_IN);
this.a.setColorFilter(this.d);
this.c.setColorFilter(this.d);
this.i = ((TextView)paramLayoutInflater.findViewById(R.id.instabug_txt_timer));
this.i.setText(String.format("00:%02d", new Object[] { Integer.valueOf(0) }));
this.j = ((TextView)paramLayoutInflater.findViewById(R.id.instabug_txt_recording_title));
this.j.setText(l.a(IBGCustomTextPlaceHolder.Key.VOICE_MESSAGE_PRESS_AND_HOLD_TO_RECORD, getString(R.string.instabug_str_hold_to_record)));
return paramLayoutInflater;
}
public void onDetach()
{
super.onDetach();
this.m = null;
}
public void onRequestPermissionsResult(int paramInt, @NonNull String[] paramArrayOfString, @NonNull int[] paramArrayOfInt)
{
switch (paramInt)
{
default:
super.onRequestPermissionsResult(paramInt, paramArrayOfString, paramArrayOfInt);
return;
}
if (paramArrayOfInt[0] == 0)
{
InstabugSDKLogger.d(this, "Audio recording permission granted by user");
this.k = true;
return;
}
InstabugSDKLogger.d(this, "Audio recording permission denied by user");
this.k = false;
Toast.makeText(getContext(), d(), 0).show();
}
public boolean onTouch(View paramView, MotionEvent paramMotionEvent)
{
switch (paramMotionEvent.getAction())
{
}
do
{
do
{
return true;
if ((!this.b) && (this.k))
{
this.g = 0;
this.e.scheduleAtFixedRate(this.h, 0L, 1000L);
this.f.a();
this.b = true;
this.a.setImageResource(R.drawable.instabug_record_default_active);
this.c.setColorFilter(null);
this.j.setText(l.a(IBGCustomTextPlaceHolder.Key.VOICE_MESSAGE_RELEASE_TO_ATTACH, getString(R.string.instabug_str_release_stop_record)));
}
} while (this.k);
a();
return true;
} while ((!this.b) || (!this.k) || (!c()) || (paramMotionEvent.getAction() != 1));
b();
return true;
}
public void onViewCreated(View paramView, @Nullable Bundle paramBundle)
{
super.onViewCreated(paramView, paramBundle);
a();
}
final class a
extends TimerTask
{
a() {}
public final void run()
{
f.this.getActivity().runOnUiThread(new Runnable()
{
public final void run()
{
if (f.e(f.this) >= 50)
{
f.f(f.this).setTextColor(-65536);
if (f.e(f.this) != 60) {
break label89;
}
f.g(f.this);
}
for (;;)
{
f.h(f.this);
return;
f.f(f.this).setTextColor(Instabug.getSettingsBundle().y());
break;
label89:
f.f(f.this).setText(String.format("00:%02d", new Object[] { Integer.valueOf(f.e(f.this)) }));
}
}
});
}
}
public static abstract interface b
{
public abstract void a(String paramString);
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/instabug/library/f.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/