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

恢复

parent 8a4bc4e0
package com.pichillilorenzo.flutter_inappwebview; package com.pichillilorenzo.flutter_inappwebview;
import android.app.Activity; import android.app.Activity;
import android.app.Application;
import android.content.Context; import android.content.Context;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.webkit.ValueCallback; import android.webkit.ValueCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.pichillilorenzo.flutter_inappwebview.InAppWebView.FlutterWebViewFactory; import com.pichillilorenzo.flutter_inappwebview.InAppWebView.FlutterWebViewFactory;
import io.flutter.embedding.engine.plugins.activity.ActivityAware; import io.flutter.embedding.engine.plugins.activity.ActivityAware;
...@@ -37,11 +32,10 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware { ...@@ -37,11 +32,10 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware {
public static ValueCallback<Uri> filePathCallbackLegacy; public static ValueCallback<Uri> filePathCallbackLegacy;
public static ValueCallback<Uri[]> filePathCallback; public static ValueCallback<Uri[]> filePathCallback;
public InAppWebViewFlutterPlugin() { public InAppWebViewFlutterPlugin() {}
}
public static void registerWith(PluginRegistry.Registrar registrar) { 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; Shared.registrar = registrar;
instance.onAttachedToEngine( instance.onAttachedToEngine(
registrar.context(), registrar.messenger(), registrar.activity(), registrar.platformViewRegistry(), registrar.view()); registrar.context(), registrar.messenger(), registrar.activity(), registrar.platformViewRegistry(), registrar.view());
...@@ -69,7 +63,6 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware { ...@@ -69,7 +63,6 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware {
headlessInAppWebViewManager = new HeadlessInAppWebViewManager(messenger); headlessInAppWebViewManager = new HeadlessInAppWebViewManager(messenger);
chromeSafariBrowserManager = new ChromeSafariBrowserManager(messenger); chromeSafariBrowserManager = new ChromeSafariBrowserManager(messenger);
platformViewRegistry.registerViewFactory( platformViewRegistry.registerViewFactory(
"com.pichillilorenzo/flutter_inappwebview", new FlutterWebViewFactory(messenger, flutterView)); "com.pichillilorenzo/flutter_inappwebview", new FlutterWebViewFactory(messenger, flutterView));
inAppWebViewStatic = new InAppWebViewStatic(messenger); inAppWebViewStatic = new InAppWebViewStatic(messenger);
...@@ -117,45 +110,7 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware { ...@@ -117,45 +110,7 @@ public class InAppWebViewFlutterPlugin implements FlutterPlugin, ActivityAware {
@Override @Override
public void onAttachedToActivity(ActivityPluginBinding activityPluginBinding) { public void onAttachedToActivity(ActivityPluginBinding activityPluginBinding) {
Shared.activityPluginBinding = activityPluginBinding; Shared.activityPluginBinding = activityPluginBinding;
if (Shared.activity == null) { Shared.activity = activityPluginBinding.getActivity();
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;
}
});
}
} }
@Override @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