c.java
11.8 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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
package com.instabug.library.d;
import android.app.Activity;
import android.content.Context;
import android.content.res.Resources.Theme;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
import com.instabug.library.IBGCustomTextPlaceHolder.Key;
import com.instabug.library.R.attr;
import com.instabug.library.R.drawable;
import com.instabug.library.R.id;
import com.instabug.library.R.layout;
import com.instabug.library.R.string;
import com.instabug.library.h;
import com.instabug.library.internal.d.a.b.b;
import com.instabug.library.model.IssueType;
import com.instabug.library.model.a.a;
import com.instabug.library.model.g.a;
import com.instabug.library.util.InstabugSDKLogger;
import com.instabug.library.util.l;
import com.instabug.library.view.CircularImageView;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import rx.Observable;
import rx.Observer;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.subjects.PublishSubject;
public class c
extends h
implements AdapterView.OnItemClickListener, com.instabug.library.a, e, com.instabug.library.internal.d.a.d<com.instabug.library.model.c>
{
private b a;
private ListView b;
private ArrayList<com.instabug.library.model.c> c = new ArrayList();
private com.instabug.library.util.f d;
private a e;
private PublishSubject<Integer> f;
private Subscription g;
public static c f()
{
return new c();
}
private void g()
{
List localList = com.instabug.library.internal.d.a.f.a().b();
InstabugSDKLogger.d(this, "Conversations loaded from cache " + localList.size());
this.c.clear();
this.c.addAll(localList);
Collections.sort(this.c, Collections.reverseOrder(new com.instabug.library.model.c.a()));
this.a.notifyDataSetChanged();
}
private void h()
{
this.f.onNext(Integer.valueOf(0));
}
public List<com.instabug.library.model.g> a(@NonNull List<com.instabug.library.model.g> paramList)
{
if (e() != null)
{
com.instabug.library.b.a().b(e());
paramList = null;
}
return paramList;
}
protected void a() {}
protected void a(Bundle paramBundle)
{
paramBundle.putSerializable("CONVERSATIONS", this.c);
}
public void a(final com.instabug.library.model.c paramc)
{
InstabugSDKLogger.d(this, "Conversation removed from cache: " + paramc);
e().runOnUiThread(new Runnable()
{
public final void run()
{
c.a(c.this).remove(paramc);
c.b(c.this);
}
});
}
public void a(com.instabug.library.model.c paramc1, final com.instabug.library.model.c paramc2)
{
InstabugSDKLogger.d(this, "Conversation updated in cache");
e().runOnUiThread(new Runnable()
{
public final void run()
{
if (paramc2.b().size() > 0) {
c.b(c.this);
}
}
});
}
public void a(boolean paramBoolean)
{
InstabugSDKLogger.d(this, "InstabugConversationListFragment isVisible " + paramBoolean);
if (!paramBoolean)
{
d.a().b(this);
com.instabug.library.internal.d.a.e.a().b("CONVERSATIONS_MEMORY_CACHE", this);
return;
}
d.a().a(this);
com.instabug.library.internal.d.a.e.a().a("CONVERSATIONS_MEMORY_CACHE", this);
h();
}
public void a_()
{
e().runOnUiThread(new Runnable()
{
public final void run()
{
InstabugSDKLogger.d(c.this, "Conversations cache was invalidated");
c.b(c.this);
}
});
}
protected int b()
{
return R.layout.instabug_lyt_conversations;
}
protected void b(Bundle paramBundle)
{
this.c = ((ArrayList)paramBundle.getSerializable("CONVERSATIONS"));
}
public void b(final com.instabug.library.model.c paramc)
{
InstabugSDKLogger.d(this, "Conversation added to cache: " + paramc);
e().runOnUiThread(new Runnable()
{
public final void run()
{
if (paramc.b().size() > 0)
{
c.a(c.this).add(paramc);
c.b(c.this);
}
}
});
}
protected String c()
{
return l.a(IBGCustomTextPlaceHolder.Key.CONVERSATIONS_LIST_TITLE, getString(R.string.instabug_str_conversations));
}
public void onAttach(Activity paramActivity)
{
super.onAttach(paramActivity);
try
{
this.e = ((a)paramActivity);
return;
}
catch (ClassCastException localClassCastException)
{
throw new ClassCastException(paramActivity.toString() + " must implement InstabugConversationListFragment.Callbacks");
}
}
public void onDestroyView()
{
if ((this.g != null) && (!this.g.isUnsubscribed())) {
this.g.unsubscribe();
}
super.onDestroyView();
}
public void onDetach()
{
super.onDetach();
this.e = null;
}
public void onItemClick(AdapterView<?> paramAdapterView, View paramView, int paramInt, long paramLong)
{
paramView = this.a.a(paramInt);
com.instabug.library.internal.d.a.f.a().a(paramView.a(), paramView);
if (this.e != null) {
this.e.d(((com.instabug.library.model.c)paramAdapterView.getItemAtPosition(paramInt)).a());
}
}
public void onPause()
{
InstabugSDKLogger.d(this, "onPause called, un-subscribing from all listeners");
super.onPause();
com.instabug.library.internal.d.a.e.a().b("CONVERSATIONS_MEMORY_CACHE", this);
d.a().b(this);
}
public void onResume()
{
super.onResume();
com.instabug.library.internal.d.a.e.a().a("CONVERSATIONS_MEMORY_CACHE", this);
d.a().a(this);
}
public void onViewCreated(View paramView, @Nullable Bundle paramBundle)
{
super.onViewCreated(paramView, paramBundle);
this.b = ((ListView)paramView.findViewById(R.id.instabug_lst_conversations));
this.b.setOnItemClickListener(this);
this.a = new b();
this.d = new com.instabug.library.util.f(e());
this.b.setAdapter(this.a);
this.f = PublishSubject.create();
this.g = this.f.debounce(300L, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer()
{
public final void onCompleted() {}
public final void onError(Throwable paramAnonymousThrowable) {}
});
g();
this.b.setVisibility(0);
getView().findViewById(R.id.instabug_disconnected).setVisibility(8);
getView().findViewById(R.id.instabug_blank).setVisibility(8);
}
public static abstract interface a
{
public abstract void d(String paramString);
}
public class b
extends BaseAdapter
{
public b() {}
public com.instabug.library.model.c a(int paramInt)
{
return (com.instabug.library.model.c)c.a(c.this).get(paramInt);
}
public int getCount()
{
return c.a(c.this).size();
}
public long getItemId(int paramInt)
{
return a(paramInt).a().hashCode();
}
public View getView(int paramInt, View paramView, final ViewGroup paramViewGroup)
{
Object localObject1;
label122:
Object localObject2;
if (paramView == null)
{
paramView = LayoutInflater.from(paramViewGroup.getContext()).inflate(R.layout.instabug_conversation_list_item, paramViewGroup, false);
paramViewGroup = new c.c(c.this, paramView);
paramView.setTag(paramViewGroup);
localObject1 = a(paramInt);
InstabugSDKLogger.v(this, "Binding conversation " + localObject1 + " to view");
Collections.sort(((com.instabug.library.model.c)localObject1).b(), new g.a());
c.c.a(paramViewGroup).setText(((com.instabug.library.model.c)localObject1).i().c());
if (((com.instabug.library.model.c)localObject1).e() != IssueType.FEEDBACK) {
break label284;
}
c.c.b(paramViewGroup).setImageResource(R.drawable.instabug_ic_feedback_dark);
localObject2 = ((com.instabug.library.model.c)localObject1).g();
if (localObject2 == null) {
break label297;
}
localObject2 = ((String)localObject2).substring(0, ((String)localObject2).indexOf('<'));
c.c.c(paramViewGroup).setText((CharSequence)localObject2);
label158:
c.c.d(paramViewGroup).setText(com.instabug.library.util.g.a(((com.instabug.library.model.c)localObject1).h()));
if (((com.instabug.library.model.c)localObject1).c() == 0) {
break label353;
}
localObject2 = new TypedValue();
c.this.getActivity().getTheme().resolveAttribute(R.attr.instabug_color_unread_background, (TypedValue)localObject2, true);
c.c.e(paramViewGroup).setBackgroundColor(((TypedValue)localObject2).data);
}
for (;;)
{
if (((com.instabug.library.model.c)localObject1).f() != null)
{
localObject1 = com.instabug.library.internal.d.a.b.a(c.this.getActivity(), ((com.instabug.library.model.c)localObject1).f(), a.a.a);
com.instabug.library.internal.d.a.b.a(c.this.getActivity(), (com.instabug.library.model.a)localObject1, new b.b()
{
public final void a(com.instabug.library.model.a paramAnonymousa)
{
InstabugSDKLogger.d(this, "Asset Entity downloaded: " + paramAnonymousa.c().getPath());
try
{
c.c.f(paramViewGroup).setImageDrawable(null);
c.c.f(paramViewGroup).setImageBitmap(BitmapFactory.decodeStream(new FileInputStream(paramAnonymousa.c())));
return;
}
catch (FileNotFoundException paramAnonymousa)
{
InstabugSDKLogger.e(this, "Asset Entity downloading got FileNotFoundException error", paramAnonymousa);
}
}
public final void a(Throwable paramAnonymousThrowable)
{
InstabugSDKLogger.e(this, "Asset Entity downloading got error", paramAnonymousThrowable);
}
});
}
return paramView;
paramViewGroup = (c.c)paramView.getTag();
break;
label284:
c.c.b(paramViewGroup).setImageResource(R.drawable.instabug_ic_bug_dark);
break label122;
label297:
localObject2 = c.c(c.this).a() + c.this.getActivity().getApplicationContext().getString(R.string.instabug_str_notification_title);
c.c.c(paramViewGroup).setText((CharSequence)localObject2);
break label158;
label353:
c.c.e(paramViewGroup).setBackgroundDrawable(null);
}
}
}
public class c
{
private final TextView b;
private final CircularImageView c;
private final TextView d;
private final TextView e;
private final ImageView f;
private final LinearLayout g;
public c(View paramView)
{
this.g = ((LinearLayout)paramView.findViewById(R.id.conversation_container));
this.b = ((TextView)paramView.findViewById(R.id.instabug_txt_message_sender));
this.c = ((CircularImageView)paramView.findViewById(R.id.instabug_img_message_sender));
this.f = ((ImageView)paramView.findViewById(R.id.instabug_img_bug_type));
this.d = ((TextView)paramView.findViewById(R.id.instabug_txt_message_time));
this.e = ((TextView)paramView.findViewById(R.id.instabug_txt_message_snippet));
}
}
}
/* Location: /home/merong/decompile/hackery-dex2jar.jar!/com/instabug/library/d/c.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/