You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
254 lines
7.3 KiB
254 lines
7.3 KiB
package p035l0;
|
|
|
|
import android.content.Context;
|
|
import android.database.ContentObserver;
|
|
import android.database.Cursor;
|
|
import android.database.DataSetObserver;
|
|
import android.os.Handler;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.BaseAdapter;
|
|
import android.widget.Filter;
|
|
import android.widget.Filterable;
|
|
import p035l0.C1418b;
|
|
|
|
/* renamed from: l0.a */
|
|
/* loaded from: classes.dex */
|
|
public abstract class AbstractC1415a extends BaseAdapter implements Filterable, C1418b.InterfaceC1419a {
|
|
|
|
/* renamed from: d */
|
|
public boolean f3135d;
|
|
|
|
/* renamed from: e */
|
|
public boolean f3136e;
|
|
|
|
/* renamed from: f */
|
|
public Cursor f3137f;
|
|
|
|
/* renamed from: g */
|
|
public Context f3138g;
|
|
|
|
/* renamed from: h */
|
|
public int f3139h;
|
|
|
|
/* renamed from: i */
|
|
public C1416a f3140i;
|
|
|
|
/* renamed from: j */
|
|
public DataSetObserver f3141j;
|
|
|
|
/* renamed from: k */
|
|
public C1418b f3142k;
|
|
|
|
/* renamed from: l0.a$a */
|
|
/* loaded from: classes.dex */
|
|
public class C1416a extends ContentObserver {
|
|
public C1416a() {
|
|
super(new Handler());
|
|
}
|
|
|
|
@Override // android.database.ContentObserver
|
|
public boolean deliverSelfNotifications() {
|
|
return true;
|
|
}
|
|
|
|
@Override // android.database.ContentObserver
|
|
public void onChange(boolean z) {
|
|
AbstractC1415a.this.m1392h();
|
|
}
|
|
}
|
|
|
|
/* renamed from: l0.a$b */
|
|
/* loaded from: classes.dex */
|
|
public class C1417b extends DataSetObserver {
|
|
public C1417b() {
|
|
}
|
|
|
|
@Override // android.database.DataSetObserver
|
|
public void onChanged() {
|
|
AbstractC1415a abstractC1415a = AbstractC1415a.this;
|
|
abstractC1415a.f3135d = true;
|
|
abstractC1415a.notifyDataSetChanged();
|
|
}
|
|
|
|
@Override // android.database.DataSetObserver
|
|
public void onInvalidated() {
|
|
AbstractC1415a abstractC1415a = AbstractC1415a.this;
|
|
abstractC1415a.f3135d = false;
|
|
abstractC1415a.notifyDataSetInvalidated();
|
|
}
|
|
}
|
|
|
|
public AbstractC1415a(Context context, Cursor cursor, boolean z) {
|
|
m1393e(context, cursor, z ? 1 : 2);
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public void mo1390a(Cursor cursor) {
|
|
Cursor m1391i = m1391i(cursor);
|
|
if (m1391i != null) {
|
|
m1391i.close();
|
|
}
|
|
}
|
|
|
|
@Override // p035l0.C1418b.InterfaceC1419a
|
|
/* renamed from: b */
|
|
public Cursor mo1389b() {
|
|
return this.f3137f;
|
|
}
|
|
|
|
public abstract CharSequence convertToString(Cursor cursor);
|
|
|
|
/* renamed from: d */
|
|
public abstract void mo1394d(View view, Context context, Cursor cursor);
|
|
|
|
/* renamed from: e */
|
|
public void m1393e(Context context, Cursor cursor, int i) {
|
|
C1417b c1417b;
|
|
if ((i & 1) == 1) {
|
|
i |= 2;
|
|
this.f3136e = true;
|
|
} else {
|
|
this.f3136e = false;
|
|
}
|
|
boolean z = cursor != null;
|
|
this.f3137f = cursor;
|
|
this.f3135d = z;
|
|
this.f3138g = context;
|
|
this.f3139h = z ? cursor.getColumnIndexOrThrow("_id") : -1;
|
|
if ((i & 2) == 2) {
|
|
this.f3140i = new C1416a();
|
|
c1417b = new C1417b();
|
|
} else {
|
|
c1417b = null;
|
|
this.f3140i = null;
|
|
}
|
|
this.f3141j = c1417b;
|
|
if (z) {
|
|
C1416a c1416a = this.f3140i;
|
|
if (c1416a != null) {
|
|
cursor.registerContentObserver(c1416a);
|
|
}
|
|
DataSetObserver dataSetObserver = this.f3141j;
|
|
if (dataSetObserver != null) {
|
|
cursor.registerDataSetObserver(dataSetObserver);
|
|
}
|
|
}
|
|
}
|
|
|
|
/* renamed from: f */
|
|
public abstract View mo1387f(Context context, Cursor cursor, ViewGroup viewGroup);
|
|
|
|
/* renamed from: g */
|
|
public abstract View mo1386g(Context context, Cursor cursor, ViewGroup viewGroup);
|
|
|
|
@Override // android.widget.Adapter
|
|
public int getCount() {
|
|
Cursor cursor;
|
|
if (!this.f3135d || (cursor = this.f3137f) == null) {
|
|
return 0;
|
|
}
|
|
return cursor.getCount();
|
|
}
|
|
|
|
@Override // android.widget.BaseAdapter, android.widget.SpinnerAdapter
|
|
public View getDropDownView(int i, View view, ViewGroup viewGroup) {
|
|
if (this.f3135d) {
|
|
this.f3137f.moveToPosition(i);
|
|
if (view == null) {
|
|
view = mo1387f(this.f3138g, this.f3137f, viewGroup);
|
|
}
|
|
mo1394d(view, this.f3138g, this.f3137f);
|
|
return view;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // android.widget.Filterable
|
|
public Filter getFilter() {
|
|
if (this.f3142k == null) {
|
|
this.f3142k = new C1418b(this);
|
|
}
|
|
return this.f3142k;
|
|
}
|
|
|
|
@Override // android.widget.Adapter
|
|
public Object getItem(int i) {
|
|
Cursor cursor;
|
|
if (!this.f3135d || (cursor = this.f3137f) == null) {
|
|
return null;
|
|
}
|
|
cursor.moveToPosition(i);
|
|
return this.f3137f;
|
|
}
|
|
|
|
@Override // android.widget.Adapter
|
|
public long getItemId(int i) {
|
|
Cursor cursor;
|
|
if (this.f3135d && (cursor = this.f3137f) != null && cursor.moveToPosition(i)) {
|
|
return this.f3137f.getLong(this.f3139h);
|
|
}
|
|
return 0L;
|
|
}
|
|
|
|
@Override // android.widget.Adapter
|
|
public View getView(int i, View view, ViewGroup viewGroup) {
|
|
if (this.f3135d) {
|
|
if (this.f3137f.moveToPosition(i)) {
|
|
if (view == null) {
|
|
view = mo1386g(this.f3138g, this.f3137f, viewGroup);
|
|
}
|
|
mo1394d(view, this.f3138g, this.f3137f);
|
|
return view;
|
|
}
|
|
throw new IllegalStateException("couldn't move cursor to position " + i);
|
|
}
|
|
throw new IllegalStateException("this should only be called when the cursor is valid");
|
|
}
|
|
|
|
/* renamed from: h */
|
|
public void m1392h() {
|
|
Cursor cursor;
|
|
if (!this.f3136e || (cursor = this.f3137f) == null || cursor.isClosed()) {
|
|
return;
|
|
}
|
|
this.f3135d = this.f3137f.requery();
|
|
}
|
|
|
|
/* renamed from: i */
|
|
public Cursor m1391i(Cursor cursor) {
|
|
Cursor cursor2 = this.f3137f;
|
|
if (cursor == cursor2) {
|
|
return null;
|
|
}
|
|
if (cursor2 != null) {
|
|
C1416a c1416a = this.f3140i;
|
|
if (c1416a != null) {
|
|
cursor2.unregisterContentObserver(c1416a);
|
|
}
|
|
DataSetObserver dataSetObserver = this.f3141j;
|
|
if (dataSetObserver != null) {
|
|
cursor2.unregisterDataSetObserver(dataSetObserver);
|
|
}
|
|
}
|
|
this.f3137f = cursor;
|
|
if (cursor != null) {
|
|
C1416a c1416a2 = this.f3140i;
|
|
if (c1416a2 != null) {
|
|
cursor.registerContentObserver(c1416a2);
|
|
}
|
|
DataSetObserver dataSetObserver2 = this.f3141j;
|
|
if (dataSetObserver2 != null) {
|
|
cursor.registerDataSetObserver(dataSetObserver2);
|
|
}
|
|
this.f3139h = cursor.getColumnIndexOrThrow("_id");
|
|
this.f3135d = true;
|
|
notifyDataSetChanged();
|
|
} else {
|
|
this.f3139h = -1;
|
|
this.f3135d = false;
|
|
notifyDataSetInvalidated();
|
|
}
|
|
return cursor2;
|
|
}
|
|
} |