package o;

import android.app.Activity;
import android.content.ClipData;
import android.os.Build;
import android.text.Selection;
import android.text.Spannable;
import android.view.DragEvent;
import android.view.View;
import android.widget.TextView;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.g8, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC1266g8 {
    public static boolean a(DragEvent dragEvent, TextView textView, Activity activity) {
        InterfaceC1986nm od;
        activity.requestDragAndDropPermissions(dragEvent);
        int offsetForPosition = textView.getOffsetForPosition(dragEvent.getX(), dragEvent.getY());
        textView.beginBatchEdit();
        try {
            Selection.setSelection((Spannable) textView.getText(), offsetForPosition);
            ClipData clipData = dragEvent.getClipData();
            if (Build.VERSION.SDK_INT >= 31) {
                od = new OD(clipData, 3);
            } else {
                C2081om c2081om = new C2081om();
                c2081om.m = clipData;
                c2081om.n = 3;
                od = c2081om;
            }
            Oj0.i(textView, od.build());
            textView.endBatchEdit();
            return true;
        } catch (Throwable th) {
            textView.endBatchEdit();
            throw th;
        }
    }

    public static boolean b(DragEvent dragEvent, View view, Activity activity) {
        InterfaceC1986nm od;
        activity.requestDragAndDropPermissions(dragEvent);
        ClipData clipData = dragEvent.getClipData();
        if (Build.VERSION.SDK_INT >= 31) {
            od = new OD(clipData, 3);
        } else {
            C2081om c2081om = new C2081om();
            c2081om.m = clipData;
            c2081om.n = 3;
            od = c2081om;
        }
        Oj0.i(view, od.build());
        return true;
    }
}
