feat(update screen): complete main update screen

This commit is contained in:
Aunali321 2023-05-22 04:14:43 +05:30
parent fec8c0cc14
commit ea4247c688
4 changed files with 68 additions and 3 deletions

View File

@ -111,7 +111,7 @@ fun SettingsScreen(
ListItem( ListItem(
modifier = Modifier.clickable { navController.navigate(destination) }, modifier = Modifier.clickable { navController.navigate(destination) },
headlineContent = { Text(stringResource(titleDescIcon.first), style = MaterialTheme.typography.titleLarge) }, headlineContent = { Text(stringResource(titleDescIcon.first), style = MaterialTheme.typography.titleLarge) },
supportingContent = { Text(stringResource(titleDescIcon.second), style = MaterialTheme.typography.bodyMedium) }, supportingContent = { Text(stringResource(titleDescIcon.second), style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.outline) },
leadingContent = { Icon(titleDescIcon.third, null) } leadingContent = { Icon(titleDescIcon.third, null) }
) )
} }

View File

@ -174,7 +174,7 @@ fun AboutSettingsScreen(
.padding(8.dp) .padding(8.dp)
.clickable { onClick() }, .clickable { onClick() },
headlineContent = { Text(title, style = MaterialTheme.typography.titleLarge) }, headlineContent = { Text(title, style = MaterialTheme.typography.titleLarge) },
supportingContent = { Text(description, style = MaterialTheme.typography.bodyMedium) } supportingContent = { Text(description, style = MaterialTheme.typography.bodyMedium,color = MaterialTheme.colorScheme.outline) }
) )
} }
} }

View File

@ -1,15 +1,31 @@
package app.revanced.manager.compose.ui.screen.settings package app.revanced.manager.compose.ui.screen.settings
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Update
import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.ListItem
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold 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.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
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
@ -18,6 +34,13 @@ import app.revanced.manager.compose.ui.component.AppTopBar
fun UpdatesSettingsScreen( fun UpdatesSettingsScreen(
onBackClick: () -> Unit onBackClick: () -> Unit
) { ) {
val listItems = listOf(
Triple(stringResource(R.string.update_channel), stringResource(R.string.update_channel_description), third = { /*TODO*/ }),
Triple(stringResource(R.string.update_notifications), stringResource(R.string.update_notifications_description), third = { /*TODO*/ }),
Triple(stringResource(R.string.changelog), stringResource(R.string.changelog_description), third = { /*TODO*/ }),
)
Scaffold( Scaffold(
topBar = { topBar = {
AppTopBar( AppTopBar(
@ -27,9 +50,44 @@ fun UpdatesSettingsScreen(
} }
) { paddingValues -> ) { paddingValues ->
Column( Column(
modifier = Modifier.fillMaxSize().padding(paddingValues).verticalScroll(rememberScrollState()) modifier = Modifier
.fillMaxSize()
.padding(paddingValues)
.verticalScroll(rememberScrollState())
) { ) {
UpdateNotification()
listItems.forEach { (title, description, onClick) ->
ListItem(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
.clickable { onClick() },
headlineContent = { Text(title, style = MaterialTheme.typography.titleLarge) },
supportingContent = { Text(description, style = MaterialTheme.typography.bodyMedium, color = MaterialTheme.colorScheme.outline) }
)
}
}
}
}
@Composable
fun UpdateNotification() {
Box(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.clip(RoundedCornerShape(16.dp))
.background(MaterialTheme.colorScheme.secondaryContainer)
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(16.dp)
) {
Icon(imageVector = Icons.Default.Update, contentDescription = null)
Text(text = stringResource(R.string.update_notification), style = MaterialTheme.typography.bodyMedium)
} }
} }
} }

View File

@ -84,4 +84,11 @@
<string name="developer_options_description">Options for debugging issues</string> <string name="developer_options_description">Options for debugging issues</string>
<string name="about_revanced_manager">About ReVanced Manager</string> <string name="about_revanced_manager">About ReVanced Manager</string>
<string name="revanced_manager_description">ReVanced Manager is an application designed to work with ReVanced Patcher, which allows for long-lasting patches to be created for Android apps. The patching system is designed to automatically work with new versions of apps with minimal maintenance.</string> <string name="revanced_manager_description">ReVanced Manager is an application designed to work with ReVanced Patcher, which allows for long-lasting patches to be created for Android apps. The patching system is designed to automatically work with new versions of apps with minimal maintenance.</string>
<string name="update_notification">A minor update for ReVanced Manager is available. Click here to update and get the latest features and fixes!</string>
<string name="update_channel">Update channel</string>
<string name="update_channel_description">Stable</string>
<string name="update_notifications">Update notifications</string>
<string name="update_notifications_description">Dialog on app launch + badges</string>
<string name="changelog">Changelog</string>
<string name="changelog_description">Check out the latest changes in this update</string>
</resources> </resources>