diff --git a/app/src/main/java/app/revanced/manager/compose/MainActivity.kt b/app/src/main/java/app/revanced/manager/compose/MainActivity.kt index 4fa94695..5aecb60d 100644 --- a/app/src/main/java/app/revanced/manager/compose/MainActivity.kt +++ b/app/src/main/java/app/revanced/manager/compose/MainActivity.kt @@ -8,19 +8,11 @@ import androidx.compose.foundation.isSystemInDarkTheme import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen import app.revanced.manager.compose.domain.manager.PreferencesManager import app.revanced.manager.compose.ui.destination.Destination -import app.revanced.manager.compose.ui.screen.AppSelectorScreen -import app.revanced.manager.compose.ui.screen.DashboardScreen -import app.revanced.manager.compose.ui.screen.PatchesSelectorScreen -import app.revanced.manager.compose.ui.screen.SettingsScreen -import app.revanced.manager.compose.ui.screen.InstallerScreen +import app.revanced.manager.compose.ui.screen.* import app.revanced.manager.compose.ui.theme.ReVancedManagerTheme import app.revanced.manager.compose.ui.theme.Theme import app.revanced.manager.compose.util.PM -import dev.olshevski.navigation.reimagined.AnimatedNavHost -import dev.olshevski.navigation.reimagined.NavBackHandler -import dev.olshevski.navigation.reimagined.navigate -import dev.olshevski.navigation.reimagined.pop -import dev.olshevski.navigation.reimagined.rememberNavController +import dev.olshevski.navigation.reimagined.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.MainScope import kotlinx.coroutines.launch diff --git a/app/src/main/java/app/revanced/manager/compose/di/RepositoryModule.kt b/app/src/main/java/app/revanced/manager/compose/di/RepositoryModule.kt index 8750bbb2..0ac85977 100644 --- a/app/src/main/java/app/revanced/manager/compose/di/RepositoryModule.kt +++ b/app/src/main/java/app/revanced/manager/compose/di/RepositoryModule.kt @@ -2,7 +2,7 @@ package app.revanced.manager.compose.di import app.revanced.manager.compose.domain.repository.ReVancedRepositoryImpl import app.revanced.manager.compose.network.api.ManagerAPI -import app.revanced.manager.compose.patcher.data.repository.* +import app.revanced.manager.compose.patcher.data.repository.PatchesRepository import org.koin.core.module.dsl.singleOf import org.koin.dsl.module diff --git a/app/src/main/java/app/revanced/manager/compose/di/ViewModelModule.kt b/app/src/main/java/app/revanced/manager/compose/di/ViewModelModule.kt index 90661592..474e3ea8 100644 --- a/app/src/main/java/app/revanced/manager/compose/di/ViewModelModule.kt +++ b/app/src/main/java/app/revanced/manager/compose/di/ViewModelModule.kt @@ -1,8 +1,11 @@ package app.revanced.manager.compose.di -import app.revanced.manager.compose.ui.viewmodel.* -import org.koin.androidx.viewmodel.dsl.viewModelOf +import app.revanced.manager.compose.ui.viewmodel.AppSelectorViewModel +import app.revanced.manager.compose.ui.viewmodel.InstallerScreenViewModel +import app.revanced.manager.compose.ui.viewmodel.PatchesSelectorViewModel +import app.revanced.manager.compose.ui.viewmodel.SettingsViewModel import org.koin.androidx.viewmodel.dsl.viewModel +import org.koin.androidx.viewmodel.dsl.viewModelOf import org.koin.dsl.module val viewModelModule = module { diff --git a/app/src/main/java/app/revanced/manager/compose/patcher/Session.kt b/app/src/main/java/app/revanced/manager/compose/patcher/Session.kt index d84fc35c..056928a1 100644 --- a/app/src/main/java/app/revanced/manager/compose/patcher/Session.kt +++ b/app/src/main/java/app/revanced/manager/compose/patcher/Session.kt @@ -1,11 +1,11 @@ package app.revanced.manager.compose.patcher -import app.revanced.patcher.Patcher -import app.revanced.patcher.PatcherOptions -import app.revanced.patcher.logging.Logger import android.util.Log import app.revanced.manager.compose.patcher.worker.Progress +import app.revanced.patcher.Patcher +import app.revanced.patcher.PatcherOptions import app.revanced.patcher.data.Context +import app.revanced.patcher.logging.Logger import app.revanced.patcher.patch.Patch import java.io.Closeable import java.io.File @@ -22,7 +22,8 @@ class Session( private val input: File, private val onProgress: suspend (Progress) -> Unit = { } ) : Closeable { - class PatchFailedException(val patchName: String, cause: Throwable?) : Exception("Got exception while executing $patchName", cause) + class PatchFailedException(val patchName: String, cause: Throwable?) : + Exception("Got exception while executing $patchName", cause) private val logger = LogcatLogger private val temporary = File(cacheDir).resolve("manager").also { it.mkdirs() } diff --git a/app/src/main/java/app/revanced/manager/compose/patcher/alignment/zip/structures/ZipEndRecord.kt b/app/src/main/java/app/revanced/manager/compose/patcher/alignment/zip/structures/ZipEndRecord.kt index 08319db4..455dab77 100644 --- a/app/src/main/java/app/revanced/manager/compose/patcher/alignment/zip/structures/ZipEndRecord.kt +++ b/app/src/main/java/app/revanced/manager/compose/patcher/alignment/zip/structures/ZipEndRecord.kt @@ -1,6 +1,9 @@ package app.revanced.manager.compose.patcher.alignment.zip.structures -import app.revanced.manager.compose.patcher.alignment.zip.* +import app.revanced.manager.compose.patcher.alignment.zip.putUInt +import app.revanced.manager.compose.patcher.alignment.zip.putUShort +import app.revanced.manager.compose.patcher.alignment.zip.readUIntLE +import app.revanced.manager.compose.patcher.alignment.zip.readUShortLE import java.io.DataInput import java.nio.ByteBuffer import java.nio.ByteOrder diff --git a/app/src/main/java/app/revanced/manager/compose/patcher/data/repository/PatchesRepository.kt b/app/src/main/java/app/revanced/manager/compose/patcher/data/repository/PatchesRepository.kt index ef554ad2..298162d8 100644 --- a/app/src/main/java/app/revanced/manager/compose/patcher/data/repository/PatchesRepository.kt +++ b/app/src/main/java/app/revanced/manager/compose/patcher/data/repository/PatchesRepository.kt @@ -9,7 +9,8 @@ import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow class PatchesRepository(private val managerAPI: ManagerAPI) { - private val patchInformation = MutableSharedFlow>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST) + private val patchInformation = + MutableSharedFlow>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST) private var bundle: PatchBundle? = null private val scope = CoroutineScope(Job() + Dispatchers.IO) diff --git a/app/src/main/java/app/revanced/manager/compose/patcher/patch/PatchInfo.kt b/app/src/main/java/app/revanced/manager/compose/patcher/patch/PatchInfo.kt index e04adf4a..65ccc824 100644 --- a/app/src/main/java/app/revanced/manager/compose/patcher/patch/PatchInfo.kt +++ b/app/src/main/java/app/revanced/manager/compose/patcher/patch/PatchInfo.kt @@ -32,7 +32,8 @@ data class PatchInfo( fun compatibleWith(packageName: String) = compatiblePackages?.any { it.name == packageName } ?: true fun supportsVersion(versionName: String) = - compatiblePackages?.any { compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == versionName } } } ?: true + compatiblePackages?.any { compatiblePackages.any { it.versions.isEmpty() || it.versions.any { version -> version == versionName } } } + ?: true } @Parcelize diff --git a/app/src/main/java/app/revanced/manager/compose/patcher/worker/PatcherWorker.kt b/app/src/main/java/app/revanced/manager/compose/patcher/worker/PatcherWorker.kt index ca6d9391..f091b9c7 100644 --- a/app/src/main/java/app/revanced/manager/compose/patcher/worker/PatcherWorker.kt +++ b/app/src/main/java/app/revanced/manager/compose/patcher/worker/PatcherWorker.kt @@ -4,9 +4,9 @@ import android.content.Context import android.util.Log import androidx.work.CoroutineWorker import androidx.work.WorkerParameters -import app.revanced.manager.compose.patcher.data.repository.PatchesRepository import app.revanced.manager.compose.patcher.Session import app.revanced.manager.compose.patcher.aapt.Aapt +import app.revanced.manager.compose.patcher.data.repository.PatchesRepository import app.revanced.patcher.extensions.PatchExtensions.patchName import kotlinx.serialization.Serializable import kotlinx.serialization.decodeFromString diff --git a/app/src/main/java/app/revanced/manager/compose/service/InstallService.kt b/app/src/main/java/app/revanced/manager/compose/service/InstallService.kt index cef0d7f4..1cc347c8 100644 --- a/app/src/main/java/app/revanced/manager/compose/service/InstallService.kt +++ b/app/src/main/java/app/revanced/manager/compose/service/InstallService.kt @@ -23,6 +23,7 @@ class InstallService : Service() { this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) }) } + else -> { sendBroadcast(Intent().apply { action = APP_INSTALL_ACTION diff --git a/app/src/main/java/app/revanced/manager/compose/service/UninstallService.kt b/app/src/main/java/app/revanced/manager/compose/service/UninstallService.kt index 492eda3b..c5cbfa80 100644 --- a/app/src/main/java/app/revanced/manager/compose/service/UninstallService.kt +++ b/app/src/main/java/app/revanced/manager/compose/service/UninstallService.kt @@ -23,6 +23,7 @@ class UninstallService : Service() { this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) }) } + else -> { sendBroadcast(Intent().apply { action = APP_UNINSTALL_ACTION diff --git a/app/src/main/java/app/revanced/manager/compose/ui/destination/Destination.kt b/app/src/main/java/app/revanced/manager/compose/ui/destination/Destination.kt index 87b692a1..b8eb6fa5 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/destination/Destination.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/destination/Destination.kt @@ -3,21 +3,20 @@ package app.revanced.manager.compose.ui.destination import android.os.Parcelable import app.revanced.manager.compose.util.PackageInfo import kotlinx.parcelize.Parcelize -import java.io.File -sealed interface Destination: Parcelable { +sealed interface Destination : Parcelable { @Parcelize - object Dashboard: Destination + object Dashboard : Destination @Parcelize - object AppSelector: Destination + object AppSelector : Destination @Parcelize - object Settings: Destination + object Settings : Destination @Parcelize - data class PatchesSelector(val input: PackageInfo): Destination + data class PatchesSelector(val input: PackageInfo) : Destination @Parcelize data class Installer(val input: PackageInfo, val selectedPatches: List) : Destination diff --git a/app/src/main/java/app/revanced/manager/compose/ui/destination/SettingsDestination.kt b/app/src/main/java/app/revanced/manager/compose/ui/destination/SettingsDestination.kt index a3114c79..358d84e3 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/destination/SettingsDestination.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/destination/SettingsDestination.kt @@ -3,24 +3,24 @@ package app.revanced.manager.compose.ui.destination import android.os.Parcelable import kotlinx.parcelize.Parcelize -sealed interface SettingsDestination: Parcelable { +sealed interface SettingsDestination : Parcelable { @Parcelize - object Settings: SettingsDestination + object Settings : SettingsDestination @Parcelize - object General: SettingsDestination + object General : SettingsDestination @Parcelize - object Updates: SettingsDestination + object Updates : SettingsDestination @Parcelize - object Downloads: SettingsDestination + object Downloads : SettingsDestination @Parcelize - object ImportExport: SettingsDestination + object ImportExport : SettingsDestination @Parcelize - object About: SettingsDestination + object About : SettingsDestination } \ No newline at end of file diff --git a/app/src/main/java/app/revanced/manager/compose/ui/screen/AppSelectorScreen.kt b/app/src/main/java/app/revanced/manager/compose/ui/screen/AppSelectorScreen.kt index 25a54538..5047bcca 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/screen/AppSelectorScreen.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/screen/AppSelectorScreen.kt @@ -7,7 +7,8 @@ import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.* +import androidx.compose.material.icons.filled.ArrowBack +import androidx.compose.material.icons.filled.Storage import androidx.compose.material.icons.outlined.HelpOutline import androidx.compose.material.icons.outlined.Search import androidx.compose.material3.* @@ -48,12 +49,19 @@ fun AppSelectorScreen( SearchBar( query = filterText, onQueryChange = { filterText = it }, - onSearch = { }, + onSearch = { }, active = true, onActiveChange = { search = it }, modifier = Modifier.fillMaxSize(), placeholder = { Text(stringResource(R.string.search_apps)) }, - leadingIcon = { IconButton({ search = false }) { Icon(Icons.Default.ArrowBack, stringResource(R.string.back)) } }, + leadingIcon = { + IconButton({ search = false }) { + Icon( + Icons.Default.ArrowBack, + stringResource(R.string.back) + ) + } + }, shape = SearchBarDefaults.inputFieldShape, content = { if (PM.appList.isNotEmpty()) { @@ -93,7 +101,7 @@ fun AppSelectorScreen( title = stringResource(R.string.select_app), onBackClick = onBackClick, actions = { - IconButton(onClick = { }) { + IconButton(onClick = { }) { Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help)) } IconButton(onClick = { search = true }) { @@ -119,7 +127,15 @@ fun AppSelectorScreen( modifier = Modifier.clickable { pickApkLauncher.launch("*/*") }, - leadingContent = { Box(Modifier.size(36.dp), Alignment.Center) { Icon(Icons.Default.Storage, null, modifier = Modifier.size(24.dp)) } }, + leadingContent = { + Box(Modifier.size(36.dp), Alignment.Center) { + Icon( + Icons.Default.Storage, + null, + modifier = Modifier.size(24.dp) + ) + } + }, headlineContent = { Text(stringResource(R.string.select_from_storage)) } ) @@ -150,7 +166,10 @@ fun AppSelectorScreen( if (PM.appList.isEmpty()) { item { Box(Modifier.fillMaxWidth(), Alignment.Center) { - CircularProgressIndicator(Modifier.padding(vertical = 15.dp).size(24.dp), strokeWidth = 3.dp) + CircularProgressIndicator( + Modifier.padding(vertical = 15.dp).size(24.dp), + strokeWidth = 3.dp + ) } } } @@ -164,28 +183,27 @@ fun AppSelectorScreen( } - - /*Row( - modifier = Modifier.horizontalScroll(rememberScrollState()), - horizontalArrangement = Arrangement.spacedBy(10.dp) - ) { - FilterChip( - selected = false, - onClick = {}, - label = { Text("Patched apps") }, - leadingIcon = { Icon(Icons.Default.Check, null) }, - enabled = false - ) - FilterChip( - selected = false, - onClick = {}, - label = { Text("User apps") }, - leadingIcon = { Icon(Icons.Default.Android, null) } - ) - FilterChip( - selected = filterSystemApps, - onClick = { filterSystemApps = !filterSystemApps }, - label = { Text("System apps") }, - leadingIcon = { Icon(Icons.Default.Apps, null) } - ) - }*/ +/*Row( + modifier = Modifier.horizontalScroll(rememberScrollState()), + horizontalArrangement = Arrangement.spacedBy(10.dp) +) { + FilterChip( + selected = false, + onClick = {}, + label = { Text("Patched apps") }, + leadingIcon = { Icon(Icons.Default.Check, null) }, + enabled = false + ) + FilterChip( + selected = false, + onClick = {}, + label = { Text("User apps") }, + leadingIcon = { Icon(Icons.Default.Android, null) } + ) + FilterChip( + selected = filterSystemApps, + onClick = { filterSystemApps = !filterSystemApps }, + label = { Text("System apps") }, + leadingIcon = { Icon(Icons.Default.Apps, null) } + ) +}*/ diff --git a/app/src/main/java/app/revanced/manager/compose/ui/screen/DashboardScreen.kt b/app/src/main/java/app/revanced/manager/compose/ui/screen/DashboardScreen.kt index 0ccf0c68..1d301996 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/screen/DashboardScreen.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/screen/DashboardScreen.kt @@ -7,25 +7,11 @@ import androidx.compose.foundation.pager.HorizontalPager import androidx.compose.foundation.pager.rememberPagerState import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Add -import androidx.compose.material.icons.filled.Android import androidx.compose.material.icons.outlined.Apps import androidx.compose.material.icons.outlined.HelpOutline -import androidx.compose.material.icons.outlined.Info -import androidx.compose.material.icons.outlined.Notifications import androidx.compose.material.icons.outlined.Settings import androidx.compose.material.icons.outlined.Source -import androidx.compose.material.icons.outlined.Topic -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.FloatingActionButton -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.LeadingIconTab -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Scaffold -import androidx.compose.material3.Tab -import androidx.compose.material3.TabRow -import androidx.compose.material3.Text -import androidx.compose.material3.surfaceColorAtElevation +import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier diff --git a/app/src/main/java/app/revanced/manager/compose/ui/screen/InstallerScreen.kt b/app/src/main/java/app/revanced/manager/compose/ui/screen/InstallerScreen.kt index e341deb3..ed282f83 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/screen/InstallerScreen.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/screen/InstallerScreen.kt @@ -3,14 +3,16 @@ package app.revanced.manager.compose.ui.screen import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding -import androidx.compose.material3.* +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import app.revanced.manager.compose.R import app.revanced.manager.compose.ui.component.AppScaffold import app.revanced.manager.compose.ui.component.AppTopBar import app.revanced.manager.compose.ui.viewmodel.InstallerScreenViewModel -import app.revanced.manager.compose.R @OptIn(ExperimentalMaterial3Api::class) @Composable diff --git a/app/src/main/java/app/revanced/manager/compose/ui/screen/PatchesSelectorScreen.kt b/app/src/main/java/app/revanced/manager/compose/ui/screen/PatchesSelectorScreen.kt index bc06b134..2cc0ba29 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/screen/PatchesSelectorScreen.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/screen/PatchesSelectorScreen.kt @@ -1,12 +1,7 @@ package app.revanced.manager.compose.ui.screen import androidx.compose.foundation.ExperimentalFoundationApi -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.pager.HorizontalPager @@ -15,19 +10,7 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Build import androidx.compose.material.icons.outlined.HelpOutline import androidx.compose.material.icons.outlined.Search -import androidx.compose.material3.AlertDialog -import androidx.compose.material3.Button -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.ExtendedFloatingActionButton -import androidx.compose.material3.Icon -import androidx.compose.material3.IconButton -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.Scaffold -import androidx.compose.material3.Tab -import androidx.compose.material3.TabRow -import androidx.compose.material3.Text -import androidx.compose.material3.TextButton -import androidx.compose.material3.surfaceColorAtElevation +import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.rememberCoroutineScope diff --git a/app/src/main/java/app/revanced/manager/compose/ui/screen/SettingsScreen.kt b/app/src/main/java/app/revanced/manager/compose/ui/screen/SettingsScreen.kt index c24968d5..a5fd3bcb 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/screen/SettingsScreen.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/screen/SettingsScreen.kt @@ -9,16 +9,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.outlined.Download -import androidx.compose.material.icons.outlined.ImportExport -import androidx.compose.material.icons.outlined.Info -import androidx.compose.material.icons.outlined.Settings -import androidx.compose.material.icons.outlined.Update -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.Icon -import androidx.compose.material3.ListItem -import androidx.compose.material3.Scaffold -import androidx.compose.material3.Text +import androidx.compose.material.icons.outlined.* +import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource @@ -26,17 +18,9 @@ import androidx.compose.ui.unit.dp import app.revanced.manager.compose.R import app.revanced.manager.compose.ui.component.AppTopBar import app.revanced.manager.compose.ui.destination.SettingsDestination -import app.revanced.manager.compose.ui.screen.settings.AboutSettingsScreen -import app.revanced.manager.compose.ui.screen.settings.DownloadsSettingsScreen -import app.revanced.manager.compose.ui.screen.settings.GeneralSettingsScreen -import app.revanced.manager.compose.ui.screen.settings.ImportExportSettingsScreen -import app.revanced.manager.compose.ui.screen.settings.UpdatesSettingsScreen +import app.revanced.manager.compose.ui.screen.settings.* import app.revanced.manager.compose.ui.viewmodel.SettingsViewModel -import dev.olshevski.navigation.reimagined.AnimatedNavHost -import dev.olshevski.navigation.reimagined.NavBackHandler -import dev.olshevski.navigation.reimagined.navigate -import dev.olshevski.navigation.reimagined.pop -import dev.olshevski.navigation.reimagined.rememberNavController +import dev.olshevski.navigation.reimagined.* import org.koin.androidx.compose.getViewModel @OptIn(ExperimentalMaterial3Api::class, ExperimentalAnimationApi::class) diff --git a/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/AboutSettingsScreen.kt b/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/AboutSettingsScreen.kt index a2843343..61d48f57 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/AboutSettingsScreen.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/AboutSettingsScreen.kt @@ -2,21 +2,10 @@ package app.revanced.manager.compose.ui.screen.settings import androidx.compose.foundation.Image import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Arrangement -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.FilledTonalButton -import androidx.compose.material3.ListItem -import androidx.compose.material3.MaterialTheme -import androidx.compose.material3.OutlinedButton -import androidx.compose.material3.Scaffold -import androidx.compose.material3.Text +import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -49,7 +38,7 @@ fun AboutSettingsScreen( .padding(paddingValues) .verticalScroll(rememberScrollState()) ) { - + Column( modifier = Modifier.fillMaxWidth().padding(vertical = 15.dp), horizontalAlignment = Alignment.CenterHorizontally, @@ -82,9 +71,9 @@ fun AboutSettingsScreen( } } } - + ListItem( - modifier = Modifier.clickable { }, + modifier = Modifier.clickable { }, headlineContent = { Text(stringResource(R.string.contributors)) }, supportingContent = { Text(stringResource(R.string.contributors_description)) } ) diff --git a/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/GeneralSettingsScreen.kt b/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/GeneralSettingsScreen.kt index 575f0360..334b7344 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/GeneralSettingsScreen.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/GeneralSettingsScreen.kt @@ -2,21 +2,10 @@ package app.revanced.manager.compose.ui.screen.settings import android.os.Build import androidx.compose.foundation.clickable -import androidx.compose.foundation.layout.Column -import androidx.compose.foundation.layout.Row -import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.fillMaxWidth -import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.* import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.verticalScroll -import androidx.compose.material3.AlertDialog -import androidx.compose.material3.Button -import androidx.compose.material3.ExperimentalMaterial3Api -import androidx.compose.material3.ListItem -import androidx.compose.material3.RadioButton -import androidx.compose.material3.Scaffold -import androidx.compose.material3.Switch -import androidx.compose.material3.Text +import androidx.compose.material3.* import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -69,14 +58,22 @@ fun GeneralSettingsScreen( modifier = Modifier.clickable { showThemePicker = true }, headlineContent = { Text(stringResource(R.string.theme)) }, supportingContent = { Text(stringResource(R.string.theme_description)) }, - trailingContent = { Button({ showThemePicker = true }) { Text(stringResource(prefs.theme.displayName)) } } + trailingContent = { + Button({ + showThemePicker = true + }) { Text(stringResource(prefs.theme.displayName)) } + } ) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { ListItem( modifier = Modifier.clickable { prefs.dynamicColor = !prefs.dynamicColor }, headlineContent = { Text(stringResource(R.string.dynamic_color)) }, supportingContent = { Text(stringResource(R.string.dynamic_color_description)) }, - trailingContent = { Switch(checked = prefs.dynamicColor, onCheckedChange = { prefs.dynamicColor = it }) } + trailingContent = { + Switch( + checked = prefs.dynamicColor, + onCheckedChange = { prefs.dynamicColor = it }) + } ) } diff --git a/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/ImportExportSettingsScreen.kt b/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/ImportExportSettingsScreen.kt index 32d53160..a6f9cfac 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/ImportExportSettingsScreen.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/screen/settings/ImportExportSettingsScreen.kt @@ -38,12 +38,12 @@ fun ImportExportSettingsScreen( ) { GroupHeader(stringResource(R.string.signing)) ListItem( - modifier = Modifier.clickable { }, + modifier = Modifier.clickable { }, headlineContent = { Text(stringResource(R.string.import_keystore)) }, supportingContent = { Text(stringResource(R.string.import_keystore_descripion)) } ) ListItem( - modifier = Modifier.clickable { }, + modifier = Modifier.clickable { }, headlineContent = { Text(stringResource(R.string.export_keystore)) }, supportingContent = { Text(stringResource(R.string.export_keystore_description)) } ) diff --git a/app/src/main/java/app/revanced/manager/compose/ui/theme/Theme.kt b/app/src/main/java/app/revanced/manager/compose/ui/theme/Theme.kt index da791cf0..8c751628 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/theme/Theme.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/theme/Theme.kt @@ -9,7 +9,6 @@ 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.res.stringResource import androidx.core.view.WindowCompat import app.revanced.manager.compose.R @@ -36,6 +35,7 @@ fun ReVancedManagerTheme( val context = LocalContext.current if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context) } + darkTheme -> DarkColorScheme else -> LightColorScheme } diff --git a/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/InstallerScreenViewModel.kt b/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/InstallerScreenViewModel.kt index dbd22bb3..586d85d3 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/InstallerScreenViewModel.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/InstallerScreenViewModel.kt @@ -12,8 +12,8 @@ import androidx.compose.runtime.setValue import androidx.lifecycle.Observer import androidx.lifecycle.ViewModel import androidx.work.* -import app.revanced.manager.compose.patcher.worker.PatcherWorker import app.revanced.manager.compose.patcher.worker.PatcherProgressManager +import app.revanced.manager.compose.patcher.worker.PatcherWorker import app.revanced.manager.compose.patcher.worker.StepGroup import app.revanced.manager.compose.service.InstallService import app.revanced.manager.compose.service.UninstallService diff --git a/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/PatchesSelectorViewModel.kt b/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/PatchesSelectorViewModel.kt index ef1170fe..c1d72f48 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/PatchesSelectorViewModel.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/PatchesSelectorViewModel.kt @@ -1,6 +1,9 @@ package app.revanced.manager.compose.ui.viewmodel -import androidx.compose.runtime.* +import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableStateListOf +import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import app.revanced.manager.compose.patcher.data.repository.PatchesRepository import app.revanced.manager.compose.patcher.patch.PatchInfo diff --git a/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/SettingsViewModel.kt b/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/SettingsViewModel.kt index 113270e1..c5eede37 100644 --- a/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/SettingsViewModel.kt +++ b/app/src/main/java/app/revanced/manager/compose/ui/viewmodel/SettingsViewModel.kt @@ -6,7 +6,7 @@ import app.revanced.manager.compose.ui.theme.Theme class SettingsViewModel( val prefs: PreferencesManager -): ViewModel() { +) : ViewModel() { fun setTheme(theme: Theme) { prefs.theme = theme diff --git a/app/src/main/java/app/revanced/manager/compose/util/PM.kt b/app/src/main/java/app/revanced/manager/compose/util/PM.kt index 2f4eb488..40e64dcc 100644 --- a/app/src/main/java/app/revanced/manager/compose/util/PM.kt +++ b/app/src/main/java/app/revanced/manager/compose/util/PM.kt @@ -6,7 +6,6 @@ import android.content.Context import android.content.Intent import android.content.pm.PackageInstaller import android.content.pm.PackageManager -import android.content.pm.PackageManager.PackageInfoFlags import android.graphics.drawable.Drawable import android.os.Build import android.os.Parcelable @@ -68,7 +67,8 @@ object PM { packageInstaller.uninstall(pkg, context.uninstallIntentSender) } - fun getApkInfo(apk: File, context: Context) = context.packageManager.getPackageArchiveInfo(apk.path, 0)!!.let { PackageInfo(it.packageName, it.versionName, apk) } + fun getApkInfo(apk: File, context: Context) = context.packageManager.getPackageArchiveInfo(apk.path, 0)!! + .let { PackageInfo(it.packageName, it.versionName, apk) } } private fun PackageInstaller.Session.writeApk(apk: File) {