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>
<SelectionState runConfigName="app">
<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>
</selectionStates>
</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">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<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 {
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"

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.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) },

View file

@ -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

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.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) {

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
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

View file

@ -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

View file

@ -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

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.
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
}

View file

@ -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

View file

@ -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