Skip to content
Snippets Groups Projects
Commit fafa851a authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Enable splash screen

parent 8275c0db
No related branches found
No related tags found
1 merge request!10Resolve "Enable splash screen"
Pipeline #3162 passed
Showing
with 89 additions and 56 deletions
<?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="?android:colorBackground" />
<!-- You can insert your own image assets here -->
<!-- <item>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</item>
</layer-list>
<?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="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</item>
</layer-list>
android/app/src/main/res/mipmap-hdpi/launch_image.png

1.91 KiB

android/app/src/main/res/mipmap-mdpi/launch_image.png

1.25 KiB

android/app/src/main/res/mipmap-xhdpi/launch_image.png

2.47 KiB

android/app/src/main/res/mipmap-xxhdpi/launch_image.png

4.59 KiB

android/app/src/main/res/mipmap-xxxhdpi/launch_image.png

6.36 KiB

<?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>
......
<?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 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 -->
<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>
......
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.0.8
app.versionCode=8
app.versionName=0.0.9
app.versionCode=9
Enable launch screen with image
fastlane/metadata/android/en-US/images/featureGraphic.png

214 B

Activation de l'écran de chargement avec image
......@@ -8,60 +8,111 @@ command -v optipng >/dev/null 2>&1 || { echo >&2 "I require optipng but it's not
CURRENT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
BASE_DIR="$(dirname "${CURRENT_DIR}")"
SOURCE_ICON="${CURRENT_DIR}/icon.svg"
SOURCE_FASTLANE="${CURRENT_DIR}/featureGraphic.svg"
SOURCE_LAUNCH_IMAGE="${CURRENT_DIR}/icon.svg"
OPTIPNG_OPTIONS="-preserve -quiet -o7"
# optimize svg
if [ ! -f "${SOURCE_ICON}" ]; then
echo "Missing file: ${SOURCE_ICON}"
fi
if [ ! -f "${SOURCE_FASTLANE}" ]; then
echo "Missing file: ${SOURCE_FASTLANE}"
fi
if [ ! -f "${SOURCE_LAUNCH_IMAGE}" ]; then
echo "Missing file: ${SOURCE_LAUNCH_IMAGE}"
fi
function optimize_svg() {
SOURCE="$1"
SVG="$1"
cp ${SOURCE} ${SOURCE}.tmp
cp ${SVG} ${SVG}.tmp
scour \
--remove-descriptive-elements \
--enable-id-stripping \
--enable-viewboxing \
--enable-comment-stripping \
--nindent=4 \
-i ${SOURCE}.tmp \
-o ${SOURCE}
rm ${SOURCE}.tmp
--quiet \
-i ${SVG}.tmp \
-o ${SVG}
rm ${SVG}.tmp
}
# optimize source svg files
optimize_svg ${SOURCE_ICON}
optimize_svg ${SOURCE_FASTLANE}
optimize_svg ${SOURCE_LAUNCH_IMAGE}
# build icons
function build_asset_image() {
ICON_SIZE=192
SOURCE="$1"
function build_application_icon() {
ICON_SIZE="$1"
TARGET="$2"
optimize_svg "${SOURCE}"
echo "Building ${TARGET}"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET} \
${SOURCE}
--export-filename=${TARGET_PNG} \
${SOURCE_ICON}
optipng ${OPTIPNG_OPTIONS} ${TARGET}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
function build_icons_for_skin() {
SKIN_CODE="$1"
# build fastlane image
function build_fastlane_image() {
WIDTH="$1"
HEIGHT="$2"
TARGET="$3"
echo "Building ${TARGET}"
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${WIDTH} \
--export-height=${HEIGHT} \
--export-filename=${TARGET_PNG} \
${SOURCE_FASTLANE}
build_icon_for_skin ${SKIN_CODE} tile_empty
build_icon_for_skin ${SKIN_CODE} tile_black
build_icon_for_skin ${SKIN_CODE} tile_white
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
function build_icon_for_skin() {
SKIN_CODE="$1"
IMAGE_CODE="$2"
# build launch images (splash screen)
function build_launch_image() {
ICON_SIZE="$1"
TARGET="$2"
echo "Building ${TARGET}"
build_asset_image ${CURRENT_DIR}/skins/${SKIN_CODE}/${IMAGE_CODE}.svg ${BASE_DIR}/assets/skins/${SKIN_CODE}_${IMAGE_CODE}.png
TARGET_PNG="${TARGET}.png"
inkscape \
--export-width=${ICON_SIZE} \
--export-height=${ICON_SIZE} \
--export-filename=${TARGET_PNG} \
${SOURCE_LAUNCH_IMAGE}
optipng ${OPTIPNG_OPTIONS} ${TARGET_PNG}
}
# Game icons
build_asset_image ${CURRENT_DIR}/button_restart.svg ${BASE_DIR}/assets/icons/button_restart.png
build_asset_image ${CURRENT_DIR}/empty.svg ${BASE_DIR}/assets/icons/empty.png
build_asset_image ${CURRENT_DIR}/game_win.svg ${BASE_DIR}/assets/icons/game_win.png
build_application_icon 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/ic_launcher
build_application_icon 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/ic_launcher
build_application_icon 96 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/ic_launcher
build_application_icon 144 ${BASE_DIR}/android/app/src/main/res/mipmap-xxhdpi/ic_launcher
build_application_icon 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher
build_application_icon 512 ${BASE_DIR}/fastlane/metadata/android/en-US/images/icon
build_launch_image 72 ${BASE_DIR}/android/app/src/main/res/mipmap-hdpi/launch_image
build_launch_image 48 ${BASE_DIR}/android/app/src/main/res/mipmap-mdpi/launch_image
build_launch_image 96 ${BASE_DIR}/android/app/src/main/res/mipmap-xhdpi/launch_image
build_launch_image 144 ${BASE_DIR}/android/app/src/main/res/mipmap-xxhdpi/launch_image
build_launch_image 192 ${BASE_DIR}/android/app/src/main/res/mipmap-xxxhdpi/launch_image
# Skins
build_icons_for_skin "default"
build_fastlane_image 1024 500 ${BASE_DIR}/fastlane/metadata/android/en-US/images/featureGraphic
<?xml version="1.0" encoding="UTF-8"?>
<svg enable-background="new 0 0 100 100" version="1.1" viewBox="0 0 1024 500" xml:space="preserve" xmlns="http://www.w3.org/2000/svg"><rect width="1024" height="500" rx="0" ry="0" fill="#977cff"/></svg>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment