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?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val useComposeUI =
|
|
||||||
runBlocking {
|
|
||||||
Settings.useComposeUI
|
|
||||||
}
|
|
||||||
|
|
||||||
val targetActivity =
|
val targetActivity =
|
||||||
if (useComposeUI) {
|
if (BuildConfig.DEBUG) {
|
||||||
ComposeActivity::class.java
|
val useComposeUI = runBlocking { Settings.useComposeUI }
|
||||||
|
if (useComposeUI) ComposeActivity::class.java else MainActivity::class.java
|
||||||
} else {
|
} else {
|
||||||
MainActivity::class.java
|
ComposeActivity::class.java
|
||||||
}
|
}
|
||||||
|
|
||||||
val launchIntent =
|
val launchIntent =
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.navigation.NavController
|
import androidx.navigation.NavController
|
||||||
|
import io.nekohasekai.sfa.BuildConfig
|
||||||
import io.nekohasekai.sfa.R
|
import io.nekohasekai.sfa.R
|
||||||
import io.nekohasekai.sfa.database.Settings
|
import io.nekohasekai.sfa.database.Settings
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
@@ -275,51 +276,53 @@ fun SettingsScreen(navController: NavController) {
|
|||||||
modifier = Modifier.padding(horizontal = 32.dp, vertical = 8.dp),
|
modifier = Modifier.padding(horizontal = 32.dp, vertical = 8.dp),
|
||||||
)
|
)
|
||||||
|
|
||||||
Card(
|
if (BuildConfig.DEBUG) {
|
||||||
modifier =
|
Card(
|
||||||
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,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
modifier =
|
modifier =
|
||||||
Modifier
|
Modifier
|
||||||
.clip(RoundedCornerShape(12.dp))
|
.fillMaxWidth()
|
||||||
.clickable {
|
.padding(horizontal = 16.dp),
|
||||||
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 =
|
colors =
|
||||||
ListItemDefaults.colors(
|
CardDefaults.cardColors(
|
||||||
containerColor = Color.Transparent,
|
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))
|
Spacer(modifier = Modifier.height(16.dp))
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import io.nekohasekai.libbox.Libbox
|
import io.nekohasekai.libbox.Libbox
|
||||||
import io.nekohasekai.sfa.Application
|
import io.nekohasekai.sfa.Application
|
||||||
|
import io.nekohasekai.sfa.BuildConfig
|
||||||
import io.nekohasekai.sfa.R
|
import io.nekohasekai.sfa.R
|
||||||
import io.nekohasekai.sfa.constant.EnabledType
|
import io.nekohasekai.sfa.constant.EnabledType
|
||||||
import io.nekohasekai.sfa.database.Settings
|
import io.nekohasekai.sfa.database.Settings
|
||||||
@@ -167,6 +168,7 @@ class SettingsFragment : Fragment() {
|
|||||||
binding.dynamicNotificationEnabled.text =
|
binding.dynamicNotificationEnabled.text =
|
||||||
EnabledType.from(dynamicNotification).getString(requireContext())
|
EnabledType.from(dynamicNotification).getString(requireContext())
|
||||||
binding.dynamicNotificationEnabled.setSimpleItems(R.array.enabled)
|
binding.dynamicNotificationEnabled.setSimpleItems(R.array.enabled)
|
||||||
|
binding.experimentalFeaturesCard.isVisible = BuildConfig.DEBUG
|
||||||
binding.useComposeUIEnabled.text =
|
binding.useComposeUIEnabled.text =
|
||||||
EnabledType.from(useComposeUI).getString(requireContext())
|
EnabledType.from(useComposeUI).getString(requireContext())
|
||||||
binding.useComposeUIEnabled.setSimpleItems(R.array.enabled)
|
binding.useComposeUIEnabled.setSimpleItems(R.array.enabled)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.android.application' version '8.13.1' apply false
|
id 'com.android.application' version '8.13.2' apply false
|
||||||
id 'com.android.library' version '8.13.1' apply false
|
id 'com.android.library' version '8.13.2' apply false
|
||||||
id 'org.jetbrains.kotlin.android' version '2.2.0' 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.google.devtools.ksp' version '2.2.0-2.0.2' apply false
|
||||||
id 'com.github.triplet.play' version '3.12.1' apply false
|
id 'com.github.triplet.play' version '3.12.1' apply false
|
||||||
|
|||||||
Reference in New Issue
Block a user