Support api 24
This commit is contained in:
parent
83cbd935ae
commit
c2ca9009c0
3 changed files with 6 additions and 6 deletions
|
|
@ -13,7 +13,7 @@ android {
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId applicationIdArgument ?: "org.fnives.android.qrcodetransfer"
|
applicationId applicationIdArgument ?: "org.fnives.android.qrcodetransfer"
|
||||||
minSdk 26
|
minSdk 24
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode applicationVersionCodeArgument ?: 1
|
versionCode applicationVersionCodeArgument ?: 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
@ -75,7 +75,7 @@ dependencies {
|
||||||
def compose_ui_version = '1.5.4'
|
def compose_ui_version = '1.5.4'
|
||||||
implementation 'androidx.core:core-ktx:1.12.0'
|
implementation 'androidx.core:core-ktx:1.12.0'
|
||||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
|
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
|
||||||
implementation 'androidx.activity:activity-compose:1.8.1'
|
implementation 'androidx.activity:activity-compose:1.8.2'
|
||||||
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.5.4'
|
implementation 'androidx.compose.material:material:1.5.4'
|
||||||
|
|
@ -87,7 +87,7 @@ dependencies {
|
||||||
implementation 'com.google.accompanist:accompanist-permissions:0.32.0'
|
implementation 'com.google.accompanist:accompanist-permissions:0.32.0'
|
||||||
|
|
||||||
// camerax
|
// camerax
|
||||||
def camerax_version = "1.3.0"
|
def camerax_version = "1.3.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"
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ fun interface PreviewProcessor {
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun CameraView(
|
fun CameraView(
|
||||||
interval: Duration,
|
intervalInMillis: Long,
|
||||||
processImage: PreviewProcessor,
|
processImage: PreviewProcessor,
|
||||||
backgroundColor: Color = Color.Black,
|
backgroundColor: Color = Color.Black,
|
||||||
) {
|
) {
|
||||||
|
|
@ -74,7 +74,7 @@ fun CameraView(
|
||||||
|
|
||||||
bitmapReaderScope.launch {
|
bitmapReaderScope.launch {
|
||||||
while (isActive) {
|
while (isActive) {
|
||||||
delay(interval.toMillis())
|
delay(intervalInMillis)
|
||||||
bitmapStream.value = bitmap
|
bitmapStream.value = bitmap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ fun QRCodeReader() {
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
.fillMaxWidth(),
|
.fillMaxWidth(),
|
||||||
) {
|
) {
|
||||||
CameraView(interval = Duration.ofSeconds(1), processImage = {
|
CameraView(intervalInMillis = 1000L, processImage = {
|
||||||
readState = processImage(it, readState)
|
readState = processImage(it, readState)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue