manager: Optimizing SuSFS Feature Status Display
- Use labels instead of Text Signed-off-by: ShirkNeko <109797057+ShirkNeko@users.noreply.github.com>
This commit is contained in:
@@ -45,6 +45,7 @@ import androidx.compose.material3.MenuAnchorType
|
||||
import androidx.compose.material3.OutlinedButton
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.ScrollableTabRow
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Switch
|
||||
import androidx.compose.material3.Tab
|
||||
import androidx.compose.material3.Text
|
||||
@@ -60,6 +61,7 @@ import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
@@ -1515,18 +1517,20 @@ private fun FeatureStatusCard(
|
||||
modifier = Modifier.weight(1f)
|
||||
)
|
||||
}
|
||||
Text(
|
||||
text = if (feature.isEnabled)
|
||||
stringResource(R.string.susfs_feature_enabled)
|
||||
else
|
||||
stringResource(R.string.susfs_feature_disabled),
|
||||
style = MaterialTheme.typography.bodySmall,
|
||||
color = if (feature.isEnabled)
|
||||
MaterialTheme.colorScheme.primary
|
||||
else
|
||||
MaterialTheme.colorScheme.error,
|
||||
fontWeight = FontWeight.Medium
|
||||
)
|
||||
Surface(
|
||||
shape = RoundedCornerShape(4.dp),
|
||||
color = when {
|
||||
feature.isEnabled -> MaterialTheme.colorScheme.primary
|
||||
else -> Color.Gray
|
||||
},
|
||||
modifier = Modifier
|
||||
) {
|
||||
Text(
|
||||
text = feature.statusText,
|
||||
style = MaterialTheme.typography.labelMedium,
|
||||
modifier = Modifier.padding(horizontal = 6.dp, vertical = 2.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,9 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import android.widget.Toast
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import com.dergoogler.mmrl.platform.Platform
|
||||
import com.dergoogler.mmrl.platform.Platform.Companion.context
|
||||
import com.sukisu.ultra.R
|
||||
import com.topjohnwu.superuser.Shell
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
@@ -59,7 +62,8 @@ object SuSFSManager {
|
||||
*/
|
||||
data class EnabledFeature(
|
||||
val name: String,
|
||||
val isEnabled: Boolean
|
||||
val isEnabled: Boolean,
|
||||
val statusText: String = if (isEnabled) context.getString(R.string.susfs_feature_enabled) else context.getString(R.string.susfs_feature_disabled)
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -587,7 +591,8 @@ object SuSFSManager {
|
||||
featureMappings.forEach { mapping ->
|
||||
val displayName = featureNameMap[mapping.id] ?: mapping.id
|
||||
val isEnabled = outputLines.contains(mapping.config)
|
||||
features.add(EnabledFeature(displayName, isEnabled))
|
||||
val statusText = if (isEnabled) context.getString(R.string.susfs_feature_enabled) else context.getString(R.string.susfs_feature_disabled)
|
||||
features.add(EnabledFeature(displayName, isEnabled, statusText))
|
||||
}
|
||||
|
||||
return features.sortedBy { it.name }
|
||||
|
||||
Reference in New Issue
Block a user