mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 11:05:59 +00:00
Timezone ID selector
Use IconButton to save/delete preferential network config Fix horizontal padding across SubPageItem and SwitchItem Delete User guide link in About
This commit is contained in:
@@ -91,9 +91,7 @@ class MainActivity : FragmentActivity() {
|
|||||||
val context = applicationContext
|
val context = applicationContext
|
||||||
val sharedPref = context.getSharedPreferences("data", MODE_PRIVATE)
|
val sharedPref = context.getSharedPreferences("data", MODE_PRIVATE)
|
||||||
if (VERSION.SDK_INT >= 28) HiddenApiBypass.setHiddenApiExemptions("")
|
if (VERSION.SDK_INT >= 28) HiddenApiBypass.setHiddenApiExemptions("")
|
||||||
if(sharedPref.getBoolean("auth", false)) {
|
if(sharedPref.getBoolean("auth", false)) showAuth.value = true
|
||||||
showAuth.value = true
|
|
||||||
}
|
|
||||||
val locale = context.resources?.configuration?.locale
|
val locale = context.resources?.configuration?.locale
|
||||||
zhCN = locale == Locale.SIMPLIFIED_CHINESE || locale == Locale.CHINESE || locale == Locale.CHINA
|
zhCN = locale == Locale.SIMPLIFIED_CHINESE || locale == Locale.CHINESE || locale == Locale.CHINA
|
||||||
toggleInstallAppActivity()
|
toggleInstallAppActivity()
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ private fun ThemeSettings(vm: MyViewModel) {
|
|||||||
SubPageItem(R.string.dark_theme, stringResource(darkThemeTextID)) { darkThemeMenu = true }
|
SubPageItem(R.string.dark_theme, stringResource(darkThemeTextID)) { darkThemeMenu = true }
|
||||||
DropdownMenu(
|
DropdownMenu(
|
||||||
expanded = darkThemeMenu, onDismissRequest = { darkThemeMenu = false },
|
expanded = darkThemeMenu, onDismissRequest = { darkThemeMenu = false },
|
||||||
offset = DpOffset(x = 30.dp, y = 0.dp)
|
offset = DpOffset(x = 25.dp, y = 0.dp)
|
||||||
) {
|
) {
|
||||||
DropdownMenuItem(
|
DropdownMenuItem(
|
||||||
text = { Text(stringResource(R.string.follow_system)) },
|
text = { Text(stringResource(R.string.follow_system)) },
|
||||||
@@ -240,7 +240,6 @@ private fun About() {
|
|||||||
Spacer(Modifier.padding(vertical = 5.dp))
|
Spacer(Modifier.padding(vertical = 5.dp))
|
||||||
Text(text = stringResource(R.string.app_name)+" v$verName ($verCode)", modifier = Modifier.padding(start = 26.dp))
|
Text(text = stringResource(R.string.app_name)+" v$verName ($verCode)", modifier = Modifier.padding(start = 26.dp))
|
||||||
Spacer(Modifier.padding(vertical = 5.dp))
|
Spacer(Modifier.padding(vertical = 5.dp))
|
||||||
SubPageItem(R.string.user_guide, "", R.drawable.open_in_new) { shareLink(context, "https://owndroid.pages.dev") }
|
|
||||||
SubPageItem(R.string.source_code, "", R.drawable.open_in_new) { shareLink(context, "https://github.com/BinTianqi/OwnDroid") }
|
SubPageItem(R.string.source_code, "", R.drawable.open_in_new) { shareLink(context, "https://github.com/BinTianqi/OwnDroid") }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import androidx.compose.animation.AnimatedVisibility
|
|||||||
import androidx.compose.animation.animateContentSize
|
import androidx.compose.animation.animateContentSize
|
||||||
import androidx.compose.foundation.ScrollState
|
import androidx.compose.foundation.ScrollState
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.horizontalScroll
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
@@ -58,12 +57,12 @@ import androidx.compose.foundation.rememberScrollState
|
|||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowLeft
|
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowLeft
|
||||||
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
import androidx.compose.material.icons.automirrored.filled.KeyboardArrowRight
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
|
import androidx.compose.material.icons.filled.Delete
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
import androidx.compose.material3.Icon
|
import androidx.compose.material3.Icon
|
||||||
@@ -826,8 +825,11 @@ fun PreferentialNetworkService() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row {
|
Row(
|
||||||
Button(
|
horizontalArrangement = Arrangement.Center,
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
) {
|
||||||
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
try {
|
try {
|
||||||
saveCurrentConfig()
|
saveCurrentConfig()
|
||||||
@@ -837,19 +839,18 @@ fun PreferentialNetworkService() {
|
|||||||
Toast.makeText(context, R.string.failed_to_save_current_config, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, R.string.failed_to_save_current_config, Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
modifier = Modifier.fillMaxWidth(0.49F)
|
modifier = Modifier.padding(end = 10.dp)
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.save_current_config))
|
Icon(painter = painterResource(R.drawable.save_fill0), contentDescription = stringResource(R.string.save_current_config))
|
||||||
}
|
}
|
||||||
Button(
|
IconButton(
|
||||||
onClick = {
|
onClick = {
|
||||||
if(index < configs.size) configs.removeAt(index)
|
if(index < configs.size) configs.removeAt(index)
|
||||||
if(index > 0) index -= 1
|
if(index > 0) index -= 1
|
||||||
refresh()
|
refresh()
|
||||||
},
|
}
|
||||||
modifier = Modifier.fillMaxWidth(0.96F)
|
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.delete_current_config))
|
Icon(imageVector = Icons.Default.Delete, contentDescription = stringResource(R.string.delete_current_config))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SwitchItem(
|
SwitchItem(
|
||||||
|
|||||||
@@ -418,7 +418,6 @@ private fun DeviceOwner() {
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val dpm = context.getDPM()
|
val dpm = context.getDPM()
|
||||||
var deactivateDialog by remember { mutableStateOf(false) }
|
var deactivateDialog by remember { mutableStateOf(false) }
|
||||||
var resetPolicy by remember { mutableStateOf(true) }
|
|
||||||
val deviceOwner = context.isDeviceOwner
|
val deviceOwner = context.isDeviceOwner
|
||||||
Column(modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 8.dp)) {
|
Column(modifier = Modifier.fillMaxSize().verticalScroll(rememberScrollState()).padding(horizontal = 8.dp)) {
|
||||||
Spacer(Modifier.padding(vertical = 10.dp))
|
Spacer(Modifier.padding(vertical = 10.dp))
|
||||||
@@ -443,6 +442,7 @@ private fun DeviceOwner() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(deactivateDialog) {
|
if(deactivateDialog) {
|
||||||
|
var resetPolicy by remember { mutableStateOf(false) }
|
||||||
val sharedPref = LocalContext.current.getSharedPreferences("data", Context.MODE_PRIVATE)
|
val sharedPref = LocalContext.current.getSharedPreferences("data", Context.MODE_PRIVATE)
|
||||||
val coroutine = rememberCoroutineScope()
|
val coroutine = rememberCoroutineScope()
|
||||||
AlertDialog(
|
AlertDialog(
|
||||||
|
|||||||
@@ -38,7 +38,6 @@ import android.app.admin.SystemUpdatePolicy.TYPE_POSTPONE
|
|||||||
import android.content.ComponentName
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.icu.text.IDNA
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build.VERSION
|
import android.os.Build.VERSION
|
||||||
import android.os.UserManager
|
import android.os.UserManager
|
||||||
@@ -55,13 +54,15 @@ import androidx.compose.foundation.layout.fillMaxSize
|
|||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.width
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.KeyboardActions
|
import androidx.compose.foundation.text.KeyboardActions
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
|
import androidx.compose.material.icons.automirrored.filled.List
|
||||||
import androidx.compose.material.icons.filled.Add
|
import androidx.compose.material.icons.filled.Add
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.AlertDialog
|
||||||
import androidx.compose.material3.Button
|
import androidx.compose.material3.Button
|
||||||
@@ -77,7 +78,6 @@ import androidx.compose.material3.Text
|
|||||||
import androidx.compose.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.MutableState
|
|
||||||
import androidx.compose.runtime.collectAsState
|
import androidx.compose.runtime.collectAsState
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableIntStateOf
|
import androidx.compose.runtime.mutableIntStateOf
|
||||||
@@ -140,8 +140,6 @@ fun SystemManage(navCtrl: NavHostController) {
|
|||||||
val localNavCtrl = rememberNavController()
|
val localNavCtrl = rememberNavController()
|
||||||
val backStackEntry by localNavCtrl.currentBackStackEntryAsState()
|
val backStackEntry by localNavCtrl.currentBackStackEntryAsState()
|
||||||
val scrollState = rememberScrollState()
|
val scrollState = rememberScrollState()
|
||||||
val rebootDialog = remember { mutableStateOf(false) }
|
|
||||||
val bugReportDialog = remember { mutableStateOf(false) }
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopBar(backStackEntry,navCtrl,localNavCtrl) {
|
TopBar(backStackEntry,navCtrl,localNavCtrl) {
|
||||||
@@ -162,7 +160,7 @@ fun SystemManage(navCtrl: NavHostController) {
|
|||||||
popExitTransition = Animations.navHostPopExitTransition,
|
popExitTransition = Animations.navHostPopExitTransition,
|
||||||
modifier = Modifier.padding(top = it.calculateTopPadding())
|
modifier = Modifier.padding(top = it.calculateTopPadding())
|
||||||
) {
|
) {
|
||||||
composable(route = "Home") { Home(localNavCtrl, scrollState, rebootDialog, bugReportDialog) }
|
composable(route = "Home") { Home(localNavCtrl, scrollState) }
|
||||||
composable(route = "Switches") { Switches() }
|
composable(route = "Switches") { Switches() }
|
||||||
composable(route = "Keyguard") { Keyguard() }
|
composable(route = "Keyguard") { Keyguard() }
|
||||||
composable(route = "EditTime") { EditTime() }
|
composable(route = "EditTime") { EditTime() }
|
||||||
@@ -180,16 +178,11 @@ fun SystemManage(navCtrl: NavHostController) {
|
|||||||
composable(route = "FRP") { FactoryResetProtection() }
|
composable(route = "FRP") { FactoryResetProtection() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(rebootDialog.value) {
|
|
||||||
RebootDialog(rebootDialog)
|
|
||||||
}
|
|
||||||
if(bugReportDialog.value) {
|
|
||||||
BugReportDialog(bugReportDialog)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("NewApi")
|
||||||
@Composable
|
@Composable
|
||||||
private fun Home(navCtrl: NavHostController, scrollState: ScrollState, rebootDialog: MutableState<Boolean>, bugReportDialog: MutableState<Boolean>) {
|
private fun Home(navCtrl: NavHostController, scrollState: ScrollState) {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
val dpm = context.getDPM()
|
val dpm = context.getDPM()
|
||||||
val receiver = context.getReceiver()
|
val receiver = context.getReceiver()
|
||||||
@@ -198,6 +191,7 @@ private fun Home(navCtrl: NavHostController, scrollState: ScrollState, rebootDia
|
|||||||
val dangerousFeatures = sharedPref.getBoolean("dangerous_features", false)
|
val dangerousFeatures = sharedPref.getBoolean("dangerous_features", false)
|
||||||
val deviceOwner = context.isDeviceOwner
|
val deviceOwner = context.isDeviceOwner
|
||||||
val profileOwner = context.isProfileOwner
|
val profileOwner = context.isProfileOwner
|
||||||
|
var dialog by remember { mutableIntStateOf(0) }
|
||||||
Column(modifier = Modifier.fillMaxSize().verticalScroll(scrollState)) {
|
Column(modifier = Modifier.fillMaxSize().verticalScroll(scrollState)) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(R.string.system_manage),
|
text = stringResource(R.string.system_manage),
|
||||||
@@ -209,10 +203,10 @@ private fun Home(navCtrl: NavHostController, scrollState: ScrollState, rebootDia
|
|||||||
}
|
}
|
||||||
SubPageItem(R.string.keyguard, "", R.drawable.screen_lock_portrait_fill0) { navCtrl.navigate("Keyguard") }
|
SubPageItem(R.string.keyguard, "", R.drawable.screen_lock_portrait_fill0) { navCtrl.navigate("Keyguard") }
|
||||||
if(VERSION.SDK_INT >= 24 && deviceOwner) {
|
if(VERSION.SDK_INT >= 24 && deviceOwner) {
|
||||||
SubPageItem(R.string.reboot, "", R.drawable.restart_alt_fill0) { rebootDialog.value = true }
|
SubPageItem(R.string.reboot, "", R.drawable.restart_alt_fill0) { dialog = 1 }
|
||||||
}
|
}
|
||||||
if(deviceOwner && ((VERSION.SDK_INT >= 28 && dpm.isAffiliatedUser) || VERSION.SDK_INT >= 24)) {
|
if(deviceOwner && ((VERSION.SDK_INT >= 28 && dpm.isAffiliatedUser) || VERSION.SDK_INT >= 24)) {
|
||||||
SubPageItem(R.string.bug_report, "", R.drawable.bug_report_fill0) { bugReportDialog.value = true }
|
SubPageItem(R.string.bug_report, "", R.drawable.bug_report_fill0) { dialog = 2 }
|
||||||
}
|
}
|
||||||
if(VERSION.SDK_INT >= 28 && (deviceOwner || dpm.isOrgProfile(receiver))) {
|
if(VERSION.SDK_INT >= 28 && (deviceOwner || dpm.isOrgProfile(receiver))) {
|
||||||
SubPageItem(R.string.edit_time, "", R.drawable.schedule_fill0) { navCtrl.navigate("EditTime") }
|
SubPageItem(R.string.edit_time, "", R.drawable.schedule_fill0) { navCtrl.navigate("EditTime") }
|
||||||
@@ -254,6 +248,32 @@ private fun Home(navCtrl: NavHostController, scrollState: ScrollState, rebootDia
|
|||||||
Spacer(Modifier.padding(vertical = 30.dp))
|
Spacer(Modifier.padding(vertical = 30.dp))
|
||||||
LaunchedEffect(Unit) { fileUriFlow.value = Uri.parse("") }
|
LaunchedEffect(Unit) { fileUriFlow.value = Uri.parse("") }
|
||||||
}
|
}
|
||||||
|
if(dialog != 0) AlertDialog(
|
||||||
|
onDismissRequest = { dialog = 0 },
|
||||||
|
title = { Text(stringResource(if(dialog == 1) R.string.reboot else R.string.bug_report)) },
|
||||||
|
text = { Text(stringResource(if(dialog == 1) R.string.info_reboot else R.string.confirm_bug_report)) },
|
||||||
|
dismissButton = {
|
||||||
|
TextButton(onClick = { dialog = 0 }) {
|
||||||
|
Text(stringResource(R.string.cancel))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirmButton = {
|
||||||
|
TextButton(
|
||||||
|
onClick = {
|
||||||
|
if(dialog == 1) {
|
||||||
|
dpm.reboot(receiver)
|
||||||
|
} else {
|
||||||
|
val result = dpm.requestBugreport(receiver)
|
||||||
|
Toast.makeText(context, if(result) R.string.success else R.string.failed, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
dialog = 0
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
Text(stringResource(R.string.confirm))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
modifier = Modifier.fillMaxWidth()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -406,63 +426,6 @@ private fun Keyguard() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
|
||||||
@Composable
|
|
||||||
private fun BugReportDialog(status: MutableState<Boolean>) {
|
|
||||||
val context = LocalContext.current
|
|
||||||
val dpm = context.getDPM()
|
|
||||||
val receiver = context.getReceiver()
|
|
||||||
AlertDialog(
|
|
||||||
onDismissRequest = { status.value = false },
|
|
||||||
title = { Text(stringResource(R.string.bug_report)) },
|
|
||||||
text = { Text(stringResource(R.string.confirm_bug_report)) },
|
|
||||||
dismissButton = {
|
|
||||||
TextButton(onClick = { status.value = false }) {
|
|
||||||
Text(stringResource(R.string.cancel))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
confirmButton = {
|
|
||||||
TextButton(
|
|
||||||
onClick = {
|
|
||||||
val result = dpm.requestBugreport(receiver)
|
|
||||||
Toast.makeText(context, if(result) R.string.success else R.string.failed, Toast.LENGTH_SHORT).show()
|
|
||||||
status.value = false
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
Text(stringResource(R.string.confirm))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
|
||||||
@Composable
|
|
||||||
private fun RebootDialog(status: MutableState<Boolean>) {
|
|
||||||
val context = LocalContext.current
|
|
||||||
val dpm = context.getDPM()
|
|
||||||
val receiver = context.getReceiver()
|
|
||||||
AlertDialog(
|
|
||||||
onDismissRequest = { status.value = false },
|
|
||||||
title = { Text(stringResource(R.string.reboot)) },
|
|
||||||
text = { Text(stringResource(R.string.info_reboot)) },
|
|
||||||
dismissButton = {
|
|
||||||
TextButton(onClick = { status.value = false }) {
|
|
||||||
Text(stringResource(R.string.cancel))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
confirmButton = {
|
|
||||||
TextButton(
|
|
||||||
onClick = { dpm.reboot(receiver) },
|
|
||||||
colors = ButtonDefaults.textButtonColors(contentColor = colorScheme.error)
|
|
||||||
) {
|
|
||||||
Text(stringResource(R.string.confirm))
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modifier = Modifier.fillMaxWidth()
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
@Composable
|
@Composable
|
||||||
private fun EditTime() {
|
private fun EditTime() {
|
||||||
@@ -501,8 +464,8 @@ private fun EditTimeZone() {
|
|||||||
val dpm = context.getDPM()
|
val dpm = context.getDPM()
|
||||||
val focusMgr = LocalFocusManager.current
|
val focusMgr = LocalFocusManager.current
|
||||||
val receiver = context.getReceiver()
|
val receiver = context.getReceiver()
|
||||||
var expanded by remember { mutableStateOf(false) }
|
|
||||||
var inputTimezone by remember { mutableStateOf("") }
|
var inputTimezone by remember { mutableStateOf("") }
|
||||||
|
var dialog by remember { mutableStateOf(false) }
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxSize().padding(horizontal = 8.dp).verticalScroll(rememberScrollState()),
|
modifier = Modifier.fillMaxSize().padding(horizontal = 8.dp).verticalScroll(rememberScrollState()),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
horizontalAlignment = Alignment.CenterHorizontally
|
||||||
@@ -514,6 +477,11 @@ private fun EditTimeZone() {
|
|||||||
value = inputTimezone,
|
value = inputTimezone,
|
||||||
label = { Text(stringResource(R.string.timezone_id)) },
|
label = { Text(stringResource(R.string.timezone_id)) },
|
||||||
onValueChange = { inputTimezone = it },
|
onValueChange = { inputTimezone = it },
|
||||||
|
trailingIcon = {
|
||||||
|
IconButton(onClick = { dialog = true }) {
|
||||||
|
Icon(imageVector = Icons.AutoMirrored.Default.List, contentDescription = null)
|
||||||
|
}
|
||||||
|
},
|
||||||
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Ascii, imeAction = ImeAction.Done),
|
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Ascii, imeAction = ImeAction.Done),
|
||||||
keyboardActions = KeyboardActions(onDone = { focusMgr.clearFocus() }),
|
keyboardActions = KeyboardActions(onDone = { focusMgr.clearFocus() }),
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth()
|
||||||
@@ -524,27 +492,41 @@ private fun EditTimeZone() {
|
|||||||
val result = dpm.setTimeZone(receiver, inputTimezone)
|
val result = dpm.setTimeZone(receiver, inputTimezone)
|
||||||
Toast.makeText(context, if(result) R.string.success else R.string.failed, Toast.LENGTH_SHORT).show()
|
Toast.makeText(context, if(result) R.string.success else R.string.failed, Toast.LENGTH_SHORT).show()
|
||||||
},
|
},
|
||||||
modifier = Modifier.width(100.dp)
|
modifier = Modifier.fillMaxWidth()
|
||||||
) {
|
) {
|
||||||
Text(stringResource(R.string.apply))
|
Text(stringResource(R.string.apply))
|
||||||
}
|
}
|
||||||
Spacer(Modifier.padding(vertical = 7.dp))
|
|
||||||
Button(onClick = { expanded = !expanded }) {
|
|
||||||
Text(stringResource(if(expanded) R.string.hide_all_timezones else R.string.view_all_timezones))
|
|
||||||
}
|
|
||||||
AnimatedVisibility(expanded) {
|
|
||||||
var ids = ""
|
|
||||||
TimeZone.getAvailableIDs().forEach { ids += "$it\n" }
|
|
||||||
SelectionContainer {
|
|
||||||
Text(ids)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Spacer(Modifier.padding(vertical = 10.dp))
|
Spacer(Modifier.padding(vertical = 10.dp))
|
||||||
Information {
|
Information {
|
||||||
Text(stringResource(R.string.disable_auto_time_zone_before_set))
|
Text(stringResource(R.string.disable_auto_time_zone_before_set))
|
||||||
}
|
}
|
||||||
Spacer(Modifier.padding(vertical = 30.dp))
|
|
||||||
}
|
}
|
||||||
|
if(dialog) AlertDialog(
|
||||||
|
text = {
|
||||||
|
LazyColumn {
|
||||||
|
items(TimeZone.getAvailableIDs()) {
|
||||||
|
Text(
|
||||||
|
text = it,
|
||||||
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.padding(vertical = 1.dp)
|
||||||
|
.clip(RoundedCornerShape(15))
|
||||||
|
.clickable {
|
||||||
|
inputTimezone = it
|
||||||
|
dialog = false
|
||||||
|
}
|
||||||
|
.padding(start = 6.dp, top = 10.dp, bottom = 10.dp)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
confirmButton = {
|
||||||
|
TextButton(onClick = { dialog = false }) {
|
||||||
|
Text(stringResource(R.string.cancel))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDismissRequest = { dialog = false }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
|
|||||||
@@ -40,16 +40,25 @@ fun SubPageItem(
|
|||||||
operation: () -> Unit
|
operation: () -> Unit
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth().clickable(onClick = operation).padding(top = 15.dp, bottom = 15.dp, start = 30.dp, end = 12.dp),
|
modifier = Modifier
|
||||||
|
.fillMaxWidth()
|
||||||
|
.clickable(onClick = operation)
|
||||||
|
.padding(start = 25.dp, end = 15.dp)
|
||||||
|
.padding(vertical = 12.dp + (if(desc != "") 0 else 3).dp),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
if(icon != null) {
|
if(icon != null) Icon(
|
||||||
Icon(painter = painterResource(icon), contentDescription = stringResource(title), modifier = Modifier.padding(top = 1.dp))
|
painter = painterResource(icon),
|
||||||
Spacer(Modifier.padding(start = 15.dp))
|
contentDescription = null,
|
||||||
}
|
modifier = Modifier.padding(top = 1.dp, end = 20.dp).offset(x = (-2).dp)
|
||||||
|
)
|
||||||
Column {
|
Column {
|
||||||
Text(text = stringResource(title), style = typography.titleLarge, modifier = Modifier.padding(bottom = if(zhCN) { 2 } else { 0 }.dp))
|
Text(
|
||||||
if(desc!="") { Text(text = desc, color = colorScheme.onBackground.copy(alpha = 0.8F)) }
|
text = stringResource(title),
|
||||||
|
style = typography.titleLarge,
|
||||||
|
modifier = Modifier.padding(bottom = if(zhCN) 2.dp else 0.dp)
|
||||||
|
)
|
||||||
|
if(desc != "") { Text(text = desc, color = colorScheme.onBackground.copy(alpha = 0.8F)) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -160,22 +169,22 @@ fun SwitchItem(
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.clickable(enabled = onClickBlank != null, onClick = onClickBlank?:{})
|
.clickable(enabled = onClickBlank != null, onClick = onClickBlank?:{})
|
||||||
.padding(top = 5.dp, bottom = 5.dp, start = if(padding) 25.dp else 0.dp, end = if(padding) 15.dp else 0.dp)
|
.padding(start = if(padding) 25.dp else 0.dp, end = if(padding) 15.dp else 0.dp, top = 5.dp, bottom = 5.dp)
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
modifier = Modifier.align(Alignment.CenterStart)
|
modifier = Modifier.align(Alignment.CenterStart)
|
||||||
) {
|
) {
|
||||||
if(icon != null) {
|
if(icon != null) Icon(
|
||||||
Icon(painter = painterResource(icon),contentDescription = null)
|
painter = painterResource(icon),
|
||||||
Spacer(Modifier.padding(start = 15.dp))
|
contentDescription = null,
|
||||||
}
|
modifier = Modifier.padding(end = 20.dp).offset(x = (-2).dp)
|
||||||
Column(modifier = Modifier.padding(end = 60.dp)) {
|
)
|
||||||
|
Column(modifier = Modifier.padding(end = 60.dp, bottom = if(zhCN) 2.dp else 0.dp)) {
|
||||||
Text(text = stringResource(title), style = typography.titleLarge)
|
Text(text = stringResource(title), style = typography.titleLarge)
|
||||||
if(desc!="") {
|
if(desc != "") {
|
||||||
Text(text = desc, color = colorScheme.onBackground.copy(alpha = 0.8F))
|
Text(text = desc, color = colorScheme.onBackground.copy(alpha = 0.8F))
|
||||||
}
|
}
|
||||||
if(zhCN) { Spacer(Modifier.padding(vertical = 1.dp)) }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Switch(
|
Switch(
|
||||||
|
|||||||
9
app/src/main/res/drawable/save_fill0.xml
Normal file
9
app/src/main/res/drawable/save_fill0.xml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:width="24dp"
|
||||||
|
android:height="24dp"
|
||||||
|
android:viewportWidth="960"
|
||||||
|
android:viewportHeight="960">
|
||||||
|
<path
|
||||||
|
android:pathData="M840,280v480q0,33 -23.5,56.5T760,840L200,840q-33,0 -56.5,-23.5T120,760v-560q0,-33 23.5,-56.5T200,120h480l160,160ZM760,314L646,200L200,200v560h560v-446ZM480,720q50,0 85,-35t35,-85q0,-50 -35,-85t-85,-35q-50,0 -85,35t-35,85q0,50 35,85t85,35ZM240,400h360v-160L240,240v160ZM200,314v446,-560 114Z"
|
||||||
|
android:fillColor="#000000"/>
|
||||||
|
</vector>
|
||||||
@@ -143,8 +143,6 @@
|
|||||||
<string name="reboot">Перезагрузить</string>
|
<string name="reboot">Перезагрузить</string>
|
||||||
<string name="edit_time">Изменить время</string>
|
<string name="edit_time">Изменить время</string>
|
||||||
<string name="edit_timezone">Изменить часовой пояс</string>
|
<string name="edit_timezone">Изменить часовой пояс</string>
|
||||||
<string name="view_all_timezones">Посмотреть все идентификаторы часовых поясов</string>
|
|
||||||
<string name="hide_all_timezones">Скрыть все идентификаторы часовых поясов</string>
|
|
||||||
<string name="timezone_id">Идентификатор часового пояса</string>
|
<string name="timezone_id">Идентификатор часового пояса</string>
|
||||||
<string name="disable_auto_time_zone_before_set">Автоматический часовой пояс должен быть отключен перед установкой пользовательского часового пояса.</string>
|
<string name="disable_auto_time_zone_before_set">Автоматический часовой пояс должен быть отключен перед установкой пользовательского часового пояса.</string>
|
||||||
<string name="permission_policy">Политика разрешений</string>
|
<string name="permission_policy">Политика разрешений</string>
|
||||||
@@ -546,7 +544,6 @@
|
|||||||
<string name="follow_system">Follow system</string> <!--TODO-->
|
<string name="follow_system">Follow system</string> <!--TODO-->
|
||||||
<string name="black_theme">Black theme</string> <!--TODO-->
|
<string name="black_theme">Black theme</string> <!--TODO-->
|
||||||
<string name="about">О приложении</string>
|
<string name="about">О приложении</string>
|
||||||
<string name="user_guide">Руководство пользователя</string>
|
|
||||||
<string name="source_code">Исходный код</string>
|
<string name="source_code">Исходный код</string>
|
||||||
<string name="theme">Тема</string>
|
<string name="theme">Тема</string>
|
||||||
|
|
||||||
|
|||||||
@@ -144,8 +144,6 @@
|
|||||||
<string name="reboot">Yeniden başlat</string>
|
<string name="reboot">Yeniden başlat</string>
|
||||||
<string name="edit_time">Zamanı düzenle</string>
|
<string name="edit_time">Zamanı düzenle</string>
|
||||||
<string name="edit_timezone">Saat dilimini düzenle</string>
|
<string name="edit_timezone">Saat dilimini düzenle</string>
|
||||||
<string name="view_all_timezones">Tüm saat dilimi kimliklerini görüntüle</string>
|
|
||||||
<string name="hide_all_timezones">Tüm saat dilimi kimliklerini gizle</string>
|
|
||||||
<string name="timezone_id">Saat dilimi kimliği</string>
|
<string name="timezone_id">Saat dilimi kimliği</string>
|
||||||
<string name="disable_auto_time_zone_before_set">Özel bir saat dilimi ayarlamadan önce otomatik saat dilimi devre dışı bırakılmalıdır</string>
|
<string name="disable_auto_time_zone_before_set">Özel bir saat dilimi ayarlamadan önce otomatik saat dilimi devre dışı bırakılmalıdır</string>
|
||||||
<string name="permission_policy">İzin politikası</string>
|
<string name="permission_policy">İzin politikası</string>
|
||||||
@@ -541,7 +539,6 @@
|
|||||||
<string name="follow_system">Follow system</string> <!--TODO-->
|
<string name="follow_system">Follow system</string> <!--TODO-->
|
||||||
<string name="black_theme">Black theme</string> <!--TODO-->
|
<string name="black_theme">Black theme</string> <!--TODO-->
|
||||||
<string name="about">Hakkında</string>
|
<string name="about">Hakkında</string>
|
||||||
<string name="user_guide">Kullanıcı rehberi</string>
|
|
||||||
<string name="source_code">Kaynak kodu</string>
|
<string name="source_code">Kaynak kodu</string>
|
||||||
<string name="theme">Tema</string>
|
<string name="theme">Tema</string>
|
||||||
|
|
||||||
|
|||||||
@@ -139,8 +139,6 @@
|
|||||||
<string name="reboot">重启</string>
|
<string name="reboot">重启</string>
|
||||||
<string name="edit_time">修改时间</string>
|
<string name="edit_time">修改时间</string>
|
||||||
<string name="edit_timezone">修改时区</string>
|
<string name="edit_timezone">修改时区</string>
|
||||||
<string name="view_all_timezones">显示所有时区ID</string>
|
|
||||||
<string name="hide_all_timezones">隐藏所有时区ID</string>
|
|
||||||
<string name="timezone_id">时区ID</string>
|
<string name="timezone_id">时区ID</string>
|
||||||
<string name="disable_auto_time_zone_before_set">在设置时区前需要关闭自动时区</string>
|
<string name="disable_auto_time_zone_before_set">在设置时区前需要关闭自动时区</string>
|
||||||
<string name="permission_policy">权限策略</string>
|
<string name="permission_policy">权限策略</string>
|
||||||
@@ -533,7 +531,6 @@
|
|||||||
<string name="follow_system">跟随系统</string>
|
<string name="follow_system">跟随系统</string>
|
||||||
<string name="black_theme">黑色主题</string>
|
<string name="black_theme">黑色主题</string>
|
||||||
<string name="about">关于</string>
|
<string name="about">关于</string>
|
||||||
<string name="user_guide">使用教程</string>
|
|
||||||
<string name="source_code">源代码</string>
|
<string name="source_code">源代码</string>
|
||||||
<string name="theme">主题</string>
|
<string name="theme">主题</string>
|
||||||
|
|
||||||
|
|||||||
@@ -149,8 +149,6 @@
|
|||||||
<string name="reboot">Reboot</string>
|
<string name="reboot">Reboot</string>
|
||||||
<string name="edit_time">Edit time</string>
|
<string name="edit_time">Edit time</string>
|
||||||
<string name="edit_timezone">Edit timezone</string>
|
<string name="edit_timezone">Edit timezone</string>
|
||||||
<string name="view_all_timezones">View all timezones IDs</string>
|
|
||||||
<string name="hide_all_timezones">Hide all timezones IDs</string>
|
|
||||||
<string name="timezone_id">Timezone ID</string>
|
<string name="timezone_id">Timezone ID</string>
|
||||||
<string name="disable_auto_time_zone_before_set">Auto timezone should be disabled before set a custom timezone. </string>
|
<string name="disable_auto_time_zone_before_set">Auto timezone should be disabled before set a custom timezone. </string>
|
||||||
<string name="permission_policy">Permission policy</string>
|
<string name="permission_policy">Permission policy</string>
|
||||||
@@ -547,7 +545,6 @@
|
|||||||
<string name="follow_system">Follow system</string>
|
<string name="follow_system">Follow system</string>
|
||||||
<string name="black_theme">Black theme</string>
|
<string name="black_theme">Black theme</string>
|
||||||
<string name="about">About</string>
|
<string name="about">About</string>
|
||||||
<string name="user_guide">User guide</string>
|
|
||||||
<string name="source_code">Source code</string>
|
<string name="source_code">Source code</string>
|
||||||
<string name="theme">Theme</string>
|
<string name="theme">Theme</string>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user