Use the new UI entirely for the release build
This commit is contained in:
@@ -12,16 +12,12 @@ class LauncherActivity : Activity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
val useComposeUI =
|
||||
runBlocking {
|
||||
Settings.useComposeUI
|
||||
}
|
||||
|
||||
val targetActivity =
|
||||
if (useComposeUI) {
|
||||
ComposeActivity::class.java
|
||||
if (BuildConfig.DEBUG) {
|
||||
val useComposeUI = runBlocking { Settings.useComposeUI }
|
||||
if (useComposeUI) ComposeActivity::class.java else MainActivity::class.java
|
||||
} else {
|
||||
MainActivity::class.java
|
||||
ComposeActivity::class.java
|
||||
}
|
||||
|
||||
val launchIntent =
|
||||
|
||||
@@ -37,6 +37,7 @@ import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavController
|
||||
import io.nekohasekai.sfa.BuildConfig
|
||||
import io.nekohasekai.sfa.R
|
||||
import io.nekohasekai.sfa.database.Settings
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -275,51 +276,53 @@ fun SettingsScreen(navController: NavController) {
|
||||
modifier = Modifier.padding(horizontal = 32.dp, vertical = 8.dp),
|
||||
)
|
||||
|
||||
Card(
|
||||
modifier =
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
colors =
|
||||
CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainer,
|
||||
),
|
||||
) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text(
|
||||
stringResource(R.string.switch_to_legacy_ui),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
)
|
||||
},
|
||||
leadingContent = {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.SwapHoriz,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
},
|
||||
if (BuildConfig.DEBUG) {
|
||||
Card(
|
||||
modifier =
|
||||
Modifier
|
||||
.clip(RoundedCornerShape(12.dp))
|
||||
.clickable {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
Settings.useComposeUI = false
|
||||
val intent =
|
||||
android.content.Intent(
|
||||
context,
|
||||
Class.forName("io.nekohasekai.sfa.ui.MainActivity"),
|
||||
)
|
||||
intent.flags =
|
||||
android.content.Intent.FLAG_ACTIVITY_NEW_TASK or android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
context.startActivity(intent)
|
||||
}
|
||||
},
|
||||
.fillMaxWidth()
|
||||
.padding(horizontal = 16.dp),
|
||||
colors =
|
||||
ListItemDefaults.colors(
|
||||
containerColor = Color.Transparent,
|
||||
CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surfaceContainer,
|
||||
),
|
||||
)
|
||||
) {
|
||||
ListItem(
|
||||
headlineContent = {
|
||||
Text(
|
||||
stringResource(R.string.switch_to_legacy_ui),
|
||||
style = MaterialTheme.typography.bodyLarge,
|
||||
)
|
||||
},
|
||||
leadingContent = {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.SwapHoriz,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.primary,
|
||||
)
|
||||
},
|
||||
modifier =
|
||||
Modifier
|
||||
.clip(RoundedCornerShape(12.dp))
|
||||
.clickable {
|
||||
scope.launch(Dispatchers.IO) {
|
||||
Settings.useComposeUI = false
|
||||
val intent =
|
||||
android.content.Intent(
|
||||
context,
|
||||
Class.forName("io.nekohasekai.sfa.ui.MainActivity"),
|
||||
)
|
||||
intent.flags =
|
||||
android.content.Intent.FLAG_ACTIVITY_NEW_TASK or android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
context.startActivity(intent)
|
||||
}
|
||||
},
|
||||
colors =
|
||||
ListItemDefaults.colors(
|
||||
containerColor = Color.Transparent,
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
@@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import io.nekohasekai.libbox.Libbox
|
||||
import io.nekohasekai.sfa.Application
|
||||
import io.nekohasekai.sfa.BuildConfig
|
||||
import io.nekohasekai.sfa.R
|
||||
import io.nekohasekai.sfa.constant.EnabledType
|
||||
import io.nekohasekai.sfa.database.Settings
|
||||
@@ -167,6 +168,7 @@ class SettingsFragment : Fragment() {
|
||||
binding.dynamicNotificationEnabled.text =
|
||||
EnabledType.from(dynamicNotification).getString(requireContext())
|
||||
binding.dynamicNotificationEnabled.setSimpleItems(R.array.enabled)
|
||||
binding.experimentalFeaturesCard.isVisible = BuildConfig.DEBUG
|
||||
binding.useComposeUIEnabled.text =
|
||||
EnabledType.from(useComposeUI).getString(requireContext())
|
||||
binding.useComposeUIEnabled.setSimpleItems(R.array.enabled)
|
||||
|
||||
@@ -5,8 +5,8 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.android.application' version '8.13.1' apply false
|
||||
id 'com.android.library' version '8.13.1' apply false
|
||||
id 'com.android.application' version '8.13.2' apply false
|
||||
id 'com.android.library' version '8.13.2' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '2.2.0' apply false
|
||||
id 'com.google.devtools.ksp' version '2.2.0-2.0.2' apply false
|
||||
id 'com.github.triplet.play' version '3.12.1' apply false
|
||||
|
||||
Reference in New Issue
Block a user