target sdk 36

This commit is contained in:
Gergely Hegedus 2025-11-02 20:20:45 +02:00
parent 31809449eb
commit bddb556bb1
19 changed files with 97 additions and 37 deletions

1
.idea/.name generated Normal file
View file

@ -0,0 +1 @@
QRCodeTransfer

6
.idea/AndroidProjectSystem.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

View file

@ -4,6 +4,14 @@
<selectionStates> <selectionStates>
<SelectionState runConfigName="app"> <SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" /> <option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-11-02T17:41:31.776926Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/Users/fnives/.android/avd/Pixel_5_API_35.avd" />
</handle>
</Target>
</DropdownSelection>
<DialogSelection />
</SelectionState> </SelectionState>
</selectionStates> </selectionStates>
</component> </component>

13
.idea/deviceManager.xml generated Normal file
View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DeviceTable">
<option name="columnSorters">
<list>
<ColumnSorterState>
<option name="column" value="Name" />
<option name="order" value="ASCENDING" />
</ColumnSorterState>
</list>
</option>
</component>
</project>

8
.idea/markdown.xml generated Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownSettings">
<option name="previewPanelProviderInfo">
<ProviderInfo name="Compose (experimental)" className="com.intellij.markdown.compose.preview.ComposePanelProvider" />
</option>
</component>
</project>

1
.idea/misc.xml generated
View file

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="jbr-21" project-jdk-type="JavaSDK">

View file

