Feature/android splash screen (#257)

* Scope snippets

* Add xml formatting option

* Add splash screen icon

* Cleanup android manifest

* Add changelog entry
This commit is contained in:
Marcin Wojnarowski 2021-09-24 11:27:05 +02:00 committed by GitHub
parent 9f9cc52cf5
commit 95e5da70ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 60 additions and 93 deletions

View File

@ -5,28 +5,34 @@
"body": ["\"$1\": \"$2\",", "\"@$1\": {}$0"]
},
"Assert not null": {
"scope": "dart",
"prefix": "assnotnull",
"body": ["assert($1 != null)$0"]
},
"sizedbox": {
"scope": "dart",
"prefix": "sizedbox",
"body": ["const SizedBox($1)$0"]
},
"theme": {
"scope": "dart",
"prefix": "theme",
"body": ["final theme = Theme.of(context);"]
},
"sleep": {
"scope": "dart",
"prefix": "sleep",
"body": [
"await Future<dynamic>.delayed(const Duration(milliseconds: ${1:1000}));$0"
]
},
"repeat widget": {
"scope": "dart",
"prefix": "repeat",
"body": ["for(int i = 0; i < $1; i++)$0"]
},
"L10n string": {
"scope": "dart",
"prefix": "l10n",
"body": ["L10n.of(context)!.$0"]
},

View File

@ -2,5 +2,6 @@
"files.associations": {
"*.arb": "json"
},
"dart.showTodos": false
"dart.showTodos": false,
"xml.format.preserveAttributeLineBreaks": true
}

View File

@ -3,6 +3,7 @@
### Added
- Logging: local logs about some actions/errors. Can be accessed from **settings > about lemmur > logs**
- Android theme-aware splash screen (thanks to [@mimi89999](https://github.com/mimi89999))
## v0.6.0 - 2021-09-06

View File

@ -1,51 +1,38 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.krawieck.lemmur">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Needed for url_launcher to work on android 11 -->
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.krawieck.lemmur">
<application
android:name="io.flutter.app.FlutterApplication"
android:label="${appName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- 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"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<!-- Needed for url_launcher to work on android 11 -->
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
<application
android:name="io.flutter.app.FlutterApplication"
android:label="${appName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<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" />
</intent-filter>
</activity>
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/launch_background_color" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/splash_screen_background_color" />
<item>
<bitmap
android:gravity="center"
android:src="@drawable/splash" />
</item>
</layer-list>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="launch_background_color">#303030</color>
<color name="splash_screen_background_color">#303030</color>
</resources>

View File

@ -1,18 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter 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.Black.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#ffffff</color>
<color name="launch_background_color">#fafafa</color>
<color name="splash_screen_background_color">#fafafa</color>
</resources>

View File

@ -1,18 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:windowBackground">@drawable/splash_screen</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.Black.NoTitleBar">
<item name="android:windowBackground">@android:color/white</item>
<item name="android:windowBackground">@color/splash_screen_background_color</item>
</style>
</resources>