From 3fa93d60e46c6a5e306615180f27587c062b1a6d Mon Sep 17 00:00:00 2001 From: Konyaco Date: Sat, 11 Dec 2021 22:04:06 +0800 Subject: [PATCH 1/2] [UI] Remove the gap between SearchBox and Definition. --- .../kotlin/me/konyaco/collinsdictionary/ui/App.kt | 5 +++-- .../me/konyaco/collinsdictionary/ui/component/SearchBox.kt | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/common/src/commonMain/kotlin/me/konyaco/collinsdictionary/ui/App.kt b/common/src/commonMain/kotlin/me/konyaco/collinsdictionary/ui/App.kt index 9ab5c63..5305e11 100644 --- a/common/src/commonMain/kotlin/me/konyaco/collinsdictionary/ui/App.kt +++ b/common/src/commonMain/kotlin/me/konyaco/collinsdictionary/ui/App.kt @@ -19,6 +19,7 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp +import androidx.compose.ui.zIndex import me.konyaco.collinsdictionary.service.ProvideSoundPlayer import me.konyaco.collinsdictionary.service.Word import me.konyaco.collinsdictionary.ui.component.CobuildDictionarySection @@ -79,13 +80,13 @@ fun App(data: AppViewModel.Result?, isSearching: Boolean, onSearch: (text: Strin Spacer(Modifier.height(32.dp)) var input by remember { mutableStateOf("") } SearchBox( - modifier = Modifier.padding(horizontal = padding).fillMaxWidth(), + modifier = Modifier.zIndex(2f).padding(horizontal = padding).fillMaxWidth(), value = input, onValueChange = { input = it }, onSearchClick = { onSearch(input) }, isSearching = isSearching ) - Result(Modifier.weight(1f).fillMaxWidth(), data, padding) + Result(Modifier.zIndex(1f).weight(1f).fillMaxWidth(), data, padding) } } } diff --git a/common/src/commonMain/kotlin/me/konyaco/collinsdictionary/ui/component/SearchBox.kt b/common/src/commonMain/kotlin/me/konyaco/collinsdictionary/ui/component/SearchBox.kt index 963d24a..e36f47b 100644 --- a/common/src/commonMain/kotlin/me/konyaco/collinsdictionary/ui/component/SearchBox.kt +++ b/common/src/commonMain/kotlin/me/konyaco/collinsdictionary/ui/component/SearchBox.kt @@ -1,5 +1,6 @@ package me.konyaco.collinsdictionary.ui.component +import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.layout.* @@ -31,7 +32,7 @@ fun SearchBox( isSearching: Boolean, onSearchClick: () -> Unit ) { - Column(modifier.fillMaxWidth()) { + Box(modifier.fillMaxWidth()) { Surface(Modifier.fillMaxWidth().wrapContentHeight(), color = myColors.searchBoxBackground) { Box(modifier = Modifier.fillMaxWidth(), contentAlignment = Alignment.CenterStart) { BasicTextField( @@ -86,8 +87,8 @@ fun SearchBox( } } } - Box(Modifier.height(4.dp).fillMaxWidth()) { - androidx.compose.animation.AnimatedVisibility( + Box(Modifier.align(Alignment.BottomCenter).offset(y = 4.dp).height(4.dp).fillMaxWidth()) { + AnimatedVisibility( isSearching, enter = fadeIn(), exit = fadeOut() From 69ffd9e3eb45835bb426ccaedb1f5091f18732d9 Mon Sep 17 00:00:00 2001 From: Konyaco Date: Sat, 11 Dec 2021 22:40:53 +0800 Subject: [PATCH 2/2] [Release] v1.4.2 --- android/build.gradle.kts | 8 ++++++-- android/proguard-rules.pro | 41 +++++++++++++++++++++++++++++++++++++- build.gradle.kts | 2 +- 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/android/build.gradle.kts b/android/build.gradle.kts index 10cc1c4..df4d139 100644 --- a/android/build.gradle.kts +++ b/android/build.gradle.kts @@ -10,13 +10,17 @@ android { applicationId = "me.konyaco.collinsdictionary" minSdk = 21 targetSdk = 31 - versionCode = 3 + versionCode = 5 versionName = rootProject.version as String } buildTypes { getByName("release") { - isMinifyEnabled = true + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) } } diff --git a/android/proguard-rules.pro b/android/proguard-rules.pro index 481bb43..0de7982 100644 --- a/android/proguard-rules.pro +++ b/android/proguard-rules.pro @@ -18,4 +18,43 @@ # If you keep the line number information, uncomment this to # hide the original source file name. -#-renamesourcefileattribute SourceFile \ No newline at end of file +#-renamesourcefileattribute SourceFile +# Keep `Companion` object fields of serializable classes. +# This avoids serializer lookup through `getDeclaredClasses` as done for named companion objects. +-if @kotlinx.serialization.Serializable class ** +-keepclassmembers class <1> { + static <1>$Companion Companion; +} + +# Keep `serializer()` on companion objects (both default and named) of serializable classes. +-if @kotlinx.serialization.Serializable class ** { + static **$* *; +} +-keepclassmembers class <1>$<3> { + kotlinx.serialization.KSerializer serializer(...); +} + +# Keep `INSTANCE.serializer()` of serializable objects. +-if @kotlinx.serialization.Serializable class ** { + public static ** INSTANCE; +} +-keepclassmembers class <1> { + public static <1> INSTANCE; + kotlinx.serialization.KSerializer serializer(...); +} + +# @Serializable and @Polymorphic are used at runtime for polymorphic serialization. +-keepattributes RuntimeVisibleAnnotations,AnnotationDefault + +# Serializer for classes with named companion objects are retrieved using `getDeclaredClasses`. +# If you have any, uncomment and replace classes with those containing named companion objects. +#-keepattributes InnerClasses # Needed for `getDeclaredClasses`. +#-if @kotlinx.serialization.Serializable class +#com.example.myapplication.HasNamedCompanion, # <-- List serializable classes with named companions. +#com.example.myapplication.HasNamedCompanion2 +#{ +# static **$* *; +#} +#-keepnames class <1>$$serializer { # -keepnames suffices; class is kept when serializer() is kept. +# static <1>$$serializer INSTANCE; +#} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index c97b8b4..e054d39 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -17,4 +17,4 @@ allprojects { } group = "me.konyaco.collinsdictionary" -version = "1.4.1" +version = "1.4.2" \ No newline at end of file