io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding Java Examples

The following examples show how to use io.flutter.embedding.engine.plugins.activity.ActivityPluginBinding. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QrMobileVisionPlugin.java    From flutter_qr_mobile_vision with MIT License 6 votes vote down vote up
private void performRegistration(boolean isVersion1Embedding, Registrar registrar, FlutterPluginBinding flutterPluginBinding, ActivityPluginBinding activityPluginBinding) {
    Log.i(TAG, "Plugin Registration being performed: " +
        "isVersion1Embedding " + isVersion1Embedding +
        ", registrar " + registrar +
        ", flutterPluginBinding " + flutterPluginBinding +
        ", activityPluginBinding " + activityPluginBinding);

    BinaryMessenger messenger;
    if (isVersion1Embedding) {
        messenger = registrar.messenger();
        activity = registrar.activity();
        textures = registrar.textures();
        registrar.addRequestPermissionsResultListener(this);
    } else {
        messenger = flutterPluginBinding.getBinaryMessenger();
        activity = activityPluginBinding.getActivity();
        textures = flutterPluginBinding.getTextureRegistry();
        activityPluginBinding.addRequestPermissionsResultListener(this);
    }
    channel = new MethodChannel(messenger, "com.github.rmtmckenzie/qr_mobile_vision");
    channel.setMethodCallHandler(this);
}
 
Example #2
Source File: FlutterMobileVisionPlugin.java    From flutter_mobile_vision with MIT License 6 votes vote down vote up
private void setup(
        final BinaryMessenger messenger,

        final Activity activity,
        final PluginRegistry.Registrar registrar,
        final ActivityPluginBinding activityBinding) {
    this.activity = activity;
    this.delegate = new FlutterMobileVisionDelegate(activity);
    channel = new MethodChannel(messenger, CHANNEL);
    channel.setMethodCallHandler(this);
    if (registrar != null) {
        // V1 embedding setup for activity listeners.
        registrar.addActivityResultListener(delegate);
        registrar.addRequestPermissionsResultListener(delegate);
    } else {
        // V2 embedding setup for activity listeners.
        activityBinding.addActivityResultListener(delegate);
        activityBinding.addRequestPermissionsResultListener(delegate);
    }
}
 
Example #3
Source File: FlutterAudioQueryPlugin.java    From flutter_audio_query with MIT License 5 votes vote down vote up
@Override
public void onAttachedToActivity(ActivityPluginBinding binding) {
      m_activityBinding = binding;
      Log.i("AUDIO_QUERY", "Using V2 EMBEDDING:: activity = " + binding.getActivity() );
      setup(
              m_pluginBinding.getBinaryMessenger(),
              (Application) m_pluginBinding.getApplicationContext(),

              m_activityBinding.getActivity(),
              null,
              m_activityBinding
      );
}
 
Example #4
Source File: OpenFilePlugin.java    From open_file with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onAttachedToActivity(ActivityPluginBinding binding) {
    channel =
            new MethodChannel(
                    flutterPluginBinding.getBinaryMessenger(), "open_file");
    context = flutterPluginBinding.getApplicationContext();
    activity = binding.getActivity();
    channel.setMethodCallHandler(this);
    binding.addRequestPermissionsResultListener(this);
    binding.addActivityResultListener(this);
}
 
Example #5
Source File: FlutterMobileVisionPlugin.java    From flutter_mobile_vision with MIT License 5 votes vote down vote up
@Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
    activityBinding = binding;
    setup(pluginBinding.getBinaryMessenger(),
            activityBinding.getActivity(),
            null,
            activityBinding);
}
 
Example #6
Source File: FlutterBarcodeScannerPlugin.java    From flutter_barcode_scanner with MIT License 5 votes vote down vote up
/**
 * Setup method
 * Created after Embedding V2 API release
 *
 * @param messenger
 * @param applicationContext
 * @param activity
 * @param registrar
 * @param activityBinding
 */
private void createPluginSetup(
        final BinaryMessenger messenger,
        final Application applicationContext,
        final Activity activity,
        final PluginRegistry.Registrar registrar,
        final ActivityPluginBinding activityBinding) {


    this.activity = (FlutterActivity) activity;
    eventChannel =
            new EventChannel(messenger, "flutter_barcode_scanner_receiver");
    eventChannel.setStreamHandler(this);


    this.applicationContext = applicationContext;
    channel = new MethodChannel(messenger, CHANNEL);
    channel.setMethodCallHandler(this);
    if (registrar != null) {
        // V1 embedding setup for activity listeners.
        observer = new LifeCycleObserver(activity);
        applicationContext.registerActivityLifecycleCallbacks(
                observer); // Use getApplicationContext() to avoid casting failures.
        registrar.addActivityResultListener(this);
    } else {
        // V2 embedding setup for activity listeners.
        activityBinding.addActivityResultListener(this);
        lifecycle = FlutterLifecycleAdapter.getActivityLifecycle(activityBinding);
        observer = new LifeCycleObserver(activity);
        lifecycle.addObserver(observer);
    }
}
 
Example #7
Source File: FlutterBarcodeScannerPlugin.java    From flutter_barcode_scanner with MIT License 5 votes vote down vote up
@Override
public void onAttachedToActivity(ActivityPluginBinding binding) {
    activityBinding = binding;
    createPluginSetup(
            pluginBinding.getBinaryMessenger(),
            (Application) pluginBinding.getApplicationContext(),
            activityBinding.getActivity(),
            null,
            activityBinding);
}
 