@ -9,12 +9,12 @@ def useDebugSigningForReleaseBuild = project.findProperty('useDebugSigningForRel
android { android {
namespace 'org.fnives.android.qrcodetransfer' namespace 'org.fnives.android.qrcodetransfer'
compileSdk 35 compileSdk 36
defaultConfig { defaultConfig {
applicationId applicationIdArgument ?: "org.fnives.android.qrcodetransfer" applicationId applicationIdArgument ?: "org.fnives.android.qrcodetransfer"
minSdk 24 minSdk 24
targetSdk 35 targetSdk 36
versionCode applicationVersionCodeArgument ?: 1 versionCode applicationVersionCodeArgument ?: 1
versionName "1.2.0" versionName "1.2.0"
@ -72,34 +72,34 @@ android {
dependencies { dependencies {
def compose_ui_version = '1.5.4' def compose_ui_version = '1.9.4'
implementation 'androidx.core:core-ktx:1.16.0' implementation 'androidx.core:core-ktx:1.17.0'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7' implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.9.4'
implementation 'androidx.activity:activity-compose:1.10.1' implementation 'androidx.activity:activity-compose:1.11.0'
implementation "androidx.compose.ui:ui:$compose_ui_version" implementation "androidx.compose.ui:ui:$compose_ui_version"
implementation "androidx.compose.ui:ui-tooling-preview:$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" implementation "androidx.compose.material:material-icons-extended:1.7.8"
// qr code // qr code
implementation "com.google.zxing:core:3.5.2" implementation "com.google.zxing:core:3.5.3"
// permission // permission
implementation 'com.google.accompanist:accompanist-permissions:0.32.0' implementation 'com.google.accompanist:accompanist-permissions:0.37.3'
// camerax // camerax
def camerax_version = "1.4.2" def camerax_version = "1.5.1"
implementation "androidx.camera:camera-camera2:$camerax_version" implementation "androidx.camera:camera-camera2:$camerax_version"
implementation "androidx.camera:camera-lifecycle:$camerax_version" implementation "androidx.camera:camera-lifecycle:$camerax_version"
implementation "androidx.camera:camera-view:$camerax_version" implementation "androidx.camera:camera-view:$camerax_version"
implementation "androidx.camera:camera-extensions:$camerax_version" implementation "androidx.camera:camera-extensions:$camerax_version"
// preferences // preferences
implementation "androidx.datastore:datastore-preferences:1.1.4" implementation "androidx.datastore:datastore-preferences:1.1.7"
testImplementation 'junit:junit:4.13.2' testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1' androidTestImplementation 'androidx.test.ext:junit:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1' androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version" androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_ui_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version" debugImplementation "androidx.compose.ui:ui-tooling:$compose_ui_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version" debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_ui_version"

View file

@ -0,0 +1,5 @@
package org.fnives.android.qrcodetransfer.config
object BuildConfig : BuildConfigDeclaration {
override val isDebug: Boolean = true
}

View file

@ -7,10 +7,14 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent import androidx.activity.compose.setContent
import androidx.annotation.StringRes import androidx.annotation.StringRes
import androidx.compose.animation.AnimatedContent import androidx.compose.animation.AnimatedContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.windowInsetsPadding
import androidx.compose.material.BottomNavigation import androidx.compose.material.BottomNavigation
import androidx.compose.material.BottomNavigationItem import androidx.compose.material.BottomNavigationItem
import androidx.compose.material.Icon 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.Icons
import androidx.compose.material.icons.filled.Create import androidx.compose.material.icons.filled.Create
import androidx.compose.material.icons.filled.Search import androidx.compose.material.icons.filled.Search
import androidx.compose.material.primarySurface
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.mutableStateOf
@ -28,6 +33,7 @@ import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.runtime.setValue import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import org.fnives.android.qrcodetransfer.create.CreateQRCode import org.fnives.android.qrcodetransfer.create.CreateQRCode
import org.fnives.android.qrcodetransfer.intent.LocalIntentImageUri import org.fnives.android.qrcodetransfer.intent.LocalIntentImageUri
import org.fnives.android.qrcodetransfer.intent.LocalIntentProvider import org.fnives.android.qrcodetransfer.intent.LocalIntentProvider
@ -51,7 +57,8 @@ class MainActivity : ComponentActivity() {
) { ) {
val intentImage = LocalIntentImageUri.current val intentImage = LocalIntentImageUri.current
if (intentImage != null) { if (intentImage != null) {
ImageReadQRCode(intentImage, ImageReadQRCode(
intentImage,
onErrorLoadingFile = { onErrorLoadingFile = {
showToast(R.string.could_not_read_content) showToast(R.string.could_not_read_content)
finishAfterTransition() finishAfterTransition()
@ -73,6 +80,9 @@ fun NormalState() {
var writerSelected by rememberSaveable { mutableStateOf(true) } var writerSelected by rememberSaveable { mutableStateOf(true) }
Scaffold(bottomBar = { Scaffold(bottomBar = {
NavBar( NavBar(
modifier = Modifier
.background(MaterialTheme.colors.primarySurface)
.windowInsetsPadding(WindowInsets.navigationBars),
writerSelected = writerSelected, writerSelected = writerSelected,
setWriterSelected = { writerSelected = it }) setWriterSelected = { writerSelected = it })
}) { }) {
@ -89,8 +99,8 @@ fun NormalState() {
} }
@Composable @Composable
fun NavBar(writerSelected: Boolean, setWriterSelected: (Boolean) -> Unit) { fun NavBar(modifier: Modifier, writerSelected: Boolean, setWriterSelected: (Boolean) -> Unit) {
BottomNavigation(Modifier.fillMaxWidth()) { BottomNavigation(modifier.fillMaxWidth(), elevation = 0.dp) {
BottomNavigationItem( BottomNavigationItem(
selected = writerSelected, selected = writerSelected,
onClick = { setWriterSelected(true) }, onClick = { setWriterSelected(true) },

View file

@ -8,6 +8,7 @@ import com.google.zxing.common.CharacterSetECI
import com.google.zxing.qrcode.QRCodeReader import com.google.zxing.qrcode.QRCodeReader
import com.google.zxing.qrcode.QRCodeWriter import com.google.zxing.qrcode.QRCodeWriter
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import org.fnives.android.qrcodetransfer.config.BuildConfig
import kotlin.io.encoding.Base64 import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi import kotlin.io.encoding.ExperimentalEncodingApi
import kotlin.math.max import kotlin.math.max
@ -98,7 +99,7 @@ object SequenceProtocol {
try { try {
reader.decode(binaryBitmap) reader.decode(binaryBitmap)
} catch (e: Throwable) { } catch (e: Throwable) {
if (BuildConfig.DEBUG) { if (BuildConfig.isDebug) {
e.printStackTrace() e.printStackTrace()
} }
null null

View file

@ -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.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION) // temp permission for receiving app to read this file
shareIntent.setDataAndType(contentUri, contentResolver.getType(contentUri)) shareIntent.setDataAndType(contentUri, contentResolver.getType(contentUri))
shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri) shareIntent.putExtra(Intent.EXTRA_STREAM, contentUri)
val chooserIntent = Intent.createChooser(shareIntent, ContextCompat.getString(this, R.string.share)) val chooserIntent =
ContextCompat.startActivity(this, chooserIntent, null) Intent.createChooser(shareIntent, ContextCompat.getString(this, R.string.share))
startActivity(chooserIntent, null)
} }
fun Context.shareBitmap(bitmap: Bitmap) { fun Context.shareBitmap(bitmap: Bitmap) {

View file

@ -0,0 +1,6 @@
package org.fnives.android.qrcodetransfer.config
interface BuildConfigDeclaration {
val isDebug: Boolean
}

View file

@ -1,28 +1,23 @@
package org.fnives.android.qrcodetransfer.read package org.fnives.android.qrcodetransfer.read
import android.graphics.Bitmap import android.graphics.Bitmap
import androidx.compose.ui.graphics.Color
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.annotation.WorkerThread import androidx.annotation.WorkerThread
import androidx.camera.view.LifecycleCameraController import androidx.camera.view.LifecycleCameraController
import androidx.camera.view.PreviewView import androidx.camera.view.PreviewView
import androidx.compose.foundation.layout.Box 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.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Scaffold
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.viewinterop.AndroidView import androidx.compose.ui.viewinterop.AndroidView
import java.time.Duration import androidx.lifecycle.compose.LocalLifecycleOwner
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.cancel import kotlinx.coroutines.cancel
@ -65,6 +60,7 @@ fun CameraView(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT ViewGroup.LayoutParams.MATCH_PARENT
) )
println("DSGFFDGDFG width &h = ${this.width}")
scaleType = PreviewView.ScaleType.FIT_CENTER scaleType = PreviewView.ScaleType.FIT_CENTER
implementationMode = PreviewView.ImplementationMode.PERFORMANCE implementationMode = PreviewView.ImplementationMode.PERFORMANCE

View file

@ -27,9 +27,9 @@ import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.TextUnitType import androidx.compose.ui.unit.TextUnitType
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import org.fnives.android.qrcodetransfer.BuildConfig
import org.fnives.android.qrcodetransfer.R import org.fnives.android.qrcodetransfer.R
import org.fnives.android.qrcodetransfer.SequenceProtocol 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.create.Base64EncodeCheckbox
import org.fnives.android.qrcodetransfer.read.ActionRow import org.fnives.android.qrcodetransfer.read.ActionRow
import org.fnives.android.qrcodetransfer.read.parsed.DataFormatter import org.fnives.android.qrcodetransfer.read.parsed.DataFormatter
@ -55,7 +55,7 @@ fun ImageReadQRCode(imageUri: Uri, onErrorLoadingFile: () -> Unit) {
try { try {
SequenceProtocol.read(imageBitmap.toBinaryBitmap())?.sequenceInfo?.content SequenceProtocol.read(imageBitmap.toBinaryBitmap())?.sequenceInfo?.content
} catch (ignored: Throwable) { } catch (ignored: Throwable) {
if (BuildConfig.DEBUG) { if (BuildConfig.isDebug) {
ignored.printStackTrace() ignored.printStackTrace()
} }
null null

View file

@ -1,6 +1,6 @@
package org.fnives.android.qrcodetransfer.read.parsed package org.fnives.android.qrcodetransfer.read.parsed
import org.fnives.android.qrcodetransfer.BuildConfig import org.fnives.android.qrcodetransfer.config.BuildConfig
object WiFiInfoFormatter { object WiFiInfoFormatter {
@ -14,14 +14,14 @@ object WiFiInfoFormatter {
fun tryToParse(data: String): WifiInfo? { fun tryToParse(data: String): WifiInfo? {
if (data.startsWith(PREFIX)) { if (data.startsWith(PREFIX)) {
try { try {
val result = data.drop(PREFIX.length).split(";").map { val result = data.drop(PREFIX.length).split(";").associate {
if (it.contains(":")) { if (it.contains(":")) {
val (key, value) = it.split(":") val (key, value) = it.split(":")
key to value key to value
} else { } else {
EXTRA_KEY to it EXTRA_KEY to it
} }
}.toMap() }
return WifiInfo( return WifiInfo(
name = result[NAME_KEY] name = result[NAME_KEY]
@ -33,7 +33,7 @@ object WiFiInfoFormatter {
hidden = result[HIDDEN_KEY] == "true", hidden = result[HIDDEN_KEY] == "true",
) )
} catch (ignored: Throwable) { } catch (ignored: Throwable) {
if (BuildConfig.DEBUG) { if (BuildConfig.isDebug) {
ignored.printStackTrace() ignored.printStackTrace()
} }
return null return null

View file

@ -0,0 +1,5 @@
package org.fnives.android.qrcodetransfer.config
object BuildConfig : BuildConfigDeclaration {
override val isDebug: Boolean = false
}

View file

@ -3,7 +3,7 @@ buildscript {
} }
}// Top-level build file where you can add configuration options common to all sub-projects/modules. }// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins { plugins {
id 'com.android.application' version '8.7.2' apply false id 'com.android.application' version '8.13.0' apply false
id 'com.android.library' version '8.7.2' apply false id 'com.android.library' version '8.13.0' apply false
id 'org.jetbrains.kotlin.android' version '1.9.20' apply false id 'org.jetbrains.kotlin.android' version '1.9.20' apply false
} }

View file

@ -21,5 +21,5 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies, # resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library # thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true android.nonTransitiveRClass=true
android.defaults.buildfeatures.buildconfig=true #android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false android.nonFinalResIds=false

View file

@ -1,6 +1,7 @@
#Sun Nov 02 19:45:18 EET 2025
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME