Skip to content

Commit

Permalink
Alt icons
Browse files Browse the repository at this point in the history
Fixes #233
  • Loading branch information
valldrac committed Dec 28, 2024
1 parent 82f0ab4 commit c04410f
Show file tree
Hide file tree
Showing 133 changed files with 524 additions and 3,036 deletions.
66 changes: 33 additions & 33 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@
android:name=".RoutingActivityAltYellow"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_yellow"
android:icon="@mipmap/ic_launcher_alt_heart"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -288,10 +288,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_yellow" />
android:resource="@mipmap/ic_launcher_alt_heart" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_yellow" />
android:resource="@mipmap/ic_launcher_alt_heart" />

<meta-data
android:name="android.app.shortcuts"
Expand All @@ -303,7 +303,7 @@
android:name=".RoutingActivityAltBubbles"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_bubbles"
android:icon="@mipmap/ic_launcher_alt_xmas"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -315,10 +315,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_bubbles" />
android:resource="@mipmap/ic_launcher_alt_xmas" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_bubbles" />
android:resource="@mipmap/ic_launcher_alt_xmas" />

<meta-data
android:name="android.app.shortcuts"
Expand All @@ -330,7 +330,7 @@
android:name=".RoutingActivityAltChat"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_chat"
android:icon="@mipmap/ic_launcher_alt_neon"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -342,10 +342,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_chat" />
android:resource="@mipmap/ic_launcher_alt_neon" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_chat" />
android:resource="@mipmap/ic_launcher_alt_neon" />

<meta-data
android:name="android.app.shortcuts"
Expand All @@ -357,8 +357,8 @@
android:name=".RoutingActivityAltNews"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_news"
android:label="@string/app_icon_label_news"
android:icon="@mipmap/ic_launcher_alt_zen"
android:label="@string/app_icon_label_zen"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -370,10 +370,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_news" />
android:resource="@mipmap/ic_launcher_alt_zen" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_news" />
android:resource="@mipmap/ic_launcher_alt_zen" />

<meta-data
android:name="android.app.shortcuts"
Expand Down Expand Up @@ -413,7 +413,7 @@
android:name=".RoutingActivityAltColor"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_signal_color"
android:icon="@mipmap/ic_launcher_alt_signal"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -425,10 +425,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_signal_color" />
android:resource="@mipmap/ic_launcher_alt_signal" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_signal_color" />
android:resource="@mipmap/ic_launcher_alt_signal" />

<meta-data
android:name="android.app.shortcuts"
Expand All @@ -440,7 +440,7 @@
android:name=".RoutingActivityAltDark"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_signal_dark"
android:icon="@mipmap/ic_launcher_alt_colorful"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -452,10 +452,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_signal_dark" />
android:resource="@mipmap/ic_launcher_alt_colorful" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_signal_dark" />
android:resource="@mipmap/ic_launcher_alt_colorful" />

<meta-data
android:name="android.app.shortcuts"
Expand All @@ -467,7 +467,7 @@
android:name=".RoutingActivityAltDarkVariant"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_signal_dark_variant"
android:icon="@mipmap/ic_launcher_alt_gold"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -479,10 +479,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_signal_dark_variant" />
android:resource="@mipmap/ic_launcher_alt_gold" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_signal_dark_variant" />
android:resource="@mipmap/ic_launcher_alt_gold" />

<meta-data
android:name="android.app.shortcuts"
Expand All @@ -494,7 +494,7 @@
android:name=".RoutingActivityAltWhite"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_signal_white"
android:icon="@mipmap/ic_launcher_alt_light"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -506,10 +506,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_signal_white" />
android:resource="@mipmap/ic_launcher_alt_light" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_signal_white" />
android:resource="@mipmap/ic_launcher_alt_light" />

<meta-data
android:name="android.app.shortcuts"
Expand All @@ -521,8 +521,8 @@
android:name=".RoutingActivityAltWaves"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_waves"
android:label="@string/app_icon_label_waves"
android:icon="@mipmap/ic_launcher_alt_music"
android:label="@string/app_icon_label_music"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -534,10 +534,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_waves" />
android:resource="@mipmap/ic_launcher_alt_music" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_waves" />
android:resource="@mipmap/ic_launcher_alt_music" />

<meta-data
android:name="android.app.shortcuts"
Expand All @@ -549,8 +549,8 @@
android:name=".RoutingActivityAltWeather"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/ic_launcher_alt_weather"
android:label="@string/app_icon_label_weather"
android:icon="@mipmap/ic_launcher_alt_moon"
android:label="@string/app_icon_label_moon"
android:targetActivity=".MainActivity">

<intent-filter>
Expand All @@ -562,10 +562,10 @@

<meta-data
android:name="com.sec.minimode.icon.portrait.normal"
android:resource="@mipmap/ic_launcher_alt_weather" />
android:resource="@mipmap/ic_launcher_alt_moon" />
<meta-data
android:name="com.sec.minimode.icon.landscape.normal"
android:resource="@mipmap/ic_launcher_alt_weather" />
android:resource="@mipmap/ic_launcher_alt_moon" />

<meta-data
android:name="android.app.shortcuts"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
package org.thoughtcrime.securesms.components.settings.app.appearance.appicon

