Skip to content

Commit

Permalink
Updates and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
arkon authored and ivaniskandar committed May 19, 2024
1 parent ef608ff commit 8c01067
Show file tree
Hide file tree
Showing 17 changed files with 61 additions and 57 deletions.
38 changes: 21 additions & 17 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id 'com.android.application'
id 'kotlin-android'
Expand Down Expand Up @@ -68,18 +70,18 @@ android {
buildTypes.debug.signingConfig signingConfigs.debug
}

applicationVariants.all { variant ->
applicationVariants.configureEach { variant ->
variant.outputs.each { output ->
output.versionNameOverride "$versionName-$gitCommitHash"
}
}
}

dependencies {
implementation 'androidx.core:core-ktx:1.12.0'
implementation 'androidx.core:core-ktx:1.13.1'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.activity:activity-compose:1.8.2'
implementation "androidx.navigation:navigation-compose:2.8.0-alpha04"
implementation 'androidx.activity:activity-compose:1.9.0'
implementation "androidx.navigation:navigation-compose:2.8.0-beta01"
implementation "com.github.topjohnwu.libsu:core:5.0.4"
implementation 'com.squareup.logcat:logcat:0.1'
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.1'
Expand All @@ -102,16 +104,16 @@ dependencies {
implementation "com.google.accompanist:accompanist-navigation-material:$accompanist_version"
implementation "com.google.accompanist:accompanist-systemuicontroller:$accompanist_version"

def coroutines_version = "1.8.0"
def coroutines_version = "1.8.1"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"

def lifecycle_version = "2.7.0"
def lifecycle_version = "2.8.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"

implementation "androidx.datastore:datastore:1.0.0"
implementation "androidx.datastore:datastore:1.1.1"
implementation "com.google.protobuf:protobuf-javalite:$protobuf_version"
}

Expand All @@ -131,15 +133,17 @@ protobuf {
}
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
freeCompilerArgs += "-opt-in=androidx.compose.material.ExperimentalMaterialApi"
freeCompilerArgs += "-opt-in=androidx.compose.material3.ExperimentalMaterial3Api"
freeCompilerArgs += "-opt-in=androidx.compose.foundation.ExperimentalFoundationApi"
freeCompilerArgs += "-opt-in=androidx.compose.animation.ExperimentalAnimationApi"
freeCompilerArgs += "-opt-in=androidx.compose.ui.ExperimentalComposeUiApi"
freeCompilerArgs += "-opt-in=androidx.compose.ui.text.ExperimentalTextApi"
freeCompilerArgs += "-opt-in=com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi"
tasks.withType(KotlinCompile).configureEach {
compilerOptions {
freeCompilerArgs.addAll(
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=androidx.compose.material.ExperimentalMaterialApi",
"-opt-in=androidx.compose.material3.ExperimentalMaterial3Api",
"-opt-in=androidx.compose.foundation.ExperimentalFoundationApi",
"-opt-in=androidx.compose.animation.ExperimentalAnimationApi",
"-opt-in=androidx.compose.ui.ExperimentalComposeUiApi",
"-opt-in=androidx.compose.ui.text.ExperimentalTextApi",
"-opt-in=com.google.accompanist.navigation.material.ExperimentalMaterialNavigationApi",
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.sizeIn
import androidx.compose.material.ModalBottomSheetValue
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowBack
import androidx.compose.material.icons.automirrored.rounded.ArrowBack
import androidx.compose.material.icons.rounded.MoreVert
import androidx.compose.material.rememberModalBottomSheetState
import androidx.compose.material3.CenterAlignedTopAppBar
Expand Down Expand Up @@ -132,7 +132,7 @@ class MainActivity : ComponentActivity() {
navigationIcon = if (currentRoute != null && currentRoute != Screen.Home.route) {
{
IconButton(onClick = { navController.popBackStack() }) {
Icon(imageVector = Icons.Rounded.ArrowBack, contentDescription = null)
Icon(imageVector = Icons.AutoMirrored.Rounded.ArrowBack, contentDescription = null)
}
}
} else { {} },
Expand Down Expand Up @@ -257,7 +257,7 @@ class MainActivity : ComponentActivity() {
}

@Composable
fun getAppBarTitle(navController: NavController, navBackStackEntry: NavBackStackEntry?): String {
private fun getAppBarTitle(navController: NavController, navBackStackEntry: NavBackStackEntry?): String {
return if (navBackStackEntry?.destination is BottomSheetNavigator.Destination) {
// Keep previous destination title when showing bottom sheet
getAppBarTitle(navController = navController, navBackStackEntry = navController.previousBackStackEntry)
Expand All @@ -283,7 +283,7 @@ fun getAppBarTitle(navController: NavController, navBackStackEntry: NavBackStack
}

@Composable
fun MainActivityActions(
private fun MainActivityActions(
navController: NavController,
) {
val context = LocalContext.current
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class PocketNoTouchyActivity : ComponentActivity() {

@Preview
@Composable
fun DialogCardPreview() {
private fun DialogCardPreview() {
ShoukoM3PreviewTheme(darkTheme = true) {
Box(modifier = Modifier.background(Color.Black)) {
DialogCard()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class TileBoardingActivity : ComponentActivity() {

@Preview
@Composable
fun APreview() {
private fun APreview() {
ShoukoM3PreviewTheme {
TileBoardingScreen(type = TadanoTileParentService.Type.COFFEE, onDismissRequest = {})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package xyz.ivaniskandar.shouko.ui

import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.LocalLifecycleOwner

@Composable
fun ComposeLifecycleCallback(
Expand Down
22 changes: 11 additions & 11 deletions app/src/main/java/xyz/ivaniskandar/shouko/ui/Screen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ package xyz.ivaniskandar.shouko.ui
import androidx.navigation.NavBackStackEntry

sealed class Screen(val route: String) {
object Home : Screen("home")
object ReadLogsSetup : Screen("read_logs_setup")
object SecureSettingsSetup : Screen("secure_settings_setup")
object AssistantButtonSettings : Screen("assistant_button_settings")
object AssistantLaunchSelection : Screen("assistant_launch_selection")
object LockscreenShortcutSettings : Screen("lockscreen_shortcut_settings")
object LockscreenShortcutSelection : Screen("lockscreen_shortcut_selection/{key}") {
data object Home : Screen("home")
data object ReadLogsSetup : Screen("read_logs_setup")
data object SecureSettingsSetup : Screen("secure_settings_setup")
data object AssistantButtonSettings : Screen("assistant_button_settings")
data object AssistantLaunchSelection : Screen("assistant_launch_selection")
data object LockscreenShortcutSettings : Screen("lockscreen_shortcut_settings")
data object LockscreenShortcutSelection : Screen("lockscreen_shortcut_selection/{key}") {
fun createRoute(key: String) = "lockscreen_shortcut_selection/$key"
}
object AndroidAppLinkSettings : Screen("android_app_link_settings")
object ApprovedLinkTargetList : Screen("approved_link_target_list")
object UnapprovedLinkTargetList : Screen("unapproved_link_target_list")
object LinkTargetInfoSheet : Screen("link_target_info_sheet/{packageName}") {
data object AndroidAppLinkSettings : Screen("android_app_link_settings")
data object ApprovedLinkTargetList : Screen("approved_link_target_list")
data object UnapprovedLinkTargetList : Screen("unapproved_link_target_list")
data object LinkTargetInfoSheet : Screen("link_target_info_sheet/{packageName}") {
fun createRoute(packageName: String) = "link_target_info_sheet/$packageName"

fun getPackageName(backStackEntry: NavBackStackEntry): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fun WriteSettingsCard(visible: Boolean = true, onButtonClicked: () -> Unit) {

@Preview
@Composable
fun PreferenceCardsPreview() {
private fun PreferenceCardsPreview() {
ShoukoM3PreviewTheme {
Surface(color = MaterialTheme.colorScheme.background) {
Column {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import androidx.compose.material3.Switch
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
Expand Down Expand Up @@ -97,12 +98,12 @@ fun SwitchPreference(

@Preview
@Composable
fun PreferenceItemsPreview() {
private fun PreferenceItemsPreview() {
var darkTheme by remember { mutableStateOf(false) }
ShoukoM3PreviewTheme(darkTheme = darkTheme) {
Surface(color = MaterialTheme.colorScheme.background) {
Column {
var count by remember { mutableStateOf(0) }
var count by remember { mutableIntStateOf(0) }
Text(text = "Preference clicked $count time(s)")
Preference(title = "Preference", subtitle = "With subtitle") { count += 1 }
Preference(title = "Preference") { count += 1 }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package xyz.ivaniskandar.shouko.ui.component

import androidx.compose.material3.Divider
import androidx.compose.material3.HorizontalDivider
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
Expand All @@ -9,7 +9,7 @@ import androidx.compose.ui.Modifier
fun SoftDivider(
modifier: Modifier = Modifier,
) {
Divider(
HorizontalDivider(
modifier = modifier,
color = MaterialTheme.colorScheme.onSurfaceVariant.copy(alpha = 0.12F),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Launch
import androidx.compose.material.icons.automirrored.filled.Launch
import androidx.compose.material.icons.outlined.Info
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.ButtonDefaults
Expand Down Expand Up @@ -180,7 +180,7 @@ fun CustomChooserToggle(checked: Boolean, onClick: () -> Unit) {

@Preview
@Composable
fun CustomChooserTogglePreview() {
private fun CustomChooserTogglePreview() {
ShoukoM3PreviewTheme {
CustomChooserToggle(checked = true) {}
}
Expand Down Expand Up @@ -242,7 +242,7 @@ fun LinkTargetList(
}

@Composable
fun LinkTargetListItem(item: LinkHandlerAppItem, onClick: () -> Unit) {
private fun LinkTargetListItem(item: LinkHandlerAppItem, onClick: () -> Unit) {
ListItem(
modifier = Modifier.clickable(onClick = onClick),
leadingContent = {
Expand Down Expand Up @@ -359,7 +359,7 @@ fun LinkTargetInfoSheet(
.padding(top = 24.dp, bottom = 8.dp),
) {
Icon(
Icons.Default.Launch,
Icons.AutoMirrored.Filled.Launch,
contentDescription = null,
modifier = Modifier.size(ButtonDefaults.IconSize),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ fun AssistantActionSelection(
contentPadding = PaddingValues(bottom = contentPadding.calculateBottomPadding()),
) {
item { CategoryHeader(title = stringResource(id = R.string.category_title_media_key)) }
items(MediaKeyAction.Key.values()) { item ->
items(MediaKeyAction.Key.entries.toTypedArray()) { item ->
CommonActionRow(
iconPainter = painterResource(id = item.iconResId),
label = stringResource(id = item.labelResId),
Expand Down Expand Up @@ -258,7 +258,7 @@ fun AssistantActionSelection(
},
)
}
items(StatusBarAction.PanelType.values()) { item ->
items(StatusBarAction.PanelType.entries.toTypedArray()) { item ->
CommonActionRow(
iconVector = item.iconVector,
label = stringResource(id = item.labelResId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fun KeyguardUnlock(onClick: () -> Unit) {

@Preview
@Composable
fun KeyguardUnlockPreview() {
private fun KeyguardUnlockPreview() {
ShoukoM3PreviewTheme {
KeyguardUnlock {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ fun PermissionSetupNoRoot(command: String) {

@Preview
@Composable
fun ReadLogsPermissionSetupRootPreview() {
private fun ReadLogsPermissionSetupRootPreview() {
ShoukoM3PreviewTheme {
Surface(color = MaterialTheme.colorScheme.background) {
PermissionSetup(
Expand All @@ -210,7 +210,7 @@ fun ReadLogsPermissionSetupRootPreview() {

@Preview
@Composable
fun ReadLogsPermissionSetupNoRootPreview() {
private fun ReadLogsPermissionSetupNoRootPreview() {
ShoukoM3PreviewTheme {
Surface(color = MaterialTheme.colorScheme.background) {
PermissionSetup(
Expand All @@ -226,7 +226,7 @@ fun ReadLogsPermissionSetupNoRootPreview() {

@Preview
@Composable
fun WriteSettingsPermissionSetupNoRootPreview() {
private fun WriteSettingsPermissionSetupNoRootPreview() {
ShoukoM3PreviewTheme {
Surface(color = MaterialTheme.colorScheme.background) {
PermissionSetup(
Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
kotlin_version = "1.9.22"
compose_bom_version = '2024.03.00-alpha01'
compose_compiler_version = '1.5.10'
kotlin_version = "1.9.24"
compose_bom_version = '2024.05.00-alpha02'
compose_compiler_version = '1.5.14'
protobuf_version = '3.25.3'
}
repositories {
Expand All @@ -12,7 +12,7 @@ buildscript {
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.0'
classpath 'com.android.tools.build:gradle:8.4.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.6'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.16.0'
Expand Down
2 changes: 0 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,5 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Tue Mar 07 12:57:38 ICT 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ dependencyResolutionManagement {
maven { url 'https://jitpack.io' }
}
}

rootProject.name = "XPERI+"
include ':app'

0 comments on commit 8c01067

Please sign in to comment.