Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package io.github.soclear.oneuix.ui.category

import io.github.soclear.oneuix.common.Package

enum class Category(val packageName: String) {
enum class Category(val packageName: String, val additionalPackages: List<String> = emptyList()) {
Android(Package.ANDROID),
SystemUI(Package.SYSTEMUI),
Settings(Package.SETTINGS),
Call(Package.DIALER),
Settings(Package.SETTINGS, listOf(Package.SM_CN)),
Call(Package.DIALER, listOf(Package.INCALLUI, Package.TELEPHONYUI, Package.MDEC_SERVICE)),
Camera(Package.CAMERA),
Bixby(Package.BIXBY_AGENT),
Bixby(Package.BIXBY_AGENT, listOf(Package.BIXBY_WAKEUP)),
Browser(Package.BROWSER),
Calendar(Package.CALENDAR),
DualApp(Package.DUAL_APP),
Expand All @@ -29,4 +29,7 @@ enum class Category(val packageName: String) {
WatchManager(Package.WATCH_MANAGER),
Weather(Package.WEATHER),
Other("");

val packages: List<String>
get() = listOf(packageName) + additionalPackages
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneBixby(
onEvent: (BixbyEvent) -> Unit,
modifier: Modifier = Modifier,
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Bixby) {
SwitchItem(
icon = ImageVector.vectorResource(R.drawable.wifi_link_speed),
title = stringResource(R.string.unlockBixbyOfflineProcessing_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneBrowser(
onEvent: (BrowserEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Browser) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.fast_forward),
title = stringResource(id = R.string.showMorePlaybackSpeeds_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneCalendar(
onEvent: (CalendarEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Calendar) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.today),
title = stringResource(id = R.string.enableChineseHolidayDisplay_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fun DetailPaneCall(
.fillMaxSize()
.verticalScroll(rememberScrollState())
) {
ForceStopButton(Category.Call)
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.call_recording),
title = stringResource(id = R.string.supportVoiceCallRecording_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fun DetailPaneCamera(
.fillMaxSize()
.verticalScroll(rememberScrollState())
) {
ForceStopButton(Category.Camera)
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.camera),
title = stringResource(id = R.string.supportAllCameraMenu_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneDualApp(
onEvent: (DualAppEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.DualApp) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.apk_document),
title = stringResource(id = R.string.makeAllUserAppsAvailable_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun DetailPaneGalaxyStore(
onEvent: (GalaxyStoreEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.GalaxyStore) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.ad_off),
title = stringResource(id = R.string.blockGalaxyStoreAds_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneGallery(
onEvent: (GalleryEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Gallery) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.photo_library),
title = stringResource(id = R.string.supportAllGallerySettings_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneHealthMonitor(
onEvent: (HealthMonitorEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.HealthMonitor) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.health_metrics),
title = stringResource(id = R.string.bypassHealthMonitorCountryCheck_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fun DetailPaneLauncher(
onEvent: (LauncherEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Launcher) {
MediaPageSettings(uiState, onEvent)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
SwitchItem(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneMessaging(
onEvent: (MessagingEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Messaging) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.sms),
title = stringResource(id = R.string.supportBlockMessage_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneMyFiles(
onEvent: (MyFilesEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.MyFiles) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.folder_managed),
title = stringResource(id = R.string.fixMyFilesNetworkStorage_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ fun DetailPaneNFC(
onNavigateToNfcCards: () -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.NFC) {
ListItem(
headlineContent = { Text(stringResource(R.string.nfc_filter_title)) },
supportingContent = { Text(stringResource(R.string.nfc_filter_summary)) },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneNotes(
onEvent: (NotesEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Notes) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.notes),
title = stringResource(id = R.string.supportAllNotesFeatures_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPanePhotoRetouching(
onEvent: (PhotoRetouchingEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.PhotoRetouching) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.branding_watermark),
title = stringResource(id = R.string.noAIWatermark_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneSPen(
onEvent: (SPenEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.SPen) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.spen),
title = stringResource(id = R.string.useSPenGoogleTranslate_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneSamsungHealth(
onEvent: (SamsungHealthEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Health) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.health_metrics),
title = stringResource(id = R.string.hideSamsungHealthDiscover_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ fun DetailPaneSettings(
.fillMaxSize()
.verticalScroll(rememberScrollState())
) {
ForceStopButton(Category.Settings)
SwitchItem(
title = stringResource(id = R.string.showForcePeakRefreshRatePreference_title),
summary = stringResource(id = R.string.showForcePeakRefreshRatePreference_summary),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneSketchBook(
onEvent: (SketchBookEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.SketchBook) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.branding_watermark),
title = stringResource(id = R.string.noAIWatermark_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneThemeCenter(
onEvent: (ThemeCenterEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.ThemeCenter) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.format_paint),
title = stringResource(id = R.string.setThemeTrialNeverExpired_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneVideo(
onEvent: (VideoEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Video) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.fast_forward),
title = stringResource(id = R.string.showMorePlaybackSpeeds_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fun DetailPaneWatchManager(
onEvent: (WatchManagerEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.WatchManager) {
SelectItem(
icon = ImageVector.vectorResource(id = R.drawable.watch_pairing),
title = stringResource(id = R.string.watchPairing_connectionMode_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ fun DetailPaneWeather(
onEvent: (WeatherEvent) -> Unit,
modifier: Modifier = Modifier
) {
PackagePane(modifier) {
PackagePane(modifier, Category.Weather) {
SwitchItem(
icon = ImageVector.vectorResource(id = R.drawable.partly_cloudy_day),
title = stringResource(id = R.string.setWeatherProviderCN_title),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,51 @@ package io.github.soclear.oneuix.ui.category

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import io.github.soclear.oneuix.R

@Composable
internal fun PackagePane(
modifier: Modifier = Modifier,
category: Category? = null,
content: @Composable ColumnScope.() -> Unit
) {
Column(
modifier = modifier
.fillMaxSize()
.verticalScroll(rememberScrollState()),
content = content
)
.verticalScroll(rememberScrollState())
) {
category?.let { ForceStopButton(it) }
content()
}
}

@Composable
internal fun ColumnScope.ForceStopButton(category: Category) {
Spacer(modifier = Modifier.height(30.dp))
Button(
modifier = Modifier.align(Alignment.CenterHorizontally),
onClick = {
runCatching {
ProcessBuilder(
"su", "-c",
category.packages.joinToString("; ") { "am force-stop --user current $it" }
).start()
}
}
) {
Text(text = stringResource(R.string.forceStopApp))
}
Spacer(modifier = Modifier.height(16.dp))
}
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,5 @@
<string name="allowLowBatteryFlashlight_summary">Utilisable jusqu’à 1 % sans extinction automatique due à la batterie faible. La protection thermique est conservée</string>
<string name="fixMyFilesNetworkStorage_title">Corriger la redirection du stockage réseau dans Mes fichiers</string>
<string name="fixMyFilesNetworkStorage_summary">Pour la version internationale de Mes fichiers sur une ROM chinoise : empêche le stockage réseau de rediriger vers la page de mise à jour du Galaxy Store. La dernière version en cache est alignée sur la version installée</string>
<string name="forceStopApp">Forcer l’arrêt de l’application</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ko/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,5 @@
<string name="allowLowBatteryFlashlight_summary">배터리 부족으로 자동으로 꺼지지 않고 1%까지 사용합니다. 과열 보호는 유지됩니다</string>
<string name="fixMyFilesNetworkStorage_title">내 파일 네트워크 저장소 이동 문제 수정</string>
<string name="fixMyFilesNetworkStorage_summary">중국 ROM에서 국제판 내 파일을 사용할 때 네트워크 저장소를 누르면 Galaxy Store 업데이트 페이지로 이동하는 문제를 막습니다. 캐시된 최신 버전을 설치된 버전과 동일하게 유지합니다</string>
<string name="forceStopApp">앱 강제 종료</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,5 @@
<string name="allowLowBatteryFlashlight_summary">Работа до 1 % без автоматического отключения из-за низкого заряда. Защита от перегрева сохраняется</string>
<string name="fixMyFilesNetworkStorage_title">Исправить переход «Сетевого хранилища» в «Моих файлах»</string>
<string name="fixMyFilesNetworkStorage_summary">Для международной версии «Моих файлов» на китайской прошивке: не даёт «Сетевому хранилищу» перенаправлять на страницу обновления в Galaxy Store. Кэшированная последняя версия приравнивается к установленной</string>
<string name="forceStopApp">Принудительно остановить приложение</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,5 @@
<string name="allowLowBatteryFlashlight_summary">电量低至 1% 时仍可使用,不因低电量自动关闭;保留过热保护</string>
<string name="fixMyFilesNetworkStorage_title">修复我的文件网络存储跳转</string>
<string name="fixMyFilesNetworkStorage_summary">适用于国行系统上使用国际版“我的文件”:点击网络存储时不再跳转到应用商店更新页面。让缓存的最新版本与已安装版本保持一致</string>
<string name="forceStopApp">强行停止应用</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -257,4 +257,5 @@
<string name="allowLowBatteryFlashlight_summary">Allow use down to 1% without automatic shutoff due to low battery. Thermal protection is retained</string>
<string name="fixMyFilesNetworkStorage_title">Fix My Files network storage redirect</string>
<string name="fixMyFilesNetworkStorage_summary">For the international My Files on a China ROM: stop Network storage from jumping to the Galaxy Store update page. Keeps the cached latest version equal to the installed version</string>
<string name="forceStopApp">Force stop app</string>
</resources>