jarad2's picture
Add Android Bench sample: tasks and runs (part 14)
89995d3 verified
Raw History Blame Contribute Delete
4.16 kB
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 8ac1bdbb..47c3cae7 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -48,11 +48,13 @@ android {
}
signingConfigs {
- create("release") {
- storeFile = file(providers.gradleProperty("RELEASE_STORE_FILE").get())
- storePassword = providers.gradleProperty("RELEASE_STORE_PASSWORD").get()
- keyAlias = providers.gradleProperty("RELEASE_KEY_ALIAS").get()
- keyPassword = providers.gradleProperty("RELEASE_KEY_PASSWORD").get()
+ if (providers.gradleProperty("RELEASE_STORE_FILE").isPresent) {
+ create("release") {
+ storeFile = file(providers.gradleProperty("RELEASE_STORE_FILE").get())
+ storePassword = providers.gradleProperty("RELEASE_STORE_PASSWORD").get()
+ keyAlias = providers.gradleProperty("RELEASE_KEY_ALIAS").get()
+ keyPassword = providers.gradleProperty("RELEASE_KEY_PASSWORD").get()
+ }
}
}
@@ -70,7 +72,7 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
- signingConfig = signingConfigs.getByName("release")
+ signingConfigs.findByName("release")?.let { signingConfig = it }
}
create("beta") {
initWith(getByName("release"))
@@ -163,6 +165,10 @@ android {
buildFeatures {
viewBinding = true
dataBinding = true
+ compose = true
+ }
+ composeOptions {
+ kotlinCompilerExtensionVersion = "1.5.1"
}
packaging {
@@ -335,6 +341,20 @@ dependencies {
implementation("cn.Leaqi:SwipeDrawer:1.6")
implementation("com.github.skydoves:colorpickerview:2.3.0")
implementation("com.google.android.material:material:1.12.0")
+
+ val composeBom = platform("androidx.compose:compose-bom:2024.06.00")
+ implementation(composeBom)
+ implementation("androidx.compose.ui:ui")
+ implementation("androidx.compose.foundation:foundation")
+ implementation("androidx.compose.material3:material3")
+ implementation("androidx.compose.runtime:runtime-livedata")
+ implementation("androidx.compose.ui:ui-tooling-preview")
+ implementation("androidx.activity:activity-compose:1.8.2")
+ implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.7")
+ debugImplementation("androidx.compose.ui:ui-tooling")
+ debugImplementation("androidx.compose.ui:ui-test-manifest")
+ testImplementation(composeBom)
+ testImplementation("androidx.compose.ui:ui-test-junit4")
implementation("com.google.code.findbugs:jsr305:3.0.2")
implementation("me.zhanghai.android.fastscroll:library:1.3.0")
implementation("net.lingala.zip4j:zip4j:2.11.5")
diff --git a/app/src/main/java/com/philkes/notallyx/NotallyXApplication.kt b/app/src/main/java/com/philkes/notallyx/NotallyXApplication.kt
index 443df4c4..d65e94e6 100644
--- a/app/src/main/java/com/philkes/notallyx/NotallyXApplication.kt
+++ b/app/src/main/java/com/philkes/notallyx/NotallyXApplication.kt
@@ -269,7 +269,9 @@ class NotallyXApplication : Application(), Application.ActivityLifecycleCallback
}
override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) {
- activity.setEnabledSecureFlag(preferences.secureFlag.value)
+ if (::preferences.isInitialized) {
+ activity.setEnabledSecureFlag(preferences.secureFlag.value)
+ }
}
override fun onActivityStarted(activity: Activity) {}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index 0620c756..df8aaed6 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -28,6 +28,7 @@
android:layout_height="?attr/actionBarSize"
android:layout_below="@id/Toolbar"
android:background="?attr/colorSurface"
+ app:navigationContentDescription="Close"
app:navigationIcon="@drawable/close" />
<androidx.fragment.app.FragmentContainerView