This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[battery] Support the v2 Android embedder #2152
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
10cc6a1
migrate the example app to AndroidX
amirh 0e5d91e
[battery] Support the v2 Android embedder.
amirh f593806
Bump the minor version instead of patch version
amirh ed9195c
review fixes
amirh 6a5ea5d
add e2e tests, update flutter constraints in pubspec
amirh 541b33b
Merge branch 'master' into battery_embedder_v2
amirh 09b940f
fix analyzer warnings
amirh 682687f
add TODO to remove gradle hack
amirh b90f434
move the e2e test out of the example app folder and make it test some…
amirh 5b898e6
add missing license header
amirh 58d7721
remove driver boilerplate, change TODO to my name, better name for th…
amirh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| ## 0.3.1 | ||
|
|
||
| * Support the v2 Android embedder. | ||
|
|
||
| ## 0.3.0+6 | ||
|
|
||
| * Define clang module for iOS. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...e/android/app/src/androidTest/java/io/flutter/plugins/battery/EmbedderV1ActivityTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright 2019 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| package io.flutter.plugins.batteryexample; | ||
|
|
||
| import androidx.test.rule.ActivityTestRule; | ||
| import dev.flutter.plugins.e2e.FlutterRunner; | ||
| import org.junit.Rule; | ||
| import org.junit.runner.RunWith; | ||
|
|
||
| @RunWith(FlutterRunner.class) | ||
| public class EmbedderV1ActivityTest { | ||
| @Rule | ||
| public ActivityTestRule<EmbedderV1Activity> rule = | ||
| new ActivityTestRule<>(EmbedderV1Activity.class); | ||
| } |
15 changes: 15 additions & 0 deletions
15
...example/android/app/src/androidTest/java/io/flutter/plugins/battery/MainActivityTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| // Copyright 2019 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| package io.flutter.plugins.batteryexample; | ||
|
|
||
| import androidx.test.rule.ActivityTestRule; | ||
| import dev.flutter.plugins.e2e.FlutterRunner; | ||
| import org.junit.Rule; | ||
| import org.junit.runner.RunWith; | ||
|
|
||
| @RunWith(FlutterRunner.class) | ||
| public class MainActivityTest { | ||
| @Rule public ActivityTestRule<MainActivity> rule = new ActivityTestRule<>(MainActivity.class); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
...ample/android/app/src/main/java/io/flutter/plugins/batteryexample/EmbedderV1Activity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright 2017 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| package io.flutter.plugins.batteryexample; | ||
|
|
||
| import android.os.Bundle; | ||
| import io.flutter.app.FlutterActivity; | ||
| import io.flutter.plugins.GeneratedPluginRegistrant; | ||
|
|
||
| public class EmbedderV1Activity extends FlutterActivity { | ||
| @Override | ||
| protected void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| GeneratedPluginRegistrant.registerWith(this); | ||
| } | ||
| } |
13 changes: 6 additions & 7 deletions
13
...ery/example/android/app/src/main/java/io/flutter/plugins/batteryexample/MainActivity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,16 @@ | ||
| // Copyright 2017 The Chromium Authors. All rights reserved. | ||
| // Copyright 2019 The Chromium Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| package io.flutter.plugins.batteryexample; | ||
|
|
||
| import android.os.Bundle; | ||
| import io.flutter.app.FlutterActivity; | ||
| import io.flutter.plugins.GeneratedPluginRegistrant; | ||
| import io.flutter.embedding.android.FlutterActivity; | ||
| import io.flutter.embedding.engine.FlutterEngine; | ||
| import io.flutter.plugins.battery.BatteryPlugin; | ||
|
|
||
| public class MainActivity extends FlutterActivity { | ||
| @Override | ||
| protected void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| GeneratedPluginRegistrant.registerWith(this); | ||
| public void configureFlutterEngine(FlutterEngine flutterEngine) { | ||
| flutterEngine.getPlugins().add(new BatteryPlugin()); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| org.gradle.jvmargs=-Xmx1536M | ||
| android.enableR8=true | ||
| android.useAndroidX=true | ||
collinjackson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| android.enableJetifier=true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ description: Flutter plugin for accessing information about the battery state | |
| (full, charging, discharging) on Android and iOS. | ||
| author: Flutter Team <[email protected]> | ||
| homepage: https://github.com/flutter/plugins/tree/master/packages/battery | ||
| version: 0.3.0+6 | ||
| version: 0.3.1 | ||
|
|
||
| flutter: | ||
| plugin: | ||
|
|
@@ -22,7 +22,8 @@ dev_dependencies: | |
| mockito: 3.0.0 | ||
| flutter_test: | ||
| sdk: flutter | ||
| e2e: ^0.2.0 | ||
|
|
||
| environment: | ||
| sdk: ">=2.0.0-dev.28.0 <3.0.0" | ||
| flutter: ">=1.2.0 <2.0.0" | ||
| flutter: ">=1.6.7 <2.0.0" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // Copyright 2019, the Chromium project authors. Please see the AUTHORS file | ||
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| import 'package:flutter_test/flutter_test.dart'; | ||
| import 'package:battery/battery.dart'; | ||
| import 'package:e2e/e2e.dart'; | ||
|
|
||
| void main() { | ||
| E2EWidgetsFlutterBinding.ensureInitialized(); | ||
|
|
||
| testWidgets('Can get battery level', (WidgetTester tester) async { | ||
| final Battery battery = Battery(); | ||
| final int batteryLevel = await battery.batteryLevel; | ||
| expect(batteryLevel, isNotNull); | ||
| }); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.