90 lines
4.3 KiB
Java
90 lines
4.3 KiB
Java
package io.flutter.plugins.camera;
|
|
|
|
import android.app.Activity;
|
|
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.plugin.common.BinaryMessenger;
|
|
import io.flutter.plugin.common.PluginRegistry;
|
|
import io.flutter.plugins.camera.CameraPermissions;
|
|
import io.flutter.view.TextureRegistry;
|
|
import java.util.Objects;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public final class CameraPlugin implements FlutterPlugin, ActivityAware {
|
|
private static final String TAG = "CameraPlugin";
|
|
private FlutterPlugin.FlutterPluginBinding flutterPluginBinding;
|
|
private MethodCallHandlerImpl methodCallHandler;
|
|
|
|
public static void registerWith(final PluginRegistry.Registrar registrar) {
|
|
CameraPlugin cameraPlugin = new CameraPlugin();
|
|
Activity activity = registrar.activity();
|
|
BinaryMessenger messenger = registrar.messenger();
|
|
Objects.requireNonNull(registrar);
|
|
cameraPlugin.maybeStartListening(activity, messenger, new CameraPermissions.PermissionsRegistry(registrar) { // from class: io.flutter.plugins.camera.CameraPlugin$$ExternalSyntheticLambda1
|
|
public final PluginRegistry.Registrar f$0;
|
|
|
|
@Override // io.flutter.plugins.camera.CameraPermissions.PermissionsRegistry
|
|
public final void addListener(PluginRegistry.RequestPermissionsResultListener requestPermissionsResultListener) {
|
|
this.f$0.addRequestPermissionsResultListener(requestPermissionsResultListener);
|
|
}
|
|
|
|
{
|
|
this.f$0 = registrar;
|
|
}
|
|
}, registrar.view());
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
|
|
public final void onAttachedToActivity(final ActivityPluginBinding activityPluginBinding) {
|
|
Activity activity = activityPluginBinding.getActivity();
|
|
BinaryMessenger binaryMessenger = this.flutterPluginBinding.getBinaryMessenger();
|
|
Objects.requireNonNull(activityPluginBinding);
|
|
maybeStartListening(activity, binaryMessenger, new CameraPermissions.PermissionsRegistry(activityPluginBinding) { // from class: io.flutter.plugins.camera.CameraPlugin$$ExternalSyntheticLambda0
|
|
public final ActivityPluginBinding f$0;
|
|
|
|
@Override // io.flutter.plugins.camera.CameraPermissions.PermissionsRegistry
|
|
public final void addListener(PluginRegistry.RequestPermissionsResultListener requestPermissionsResultListener) {
|
|
this.f$0.addRequestPermissionsResultListener(requestPermissionsResultListener);
|
|
}
|
|
|
|
{
|
|
this.f$0 = activityPluginBinding;
|
|
}
|
|
}, this.flutterPluginBinding.getTextureRegistry());
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
|
|
public final void onDetachedFromActivity() {
|
|
MethodCallHandlerImpl methodCallHandlerImpl = this.methodCallHandler;
|
|
if (methodCallHandlerImpl != null) {
|
|
methodCallHandlerImpl.stopListening();
|
|
this.methodCallHandler = null;
|
|
}
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
|
|
public final void onReattachedToActivityForConfigChanges(ActivityPluginBinding activityPluginBinding) {
|
|
onAttachedToActivity(activityPluginBinding);
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.activity.ActivityAware
|
|
public final void onDetachedFromActivityForConfigChanges() {
|
|
onDetachedFromActivity();
|
|
}
|
|
|
|
private void maybeStartListening(Activity activity, BinaryMessenger binaryMessenger, CameraPermissions.PermissionsRegistry permissionsRegistry, TextureRegistry textureRegistry) {
|
|
this.methodCallHandler = new MethodCallHandlerImpl(activity, binaryMessenger, new CameraPermissions(), permissionsRegistry, textureRegistry);
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin
|
|
public final void onDetachedFromEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
|
|
this.flutterPluginBinding = null;
|
|
}
|
|
|
|
@Override // io.flutter.embedding.engine.plugins.FlutterPlugin
|
|
public final void onAttachedToEngine(FlutterPlugin.FlutterPluginBinding flutterPluginBinding) {
|
|
this.flutterPluginBinding = flutterPluginBinding;
|
|
}
|
|
}
|