Example #8
Source File: SquareReaderSdkFlutterPlugin.java    From reader-sdk-flutter-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding activityPluginBinding) {
  setContextForModules(activityPluginBinding.getActivity());
}
 
Example #9
Source File: QrMobileVisionPlugin.java    From flutter_qr_mobile_vision with MIT License 4 votes vote down vote up
private void performV2Registration(FlutterPluginBinding flutterPluginBinding, ActivityPluginBinding activityPluginBinding) {
    performRegistration(false, null, flutterPluginBinding, activityPluginBinding);
}
 
Example #10
Source File: QrMobileVisionPlugin.java    From flutter_qr_mobile_vision with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
    onAttachedToActivity(binding);
}
 
Example #11
Source File: QrMobileVisionPlugin.java    From flutter_qr_mobile_vision with MIT License 4 votes vote down vote up
@Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
    performV2Registration(flutterPluginBinding, binding);
}
 
Example #12
Source File: OpenFilePlugin.java    From open_file with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {
    onAttachedToActivity(binding);
}
 
Example #13
Source File: FlutterBraintreePlugin.java    From FlutterBraintree with MIT License 4 votes vote down vote up
@Override
public void onAttachedToActivity(ActivityPluginBinding binding) {
  activity = binding.getActivity();
  binding.addActivityResultListener(this);
  dropIn.onAttachedToActivity(binding);
}
 
Example #14
Source File: FlutterMobileVisionPlugin.java    From flutter_mobile_vision with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
    onAttachedToActivity(binding);
}
 
Example #15
Source File: FlutterBraintreePlugin.java    From FlutterBraintree with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {
  activity = binding.getActivity();
  binding.addActivityResultListener(this);
  dropIn.onReattachedToActivityForConfigChanges(binding);
}
 
Example #16
Source File: ZendeskPlugin.java    From flutter-zendesk with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
  methodCallHandler.setActivity(binding.getActivity());
}
 
Example #17
Source File: ZendeskPlugin.java    From flutter-zendesk with MIT License 4 votes vote down vote up
@Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
  methodCallHandler.setActivity(binding.getActivity());
}
 
Example #18
Source File: FlutterBraintreeDropIn.java    From FlutterBraintree with MIT License 4 votes vote down vote up
@Override
public void onAttachedToActivity(ActivityPluginBinding binding) {
  activity = binding.getActivity();
  binding.addActivityResultListener(this);
}
 
Example #19
Source File: SquareReaderSdkFlutterPlugin.java    From reader-sdk-flutter-plugin with Apache License 2.0 4 votes vote down vote up
@Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding activityPluginBinding) {
  setContextForModules(activityPluginBinding.getActivity());
}
 
Example #20
Source File: FlutterAudioQueryPlugin.java    From flutter_audio_query with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {
    onAttachedToActivity(binding);
}
 
Example #21
Source File: FlutterBarcodeScannerPlugin.java    From flutter_barcode_scanner with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {
    onAttachedToActivity(binding);
}
 
Example #22
Source File: ContactsServicePlugin.java    From flutter_contacts with MIT License 4 votes vote down vote up
void bindToActivity(ActivityPluginBinding activityPluginBinding) {
  this.activityPluginBinding = activityPluginBinding;
  this.activityPluginBinding.addActivityResultListener(this);
}
 
Example #23
Source File: ContactsServicePlugin.java    From flutter_contacts with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {
  if (delegate instanceof  ContactServiceDelegate) {
    ((ContactServiceDelegate) delegate).bindToActivity(binding);
  }
}
 
Example #24
Source File: ContactsServicePlugin.java    From flutter_contacts with MIT License 4 votes vote down vote up
@Override
public void onAttachedToActivity(ActivityPluginBinding binding) {
  if (delegate instanceof  ContactServiceDelegate) {
    ((ContactServiceDelegate) delegate).bindToActivity(binding);
  }
}
 
Example #25
Source File: RazorpayFlutterPlugin.java    From razorpay-flutter with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
    onAttachedToActivity(binding);
}
 
Example #26
Source File: RazorpayFlutterPlugin.java    From razorpay-flutter with MIT License 4 votes vote down vote up
@Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
    this.razorpayDelegate = new RazorpayDelegate(binding.getActivity());
    this.pluginBinding = binding;
    binding.addActivityResultListener(razorpayDelegate);
}
 
Example #27
Source File: SocialSharePlugin.java    From social_share_plugin with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBinding binding) {
    binding.removeActivityResultListener(this);
    binding.addActivityResultListener(this);
}
 
Example #28
Source File: SocialSharePlugin.java    From social_share_plugin with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public void onAttachedToActivity(@NonNull ActivityPluginBinding binding) {
    binding.addActivityResultListener(this);
    this.activity = binding.getActivity();
}
 
Example #29
Source File: FlutterBraintreeDropIn.java    From FlutterBraintree with MIT License 4 votes vote down vote up
@Override
public void onReattachedToActivityForConfigChanges(ActivityPluginBinding binding) {
  activity = binding.getActivity();
  binding.addActivityResultListener(this);
}