mirror of
https://github.com/awfixers-stuff/OwnDroid.git
synced 2026-03-23 19:15:58 +00:00
UI improvement
This commit is contained in:
@@ -144,16 +144,16 @@ private fun HomePage(navCtrl:NavHostController){
|
||||
.padding(vertical = 16.dp),
|
||||
verticalAlignment = Alignment.CenterVertically
|
||||
) {
|
||||
Spacer(modifier = Modifier.fillMaxWidth(0.06F))
|
||||
Spacer(modifier = Modifier.padding(start = 22.dp))
|
||||
Icon(
|
||||
painter = painterResource(if(myDpm.isAdminActive(myComponent)){ R.drawable.check_circle_fill1 }else{ R.drawable.block_fill0 }),
|
||||
contentDescription = null,
|
||||
tint = colorScheme.onPrimary
|
||||
)
|
||||
Spacer(modifier = Modifier.fillMaxWidth(0.05F))
|
||||
Spacer(modifier = Modifier.padding(start = 10.dp))
|
||||
Column {
|
||||
Text(
|
||||
text = if(myDpm.isAdminActive(myComponent)){"已激活"}else{"未激活"},
|
||||
text = stringResource(if(myDpm.isAdminActive(myComponent)){R.string.activated}else{R.string.deactivated}),
|
||||
style = typography.headlineSmall,
|
||||
color = colorScheme.onPrimary,
|
||||
modifier = Modifier.padding(bottom = 2.dp)
|
||||
|
||||
@@ -18,6 +18,7 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.toArgb
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
@@ -80,7 +81,7 @@ private fun Settings(){
|
||||
R.string.dynamic_color, stringResource(R.string.dynamic_color_desc),null,
|
||||
{sharedPref.getBoolean("dynamicColor",false)},{sharedPref.edit().putBoolean("dynamicColor",it).apply()}
|
||||
)
|
||||
if(colorScheme.background!=Color(0xFF000000)){
|
||||
if(colorScheme.background.toArgb()!=Color(0xFF000000).toArgb()){
|
||||
SwitchItem(
|
||||
R.string.blackTheme, stringResource(R.string.blackTheme_desc),null,
|
||||
{sharedPref.getBoolean("blackTheme",false)},{sharedPref.edit().putBoolean("blackTheme",it).apply()}
|
||||
|
||||
@@ -69,7 +69,7 @@ fun Network(navCtrl: NavHostController){
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = colorScheme.surfaceVariant)
|
||||
)*/
|
||||
TopBar(backStackEntry,navCtrl,localNavCtrl){
|
||||
if(backStackEntry?.destination?.route=="Home"){
|
||||
if(backStackEntry?.destination?.route=="Home"&&scrollState.maxValue>80){
|
||||
Text(
|
||||
text = stringResource(R.string.network),
|
||||
modifier = Modifier.alpha((maxOf(scrollState.value-30,0)).toFloat()/80)
|
||||
|
||||
@@ -62,7 +62,7 @@ fun Password(navCtrl: NavHostController){
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = colorScheme.surfaceVariant)
|
||||
)*/
|
||||
TopBar(backStackEntry,navCtrl,localNavCtrl){
|
||||
if(backStackEntry?.destination?.route=="Home"){
|
||||
if(backStackEntry?.destination?.route=="Home"&&scrollState.maxValue>80){
|
||||
Text(
|
||||
text = stringResource(R.string.password_and_keyguard),
|
||||
modifier = Modifier.alpha((maxOf(scrollState.value-30,0)).toFloat()/80)
|
||||
|
||||
@@ -14,11 +14,9 @@ import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.material3.MaterialTheme.colorScheme
|
||||
import androidx.compose.material3.MaterialTheme.typography
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.alpha
|
||||
@@ -68,7 +66,7 @@ fun DpmPermissions(navCtrl:NavHostController){
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = colorScheme.surfaceVariant)
|
||||
)*/
|
||||
TopBar(backStackEntry,navCtrl,localNavCtrl){
|
||||
if(backStackEntry?.destination?.route=="Home"){
|
||||
if(backStackEntry?.destination?.route=="Home"&&scrollState.maxValue>80){
|
||||
Text(
|
||||
text = stringResource(R.string.permission),
|
||||
modifier = Modifier.alpha((maxOf(scrollState.value-30,0)).toFloat()/80)
|
||||
@@ -201,7 +199,7 @@ private fun DeviceAdmin(navCtrl: NavHostController){
|
||||
myDpm.removeActiveAdmin(myComponent)
|
||||
co.launch{ delay(600); if(!myDpm.isAdminActive(myComponent)){navCtrl.navigateUp()} }
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorScheme.error, contentColor = colorScheme.onError)
|
||||
) {
|
||||
Text(stringResource(R.string.deactivate))
|
||||
}
|
||||
@@ -232,7 +230,10 @@ private fun ProfileOwner(){
|
||||
Text(stringResource(if(isProfileOwner(myDpm)){R.string.activated}else{R.string.deactivated}), style = typography.titleLarge)
|
||||
Spacer(Modifier.padding(vertical = 5.dp))
|
||||
if(isProfileOwner(myDpm)&&VERSION.SDK_INT>=24){
|
||||
Button(onClick = {myDpm.clearProfileOwner(myComponent)}, modifier = Modifier.fillMaxWidth()) {
|
||||
Button(
|
||||
onClick = {myDpm.clearProfileOwner(myComponent)},
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorScheme.error, contentColor = colorScheme.onError)
|
||||
) {
|
||||
Text(stringResource(R.string.deactivate))
|
||||
}
|
||||
}
|
||||
@@ -261,7 +262,7 @@ private fun DeviceOwner(navCtrl: NavHostController){
|
||||
myDpm.clearDeviceOwnerApp(myContext.packageName)
|
||||
co.launch{ delay(600); if(!isDeviceOwner(myDpm)){navCtrl.navigateUp()} }
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
colors = ButtonDefaults.buttonColors(containerColor = colorScheme.error, contentColor = colorScheme.onError)
|
||||
) {
|
||||
Text(text = stringResource(R.string.deactivate))
|
||||
}
|
||||
|
||||
@@ -111,8 +111,8 @@ fun ShizukuActivate(){
|
||||
scrollState.animateScrollTo(scrollState.maxValue, scrollAnim())
|
||||
outputTextScrollState.animateScrollTo(0, scrollAnim())
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()) {
|
||||
}
|
||||
) {
|
||||
Text(text = stringResource(R.string.activate_device_admin))
|
||||
}
|
||||
}
|
||||
@@ -124,8 +124,8 @@ fun ShizukuActivate(){
|
||||
scrollState.animateScrollTo(scrollState.maxValue, scrollAnim())
|
||||
outputTextScrollState.animateScrollTo(0, scrollAnim())
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()) {
|
||||
}
|
||||
) {
|
||||
Text(text = stringResource(R.string.activate_profile_owner))
|
||||
}
|
||||
|
||||
@@ -136,8 +136,8 @@ fun ShizukuActivate(){
|
||||
scrollState.animateScrollTo(scrollState.maxValue, scrollAnim())
|
||||
outputTextScrollState.animateScrollTo(0, scrollAnim())
|
||||
}
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()) {
|
||||
}
|
||||
) {
|
||||
Text(text = stringResource(R.string.activate_device_owner))
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ fun SystemManage(navCtrl:NavHostController){
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = colorScheme.surfaceVariant)
|
||||
)*/
|
||||
TopBar(backStackEntry,navCtrl,localNavCtrl){
|
||||
if(backStackEntry?.destination?.route=="Home"){
|
||||
if(backStackEntry?.destination?.route=="Home"&&scrollState.maxValue>80){
|
||||
Text(
|
||||
text = stringResource(R.string.device_ctrl),
|
||||
modifier = Modifier.alpha((maxOf(scrollState.value-30,0)).toFloat()/80)
|
||||
|
||||
@@ -67,7 +67,7 @@ fun UserManage(navCtrl:NavHostController) {
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = colorScheme.surfaceVariant)
|
||||
)*/
|
||||
TopBar(backStackEntry,navCtrl,localNavCtrl){
|
||||
if(backStackEntry?.destination?.route=="Home"){
|
||||
if(backStackEntry?.destination?.route=="Home"&&scrollState.maxValue>80){
|
||||
Text(
|
||||
text = stringResource(R.string.user_manage),
|
||||
modifier = Modifier.alpha((maxOf(scrollState.value-30,0)).toFloat()/80)
|
||||
|
||||
@@ -68,7 +68,7 @@ fun UserRestriction(navCtrl: NavHostController){
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = colorScheme.surfaceVariant)
|
||||
)*/
|
||||
TopBar(backStackEntry,navCtrl,localNavCtrl){
|
||||
if(backStackEntry?.destination?.route=="Home"){
|
||||
if(backStackEntry?.destination?.route=="Home"&&scrollState.maxValue>80){
|
||||
Text(
|
||||
text = stringResource(R.string.user_restrict),
|
||||
modifier = Modifier.alpha((maxOf(scrollState.value-30,0)).toFloat()/80)
|
||||
|
||||
@@ -17,8 +17,8 @@ class Animations{
|
||||
val animateListSize:FiniteAnimationSpec<IntSize> = spring(stiffness = Spring.StiffnessMediumLow, visibilityThreshold = IntSize.VisibilityThreshold)
|
||||
|
||||
private val screenWidth = displayMetrics.widthPixels
|
||||
private val initialOffsetValue = screenWidth/8
|
||||
private val targetOffsetValue = screenWidth/8
|
||||
private val initialOffsetValue = screenWidth/10
|
||||
private val targetOffsetValue = screenWidth/10
|
||||
|
||||
val navHostEnterTransition: AnimatedContentTransitionScope<NavBackStackEntry>.() -> EnterTransition = {
|
||||
fadeIn(animationSpec = fade) +
|
||||
|
||||
Reference in New Issue
Block a user