262 lines
10 KiB
Java
262 lines
10 KiB
Java
|
package com.mr.flutter.plugin.filepicker;
|
||
|
|
||
|
import android.app.Activity;
|
||
|
import android.app.Application;
|
||
|
import android.os.Bundle;
|
||
|
import android.os.Handler;
|
||
|
import android.os.Looper;
|
||
|
import androidx.lifecycle.DefaultLifecycleObserver;
|
||
|
import io.flutter.embedding.engine.plugins.FlutterPlugin;
|
||
|
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
|
||
|
import io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding;
|
||
|
import io.flutter.embedding.engine.plugins.lifecycle.FlutterLifecycleAdapter;
|
||
|
import io.flutter.plugin.common.BinaryMessenger;
|
||
|
import io.flutter.plugin.common.EventChannel;
|
||
|
import io.flutter.plugin.common.MethodChannel;
|
||
|
import o.C0599Kie;
|
||
|
import o.InterfaceC16541pFg;
|
||
|
import o.wdQ;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class FilePickerPlugin implements MethodChannel.MethodCallHandler, FlutterPlugin, ActivityAware {
|
||
|
private static boolean b = false;
|
||
|
private static String d = null;
|
||
|
private static boolean e = false;
|
||
|
private ActivityPluginBinding a;
|
||
|
private Activity c;
|
||
|
private MethodChannel f;
|
||
|
private LifeCycleObserver g;
|
||
|
private wdQ h;
|
||
|
private Application i;
|
||
|
private C0599Kie j;
|
||
|
private FlutterPlugin.FlutterPluginBinding n;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class LifeCycleObserver implements Application.ActivityLifecycleCallbacks, DefaultLifecycleObserver {
|
||
|
private final Activity c;
|
||
|
private FilePickerPlugin e;
|
||
|
|
||
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||
|
public void onActivityCreated(Activity activity, Bundle bundle) {
|
||
|
}
|
||
|
|
||
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||
|
public void onActivityPaused(Activity activity) {
|
||
|
}
|
||
|
|
||
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||
|
public void onActivityResumed(Activity activity) {
|
||
|
}
|
||
|
|
||
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||
|
public void onActivitySaveInstanceState(Activity activity, Bundle bundle) {
|
||
|
}
|
||
|
|
||
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||
|
public void onActivityStarted(Activity activity) {
|
||
|
}
|
||
|
|
||
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||
|
public void onActivityStopped(Activity activity) {
|
||
|
}
|
||
|
|
||
|
@Override // androidx.lifecycle.DefaultLifecycleObserver, o.InterfaceC15806ikR
|
||
|
public void onCreate(InterfaceC16541pFg interfaceC16541pFg) {
|
||
|
}
|
||
|
|
||
|
@Override // androidx.lifecycle.DefaultLifecycleObserver, o.InterfaceC15806ikR
|
||
|
public void onPause(InterfaceC16541pFg interfaceC16541pFg) {
|
||
|
}
|
||
|
|
||
|
@Override // androidx.lifecycle.DefaultLifecycleObserver, o.InterfaceC15806ikR
|
||
|
public void onResume(InterfaceC16541pFg interfaceC16541pFg) {
|
||
|
}
|
||
|
|
||
|
@Override // androidx.lifecycle.DefaultLifecycleObserver, o.InterfaceC15806ikR
|
||
|
public void onStart(InterfaceC16541pFg interfaceC16541pFg) {
|
||
|
}
|
||
|
|
||
|
LifeCycleObserver(FilePickerPlugin filePickerPlugin, Activity activity) {
|
||
|
this.e = filePickerPlugin;
|
||
|
this.c = activity;
|
||
|
}
|
||
|
|
||
|
@Override // androidx.lifecycle.DefaultLifecycleObserver, o.InterfaceC15806ikR
|
||
|
public void onStop(InterfaceC16541pFg interfaceC16541pFg) {
|
||
|
onActivityStopped(this.c);
|
||
|
}
|
||
|
|
||
|
@Override // androidx.lifecycle.DefaultLifecycleObserver, o.InterfaceC15806ikR
|
||
|
public void onDestroy(InterfaceC16541pFg interfaceC16541pFg) {
|
||
|
onActivityDestroyed(this.c);
|
||
|
}
|
||
|
|
||
|
@Override // android.app.Application.ActivityLifecycleCallbacks
|
||
|
public void onActivityDestroyed(Activity activity) {
|
||
|
if (this.c != activity || activity.getApplicationContext() == null) {
|
||
|
return;
|
||
|
}
|
||
|
((Application) activity.getApplicationContext()).unregisterActivityLifecycleCallbacks(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:34:0x012e */
|
||
|
/* JADX WARN: Removed duplicated region for block: B:36:0x0136 */
|
||
|
@Override // io.flutter.plugin.common.MethodChannel.MethodCallHandler
|
||
|
/*
|
||
|
Code decompiled incorrectly, please refer to instructions dump.
|
||
|
To view partially-correct add '--show-bad-code' argument
|
||
|
*/
|
||
|
public void onMethodCall(io.flutter.plugin.common.MethodCall r9, io.flutter.plugin.common.MethodChannel.Result r10) {
|
||
|
/*
|
||
|
Method dump skipped, instructions count: 396
|
||
|
To view this dump add '--comments-level debug' option
|
||
|
*/
|
||
|
throw new UnsupportedOperationException("Method not decompiled: com.mr.flutter.plugin.filepicker.FilePickerPlugin.onMethodCall(io.flutter.plugin.common.MethodCall, io.flutter.plugin.common.MethodChannel$Result):void");
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
static class IeS implements MethodChannel.Result {
|
||
|
private final Handler a = new Handler(Looper.getMainLooper());
|
||
|
private final MethodChannel.Result b;
|
||
|
|
||
|
IeS(MethodChannel.Result result) {
|
||
|
this.b = result;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.common.MethodChannel.Result
|
||
|
public final void success(Object obj) {
|
||
|
this.a.post(new Runnable(this, obj) { // from class: com.mr.flutter.plugin.filepicker.FilePickerPlugin.IeS.5
|
||
|
private Object a;
|
||
|
private IeS e;
|
||
|
|
||
|
{
|
||
|
this.e = this;
|
||
|
this.a = obj;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
this.e.b.success(this.a);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.common.MethodChannel.Result
|
||
|
public final void error(String str, String str2, Object obj) {
|
||
|
this.a.post(new Runnable(this, str, str2, obj) { // from class: com.mr.flutter.plugin.filepicker.FilePickerPlugin.IeS.2
|
||
|
private Object a;
|
||
|
private String b;
|
||
|
private IeS c;
|
||
|
private String d;
|
||
|
|
||
|
{
|
||
|
this.c = this;
|
||
|
this.b = str;
|
||
|
this.d = str2;
|
||
|
this.a = obj;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
this.c.b.error(this.b, this.d, this.a);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.common.MethodChannel.Result
|
||
|
public final void notImplemented() {
|
||
|
this.a.post(new Runnable(this) { // from class: com.mr.flutter.plugin.filepicker.FilePickerPlugin.IeS.3
|
||
|
private IeS e;
|
||
|
|
||
|
{
|
||
|
this.e = this;
|
||
|
}
|
||
|
|
||
|
@Override // java.lang.Runnable
|
||
|
public final void run() {
|
||
|
this.e.b.notImplemented();
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
|
||
|
public void onAttachedToActivity(ActivityPluginBinding activityPluginBinding) {
|
||
|
this.a = activityPluginBinding;
|
||
|
BinaryMessenger binaryMessenger = this.n.getBinaryMessenger();
|
||
|
Application application = (Application) this.n.getApplicationContext();
|
||
|
Activity activity = this.a.getActivity();
|
||
|
ActivityPluginBinding activityPluginBinding2 = this.a;
|
||
|
this.c = activity;
|
||
|
this.i = application;
|
||
|
this.j = new C0599Kie(activity);
|
||
|
MethodChannel methodChannel = new MethodChannel(binaryMessenger, "miguelruivo.flutter.plugins.filepicker");
|
||
|
this.f = methodChannel;
|
||
|
methodChannel.setMethodCallHandler(this);
|
||
|
new EventChannel(binaryMessenger, "miguelruivo.flutter.plugins.filepickerevent").setStreamHandler(new EventChannel.StreamHandler(this) { // from class: com.mr.flutter.plugin.filepicker.FilePickerPlugin.1
|
||
|
private FilePickerPlugin e;
|
||
|
|
||
|
{
|
||
|
this.e = this;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.common.EventChannel.StreamHandler
|
||
|
public final void onListen(Object obj, EventChannel.EventSink eventSink) {
|
||
|
this.e.j.c = eventSink;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.plugin.common.EventChannel.StreamHandler
|
||
|
public final void onCancel(Object obj) {
|
||
|
this.e.j.c = null;
|
||
|
}
|
||
|
});
|
||
|
this.g = new LifeCycleObserver(this, activity);
|
||
|
activityPluginBinding2.addActivityResultListener(this.j);
|
||
|
activityPluginBinding2.addRequestPermissionsResultListener(this.j);
|
||
|
wdQ activityLifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityPluginBinding2);
|
||
|
this.h = activityLifecycle;
|
||
|
activityLifecycle.e(this.g);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
|
||
|
public void onDetachedFromActivityForConfigChanges() {
|
||
|
onDetachedFromActivity();
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
|
||
|
public void onReattachedToActivityForConfigChanges(ActivityPluginBinding activityPluginBinding) {
|
||
|
onAttachedToActivity(activityPluginBinding);
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
|
||
|
public void onDetachedFromActivity() {
|
||
|
this.a.removeActivityResultListener(this.j);
|
||
|
this.a.removeRequestPermissionsResultListener(this.j);
|
||
|
this.a = null;
|
||
|
LifeCycleObserver lifeCycleObserver = this.g;
|
||
|
if (lifeCycleObserver != null) {
|
||
|
this.h.a(lifeCycleObserver);
|
||
|
this.i.unregisterActivityLifecycleCallbacks(this.g);
|
||
|
}
|
||
|
this.h = null;
|
||
|
this.j.c = null;
|
||
|
this.j = null;
|
||
|
this.f.setMethodCallHandler(null);
|
||
|
this.f = null;
|
||
|
this.i = null;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin
|
||
|
public void onDetachedFromEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
|
||
|
this.n = null;
|
||
|
}
|
||
|
|
||
|
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin
|
||
|
public void onAttachedToEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
|
||
|
this.n = flutterPluginBinding;
|
||
|
}
|
||
|
}
|