From 32e0b57b463b9177743595fb5cc46a20ed7a63ed Mon Sep 17 00:00:00 2001 From: Ruchit Marathe Date: Sat, 4 May 2024 13:37:09 +0530 Subject: [PATCH 1/3] [add device] Galaxy A52 and A72 (#1696) * Update links for a52sxq and m52xq since BlackMesa123 stepped down and i took over for those devices as well Change-Id: I9b35fdce65da74fa757d5b77a3819c3174e12160 Signed-off-by: Ruchit --- website/docs/repos.json | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/website/docs/repos.json b/website/docs/repos.json index 1db0b20d65bc..be4d79d588ef 100644 --- a/website/docs/repos.json +++ b/website/docs/repos.json @@ -518,17 +518,31 @@ "devices": "Huawei nova 2 (pic)" }, { - "maintainer": "BlackMesa123", - "maintainer_link": "https://xdaforums.com/t/kernel-a528b-n-kernelsu-v0-7-5-for-galaxy-a52s-5g.4603287/", - "kernel_name": "android_kernel_samsung_sm7325", - "kernel_link": "https://github.com/BlackMesa123/android_kernel_samsung_sm7325", + "maintainer": "RisenID", + "maintainer_link": "https://github.com/RisenID", + "kernel_name": "kernel_samsung_ascendia_sm7325", + "kernel_link": "https://github.com/RisenID/kernel_samsung_ascendia_sm7325", "devices": "Samsung Galaxy A52s 5G (a52sxq)" }, { - "maintainer": "BlackMesa123", - "maintainer_link": "https://xdaforums.com/t/kernel-m526b-br-kernelsu-v0-7-5-for-galaxy-m52-5g.4603295/", - "kernel_name": "android_kernel_samsung_sm7325", - "kernel_link": "https://github.com/BlackMesa123/android_kernel_samsung_sm7325", + "maintainer": "RisenID", + "maintainer_link": "https://github.com/RisenID", + "kernel_name": "kernel_samsung_ascendia_sm7125", + "kernel_link": "https://github.com/RisenID/kernel_samsung_ascendia_sm7125", + "devices": "Samsung Galaxy A52 4G (a52q)" + }, + { + "maintainer": "RisenID", + "maintainer_link": "https://github.com/RisenID", + "kernel_name": "kernel_samsung_ascendia_sm7125", + "kernel_link": "https://github.com/RisenID/kernel_samsung_ascendia_sm7125", + "devices": "Samsung Galaxy A72 (a72q)" + }, + { + "maintainer": "RisenID", + "maintainer_link": "https://github.com/RisenID", + "kernel_name": "kernel_samsung_ascendia_sm7325", + "kernel_link": "https://github.com/RisenID/kernel_samsung_ascendia_sm7325", "devices": "Samsung Galaxy M52 5G (m52xq)" }, { From 8ee274f7d8fdb4f28215309304d410c885b3d80a Mon Sep 17 00:00:00 2001 From: Flame <40175769+flame-0@users.noreply.github.com> Date: Sat, 4 May 2024 08:07:34 +0000 Subject: [PATCH 2/3] device: remove POCO F3/Redmi K40/Mi 11X (alioth) (#1694) I do patches now, https://codeberg.org/vyrine/android_vendor_extra/src/branch/main/patches/kernel_xiaomi_sm8250/0001-Implement-KernelSU.patch --- website/docs/repos.json | 7 ------- 1 file changed, 7 deletions(-) diff --git a/website/docs/repos.json b/website/docs/repos.json index be4d79d588ef..d03a37ae8492 100644 --- a/website/docs/repos.json +++ b/website/docs/repos.json @@ -370,13 +370,6 @@ "kernel_link": "https://github.com/Google-Pixel2-2XL/kernel_google_wahoo", "devices": "Google Pixel 2/2XL" }, - { - "maintainer": "Flame", - "maintainer_link": "https://github.com/flame-0", - "kernel_name": "android_kernel_xiaomi_sm8250", - "kernel_link": "https://github.com/vyrine/android_kernel_xiaomi_sm8250/tree/lineage-20-kernelsu", - "devices": "POCO F3/Redmi K40/Mi 11X (alioth)" - }, { "maintainer": "DawfukFR", "maintainer_link": "https://github.com/DawfukFR", From f2816653d9728f90b9281b63a0c36905c1a97d51 Mon Sep 17 00:00:00 2001 From: Light_summer <93428659+lightsummer233@users.noreply.github.com> Date: Sat, 4 May 2024 20:41:05 +0800 Subject: [PATCH 3/3] manager: Make SwitchItem can be click like preference (#1697) Use `AutoMirrored` icon Drop some deprecated methods Remove unused imports Add bottom padding for AppProfileTemplateScreen to avoid display content behind fab --- .../me/weishu/kernelsu/ui/MainActivity.kt | 17 +-- .../weishu/kernelsu/ui/component/AboutCard.kt | 2 - .../weishu/kernelsu/ui/component/SearchBar.kt | 7 +- .../kernelsu/ui/component/SettingsItem.kt | 5 + .../ui/component/profile/RootProfileConfig.kt | 15 +-- .../ui/component/profile/TemplateConfig.kt | 4 +- .../weishu/kernelsu/ui/screen/AppProfile.kt | 9 +- .../me/weishu/kernelsu/ui/screen/Flash.kt | 6 +- .../java/me/weishu/kernelsu/ui/screen/Home.kt | 4 +- .../me/weishu/kernelsu/ui/screen/Install.kt | 4 +- .../me/weishu/kernelsu/ui/screen/Settings.kt | 4 +- .../me/weishu/kernelsu/ui/screen/Template.kt | 10 +- .../kernelsu/ui/screen/TemplateEditor.kt | 9 +- .../java/me/weishu/kernelsu/ui/theme/Theme.kt | 12 +- .../kernelsu/ui/util/HanziToPinyin.java | 8 +- .../kernelsu/ui/viewmodel/ModuleViewModel.kt | 3 +- .../ui/viewmodel/SuperUserViewModel.kt | 4 +- .../ui/viewmodel/TemplateViewModel.kt | 8 +- .../me/weishu/kernelsu/ui/webui/MimeUtil.java | 117 +++++------------- .../kernelsu/ui/webui/SuFilePathHandler.java | 6 +- .../ic_launcher.xml | 0 manager/build.gradle.kts | 4 - manager/settings.gradle.kts | 2 + 23 files changed, 100 insertions(+), 160 deletions(-) rename manager/app/src/main/res/{mipmap-anydpi-v26 => mipmap-anydpi}/ic_launcher.xml (100%) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt index 70dd08d099a6..042155fbee62 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/MainActivity.kt @@ -3,9 +3,14 @@ package me.weishu.kernelsu.ui import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent -import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.layout.padding -import androidx.compose.material3.* +import androidx.compose.material3.Icon +import androidx.compose.material3.NavigationBar +import androidx.compose.material3.NavigationBarItem +import androidx.compose.material3.Scaffold +import androidx.compose.material3.SnackbarHost +import androidx.compose.material3.SnackbarHostState +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.runtime.getValue @@ -14,8 +19,7 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import androidx.navigation.NavHostController -import androidx.navigation.compose.currentBackStackEntryAsState -import com.google.accompanist.navigation.animation.rememberAnimatedNavController +import androidx.navigation.compose.rememberNavController import com.ramcosta.composedestinations.DestinationsNavHost import com.ramcosta.composedestinations.navigation.popBackStack import com.ramcosta.composedestinations.utils.isRouteOnBackStackAsState @@ -29,13 +33,12 @@ import me.weishu.kernelsu.ui.util.rootAvailable class MainActivity : ComponentActivity() { - @OptIn(ExperimentalAnimationApi::class) override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { KernelSUTheme { - val navController = rememberAnimatedNavController() + val navController = rememberNavController() val snackbarHostState = remember { SnackbarHostState() } Scaffold( bottomBar = { BottomBar(navController) }, @@ -61,7 +64,7 @@ private fun BottomBar(navController: NavHostController) { val isManager = Natives.becomeManager(ksuApp.packageName) val fullFeatured = isManager && !Natives.requireNewKernel() && rootAvailable() NavigationBar(tonalElevation = 8.dp) { - BottomBarDestination.values().forEach { destination -> + BottomBarDestination.entries.forEach { destination -> if (!fullFeatured && destination.rootRequired) return@forEach val isCurrentDestOnBackStack by navController.isRouteOnBackStackAsState(destination.direction) NavigationBarItem( diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/AboutCard.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/AboutCard.kt index 269f48b2d04c..0807d0521dfe 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/AboutCard.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/AboutCard.kt @@ -12,13 +12,11 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.width import androidx.compose.foundation.shape.RoundedCornerShape -import androidx.compose.material3.AlertDialog import androidx.compose.material3.ElevatedCard import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable -import androidx.compose.runtime.MutableState import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SearchBar.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SearchBar.kt index af47ee64a6bb..8195cdddd40b 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SearchBar.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SearchBar.kt @@ -10,9 +10,9 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.outlined.ArrowBack import androidx.compose.material.icons.filled.Close import androidx.compose.material.icons.filled.Search -import androidx.compose.material.icons.outlined.ArrowBack import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.IconButton @@ -27,7 +27,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.focus.FocusRequester import androidx.compose.ui.focus.focusRequester @@ -39,7 +38,7 @@ import androidx.compose.ui.unit.dp private const val TAG = "SearchBar" -@OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3Api::class) +@OptIn(ExperimentalMaterial3Api::class) @Composable fun SearchAppBar( title: @Composable () -> Unit, @@ -115,7 +114,7 @@ fun SearchAppBar( if (onBackClick != null) { IconButton( onClick = onBackClick, - content = { Icon(Icons.Outlined.ArrowBack, null) } + content = { Icon(Icons.AutoMirrored.Outlined.ArrowBack, null) } ) } }, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SettingsItem.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SettingsItem.kt index c3e3b5c4e65b..6db20b163cde 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SettingsItem.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/SettingsItem.kt @@ -1,11 +1,13 @@ package me.weishu.kernelsu.ui.component +import androidx.compose.foundation.clickable import androidx.compose.material3.Icon import androidx.compose.material3.ListItem import androidx.compose.material3.RadioButton import androidx.compose.material3.Switch import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.vector.ImageVector @Composable @@ -18,6 +20,9 @@ fun SwitchItem( onCheckedChange: (Boolean) -> Unit ) { ListItem( + modifier = Modifier.clickable { + onCheckedChange.invoke(!checked) + }, headlineContent = { Text(title) }, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt index 500ae7860ab0..d2cb3f342e51 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/RootProfileConfig.kt @@ -22,15 +22,13 @@ import androidx.compose.material3.ListItem import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedCard import androidx.compose.material3.OutlinedTextField +import androidx.compose.material3.OutlinedTextFieldDefaults import androidx.compose.material3.Text -import androidx.compose.material3.TextFieldDefaults import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember -import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.setValue -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.platform.LocalSoftwareKeyboardController import androidx.compose.ui.res.stringResource @@ -148,7 +146,7 @@ fun RootProfileConfig( val selectedGroups = profile.groups.ifEmpty { listOf(0) }.let { e -> e.mapNotNull { g -> - Groups.values().find { it.gid == g } + Groups.entries.find { it.gid == g } } } GroupsPanel(selectedGroups) { @@ -161,7 +159,7 @@ fun RootProfileConfig( } val selectedCaps = profile.capabilities.mapNotNull { e -> - Capabilities.values().find { it.cap == e } + Capabilities.entries.find { it.cap == e } } CapsPanel(selectedCaps) { @@ -190,7 +188,7 @@ fun RootProfileConfig( @Composable fun GroupsPanel(selected: List, closeSelection: (selection: Set) -> Unit) { val selectGroupsDialog = rememberCustomDialog { dismiss: () -> Unit -> - val groups = Groups.values().sortedWith( + val groups = Groups.entries.toTypedArray().sortedWith( compareBy { if (selected.contains(it)) 0 else 1 } .then(compareBy { when (it) { @@ -265,7 +263,7 @@ fun CapsPanel( closeSelection: (selection: Set) -> Unit ) { val selectCapabilitiesDialog = rememberCustomDialog { dismiss -> - val caps = Capabilities.values().sortedWith( + val caps = Capabilities.entries.toTypedArray().sortedWith( compareBy { if (selected.contains(it)) 0 else 1 } .then(compareBy { it.name }) ) @@ -323,7 +321,6 @@ fun CapsPanel( } } -@OptIn(ExperimentalComposeUiApi::class) @Composable private fun UidPanel(uid: Int, label: String, onUidChange: (Int) -> Unit) { @@ -447,7 +444,7 @@ private fun SELinuxPanel( editSELinuxDialog.show() }, enabled = false, - colors = TextFieldDefaults.outlinedTextFieldColors( + colors = OutlinedTextFieldDefaults.colors( disabledTextColor = MaterialTheme.colorScheme.onSurface, disabledBorderColor = MaterialTheme.colorScheme.outline, disabledPlaceholderColor = MaterialTheme.colorScheme.onSurfaceVariant, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/TemplateConfig.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/TemplateConfig.kt index b1ed8a8b9d99..d09a23434f85 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/TemplateConfig.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/component/profile/TemplateConfig.kt @@ -2,10 +2,10 @@ package me.weishu.kernelsu.ui.component.profile import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ReadMore import androidx.compose.material.icons.filled.ArrowDropDown import androidx.compose.material.icons.filled.ArrowDropUp import androidx.compose.material.icons.filled.Create -import androidx.compose.material.icons.filled.ReadMore import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExposedDropdownMenuBox @@ -105,7 +105,7 @@ fun TemplateConfig( IconButton(onClick = { onViewTemplate(tid) }) { - Icon(Icons.Filled.ReadMore, null) + Icon(Icons.AutoMirrored.Filled.ReadMore, null) } } ) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/AppProfile.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/AppProfile.kt index b68e45a29e6f..ca53388f8ea4 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/AppProfile.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/AppProfile.kt @@ -15,15 +15,15 @@ import androidx.compose.foundation.layout.width import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.AccountCircle import androidx.compose.material.icons.filled.Android -import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.Security -import androidx.compose.material3.Divider import androidx.compose.material3.DropdownMenu import androidx.compose.material3.DropdownMenuItem import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.FilterChip +import androidx.compose.material3.HorizontalDivider import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.ListItem @@ -246,12 +246,11 @@ private fun TopBar(onBack: () -> Unit) { navigationIcon = { IconButton( onClick = onBack - ) { Icon(Icons.Filled.ArrowBack, contentDescription = null) } + ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } }, ) } -@OptIn(ExperimentalMaterial3Api::class) @Composable private fun ProfileBox( mode: Mode, @@ -263,7 +262,7 @@ private fun ProfileBox( supportingContent = { Text(mode.text) }, leadingContent = { Icon(Icons.Filled.AccountCircle, null) }, ) - Divider(thickness = Dp.Hairline) + HorizontalDivider(thickness = Dp.Hairline) ListItem(headlineContent = { Row( modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceEvenly diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Flash.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Flash.kt index b48ccfbddbf2..1e3d48fdae05 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Flash.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Flash.kt @@ -27,7 +27,6 @@ import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue -import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.key @@ -46,8 +45,8 @@ import me.weishu.kernelsu.R import me.weishu.kernelsu.ui.component.KeyEventBlocker import me.weishu.kernelsu.ui.util.LkmSelection import me.weishu.kernelsu.ui.util.LocalSnackbarHost -import me.weishu.kernelsu.ui.util.installBoot import me.weishu.kernelsu.ui.util.flashModule +import me.weishu.kernelsu.ui.util.installBoot import me.weishu.kernelsu.ui.util.reboot import me.weishu.kernelsu.ui.util.restoreBoot import me.weishu.kernelsu.ui.util.uninstallPermanently @@ -66,7 +65,6 @@ enum class FlashingStatus { * @author weishu * @date 2023/1/1. */ -@OptIn(ExperimentalComposeUiApi::class) @Composable @Destination fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) { @@ -101,7 +99,7 @@ fun FlashScreen(navigator: DestinationsNavigator, flashIt: FlashIt) { logContent.append(it).append("\n") }, onStderr = { logContent.append(it).append("\n") - }); + }) } } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt index 289bdccae049..3425826ef946 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Home.kt @@ -327,7 +327,7 @@ fun LearnMoreCard() { uriHandler.openUri(url) } .padding(24.dp), verticalAlignment = Alignment.CenterVertically) { - Column() { + Column { Text( text = stringResource(R.string.home_learn_kernelsu), style = MaterialTheme.typography.titleSmall @@ -354,7 +354,7 @@ fun DonateCard() { uriHandler.openUri("https://patreon.com/weishu") } .padding(24.dp), verticalAlignment = Alignment.CenterVertically) { - Column() { + Column { Text( text = stringResource(R.string.home_support_title), style = MaterialTheme.typography.titleSmall diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt index efad3b4be070..71b5c9756909 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Install.kt @@ -12,7 +12,7 @@ import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.FileUpload import androidx.compose.material3.Button import androidx.compose.material3.ExperimentalMaterial3Api @@ -296,7 +296,7 @@ private fun TopBar(onBack: () -> Unit = {}, onLkmUpload: () -> Unit = {}) { TopAppBar(title = { Text(stringResource(R.string.install)) }, navigationIcon = { IconButton( onClick = onBack - ) { Icon(Icons.Filled.ArrowBack, contentDescription = null) } + ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } }, actions = { IconButton(onClick = onLkmUpload) { Icon(Icons.Filled.FileUpload, contentDescription = null) diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt index 26685b93ca79..4af20bd4e726 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Settings.kt @@ -10,8 +10,8 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.automirrored.filled.Undo -import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.BugReport import androidx.compose.material.icons.filled.Compress import androidx.compose.material.icons.filled.ContactPage @@ -350,7 +350,7 @@ private fun TopBar(onBack: () -> Unit = {}) { navigationIcon = { IconButton( onClick = onBack - ) { Icon(Icons.Filled.ArrowBack, contentDescription = null) } + ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } }, ) } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Template.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Template.kt index c933e0d1c8cc..bf353b0afa84 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Template.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/Template.kt @@ -6,14 +6,15 @@ import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.FlowRow +import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.ExperimentalMaterialApi import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.Add -import androidx.compose.material.icons.filled.ArrowBack import androidx.compose.material.icons.filled.ImportExport import androidx.compose.material.icons.filled.Sync import androidx.compose.material.pullrefresh.PullRefreshIndicator @@ -43,6 +44,7 @@ import androidx.compose.ui.platform.LocalClipboardManager import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.AnnotatedString +import androidx.compose.ui.unit.dp import androidx.lifecycle.viewmodel.compose.viewModel import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.navigation.DestinationsNavigator @@ -149,7 +151,9 @@ fun AppProfileTemplateScreen( .padding(innerPadding) .pullRefresh(refreshState) ) { - LazyColumn(Modifier.fillMaxSize()) { + LazyColumn(Modifier.fillMaxSize(), contentPadding = remember { + PaddingValues(bottom = 16.dp + 16.dp + 56.dp /* Scaffold Fab Spacing + Fab container height */) + }) { items(viewModel.templateList, key = { it.id }) { app -> TemplateItem(navigator, app) } @@ -214,7 +218,7 @@ private fun TopBar( navigationIcon = { IconButton( onClick = onBack - ) { Icon(Icons.Filled.ArrowBack, contentDescription = null) } + ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } }, actions = { IconButton(onClick = onSync) { diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/TemplateEditor.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/TemplateEditor.kt index 5059244f8188..b6b7cc8028ec 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/TemplateEditor.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/screen/TemplateEditor.kt @@ -10,7 +10,7 @@ import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.verticalScroll import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.automirrored.filled.ArrowBack import androidx.compose.material.icons.filled.DeleteForever import androidx.compose.material.icons.filled.Save import androidx.compose.material3.ExperimentalMaterial3Api @@ -40,16 +40,12 @@ import com.ramcosta.composedestinations.annotation.Destination import com.ramcosta.composedestinations.result.ResultBackNavigator import me.weishu.kernelsu.Natives import me.weishu.kernelsu.R -import me.weishu.kernelsu.profile.Capabilities -import me.weishu.kernelsu.profile.Groups import me.weishu.kernelsu.ui.component.profile.RootProfileConfig import me.weishu.kernelsu.ui.util.deleteAppProfileTemplate import me.weishu.kernelsu.ui.util.getAppProfileTemplate import me.weishu.kernelsu.ui.util.setAppProfileTemplate import me.weishu.kernelsu.ui.viewmodel.TemplateViewModel import me.weishu.kernelsu.ui.viewmodel.toJSON -import org.json.JSONArray -import org.json.JSONObject /** * @author weishu @@ -259,7 +255,7 @@ private fun TopBar( }, navigationIcon = { IconButton( onClick = onBack - ) { Icon(Icons.Filled.ArrowBack, contentDescription = null) } + ) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = null) } }, actions = { if (readOnly) { return@TopAppBar @@ -279,7 +275,6 @@ private fun TopBar( }) } -@OptIn(ExperimentalComposeUiApi::class) @Composable private fun TextEdit( label: String, diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt index 040b2bf86971..3b3945d0cdc5 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/theme/Theme.kt @@ -1,17 +1,17 @@ package me.weishu.kernelsu.ui.theme -import android.app.Activity import android.os.Build import androidx.compose.foundation.isSystemInDarkTheme -import androidx.compose.material3.* +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.darkColorScheme +import androidx.compose.material3.dynamicDarkColorScheme +import androidx.compose.material3.dynamicLightColorScheme +import androidx.compose.material3.lightColorScheme +import androidx.compose.material3.surfaceColorAtElevation import androidx.compose.runtime.Composable import androidx.compose.runtime.SideEffect -import androidx.compose.ui.graphics.Color -import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.platform.LocalView import androidx.compose.ui.unit.dp -import androidx.core.view.ViewCompat import com.google.accompanist.systemuicontroller.rememberSystemUiController private val DarkColorScheme = darkColorScheme( diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/HanziToPinyin.java b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/HanziToPinyin.java index ab905a388520..d3d57cefe2ea 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/util/HanziToPinyin.java +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/util/HanziToPinyin.java @@ -391,9 +391,9 @@ public static HanziToPinyin getInstance() { return sInstance; } // Check if zh_CN collation data is available - final Locale locale[] = Collator.getAvailableLocales(); - for (int i = 0; i < locale.length; i++) { - if (locale[i].equals(Locale.CHINA) || locale[i].getLanguage().contains("zh")) { + final Locale[] locale = Collator.getAvailableLocales(); + for (Locale value : locale) { + if (value.equals(Locale.CHINA) || value.getLanguage().contains("zh")) { // Do self validation just once. if (DEBUG) { Log.d(TAG, "Self validation. Result: " + doSelfValidation()); @@ -508,7 +508,7 @@ private Token getToken(char character) { * Token. If these is no China collator, the empty token array is returned. */ public ArrayList get(final String input) { - ArrayList tokens = new ArrayList(); + ArrayList tokens = new ArrayList<>(); if (!mHasChinaCollator || TextUtils.isEmpty(input)) { // return empty tokens. return tokens; diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/ModuleViewModel.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/ModuleViewModel.kt index 2d0fef8a39e6..013453fbfeed 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/ModuleViewModel.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/ModuleViewModel.kt @@ -1,6 +1,5 @@ package me.weishu.kernelsu.ui.viewmodel -import android.net.Uri import android.os.SystemClock import android.util.Log import androidx.compose.runtime.derivedStateOf @@ -16,7 +15,7 @@ import me.weishu.kernelsu.ui.util.overlayFsAvailable import org.json.JSONArray import org.json.JSONObject import java.text.Collator -import java.util.* +import java.util.Locale class ModuleViewModel : ViewModel() { diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/SuperUserViewModel.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/SuperUserViewModel.kt index 8dcdeda33fb9..37e05aa82aff 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/SuperUserViewModel.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/SuperUserViewModel.kt @@ -107,7 +107,7 @@ class SuperUserViewModel : ViewModel() { } } - val intent = Intent(ksuApp, KsuService::class.java); + val intent = Intent(ksuApp, KsuService::class.java) val task = KsuService.bindOrTask( intent, @@ -119,7 +119,7 @@ class SuperUserViewModel : ViewModel() { } private fun stopKsuService() { - val intent = Intent(ksuApp, KsuService::class.java); + val intent = Intent(ksuApp, KsuService::class.java) KsuService.stop(intent) } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/TemplateViewModel.kt b/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/TemplateViewModel.kt index f7109a1583a1..cbed82f21c05 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/TemplateViewModel.kt +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/viewmodel/TemplateViewModel.kt @@ -235,7 +235,7 @@ private fun fromJSON(templateJson: JSONObject): TemplateViewModel.TemplateInfo? val groupsJsonArray = templateJson.optJSONArray("groups") val capabilitiesJsonArray = templateJson.optJSONArray("capabilities") val context = templateJson.optString("context").takeIf { it.isNotEmpty() } - ?: Natives.KERNEL_SU_DOMAIN; + ?: Natives.KERNEL_SU_DOMAIN val namespace = templateJson.optString("namespace").takeIf { it.isNotEmpty() } ?: Natives.Profile.Namespace.INHERITED.name @@ -276,13 +276,13 @@ fun TemplateViewModel.TemplateInfo.toJSON(): JSONObject { if (template.author.isNotEmpty()) { put("author", template.author) } - put("namespace", Natives.Profile.Namespace.values()[template.namespace].name) + put("namespace", Natives.Profile.Namespace.entries[template.namespace].name) put("uid", template.uid) put("gid", template.gid) if (template.groups.isNotEmpty()) { put("groups", JSONArray( - Groups.values().filter { + Groups.entries.filter { template.groups.contains(it.gid) }.map { it.name @@ -292,7 +292,7 @@ fun TemplateViewModel.TemplateInfo.toJSON(): JSONObject { if (template.capabilities.isNotEmpty()) { put("capabilities", JSONArray( - Capabilities.values().filter { + Capabilities.entries.filter { template.capabilities.contains(it.cap) }.map { it.name diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/MimeUtil.java b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/MimeUtil.java index 79ba2ff60b09..1fc2f4a4ceab 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/MimeUtil.java +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/MimeUtil.java @@ -51,89 +51,38 @@ private static String guessHardcodedMime(String fileName) { final String extension = fileName.substring(finalFullStop + 1).toLowerCase(); - switch (extension) { - case "webm": - return "video/webm"; - case "mpeg": - case "mpg": - return "video/mpeg"; - case "mp3": - return "audio/mpeg"; - case "wasm": - return "application/wasm"; - case "xhtml": - case "xht": - case "xhtm": - return "application/xhtml+xml"; - case "flac": - return "audio/flac"; - case "ogg": - case "oga": - case "opus": - return "audio/ogg"; - case "wav": - return "audio/wav"; - case "m4a": - return "audio/x-m4a"; - case "gif": - return "image/gif"; - case "jpeg": - case "jpg": - case "jfif": - case "pjpeg": - case "pjp": - return "image/jpeg"; - case "png": - return "image/png"; - case "apng": - return "image/apng"; - case "svg": - case "svgz": - return "image/svg+xml"; - case "webp": - return "image/webp"; - case "mht": - case "mhtml": - return "multipart/related"; - case "css": - return "text/css"; - case "html": - case "htm": - case "shtml": - case "shtm": - case "ehtml": - return "text/html"; - case "js": - case "mjs": - return "application/javascript"; - case "xml": - return "text/xml"; - case "mp4": - case "m4v": - return "video/mp4"; - case "ogv": - case "ogm": - return "video/ogg"; - case "ico": - return "image/x-icon"; - case "woff": - return "application/font-woff"; - case "gz": - case "tgz": - return "application/gzip"; - case "json": - return "application/json"; - case "pdf": - return "application/pdf"; - case "zip": - return "application/zip"; - case "bmp": - return "image/bmp"; - case "tiff": - case "tif": - return "image/tiff"; - default: - return null; - } + return switch (extension) { + case "webm" -> "video/webm"; + case "mpeg", "mpg" -> "video/mpeg"; + case "mp3" -> "audio/mpeg"; + case "wasm" -> "application/wasm"; + case "xhtml", "xht", "xhtm" -> "application/xhtml+xml"; + case "flac" -> "audio/flac"; + case "ogg", "oga", "opus" -> "audio/ogg"; + case "wav" -> "audio/wav"; + case "m4a" -> "audio/x-m4a"; + case "gif" -> "image/gif"; + case "jpeg", "jpg", "jfif", "pjpeg", "pjp" -> "image/jpeg"; + case "png" -> "image/png"; + case "apng" -> "image/apng"; + case "svg", "svgz" -> "image/svg+xml"; + case "webp" -> "image/webp"; + case "mht", "mhtml" -> "multipart/related"; + case "css" -> "text/css"; + case "html", "htm", "shtml", "shtm", "ehtml" -> "text/html"; + case "js", "mjs" -> "application/javascript"; + case "xml" -> "text/xml"; + case "mp4", "m4v" -> "video/mp4"; + case "ogv", "ogm" -> "video/ogg"; + case "ico" -> "image/x-icon"; + case "woff" -> "application/font-woff"; + case "gz", "tgz" -> "application/gzip"; + case "json" -> "application/json"; + case "pdf" -> "application/pdf"; + case "zip" -> "application/zip"; + case "bmp" -> "image/bmp"; + case "tiff", "tif" -> "image/tiff"; + default -> null; + }; } } diff --git a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/SuFilePathHandler.java b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/SuFilePathHandler.java index 84a37c84681e..ff450e8e9cfe 100644 --- a/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/SuFilePathHandler.java +++ b/manager/app/src/main/java/me/weishu/kernelsu/ui/webui/SuFilePathHandler.java @@ -13,13 +13,10 @@ import com.topjohnwu.superuser.io.SuFileInputStream; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPInputStream; -import me.weishu.kernelsu.ui.util.KsuCliKt; - /** * Handler class to open files from file system by root access * For more information about android storage please refer to @@ -172,8 +169,7 @@ private static InputStream handleSvgzStream(@NonNull String path, return path.endsWith(".svgz") ? new GZIPInputStream(stream) : stream; } - public static InputStream openFile(@NonNull File file, @NonNull Shell shell) throws FileNotFoundException, - IOException { + public static InputStream openFile(@NonNull File file, @NonNull Shell shell) throws IOException { SuFile suFile = new SuFile(file.getAbsolutePath()); suFile.setShell(shell); InputStream fis = SuFileInputStream.open(suFile); diff --git a/manager/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/manager/app/src/main/res/mipmap-anydpi/ic_launcher.xml similarity index 100% rename from manager/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml rename to manager/app/src/main/res/mipmap-anydpi/ic_launcher.xml diff --git a/manager/build.gradle.kts b/manager/build.gradle.kts index 9786106baa31..d2c372b36c3f 100644 --- a/manager/build.gradle.kts +++ b/manager/build.gradle.kts @@ -42,10 +42,6 @@ val androidTargetCompatibility = JavaVersion.VERSION_21 val managerVersionCode by extra(getVersionCode()) val managerVersionName by extra(getVersionName()) -tasks.register("clean") { - delete(rootProject.buildDir) -} - fun getGitCommitCount(): Int { val out = ByteArrayOutputStream() exec { diff --git a/manager/settings.gradle.kts b/manager/settings.gradle.kts index 1a4947bfc73f..2230bf48671a 100644 --- a/manager/settings.gradle.kts +++ b/manager/settings.gradle.kts @@ -1,3 +1,5 @@ +@file:Suppress("UnstableApiUsage") + enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") pluginManagement {