mirror of
https://github.com/YTVanced/VancedManager
synced 2024-12-03 16:27:25 +00:00
cleanup
This commit is contained in:
parent
c7e54ba6fa
commit
c83ee3df8f
28 changed files with 187 additions and 170 deletions
|
@ -1,7 +1,6 @@
|
||||||
package com.vanced.manager.core.downloader.impl
|
package com.vanced.manager.core.downloader.impl
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.util.Log
|
|
||||||
import com.vanced.manager.core.downloader.api.MicrogAPI
|
import com.vanced.manager.core.downloader.api.MicrogAPI
|
||||||
import com.vanced.manager.core.downloader.base.AppDownloader
|
import com.vanced.manager.core.downloader.base.AppDownloader
|
||||||
import com.vanced.manager.core.downloader.util.DownloadStatus
|
import com.vanced.manager.core.downloader.util.DownloadStatus
|
||||||
|
@ -33,10 +32,12 @@ class MicrogDownloader(
|
||||||
onStatus(DownloadStatus.StartInstall)
|
onStatus(DownloadStatus.StartInstall)
|
||||||
},
|
},
|
||||||
onError = { error, fileName ->
|
onError = { error, fileName ->
|
||||||
onStatus(DownloadStatus.Error(
|
onStatus(
|
||||||
|
DownloadStatus.Error(
|
||||||
displayError = "Failed to download $fileName",
|
displayError = "Failed to download $fileName",
|
||||||
stacktrace = error
|
stacktrace = error
|
||||||
))
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,15 @@ class MusicDownloader(
|
||||||
absoluteVersion = getLatestOrProvidedAppVersion(musicVersionPref, appVersions)
|
absoluteVersion = getLatestOrProvidedAppVersion(musicVersionPref, appVersions)
|
||||||
|
|
||||||
downloadFiles(
|
downloadFiles(
|
||||||
downloadFiles = arrayOf(DownloadFile(
|
downloadFiles = arrayOf(
|
||||||
|
DownloadFile(
|
||||||
call = musicAPI.getFiles(
|
call = musicAPI.getFiles(
|
||||||
version = absoluteVersion,
|
version = absoluteVersion,
|
||||||
variant = managerVariantPref,
|
variant = managerVariantPref,
|
||||||
),
|
),
|
||||||
fileName = "music.apk"
|
fileName = "music.apk"
|
||||||
)),
|
)
|
||||||
|
),
|
||||||
onProgress = { progress ->
|
onProgress = { progress ->
|
||||||
onStatus(DownloadStatus.Progress(progress))
|
onStatus(DownloadStatus.Progress(progress))
|
||||||
},
|
},
|
||||||
|
@ -40,10 +42,12 @@ class MusicDownloader(
|
||||||
onStatus(DownloadStatus.StartInstall)
|
onStatus(DownloadStatus.StartInstall)
|
||||||
},
|
},
|
||||||
onError = { error, fileName ->
|
onError = { error, fileName ->
|
||||||
onStatus(DownloadStatus.Error(
|
onStatus(
|
||||||
|
DownloadStatus.Error(
|
||||||
displayError = "Failed to download $fileName",
|
displayError = "Failed to download $fileName",
|
||||||
stacktrace = error
|
stacktrace = error
|
||||||
))
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,10 +53,12 @@ class VancedDownloader(
|
||||||
onStatus(DownloadStatus.StartInstall)
|
onStatus(DownloadStatus.StartInstall)
|
||||||
},
|
},
|
||||||
onError = { error, fileName ->
|
onError = { error, fileName ->
|
||||||
onStatus(DownloadStatus.Error(
|
onStatus(
|
||||||
|
DownloadStatus.Error(
|
||||||
displayError = "Failed to download $fileName",
|
displayError = "Failed to download $fileName",
|
||||||
stacktrace = error
|
stacktrace = error
|
||||||
))
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,10 @@ class AppInstallService : Service() {
|
||||||
sendBroadcast(Intent().apply {
|
sendBroadcast(Intent().apply {
|
||||||
action = APP_INSTALL_STATUS
|
action = APP_INSTALL_STATUS
|
||||||
putExtra(EXTRA_INSTALL_STATUS, status)
|
putExtra(EXTRA_INSTALL_STATUS, status)
|
||||||
putExtra(EXTRA_INSTALL_EXTRA, intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE))
|
putExtra(
|
||||||
|
EXTRA_INSTALL_EXTRA,
|
||||||
|
intent.getStringExtra(PackageInstaller.EXTRA_STATUS_MESSAGE)
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,20 @@ import com.vanced.manager.core.preferences.managerStringSetPreference
|
||||||
import com.vanced.manager.ui.theme.defAccentColor
|
import com.vanced.manager.ui.theme.defAccentColor
|
||||||
|
|
||||||
var useCustomTabsPref by managerBooleanPreference(USE_CUSTOM_TABS_KEY)
|
var useCustomTabsPref by managerBooleanPreference(USE_CUSTOM_TABS_KEY)
|
||||||
var managerVariantPref by managerStringPreference(MANAGER_VARIANT_KEY, MANAGER_VARIANT_DEFAULT_VALUE)
|
var managerVariantPref by managerStringPreference(
|
||||||
|
MANAGER_VARIANT_KEY,
|
||||||
|
MANAGER_VARIANT_DEFAULT_VALUE
|
||||||
|
)
|
||||||
|
|
||||||
var managerThemePref by managerStringPreference(MANAGER_THEME_KEY, MANAGER_THEME_DEFAULT_VALUE)
|
var managerThemePref by managerStringPreference(MANAGER_THEME_KEY, MANAGER_THEME_DEFAULT_VALUE)
|
||||||
var managerAccentColorPref by managerLongPreference(MANAGER_ACCENT_COLOR_KEY, defAccentColor)
|
var managerAccentColorPref by managerLongPreference(MANAGER_ACCENT_COLOR_KEY, defAccentColor)
|
||||||
|
|
||||||
var vancedThemePref by managerStringPreference(APP_VANCED_THEME_KEY, VANCED_THEME_DEFAULT_VALUE)
|
var vancedThemePref by managerStringPreference(APP_VANCED_THEME_KEY, VANCED_THEME_DEFAULT_VALUE)
|
||||||
var vancedVersionPref by managerStringPreference(APP_VANCED_VERSION_KEY, APP_VERSION_DEFAULT_VALUE)
|
var vancedVersionPref by managerStringPreference(APP_VANCED_VERSION_KEY, APP_VERSION_DEFAULT_VALUE)
|
||||||
var vancedLanguagesPref by managerStringSetPreference(APP_VANCED_LANGUAGE_KEY, VANCED_LANGUAGE_DEFAULT_VALUE)
|
var vancedLanguagesPref by managerStringSetPreference(
|
||||||
|
APP_VANCED_LANGUAGE_KEY,
|
||||||
|
VANCED_LANGUAGE_DEFAULT_VALUE
|
||||||
|
)
|
||||||
|
|
||||||
var musicVersionPref by managerStringPreference(APP_MUSIC_VERSION_KEY, APP_VERSION_DEFAULT_VALUE)
|
var musicVersionPref by managerStringPreference(APP_MUSIC_VERSION_KEY, APP_VERSION_DEFAULT_VALUE)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import android.content.IntentFilter
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.activity.ComponentActivity
|
import androidx.activity.ComponentActivity
|
||||||
import androidx.activity.compose.setContent
|
import androidx.activity.compose.setContent
|
||||||
import androidx.compose.animation.*
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
|
@ -23,11 +23,13 @@ import com.vanced.manager.ui.theme.ManagerTheme
|
||||||
import com.vanced.manager.ui.theme.isDark
|
import com.vanced.manager.ui.theme.isDark
|
||||||
import com.vanced.manager.ui.util.Screen
|
import com.vanced.manager.ui.util.Screen
|
||||||
import com.vanced.manager.ui.viewmodel.InstallViewModel
|
import com.vanced.manager.ui.viewmodel.InstallViewModel
|
||||||
|
import com.vanced.manager.ui.viewmodel.MainViewModel
|
||||||
import org.koin.androidx.viewmodel.ext.android.viewModel
|
import org.koin.androidx.viewmodel.ext.android.viewModel
|
||||||
|
|
||||||
class MainActivity : ComponentActivity() {
|
class MainActivity : ComponentActivity() {
|
||||||
|
|
||||||
private val installViewModel: InstallViewModel by viewModel()
|
private val installViewModel: InstallViewModel by viewModel()
|
||||||
|
private val mainViewModel: MainViewModel by viewModel()
|
||||||
|
|
||||||
private val backPressHandler = BackPressHandler()
|
private val backPressHandler = BackPressHandler()
|
||||||
|
|
||||||
|
@ -46,7 +48,7 @@ class MainActivity : ComponentActivity() {
|
||||||
@OptIn(
|
@OptIn(
|
||||||
ExperimentalAnimationApi::class,
|
ExperimentalAnimationApi::class,
|
||||||
ExperimentalMaterial3Api::class,
|
ExperimentalMaterial3Api::class,
|
||||||
ExperimentalFoundationApi::class
|
ExperimentalFoundationApi::class,
|
||||||
)
|
)
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
@ -72,6 +74,7 @@ class MainActivity : ComponentActivity() {
|
||||||
when (val screen = backStack.last()) {
|
when (val screen = backStack.last()) {
|
||||||
is Screen.Home -> {
|
is Screen.Home -> {
|
||||||
HomeLayout(
|
HomeLayout(
|
||||||
|
viewModel = mainViewModel,
|
||||||
onToolbarScreenSelected = {
|
onToolbarScreenSelected = {
|
||||||
backStack.push(it)
|
backStack.push(it)
|
||||||
},
|
},
|
||||||
|
@ -124,7 +127,11 @@ class MainActivity : ComponentActivity() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
is Screen.Install -> {
|
is Screen.Install -> {
|
||||||
InstallScreen(screen.appName, screen.appVersions)
|
InstallScreen(
|
||||||
|
appName = screen.appName,
|
||||||
|
appVersions = screen.appVersions,
|
||||||
|
viewModel = installViewModel
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
package com.vanced.manager.ui.component.layout
|
package com.vanced.manager.ui.component.layout
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.Dp
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import com.vanced.manager.ui.util.DefaultContentPaddingVertical
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ManagerLazyColumn(
|
fun ManagerLazyColumn(
|
||||||
|
|
|
@ -3,13 +3,9 @@ package com.vanced.manager.ui.component.layout
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
import com.google.accompanist.swiperefresh.SwipeRefresh
|
import com.google.accompanist.swiperefresh.SwipeRefresh
|
||||||
import com.google.accompanist.swiperefresh.SwipeRefreshIndicator
|
import com.google.accompanist.swiperefresh.SwipeRefreshIndicator
|
||||||
import com.google.accompanist.swiperefresh.SwipeRefreshState
|
import com.google.accompanist.swiperefresh.SwipeRefreshState
|
||||||
import com.vanced.manager.ui.component.card.ManagerCard
|
|
||||||
import com.vanced.manager.ui.component.color.managerAccentColor
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ManagerSwipeRefresh(
|
fun ManagerSwipeRefresh(
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.vanced.manager.ui.component.layout
|
package com.vanced.manager.ui.component.layout
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.lazy.LazyRow
|
import androidx.compose.foundation.lazy.LazyRow
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||||
|
|
|
@ -1,9 +1,17 @@
|
||||||
package com.vanced.manager.ui.component.menu
|
package com.vanced.manager.ui.component.menu
|
||||||
|
|
||||||
import androidx.compose.animation.*
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
import androidx.compose.animation.core.*
|
import androidx.compose.animation.core.MutableTransitionState
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.animation.core.animateFloat
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.animation.core.tween
|
||||||
|
import androidx.compose.animation.core.updateTransition
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
|
import androidx.compose.foundation.layout.IntrinsicSize
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.getValue
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.alpha
|
import androidx.compose.ui.draw.alpha
|
||||||
|
|
|
@ -1,26 +1,17 @@
|
||||||
package com.vanced.manager.ui.component.preference
|
package com.vanced.manager.ui.component.preference
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
|
||||||
import androidx.compose.foundation.layout.heightIn
|
import androidx.compose.foundation.layout.heightIn
|
||||||
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.TextButton
|
import androidx.compose.material.TextButton
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
|
||||||
import androidx.compose.runtime.toMutableStateList
|
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vanced.manager.R
|
import com.vanced.manager.R
|
||||||
import com.vanced.manager.core.preferences.CheckboxPreference
|
|
||||||
import com.vanced.manager.core.preferences.ManagerPreference
|
|
||||||
import com.vanced.manager.core.preferences.RadioButtonPreference
|
import com.vanced.manager.core.preferences.RadioButtonPreference
|
||||||
import com.vanced.manager.ui.component.button.ManagerThemedTextButton
|
|
||||||
import com.vanced.manager.ui.component.text.ManagerText
|
import com.vanced.manager.ui.component.text.ManagerText
|
||||||
import com.vanced.manager.ui.resources.managerString
|
import com.vanced.manager.ui.resources.managerString
|
||||||
import com.vanced.manager.ui.widget.list.CheckboxItem
|
import com.vanced.manager.ui.widget.list.CheckboxItem
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CheckboxDialogPreference(
|
fun CheckboxDialogPreference(
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package com.vanced.manager.ui.component.preference
|
package com.vanced.manager.ui.component.preference
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.rememberCoroutineScope
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vanced.manager.core.preferences.ManagerPreference
|
|
||||||
import com.vanced.manager.ui.widget.checkbox.ManagerAnimatedCheckbox
|
import com.vanced.manager.ui.widget.checkbox.ManagerAnimatedCheckbox
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CheckboxPreference(
|
fun CheckboxPreference(
|
||||||
|
|
|
@ -11,11 +11,9 @@ import androidx.compose.ui.unit.dp
|
||||||
import com.vanced.manager.ui.component.card.ManagerTonalCard
|
import com.vanced.manager.ui.component.card.ManagerTonalCard
|
||||||
import com.vanced.manager.ui.component.color.managerAnimatedColor
|
import com.vanced.manager.ui.component.color.managerAnimatedColor
|
||||||
import com.vanced.manager.ui.component.list.ManagerListItem
|
import com.vanced.manager.ui.component.list.ManagerListItem
|
||||||
import com.vanced.manager.ui.component.modifier.managerClickable
|
|
||||||
import com.vanced.manager.ui.component.text.ManagerText
|
import com.vanced.manager.ui.component.text.ManagerText
|
||||||
import com.vanced.manager.ui.theme.LargeShape
|
import com.vanced.manager.ui.theme.LargeShape
|
||||||
import com.vanced.manager.ui.util.DefaultContentPaddingHorizontal
|
import com.vanced.manager.ui.util.DefaultContentPaddingHorizontal
|
||||||
import com.vanced.manager.ui.util.DefaultContentPaddingVertical
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun Preference(
|
fun Preference(
|
||||||
|
|
|
@ -4,7 +4,7 @@ import androidx.compose.foundation.layout.heightIn
|
||||||
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.material3.TextButton
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vanced.manager.R
|
import com.vanced.manager.R
|
||||||
|
|
|
@ -132,7 +132,9 @@ fun AboutLayout(
|
||||||
}
|
}
|
||||||
) { paddingValues ->
|
) { paddingValues ->
|
||||||
ManagerLazyColumn(
|
ManagerLazyColumn(
|
||||||
modifier = Modifier.fillMaxSize().padding(paddingValues),
|
modifier = Modifier
|
||||||
|
.fillMaxSize()
|
||||||
|
.padding(paddingValues),
|
||||||
) {
|
) {
|
||||||
item {
|
item {
|
||||||
ManagerTonalCard(
|
ManagerTonalCard(
|
||||||
|
|
|
@ -4,7 +4,10 @@ import androidx.compose.animation.*
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.*
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.MoreVert
|
import androidx.compose.material.icons.rounded.MoreVert
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.IconButton
|
||||||
|
import androidx.compose.material3.TextButton
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
@ -33,12 +36,12 @@ import com.vanced.manager.ui.viewmodel.MainViewModel
|
||||||
import com.vanced.manager.ui.widget.app.AppCard
|
import com.vanced.manager.ui.widget.app.AppCard
|
||||||
import com.vanced.manager.ui.widget.app.AppCardPlaceholder
|
import com.vanced.manager.ui.widget.app.AppCardPlaceholder
|
||||||
import com.vanced.manager.ui.widget.layout.managerCategory
|
import com.vanced.manager.ui.widget.layout.managerCategory
|
||||||
import org.koin.androidx.compose.getViewModel
|
|
||||||
|
|
||||||
@ExperimentalMaterial3Api
|
@ExperimentalMaterial3Api
|
||||||
@ExperimentalAnimationApi
|
@ExperimentalAnimationApi
|
||||||
@Composable
|
@Composable
|
||||||
fun HomeLayout(
|
fun HomeLayout(
|
||||||
|
viewModel: MainViewModel,
|
||||||
onToolbarScreenSelected: (Screen) -> Unit,
|
onToolbarScreenSelected: (Screen) -> Unit,
|
||||||
onAppInstallPress: (
|
onAppInstallPress: (
|
||||||
appName: String,
|
appName: String,
|
||||||
|
@ -46,11 +49,10 @@ fun HomeLayout(
|
||||||
installationOptions: List<InstallationOption>?
|
installationOptions: List<InstallationOption>?
|
||||||
) -> Unit
|
) -> Unit
|
||||||
) {
|
) {
|
||||||
val viewModel: MainViewModel = getViewModel()
|
|
||||||
|
|
||||||
val appState by viewModel.appState.collectAsState()
|
val appState by viewModel.appState.collectAsState()
|
||||||
|
|
||||||
val refreshState = rememberSwipeRefreshState(isRefreshing = appState is MainViewModel.AppState.Fetching)
|
val refreshState =
|
||||||
|
rememberSwipeRefreshState(isRefreshing = appState is MainViewModel.AppState.Fetching)
|
||||||
var isMenuExpanded by remember { mutableStateOf(false) }
|
var isMenuExpanded by remember { mutableStateOf(false) }
|
||||||
val dropdownScreens = remember { listOf(Screen.Settings, Screen.About) }
|
val dropdownScreens = remember { listOf(Screen.Settings, Screen.About) }
|
||||||
|
|
||||||
|
@ -116,7 +118,11 @@ fun HomeLayout(
|
||||||
diskCachePolicy(CachePolicy.ENABLED)
|
diskCachePolicy(CachePolicy.ENABLED)
|
||||||
}
|
}
|
||||||
|
|
||||||
var showAppInfoDialog by rememberSaveable { mutableStateOf(false) }
|
var showAppInfoDialog by rememberSaveable {
|
||||||
|
mutableStateOf(
|
||||||
|
false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
AppCard(
|
AppCard(
|
||||||
appName = app.name,
|
appName = app.name,
|
||||||
|
@ -124,7 +130,11 @@ fun HomeLayout(
|
||||||
appInstalledVersion = app.installedVersion,
|
appInstalledVersion = app.installedVersion,
|
||||||
appRemoteVersion = app.remoteVersion,
|
appRemoteVersion = app.remoteVersion,
|
||||||
onAppDownloadClick = {
|
onAppDownloadClick = {
|
||||||
onAppInstallPress(app.name, app.versions, app.installationOptions)
|
onAppInstallPress(
|
||||||
|
app.name,
|
||||||
|
app.versions,
|
||||||
|
app.installationOptions
|
||||||
|
)
|
||||||
},
|
},
|
||||||
onAppUninstallClick = { /*TODO*/ },
|
onAppUninstallClick = { /*TODO*/ },
|
||||||
onAppLaunchClick = { /*TODO*/ },
|
onAppLaunchClick = { /*TODO*/ },
|
||||||
|
@ -135,7 +145,10 @@ fun HomeLayout(
|
||||||
|
|
||||||
if (showAppInfoDialog) {
|
if (showAppInfoDialog) {
|
||||||
ManagerDialog(
|
ManagerDialog(
|
||||||
title = managerString(R.string.app_info_title, app.name),
|
title = managerString(
|
||||||
|
R.string.app_info_title,
|
||||||
|
app.name
|
||||||
|
),
|
||||||
onDismissRequest = { showAppInfoDialog = false },
|
onDismissRequest = { showAppInfoDialog = false },
|
||||||
confirmButton = {
|
confirmButton = {
|
||||||
TextButton(onClick = {
|
TextButton(onClick = {
|
||||||
|
|
|
@ -8,7 +8,10 @@ import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.ArrowDropDown
|
import androidx.compose.material.icons.rounded.ArrowDropDown
|
||||||
import androidx.compose.material.icons.rounded.Done
|
import androidx.compose.material.icons.rounded.Done
|
||||||
import androidx.compose.material3.*
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||||
|
import androidx.compose.material3.ExtendedFloatingActionButton
|
||||||
|
import androidx.compose.material3.Icon
|
||||||
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.runtime.saveable.rememberSaveable
|
import androidx.compose.runtime.saveable.rememberSaveable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
@ -30,7 +33,6 @@ import com.vanced.manager.ui.component.topappbar.ManagerTopAppBar
|
||||||
import com.vanced.manager.ui.resources.managerString
|
import com.vanced.manager.ui.resources.managerString
|
||||||
import com.vanced.manager.ui.util.DefaultContentPaddingHorizontal
|
import com.vanced.manager.ui.util.DefaultContentPaddingHorizontal
|
||||||
import com.vanced.manager.ui.viewmodel.InstallViewModel
|
import com.vanced.manager.ui.viewmodel.InstallViewModel
|
||||||
import org.koin.androidx.compose.getViewModel
|
|
||||||
|
|
||||||
@OptIn(
|
@OptIn(
|
||||||
ExperimentalFoundationApi::class,
|
ExperimentalFoundationApi::class,
|
||||||
|
@ -39,10 +41,9 @@ import org.koin.androidx.compose.getViewModel
|
||||||
@Composable
|
@Composable
|
||||||
fun InstallScreen(
|
fun InstallScreen(
|
||||||
appName: String,
|
appName: String,
|
||||||
appVersions: List<String>?
|
appVersions: List<String>?,
|
||||||
|
viewModel: InstallViewModel,
|
||||||
) {
|
) {
|
||||||
val viewModel: InstallViewModel = getViewModel()
|
|
||||||
|
|
||||||
var startedProcess by rememberSaveable { mutableStateOf(false) }
|
var startedProcess by rememberSaveable { mutableStateOf(false) }
|
||||||
|
|
||||||
val logs = viewModel.logs
|
val logs = viewModel.logs
|
||||||
|
|
|
@ -22,10 +22,12 @@ sealed class Screen(
|
||||||
route = "about",
|
route = "about",
|
||||||
displayName = R.string.toolbar_about,
|
displayName = R.string.toolbar_about,
|
||||||
)
|
)
|
||||||
|
|
||||||
object Logs : Screen(
|
object Logs : Screen(
|
||||||
route = "logs",
|
route = "logs",
|
||||||
displayName = R.string.toolbar_logs,
|
displayName = R.string.toolbar_logs,
|
||||||
)
|
)
|
||||||
|
|
||||||
data class InstallPreferences(
|
data class InstallPreferences(
|
||||||
val appName: String,
|
val appName: String,
|
||||||
val appVersions: List<String>?,
|
val appVersions: List<String>?,
|
||||||
|
|
|
@ -83,11 +83,14 @@ class InstallViewModel(
|
||||||
downloader.download(appVersions) { downloadStatus ->
|
downloader.download(appVersions) { downloadStatus ->
|
||||||
when (downloadStatus) {
|
when (downloadStatus) {
|
||||||
is DownloadStatus.File -> log(Log.Info("Downloading ${downloadStatus.fileName}"))
|
is DownloadStatus.File -> log(Log.Info("Downloading ${downloadStatus.fileName}"))
|
||||||
is DownloadStatus.Error -> log(Log.Error(
|
is DownloadStatus.Error -> log(
|
||||||
|
Log.Error(
|
||||||
displayText = downloadStatus.displayError,
|
displayText = downloadStatus.displayError,
|
||||||
stacktrace = downloadStatus.stacktrace
|
stacktrace = downloadStatus.stacktrace
|
||||||
))
|
)
|
||||||
is DownloadStatus.Progress -> status = Status.Progress(downloadStatus.progress / 100)
|
)
|
||||||
|
is DownloadStatus.Progress -> status =
|
||||||
|
Status.Progress(downloadStatus.progress / 100)
|
||||||
is DownloadStatus.StartInstall -> {
|
is DownloadStatus.StartInstall -> {
|
||||||
log(Log.Success("Successfully downloaded $appName"))
|
log(Log.Success("Successfully downloaded $appName"))
|
||||||
installApp(appName, appVersions)
|
installApp(appName, appVersions)
|
||||||
|
|
|
@ -8,7 +8,6 @@ import com.vanced.manager.core.preferences.holder.musicEnabled
|
||||||
import com.vanced.manager.core.preferences.holder.vancedEnabled
|
import com.vanced.manager.core.preferences.holder.vancedEnabled
|
||||||
import com.vanced.manager.domain.model.App
|
import com.vanced.manager.domain.model.App
|
||||||
import com.vanced.manager.repository.JsonRepository
|
import com.vanced.manager.repository.JsonRepository
|
||||||
import kotlinx.coroutines.Dispatchers
|
|
||||||
import kotlinx.coroutines.flow.MutableStateFlow
|
import kotlinx.coroutines.flow.MutableStateFlow
|
||||||
import kotlinx.coroutines.flow.StateFlow
|
import kotlinx.coroutines.flow.StateFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
|
|
@ -5,7 +5,6 @@ import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Info
|
|
||||||
import androidx.compose.material.icons.outlined.Info
|
import androidx.compose.material.icons.outlined.Info
|
||||||
import androidx.compose.material.icons.rounded.DeleteForever
|
import androidx.compose.material.icons.rounded.DeleteForever
|
||||||
import androidx.compose.material.icons.rounded.Download
|
import androidx.compose.material.icons.rounded.Download
|
||||||
|
@ -19,7 +18,6 @@ import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import coil.compose.ImagePainter
|
import coil.compose.ImagePainter
|
||||||
import com.vanced.manager.R
|
import com.vanced.manager.R
|
||||||
import com.vanced.manager.ui.component.button.ManagerIconButton
|
|
||||||
import com.vanced.manager.ui.component.text.AppVersionText
|
import com.vanced.manager.ui.component.text.AppVersionText
|
||||||
import com.vanced.manager.ui.component.text.ManagerText
|
import com.vanced.manager.ui.component.text.ManagerText
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.shape.CircleShape
|
import androidx.compose.foundation.shape.CircleShape
|
||||||
import androidx.compose.material3.IconButton
|
|
||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package com.vanced.manager.ui.widget.layout
|
package com.vanced.manager.ui.widget.layout
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.*
|
import androidx.compose.foundation.layout.Arrangement
|
||||||
|
import androidx.compose.foundation.layout.Column
|
||||||
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.lazy.LazyItemScope
|
import androidx.compose.foundation.lazy.LazyItemScope
|
||||||
import androidx.compose.foundation.lazy.LazyListScope
|
import androidx.compose.foundation.lazy.LazyListScope
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
|
|
|
@ -2,7 +2,6 @@ package com.vanced.manager.ui.widget.layout
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.unit.dp
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsCategoryLayout(
|
fun SettingsCategoryLayout(
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
package com.vanced.manager.ui.widget.screens.settings
|
package com.vanced.manager.ui.widget.screens.settings
|
||||||
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import com.vanced.manager.R
|
|
||||||
import com.vanced.manager.core.preferences.holder.managerAccentColorPref
|
|
||||||
import com.vanced.manager.ui.component.color.ManagerColorPicker
|
|
||||||
import com.vanced.manager.ui.component.preference.DialogPreference
|
|
||||||
import com.vanced.manager.ui.resources.managerString
|
|
||||||
import com.vanced.manager.ui.theme.defAccentColor
|
|
||||||
import com.vanced.manager.ui.widget.button.ManagerResetButton
|
|
||||||
import com.vanced.manager.ui.widget.button.ManagerSaveButton
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun SettingsAccentColorItem() {
|
fun SettingsAccentColorItem() {
|
||||||
|
|
Loading…
Reference in a new issue