mirror of
https://github.com/YTVanced/VancedManager
synced 2024-12-01 15:27:26 +00:00
more refactor
This commit is contained in:
parent
822778f7e9
commit
bc69bd4a9d
28 changed files with 152 additions and 174 deletions
|
@ -12,7 +12,8 @@ import com.vanced.manager.downloader.impl.VancedDownloader
|
||||||
import com.vanced.manager.network.util.MICROG_NAME
|
import com.vanced.manager.network.util.MICROG_NAME
|
||||||
import com.vanced.manager.network.util.MUSIC_NAME
|
import com.vanced.manager.network.util.MUSIC_NAME
|
||||||
import com.vanced.manager.network.util.VANCED_NAME
|
import com.vanced.manager.network.util.VANCED_NAME
|
||||||
import com.vanced.manager.ui.preferences.*
|
import com.vanced.manager.ui.preferences.CheckboxPreference
|
||||||
|
import com.vanced.manager.ui.preferences.RadioButtonPreference
|
||||||
import com.vanced.manager.ui.preferences.holder.musicVersionPref
|
import com.vanced.manager.ui.preferences.holder.musicVersionPref
|
||||||
import com.vanced.manager.ui.preferences.holder.vancedLanguagesPref
|
import com.vanced.manager.ui.preferences.holder.vancedLanguagesPref
|
||||||
import com.vanced.manager.ui.preferences.holder.vancedThemePref
|
import com.vanced.manager.ui.preferences.holder.vancedThemePref
|
||||||
|
|
|
@ -23,11 +23,11 @@ import com.vanced.manager.ui.components.color.managerAnimatedColor
|
||||||
import com.vanced.manager.ui.components.color.managerSurfaceColor
|
import com.vanced.manager.ui.components.color.managerSurfaceColor
|
||||||
import com.vanced.manager.ui.components.color.managerTextColor
|
import com.vanced.manager.ui.components.color.managerTextColor
|
||||||
import com.vanced.manager.ui.components.menu.ManagerDropdownMenuItem
|
import com.vanced.manager.ui.components.menu.ManagerDropdownMenuItem
|
||||||
|
import com.vanced.manager.ui.components.text.ToolbarTitleText
|
||||||
import com.vanced.manager.ui.resources.managerString
|
import com.vanced.manager.ui.resources.managerString
|
||||||
import com.vanced.manager.ui.screens.Screen
|
import com.vanced.manager.ui.screens.Screen
|
||||||
import com.vanced.manager.ui.theme.ManagerTheme
|
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.components.text.ToolbarTitleText
|
|
||||||
|
|
||||||
class MainActivity : AppCompatActivity() {
|
class MainActivity : AppCompatActivity() {
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.luminance
|
import androidx.compose.ui.graphics.luminance
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vanced.manager.ui.components.color.managerAccentColor
|
import com.vanced.manager.ui.components.color.managerAccentColor
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ManagerThemedButton(
|
fun ManagerThemedButton(
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
package com.vanced.manager.ui.components.button
|
package com.vanced.manager.ui.components.button
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.compose.material.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.graphics.Color
|
||||||
import com.vanced.manager.ui.components.color.managerAccentColor
|
import com.vanced.manager.ui.components.color.managerAccentColor
|
||||||
import com.vanced.manager.ui.components.text.ManagerText
|
import com.vanced.manager.ui.components.text.ManagerText
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ManagerThemedTextButton(
|
fun ManagerThemedTextButton(
|
||||||
|
|
|
@ -10,14 +10,12 @@ 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
|
||||||
import androidx.compose.ui.geometry.Offset
|
import androidx.compose.ui.geometry.Offset
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.vanced.manager.ui.components.color.ThemedItemContentColorProvider
|
import com.vanced.manager.ui.components.color.ThemedItemContentColorProvider
|
||||||
import com.vanced.manager.ui.components.color.managerAccentColor
|
import com.vanced.manager.ui.components.color.managerAccentColor
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
private val cardModifier = Modifier.sizeIn(
|
private val cardModifier = Modifier.sizeIn(
|
||||||
minHeight = 95.dp,
|
minHeight = 95.dp,
|
||||||
|
|
|
@ -7,21 +7,18 @@ import androidx.compose.animation.core.updateTransition
|
||||||
import androidx.compose.foundation.layout.requiredSize
|
import androidx.compose.foundation.layout.requiredSize
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.material.Icon
|
import androidx.compose.material.Icon
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.rounded.Close
|
import androidx.compose.material.icons.rounded.Close
|
||||||
import androidx.compose.material.icons.rounded.Done
|
import androidx.compose.material.icons.rounded.Done
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.vanced.manager.ui.components.card.ManagerCard
|
import com.vanced.manager.ui.components.card.ManagerCard
|
||||||
import com.vanced.manager.ui.components.color.contentColorForColor
|
import com.vanced.manager.ui.components.color.contentColorForColor
|
||||||
import com.vanced.manager.ui.components.color.managerAccentColor
|
import com.vanced.manager.ui.components.color.managerAccentColor
|
||||||
import com.vanced.manager.ui.components.color.managerAnimatedColor
|
import com.vanced.manager.ui.components.color.managerAnimatedColor
|
||||||
import com.vanced.manager.ui.components.color.managerThemedCardColor
|
import com.vanced.manager.ui.components.color.managerThemedCardColor
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
@SuppressLint("UnusedTransitionTargetStateParameter")
|
@SuppressLint("UnusedTransitionTargetStateParameter")
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package com.vanced.manager.ui.components.color
|
package com.vanced.manager.ui.components.color
|
||||||
|
|
||||||
import androidx.compose.material.LocalContentColor
|
import androidx.compose.material.LocalContentColor
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.CompositionLocalProvider
|
import androidx.compose.runtime.CompositionLocalProvider
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ThemedItemContentColorProvider(
|
fun ThemedItemContentColorProvider(
|
||||||
|
|
|
@ -2,17 +2,13 @@ package com.vanced.manager.ui.components.color
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.wrapContentHeight
|
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.skydoves.colorpickerview.ColorEnvelope
|
import com.skydoves.colorpickerview.ColorEnvelope
|
||||||
import com.skydoves.orchestra.colorpicker.ColorPicker
|
import com.skydoves.orchestra.colorpicker.ColorPicker
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ManagerColorPicker(
|
fun ManagerColorPicker(
|
||||||
|
|
|
@ -4,7 +4,6 @@ import androidx.compose.animation.animateColorAsState
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.luminance
|
import androidx.compose.ui.graphics.luminance
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
||||||
|
|
|
@ -6,7 +6,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.Checkbox
|
import androidx.compose.material.Checkbox
|
||||||
import androidx.compose.material.CheckboxDefaults
|
import androidx.compose.material.CheckboxDefaults
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
|
@ -16,7 +15,6 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.vanced.manager.ui.components.color.managerAccentColor
|
import com.vanced.manager.ui.components.color.managerAccentColor
|
||||||
import com.vanced.manager.ui.components.color.managerTextColor
|
import com.vanced.manager.ui.components.color.managerTextColor
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CheckboxItem(
|
fun CheckboxItem(
|
||||||
|
|
|
@ -4,7 +4,6 @@ import androidx.compose.foundation.clickable
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.MaterialTheme
|
|
||||||
import androidx.compose.material.RadioButton
|
import androidx.compose.material.RadioButton
|
||||||
import androidx.compose.material.RadioButtonDefaults
|
import androidx.compose.material.RadioButtonDefaults
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.Text
|
||||||
|
@ -16,7 +15,6 @@ import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
import androidx.compose.ui.unit.sp
|
||||||
import com.vanced.manager.ui.components.color.managerAccentColor
|
import com.vanced.manager.ui.components.color.managerAccentColor
|
||||||
import com.vanced.manager.ui.components.color.managerTextColor
|
import com.vanced.manager.ui.components.color.managerTextColor
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun <T> RadiobuttonItem(
|
fun <T> RadiobuttonItem(
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.vanced.manager.ui.components.preference
|
package com.vanced.manager.ui.components.preference
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.compose.foundation.layout.ColumnScope
|
import androidx.compose.foundation.layout.ColumnScope
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
import androidx.compose.runtime.MutableState
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.vanced.manager.ui.components.preference
|
package com.vanced.manager.ui.components.preference
|
||||||
|
|
||||||
import androidx.compose.foundation.clickable
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.LocalContentColor
|
import androidx.compose.material.LocalContentColor
|
||||||
import androidx.compose.material.LocalTextStyle
|
import androidx.compose.material.LocalTextStyle
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.vanced.manager.ui.components.progressindicator
|
||||||
|
|
||||||
|
import androidx.compose.material.LinearProgressIndicator
|
||||||
|
import androidx.compose.runtime.Composable
|
||||||
|
import com.vanced.manager.ui.components.color.managerAccentColor
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ManagerProgressIndicator() {
|
||||||
|
LinearProgressIndicator(
|
||||||
|
color = managerAccentColor()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Composable
|
||||||
|
fun ManagerProgressIndicator(
|
||||||
|
progress: Float
|
||||||
|
) {
|
||||||
|
LinearProgressIndicator(
|
||||||
|
color = managerAccentColor(),
|
||||||
|
progress = progress
|
||||||
|
)
|
||||||
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
package com.vanced.manager.ui.components.text
|
package com.vanced.manager.ui.components.text
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
|
|
@ -21,9 +21,9 @@ import com.vanced.manager.ui.components.card.ManagerLinkCard
|
||||||
import com.vanced.manager.ui.components.card.ManagerThemedCard
|
import com.vanced.manager.ui.components.card.ManagerThemedCard
|
||||||
import com.vanced.manager.ui.components.layout.ManagerScrollableColumn
|
import com.vanced.manager.ui.components.layout.ManagerScrollableColumn
|
||||||
import com.vanced.manager.ui.components.layout.ScrollableItemRow
|
import com.vanced.manager.ui.components.layout.ScrollableItemRow
|
||||||
import com.vanced.manager.ui.resources.managerString
|
|
||||||
import com.vanced.manager.ui.components.list.ManagerListItem
|
import com.vanced.manager.ui.components.list.ManagerListItem
|
||||||
import com.vanced.manager.ui.components.text.ManagerText
|
import com.vanced.manager.ui.components.text.ManagerText
|
||||||
|
import com.vanced.manager.ui.resources.managerString
|
||||||
import com.vanced.manager.ui.widgets.layout.CategoryLayout
|
import com.vanced.manager.ui.widgets.layout.CategoryLayout
|
||||||
|
|
||||||
data class Person(
|
data class Person(
|
||||||
|
|
|
@ -2,16 +2,17 @@ package com.vanced.manager.ui.layouts
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.lazy.items
|
import androidx.compose.foundation.lazy.items
|
||||||
import androidx.compose.material.*
|
import androidx.compose.material.FloatingActionButton
|
||||||
|
import androidx.compose.material.Icon
|
||||||
|
import androidx.compose.material.Scaffold
|
||||||
|
import androidx.compose.material.Text
|
||||||
import androidx.compose.material.icons.Icons
|
import androidx.compose.material.icons.Icons
|
||||||
import androidx.compose.material.icons.filled.Share
|
import androidx.compose.material.icons.filled.Share
|
||||||
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 com.vanced.manager.ui.components.color.managerAccentColor
|
import com.vanced.manager.ui.components.color.managerAccentColor
|
||||||
import com.vanced.manager.ui.components.color.managerSurfaceColor
|
import com.vanced.manager.ui.components.color.managerSurfaceColor
|
||||||
import com.vanced.manager.ui.components.layout.ManagerLazyColumn
|
import com.vanced.manager.ui.components.layout.ManagerLazyColumn
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
import com.vanced.manager.util.logs
|
import com.vanced.manager.util.logs
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.vanced.manager.ui.layouts
|
package com.vanced.manager.ui.layouts
|
||||||
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.Composable
|
||||||
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.ui.components.layout.ManagerScrollableColumn
|
import com.vanced.manager.ui.components.layout.ManagerScrollableColumn
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package com.vanced.manager.ui.theme
|
package com.vanced.manager.ui.theme
|
||||||
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import com.vanced.manager.ui.components.color.managerAccentColor
|
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
|
||||||
|
|
||||||
val primaryColor = Color(defAccentColor)
|
val primaryColor = Color(defAccentColor)
|
||||||
val primaryColorVariant = primaryColor.copy(alpha = 0.25f)
|
val primaryColorVariant = primaryColor.copy(alpha = 0.25f)
|
||||||
|
|
|
@ -7,25 +7,24 @@ import androidx.compose.material.icons.rounded.DeleteForever
|
||||||
import androidx.compose.material.icons.rounded.Download
|
import androidx.compose.material.icons.rounded.Download
|
||||||
import androidx.compose.material.icons.rounded.Launch
|
import androidx.compose.material.icons.rounded.Launch
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
|
||||||
import androidx.compose.ui.Alignment
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.res.stringResource
|
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.ui.components.button.IconButton
|
import com.vanced.manager.ui.components.button.IconButton
|
||||||
|
import com.vanced.manager.ui.components.text.AppVersionText
|
||||||
import com.vanced.manager.ui.components.text.ManagerText
|
import com.vanced.manager.ui.components.text.ManagerText
|
||||||
import com.vanced.manager.ui.utils.defaultContentPaddingHorizontal
|
import com.vanced.manager.ui.utils.defaultContentPaddingHorizontal
|
||||||
import com.vanced.manager.ui.components.text.AppVersionText
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppActionCard(
|
fun AppActionCard(
|
||||||
appRemoteVersion: String?,
|
appRemoteVersion: String?,
|
||||||
appInstalledVersion: String?,
|
appInstalledVersion: String?,
|
||||||
showDownloadDialog: MutableState<Boolean>,
|
onInfoClick: () -> Unit,
|
||||||
showAppInfo: MutableState<Boolean>,
|
onUninstallClick: () -> Unit,
|
||||||
showInstallationOptions: MutableState<Boolean>,
|
onLaunchClick: () -> Unit,
|
||||||
hasInstallationOptions: Boolean
|
onDownloadClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
|
@ -65,18 +64,26 @@ fun AppActionCard(
|
||||||
.padding(start = 4.dp)
|
.padding(start = 4.dp)
|
||||||
.wrapContentWidth(Alignment.End)
|
.wrapContentWidth(Alignment.End)
|
||||||
) {
|
) {
|
||||||
IconButton(icon = Icons.Outlined.Info, contentDescription = "App Info") {
|
IconButton(
|
||||||
showAppInfo.value = true
|
icon = Icons.Outlined.Info,
|
||||||
}
|
contentDescription = "App Info",
|
||||||
IconButton(icon = Icons.Rounded.DeleteForever, contentDescription = "Uninstall") {}
|
onClick = onInfoClick
|
||||||
IconButton(icon = Icons.Rounded.Launch, contentDescription = "Launch") {}
|
)
|
||||||
IconButton(icon = Icons.Rounded.Download, contentDescription = "Install") {
|
IconButton(
|
||||||
if (hasInstallationOptions) {
|
icon = Icons.Rounded.DeleteForever,
|
||||||
showInstallationOptions.value = true
|
contentDescription = "Uninstall",
|
||||||
} else {
|
onClick = onUninstallClick
|
||||||
showDownloadDialog.value = true
|
)
|
||||||
}
|
IconButton(
|
||||||
}
|
icon = Icons.Rounded.Launch,
|
||||||
|
contentDescription = "Launch",
|
||||||
|
onClick = onLaunchClick
|
||||||
|
)
|
||||||
|
IconButton(
|
||||||
|
icon = Icons.Rounded.Download,
|
||||||
|
contentDescription = "Install",
|
||||||
|
onClick = onDownloadClick
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,14 +1,16 @@
|
||||||
package com.vanced.manager.ui.widgets.home.apps.card
|
package com.vanced.manager.ui.widgets.home.apps.card
|
||||||
|
|
||||||
import androidx.compose.animation.*
|
import androidx.compose.animation.AnimatedVisibility
|
||||||
|
import androidx.compose.animation.ExperimentalAnimationApi
|
||||||
import androidx.compose.animation.core.tween
|
import androidx.compose.animation.core.tween
|
||||||
|
import androidx.compose.animation.expandVertically
|
||||||
|
import androidx.compose.animation.shrinkVertically
|
||||||
import androidx.compose.foundation.layout.Column
|
import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.*
|
||||||
import androidx.compose.runtime.mutableStateOf
|
|
||||||
import androidx.compose.runtime.remember
|
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
|
import androidx.compose.ui.unit.IntSize
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import com.google.accompanist.glide.rememberGlidePainter
|
import com.google.accompanist.glide.rememberGlidePainter
|
||||||
import com.vanced.manager.domain.model.App
|
import com.vanced.manager.domain.model.App
|
||||||
|
@ -27,14 +29,21 @@ fun AppCard(
|
||||||
app: App,
|
app: App,
|
||||||
fetching: Boolean
|
fetching: Boolean
|
||||||
) {
|
) {
|
||||||
val showDownloadDialog = remember { mutableStateOf(false) }
|
var showDownloadDialog by remember { mutableStateOf(false) }
|
||||||
val showAppInfo = remember { mutableStateOf(false) }
|
var showAppInfoDialog by remember { mutableStateOf(false) }
|
||||||
val showInstallationOptions = remember { mutableStateOf(false) }
|
var showInstallationOptions by remember { mutableStateOf(false) }
|
||||||
|
|
||||||
val icon = rememberGlidePainter(
|
val icon = rememberGlidePainter(
|
||||||
request = app.iconUrl ?: "",
|
request = app.iconUrl ?: "",
|
||||||
fadeIn = true
|
fadeIn = true
|
||||||
)
|
)
|
||||||
val hasInstallationOption = app.installationOptions != null
|
|
||||||
|
val hasInstallationOptions = app.installationOptions != null
|
||||||
|
val animationSpec = tween<IntSize>(400)
|
||||||
|
|
||||||
|
fun download() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
ManagerThemedCard {
|
ManagerThemedCard {
|
||||||
|
@ -50,23 +59,31 @@ fun AppCard(
|
||||||
AppActionCard(
|
AppActionCard(
|
||||||
appInstalledVersion = app.installedVersion,
|
appInstalledVersion = app.installedVersion,
|
||||||
appRemoteVersion = app.remoteVersion,
|
appRemoteVersion = app.remoteVersion,
|
||||||
showDownloadDialog = showDownloadDialog,
|
onDownloadClick = {
|
||||||
showAppInfo = showAppInfo,
|
if (hasInstallationOptions) {
|
||||||
showInstallationOptions = showInstallationOptions,
|
showInstallationOptions = true
|
||||||
hasInstallationOptions = hasInstallationOption
|
} else {
|
||||||
|
showDownloadDialog = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onInfoClick = {
|
||||||
|
showAppInfoDialog = true
|
||||||
|
},
|
||||||
|
onLaunchClick = {},
|
||||||
|
onUninstallClick = {}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasInstallationOption) {
|
if (hasInstallationOptions) {
|
||||||
AnimatedVisibility(
|
AnimatedVisibility(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
visible = showInstallationOptions.value,
|
visible = showInstallationOptions,
|
||||||
enter = expandVertically(
|
enter = expandVertically(
|
||||||
animationSpec = tween(400)
|
animationSpec = animationSpec
|
||||||
),
|
),
|
||||||
exit = shrinkVertically(
|
exit = shrinkVertically(
|
||||||
animationSpec = tween(400)
|
animationSpec = animationSpec
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
|
@ -81,10 +98,10 @@ fun AppCard(
|
||||||
.padding(top = defaultContentPaddingVertical)
|
.padding(top = defaultContentPaddingVertical)
|
||||||
) {
|
) {
|
||||||
ManagerDownloadButton {
|
ManagerDownloadButton {
|
||||||
showDownloadDialog.value = true
|
showDownloadDialog = true
|
||||||
}
|
}
|
||||||
ManagerCancelButton {
|
ManagerCancelButton {
|
||||||
showInstallationOptions.value = false
|
showInstallationOptions = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,19 +109,23 @@ fun AppCard(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.name != null && app.downloader != null) {
|
if (app.name != null && app.downloader != null && showDownloadDialog) {
|
||||||
AppDownloadDialog(
|
AppDownloadDialog(
|
||||||
app = app.name,
|
app = app.name,
|
||||||
downloader = app.downloader,
|
downloader = app.downloader,
|
||||||
showDialog = showDownloadDialog
|
onCancelClick = {
|
||||||
|
showDownloadDialog = false
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.name != null && app.changelog != null) {
|
if (app.name != null && app.changelog != null && showAppInfoDialog) {
|
||||||
AppChangelogDialog(
|
AppChangelogDialog(
|
||||||
appName = app.name,
|
appName = app.name,
|
||||||
changelog = app.changelog,
|
changelog = app.changelog,
|
||||||
showDialog = showAppInfo
|
onDismissRequest = {
|
||||||
|
showAppInfoDialog = false
|
||||||
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,29 +3,25 @@ package com.vanced.manager.ui.widgets.home.apps.dialog
|
||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.material.MaterialTheme
|
import androidx.compose.material.MaterialTheme
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.MutableState
|
|
||||||
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
|
||||||
import com.vanced.manager.ui.components.dialog.ManagerDialog
|
import com.vanced.manager.ui.components.dialog.ManagerDialog
|
||||||
import com.vanced.manager.ui.resources.managerString
|
|
||||||
import com.vanced.manager.ui.components.text.ManagerText
|
import com.vanced.manager.ui.components.text.ManagerText
|
||||||
|
import com.vanced.manager.ui.resources.managerString
|
||||||
import com.vanced.manager.ui.widgets.button.ManagerCloseButton
|
import com.vanced.manager.ui.widgets.button.ManagerCloseButton
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppChangelogDialog(
|
fun AppChangelogDialog(
|
||||||
appName: String,
|
appName: String,
|
||||||
changelog: String,
|
changelog: String,
|
||||||
showDialog: MutableState<Boolean>
|
onDismissRequest: () -> Unit,
|
||||||
) {
|
) {
|
||||||
if (showDialog.value) {
|
|
||||||
ManagerDialog(
|
ManagerDialog(
|
||||||
title = managerString(R.string.app_info_title, appName),
|
title = managerString(R.string.app_info_title, appName),
|
||||||
onDismissRequest = { showDialog.value = false },
|
onDismissRequest = onDismissRequest,
|
||||||
buttons = {
|
buttons = {
|
||||||
ManagerCloseButton {
|
ManagerCloseButton(onClick = onDismissRequest)
|
||||||
showDialog.value = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
ManagerText(
|
ManagerText(
|
||||||
|
@ -34,5 +30,4 @@ fun AppChangelogDialog(
|
||||||
textStyle = MaterialTheme.typography.subtitle1
|
textStyle = MaterialTheme.typography.subtitle1
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,53 +1,33 @@
|
||||||
package com.vanced.manager.ui.widgets.home.apps.dialog
|
package com.vanced.manager.ui.widgets.home.apps.dialog
|
||||||
|
|
||||||
import androidx.compose.runtime.*
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.runtime.remember
|
||||||
import com.vanced.manager.downloader.base.BaseDownloader
|
import com.vanced.manager.downloader.base.BaseDownloader
|
||||||
import com.vanced.manager.ui.components.dialog.ManagerDialog
|
import com.vanced.manager.ui.components.dialog.ManagerDialog
|
||||||
import com.vanced.manager.ui.widgets.home.download.AppDownloadDialogButtons
|
import com.vanced.manager.ui.widgets.button.ManagerCancelButton
|
||||||
import com.vanced.manager.ui.widgets.home.download.AppDownloadDialogProgress
|
import com.vanced.manager.ui.widgets.home.download.AppDownloadDialogProgress
|
||||||
import kotlinx.coroutines.launch
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppDownloadDialog(
|
fun AppDownloadDialog(
|
||||||
app: String,
|
app: String,
|
||||||
downloader: BaseDownloader,
|
downloader: BaseDownloader,
|
||||||
showDialog: MutableState<Boolean>
|
onCancelClick: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val coroutineScope = rememberCoroutineScope()
|
|
||||||
|
|
||||||
val rememberProgress = remember { downloader.downloadProgress }
|
val rememberProgress = remember { downloader.downloadProgress }
|
||||||
val rememberFile = remember { downloader.downloadFile }
|
val rememberFile = remember { downloader.downloadFile }
|
||||||
val rememberInstalling = remember { downloader.installing }
|
val rememberInstalling = remember { downloader.installing }
|
||||||
|
|
||||||
val showProgress = remember { mutableStateOf(false) }
|
|
||||||
|
|
||||||
if (showDialog.value) {
|
|
||||||
ManagerDialog(
|
ManagerDialog(
|
||||||
title = app,
|
title = app,
|
||||||
onDismissRequest = { showDialog.value = false },
|
onDismissRequest = {},
|
||||||
buttons = {
|
buttons = {
|
||||||
AppDownloadDialogButtons(
|
ManagerCancelButton(onClick = onCancelClick)
|
||||||
showProgress = showProgress,
|
|
||||||
onDownloadClick = {
|
|
||||||
coroutineScope.launch {
|
|
||||||
showProgress.value = true
|
|
||||||
downloader.download()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onCancelClick = {
|
|
||||||
downloader.cancelDownload()
|
|
||||||
showDialog.value = false
|
|
||||||
showProgress.value = false
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
AppDownloadDialogProgress(
|
AppDownloadDialogProgress(
|
||||||
progress = rememberProgress,
|
progress = rememberProgress,
|
||||||
file = rememberFile,
|
file = rememberFile,
|
||||||
showProgress = showProgress.value,
|
|
||||||
installing = rememberInstalling
|
installing = rememberInstalling
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
package com.vanced.manager.ui.widgets.home.download
|
|
||||||
|
|
||||||
import androidx.compose.runtime.Composable
|
|
||||||
import androidx.compose.runtime.MutableState
|
|
||||||
import com.vanced.manager.ui.widgets.button.ManagerCancelButton
|
|
||||||
import com.vanced.manager.ui.widgets.button.ManagerDownloadButton
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
fun AppDownloadDialogButtons(
|
|
||||||
showProgress: MutableState<Boolean>,
|
|
||||||
onDownloadClick: () -> Unit,
|
|
||||||
onCancelClick: () -> Unit,
|
|
||||||
) {
|
|
||||||
when (showProgress.value) {
|
|
||||||
true -> ManagerCancelButton(onClick = onCancelClick)
|
|
||||||
false -> ManagerDownloadButton(onClick = onDownloadClick)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,43 +2,39 @@ package com.vanced.manager.ui.widgets.home.download
|
||||||
|
|
||||||
import androidx.compose.foundation.layout.Row
|
import androidx.compose.foundation.layout.Row
|
||||||
import androidx.compose.foundation.layout.wrapContentWidth
|
import androidx.compose.foundation.layout.wrapContentWidth
|
||||||
import androidx.compose.material.LinearProgressIndicator
|
|
||||||
import androidx.compose.material.Text
|
import androidx.compose.material.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
|
||||||
import androidx.compose.ui.graphics.Color
|
import com.vanced.manager.R
|
||||||
import com.vanced.manager.ui.components.color.managerAccentColor
|
import com.vanced.manager.ui.components.progressindicator.ManagerProgressIndicator
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
import com.vanced.manager.ui.resources.managerString
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun AppDownloadDialogProgress(
|
fun AppDownloadDialogProgress(
|
||||||
progress: Float,
|
progress: Float,
|
||||||
file: String,
|
file: String,
|
||||||
showProgress: Boolean,
|
|
||||||
installing: Boolean
|
installing: Boolean
|
||||||
) {
|
) {
|
||||||
if (showProgress) {
|
|
||||||
when (installing) {
|
when (installing) {
|
||||||
true -> LinearProgressIndicator(color = managerAccentColor())
|
true -> ManagerProgressIndicator()
|
||||||
false -> LinearProgressIndicator(
|
false -> ManagerProgressIndicator(progress = progress)
|
||||||
progress = progress,
|
|
||||||
color = managerAccentColor()
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
Row {
|
Row {
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.wrapContentWidth(Alignment.Start),
|
.wrapContentWidth(Alignment.Start),
|
||||||
text = "Downloading $file"
|
text = managerString(
|
||||||
|
stringId = R.string.app_download_dialog_downloading_file,
|
||||||
|
file
|
||||||
|
)
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.wrapContentWidth(Alignment.End),
|
.wrapContentWidth(Alignment.End),
|
||||||
text = "$progress"
|
text = "%$progress"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
package com.vanced.manager.ui.widgets.home.installation
|
package com.vanced.manager.ui.widgets.home.installation
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
import androidx.annotation.StringRes
|
||||||
import com.vanced.manager.ui.resources.managerString
|
|
||||||
import com.vanced.manager.ui.components.preference.CheckboxDialogPreference
|
import com.vanced.manager.ui.components.preference.CheckboxDialogPreference
|
||||||
import com.vanced.manager.ui.preferences.CheckboxPreference
|
import com.vanced.manager.ui.preferences.CheckboxPreference
|
||||||
import com.vanced.manager.ui.preferences.ManagerPreference
|
import com.vanced.manager.ui.preferences.ManagerPreference
|
||||||
|
import com.vanced.manager.ui.resources.managerString
|
||||||
|
|
||||||
data class CheckboxInstallationOption(
|
data class CheckboxInstallationOption(
|
||||||
@StringRes val titleId: Int,
|
@StringRes val titleId: Int,
|
||||||
|
|
|
@ -4,9 +4,9 @@ import androidx.compose.foundation.layout.*
|
||||||
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.components.text.CategoryTitleText
|
||||||
import com.vanced.manager.ui.utils.defaultContentPaddingHorizontal
|
import com.vanced.manager.ui.utils.defaultContentPaddingHorizontal
|
||||||
import com.vanced.manager.ui.utils.defaultContentPaddingVertical
|
import com.vanced.manager.ui.utils.defaultContentPaddingVertical
|
||||||
import com.vanced.manager.ui.components.text.CategoryTitleText
|
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CategoryLayout(
|
fun CategoryLayout(
|
||||||
|
|
|
@ -5,8 +5,8 @@ import androidx.compose.ui.graphics.Color
|
||||||
import com.vanced.manager.R
|
import com.vanced.manager.R
|
||||||
import com.vanced.manager.ui.components.color.ManagerColorPicker
|
import com.vanced.manager.ui.components.color.ManagerColorPicker
|
||||||
import com.vanced.manager.ui.components.preference.DialogPreference
|
import com.vanced.manager.ui.components.preference.DialogPreference
|
||||||
import com.vanced.manager.ui.resources.managerString
|
|
||||||
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
import com.vanced.manager.ui.preferences.holder.managerAccentColorPref
|
||||||
|
import com.vanced.manager.ui.resources.managerString
|
||||||
import com.vanced.manager.ui.widgets.button.ManagerSaveButton
|
import com.vanced.manager.ui.widgets.button.ManagerSaveButton
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
|
|
Loading…
Reference in a new issue