-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[image_picker] support android V2 embedding #2430
Conversation
| @Override | ||
| public void onCreate(@NonNull LifecycleOwner owner) {} | ||
|
|
||
| @Override | ||
| public void onStart(@NonNull LifecycleOwner owner) {} | ||
|
|
||
| @Override | ||
| public void onResume(@NonNull LifecycleOwner owner) {} | ||
|
|
||
| @Override | ||
| public void onPause(@NonNull LifecycleOwner owner) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why override these empty methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ because it's implements, not extends. My mistake. This class does need all these empty methods defined still, sorry.
...ges/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java
Show resolved
Hide resolved
| private Application.ActivityLifecycleCallbacks activityLifecycleCallbacks; | ||
| private FlutterPluginBinding pluginBinding; | ||
| private ActivityPluginBinding activityBinding; | ||
| private Application applicationContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: An Application and an ApplicationContext are two separate things, so this naming is a little confusing. Do you really need this to be an Application, or are you just trying to get an ApplicationContext? If it's the latter I would just stick with a Context for the type here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need Application. I'll rename the variable as application
| // V1 embedding setup for activity listeners. | ||
| observer = new LifeCycleObserver(activity); | ||
| applicationContext.registerActivityLifecycleCallbacks( | ||
| observer); // Use getApplicationContext() to avoid casting failures. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: extra comment here
...ges/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java
Show resolved
Hide resolved
...er/example/android/app/src/main/java/io/flutter/plugins/imagepickerexample/MainActivity.java
Outdated
Show resolved
Hide resolved
packages/image_picker/example/test_driver/test/image_picker_e2e_test.dart
Show resolved
Hide resolved
|
Thank you cyanglaz. I tested it. It will solve the problem |
mklim
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM minus the compile failure from the removed empty methods.
| @Override | ||
| public void onCreate(@NonNull LifecycleOwner owner) {} | ||
|
|
||
| @Override | ||
| public void onStart(@NonNull LifecycleOwner owner) {} | ||
|
|
||
| @Override | ||
| public void onResume(@NonNull LifecycleOwner owner) {} | ||
|
|
||
| @Override | ||
| public void onPause(@NonNull LifecycleOwner owner) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️ because it's implements, not extends. My mistake. This class does need all these empty methods defined still, sorry.
...ges/image_picker/android/src/main/java/io/flutter/plugins/imagepicker/ImagePickerPlugin.java
Show resolved
Hide resolved
packages/image_picker/example/test_driver/test/image_picker_e2e_test.dart
Show resolved
Hide resolved
|
\o/ |
…acheing-01-08 * flutterPlugin/master: (30 commits) Update Gradle version (flutter#2448) [image_picker] support android V2 embedding (flutter#2430) [webview_flutter] Setup XCTests (flutter#2445) [video_player] Fixes video initialization future stall. (flutter#2134) [ci] Upgrade to Xcode 11.3 (flutter#2435) [In_app_purchases] migrate to Play Billing Library 2.0. (flutter#2287) Migrate away from deprecated `BinaryMessages` (flutter#2444) [google_sign_in]Update google_sign_in_example name in pubspec.yaml (flutter#2335) [ios_platform_images] Removed android support from the pubspec. (flutter#2432) [google_sign_in] Expose network error (flutter#2398) [battery] cleanup for Android embedding post 1.12 (flutter#2400) [flutter_webview] Raise min Flutter SDK to stable (flutter#2425) re-enable stable CI (flutter#2402) [in_app_purchase]Change a comment. (flutter#2329) [google_sign_in] Pass the client id to the platform interface. (flutter#2427) [ios_platform_images] Made ios_platform_images set the correct image scale. (flutter#2414) [url_launcher_platform_interface] use non static token for platform interface (flutter#2418) [plugin_platform_interface] Don't use const Object as a token (flutter#2417) Update endorsed macos plugins readme and update others (flutter#2407) [webview_flutter] add gesture navigation for iOS (flutter#2339) ... # Conflicts: # packages/video_player/video_player/CHANGELOG.md # packages/video_player/video_player/pubspec.yaml
flutter/flutter#41839
aside from migration, I also moved the code in onActivitySaveInstanceState to onStop to match with the
DefaultLifecycleObserver.I think onStop is enough for our needs in this plugin.