Skip to content

Commit

Permalink
[fix|build] Fix search screen FAB invalid recompose; update dependenc…
Browse files Browse the repository at this point in the history
…ies; update AGP
  • Loading branch information
SkyD666 committed May 21, 2024
1 parent 637b75c commit 2a2fa36
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 66 deletions.
10 changes: 5 additions & 5 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ android {
minSdk = 24
targetSdk = 34
versionCode = 66
versionName = "2.2-rc06"
versionName = "2.2-rc07"

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down Expand Up @@ -108,7 +108,7 @@ android {
aidl = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.5.12"
kotlinCompilerExtensionVersion = "1.5.14"
}
packaging {
resources.excludes += mutableSetOf(
Expand Down Expand Up @@ -162,8 +162,8 @@ dependencies {
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.7.0")
implementation("androidx.activity:activity-compose:1.9.0")
implementation("androidx.palette:palette-ktx:1.0.0")
implementation("com.google.dagger:hilt-android:2.51")
ksp("com.google.dagger:hilt-android-compiler:2.51")
implementation("com.google.dagger:hilt-android:2.51.1")
ksp("com.google.dagger:hilt-android-compiler:2.51.1")
implementation("androidx.hilt:hilt-navigation-compose:1.2.0")
implementation("androidx.navigation:navigation-compose:2.7.7")
implementation("androidx.security:security-crypto:1.1.0-alpha06")
Expand All @@ -182,7 +182,7 @@ dependencies {
implementation("androidx.datastore:datastore-preferences:1.1.1")
implementation("com.airbnb.android:lottie-compose:6.3.0")

implementation("com.squareup.retrofit2:retrofit:2.10.0")
implementation("com.squareup.retrofit2:retrofit:2.11.0")
implementation("com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0")

// Google ML Kit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import androidx.compose.material3.VerticalDivider
import androidx.compose.material3.rememberTooltipState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
Expand Down Expand Up @@ -138,7 +139,11 @@ fun SearchScreen(viewModel: SearchViewModel = hiltViewModel()) {
modifier = Modifier.imePadding(),
snackbarHost = { SnackbarHost(hostState = snackbarHostState) },
floatingActionButton = {
AnimatedVisibility(visible = searchResultListState.firstVisibleItemIndex > 2) {
AnimatedVisibility(
visible = remember {
derivedStateOf { searchResultListState.firstVisibleItemIndex > 2 }
}.value
) {
RaysFloatingActionButton(
onClick = { scope.launch { searchResultListState.animateScrollToItem(0) } },
onSizeWithSinglePaddingChanged = { width, height ->
Expand Down
74 changes: 21 additions & 53 deletions app/src/main/java/com/skyd/rays/util/image/format/FormatStandard.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,7 @@ sealed class FormatStandard(
requiredByteArraySize = 8,
) {
val PNG_FORMAT_DATA = byteArrayOf(
0x89.toByte(),
0x50.toByte(),
0x4E.toByte(),
0x47.toByte(),
0x0D.toByte(),
0x0A.toByte(),
0x1A.toByte(),
0x0A.toByte(),
0x89.toByte(), 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A,
)

override fun check(tested: ByteArray): Boolean = baseCheck(
Expand Down Expand Up @@ -117,26 +110,12 @@ sealed class FormatStandard(
requiredByteArraySize = 6,
) {
override fun check(tested: ByteArray): Boolean = baseCheck(
standard = byteArrayOf(
// GIF87a
0x47.toByte(),
0x49.toByte(),
0x46.toByte(),
0x38.toByte(),
0x37.toByte(),
0x61.toByte(),
),
// GIF87a
standard = byteArrayOf(0x47, 0x49, 0x46, 0x38, 0x37, 0x61),
tested = tested,
) or baseCheck(
// GIF89a
standard = byteArrayOf(
0x47.toByte(),
0x49.toByte(),
0x46.toByte(),
0x38.toByte(),
0x39.toByte(),
0x61.toByte(),
),
standard = byteArrayOf(0x47, 0x49, 0x46, 0x38, 0x39, 0x61),
tested = tested,
)
}
Expand All @@ -157,12 +136,12 @@ sealed class FormatStandard(
* PT – OS/2 Pointer
*/
private val firstFieldArray = arrayOf(
byteArrayOf(0x42.toByte(), 0x4D.toByte()),
byteArrayOf(0x42.toByte(), 0x41.toByte()),
byteArrayOf(0x43.toByte(), 0x49.toByte()),
byteArrayOf(0x43.toByte(), 0x50.toByte()),
byteArrayOf(0x49.toByte(), 0x43.toByte()),
byteArrayOf(0x50.toByte(), 0x54.toByte()),
byteArrayOf(0x42, 0x4D),
byteArrayOf(0x42, 0x41),
byteArrayOf(0x43, 0x49),
byteArrayOf(0x43, 0x50),
byteArrayOf(0x49, 0x43),
byteArrayOf(0x50, 0x54),
)

override fun check(tested: ByteArray): Boolean {
Expand Down Expand Up @@ -193,18 +172,7 @@ sealed class FormatStandard(
requiredByteArraySize = 12,
) {
private val standard = byteArrayOf(
0x52.toByte(),
0x49.toByte(),
0x46.toByte(),
0x46.toByte(),
0x00.toByte(),
0x00.toByte(),
0x00.toByte(),
0x00.toByte(),
0x57.toByte(),
0x45.toByte(),
0x42.toByte(),
0x50.toByte(),
0x52, 0x49, 0x46, 0x46, 0x00, 0x00, 0x00, 0x00, 0x57, 0x45, 0x42, 0x50,
)

override fun check(tested: ByteArray): Boolean {
Expand Down Expand Up @@ -232,9 +200,9 @@ sealed class FormatStandard(
format = ImageFormat.HEIF,
requiredByteArraySize = 12,
) {
private val ftyp = byteArrayOf(0x66.toByte(), 0x74.toByte(), 0x79.toByte(), 0x70.toByte())
private val mif1 = byteArrayOf(0x6d.toByte(), 0x69.toByte(), 0x66.toByte(), 0x31.toByte())
private val msf1 = byteArrayOf(0x6d.toByte(), 0x73.toByte(), 0x66.toByte(), 0x31.toByte())
private val ftyp = byteArrayOf(0x66, 0x74, 0x79, 0x70)
private val mif1 = byteArrayOf(0x6d, 0x69, 0x66, 0x31)
private val msf1 = byteArrayOf(0x6d, 0x73, 0x66, 0x31)
private val m = arrayOf(mif1, msf1)

override fun check(tested: ByteArray): Boolean {
Expand All @@ -255,14 +223,14 @@ sealed class FormatStandard(
format = ImageFormat.HEIC,
requiredByteArraySize = 12,
) {
private val ftyp = byteArrayOf(0x66.toByte(), 0x74.toByte(), 0x79.toByte(), 0x70.toByte())
private val he = byteArrayOf(0x68.toByte(), 0x65.toByte())
private val ftyp = byteArrayOf(0x66, 0x74, 0x79, 0x70)
private val he = byteArrayOf(0x68, 0x65)
private val icIxIsVcVx = arrayOf(
byteArrayOf(0x69.toByte(), 0x63.toByte()),
byteArrayOf(0x69.toByte(), 0x78.toByte()),
byteArrayOf(0x69.toByte(), 0x73.toByte()),
byteArrayOf(0x76.toByte(), 0x63.toByte()),
byteArrayOf(0x76.toByte(), 0x78.toByte()),
byteArrayOf(0x69, 0x63),
byteArrayOf(0x69, 0x78),
byteArrayOf(0x69, 0x73),
byteArrayOf(0x76, 0x63),
byteArrayOf(0x76, 0x78),
)

override fun check(tested: ByteArray): Boolean {
Expand Down
14 changes: 7 additions & 7 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {
extra.apply {
set("composeVersion", "1.6.5")
set("composeVersion", "1.6.7")
set("md3Version", "1.2.1")
set("accompanistVersion", "0.34.0")
set("mlkitRecognitionVersion", "16.0.0")
Expand All @@ -9,10 +9,10 @@ buildscript {
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id("com.android.application") version "8.3.1" apply false
id("com.android.library") version "8.3.1" apply false
id("org.jetbrains.kotlin.android") version "1.9.23" apply false
id("com.google.dagger.hilt.android") version "2.50" apply false
id("com.google.devtools.ksp") version "1.9.23-1.0.19" apply false
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.23"
id("com.android.application") version "8.4.0" apply false
id("com.android.library") version "8.4.0" apply false
id("org.jetbrains.kotlin.android") version "1.9.24" apply false
id("com.google.dagger.hilt.android") version "2.51.1" apply false
id("com.google.devtools.ksp") version "1.9.24-1.0.20" apply false
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.24"
}

0 comments on commit 2a2fa36

Please sign in to comment.