Skip to content

Commit

Permalink
Add ivfun launcher icons
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelekol committed Sep 30, 2024
1 parent d0fa4b9 commit 09b0c4a
Show file tree
Hide file tree
Showing 12 changed files with 1,670 additions and 77 deletions.
64 changes: 64 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,70 @@
<data android:pathPrefix="/referral" />
</intent-filter>
</activity-alias>
<activity-alias
android:name="${applicationId}.IvfunLauncherAlias"
android:enabled="false"
android:icon="@mipmap/launcher_ivfun"
android:label="@string/App_Name"
android:exported="true"
android:targetActivity=".modules.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wc" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/DeeplinkScheme" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="unstoppable.money" />
<data android:pathPrefix="/referral" />
</intent-filter>
</activity-alias>
<activity-alias
android:name="${applicationId}.DuckLauncherAlias"
android:enabled="false"
android:icon="@mipmap/launcher_duck"
android:label="@string/App_Name"
android:exported="true"
android:targetActivity=".modules.main.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="wc" />
</intent-filter>
<intent-filter android:label="@string/App_Name">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/DeeplinkScheme" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="unstoppable.money" />
<data android:pathPrefix="/referral" />
</intent-filter>
</activity-alias>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.update

class AppIconService(private val localStorage: ILocalStorage) {
private val appIcons by lazy { AppIcon.values().asList() }
private val appIcons by lazy { AppIcon.entries }

private val _optionsFlow = MutableStateFlow(
Select(localStorage.appIcon ?: AppIcon.Main, appIcons)
Expand All @@ -27,7 +27,7 @@ class AppIconService(private val localStorage: ILocalStorage) {
val enabled = PackageManager.COMPONENT_ENABLED_STATE_ENABLED
val disabled = PackageManager.COMPONENT_ENABLED_STATE_DISABLED

AppIcon.values().forEach { item ->
AppIcon.entries.forEach { item ->
App.instance.packageManager.setComponentEnabledSetting(
ComponentName(App.instance, item.launcherName),
if (appIcon == item) enabled else disabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
Expand Down Expand Up @@ -47,15 +46,12 @@ import io.horizontalsystems.bankwallet.ui.compose.ComposeAppTheme
import io.horizontalsystems.bankwallet.ui.compose.Select
import io.horizontalsystems.bankwallet.ui.compose.components.AlertGroup
import io.horizontalsystems.bankwallet.ui.compose.components.AppBar
import io.horizontalsystems.bankwallet.ui.compose.components.B2
import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryTransparent
import io.horizontalsystems.bankwallet.ui.compose.components.ButtonPrimaryYellow
import io.horizontalsystems.bankwallet.ui.compose.components.CellUniversalLawrenceSection
import io.horizontalsystems.bankwallet.ui.compose.components.D1
import io.horizontalsystems.bankwallet.ui.compose.components.HeaderText
import io.horizontalsystems.bankwallet.ui.compose.components.HsBackButton
import io.horizontalsystems.bankwallet.ui.compose.components.HsSwitch
import io.horizontalsystems.bankwallet.ui.compose.components.MultitextM1
import io.horizontalsystems.bankwallet.ui.compose.components.RowUniversal
import io.horizontalsystems.bankwallet.ui.compose.components.TextImportantWarning
import io.horizontalsystems.bankwallet.ui.compose.components.VSpacer
Expand Down Expand Up @@ -323,12 +319,13 @@ private fun AppIconSection(appIconOptions: Select<AppIcon>, onAppIconSelect: (Ap
AppIconsRow(rows[0], appIconOptions.selected, onAppIconSelect)
AppIconsRow(rows[1], appIconOptions.selected, onAppIconSelect)
AppIconsRow(rows[2], appIconOptions.selected, onAppIconSelect)
AppIconsRow(rows[3], appIconOptions.selected, onAppIconSelect)
}
}

@Composable
private fun AppIconsRow(
chunk: List<AppIcon>,
chunk: List<AppIcon?>,
selected: AppIcon,
onAppIconSelect: (AppIcon) -> Unit
) {
Expand All @@ -338,21 +335,19 @@ private fun AppIconsRow(
.padding(horizontal = 14.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
IconBox(
chunk[0].icon,
chunk[0].title.getString(),
chunk[0] == selected,
) { onAppIconSelect(chunk[0]) }
IconBox(
chunk[1].icon,
chunk[1].title.getString(),
chunk[1] == selected,
) { onAppIconSelect(chunk[1]) }
IconBox(
chunk[2].icon,
chunk[2].title.getString(),
chunk[2] == selected
) { onAppIconSelect(chunk[2]) }
for (i in 0 until 3) {
val appIcon = chunk.getOrNull(i)
if (appIcon != null) {
IconBox(
appIcon.icon,
appIcon.title.getString(),
appIcon == selected
) { onAppIconSelect(appIcon) }
} else {
// Invisible element to preserve space
Spacer(modifier = Modifier.size(60.dp))
}
}
}
}

Expand Down Expand Up @@ -390,60 +385,6 @@ private fun IconBox(

}

@Composable
private fun RowMultilineSelect(
title: String,
subtitle: String,
selected: Boolean,
onClick: () -> Unit
) {
RowUniversal(
modifier = Modifier.padding(horizontal = 16.dp),
onClick = onClick
) {
MultitextM1(
title = { B2(text = title) },
subtitle = { D1(text = subtitle) }
)
Spacer(modifier = Modifier.weight(1f))
if (selected) {
Image(
painter = painterResource(id = R.drawable.ic_checkmark_20),
contentDescription = null,
colorFilter = ColorFilter.tint(ComposeAppTheme.colors.jacob)
)
}
}
}

@Composable
fun RowSelect(
imageContent: @Composable RowScope.() -> Unit,
text: String,
selected: Boolean,
onClick: () -> Unit
) {
RowUniversal(
modifier = Modifier.padding(horizontal = 16.dp),
onClick = onClick
) {
imageContent.invoke(this)
body_leah(
text = text,
modifier = Modifier
.weight(1f)
.padding(horizontal = 16.dp)
)
if (selected) {
Image(
painter = painterResource(id = R.drawable.ic_checkmark_20),
contentDescription = null,
colorFilter = ColorFilter.tint(ComposeAppTheme.colors.jacob)
)
}
}
}

@Composable
fun MenuItemWithDialog(
@StringRes title: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ enum class AppIcon(val icon: Int, val titleText: String) : WithTranslatableTitle
Yak(R.drawable.launcher_yak_preview, "Yak"),
Punk(R.drawable.launcher_punk_preview, "Punk"),
Ape(R.drawable.launcher_ape_preview, "#1874"),
Ball8(R.drawable.launcher_8ball_preview, "8ball");
Ball8(R.drawable.launcher_8ball_preview, "8ball"),
Ivfun(R.drawable.launcher_ivfun_preview, "Ivfun"),
Duck(R.drawable.launcher_duck_preview, "Duck");

override val title: TranslatableString
get() = TranslatableString.PlainString(titleText)
Expand Down
Loading

0 comments on commit 09b0c4a

Please sign in to comment.