Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5197800b55 | ||
|
|
6fe29dfe53 | ||
|
|
ea84410eb6 | ||
|
|
0a8a52ea3c | ||
|
|
d115339a99 | ||
|
|
0c01f0dba2 | ||
|
|
7b35b2eb80 | ||
|
|
3508205328 | ||
|
|
0c7ec55414 | ||
|
|
8cf43373c8 | ||
|
|
e14e402c2f |
No files matched your search
+75
-64
@@ -1,12 +1,14 @@
|
||||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("com.google.devtools.ksp")
|
||||
id("com.google.dagger.hilt.android")
|
||||
id("com.mikepenz.aboutlibraries.plugin")
|
||||
id("org.jetbrains.kotlin.plugin.serialization")
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
alias(libs.plugins.androidApplication)
|
||||
alias(libs.plugins.kotlinAndroid)
|
||||
alias(libs.plugins.kotlinCompose)
|
||||
alias(libs.plugins.hiltAndroid)
|
||||
alias(libs.plugins.ksp)
|
||||
alias(libs.plugins.aboutLibraries)
|
||||
alias(libs.plugins.kotlinSerialization)
|
||||
alias(libs.plugins.baselineProfile)
|
||||
}
|
||||
|
||||
ksp {
|
||||
arg("room.schemaLocation", "$projectDir/schemas")
|
||||
}
|
||||
@@ -19,8 +21,8 @@ android {
|
||||
applicationId = "com.anthonyla.paperize"
|
||||
minSdk = 26
|
||||
targetSdk = 35
|
||||
versionCode = 32
|
||||
versionName = "2.3.0"
|
||||
versionCode = 33
|
||||
versionName = "2.3.1"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
@@ -30,6 +32,7 @@ android {
|
||||
buildTypes {
|
||||
release {
|
||||
isMinifyEnabled = true
|
||||
isShrinkResources = true
|
||||
proguardFiles(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
@@ -38,12 +41,12 @@ android {
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
jvmTarget = "17"
|
||||
}
|
||||
|
||||
buildFeatures {
|
||||
@@ -52,16 +55,13 @@ android {
|
||||
buildConfig = true
|
||||
}
|
||||
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.5.15"
|
||||
}
|
||||
|
||||
@Suppress("UnstableApiUsage")
|
||||
androidResources {
|
||||
generateLocaleConfig = true
|
||||
}
|
||||
|
||||
ndkVersion = "26.3.11579264"
|
||||
buildToolsVersion = "34.0.0"
|
||||
ndkVersion = "28.0.12433566"
|
||||
buildToolsVersion = "35.0.0"
|
||||
dependenciesInfo {
|
||||
includeInApk = false
|
||||
includeInBundle = false
|
||||
@@ -70,6 +70,15 @@ android {
|
||||
aboutLibraries {
|
||||
excludeFields = arrayOf("generated")
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants { variant ->
|
||||
variant.outputs.forEach { output ->
|
||||
val apkName = "paperize-v${output.versionName}"
|
||||
output.versionName.set(apkName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
@@ -79,50 +88,52 @@ androidComponents {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.13.1")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.8.6")
|
||||
implementation("androidx.activity:activity-compose:1.9.2")
|
||||
implementation(platform("androidx.compose:compose-bom:2024.09.03"))
|
||||
implementation("androidx.compose.ui:ui:1.7.3")
|
||||
implementation("androidx.compose.ui:ui-graphics:1.7.3")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview:1.7.3")
|
||||
implementation("androidx.compose.material3:material3:1.3.0")
|
||||
implementation("androidx.navigation:navigation-compose:2.8.2")
|
||||
implementation("androidx.compose.material:material:1.7.3")
|
||||
implementation("androidx.datastore:datastore:1.1.1")
|
||||
implementation("androidx.datastore:datastore-preferences:1.1.1")
|
||||
implementation("androidx.compose.material:material-icons-extended:1.7.3")
|
||||
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
|
||||
implementation("androidx.compose.animation:animation:1.7.3")
|
||||
implementation("androidx.core:core-splashscreen:1.2.0-alpha02")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.6")
|
||||
implementation("com.google.code.gson:gson:2.11.0")
|
||||
implementation("androidx.documentfile:documentfile:1.1.0-alpha01")
|
||||
implementation("net.engawapg.lib:zoomable:2.0.0-beta01")
|
||||
implementation("com.github.skydoves:landscapist-glide:2.4.0")
|
||||
implementation("androidx.work:work-runtime-ktx:2.10.0-beta01")
|
||||
implementation("androidx.hilt:hilt-work:1.2.0")
|
||||
implementation("com.airbnb.android:lottie-compose:6.5.2")
|
||||
implementation("com.google.accompanist:accompanist-permissions:0.36.0")
|
||||
implementation("com.mikepenz:aboutlibraries-core:11.2.3")
|
||||
implementation("com.mikepenz:aboutlibraries-compose-m3:11.2.3")
|
||||
implementation("androidx.compose.foundation:foundation:1.7.3")
|
||||
implementation("com.github.nanihadesuka:LazyColumnScrollbar:2.2.0")
|
||||
implementation("com.joaomgcd:taskerpluginlibrary:0.4.10")
|
||||
implementation("com.google.ar.sceneform:filament-android:1.17.1")
|
||||
testImplementation("junit:junit:4.13.2")
|
||||
androidTestImplementation("androidx.test.ext:junit:1.2.1")
|
||||
androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
androidTestImplementation("androidx.compose.ui:ui-test-junit4:1.7.3")
|
||||
debugImplementation("androidx.compose.ui:ui-tooling:1.7.3")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest:1.7.3")
|
||||
implementation("com.google.dagger:hilt-android:2.52")
|
||||
ksp("com.google.dagger:hilt-android-compiler:2.52")
|
||||
implementation("androidx.room:room-runtime:2.6.1")
|
||||
ksp("androidx.room:room-compiler:2.6.1")
|
||||
implementation("androidx.room:room-ktx:2.6.1")
|
||||
implementation("com.lazygeniouz:dfc:1.0.8")
|
||||
implementation ("org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
|
||||
implementation("com.github.android:renderscript-intrinsics-replacement-toolkit:b6363490c3")
|
||||
implementation("me.onebone:toolbar-compose:2.3.5")
|
||||
implementation(libs.androidx.core.ktx)
|
||||
implementation(libs.androidx.lifecycle.runtime.ktx)
|
||||
implementation(libs.androidx.activity.compose)
|
||||
implementation(platform(libs.androidx.compose.bom))
|
||||
implementation(libs.androidx.ui)
|
||||
implementation(libs.androidx.ui.graphics)
|
||||
implementation(libs.androidx.ui.tooling.preview)
|
||||
implementation(libs.androidx.material3)
|
||||
implementation(libs.androidx.navigation.compose)
|
||||
implementation(libs.androidx.material)
|
||||
implementation(libs.androidx.datastore)
|
||||
implementation(libs.androidx.datastore.preferences)
|
||||
implementation(libs.androidx.material.icons.extended)
|
||||
implementation(libs.androidx.hilt.navigation.compose)
|
||||
implementation(libs.androidx.animation)
|
||||
implementation(libs.androidx.core.splashscreen)
|
||||
implementation(libs.androidx.lifecycle.runtime.compose)
|
||||
implementation(libs.gson)
|
||||
implementation(libs.androidx.documentfile)
|
||||
implementation(libs.zoomable)
|
||||
implementation(libs.landscapist.glide)
|
||||
implementation(libs.androidx.work.runtime.ktx)
|
||||
implementation(libs.androidx.hilt.work)
|
||||
implementation(libs.lottie.compose)
|
||||
implementation(libs.accompanist.permissions)
|
||||
implementation(libs.aboutlibraries.core)
|
||||
implementation(libs.aboutlibraries.compose.m3)
|
||||
implementation(libs.androidx.foundation)
|
||||
implementation(libs.lazycolumnscrollbar)
|
||||
implementation(libs.taskerpluginlibrary)
|
||||
implementation(libs.filament.android)
|
||||
implementation(libs.androidx.profileinstaller)
|
||||
testImplementation(libs.junit)
|
||||
androidTestImplementation(libs.androidx.junit)
|
||||
androidTestImplementation(libs.androidx.espresso.core)
|
||||
androidTestImplementation(libs.androidx.ui.test.junit4)
|
||||
"baselineProfile"(project(":baselineprofile"))
|
||||
debugImplementation(libs.androidx.ui.tooling)
|
||||
debugImplementation(libs.androidx.ui.test.manifest)
|
||||
implementation(libs.hilt.android)
|
||||
ksp(libs.hilt.android.compiler)
|
||||
implementation(libs.androidx.room.runtime)
|
||||
ksp(libs.androidx.room.compiler)
|
||||
implementation(libs.androidx.room.ktx)
|
||||
implementation(libs.dfc)
|
||||
implementation (libs.kotlinx.serialization.json)
|
||||
implementation(libs.renderscript.intrinsics.replacement.toolkit)
|
||||
implementation(libs.toolbar.compose)
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package com.anthonyla.paperize
|
||||
import android.app.Application
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import dagger.hilt.android.HiltAndroidApp
|
||||
|
||||
/**
|
||||
@@ -14,7 +13,7 @@ class App: Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
val channel = NotificationChannel("wallpaper_service_channel", "Paperize", NotificationManager.IMPORTANCE_LOW)
|
||||
val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
val notificationManager = getSystemService(NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationManager.createNotificationChannel(channel)
|
||||
}
|
||||
}
|
||||
+19
-4
@@ -22,10 +22,14 @@ import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.text.input.ImeAction
|
||||
import androidx.compose.ui.text.input.KeyboardType
|
||||
import androidx.compose.ui.unit.dp
|
||||
@@ -37,6 +41,7 @@ import kotlinx.coroutines.android.awaitFrame
|
||||
/**
|
||||
* Dialog for adding a new album.
|
||||
*/
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun AddAlbumDialog(
|
||||
onDismissRequest: () -> Unit,
|
||||
@@ -44,11 +49,16 @@ fun AddAlbumDialog(
|
||||
) {
|
||||
val focusRequester = remember { FocusRequester() }
|
||||
var albumName by rememberSaveable { mutableStateOf("") }
|
||||
Dialog(onDismissRequest = onDismissRequest) {
|
||||
Dialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
) {
|
||||
Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(24.dp),
|
||||
.padding(24.dp)
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
},
|
||||
shape = RoundedCornerShape(16.dp),
|
||||
colors = CardDefaults.cardColors(
|
||||
containerColor = MaterialTheme.colorScheme.surface,
|
||||
@@ -99,7 +109,10 @@ fun AddAlbumDialog(
|
||||
onClick = { onDismissRequest() },
|
||||
modifier = Modifier.padding(8.dp),
|
||||
) {
|
||||
Text(stringResource(R.string.cancel))
|
||||
Text(
|
||||
text = stringResource(R.string.cancel),
|
||||
modifier = Modifier.testTag("paperize:cancel_album_button")
|
||||
)
|
||||
}
|
||||
TextButton(
|
||||
modifier = Modifier.padding(8.dp),
|
||||
@@ -110,7 +123,9 @@ fun AddAlbumDialog(
|
||||
}
|
||||
}
|
||||
) {
|
||||
Text(stringResource(R.string.save))
|
||||
Text(
|
||||
text = stringResource(R.string.save),
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -21,7 +21,11 @@ import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.anthonyla.paperize.core.ScalingConstants
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperAndFolder
|
||||
@@ -32,7 +36,7 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.home_screen.compone
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.library_screen.LibraryScreen
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.WallpaperScreen
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun HomeScreen(
|
||||
albums: List<AlbumWithWallpaperAndFolder>,
|
||||
@@ -105,6 +109,9 @@ fun HomeScreen(
|
||||
}
|
||||
|
||||
Scaffold (
|
||||
modifier = Modifier.semantics {
|
||||
testTagsAsResourceId = true
|
||||
},
|
||||
topBar = {
|
||||
HomeTopBar(
|
||||
showSelectionModeAppBar = false,
|
||||
@@ -141,7 +148,8 @@ fun HomeScreen(
|
||||
imageVector = if (index == tabIndex) item.filledIcon else item.unfilledIcon,
|
||||
contentDescription = item.title
|
||||
)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.testTag("paperize:${item.title}_button"),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+2
@@ -27,6 +27,7 @@ import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.anthonyla.paperize.R
|
||||
@@ -91,6 +92,7 @@ fun HomeTopBar (
|
||||
} else {
|
||||
IconButton(
|
||||
onClick = { onSettingsClick() },
|
||||
modifier = Modifier.testTag("paperize:home_to_settings_button"),
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.Outlined.Settings,
|
||||
|
||||
+11
-1
@@ -15,13 +15,18 @@ import androidx.compose.material3.LargeFloatingActionButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.anthonyla.paperize.R
|
||||
import com.anthonyla.paperize.feature.wallpaper.domain.model.AlbumWithWallpaperAndFolder
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.album.components.AlbumItem
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun LibraryScreen(
|
||||
albums: List<AlbumWithWallpaperAndFolder>,
|
||||
@@ -30,12 +35,17 @@ fun LibraryScreen(
|
||||
) {
|
||||
val lazyListState = rememberLazyGridState()
|
||||
Scaffold(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
},
|
||||
floatingActionButton = {
|
||||
LargeFloatingActionButton(
|
||||
containerColor = MaterialTheme.colorScheme.primaryContainer,
|
||||
contentColor = MaterialTheme.colorScheme.onPrimaryContainer,
|
||||
onClick = onAddNewAlbumClick,
|
||||
modifier = Modifier.testTag("paperize:library_floating_button")
|
||||
) {
|
||||
Icon(
|
||||
Icons.Filled.Add,
|
||||
|
||||
-46
@@ -1,46 +0,0 @@
|
||||
package com.anthonyla.paperize.feature.wallpaper.presentation.library_screen.components
|
||||
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.Dp
|
||||
import androidx.compose.ui.unit.dp
|
||||
|
||||
/**
|
||||
* A row that contains an icon, text, and an onClick listener.
|
||||
*/
|
||||
@Composable
|
||||
fun MenuRow(text: String, icon: ImageVector?, horizontalExpansion: Dp, onClick: () -> Unit) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.width(horizontalExpansion)
|
||||
.clickable { onClick() },
|
||||
horizontalArrangement = Arrangement.Center,
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
) {
|
||||
if (icon != null) {
|
||||
Icon(
|
||||
imageVector = icon,
|
||||
contentDescription = text,
|
||||
modifier = Modifier.padding(12.dp)
|
||||
)
|
||||
}
|
||||
Spacer(modifier = Modifier.weight(1f))
|
||||
Text(
|
||||
text = text,
|
||||
overflow = TextOverflow.Visible,
|
||||
maxLines = 1,
|
||||
modifier = Modifier.padding(end = 20.dp)
|
||||
)
|
||||
}
|
||||
}
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
package com.anthonyla.paperize.feature.wallpaper.presentation.library_screen.components
|
||||
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
|
||||
/**
|
||||
* Data class for selection options
|
||||
*/
|
||||
data class SelectionOptions(
|
||||
val id: String = "",
|
||||
val text: String = "",
|
||||
val subText: String? = "",
|
||||
val icon: ImageVector? = null
|
||||
)
|
||||
+10
-1
@@ -25,11 +25,14 @@ import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.airbnb.lottie.compose.LottieAnimation
|
||||
@@ -39,6 +42,7 @@ import com.airbnb.lottie.compose.animateLottieCompositionAsState
|
||||
import com.airbnb.lottie.compose.rememberLottieComposition
|
||||
import com.anthonyla.paperize.R
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun NotificationScreen(
|
||||
onAgree: () -> Unit
|
||||
@@ -74,6 +78,9 @@ fun NotificationScreen(
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
modifier = Modifier.semantics {
|
||||
testTagsAsResourceId = true
|
||||
},
|
||||
content = { it
|
||||
Column (modifier = Modifier.padding(32.dp)) {
|
||||
Spacer(modifier = Modifier.height(120.dp))
|
||||
@@ -102,7 +109,9 @@ fun NotificationScreen(
|
||||
},
|
||||
floatingActionButton = {
|
||||
ExtendedFloatingActionButton(
|
||||
modifier = Modifier.padding(8.dp),
|
||||
modifier = Modifier
|
||||
.padding(8.dp)
|
||||
.testTag("paperize:floating_notification_button"),
|
||||
onClick = { askPermission.value = true },
|
||||
icon = {
|
||||
Icon(
|
||||
|
||||
+11
-3
@@ -27,9 +27,13 @@ import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.material3.surfaceColorAtElevation
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.lerp
|
||||
import androidx.compose.ui.unit.sp
|
||||
@@ -52,7 +56,7 @@ import me.onebone.toolbar.CollapsingToolbarScaffold
|
||||
import me.onebone.toolbar.ScrollStrategy
|
||||
import me.onebone.toolbar.rememberCollapsingToolbarScaffoldState
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun SettingsScreen(
|
||||
settingsState: StateFlow<SettingsState>,
|
||||
@@ -88,7 +92,9 @@ fun SettingsScreen(
|
||||
val dynamicPaddingStart = lerp(firstPaddingInterpolation, secondPaddingInterpolation, collapseFraction)
|
||||
val textSize = (titleFontScaleEnd + (titleFontScaleStart - titleFontScaleEnd) * collapseFraction).sp
|
||||
|
||||
Scaffold {
|
||||
Scaffold(
|
||||
modifier = Modifier.semantics { testTagsAsResourceId = true },
|
||||
) {
|
||||
CollapsingToolbarScaffold(
|
||||
state = topBarState,
|
||||
modifier = Modifier.fillMaxSize().padding(it),
|
||||
@@ -106,6 +112,7 @@ fun SettingsScreen(
|
||||
modifier = Modifier
|
||||
.padding(16.dp)
|
||||
.size(24.dp)
|
||||
.testTag("paperize:settings_to_home_button"),
|
||||
) {
|
||||
Icon(
|
||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||
@@ -129,7 +136,8 @@ fun SettingsScreen(
|
||||
modifier = Modifier
|
||||
.verticalScroll(rememberScrollState())
|
||||
.fillMaxSize()
|
||||
.padding(horizontal = 24.dp),
|
||||
.padding(horizontal = 24.dp)
|
||||
.testTag("paperize:settings_column"),
|
||||
) {
|
||||
ListSectionTitle(stringResource(R.string.appearance))
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
+24
-4
@@ -34,11 +34,14 @@ import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.semantics.contentDescription
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.airbnb.lottie.compose.LottieAnimation
|
||||
@@ -50,6 +53,7 @@ import com.anthonyla.paperize.R
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
// Inspired by https://github.com/Ashinch/ReadYou
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun StartupScreen(
|
||||
onAgree: () -> Unit
|
||||
@@ -71,13 +75,20 @@ fun StartupScreen(
|
||||
}
|
||||
|
||||
Scaffold(
|
||||
modifier = Modifier.semantics {
|
||||
testTagsAsResourceId = true
|
||||
},
|
||||
snackbarHost = {
|
||||
SnackbarHost(
|
||||
hostState = snackbarHostState,
|
||||
snackbar = { data ->
|
||||
Snackbar(
|
||||
snackbarData = data,
|
||||
modifier = Modifier.padding(PaddingValues(horizontal = 8.dp)),
|
||||
modifier = Modifier
|
||||
.padding(PaddingValues(horizontal = 8.dp))
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
},
|
||||
shape = RoundedCornerShape(24.dp)
|
||||
)
|
||||
}
|
||||
@@ -118,7 +129,9 @@ fun StartupScreen(
|
||||
snackbarHostState.currentSnackbarData?.dismiss()
|
||||
showToS = true
|
||||
} },
|
||||
modifier = Modifier.padding(PaddingValues(vertical = 16.dp)),
|
||||
modifier = Modifier
|
||||
.padding(PaddingValues(vertical = 16.dp))
|
||||
.testTag("paperize:privacy_notice_button"),
|
||||
) {
|
||||
Text(text = stringResource(R.string.privacy_notice), textAlign = TextAlign.Start)
|
||||
}
|
||||
@@ -127,7 +140,9 @@ fun StartupScreen(
|
||||
},
|
||||
floatingActionButton = {
|
||||
ExtendedFloatingActionButton(
|
||||
modifier = Modifier.padding(8.dp),
|
||||
modifier = Modifier
|
||||
.padding(8.dp)
|
||||
.testTag("paperize:floating_agree_button"),
|
||||
onClick = {
|
||||
if (seenToS) {
|
||||
onAgree()
|
||||
@@ -161,7 +176,11 @@ fun StartupScreen(
|
||||
if (showToS) {
|
||||
seenToS = true
|
||||
AlertDialog(
|
||||
modifier = Modifier.fillMaxHeight(0.7f),
|
||||
modifier = Modifier
|
||||
.fillMaxHeight(0.7f)
|
||||
.semantics {
|
||||
testTagsAsResourceId = true
|
||||
},
|
||||
onDismissRequest = { showToS = false },
|
||||
title = {
|
||||
Box(modifier = Modifier.fillMaxWidth()) {
|
||||
@@ -176,6 +195,7 @@ fun StartupScreen(
|
||||
confirmButton = {
|
||||
Button(
|
||||
onClick = { showToS = false },
|
||||
modifier = Modifier.testTag("paperize:dismiss_button"),
|
||||
) {
|
||||
Text(stringResource(R.string.dismiss))
|
||||
}
|
||||
|
||||
+7
-2
@@ -26,8 +26,11 @@ import androidx.compose.runtime.rememberCoroutineScope
|
||||
import androidx.compose.runtime.saveable.rememberSaveable
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.ExperimentalComposeUiApi
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.semantics.semantics
|
||||
import androidx.compose.ui.semantics.testTagsAsResourceId
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.anthonyla.paperize.R
|
||||
@@ -47,7 +50,7 @@ import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.co
|
||||
import com.anthonyla.paperize.feature.wallpaper.presentation.wallpaper_screen.components.WallpaperPreviewAndScale
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@OptIn(ExperimentalMaterial3Api::class, ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun WallpaperScreen(
|
||||
albums: List<AlbumWithWallpaperAndFolder>,
|
||||
@@ -123,7 +126,9 @@ fun WallpaperScreen(
|
||||
)
|
||||
}
|
||||
) },
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.semantics { testTagsAsResourceId = true },
|
||||
content = { padding ->
|
||||
Column(
|
||||
modifier = Modifier
|
||||
|
||||
+5
-2
@@ -9,6 +9,7 @@ import androidx.compose.material3.SegmentedButtonDefaults
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.anthonyla.paperize.R
|
||||
@@ -28,14 +29,16 @@ fun ChangerSelectionRow(
|
||||
SegmentedButton(
|
||||
shape = SegmentedButtonDefaults.itemShape(index = 0, count = 2),
|
||||
onCheckedChange = onLockCheckedChange,
|
||||
checked = lockEnabled
|
||||
checked = lockEnabled,
|
||||
modifier = Modifier.testTag("paperize:lock_button"),
|
||||
) {
|
||||
Text(stringResource(R.string.lock_screen_btn))
|
||||
}
|
||||
SegmentedButton(
|
||||
shape = SegmentedButtonDefaults.itemShape(index = 1, count = 2),
|
||||
onCheckedChange = onHomeCheckedChange,
|
||||
checked = homeEnabled
|
||||
checked = homeEnabled,
|
||||
modifier = Modifier.testTag("paperize:home_button"),
|
||||
) {
|
||||
Text(text = stringResource(R.string.home_screen_btn))
|
||||
}
|
||||
|
||||
+2
@@ -25,6 +25,7 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.testTag
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
@@ -80,6 +81,7 @@ fun IndividualSchedulingAndToggleRow(
|
||||
Switch(
|
||||
checked = scheduleSeparately,
|
||||
onCheckedChange = onScheduleSeparatelyChange,
|
||||
modifier = Modifier.testTag("paperize:individual_scheduling_switch"),
|
||||
)
|
||||
}
|
||||
if (animate) {
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1 @@
|
||||
/build
|
||||
@@ -0,0 +1,65 @@
|
||||
import com.android.build.api.dsl.ManagedVirtualDevice
|
||||
|
||||
plugins {
|
||||
id("com.android.test")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
id("androidx.baselineprofile")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.anthonyla.paperize.baselineprofile"
|
||||
compileSdk = 34
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
minSdk = 28
|
||||
targetSdk = 34
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
|
||||
targetProjectPath = ":app"
|
||||
|
||||
// This code creates the gradle managed device used to generate baseline profiles.
|
||||
// To use GMD please invoke generation through the command line:
|
||||
// ./gradlew :app:generateBaselineProfile
|
||||
testOptions.managedDevices.devices {
|
||||
create<ManagedVirtualDevice>("pixel6Api34") {
|
||||
device = "Pixel 6"
|
||||
apiLevel = 34
|
||||
systemImageSource = "google"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is the configuration block for the Baseline Profile plugin.
|
||||
// You can specify to run the generators on a managed devices or connected devices.
|
||||
baselineProfile {
|
||||
managedDevices += "pixel6Api34"
|
||||
useConnectedDevices = false
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.test.ext:junit:1.2.1")
|
||||
implementation("androidx.test.espresso:espresso-core:3.6.1")
|
||||
implementation("androidx.test.uiautomator:uiautomator:2.3.0")
|
||||
implementation("androidx.benchmark:benchmark-macro-junit4:1.3.2")
|
||||
}
|
||||
|
||||
androidComponents {
|
||||
onVariants { v ->
|
||||
val artifactsLoader = v.artifacts.getBuiltArtifactsLoader()
|
||||
v.instrumentationRunnerArguments.put(
|
||||
"targetAppId",
|
||||
v.testedApks.map { artifactsLoader.load(it)?.applicationId }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<manifest />
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
package com.anthonyla.paperize.baselineprofile
|
||||
|
||||
import androidx.benchmark.macro.junit4.BaselineProfileRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* This test class generates a basic startup baseline profile for the target package.
|
||||
*
|
||||
* We recommend you start with this but add important user flows to the profile to improve their performance.
|
||||
* Refer to the [baseline profile documentation](https://d.android.com/topic/performance/baselineprofiles)
|
||||
* for more information.
|
||||
*
|
||||
* You can run the generator with the "Generate Baseline Profile" run configuration in Android Studio or
|
||||
* the equivalent `generateBaselineProfile` gradle task:
|
||||
* ```
|
||||
* ./gradlew :app:generateReleaseBaselineProfile
|
||||
* ```
|
||||
* The run configuration runs the Gradle task and applies filtering to run only the generators.
|
||||
*
|
||||
* Check [documentation](https://d.android.com/topic/performance/benchmarking/macrobenchmark-instrumentation-args)
|
||||
* for more information about available instrumentation arguments.
|
||||
*
|
||||
* After you run the generator, you can verify the improvements running the [StartupBenchmarks] benchmark.
|
||||
*
|
||||
* When using this class to generate a baseline profile, only API 33+ or rooted API 28+ are supported.
|
||||
*
|
||||
* The minimum required version of androidx.benchmark to generate a baseline profile is 1.2.0.
|
||||
**/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@LargeTest
|
||||
class BaselineProfileGenerator {
|
||||
|
||||
@get:Rule
|
||||
val rule = BaselineProfileRule()
|
||||
|
||||
@Test
|
||||
fun generate() {
|
||||
// The application id for the running build variant is read from the instrumentation arguments.
|
||||
rule.collect(
|
||||
packageName = InstrumentationRegistry.getArguments().getString("targetAppId")
|
||||
?: throw Exception("targetAppId not passed as instrumentation runner arg"),
|
||||
|
||||
// See: https://d.android.com/topic/performance/baselineprofiles/dex-layout-optimizations
|
||||
includeInStartupProfile = true
|
||||
) {
|
||||
// This block defines the app's critical user journey. Here we are interested in
|
||||
// optimizing for app startup. But you can also navigate and scroll through your most important UI.
|
||||
InstrumentationRegistry.getInstrumentation().uiAutomation.executeShellCommand("pm clear $packageName").close()
|
||||
// Start default activity for your app
|
||||
pressHome()
|
||||
startActivityAndWait()
|
||||
PaperizeScenarios.runStartingScenario(device)
|
||||
}
|
||||
}
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.anthonyla.paperize.baselineprofile
|
||||
|
||||
import android.os.SystemClock
|
||||
import androidx.test.uiautomator.By
|
||||
import androidx.test.uiautomator.BySelector
|
||||
import androidx.test.uiautomator.Direction
|
||||
import androidx.test.uiautomator.SearchCondition
|
||||
import androidx.test.uiautomator.UiDevice
|
||||
import androidx.test.uiautomator.UiObject2
|
||||
import androidx.test.uiautomator.UiSelector
|
||||
import androidx.test.uiautomator.Until
|
||||
import kotlin.time.Duration
|
||||
import kotlin.time.Duration.Companion.seconds
|
||||
|
||||
object PaperizeScenarios {
|
||||
fun runStartingScenario(device: UiDevice) {
|
||||
device.waitForIdle()
|
||||
device.testWelcome()
|
||||
device.testNotifications()
|
||||
device.testSettings()
|
||||
device.testLibrary()
|
||||
device.testWallpaper()
|
||||
}
|
||||
}
|
||||
|
||||
private fun UiDevice.testWelcome(): Boolean {
|
||||
runAction(By.res("paperize:privacy_notice_button")) { click() }
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:dismiss_button")) { click() }
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:floating_agree_button")) { click() }
|
||||
waitForIdle()
|
||||
return true
|
||||
}
|
||||
|
||||
fun UiDevice.testNotifications(): Boolean {
|
||||
runAction(By.res("paperize:floating_notification_button")) { click() }
|
||||
waitForIdle()
|
||||
return findObject(UiSelector().text("Allow")).run {
|
||||
try {
|
||||
click()
|
||||
waitForIdle()
|
||||
true
|
||||
} catch (_: Exception) {
|
||||
waitForIdle()
|
||||
false
|
||||
}
|
||||
} == true
|
||||
}
|
||||
|
||||
fun UiDevice.testSettings(): Boolean {
|
||||
runAction(By.res("paperize:home_to_settings_button")) { click() }
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:settings_column")) {
|
||||
setGestureMargins(this)
|
||||
scroll(Direction.DOWN, 1f)
|
||||
scroll(Direction.DOWN, 1f)
|
||||
}
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:settings_column")) {
|
||||
setGestureMargins(this)
|
||||
scroll(Direction.UP, 1f)
|
||||
scroll(Direction.UP, 1f)
|
||||
}
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:settings_to_home_button")) { click() }
|
||||
waitForIdle()
|
||||
return true
|
||||
}
|
||||
|
||||
fun UiDevice.testWallpaper(): Boolean {
|
||||
runAction(By.res("paperize:lock_button")) { click() }
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:home_button")) { click() }
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:individual_scheduling_switch")) { click() }
|
||||
waitForIdle()
|
||||
return true
|
||||
}
|
||||
|
||||
fun UiDevice.testLibrary(): Boolean {
|
||||
runAction(By.res("paperize:Library_button")) { click() }
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:library_floating_button")) { click() }
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:cancel_album_button")) { click() }
|
||||
waitForIdle()
|
||||
runAction(By.res("paperize:Wallpaper_button")) { click() }
|
||||
waitForIdle()
|
||||
return true
|
||||
}
|
||||
|
||||
/** https://github.com/chrisbanes/tivi/blob/main/android-app/common-test/src/main/kotlin/app/tivi/app/test/AppScenarios.kt */
|
||||
private fun UiDevice.runAction(
|
||||
selector: BySelector,
|
||||
maxRetries: Int = 6,
|
||||
action: UiObject2.() -> Unit,
|
||||
) {
|
||||
waitForObject(selector)
|
||||
|
||||
retry(maxRetries = maxRetries, delay = 1.seconds) {
|
||||
waitForIdle()
|
||||
requireNotNull(findObject(selector)).action()
|
||||
}
|
||||
}
|
||||
private fun retry(maxRetries: Int, delay: Duration, block: () -> Unit) {
|
||||
repeat(maxRetries) { run ->
|
||||
val result = runCatching { block() }
|
||||
if (result.isSuccess) { return }
|
||||
if (run == maxRetries - 1) {
|
||||
result.getOrThrow()
|
||||
} else {
|
||||
SystemClock.sleep(delay.inWholeMilliseconds)
|
||||
}
|
||||
}
|
||||
}
|
||||
private fun UiDevice.setGestureMargins(uiObject: UiObject2) {
|
||||
uiObject.setGestureMargins(
|
||||
(displayWidth * 0.1f).toInt(),
|
||||
(displayHeight * 0.2f).toInt(),
|
||||
(displayWidth * 0.1f).toInt(),
|
||||
(displayHeight * 0.2f).toInt(),
|
||||
)
|
||||
}
|
||||
private fun UiDevice.waitForObject(selector: BySelector, timeout: Duration = 5.seconds): UiObject2 {
|
||||
if (wait(Until.hasObject(selector), timeout)) {
|
||||
return findObject(selector)
|
||||
}
|
||||
error("Object with selector [$selector] not found")
|
||||
}
|
||||
private fun <R> UiDevice.wait(condition: SearchCondition<R>, timeout: Duration): R {
|
||||
return wait(condition, timeout.inWholeMilliseconds)
|
||||
}
|
||||
/** https://github.com/chrisbanes/tivi/blob/main/android-app/common-test/src/main/kotlin/app/tivi/app/test/AppScenarios.kt */
|
||||
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
package com.anthonyla.paperize.baselineprofile
|
||||
|
||||
import androidx.benchmark.macro.BaselineProfileMode
|
||||
import androidx.benchmark.macro.CompilationMode
|
||||
import androidx.benchmark.macro.StartupMode
|
||||
import androidx.benchmark.macro.StartupTimingMetric
|
||||
import androidx.benchmark.macro.junit4.MacrobenchmarkRule
|
||||
import androidx.test.ext.junit.runners.AndroidJUnit4
|
||||
import androidx.test.filters.LargeTest
|
||||
import androidx.test.platform.app.InstrumentationRegistry
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
/**
|
||||
* This test class benchmarks the speed of app startup.
|
||||
* Run this benchmark to verify how effective a Baseline Profile is.
|
||||
* It does this by comparing [CompilationMode.None], which represents the app with no Baseline
|
||||
* Profiles optimizations, and [CompilationMode.Partial], which uses Baseline Profiles.
|
||||
*
|
||||
* Run this benchmark to see startup measurements and captured system traces for verifying
|
||||
* the effectiveness of your Baseline Profiles. You can run it directly from Android
|
||||
* Studio as an instrumentation test, or run all benchmarks for a variant, for example benchmarkRelease,
|
||||
* with this Gradle task:
|
||||
* ```
|
||||
* ./gradlew :baselineprofile:connectedBenchmarkReleaseAndroidTest
|
||||
* ```
|
||||
*
|
||||
* You should run the benchmarks on a physical device, not an Android emulator, because the
|
||||
* emulator doesn't represent real world performance and shares system resources with its host.
|
||||
*
|
||||
* For more information, see the [Macrobenchmark documentation](https://d.android.com/macrobenchmark#create-macrobenchmark)
|
||||
* and the [instrumentation arguments documentation](https://d.android.com/topic/performance/benchmarking/macrobenchmark-instrumentation-args).
|
||||
**/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
@LargeTest
|
||||
class StartupBenchmarks {
|
||||
|
||||
@get:Rule
|
||||
val rule = MacrobenchmarkRule()
|
||||
|
||||
@Test
|
||||
fun startupCompilationNone() =
|
||||
benchmark(CompilationMode.None())
|
||||
|
||||
@Test
|
||||
fun startupCompilationBaselineProfiles() =
|
||||
benchmark(CompilationMode.Partial(BaselineProfileMode.Require))
|
||||
|
||||
private fun benchmark(compilationMode: CompilationMode) {
|
||||
// The application id for the running build variant is read from the instrumentation arguments.
|
||||
rule.measureRepeated(
|
||||
packageName = InstrumentationRegistry.getArguments().getString("targetAppId")
|
||||
?: throw Exception("targetAppId not passed as instrumentation runner arg"),
|
||||
metrics = listOf(StartupTimingMetric()),
|
||||
compilationMode = compilationMode,
|
||||
startupMode = StartupMode.COLD,
|
||||
iterations = 10,
|
||||
setupBlock = {
|
||||
InstrumentationRegistry.getInstrumentation().uiAutomation.executeShellCommand("pm clear $packageName").close()
|
||||
pressHome()
|
||||
},
|
||||
measureBlock = {
|
||||
startActivityAndWait()
|
||||
PaperizeScenarios.runStartingScenario(device)
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
+12
-8
@@ -1,3 +1,5 @@
|
||||
import org.gradle.kotlin.dsl.libs
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
google()
|
||||
@@ -6,14 +8,16 @@ buildscript {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("com.android.application") version "8.7.0" apply false
|
||||
id("com.android.library") version "8.7.0" apply false
|
||||
id("org.jetbrains.kotlin.android") version "2.0.20" apply false
|
||||
id ("org.jetbrains.kotlin.plugin.compose") version "2.0.20" apply false
|
||||
id("com.google.dagger.hilt.android") version "2.52" apply false
|
||||
id("com.google.devtools.ksp") version "2.0.20-1.0.25" apply false
|
||||
id ("com.mikepenz.aboutlibraries.plugin") version "11.2.3" apply false
|
||||
id ("org.jetbrains.kotlin.plugin.serialization") version "2.0.20" apply false
|
||||
alias(libs.plugins.androidApplication) apply false
|
||||
alias(libs.plugins.androidLibrary) apply false
|
||||
alias(libs.plugins.kotlinAndroid) apply false
|
||||
alias(libs.plugins.kotlinCompose) apply false
|
||||
alias(libs.plugins.hiltAndroid) apply false
|
||||
alias(libs.plugins.ksp) apply false
|
||||
alias(libs.plugins.aboutLibraries) apply false
|
||||
alias(libs.plugins.kotlinSerialization) apply false
|
||||
alias(libs.plugins.androidTest) apply false
|
||||
alias(libs.plugins.baselineProfile) apply false
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -21,4 +21,5 @@ kotlin.code.style=official
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
org.gradle.configuration-cache=true
|
||||
org.gradle.configuration-cache=true
|
||||
@@ -0,0 +1,105 @@
|
||||
[versions]
|
||||
androidGradlePlugin = "8.7.0"
|
||||
kotlin = "2.0.21"
|
||||
hilt = "2.52"
|
||||
ksp = "2.0.21-1.0.25"
|
||||
aboutLibraries = "11.2.3"
|
||||
baselineProfile = "1.3.2"
|
||||
accompanistPermissions = "0.36.0"
|
||||
aboutlibrariesCore = "11.2.3"
|
||||
activityCompose = "1.9.2"
|
||||
animation = "1.7.3"
|
||||
composeBom = "2024.09.03"
|
||||
coreKtx = "1.13.1"
|
||||
coreSplashscreen = "1.2.0-alpha02"
|
||||
datastore = "1.1.1"
|
||||
datastorePreferences = "1.1.1"
|
||||
dfc = "1.0.8"
|
||||
espressoCore = "3.6.1"
|
||||
filamentAndroid = "1.17.1"
|
||||
foundation = "1.7.3"
|
||||
gson = "2.11.0"
|
||||
documentfile = "1.1.0-alpha01"
|
||||
hiltAndroid = "2.52"
|
||||
hiltAndroidCompiler = "2.52"
|
||||
hiltNavigationCompose = "1.2.0"
|
||||
junit = "4.13.2"
|
||||
junitVersion = "1.2.1"
|
||||
kotlinxSerializationJson = "1.7.3"
|
||||
landscapistGlide = "2.4.0"
|
||||
lazycolumnscrollbar = "2.2.0"
|
||||
lifecycleRuntimeKtx = "2.8.6"
|
||||
lottieCompose = "6.5.2"
|
||||
material = "1.7.3"
|
||||
material3 = "1.3.0"
|
||||
navigationCompose = "2.8.2"
|
||||
profileinstaller = "1.4.1"
|
||||
renderscriptIntrinsicsReplacementToolkit = "b6363490c3"
|
||||
roomRuntime = "2.6.1"
|
||||
roomCompiler = "2.6.1"
|
||||
taskerpluginlibrary = "0.4.10"
|
||||
toolbarCompose = "2.3.5"
|
||||
ui = "1.7.3"
|
||||
workRuntimeKtx = "2.10.0-beta01"
|
||||
zoomable = "2.0.0-beta01"
|
||||
|
||||
[libraries]
|
||||
aboutlibraries-compose-m3 = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "aboutlibrariesCore" }
|
||||
aboutlibraries-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "aboutlibrariesCore" }
|
||||
accompanist-permissions = { module = "com.google.accompanist:accompanist-permissions", version.ref = "accompanistPermissions" }
|
||||
androidx-activity-compose = { module = "androidx.activity:activity-compose", version.ref = "activityCompose" }
|
||||
androidx-animation = { module = "androidx.compose.animation:animation", version.ref = "animation" }
|
||||
androidx-compose-bom = { module = "androidx.compose:compose-bom", version.ref = "composeBom" }
|
||||
androidx-core-ktx = { module = "androidx.core:core-ktx", version.ref = "coreKtx" }
|
||||
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" }
|
||||
androidx-datastore-preferences = { module = "androidx.datastore:datastore-preferences", version.ref = "datastorePreferences" }
|
||||
androidx-datastore = { module = "androidx.datastore:datastore", version.ref = "datastore" }
|
||||
androidx-documentfile = { module = "androidx.documentfile:documentfile", version.ref = "documentfile" }
|
||||
androidx-espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
|
||||
androidx-foundation = { module = "androidx.compose.foundation:foundation", version.ref = "foundation" }
|
||||
androidx-hilt-navigation-compose = { module = "androidx.hilt:hilt-navigation-compose", version.ref = "hiltNavigationCompose" }
|
||||
androidx-hilt-work = { module = "androidx.hilt:hilt-work", version.ref = "hiltNavigationCompose" }
|
||||
androidx-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
|
||||
androidx-lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycleRuntimeKtx" }
|
||||
androidx-lifecycle-runtime-ktx = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
|
||||
androidx-material = { module = "androidx.compose.material:material", version.ref = "material" }
|
||||
androidx-material-icons-extended = { module = "androidx.compose.material:material-icons-extended", version.ref = "material" }
|
||||
androidx-material3 = { module = "androidx.compose.material3:material3", version.ref = "material3" }
|
||||
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "navigationCompose" }
|
||||
androidx-profileinstaller = { module = "androidx.profileinstaller:profileinstaller", version.ref = "profileinstaller" }
|
||||
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "roomRuntime" }
|
||||
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "roomCompiler" }
|
||||
androidx-room-runtime = { module = "androidx.room:room-runtime", version.ref = "roomRuntime" }
|
||||
androidx-ui = { module = "androidx.compose.ui:ui", version.ref = "ui" }
|
||||
androidx-ui-graphics = { module = "androidx.compose.ui:ui-graphics", version.ref = "ui" }
|
||||
androidx-ui-test-junit4 = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "ui" }
|
||||
androidx-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "ui" }
|
||||
androidx-ui-tooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "ui" }
|
||||
androidx-ui-tooling-preview = { module = "androidx.compose.ui:ui-tooling-preview", version.ref = "ui" }
|
||||
androidx-work-runtime-ktx = { module = "androidx.work:work-runtime-ktx", version.ref = "workRuntimeKtx" }
|
||||
dfc = { module = "com.lazygeniouz:dfc", version.ref = "dfc" }
|
||||
filament-android = { module = "com.google.ar.sceneform:filament-android", version.ref = "filamentAndroid" }
|
||||
gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
||||
hilt-android-compiler = { module = "com.google.dagger:hilt-android-compiler", version.ref = "hiltAndroidCompiler" }
|
||||
hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hiltAndroid" }
|
||||
junit = { module = "junit:junit", version.ref = "junit" }
|
||||
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
|
||||
landscapist-glide = { module = "com.github.skydoves:landscapist-glide", version.ref = "landscapistGlide" }
|
||||
lazycolumnscrollbar = { module = "com.github.nanihadesuka:LazyColumnScrollbar", version.ref = "lazycolumnscrollbar" }
|
||||
lottie-compose = { module = "com.airbnb.android:lottie-compose", version.ref = "lottieCompose" }
|
||||
renderscript-intrinsics-replacement-toolkit = { module = "com.github.android:renderscript-intrinsics-replacement-toolkit", version.ref = "renderscriptIntrinsicsReplacementToolkit" }
|
||||
taskerpluginlibrary = { module = "com.joaomgcd:taskerpluginlibrary", version.ref = "taskerpluginlibrary" }
|
||||
toolbar-compose = { module = "me.onebone:toolbar-compose", version.ref = "toolbarCompose" }
|
||||
zoomable = { module = "net.engawapg.lib:zoomable", version.ref = "zoomable" }
|
||||
|
||||
[plugins]
|
||||
androidApplication = { id = "com.android.application", version.ref = "androidGradlePlugin" }
|
||||
androidLibrary = { id = "com.android.library", version.ref = "androidGradlePlugin" }
|
||||
kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
|
||||
kotlinCompose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" }
|
||||
hiltAndroid = { id = "com.google.dagger.hilt.android", version.ref = "hilt" }
|
||||
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||
aboutLibraries = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "aboutLibraries" }
|
||||
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
|
||||
androidTest = { id = "com.android.test", version.ref = "androidGradlePlugin" }
|
||||
baselineProfile = { id = "androidx.baselineprofile", version.ref = "baselineProfile" }
|
||||
@@ -17,3 +17,4 @@ dependencyResolutionManagement {
|
||||
rootProject.name = "Paperize"
|
||||
include(":app")
|
||||
|
||||
include(":baselineprofile")
|
||||
Reference in new issue
Block a user