2021-12-17 21:59:34 +00:00
|
|
|
package b.b.a.d;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
import android.content.ContentResolver;
|
2021-11-02 06:38:17 +00:00
|
|
|
import android.content.ContentUris;
|
2021-07-24 02:37:17 +00:00
|
|
|
import android.content.Context;
|
|
|
|
import android.database.Cursor;
|
2021-11-02 06:38:17 +00:00
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import android.graphics.drawable.BitmapDrawable;
|
|
|
|
import android.graphics.drawable.ColorDrawable;
|
2021-07-24 02:37:17 +00:00
|
|
|
import android.net.Uri;
|
2021-11-02 06:38:17 +00:00
|
|
|
import android.os.AsyncTask;
|
2021-07-24 02:37:17 +00:00
|
|
|
import android.os.Build;
|
2021-11-02 06:38:17 +00:00
|
|
|
import android.os.CancellationSignal;
|
2021-07-24 02:37:17 +00:00
|
|
|
import android.provider.MediaStore;
|
|
|
|
import android.view.View;
|
2021-11-02 06:38:17 +00:00
|
|
|
import androidx.annotation.RequiresApi;
|
|
|
|
import androidx.core.app.NotificationCompat;
|
2021-07-24 02:37:17 +00:00
|
|
|
import androidx.recyclerview.widget.RecyclerView;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.f.g.e.r;
|
|
|
|
import b.f.g.e.s;
|
|
|
|
import b.i.a.f.e.o.f;
|
2021-11-02 06:38:17 +00:00
|
|
|
import com.discord.utilities.color.ColorCompat;
|
|
|
|
import com.facebook.drawee.drawable.ScalingUtils$ScaleType;
|
|
|
|
import com.facebook.drawee.generic.GenericDraweeHierarchy;
|
2021-07-24 02:37:17 +00:00
|
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
|
|
import com.lytefast.flexinput.R;
|
|
|
|
import com.lytefast.flexinput.model.Media;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.z.d.m;
|
|
|
|
import d0.z.d.o;
|
2021-07-24 02:37:17 +00:00
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
2021-11-02 06:38:17 +00:00
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlinx.coroutines.CoroutineDispatcher;
|
|
|
|
import kotlinx.coroutines.Job;
|
|
|
|
import s.a.a.n;
|
2021-12-02 18:53:44 +00:00
|
|
|
import s.a.k0;
|
|
|
|
import s.a.x0;
|
2021-11-02 06:38:17 +00:00
|
|
|
/* compiled from: ThumbnailViewHolder.kt */
|
|
|
|
public abstract class i extends RecyclerView.ViewHolder {
|
|
|
|
public static int j;
|
2021-12-02 18:53:44 +00:00
|
|
|
public static int k;
|
|
|
|
public static ColorDrawable l;
|
|
|
|
public static final a m = new a(null);
|
|
|
|
public b n;
|
|
|
|
public c o;
|
2021-11-02 06:38:17 +00:00
|
|
|
|
|
|
|
/* compiled from: ThumbnailViewHolder.kt */
|
|
|
|
public static final class a {
|
|
|
|
public a(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final boolean a(a aVar) {
|
|
|
|
return Build.VERSION.SDK_INT >= 29;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
/* compiled from: ThumbnailViewHolder.kt */
|
|
|
|
@RequiresApi(29)
|
|
|
|
public static final class b {
|
|
|
|
public Job a;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b reason: collision with root package name */
|
2022-01-21 08:24:42 +00:00
|
|
|
public CancellationSignal f316b;
|
2021-12-17 21:59:34 +00:00
|
|
|
public Bitmap c;
|
2021-11-02 06:38:17 +00:00
|
|
|
public final ContentResolver d;
|
|
|
|
|
|
|
|
public b(ContentResolver contentResolver) {
|
|
|
|
m.checkNotNullParameter(contentResolver, "contentResolver");
|
|
|
|
this.d = contentResolver;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
public final void a() {
|
2021-12-02 18:53:44 +00:00
|
|
|
if (a.a(i.m)) {
|
2021-11-02 06:38:17 +00:00
|
|
|
Job job = this.a;
|
|
|
|
if (job != null) {
|
2022-01-13 08:07:50 +00:00
|
|
|
f.t(job, null, 1, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2022-01-21 08:24:42 +00:00
|
|
|
CancellationSignal cancellationSignal = this.f316b;
|
2021-11-02 06:38:17 +00:00
|
|
|
if (cancellationSignal != null) {
|
|
|
|
cancellationSignal.cancel();
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 21:59:34 +00:00
|
|
|
Bitmap bitmap = this.c;
|
2021-11-02 06:38:17 +00:00
|
|
|
if (bitmap != null) {
|
|
|
|
bitmap.recycle();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2021-12-17 21:59:34 +00:00
|
|
|
this.c = null;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
/* compiled from: ThumbnailViewHolder.kt */
|
|
|
|
public static final class c {
|
|
|
|
public final ContentResolver a;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
public c(ContentResolver contentResolver) {
|
|
|
|
m.checkNotNullParameter(contentResolver, "contentResolver");
|
|
|
|
this.a = contentResolver;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
/* compiled from: ThumbnailViewHolder.kt */
|
|
|
|
public static final class d extends o implements Function1<Bitmap, Unit> {
|
|
|
|
public final /* synthetic */ i this$0;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public d(i iVar) {
|
|
|
|
super(1);
|
|
|
|
this.this$0 = iVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
|
|
@Override // kotlin.jvm.functions.Function1
|
|
|
|
public Unit invoke(Bitmap bitmap) {
|
|
|
|
BitmapDrawable bitmapDrawable = new BitmapDrawable(this.this$0.a().getResources(), bitmap);
|
|
|
|
GenericDraweeHierarchy hierarchy = this.this$0.a().getHierarchy();
|
|
|
|
ScalingUtils$ScaleType scalingUtils$ScaleType = ScalingUtils$ScaleType.a;
|
|
|
|
ScalingUtils$ScaleType scalingUtils$ScaleType2 = s.l;
|
|
|
|
hierarchy.o(1, bitmapDrawable);
|
|
|
|
hierarchy.l(1).r(scalingUtils$ScaleType2);
|
|
|
|
return Unit.a;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public i(View view) {
|
|
|
|
super(view);
|
|
|
|
m.checkNotNullParameter(view, "itemView");
|
|
|
|
if (Build.VERSION.SDK_INT >= 29) {
|
|
|
|
Context context = view.getContext();
|
|
|
|
m.checkNotNullExpressionValue(context, "itemView.context");
|
|
|
|
ContentResolver contentResolver = context.getContentResolver();
|
|
|
|
m.checkNotNullExpressionValue(contentResolver, "itemView.context.contentResolver");
|
2021-12-02 18:53:44 +00:00
|
|
|
this.n = new b(contentResolver);
|
2021-11-02 06:38:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
Context context2 = view.getContext();
|
|
|
|
m.checkNotNullExpressionValue(context2, "itemView.context");
|
|
|
|
ContentResolver contentResolver2 = context2.getContentResolver();
|
|
|
|
m.checkNotNullExpressionValue(contentResolver2, "itemView.context.contentResolver");
|
2021-12-02 18:53:44 +00:00
|
|
|
this.o = new c(contentResolver2);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
public abstract SimpleDraweeView a();
|
2021-07-24 02:37:17 +00:00
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
public final void b() {
|
|
|
|
b bVar;
|
2021-12-02 18:53:44 +00:00
|
|
|
if ((Build.VERSION.SDK_INT >= 29) && (bVar = this.n) != null) {
|
2021-11-02 06:38:17 +00:00
|
|
|
bVar.a();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 06:38:17 +00:00
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:30:0x00c9, code lost:
|
|
|
|
r13 = move-exception;
|
|
|
|
*/
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:31:0x00ca, code lost:
|
|
|
|
d0.y.b.closeFinally(r0, r12);
|
|
|
|
*/
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:32:0x00cd, code lost:
|
|
|
|
throw r13;
|
|
|
|
*/
|
|
|
|
public final void c(Media media, Integer num, Integer num2) {
|
2021-12-02 18:53:44 +00:00
|
|
|
if (l == null) {
|
2021-11-02 06:38:17 +00:00
|
|
|
View view = this.itemView;
|
|
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
2021-12-02 18:53:44 +00:00
|
|
|
l = new ColorDrawable(ColorCompat.getThemedColor(view, R.b.flexInputDialogBackground));
|
2021-11-02 06:38:17 +00:00
|
|
|
}
|
|
|
|
if (num != null) {
|
2021-12-02 18:53:44 +00:00
|
|
|
j = num.intValue();
|
2021-11-02 06:38:17 +00:00
|
|
|
}
|
|
|
|
if (num2 != null) {
|
2021-12-02 18:53:44 +00:00
|
|
|
k = num2.intValue();
|
2021-11-02 06:38:17 +00:00
|
|
|
}
|
|
|
|
if (media != null) {
|
|
|
|
Uri uri = null;
|
|
|
|
if (Build.VERSION.SDK_INT >= 29) {
|
2021-12-02 18:53:44 +00:00
|
|
|
ColorDrawable colorDrawable = l;
|
2021-11-02 06:38:17 +00:00
|
|
|
ScalingUtils$ScaleType scalingUtils$ScaleType = ScalingUtils$ScaleType.a;
|
|
|
|
a().getHierarchy().q(colorDrawable, r.l);
|
2021-12-02 18:53:44 +00:00
|
|
|
b bVar = this.n;
|
2021-11-02 06:38:17 +00:00
|
|
|
if (bVar != null) {
|
|
|
|
Uri uri2 = media.getUri();
|
|
|
|
d dVar = new d(this);
|
|
|
|
m.checkNotNullParameter(uri2, NotificationCompat.MessagingStyle.Message.KEY_DATA_URI);
|
|
|
|
m.checkNotNullParameter(dVar, "onGenerate");
|
|
|
|
bVar.a();
|
2021-12-02 18:53:44 +00:00
|
|
|
x0 x0Var = x0.j;
|
|
|
|
CoroutineDispatcher coroutineDispatcher = k0.a;
|
2022-01-22 08:57:18 +00:00
|
|
|
bVar.a = f.H0(x0Var, n.f3797b, null, new j(bVar, uri2, dVar, null), 2, null);
|
2021-11-02 06:38:17 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-07-24 02:37:17 +00:00
|
|
|
return;
|
|
|
|
}
|
2021-12-02 18:53:44 +00:00
|
|
|
c cVar = this.o;
|
2021-11-02 06:38:17 +00:00
|
|
|
if (cVar != null) {
|
|
|
|
long id2 = media.getId();
|
|
|
|
Uri uri3 = media.getUri();
|
|
|
|
m.checkNotNullParameter(uri3, NotificationCompat.MessagingStyle.Message.KEY_DATA_URI);
|
|
|
|
m mVar = new m(id2);
|
|
|
|
Cursor query = cVar.a.query(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, new String[]{"_id"}, "image_id = ? AND KIND = ?", new String[]{String.valueOf(id2), String.valueOf(1)}, null);
|
|
|
|
if (query == null || !query.moveToFirst()) {
|
|
|
|
ContentResolver contentResolver = cVar.a;
|
|
|
|
m.checkNotNullParameter(contentResolver, "contentResolver");
|
|
|
|
AsyncTask.execute(new l(mVar, contentResolver));
|
|
|
|
if (query != null) {
|
|
|
|
query.close();
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2021-11-02 06:38:17 +00:00
|
|
|
} else {
|
|
|
|
uri3 = ContentUris.withAppendedId(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, query.getLong(0));
|
|
|
|
d0.y.b.closeFinally(query, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2021-11-02 06:38:17 +00:00
|
|
|
uri = uri3;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
2021-11-02 06:38:17 +00:00
|
|
|
a().setImageURI(uri, a().getContext());
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|