import android.content.Context
import androidx.appcompat.content.res.AppCompatResources
import androidx.compose.animation.core.CubicBezierEasing
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
Expand Down Expand Up @@ -36,7 +37,10 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.graphics.painter.BitmapPainter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.SpanStyle
Expand All @@ -45,6 +49,7 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.core.graphics.drawable.toBitmap
import androidx.navigation.fragment.findNavController
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
Expand Down Expand Up @@ -255,11 +260,14 @@ fun AppIcon(preset: AppIconPreset, isSelected: Boolean, onClick: () -> Unit, mod
clip = true
)
.clickable(onClick = onClick)
Image(
painterResource(id = preset.iconPreviewResId),
contentDescription = stringResource(id = preset.labelResId),
modifier = imageModifier
)
val adaptiveIcon = AppCompatResources.getDrawable(LocalContext.current, preset.iconPreviewResId)
if (adaptiveIcon != null) {
Image(
BitmapPainter(adaptiveIcon.toBitmap().asImageBitmap()),
contentDescription = stringResource(id = preset.labelResId),
modifier = imageModifier
)
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ import androidx.annotation.StringRes
import org.thoughtcrime.securesms.R

enum class AppIconPreset(private val componentName: String, @DrawableRes val iconPreviewResId: Int, @StringRes val labelResId: Int) {
DEFAULT(".RoutingActivity", R.drawable.ic_app_icon_default_top_preview, R.string.app_name),
WHITE(".RoutingActivityAltWhite", R.drawable.ic_app_icon_signal_white_top_preview, R.string.app_name),
COLOR(".RoutingActivityAltColor", R.drawable.ic_app_icon_signal_color_top_preview, R.string.app_name),
DARK(".RoutingActivityAltDark", R.drawable.ic_app_icon_signal_dark_top_preview, R.string.app_name),
DARK_VARIANT(".RoutingActivityAltDarkVariant", R.drawable.ic_app_icon_signal_dark_variant_top_preview, R.string.app_name),
CHAT(".RoutingActivityAltChat", R.drawable.ic_app_icon_chat_top_preview, R.string.app_name),
BUBBLES(".RoutingActivityAltBubbles", R.drawable.ic_app_icon_bubbles_top_preview, R.string.app_name),
YELLOW(".RoutingActivityAltYellow", R.drawable.ic_app_icon_yellow_top_preview, R.string.app_name),
NEWS(".RoutingActivityAltNews", R.drawable.ic_app_icon_news_top_preview, R.string.app_icon_label_news),
NOTES(".RoutingActivityAltNotes", R.drawable.ic_app_icon_notes_top_preview, R.string.app_icon_label_notes),
WEATHER(".RoutingActivityAltWeather", R.drawable.ic_app_icon_weather_top_preview, R.string.app_icon_label_weather),
WAVES(".RoutingActivityAltWaves", R.drawable.ic_app_icon_waves_top_preview, R.string.app_icon_label_waves);
DEFAULT(".RoutingActivity", R.mipmap.ic_launcher, R.string.app_name),
LIGHT(".RoutingActivityAltWhite", R.mipmap.ic_launcher_alt_light, R.string.app_name),
SIGNAL(".RoutingActivityAltColor", R.mipmap.ic_launcher_alt_signal, R.string.app_name),
COLORFUL(".RoutingActivityAltDark", R.mipmap.ic_launcher_alt_colorful, R.string.app_name),
GOLD(".RoutingActivityAltDarkVariant", R.mipmap.ic_launcher_alt_gold, R.string.app_name),
NEON(".RoutingActivityAltChat", R.mipmap.ic_launcher_alt_neon, R.string.app_name),
CHRISTMAS(".RoutingActivityAltBubbles", R.mipmap.ic_launcher_alt_xmas, R.string.app_name),
HEART(".RoutingActivityAltYellow", R.mipmap.ic_launcher_alt_heart, R.string.app_name),
ZEN(".RoutingActivityAltNews", R.mipmap.ic_launcher_alt_zen, R.string.app_icon_label_zen),
NOTES(".RoutingActivityAltNotes", R.mipmap.ic_launcher_alt_notes, R.string.app_icon_label_notes),
MOON(".RoutingActivityAltWeather", R.mipmap.ic_launcher_alt_moon, R.string.app_icon_label_moon),
MUSIC(".RoutingActivityAltWaves", R.mipmap.ic_launcher_alt_music, R.string.app_icon_label_music);

fun getComponentName(context: Context): ComponentName {
val applicationContext = context.applicationContext
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/drawable/group_story.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<path
android:pathData="M53.92,13.83L97.42,13.83A14.5,14.5 0,0 1,111.92 28.33L111.92,105.67A14.5,14.5 0,0 1,97.42 120.17L53.92,120.17A14.5,14.5 0,0 1,39.42 105.67L39.42,28.33A14.5,14.5 0,0 1,53.92 13.83z">
<aapt:attr name="android:fillColor">
<gradient
<gradient
android:startX="75.67"
android:startY="13.83"
android:endX="75.67"
Expand All @@ -24,7 +24,7 @@
android:pathData="M33.95,25.81L25.98,28.71C18.45,31.45 14.57,39.77 17.31,47.3L33.95,93.02V25.81Z"
android:fillType="evenOdd">
<aapt:attr name="android:fillColor">
<gradient
<gradient
android:startX="25.19"
android:startY="25.81"
android:endX="25.19"
Expand Down
51 changes: 0 additions & 51 deletions app/src/main/res/drawable/ic_app_icon_bubbles_top_preview.xml

This file was deleted.

Loading

0 comments on commit c04410f

Please sign in to comment.