mirror of
https://github.com/revanced/revanced-manager-compose-old.git
synced 2025-04-30 14:34:29 +02:00
feat: source selector screen skeleton
This commit is contained in:
parent
edfa5587df
commit
7b19a4fb83
@ -21,11 +21,7 @@ import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
|
||||
import app.revanced.manager.preferences.PreferencesManager
|
||||
import app.revanced.manager.ui.navigation.AppDestination
|
||||
import app.revanced.manager.ui.screen.MainDashboardScreen
|
||||
import app.revanced.manager.ui.screen.subscreens.PatchingSubscreen
|
||||
import app.revanced.manager.ui.screen.subscreens.AppSelectorSubscreen
|
||||
import app.revanced.manager.ui.screen.subscreens.ContributorsSubscreen
|
||||
import app.revanced.manager.ui.screen.subscreens.LicensesSubscreen
|
||||
import app.revanced.manager.ui.screen.subscreens.PatchesSelectorSubscreen
|
||||
import app.revanced.manager.ui.screen.subscreens.*
|
||||
import app.revanced.manager.ui.theme.ReVancedManagerTheme
|
||||
import app.revanced.manager.ui.theme.Theme
|
||||
import com.xinto.taxi.Taxi
|
||||
@ -61,6 +57,7 @@ class MainActivity : ComponentActivity() {
|
||||
is AppDestination.AppSelector -> AppSelectorSubscreen(navigator = navigator)
|
||||
is AppDestination.PatchSelector -> PatchesSelectorSubscreen(navigator = navigator)
|
||||
is AppDestination.Contributors -> ContributorsSubscreen(navigator = navigator)
|
||||
is AppDestination.SourceSelector -> SourceSelectorSubscreen(navigator = navigator)
|
||||
is AppDestination.Licenses -> LicensesSubscreen(navigator = navigator)
|
||||
is AppDestination.Patcher -> PatchingSubscreen(navigator = navigator)
|
||||
}
|
||||
|
@ -0,0 +1,82 @@
|
||||
package app.revanced.manager.ui.component
|
||||
|
||||
import androidx.compose.foundation.ExperimentalFoundationApi
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.combinedClickable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.revanced.manager.R
|
||||
import coil.compose.AsyncImage
|
||||
|
||||
@OptIn(ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun SourceItem() {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.padding(top = 8.dp)
|
||||
.clickable { }
|
||||
) {
|
||||
AsyncImage(
|
||||
model = "https://github.com/ushie.png",
|
||||
contentDescription = stringResource(id = R.string.contributor_image),
|
||||
modifier = Modifier
|
||||
.padding(4.dp, 4.dp, 10.dp, 4.dp)
|
||||
.size(50.dp)
|
||||
.clip(RoundedCornerShape(20))
|
||||
)
|
||||
Column {
|
||||
Row(Modifier.padding(vertical = 5.dp)) {
|
||||
Text(
|
||||
text = "Ushie",
|
||||
style = MaterialTheme.typography.bodyLarge
|
||||
)
|
||||
Spacer(Modifier.width(4.dp))
|
||||
Text(
|
||||
modifier = Modifier.align(Alignment.CenterVertically),
|
||||
text = "2.52.5",
|
||||
style = MaterialTheme.typography.bodySmall
|
||||
)
|
||||
}
|
||||
Row {
|
||||
Icon(
|
||||
modifier = Modifier.size(18.dp),
|
||||
painter = painterResource(R.drawable.ic_github),
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
Spacer(Modifier.width(4.dp))
|
||||
Text(
|
||||
text = "Ushie/revanced-patches",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
Spacer(Modifier.weight(1f))
|
||||
Box(
|
||||
Modifier
|
||||
.align(Alignment.CenterVertically)
|
||||
) {
|
||||
IconButton(onClick = { /*TODO*/ }) {
|
||||
Icon(
|
||||
imageVector = Icons.Default.Settings,
|
||||
contentDescription = null,
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -25,6 +25,9 @@ sealed interface AppDestination : Destination {
|
||||
@Parcelize
|
||||
object Patcher : AppDestination
|
||||
|
||||
@Parcelize
|
||||
object SourceSelector : AppDestination
|
||||
|
||||
@Parcelize
|
||||
object Licenses : AppDestination
|
||||
|
||||
|
@ -71,6 +71,7 @@ fun MainDashboardScreen(navigator: BackstackNavigator<AppDestination>) {
|
||||
onClickAppSelector = { navigator.push(AppDestination.AppSelector) },
|
||||
onClickPatchSelector = { navigator.push(AppDestination.PatchSelector) },
|
||||
onClickPatch = { navigator.push(AppDestination.Patcher) },
|
||||
onClickSourceSelector = { navigator.push(AppDestination.SourceSelector) }
|
||||
)
|
||||
DashboardDestination.SETTINGS -> SettingsScreen(
|
||||
onClickContributors = { navigator.push(AppDestination.Contributors) },
|
||||
|
@ -27,6 +27,7 @@ fun PatcherScreen(
|
||||
onClickAppSelector: () -> Unit,
|
||||
onClickPatchSelector: () -> Unit,
|
||||
onClickPatch: () -> Unit,
|
||||
onClickSourceSelector: () -> Unit,
|
||||
viewModel: PatcherScreenViewModel = getViewModel()
|
||||
) {
|
||||
val selectedAmount = selectedPatches.size
|
||||
@ -35,7 +36,8 @@ fun PatcherScreen(
|
||||
val patchesLoaded = patches.value is Resource.Success
|
||||
var showDialog by remember { mutableStateOf(false) }
|
||||
|
||||
Scaffold(floatingActionButton = {
|
||||
Scaffold(
|
||||
floatingActionButton = {
|
||||
FloatingActionButton(
|
||||
enabled = hasAppSelected && viewModel.anyPatchSelected(),
|
||||
onClick = {
|
||||
@ -57,9 +59,22 @@ fun PatcherScreen(
|
||||
) {
|
||||
if (showDialog)
|
||||
SplitAPKDialog(onDismiss = { showDialog = false }, onConfirm = onClickPatch)
|
||||
Card(
|
||||
ElevatedCard(
|
||||
modifier = Modifier
|
||||
.padding(4.dp)
|
||||
.padding(vertical = 4.dp)
|
||||
.fillMaxWidth(),
|
||||
onClick = onClickSourceSelector
|
||||
) {
|
||||
Column(modifier = Modifier.padding(16.dp)) {
|
||||
Text(
|
||||
text = stringResource(id = R.string.select_sources),
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
)
|
||||
}
|
||||
}
|
||||
ElevatedCard(
|
||||
modifier = Modifier
|
||||
.padding(vertical = 4.dp)
|
||||
.fillMaxWidth(),
|
||||
enabled = patchesLoaded,
|
||||
onClick = onClickAppSelector
|
||||
@ -73,19 +88,20 @@ fun PatcherScreen(
|
||||
text = if (patchesLoaded) {
|
||||
if (selectedAppPackage.isPresent) {
|
||||
selectedAppPackage.get().packageName
|
||||
} else {
|
||||
stringResource(R.string.card_application_not_selected)
|
||||
}
|
||||
else {stringResource(R.string.card_application_not_selected)}
|
||||
} else {
|
||||
stringResource(R.string.card_application_not_loaded)
|
||||
},
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.padding(0.dp, 8.dp)
|
||||
modifier = Modifier.padding(vertical = 8.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
Card(
|
||||
ElevatedCard(
|
||||
modifier = Modifier
|
||||
.padding(4.dp)
|
||||
.padding(vertical = 4.dp)
|
||||
.fillMaxWidth(),
|
||||
enabled = hasAppSelected,
|
||||
onClick = onClickPatchSelector
|
||||
@ -104,7 +120,7 @@ fun PatcherScreen(
|
||||
stringResource(R.string.card_patches_body_patches)
|
||||
},
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.padding(0.dp, 8.dp)
|
||||
modifier = Modifier.padding(vertical = 8.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,79 @@
|
||||
package app.revanced.manager.ui.screen.subscreens
|
||||
|
||||
import androidx.compose.foundation.*
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Add
|
||||
import androidx.compose.material.icons.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Settings
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Alignment.Companion.CenterVertically
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import app.revanced.manager.R
|
||||
import app.revanced.manager.ui.component.SourceItem
|
||||
import app.revanced.manager.ui.navigation.AppDestination
|
||||
import app.revanced.manager.ui.theme.Typography
|
||||
import coil.compose.AsyncImage
|
||||
import com.xinto.taxi.BackstackNavigator
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalFoundationApi::class)
|
||||
@Composable
|
||||
fun SourceSelectorSubscreen(
|
||||
navigator: BackstackNavigator<AppDestination>
|
||||
) {
|
||||
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior(
|
||||
state = rememberTopAppBarState(),
|
||||
canScroll = { true }
|
||||
)
|
||||
Scaffold(
|
||||
modifier = Modifier
|
||||
.nestedScroll(scrollBehavior.nestedScrollConnection),
|
||||
topBar = {
|
||||
LargeTopAppBar(
|
||||
title = { Text(text = stringResource(R.string.select_sources)) },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = navigator::pop) {
|
||||
Icon(imageVector = Icons.Default.ArrowBack, contentDescription = null)
|
||||
}
|
||||
},
|
||||
scrollBehavior = scrollBehavior
|
||||
)
|
||||
},
|
||||
floatingActionButton = {
|
||||
FloatingActionButton(onClick = { /* TODO */ }) {
|
||||
Icon(imageVector = Icons.Default.Add, contentDescription = null)
|
||||
}
|
||||
}
|
||||
) { paddingValues ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.padding(paddingValues)
|
||||
.padding(horizontal = 16.dp)
|
||||
.verticalScroll(rememberScrollState())
|
||||
) {
|
||||
ListItem(
|
||||
modifier = Modifier
|
||||
.clickable { /* TODO */ },
|
||||
headlineText = { Text(stringResource(R.string.select_bundle_from_storage)) },
|
||||
leadingContent = {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.uwu),
|
||||
contentDescription = null
|
||||
)
|
||||
}
|
||||
)
|
||||
Divider()
|
||||
SourceItem()
|
||||
SourceItem()
|
||||
SourceItem()
|
||||
}
|
||||
}
|
||||
}
|
9
app/src/main/res/drawable/uwu.xml
Normal file
9
app/src/main/res/drawable/uwu.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:pathData="M12,18.25V15.75H14.5V18.25H12ZM14.5,13.25V10.75H12V13.25H14.5ZM14.5,8.25V5.75H12V8.25H14.5ZM9.5,10.75H12V8.25H9.5V10.75ZM9.5,15.75H12V13.25H9.5V15.75ZM23.25,3.25V20.75C23.25,22.125 22.125,23.25 20.75,23.25H3.25C1.875,23.25 0.75,22.125 0.75,20.75V3.25C0.75,1.875 1.875,0.75 3.25,0.75H20.75C22.125,0.75 23.25,1.875 23.25,3.25ZM20.75,3.25H12V5.75H9.5V3.25H3.25V20.75H20.75V3.25Z"
|
||||
android:fillColor="#FFFFFF"/>
|
||||
</vector>
|
@ -79,4 +79,6 @@
|
||||
<string name="warning">Warning</string>
|
||||
<string name="split_apk_warning">You have selected a resource patch and a split APK installation was detected so patching errors can occur.\nAre you sure you want to proceed with patching a split base APK?</string>
|
||||
<string name="opensource_licenses">Open source licenses</string>
|
||||
<string name="select_sources">Select sources</string>
|
||||
<string name="select_bundle_from_storage">Select a bundle from storage</string>
|
||||
</resources>
|
Loading…
x
Reference in New Issue
Block a user