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 androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||||
import app.revanced.manager.compose.domain.manager.PreferencesManager
|
import app.revanced.manager.compose.domain.manager.PreferencesManager
|
||||||
import app.revanced.manager.compose.ui.destination.Destination
|
import app.revanced.manager.compose.ui.destination.Destination
|
||||||
import app.revanced.manager.compose.ui.screen.AppSelectorScreen
|
import app.revanced.manager.compose.ui.screen.*
|
||||||
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.theme.ReVancedManagerTheme
|
import app.revanced.manager.compose.ui.theme.ReVancedManagerTheme
|
||||||
import app.revanced.manager.compose.ui.theme.Theme
|
import app.revanced.manager.compose.ui.theme.Theme
|
||||||
import app.revanced.manager.compose.util.PM
|
import app.revanced.manager.compose.util.PM
|
||||||
import dev.olshevski.navigation.reimagined.AnimatedNavHost
|
import dev.olshevski.navigation.reimagined.*
|
||||||
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 kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.MainScope
|
import kotlinx.coroutines.MainScope
|
||||||
import kotlinx.coroutines.launch
|
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.domain.repository.ReVancedRepositoryImpl
|
||||||
import app.revanced.manager.compose.network.api.ManagerAPI
|
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.core.module.dsl.singleOf
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
|
@ -1,8 +1,11 @@
|
|||||||
package app.revanced.manager.compose.di
|
package app.revanced.manager.compose.di
|
||||||
|
|
||||||
import app.revanced.manager.compose.ui.viewmodel.*
|
import app.revanced.manager.compose.ui.viewmodel.AppSelectorViewModel
|
||||||
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
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.viewModel
|
||||||
|
import org.koin.androidx.viewmodel.dsl.viewModelOf
|
||||||
import org.koin.dsl.module
|
import org.koin.dsl.module
|
||||||
|
|
||||||
val viewModelModule = module {
|
val viewModelModule = module {
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package app.revanced.manager.compose.patcher
|
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 android.util.Log
|
||||||
import app.revanced.manager.compose.patcher.worker.Progress
|
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.data.Context
|
||||||
|
import app.revanced.patcher.logging.Logger
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@ -22,7 +22,8 @@ class Session(
|
|||||||
private val input: File,
|
private val input: File,
|
||||||
private val onProgress: suspend (Progress) -> Unit = { }
|
private val onProgress: suspend (Progress) -> Unit = { }
|
||||||
) : Closeable {
|
) : 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 logger = LogcatLogger
|
||||||
private val temporary = File(cacheDir).resolve("manager").also { it.mkdirs() }
|
private val temporary = File(cacheDir).resolve("manager").also { it.mkdirs() }
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package app.revanced.manager.compose.patcher.alignment.zip.structures
|
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.io.DataInput
|
||||||
import java.nio.ByteBuffer
|
import java.nio.ByteBuffer
|
||||||
import java.nio.ByteOrder
|
import java.nio.ByteOrder
|
||||||
|
@ -9,7 +9,8 @@ import kotlinx.coroutines.flow.MutableSharedFlow
|
|||||||
import kotlinx.coroutines.flow.asSharedFlow
|
import kotlinx.coroutines.flow.asSharedFlow
|
||||||
|
|
||||||
class PatchesRepository(private val managerAPI: ManagerAPI) {
|
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 var bundle: PatchBundle? = null
|
||||||
|
|
||||||
private val scope = CoroutineScope(Job() + Dispatchers.IO)
|
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 compatibleWith(packageName: String) = compatiblePackages?.any { it.name == packageName } ?: true
|
||||||
|
|
||||||
fun supportsVersion(versionName: String) =
|
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
|
@Parcelize
|
||||||
|
@ -4,9 +4,9 @@ import android.content.Context
|
|||||||
import android.util.Log
|
import android.util.Log
|
||||||
import androidx.work.CoroutineWorker
|
import androidx.work.CoroutineWorker
|
||||||
import androidx.work.WorkerParameters
|
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.Session
|
||||||
import app.revanced.manager.compose.patcher.aapt.Aapt
|
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 app.revanced.patcher.extensions.PatchExtensions.patchName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlinx.serialization.decodeFromString
|
import kotlinx.serialization.decodeFromString
|
||||||
|
@ -23,6 +23,7 @@ class InstallService : Service() {
|
|||||||
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
sendBroadcast(Intent().apply {
|
sendBroadcast(Intent().apply {
|
||||||
action = APP_INSTALL_ACTION
|
action = APP_INSTALL_ACTION
|
||||||
|
@ -23,6 +23,7 @@ class UninstallService : Service() {
|
|||||||
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
this?.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
else -> {
|
else -> {
|
||||||
sendBroadcast(Intent().apply {
|
sendBroadcast(Intent().apply {
|
||||||
action = APP_UNINSTALL_ACTION
|
action = APP_UNINSTALL_ACTION
|
||||||
|
@ -3,21 +3,20 @@ package app.revanced.manager.compose.ui.destination
|
|||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import app.revanced.manager.compose.util.PackageInfo
|
import app.revanced.manager.compose.util.PackageInfo
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
sealed interface Destination: Parcelable {
|
sealed interface Destination : Parcelable {
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object Dashboard: Destination
|
object Dashboard : Destination
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object AppSelector: Destination
|
object AppSelector : Destination
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object Settings: Destination
|
object Settings : Destination
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class PatchesSelector(val input: PackageInfo): Destination
|
data class PatchesSelector(val input: PackageInfo) : Destination
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
data class Installer(val input: PackageInfo, val selectedPatches: List<String>) : Destination
|
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 android.os.Parcelable
|
||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
|
|
||||||
sealed interface SettingsDestination: Parcelable {
|
sealed interface SettingsDestination : Parcelable {
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object Settings: SettingsDestination
|
object Settings : SettingsDestination
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object General: SettingsDestination
|
object General : SettingsDestination
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object Updates: SettingsDestination
|
object Updates : SettingsDestination
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object Downloads: SettingsDestination
|
object Downloads : SettingsDestination
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
object ImportExport: SettingsDestination
|
object ImportExport : SettingsDestination
|
||||||
|
|
||||||
@Parcelize
|
@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.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material.icons.Icons
|
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.HelpOutline
|
||||||
import androidx.compose.material.icons.outlined.Search
|
import androidx.compose.material.icons.outlined.Search
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.*
|
||||||
@ -48,12 +49,19 @@ fun AppSelectorScreen(
|
|||||||
SearchBar(
|
SearchBar(
|
||||||
query = filterText,
|
query = filterText,
|
||||||
onQueryChange = { filterText = it },
|
onQueryChange = { filterText = it },
|
||||||
onSearch = { },
|
onSearch = { },
|
||||||
active = true,
|
active = true,
|
||||||
onActiveChange = { search = it },
|
onActiveChange = { search = it },
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
placeholder = { Text(stringResource(R.string.search_apps)) },
|
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,
|
shape = SearchBarDefaults.inputFieldShape,
|
||||||
content = {
|
content = {
|
||||||
if (PM.appList.isNotEmpty()) {
|
if (PM.appList.isNotEmpty()) {
|
||||||
@ -93,7 +101,7 @@ fun AppSelectorScreen(
|
|||||||
title = stringResource(R.string.select_app),
|
title = stringResource(R.string.select_app),
|
||||||
onBackClick = onBackClick,
|
onBackClick = onBackClick,
|
||||||
actions = {
|
actions = {
|
||||||
IconButton(onClick = { }) {
|
IconButton(onClick = { }) {
|
||||||
Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help))
|
Icon(Icons.Outlined.HelpOutline, stringResource(R.string.help))
|
||||||
}
|
}
|
||||||
IconButton(onClick = { search = true }) {
|
IconButton(onClick = { search = true }) {
|
||||||
@ -119,7 +127,15 @@ fun AppSelectorScreen(
|
|||||||
modifier = Modifier.clickable {
|
modifier = Modifier.clickable {
|
||||||
pickApkLauncher.launch("*/*")
|
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)) }
|
headlineContent = { Text(stringResource(R.string.select_from_storage)) }
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -150,7 +166,10 @@ fun AppSelectorScreen(
|
|||||||
if (PM.appList.isEmpty()) {
|
if (PM.appList.isEmpty()) {
|
||||||
item {
|
item {
|
||||||
Box(Modifier.fillMaxWidth(), Alignment.Center) {
|
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(
|
||||||
/*Row(
|
modifier = Modifier.horizontalScroll(rememberScrollState()),
|
||||||
modifier = Modifier.horizontalScroll(rememberScrollState()),
|
horizontalArrangement = Arrangement.spacedBy(10.dp)
|
||||||
horizontalArrangement = Arrangement.spacedBy(10.dp)
|
) {
|
||||||
) {
|
FilterChip(
|
||||||
FilterChip(
|
selected = false,
|
||||||
selected = false,
|
onClick = {},
|
||||||
onClick = {},
|
label = { Text("Patched apps") },
|
||||||
label = { Text("Patched apps") },
|
leadingIcon = { Icon(Icons.Default.Check, null) },
|
||||||
leadingIcon = { Icon(Icons.Default.Check, null) },
|
enabled = false
|
||||||
enabled = false
|
)
|
||||||
)
|
FilterChip(
|
||||||
FilterChip(
|
selected = false,
|
||||||
selected = false,
|
onClick = {},
|
||||||
onClick = {},
|
label = { Text("User apps") },
|
||||||
label = { Text("User apps") },
|
leadingIcon = { Icon(Icons.Default.Android, null) }
|
||||||
leadingIcon = { Icon(Icons.Default.Android, null) }
|
)
|
||||||
)
|
FilterChip(
|
||||||
FilterChip(
|
selected = filterSystemApps,
|
||||||
selected = filterSystemApps,
|
onClick = { filterSystemApps = !filterSystemApps },
|
||||||
onClick = { filterSystemApps = !filterSystemApps },
|
label = { Text("System apps") },
|
||||||
label = { Text("System apps") },
|
leadingIcon = { Icon(Icons.Default.Apps, null) }
|
||||||
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.foundation.pager.rememberPagerState
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Add
|
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.Apps
|
||||||
import androidx.compose.material.icons.outlined.HelpOutline
|
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.Settings
|
||||||
import androidx.compose.material.icons.outlined.Source
|
import androidx.compose.material.icons.outlined.Source
|
||||||
import androidx.compose.material.icons.outlined.Topic
|
import androidx.compose.material3.*
|
||||||
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.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
import androidx.compose.ui.Modifier
|
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.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.padding
|
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.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
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.AppScaffold
|
||||||
import app.revanced.manager.compose.ui.component.AppTopBar
|
import app.revanced.manager.compose.ui.component.AppTopBar
|
||||||
import app.revanced.manager.compose.ui.viewmodel.InstallerScreenViewModel
|
import app.revanced.manager.compose.ui.viewmodel.InstallerScreenViewModel
|
||||||
import app.revanced.manager.compose.R
|
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class)
|
@OptIn(ExperimentalMaterial3Api::class)
|
||||||
@Composable
|
@Composable
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
package app.revanced.manager.compose.ui.screen
|
package app.revanced.manager.compose.ui.screen
|
||||||
|
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.*
|
||||||
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.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
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.filled.Build
|
||||||
import androidx.compose.material.icons.outlined.HelpOutline
|
import androidx.compose.material.icons.outlined.HelpOutline
|
||||||
import androidx.compose.material.icons.outlined.Search
|
import androidx.compose.material.icons.outlined.Search
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.*
|
||||||
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.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
import androidx.compose.runtime.rememberCoroutineScope
|
||||||
|
@ -9,16 +9,8 @@ import androidx.compose.foundation.layout.padding
|
|||||||
import androidx.compose.foundation.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.outlined.Download
|
import androidx.compose.material.icons.outlined.*
|
||||||
import androidx.compose.material.icons.outlined.ImportExport
|
import androidx.compose.material3.*
|
||||||
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.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
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.R
|
||||||
import app.revanced.manager.compose.ui.component.AppTopBar
|
import app.revanced.manager.compose.ui.component.AppTopBar
|
||||||
import app.revanced.manager.compose.ui.destination.SettingsDestination
|
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.*
|
||||||
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.viewmodel.SettingsViewModel
|
import app.revanced.manager.compose.ui.viewmodel.SettingsViewModel
|
||||||
import dev.olshevski.navigation.reimagined.AnimatedNavHost
|
import dev.olshevski.navigation.reimagined.*
|
||||||
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 org.koin.androidx.compose.getViewModel
|
import org.koin.androidx.compose.getViewModel
|
||||||
|
|
||||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalAnimationApi::class)
|
@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.Image
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.*
|
||||||
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.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.*
|
||||||
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.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
@ -49,7 +38,7 @@ fun AboutSettingsScreen(
|
|||||||
.padding(paddingValues)
|
.padding(paddingValues)
|
||||||
.verticalScroll(rememberScrollState())
|
.verticalScroll(rememberScrollState())
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth().padding(vertical = 15.dp),
|
modifier = Modifier.fillMaxWidth().padding(vertical = 15.dp),
|
||||||
horizontalAlignment = Alignment.CenterHorizontally,
|
horizontalAlignment = Alignment.CenterHorizontally,
|
||||||
@ -82,9 +71,9 @@ fun AboutSettingsScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = Modifier.clickable { },
|
modifier = Modifier.clickable { },
|
||||||
headlineContent = { Text(stringResource(R.string.contributors)) },
|
headlineContent = { Text(stringResource(R.string.contributors)) },
|
||||||
supportingContent = { Text(stringResource(R.string.contributors_description)) }
|
supportingContent = { Text(stringResource(R.string.contributors_description)) }
|
||||||
)
|
)
|
||||||
|
@ -2,21 +2,10 @@ package app.revanced.manager.compose.ui.screen.settings
|
|||||||
|
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.compose.foundation.clickable
|
import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.*
|
||||||
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.rememberScrollState
|
import androidx.compose.foundation.rememberScrollState
|
||||||
import androidx.compose.foundation.verticalScroll
|
import androidx.compose.foundation.verticalScroll
|
||||||
import androidx.compose.material3.AlertDialog
|
import androidx.compose.material3.*
|
||||||
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.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
@ -69,14 +58,22 @@ fun GeneralSettingsScreen(
|
|||||||
modifier = Modifier.clickable { showThemePicker = true },
|
modifier = Modifier.clickable { showThemePicker = true },
|
||||||
headlineContent = { Text(stringResource(R.string.theme)) },
|
headlineContent = { Text(stringResource(R.string.theme)) },
|
||||||
supportingContent = { Text(stringResource(R.string.theme_description)) },
|
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) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = Modifier.clickable { prefs.dynamicColor = !prefs.dynamicColor },
|
modifier = Modifier.clickable { prefs.dynamicColor = !prefs.dynamicColor },
|
||||||
headlineContent = { Text(stringResource(R.string.dynamic_color)) },
|
headlineContent = { Text(stringResource(R.string.dynamic_color)) },
|
||||||
supportingContent = { Text(stringResource(R.string.dynamic_color_description)) },
|
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))
|
GroupHeader(stringResource(R.string.signing))
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = Modifier.clickable { },
|
modifier = Modifier.clickable { },
|
||||||
headlineContent = { Text(stringResource(R.string.import_keystore)) },
|
headlineContent = { Text(stringResource(R.string.import_keystore)) },
|
||||||
supportingContent = { Text(stringResource(R.string.import_keystore_descripion)) }
|
supportingContent = { Text(stringResource(R.string.import_keystore_descripion)) }
|
||||||
)
|
)
|
||||||
ListItem(
|
ListItem(
|
||||||
modifier = Modifier.clickable { },
|
modifier = Modifier.clickable { },
|
||||||
headlineContent = { Text(stringResource(R.string.export_keystore)) },
|
headlineContent = { Text(stringResource(R.string.export_keystore)) },
|
||||||
supportingContent = { Text(stringResource(R.string.export_keystore_description)) }
|
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.graphics.toArgb
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalView
|
import androidx.compose.ui.platform.LocalView
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.core.view.WindowCompat
|
import androidx.core.view.WindowCompat
|
||||||
import app.revanced.manager.compose.R
|
import app.revanced.manager.compose.R
|
||||||
|
|
||||||
@ -36,6 +35,7 @@ fun ReVancedManagerTheme(
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
darkTheme -> DarkColorScheme
|
darkTheme -> DarkColorScheme
|
||||||
else -> LightColorScheme
|
else -> LightColorScheme
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,8 @@ import androidx.compose.runtime.setValue
|
|||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.work.*
|
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.PatcherProgressManager
|
||||||
|
import app.revanced.manager.compose.patcher.worker.PatcherWorker
|
||||||
import app.revanced.manager.compose.patcher.worker.StepGroup
|
import app.revanced.manager.compose.patcher.worker.StepGroup
|
||||||
import app.revanced.manager.compose.service.InstallService
|
import app.revanced.manager.compose.service.InstallService
|
||||||
import app.revanced.manager.compose.service.UninstallService
|
import app.revanced.manager.compose.service.UninstallService
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
package app.revanced.manager.compose.ui.viewmodel
|
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 androidx.lifecycle.ViewModel
|
||||||
import app.revanced.manager.compose.patcher.data.repository.PatchesRepository
|
import app.revanced.manager.compose.patcher.data.repository.PatchesRepository
|
||||||
import app.revanced.manager.compose.patcher.patch.PatchInfo
|
import app.revanced.manager.compose.patcher.patch.PatchInfo
|
||||||
|
@ -6,7 +6,7 @@ import app.revanced.manager.compose.ui.theme.Theme
|
|||||||
|
|
||||||
class SettingsViewModel(
|
class SettingsViewModel(
|
||||||
val prefs: PreferencesManager
|
val prefs: PreferencesManager
|
||||||
): ViewModel() {
|
) : ViewModel() {
|
||||||
|
|
||||||
fun setTheme(theme: Theme) {
|
fun setTheme(theme: Theme) {
|
||||||
prefs.theme = theme
|
prefs.theme = theme
|
||||||
|
@ -6,7 +6,6 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.pm.PackageInstaller
|
import android.content.pm.PackageInstaller
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.pm.PackageManager.PackageInfoFlags
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
@ -68,7 +67,8 @@ object PM {
|
|||||||
packageInstaller.uninstall(pkg, context.uninstallIntentSender)
|
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) {
|
private fun PackageInstaller.Session.writeApk(apk: File) {
|
||||||
|
Loading…
Reference in New Issue
Block a user