Skip to content

Commit

Permalink
Merge branch 'fix/fragment_activity' into minor
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanheise committed Dec 27, 2022
2 parents 670c94f + d73c37a commit bca317a
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions audio_service/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 0.18.9

* Fix cache bug in AudioServiceFragmentActivity (@Mordtimer).
* Add Android Auto manifest entry for example app (@ColinSchmale).

## 0.18.8
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import android.content.Context;

import android.os.Bundle;
import androidx.annotation.NonNull;

import androidx.annotation.Nullable;
import io.flutter.embedding.android.FlutterFragmentActivity;
import io.flutter.embedding.engine.FlutterEngine;

Expand All @@ -13,6 +15,12 @@ public FlutterEngine provideFlutterEngine(@NonNull Context context) {
return AudioServicePlugin.getFlutterEngine(context);
}

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
AudioServicePlugin.getFlutterEngine(this);
super.onCreate(savedInstanceState);
}

@Override
protected String getCachedEngineId() {
AudioServicePlugin.getFlutterEngine(this);
Expand Down
11 changes: 10 additions & 1 deletion audio_service/example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,25 @@

<application
android:label="Audio Service Demo"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name="com.ryanheise.audioservice.AudioServiceActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:exported="true"
tools:ignore="Instantiatable">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
14 changes: 12 additions & 2 deletions audio_service/example/android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<!-- Theme applied to the Android Window as soon as the process has started.
This theme determines the color of the Android Window while your
Flutter UI initializes, as well as behind your Flutter UI while its
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

0 comments on commit bca317a

Please sign in to comment.