diff --git a/app/android/src/main/AndroidManifest.xml b/app/android/src/main/AndroidManifest.xml index 98830836..2b5d95bc 100644 --- a/app/android/src/main/AndroidManifest.xml +++ b/app/android/src/main/AndroidManifest.xml @@ -9,31 +9,26 @@ tools:ignore="QueryAllPackagesPermission" /> + - - - - - + @@ -41,6 +36,7 @@ + @@ -54,9 +50,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/android/src/main/java/com/materiiapps/gloom/Gloom.kt b/app/android/src/main/java/com/materiiapps/gloom/Gloom.kt index 3f8c40d0..2dc8c09d 100644 --- a/app/android/src/main/java/com/materiiapps/gloom/Gloom.kt +++ b/app/android/src/main/java/com/materiiapps/gloom/Gloom.kt @@ -4,7 +4,7 @@ import android.app.Application import com.materiiapps.gloom.di.httpModule import com.materiiapps.gloom.di.module.loggerModule import com.materiiapps.gloom.di.module.managerModule -import com.materiiapps.gloom.di.module.platformViewModelModule +import com.materiiapps.gloom.di.module.platformModule import com.materiiapps.gloom.di.module.settingsModule import com.materiiapps.gloom.di.module.viewModelModule import com.materiiapps.gloom.di.repositoryModule @@ -32,7 +32,7 @@ class Gloom : Application() { settingsModule(), managerModule(), viewModelModule(), - platformViewModelModule(), + platformModule(), module { viewModelOf(::MainViewModel) } // Cant group with the rest ) } diff --git a/app/android/src/main/res/drawable-v26/ic_launcher.xml b/app/android/src/main/res/drawable-v26/ic_launcher.xml index ed7711d5..bbbd1ec3 100644 --- a/app/android/src/main/res/drawable-v26/ic_launcher.xml +++ b/app/android/src/main/res/drawable-v26/ic_launcher.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_foreground.xml b/app/android/src/main/res/drawable-v26/ic_launcher_foreground.xml index 1ceaf757..84d319d5 100644 --- a/app/android/src/main/res/drawable-v26/ic_launcher_foreground.xml +++ b/app/android/src/main/res/drawable-v26/ic_launcher_foreground.xml @@ -1,29 +1,10 @@ - + - - - + - - - + + + diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_frappe.xml b/app/android/src/main/res/drawable-v26/ic_launcher_frappe.xml new file mode 100644 index 00000000..69c70a8b --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_frappe.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_frappe_foreground.xml b/app/android/src/main/res/drawable-v26/ic_launcher_frappe_foreground.xml new file mode 100644 index 00000000..e66f3996 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_frappe_foreground.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_latte.xml b/app/android/src/main/res/drawable-v26/ic_launcher_latte.xml new file mode 100644 index 00000000..2822c210 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_latte.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_latte_foreground.xml b/app/android/src/main/res/drawable-v26/ic_launcher_latte_foreground.xml new file mode 100644 index 00000000..f9ef30a7 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_latte_foreground.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_light.xml b/app/android/src/main/res/drawable-v26/ic_launcher_light.xml new file mode 100644 index 00000000..5430e2a9 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_light.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_macchiato.xml b/app/android/src/main/res/drawable-v26/ic_launcher_macchiato.xml new file mode 100644 index 00000000..9245825d --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_macchiato.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_macchiato_foreground.xml b/app/android/src/main/res/drawable-v26/ic_launcher_macchiato_foreground.xml new file mode 100644 index 00000000..40a27b3b --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_macchiato_foreground.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_mocha.xml b/app/android/src/main/res/drawable-v26/ic_launcher_mocha.xml new file mode 100644 index 00000000..2da9d6af --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_mocha.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_mocha_foreground.xml b/app/android/src/main/res/drawable-v26/ic_launcher_mocha_foreground.xml new file mode 100644 index 00000000..9c4fc9b4 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_mocha_foreground.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_pride.xml b/app/android/src/main/res/drawable-v26/ic_launcher_pride.xml new file mode 100644 index 00000000..e66be93c --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_pride.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_pride_foreground.xml b/app/android/src/main/res/drawable-v26/ic_launcher_pride_foreground.xml new file mode 100644 index 00000000..15f2d246 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_pride_foreground.xml @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_sky.xml b/app/android/src/main/res/drawable-v26/ic_launcher_sky.xml new file mode 100644 index 00000000..bbcb7324 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_sky.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_trans.xml b/app/android/src/main/res/drawable-v26/ic_launcher_trans.xml new file mode 100644 index 00000000..83455d22 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_trans.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_trans_foreground.xml b/app/android/src/main/res/drawable-v26/ic_launcher_trans_foreground.xml new file mode 100644 index 00000000..60950931 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_trans_foreground.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_trans_inverted.xml b/app/android/src/main/res/drawable-v26/ic_launcher_trans_inverted.xml new file mode 100644 index 00000000..cb4e3eb3 --- /dev/null +++ b/app/android/src/main/res/drawable-v26/ic_launcher_trans_inverted.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/android/src/main/res/drawable-v26/ic_launcher_trans_inverted_foreground.png b/app/android/src/main/res/drawable-v26/ic_launcher_trans_inverted_foreground.png new file mode 100644 index 00000000..afd2557f Binary files /dev/null and b/app/android/src/main/res/drawable-v26/ic_launcher_trans_inverted_foreground.png differ diff --git a/app/android/src/main/res/drawable/ic_balance_24.xml b/app/android/src/main/res/drawable/ic_balance_24.xml deleted file mode 100644 index 7255641b..00000000 --- a/app/android/src/main/res/drawable/ic_balance_24.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/android/src/main/res/drawable/ic_bluesky_24.xml b/app/android/src/main/res/drawable/ic_bluesky_24.xml deleted file mode 100644 index 6a053185..00000000 --- a/app/android/src/main/res/drawable/ic_bluesky_24.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/android/src/main/res/drawable/ic_commit_24.xml b/app/android/src/main/res/drawable/ic_commit_24.xml deleted file mode 100644 index db4bd5e6..00000000 --- a/app/android/src/main/res/drawable/ic_commit_24.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/android/src/main/res/drawable/ic_facebook_24.xml b/app/android/src/main/res/drawable/ic_facebook_24.xml deleted file mode 100644 index 8bd25975..00000000 --- a/app/android/src/main/res/drawable/ic_facebook_24.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/app/android/src/main/res/drawable/ic_fork_24.xml b/app/android/src/main/res/drawable/ic_fork_24.xml deleted file mode 100644 index d547ff07..00000000 --- a/app/android/src/main/res/drawable/ic_fork_24.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/app/android/src/main/res/drawable/ic_github_24.xml b/app/android/src/main/res/drawable/ic_github_24.xml deleted file mode 100644 index 51491b42..00000000 --- a/app/android/src/main/res/drawable/ic_github_24.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/app/android/src/main/res/drawable/ic_gloom.xml b/app/android/src/main/res/drawable/ic_gloom.xml index efe3316a..b30f5de5 100644 --- a/app/android/src/main/res/drawable/ic_gloom.xml +++ b/app/android/src/main/res/drawable/ic_gloom.xml @@ -1,11 +1,10 @@ - + android:height="200dp" + android:viewportHeight="512" + android:viewportWidth="512" + android:width="200dp"> - - + diff --git a/app/android/src/main/res/drawable/ic_hometown_24.xml b/app/android/src/main/res/drawable/ic_hometown_24.xml deleted file mode 100644 index ba5a5cf5..00000000 --- a/app/android/src/main/res/drawable/ic_hometown_24.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - diff --git a/app/android/src/main/res/drawable/ic_instagram_24.xml b/app/android/src/main/res/drawable/ic_instagram_24.xml deleted file mode 100644 index 197b715f..00000000 --- a/app/android/src/main/res/drawable/ic_instagram_24.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/app/android/src/main/res/drawable/ic_ios_24.xml b/app/android/src/main/res/drawable/ic_ios_24.xml deleted file mode 100644 index fe854bb1..00000000 --- a/app/android/src/main/res/drawable/ic_ios_24.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - diff --git a/app/android/src/main/res/drawable/ic_launcher.png b/app/android/src/main/res/drawable/ic_launcher.png index 0a54c5df..d25212fc 100644 Binary files a/app/android/src/main/res/drawable/ic_launcher.png and b/app/android/src/main/res/drawable/ic_launcher.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_frappe.png b/app/android/src/main/res/drawable/ic_launcher_frappe.png new file mode 100644 index 00000000..58f53344 Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_frappe.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_latte.png b/app/android/src/main/res/drawable/ic_launcher_latte.png new file mode 100644 index 00000000..3322aa57 Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_latte.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_light.png b/app/android/src/main/res/drawable/ic_launcher_light.png new file mode 100644 index 00000000..4700bfd1 Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_light.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_macchiato.png b/app/android/src/main/res/drawable/ic_launcher_macchiato.png new file mode 100644 index 00000000..293b7f54 Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_macchiato.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_mocha.png b/app/android/src/main/res/drawable/ic_launcher_mocha.png new file mode 100644 index 00000000..826710fa Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_mocha.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_pride.png b/app/android/src/main/res/drawable/ic_launcher_pride.png new file mode 100644 index 00000000..e65248e7 Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_pride.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_sky.png b/app/android/src/main/res/drawable/ic_launcher_sky.png new file mode 100644 index 00000000..38080fdb Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_sky.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_trans.png b/app/android/src/main/res/drawable/ic_launcher_trans.png new file mode 100644 index 00000000..a9228e05 Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_trans.png differ diff --git a/app/android/src/main/res/drawable/ic_launcher_trans_inverted.png b/app/android/src/main/res/drawable/ic_launcher_trans_inverted.png new file mode 100644 index 00000000..4e3e78c8 Binary files /dev/null and b/app/android/src/main/res/drawable/ic_launcher_trans_inverted.png differ diff --git a/app/android/src/main/res/drawable/ic_link_24.xml b/app/android/src/main/res/drawable/ic_link_24.xml deleted file mode 100644 index 0d929d47..00000000 --- a/app/android/src/main/res/drawable/ic_link_24.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - diff --git a/app/android/src/main/res/drawable/ic_linkedin_24.xml b/app/android/src/main/res/drawable/ic_linkedin_24.xml deleted file mode 100644 index 6eee07b7..00000000 --- a/app/android/src/main/res/drawable/ic_linkedin_24.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/app/android/src/main/res/drawable/ic_mastodon_24.xml b/app/android/src/main/res/drawable/ic_mastodon_24.xml deleted file mode 100644 index e63fd549..00000000 --- a/app/android/src/main/res/drawable/ic_mastodon_24.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/app/android/src/main/res/drawable/ic_npm_24.xml b/app/android/src/main/res/drawable/ic_npm_24.xml deleted file mode 100644 index 8250c132..00000000 --- a/app/android/src/main/res/drawable/ic_npm_24.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/android/src/main/res/drawable/ic_reddit_24.xml b/app/android/src/main/res/drawable/ic_reddit_24.xml deleted file mode 100644 index 1532f26a..00000000 --- a/app/android/src/main/res/drawable/ic_reddit_24.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - diff --git a/app/android/src/main/res/drawable/ic_twitch_24.xml b/app/android/src/main/res/drawable/ic_twitch_24.xml deleted file mode 100644 index f2b1882c..00000000 --- a/app/android/src/main/res/drawable/ic_twitch_24.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/app/android/src/main/res/drawable/ic_twitter_24.xml b/app/android/src/main/res/drawable/ic_twitter_24.xml deleted file mode 100644 index 0ec97e6f..00000000 --- a/app/android/src/main/res/drawable/ic_twitter_24.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/app/android/src/main/res/drawable/ic_youtube_24.xml b/app/android/src/main/res/drawable/ic_youtube_24.xml deleted file mode 100644 index ec6a974d..00000000 --- a/app/android/src/main/res/drawable/ic_youtube_24.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - diff --git a/app/android/src/main/res/values/colors.xml b/app/android/src/main/res/values/colors.xml index 6feac1cc..e83cfd82 100644 --- a/app/android/src/main/res/values/colors.xml +++ b/app/android/src/main/res/values/colors.xml @@ -1,4 +1,9 @@ #242424 + #1E1E2E + #24273A + #303446 + #EFF1F5 + #FFFFFF \ No newline at end of file diff --git a/app/desktop/src/commonMain/kotlin/com/materiiapps/gloom/Gloom.kt b/app/desktop/src/commonMain/kotlin/com/materiiapps/gloom/Gloom.kt index a88f254b..75b968b3 100644 --- a/app/desktop/src/commonMain/kotlin/com/materiiapps/gloom/Gloom.kt +++ b/app/desktop/src/commonMain/kotlin/com/materiiapps/gloom/Gloom.kt @@ -5,7 +5,7 @@ import androidx.compose.ui.window.application import com.materiiapps.gloom.di.httpModule import com.materiiapps.gloom.di.module.loggerModule import com.materiiapps.gloom.di.module.managerModule -import com.materiiapps.gloom.di.module.platformViewModelModule +import com.materiiapps.gloom.di.module.platformModule import com.materiiapps.gloom.di.module.settingsModule import com.materiiapps.gloom.di.module.viewModelModule import com.materiiapps.gloom.di.repositoryModule @@ -30,7 +30,7 @@ fun main(args: Array) { settingsModule(), managerModule(), viewModelModule(), - platformViewModelModule() + platformModule() ) } diff --git a/shared/src/androidMain/kotlin/com/materiiapps/gloom/util/PlatformUtil.kt b/shared/src/androidMain/kotlin/com/materiiapps/gloom/util/PlatformUtil.kt index e9302d05..397611bc 100644 --- a/shared/src/androidMain/kotlin/com/materiiapps/gloom/util/PlatformUtil.kt +++ b/shared/src/androidMain/kotlin/com/materiiapps/gloom/util/PlatformUtil.kt @@ -11,6 +11,6 @@ actual val supportsMonet = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S actual val isDebug = BuildConfig.DEBUG actual val GloomPath = File(Environment.getExternalStorageDirectory(), "Gloom") -actual val Features = listOf(Feature.DYNAMIC_COLOR, Feature.INSTALL_APKS) +actual val Features = listOf(Feature.DYNAMIC_COLOR, Feature.INSTALL_APKS, Feature.CHANGE_ICON) diff --git a/shared/src/commonMain/kotlin/com/materiiapps/gloom/util/Feature.kt b/shared/src/commonMain/kotlin/com/materiiapps/gloom/util/Feature.kt index d230dbf8..82914729 100644 --- a/shared/src/commonMain/kotlin/com/materiiapps/gloom/util/Feature.kt +++ b/shared/src/commonMain/kotlin/com/materiiapps/gloom/util/Feature.kt @@ -2,5 +2,6 @@ package com.materiiapps.gloom.util enum class Feature { DYNAMIC_COLOR, - INSTALL_APKS + INSTALL_APKS, + CHANGE_ICON } \ No newline at end of file diff --git a/ui/src/desktopMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt b/ui/src/androidMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.android.kt similarity index 54% rename from ui/src/desktopMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt rename to ui/src/androidMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.android.kt index faff4894..28c9c4b6 100644 --- a/ui/src/desktopMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt +++ b/ui/src/androidMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.android.kt @@ -1,11 +1,15 @@ package com.materiiapps.gloom.di.module import com.materiiapps.gloom.ui.screen.release.viewmodel.ReleaseViewModel +import com.materiiapps.gloom.ui.util.AppIconSetter import org.koin.core.module.dsl.factoryOf +import org.koin.core.qualifier.named import org.koin.dsl.module -actual fun platformViewModelModule() = module { +actual fun platformModule() = module { factoryOf(::ReleaseViewModel) + single { AppIconSetter(get(), get(named("prefs"))) } + } \ No newline at end of file diff --git a/ui/src/androidMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.android.kt b/ui/src/androidMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.android.kt new file mode 100644 index 00000000..43d8a93b --- /dev/null +++ b/ui/src/androidMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.android.kt @@ -0,0 +1,35 @@ +package com.materiiapps.gloom.ui.util + +import android.content.ComponentName +import android.content.Context +import android.content.pm.PackageManager +import com.materiiapps.gloom.domain.manager.base.BasePreferenceManager +import com.materiiapps.gloom.domain.manager.base.enumPreference +import com.materiiapps.gloom.util.SettingsProvider + +actual class AppIconSetter( + private val context: Context, + settingsProvider: SettingsProvider +): BasePreferenceManager(settingsProvider) { + + actual var currentIcon by enumPreference("app_icon", AppIcon.Main) + + actual fun setIcon(appIcon: AppIcon) { + val pm = context.packageManager + + pm.setComponentEnabledSetting( + ComponentName(context, currentIcon.aliasName), + PackageManager.COMPONENT_ENABLED_STATE_DISABLED, + PackageManager.DONT_KILL_APP + ) + + pm.setComponentEnabledSetting( + ComponentName(context, appIcon.aliasName), + PackageManager.COMPONENT_ENABLED_STATE_ENABLED, + PackageManager.DONT_KILL_APP + ) + + currentIcon = appIcon + } + +} \ No newline at end of file diff --git a/ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt b/ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.kt similarity index 63% rename from ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt rename to ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.kt index cb25e7fd..63546620 100644 --- a/ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt +++ b/ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.kt @@ -2,4 +2,4 @@ package com.materiiapps.gloom.di.module import org.koin.core.module.Module -expect fun platformViewModelModule(): Module \ No newline at end of file +expect fun platformModule(): Module \ No newline at end of file diff --git a/ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/ViewModelModule.kt b/ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/ViewModelModule.kt index c1bfa0d6..cb80fe23 100644 --- a/ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/ViewModelModule.kt +++ b/ui/src/commonMain/kotlin/com/materiiapps/gloom/di/module/ViewModelModule.kt @@ -20,6 +20,7 @@ import com.materiiapps.gloom.ui.screen.repo.viewmodel.RepoPullRequestsViewModel import com.materiiapps.gloom.ui.screen.repo.viewmodel.RepoReleasesViewModel import com.materiiapps.gloom.ui.screen.repo.viewmodel.RepoViewModel import com.materiiapps.gloom.ui.screen.settings.viewmodel.AccountSettingsViewModel +import com.materiiapps.gloom.ui.screen.settings.viewmodel.AppIconsSettingsViewModel import com.materiiapps.gloom.ui.screen.settings.viewmodel.AppearanceSettingsViewModel import com.materiiapps.gloom.ui.screen.settings.viewmodel.SettingsViewModel import org.koin.core.module.dsl.factoryOf @@ -38,6 +39,7 @@ fun viewModelModule() = module { factoryOf(::SettingsViewModel) factoryOf(::AppearanceSettingsViewModel) factoryOf(::AccountSettingsViewModel) + factoryOf(::AppIconsSettingsViewModel) factoryOf(::HomeViewModel) factoryOf(::ExploreViewModel) diff --git a/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/AppIconSettingsScreen.kt b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/AppIconSettingsScreen.kt new file mode 100644 index 00000000..9db3220b --- /dev/null +++ b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/AppIconSettingsScreen.kt @@ -0,0 +1,76 @@ +package com.materiiapps.gloom.ui.screen.settings + +import androidx.compose.foundation.layout.WindowInsets +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.lazy.LazyColumn +import androidx.compose.foundation.selection.selectableGroup +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.Scaffold +import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.TopAppBarScrollBehavior +import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier +import androidx.compose.ui.input.nestedscroll.nestedScroll +import cafe.adriel.voyager.core.screen.Screen +import cafe.adriel.voyager.koin.getScreenModel +import com.materiiapps.gloom.Res +import com.materiiapps.gloom.ui.component.NavBarSpacer +import com.materiiapps.gloom.ui.component.toolbar.LargeToolbar +import com.materiiapps.gloom.ui.screen.settings.component.SettingsHeader +import com.materiiapps.gloom.ui.screen.settings.component.appicon.AppIconSetting +import com.materiiapps.gloom.ui.screen.settings.viewmodel.AppIconsSettingsViewModel +import com.materiiapps.gloom.ui.util.AppIcon +import com.materiiapps.gloom.ui.util.AppIconCollection +import dev.icerock.moko.resources.compose.stringResource + +class AppIconsSettingsScreen : Screen { + + @Composable + @OptIn(ExperimentalMaterial3Api::class) + override fun Content() { + val viewModel: AppIconsSettingsViewModel = getScreenModel() + val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior() + + Scaffold( + topBar = { Toolbar(scrollBehavior) }, + contentWindowInsets = WindowInsets(0, 0, 0, 0), + modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection) + ) { pv -> + LazyColumn( + modifier = Modifier + .padding(pv) + .selectableGroup() + ) { + AppIconCollection.entries.forEach { iconCollection -> + item(iconCollection.name) { + SettingsHeader(stringResource(iconCollection.nameRes)) + } + + AppIcon.entries.filter { it.collection == iconCollection }.forEach { appIcon -> + item(appIcon) { + AppIconSetting( + appIcon = appIcon, + selected = viewModel.appIconSetter.currentIcon == appIcon, + onSelected = { viewModel.setIcon(appIcon) } + ) + } + } + } + + item("spacer") { NavBarSpacer() } + } + } + } + + @OptIn(ExperimentalMaterial3Api::class) + @Composable + private fun Toolbar( + scrollBehavior: TopAppBarScrollBehavior + ) { + LargeToolbar( + title = stringResource(Res.strings.settings_app_icon), + scrollBehavior = scrollBehavior + ) + } + +} \ No newline at end of file diff --git a/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/AppearanceSettingsScreen.kt b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/AppearanceSettingsScreen.kt index c5ba40a0..308e8f30 100644 --- a/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/AppearanceSettingsScreen.kt +++ b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/AppearanceSettingsScreen.kt @@ -17,13 +17,13 @@ import cafe.adriel.voyager.core.screen.Screen import cafe.adriel.voyager.koin.getScreenModel import com.materiiapps.gloom.Res import com.materiiapps.gloom.domain.manager.Theme +import com.materiiapps.gloom.ui.component.toolbar.LargeToolbar +import com.materiiapps.gloom.ui.screen.settings.component.AvatarShapeSetting import com.materiiapps.gloom.ui.screen.settings.component.SettingsHeader import com.materiiapps.gloom.ui.screen.settings.component.SettingsItemChoice import com.materiiapps.gloom.ui.screen.settings.component.SettingsSwitch -import com.materiiapps.gloom.ui.component.toolbar.LargeToolbar -import com.materiiapps.gloom.ui.util.getString import com.materiiapps.gloom.ui.screen.settings.viewmodel.AppearanceSettingsViewModel -import com.materiiapps.gloom.ui.screen.settings.component.AvatarShapeSetting +import com.materiiapps.gloom.ui.util.getString import com.materiiapps.gloom.util.Feature import com.materiiapps.gloom.util.Features import com.materiiapps.gloom.util.supportsMonet diff --git a/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/SettingsScreen.kt b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/SettingsScreen.kt index 1e13dccd..e863397c 100644 --- a/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/SettingsScreen.kt +++ b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/SettingsScreen.kt @@ -7,6 +7,7 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons import androidx.compose.material.icons.outlined.AccountCircle import androidx.compose.material.icons.outlined.Code +import androidx.compose.material.icons.outlined.DesignServices import androidx.compose.material.icons.outlined.Info import androidx.compose.material.icons.outlined.Palette import androidx.compose.material3.ExperimentalMaterial3Api @@ -21,14 +22,16 @@ import cafe.adriel.voyager.koin.getScreenModel import cafe.adriel.voyager.navigator.LocalNavigator import cafe.adriel.voyager.navigator.currentOrThrow import com.materiiapps.gloom.Res -import com.materiiapps.gloom.ui.screen.settings.component.SettingsButton -import com.materiiapps.gloom.ui.screen.settings.component.SettingsCategory import com.materiiapps.gloom.ui.component.toolbar.LargeToolbar import com.materiiapps.gloom.ui.screen.auth.LandingScreen import com.materiiapps.gloom.ui.screen.settings.about.AboutScreen +import com.materiiapps.gloom.ui.screen.settings.component.SettingsButton +import com.materiiapps.gloom.ui.screen.settings.component.SettingsCategory +import com.materiiapps.gloom.ui.screen.settings.component.account.SignOutDialog import com.materiiapps.gloom.ui.screen.settings.developer.DeveloperSettingsScreen import com.materiiapps.gloom.ui.screen.settings.viewmodel.SettingsViewModel -import com.materiiapps.gloom.ui.screen.settings.component.account.SignOutDialog +import com.materiiapps.gloom.util.Feature +import com.materiiapps.gloom.util.Features import com.materiiapps.gloom.util.IsDeveloper import com.materiiapps.gloom.util.VersionName import dev.icerock.moko.resources.compose.stringResource @@ -74,6 +77,15 @@ class SettingsScreen : Screen { destination = ::AppearanceSettingsScreen ) + if (Features.contains(Feature.CHANGE_ICON)) { + SettingsCategory( + icon = Icons.Outlined.DesignServices, + text = stringResource(Res.strings.settings_app_icon), + subtext = stringResource(Res.strings.settings_app_icon_description), + destination = ::AppIconsSettingsScreen + ) + } + SettingsCategory( icon = Icons.Outlined.AccountCircle, text = stringResource(Res.strings.settings_accounts), diff --git a/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/component/appicon/AppIconSetting.kt b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/component/appicon/AppIconSetting.kt new file mode 100644 index 00000000..9563142b --- /dev/null +++ b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/component/appicon/AppIconSetting.kt @@ -0,0 +1,84 @@ +package com.materiiapps.gloom.ui.screen.settings.component.appicon + +import androidx.compose.foundation.Image +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.heightIn +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.foundation.selection.selectable +import androidx.compose.foundation.shape.CircleShape +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.CheckCircle +import androidx.compose.material3.Icon +import androidx.compose.material3.LocalContentColor +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.draw.shadow +import androidx.compose.ui.semantics.Role +import androidx.compose.ui.text.font.FontStyle +import androidx.compose.ui.text.font.FontWeight +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import com.materiiapps.gloom.ui.util.AppIcon +import dev.icerock.moko.resources.compose.painterResource +import dev.icerock.moko.resources.compose.stringResource + +@Composable +fun AppIconSetting( + appIcon: AppIcon, + selected: Boolean, + onSelected: () -> Unit, + modifier: Modifier = Modifier +) { + Row( + verticalAlignment = Alignment.CenterVertically, + horizontalArrangement = Arrangement.spacedBy(16.dp), + modifier = modifier + .selectable(selected, enabled = !selected, role = Role.Checkbox, onClick = onSelected) + .heightIn(min = 64.dp) + .fillMaxWidth() + .padding(16.dp) + ) { + Image( + painter = painterResource(appIcon.preview), + contentDescription = null, + modifier = Modifier + .size(45.dp) + .clip(CircleShape) + .shadow(10.dp, CircleShape) + ) + + Column( + verticalArrangement = Arrangement.spacedBy(3.dp), + modifier = Modifier.weight(1f) + ) { + Text( + text = stringResource(appIcon.iconName), + style = MaterialTheme.typography.titleMedium, + fontWeight = FontWeight.Medium, + fontSize = 17.sp + ) + + Text( + text = stringResource(appIcon.iconDescription), + style = MaterialTheme.typography.labelLarge, + fontStyle = FontStyle.Italic, + color = LocalContentColor.current.copy(alpha = 0.5f) + ) + } + + if (selected) { + Icon( + imageVector = Icons.Filled.CheckCircle, + contentDescription = null + ) + } + } +} \ No newline at end of file diff --git a/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/viewmodel/AppIconSettingsViewModel.kt b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/viewmodel/AppIconSettingsViewModel.kt new file mode 100644 index 00000000..7ee26f45 --- /dev/null +++ b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/screen/settings/viewmodel/AppIconSettingsViewModel.kt @@ -0,0 +1,13 @@ +package com.materiiapps.gloom.ui.screen.settings.viewmodel + +import cafe.adriel.voyager.core.model.ScreenModel +import com.materiiapps.gloom.ui.util.AppIcon +import com.materiiapps.gloom.ui.util.AppIconSetter + +class AppIconsSettingsViewModel( + val appIconSetter: AppIconSetter +) : ScreenModel { + + fun setIcon(appIcon: AppIcon) = appIconSetter.setIcon(appIcon) + +} \ No newline at end of file diff --git a/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.kt b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.kt new file mode 100644 index 00000000..1a52121a --- /dev/null +++ b/ui/src/commonMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.kt @@ -0,0 +1,117 @@ +package com.materiiapps.gloom.ui.util + +import com.materiiapps.gloom.Res +import dev.icerock.moko.resources.ImageResource +import dev.icerock.moko.resources.StringResource + +expect class AppIconSetter { + + var currentIcon: AppIcon + + fun setIcon(appIcon: AppIcon) + +} + +enum class AppIcon( + val aliasName: String, + val iconName: StringResource, + val iconDescription: StringResource, + val preview: ImageResource, + val collection: AppIconCollection +) { + + // Classic + + Main( + aliasName = "gloom.icons.classic.Main", + iconName = Res.strings.app_icon_main, + iconDescription = Res.strings.app_icon_main_description, + preview = Res.images.gloom_icon_default, + collection = AppIconCollection.Classic + ), + + Sky( + aliasName = "gloom.icons.classic.Sky", + iconName = Res.strings.app_icon_sky, + iconDescription = Res.strings.app_icon_sky_description, + preview = Res.images.gloom_icon_sky, + collection = AppIconCollection.Classic + ), + + Light( + aliasName = "gloom.icons.classic.Light", + iconName = Res.strings.app_icon_light, + iconDescription = Res.strings.app_icon_light_description, + preview = Res.images.gloom_icon_light, + collection = AppIconCollection.Classic + ), + + // Pride + + Pride( + aliasName = "gloom.icons.pride.LGBT", + iconName = Res.strings.app_icon_pride, + iconDescription = Res.strings.app_icon_pride_description, + preview = Res.images.gloom_icon_pride, + collection = AppIconCollection.Pride + ), + + Trans( + aliasName = "gloom.icons.pride.Trans", + iconName = Res.strings.app_icon_trans, + iconDescription = Res.strings.app_icon_trans_description, + preview = Res.images.gloom_icon_trans, + collection = AppIconCollection.Pride + ), + + TransInverted( + aliasName = "gloom.icons.pride.TransInverted", + iconName = Res.strings.app_icon_trans_inverted, + iconDescription = Res.strings.app_icon_trans_inverted_description, + preview = Res.images.gloom_icon_trans_inverted, + collection = AppIconCollection.Pride + ), + + // Catppuccin + + Mocha( + aliasName = "gloom.icons.catppuccin.Mocha", + iconName = Res.strings.app_icon_mocha, + iconDescription = Res.strings.app_icon_mocha_description, + preview = Res.images.gloom_icon_mocha, + collection = AppIconCollection.Catppuccin + ), + + Macchiato( + aliasName = "gloom.icons.catppuccin.Macchiato", + iconName = Res.strings.app_icon_macchiato, + iconDescription = Res.strings.app_icon_macchiato_description, + preview = Res.images.gloom_icon_macchiato, + collection = AppIconCollection.Catppuccin + ), + + Frappe( + aliasName = "gloom.icons.catppuccin.Frappe", + iconName = Res.strings.app_icon_frappe, + iconDescription = Res.strings.app_icon_frappe_description, + preview = Res.images.gloom_icon_frappe, + collection = AppIconCollection.Catppuccin + ), + + Latte( + aliasName = "gloom.icons.catppuccin.Latte", + iconName = Res.strings.app_icon_latte, + iconDescription = Res.strings.app_icon_latte_description, + preview = Res.images.gloom_icon_latte, + collection = AppIconCollection.Catppuccin + ) + +} + +enum class AppIconCollection( + val nameRes: StringResource +) { + Classic(Res.strings.app_icon_collection_classic), + Pride(Res.strings.app_icon_collection_pride), + Catppuccin(Res.strings.app_icon_collection_catppuccin) +} \ No newline at end of file diff --git a/ui/src/commonMain/moko-resources/base/strings_settings.xml b/ui/src/commonMain/moko-resources/base/strings_settings.xml index 4a8dda36..31b055fb 100644 --- a/ui/src/commonMain/moko-resources/base/strings_settings.xml +++ b/ui/src/commonMain/moko-resources/base/strings_settings.xml @@ -26,6 +26,51 @@ Squircle + + App Icon + Pick an icon for Gloom + + + Classic + + Default + The default Gloom icon. + + Sky + Huh... That's an interesting cloud... + + Light + The original, but light. + + + Pride + + LGBT + 🏳️‍🌈 + + Trans + 🏳️‍⚧️ + + Trans Inverted + 🏳️‍⚧️ but swapped + + + Catppuccin + + Mocha + Something rich to start your day! + + Macchiato + Prefer something a little lighter? + + Frappé + Must be hot out, huh? + + Latte + Would you prefer almond or soy? + + + Accounts Add or switch accounts diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_default@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_default@1x.png new file mode 100644 index 00000000..07ea39f1 Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_default@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_frappe@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_frappe@1x.png new file mode 100644 index 00000000..20766ddc Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_frappe@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_latte@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_latte@1x.png new file mode 100644 index 00000000..c29dbc2b Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_latte@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_light@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_light@1x.png new file mode 100644 index 00000000..adb3ad7e Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_light@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_macchiato@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_macchiato@1x.png new file mode 100644 index 00000000..8c89d7bc Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_macchiato@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_mocha@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_mocha@1x.png new file mode 100644 index 00000000..1912b9b4 Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_mocha@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_pride@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_pride@1x.png new file mode 100644 index 00000000..ab9a4047 Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_pride@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_sky@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_sky@1x.png new file mode 100644 index 00000000..250036cc Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_sky@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_trans@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_trans@1x.png new file mode 100644 index 00000000..c612033d Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_trans@1x.png differ diff --git a/ui/src/commonMain/moko-resources/images/gloom_icon_trans_inverted@1x.png b/ui/src/commonMain/moko-resources/images/gloom_icon_trans_inverted@1x.png new file mode 100644 index 00000000..4abeeece Binary files /dev/null and b/ui/src/commonMain/moko-resources/images/gloom_icon_trans_inverted@1x.png differ diff --git a/ui/src/androidMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt b/ui/src/desktopMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.desktop.kt similarity index 57% rename from ui/src/androidMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt rename to ui/src/desktopMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.desktop.kt index faff4894..5c76a154 100644 --- a/ui/src/androidMain/kotlin/com/materiiapps/gloom/di/module/PlatformViewModelModule.kt +++ b/ui/src/desktopMain/kotlin/com/materiiapps/gloom/di/module/PlatformModule.desktop.kt @@ -1,11 +1,15 @@ package com.materiiapps.gloom.di.module import com.materiiapps.gloom.ui.screen.release.viewmodel.ReleaseViewModel +import com.materiiapps.gloom.ui.util.AppIconSetter import org.koin.core.module.dsl.factoryOf +import org.koin.core.module.dsl.singleOf import org.koin.dsl.module -actual fun platformViewModelModule() = module { +actual fun platformModule() = module { factoryOf(::ReleaseViewModel) + singleOf(::AppIconSetter) + } \ No newline at end of file diff --git a/ui/src/desktopMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.desktop.kt b/ui/src/desktopMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.desktop.kt new file mode 100644 index 00000000..5f25ef25 --- /dev/null +++ b/ui/src/desktopMain/kotlin/com/materiiapps/gloom/ui/util/AppIconUtil.desktop.kt @@ -0,0 +1,11 @@ +package com.materiiapps.gloom.ui.util + +actual class AppIconSetter { + + actual var currentIcon: AppIcon = AppIcon.Main + + actual fun setIcon(appIcon: AppIcon) { + // NO-OP + } + +} \ No newline at end of file