From bddb556bb1015b5537bd15905801cac4cbc9608b Mon Sep 17 00:00:00 2001 From: Gergely Hegedus Date: Sun, 2 Nov 2025 20:20:45 +0200 Subject: [PATCH] target sdk 36 --- .idea/.name | 1 + .idea/AndroidProjectSystem.xml | 6 +++++ .idea/deploymentTargetSelector.xml | 8 ++++++ .idea/deviceManager.xml | 13 ++++++++++ .idea/markdown.xml | 8 ++++++ .idea/misc.xml | 1 - app/build.gradle | 26 +++++++++---------- .../qrcodetransfer/config/BuildConfig.kt | 5 ++++ .../android/qrcodetransfer/MainActivity.kt | 16 +++++++++--- .../qrcodetransfer/SequenceProtocol.kt | 3 ++- .../org/fnives/android/qrcodetransfer/Util.kt | 5 ++-- .../config/BuildConfigDeclaration.kt | 6 +++++ .../android/qrcodetransfer/read/CameraView.kt | 10 +++---- .../read/image/ImageReadQRCode.kt | 4 +-- .../read/parsed/WiFiInfoFormatter.kt | 8 +++--- .../qrcodetransfer/config/BuildConfig.kt | 5 ++++ build.gradle | 4 +-- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 3 ++- 19 files changed, 97 insertions(+), 37 deletions(-) create mode 100644 .idea/.name create mode 100644 .idea/AndroidProjectSystem.xml create mode 100644 .idea/deviceManager.xml create mode 100644 .idea/markdown.xml create mode 100644 app/src/debug/kotlin/org/fnives/android/qrcodetransfer/config/BuildConfig.kt create mode 100644 app/src/main/java/org/fnives/android/qrcodetransfer/config/BuildConfigDeclaration.kt create mode 100644 app/src/release/kotlin/org/fnives/android/qrcodetransfer/config/BuildConfig.kt diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..e3ae390 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +QRCodeTransfer \ No newline at end of file diff --git a/.idea/AndroidProjectSystem.xml b/.idea/AndroidProjectSystem.xml new file mode 100644 index 0000000..4a53bee --- /dev/null +++ b/.idea/AndroidProjectSystem.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml index b268ef3..8cdfbae 100644 --- a/.idea/deploymentTargetSelector.xml +++ b/.idea/deploymentTargetSelector.xml @@ -4,6 +4,14 @@ diff --git a/.idea/deviceManager.xml b/.idea/deviceManager.xml new file mode 100644 index 0000000..91f9558 --- /dev/null +++ b/.idea/deviceManager.xml @@ -0,0 +1,13 @@ + + + + + + \ No newline at end of file diff --git a/.idea/markdown.xml b/.idea/markdown.xml new file mode 100644 index 0000000..c61ea33 --- /dev/null +++ b/.idea/markdown.xml @@ -0,0 +1,8 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index 74dd639..b2c751a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/app/build.gradle b/app/build.gradle index 23549fa..2e6bef2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -9,12 +9,12 @@ def useDebugSigningForReleaseBuild = project.findProperty('useDebugSigningForRel android { namespace 'org.fnives.android.qrcodetransfer' - compileSdk 35 + compileSdk 36 defaultConfig { applicationId applicationIdArgument ?: "org.fnives.android.qrcodetransfer" minSdk 24 - targetSdk 35 + targetSdk 36 versionCode applicationVersionCodeArgument ?: 1 versionName "1.2.0" @@ -72,34 +72,34 @@ android { dependencies { - def compose_ui_version = '1.5.4' - implementation 'androidx.core:core-ktx:1.16.0' - implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7' - implementation 'androidx.activity:activity-compose:1.10.1' + def compose_ui_version = '1.9.4' + implementation 'androidx.core:core-ktx:1.17.0' + implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.4' + implementation 'androidx.activity:activity-compose:1.11.0' implementation "androidx.compose.ui:ui:$compose_ui_version" implementation "androidx.compose.ui:ui-tooling-preview:$compose_ui_version" - implementation 'androidx.compose.material:material:1.8.0' + implementation 'androidx.compose.material:material:1.9.4' implementation "androidx.compose.material:material-icons-extended:1.7.8" // qr code - implementation "com.google.zxing:core:3.5.2" + implementation "com.google.zxing:core:3.5.3" // permission - implementation 'com.google.accompanist:accompanist-permissions:0.32.0' + implementation 'com.google.accompanist:accompanist-permissions:0.37.3' // camerax - def camerax_version = "1.4.2" + def camerax_version = "1.5.1" implementation "androidx.camera:camera-camera2:$camerax_version" implementation "androidx.camera:camera-lifecycle:$camerax_version" implementation "androidx.camera:camera-view:$camerax_version" implementation "androidx.camera:camera-extensions:$camerax_version" // preferences - implementation "androidx.datastore:datastore-preferences:1.1.4" + implementation "androidx.datastore:datastore-preferences:1.1.7" 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.test.ext:junit:1.3.0' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0' androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version" debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version" debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version" diff --git a/app/src/debug/kotlin/org/fnives/android/qrcodetransfer/config/BuildConfig.kt b/app/src/debug/kotlin/org/fnives/android/qrcodetransfer/config/BuildConfig.kt new file mode 100644 index 0000000..8ba57a0 --- /dev/null +++ b/app/src/debug/kotlin/org/fnives/android/qrcodetransfer/config/BuildConfig.kt @@ -0,0 +1,5 @@ +package org.fnives.android.qrcodetransfer.config + +object BuildConfig : BuildConfigDeclaration { + override val isDebug: Boolean = true +} \ No newline at end of file diff --git a/app/src/main/java/org/fnives/android/qrcodetransfer/MainActivity.kt b/app/src/main/java/org/fnives/android/qrcodetransfer/MainActivity.kt index 24e90f6..bdf2f9d 100644 --- a/app/src/main/java/org/fnives/android/qrcodetransfer/MainActivity.kt +++ b/app/src/main/java/org/fnives/android/qrcodetransfer/MainActivity.kt @@ -7,10 +7,14 @@ import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.annotation.StringRes import androidx.compose.animation.AnimatedContent +import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.WindowInsets import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.navigationBars import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.material.BottomNavigation import androidx.compose.material.BottomNavigationItem import androidx.compose.material.Icon @@ -21,6 +25,7 @@ import androidx.compose.material.Text import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Create import androidx.compose.material.icons.filled.Search +import androidx.compose.material.primarySurface import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf @@ -28,6 +33,7 @@ import androidx.compose.runtime.saveable.rememberSaveable import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource +import androidx.compose.ui.unit.dp import org.fnives.android.qrcodetransfer.create.CreateQRCode import org.fnives.android.qrcodetransfer.intent.LocalIntentImageUri import org.fnives.android.qrcodetransfer.intent.LocalIntentProvider @@ -51,7 +57,8 @@ class MainActivity : ComponentActivity() { ) { val intentImage = LocalIntentImageUri.current if (intentImage != null) { - ImageReadQRCode(intentImage, + ImageReadQRCode( + intentImage, onErrorLoadingFile = { showToast(R.string.could_not_read_content) finishAfterTransition() @@ -73,6 +80,9 @@ fun NormalState() { var writerSelected by rememberSaveable { mutableStateOf(true) } Scaffold(bottomBar = { NavBar( + modifier = Modifier + .background(MaterialTheme.colors.primarySurface) + .windowInsetsPadding(WindowInsets.navigationBars), writerSelected = writerSelected, setWriterSelected = { writerSelected = it }) }) { @@ -89,8 +99,8 @@ fun NormalState() { } @Composable -fun NavBar(writerSelected: Boolean, setWriterSelected: (Boolean) -> Unit) { - BottomNavigation(Modifier.fillMaxWidth()) { +fun NavBar(modifier: Modifier, writerSelected: Boolean, setWriterSelected: (Boolean) -> Unit) { + BottomNavigation(modifier.fillMaxWidth(), elevation = 0.dp) { BottomNavigationItem( selected = writerSelected, onClick = { setWriterSelected(true) }, diff --git a/app/src/main/java/org/fnives/android/qrcodetransfer/SequenceProtocol.kt b/app/src/main/java/org/fnives/android/qrcodetransfer/SequenceProtocol.kt index afc5978..47ef844 100644 --- a/app/src/main/java/org/fnives/android/qrcodetransfer/SequenceProtocol.kt +++ b/app/src/main/java/org/fnives/android/qrcodetransfer/SequenceProtocol.kt @@ -8,6 +8,7 @@ import com.google.zxing.common.CharacterSetECI import com.google.zxing.qrcode.QRCodeReader import com.google.zxing.qrcode.QRCodeWriter import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel +import org.fnives.android.qrcodetransfer.config.BuildConfig import kotlin.io.encoding.Base64 import kotlin.io.encoding.ExperimentalEncodingApi import kotlin.math.max @@ -98,7 +99,7 @@ object SequenceProtocol { try { reader.decode(binaryBitmap) } catch (e: Throwable) { - if (BuildConfig.DEBUG) { + if (BuildConfig.isDebug) { e.printStackTrace() } null diff --git a/app/src/main/java/org/fnives/android/qrcodetransfer/Util.kt b/app/src/main/java/org/fnives/android/qrcodetransfer/Util.kt index fe791ae..b8c9e86 100644 --- a/app/src/main/java/org/fnives/android/qrcodetransfer/Util.kt +++ b/app/src/main/java/org/fnives/android/qrcodetransfer/Util.kt @@ -123,8 +123,9 @@ private fun Context.shareQRCodeImageFile() { shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // temp permission for receiving app to read this file shareIntent.setDataAndType(contentUri, contentResolver.getType(contentUri)) shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri) - val chooserIntent = Intent.createChooser(shareIntent, ContextCompat.getString(this, R.string.share)) - ContextCompat.startActivity(this, chooserIntent, null) + val chooserIntent = + Intent.createChooser(shareIntent, ContextCompat.getString(this, R.string.share)) + startActivity(chooserIntent, null) } fun Context.shareBitmap(bitmap: Bitmap) { diff --git a/app/src/main/java/org/fnives/android/qrcodetransfer/config/BuildConfigDeclaration.kt b/app/src/main/java/org/fnives/android/qrcodetransfer/config/BuildConfigDeclaration.kt new file mode 100644 index 0000000..9aa741e --- /dev/null +++ b/app/src/main/java/org/fnives/android/qrcodetransfer/config/BuildConfigDeclaration.kt @@ -0,0 +1,6 @@ +package org.fnives.android.qrcodetransfer.config + +interface BuildConfigDeclaration { + + val isDebug: Boolean +} \ No newline at end of file diff --git a/app/src/main/java/org/fnives/android/qrcodetransfer/read/CameraView.kt b/app/src/main/java/org/fnives/android/qrcodetransfer/read/CameraView.kt index b425860..dc7d16e 100644 --- a/app/src/main/java/org/fnives/android/qrcodetransfer/read/CameraView.kt +++ b/app/src/main/java/org/fnives/android/qrcodetransfer/read/CameraView.kt @@ -1,28 +1,23 @@ package org.fnives.android.qrcodetransfer.read import android.graphics.Bitmap -import androidx.compose.ui.graphics.Color import android.view.ViewGroup import android.widget.LinearLayout import androidx.annotation.WorkerThread import androidx.camera.view.LifecycleCameraController import androidx.camera.view.PreviewView import androidx.compose.foundation.layout.Box -import androidx.compose.foundation.layout.PaddingValues -import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxSize -import androidx.compose.foundation.layout.padding -import androidx.compose.material.Scaffold import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.platform.LocalContext -import androidx.compose.ui.platform.LocalLifecycleOwner import androidx.compose.ui.viewinterop.AndroidView -import java.time.Duration +import androidx.lifecycle.compose.LocalLifecycleOwner import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.cancel @@ -65,6 +60,7 @@ fun CameraView( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT ) + println("DSGFFDGDFG width &h = ${this.width}") scaleType = PreviewView.ScaleType.FIT_CENTER implementationMode = PreviewView.ImplementationMode.PERFORMANCE diff --git a/app/src/main/java/org/fnives/android/qrcodetransfer/read/image/ImageReadQRCode.kt b/app/src/main/java/org/fnives/android/qrcodetransfer/read/image/ImageReadQRCode.kt index 09b1c2a..5d42d33 100644 --- a/app/src/main/java/org/fnives/android/qrcodetransfer/read/image/ImageReadQRCode.kt +++ b/app/src/main/java/org/fnives/android/qrcodetransfer/read/image/ImageReadQRCode.kt @@ -27,9 +27,9 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnitType import androidx.compose.ui.unit.dp -import org.fnives.android.qrcodetransfer.BuildConfig import org.fnives.android.qrcodetransfer.R import org.fnives.android.qrcodetransfer.SequenceProtocol +import org.fnives.android.qrcodetransfer.config.BuildConfig import org.fnives.android.qrcodetransfer.create.Base64EncodeCheckbox import org.fnives.android.qrcodetransfer.read.ActionRow import org.fnives.android.qrcodetransfer.read.parsed.DataFormatter @@ -55,7 +55,7 @@ fun ImageReadQRCode(imageUri: Uri, onErrorLoadingFile: () -> Unit) { try { SequenceProtocol.read(imageBitmap.toBinaryBitmap())?.sequenceInfo?.content } catch (ignored: Throwable) { - if (BuildConfig.DEBUG) { + if (BuildConfig.isDebug) { ignored.printStackTrace() } null diff --git a/app/src/main/java/org/fnives/android/qrcodetransfer/read/parsed/WiFiInfoFormatter.kt b/app/src/main/java/org/fnives/android/qrcodetransfer/read/parsed/WiFiInfoFormatter.kt index d2ce797..8deedd2 100644 --- a/app/src/main/java/org/fnives/android/qrcodetransfer/read/parsed/WiFiInfoFormatter.kt +++ b/app/src/main/java/org/fnives/android/qrcodetransfer/read/parsed/WiFiInfoFormatter.kt @@ -1,6 +1,6 @@ package org.fnives.android.qrcodetransfer.read.parsed -import org.fnives.android.qrcodetransfer.BuildConfig +import org.fnives.android.qrcodetransfer.config.BuildConfig object WiFiInfoFormatter { @@ -14,14 +14,14 @@ object WiFiInfoFormatter { fun tryToParse(data: String): WifiInfo? { if (data.startsWith(PREFIX)) { try { - val result = data.drop(PREFIX.length).split(";").map { + val result = data.drop(PREFIX.length).split(";").associate { if (it.contains(":")) { val (key, value) = it.split(":") key to value } else { EXTRA_KEY to it } - }.toMap() + } return WifiInfo( name = result[NAME_KEY] @@ -33,7 +33,7 @@ object WiFiInfoFormatter { hidden = result[HIDDEN_KEY] == "true", ) } catch (ignored: Throwable) { - if (BuildConfig.DEBUG) { + if (BuildConfig.isDebug) { ignored.printStackTrace() } return null diff --git a/app/src/release/kotlin/org/fnives/android/qrcodetransfer/config/BuildConfig.kt b/app/src/release/kotlin/org/fnives/android/qrcodetransfer/config/BuildConfig.kt new file mode 100644 index 0000000..3a7c5c6 --- /dev/null +++ b/app/src/release/kotlin/org/fnives/android/qrcodetransfer/config/BuildConfig.kt @@ -0,0 +1,5 @@ +package org.fnives.android.qrcodetransfer.config + +object BuildConfig : BuildConfigDeclaration { + override val isDebug: Boolean = false +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1b350b9..7d15ab2 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { } }// Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '8.7.2' apply false - id 'com.android.library' version '8.7.2' apply false + id 'com.android.application' version '8.13.0' apply false + id 'com.android.library' version '8.13.0' apply false id 'org.jetbrains.kotlin.android' version '1.9.20' apply false } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index a2e90d8..c4e19a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,5 +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 -android.defaults.buildfeatures.buildconfig=true +#android.defaults.buildfeatures.buildconfig=true android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 09523c0..7386495 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ +#Sun Nov 02 19:45:18 EET 2025 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME