add fillMaxWidth modifier for some buttons

This commit is contained in:
BinTianqi
2024-01-25 09:56:41 +08:00
parent 1f79994161
commit d427e87c5f
12 changed files with 243 additions and 157 deletions

View File

@@ -22,6 +22,7 @@ import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.MaterialTheme.typography
import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
@@ -64,14 +65,14 @@ fun UserRestriction(){
){
items(1){
Text(text = "打开开关后会禁用对应的功能",modifier = Modifier.padding(3.dp),
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium})
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium})
if(isProfileOwner(myDpm)){
Text(text = "Profile owner无法更改部分功能",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium})
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium})
}
if(isWear){
Text(text = "部分功能在手表上无效",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium})
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium})
}
}
@@ -119,20 +120,22 @@ fun UserRestriction(){
items(1){
Spacer(Modifier.padding(vertical = 5.dp))
if(VERSION.SDK_INT<24){ Text(text = "以下功能需要安卓7或以上数据漫游、修改用户头像、更换壁纸",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium}) }
if(VERSION.SDK_INT<26){ Text(text = "以下功能需要安卓8或以上蓝牙、自动填充服务、添加/移除工作资料",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium}) }
if(VERSION.SDK_INT<28){ Text(text = "以下功能需要安卓9或以上飞行模式、位置信息、调整亮度、修改语言、修改日期时间、修改屏幕超时、打印、分享至工作应用、切换用户",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium}) }
if(VERSION.SDK_INT<29){ Text(text = "以下功能需要安卓10或以上配置私人DNS、内容捕获、内容建议",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium}) }
if(VERSION.SDK_INT<31){ Text(text = "以下功能需要安卓12或以上切换摄像头使用权限、切换麦克风使用权限",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium}) }
if(VERSION.SDK_INT<33){ Text(text = "以下功能需要安卓13或以上添加WiFi配置、分享设备管理器配置的WiFi、WiFi共享",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium}) }
if(VERSION.SDK_INT<34){ Text(text = "以下功能需要安卓14或以上2G信号、启用设备管理器、超宽频段无线电",
style = if(!isWear){MaterialTheme.typography.bodyLarge}else{MaterialTheme.typography.bodyMedium}) }
Column(modifier = Modifier.padding(horizontal = if(!isWear){10.dp}else{3.dp})) {
if(VERSION.SDK_INT<24){ Text(text = "以下功能需要安卓7或以上数据漫游、修改用户头像、更换壁纸",
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium}) }
if(VERSION.SDK_INT<26){ Text(text = "以下功能需要安卓8或以上蓝牙、自动填充服务、添加/移除工作资料",
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium}) }
if(VERSION.SDK_INT<28){ Text(text = "以下功能需要安卓9或以上飞行模式、位置信息、调整亮度、修改语言、修改日期时间、修改屏幕超时、打印、分享至工作应用、切换用户",
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium}) }
if(VERSION.SDK_INT<29){ Text(text = "以下功能需要安卓10或以上配置私人DNS、内容捕获、内容建议",
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium}) }
if(VERSION.SDK_INT<31){ Text(text = "以下功能需要安卓12或以上切换摄像头使用权限、切换麦克风使用权限",
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium}) }
if(VERSION.SDK_INT<33){ Text(text = "以下功能需要安卓13或以上添加WiFi配置、分享设备管理器配置的WiFi、WiFi共享",
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium}) }
if(VERSION.SDK_INT<34){ Text(text = "以下功能需要安卓14或以上2G信号、启用设备管理器、超宽频段无线电",
style = if(!isWear){typography.bodyLarge}else{typography.bodyMedium}) }
}
Spacer(Modifier.padding(vertical = 30.dp))
}
}
@@ -145,7 +148,7 @@ fun SectionTab(txt:String,getSection:()->Boolean,setSection:()->Unit){
text = txt,
color = if(getSection()){MaterialTheme.colorScheme.onTertiaryContainer}else{MaterialTheme.colorScheme.onPrimaryContainer},
textAlign = TextAlign.Center,
style = if(!sharedPref.getBoolean("isWear",false)){MaterialTheme.typography.headlineMedium}else{MaterialTheme.typography.titleLarge},
style = if(!sharedPref.getBoolean("isWear",false)){typography.headlineMedium}else{typography.titleLarge},
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = if(!sharedPref.getBoolean("isWear",false)){8.dp}else{4.dp},
@@ -194,7 +197,7 @@ private fun UserRestrictionItem(
) {
Text(
text = stringResource(itemName),
style = if(!sharedPref.getBoolean("isWear",false)){MaterialTheme.typography.titleLarge}else{MaterialTheme.typography.bodyLarge},
style = if(!sharedPref.getBoolean("isWear",false)){typography.titleLarge}else{typography.bodyLarge},
color = MaterialTheme.colorScheme.onTertiaryContainer
)
if(restrictionDescription!=""){Text(text = restrictionDescription, color = MaterialTheme.colorScheme.onSecondaryContainer)}