target sdk 36
This commit is contained in:
parent
31809449eb
commit
bddb556bb1
19 changed files with 97 additions and 37 deletions
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package org.fnives.android.qrcodetransfer.config
|
||||
|
||||
object BuildConfig : BuildConfigDeclaration {
|
||||
override val isDebug: Boolean = true
|
||||
}
|
||||
|
|
@ -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) },
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
package org.fnives.android.qrcodetransfer.config
|
||||
|
||||
interface BuildConfigDeclaration {
|
||||
|
||||
val isDebug: Boolean
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,5 @@
|
|||
package org.fnives.android.qrcodetransfer.config
|
||||
|
||||
object BuildConfig : BuildConfigDeclaration {
|
||||
override val isDebug: Boolean = false
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue