what-the-bank/sources/o/FNY.java

82 lines
3.0 KiB
Java

package o;
import android.app.Activity;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.ContextWrapper;
import android.os.Build;
import android.text.Selection;
import android.text.Spannable;
import android.view.DragEvent;
import android.view.View;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import o.irq;
/* loaded from: classes.dex */
public final class FNY {
public static boolean gF_(TextView textView, int i) {
if (Build.VERSION.SDK_INT >= 31 || ViewCompat.s(textView) == null || !(i == 16908322 || i == 16908337)) {
return false;
}
ClipboardManager clipboardManager = (ClipboardManager) textView.getContext().getSystemService("clipboard");
ClipData primaryClip = clipboardManager == null ? null : clipboardManager.getPrimaryClip();
if (primaryClip != null && primaryClip.getItemCount() > 0) {
ViewCompat.c(textView, new irq.HBt(primaryClip, 1).b(i != 16908322 ? 1 : 0).b());
}
return true;
}
public static boolean gE_(View view, DragEvent dragEvent) {
Activity gG_;
if (Build.VERSION.SDK_INT >= 31 || dragEvent.getLocalState() != null || ViewCompat.s(view) == null || (gG_ = gG_(view)) == null) {
return false;
}
if (dragEvent.getAction() == 1) {
return !(view instanceof TextView);
}
if (dragEvent.getAction() == 3) {
if (view instanceof TextView) {
return IeS.gH_(dragEvent, (TextView) view, gG_);
}
return IeS.gI_(dragEvent, view, gG_);
}
return false;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static final class IeS {
static boolean gH_(DragEvent dragEvent, TextView textView, Activity activity) {
activity.requestDragAndDropPermissions(dragEvent);
int offsetForPosition = textView.getOffsetForPosition(dragEvent.getX(), dragEvent.getY());
textView.beginBatchEdit();
try {
Selection.setSelection((Spannable) textView.getText(), offsetForPosition);
ViewCompat.c(textView, new irq.HBt(dragEvent.getClipData(), 3).b());
textView.endBatchEdit();
return true;
} catch (Throwable th) {
textView.endBatchEdit();
throw th;
}
}
static boolean gI_(DragEvent dragEvent, View view, Activity activity) {
activity.requestDragAndDropPermissions(dragEvent);
ViewCompat.c(view, new irq.HBt(dragEvent.getClipData(), 3).b());
return true;
}
}
static Activity gG_(View view) {
for (Context context = view.getContext(); context instanceof ContextWrapper; context = ((ContextWrapper) context).getBaseContext()) {
if (context instanceof Activity) {
return (Activity) context;
}
}
return null;
}
}