Commit 06236e73 authored by 李增强's avatar 李增强

恢复

parent 8a4bc4e0
package com.pichillilorenzo.flutter_inappwebview;
import android.app.Activity;
import android.app.Application;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.webkit.ValueCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.pichillilorenzo.flutter_inappwebview.InAppWebView.FlutterWebViewFactory;
import io.flutter.embedding.engine.plugins.activity.ActivityAware;
......@@ -37,11 +32,10 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware {
public static ValueCallback<Uri> filePathCallbackLegacy;
public static ValueCallback<Uri[]> filePathCallback;
public InAppWebViewFlutterPlugin() {
}
public InAppWebViewFlutterPlugin() {}
public static void registerWith(PluginRegistry.Registrar registrar) {
final com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin instance = new com.pichillilorenzo.flutter_inappwebview.InAppWebViewFlutterPlugin();
final InAppWebViewFlutterPlugin instance = new InAppWebViewFlutterPlugin();
Shared.registrar = registrar;
instance.onAttachedToEngine(
registrar.context(), registrar.messenger(), registrar.activity(), registrar.platformViewRegistry(), registrar.view());
......@@ -69,7 +63,6 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware {
headlessInAppWebViewManager = new HeadlessInAppWebViewManager(messenger);
chromeSafariBrowserManager = new ChromeSafariBrowserManager(messenger);
platformViewRegistry.registerViewFactory(
"com.pichillilorenzo/flutter_inappwebview", new FlutterWebViewFactory(messenger, flutterView));
inAppWebViewStatic = new InAppWebViewStatic(messenger);
......@@ -117,45 +110,7 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware {
@Override
public void onAttachedToActivity(ActivityPluginBinding activityPluginBinding) {
Shared.activityPluginBinding = activityPluginBinding;
if (Shared.activity == null) {
Shared.activity = activityPluginBinding.getActivity();
activityPluginBinding.getActivity().getApplication().registerActivityLifecycleCallbacks(new Application.ActivityLifecycleCallbacks() {
@Override
public void onActivityCreated(@NonNull Activity activity, @Nullable Bundle bundle) {
Shared.activity = activity;
}
@Override
public void onActivityStarted(@NonNull Activity activity) {
Shared.activity = activity;
}
@Override
public void onActivityResumed(@NonNull Activity activity) {
Shared.activity = activity;
}
@Override
public void onActivityPaused(@NonNull Activity activity) {
Shared.activity = null;
}
@Override
public void onActivityStopped(@NonNull Activity activity) {
Shared.activity = null;
}
@Override
public void onActivitySaveInstanceState(@NonNull Activity activity, @NonNull Bundle bundle) {
Shared.activity = null;
}
@Override
public void onActivityDestroyed(@NonNull Activity activity) {
Shared.activity = null;
}
});
}
Shared.activity = activityPluginBinding.getActivity();
}
@Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment