mirror of
https://github.com/revanced/revanced-manager
synced 2024-05-14 13:56:57 +02:00
style: run formatter
This commit is contained in:
parent
a48faad17a
commit
32839656f8
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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() }
|
||||
|
@ -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
|
||||
|
@ -9,7 +9,8 @@ import kotlinx.coroutines.flow.MutableSharedFlow
|
||||
import kotlinx.coroutines.flow.asSharedFlow
|
||||
|
||||
class PatchesRepository(private val managerAPI: ManagerAPI) {
|
||||
private val patchInformation = MutableSharedFlow<List<PatchInfo>>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
|
||||
private val patchInformation =
|
||||
MutableSharedFlow<List<PatchInfo>>(replay = 1, onBufferOverflow = BufferOverflow.DROP_OLDEST)
|
||||
private var bundle: PatchBundle? = null
|
||||
|
||||
private val scope = CoroutineScope(Job() + Dispatchers.IO)
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -23,6 +23,7 @@ class InstallService : Service() {
|
||||
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
})
|
||||
}
|
||||
|
||||
else -> {
|
||||
sendBroadcast(Intent().apply {
|
||||
action = APP_INSTALL_ACTION
|
||||
|
@ -23,6 +23,7 @@ class UninstallService : Service() {
|
||||
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
})
|
||||
}
|
||||
|
||||
else -> {
|
||||
sendBroadcast(Intent().apply {
|
||||
action = APP_UNINSTALL_ACTION
|
||||
|
@ -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<String>) : Destination
|
||||
|
@ -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
|
||||
|
||||
}
|
@ -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) }
|
||||
)
|
||||
}*/
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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)) }
|
||||
)
|
||||
|
@ -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 })
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -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)) }
|
||||
)
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user