More changes
This commit is contained in:
parent
6aeea1d86a
commit
b51834635a
11 changed files with 131 additions and 133 deletions
1
.idea/gradle.xml
generated
1
.idea/gradle.xml
generated
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
plugins {
|
||||
id 'com.android.application'
|
||||
id 'org.jetbrains.kotlin.android'
|
||||
}
|
||||
|
||||
android {
|
||||
namespace 'com.henryhiles.qscan'
|
||||
compileSdk 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId "com.henryhiles.qscan"
|
||||
minSdk 29
|
||||
targetSdk 33
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = '1.8'
|
||||
}
|
||||
buildFeatures {
|
||||
compose true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion '1.2.0'
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += '/META-INF/{AL2.0,LGPL2.1}'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
|
||||
implementation 'androidx.activity:activity-compose:1.3.1'
|
||||
implementation "androidx.compose.ui:ui:$compose_version"
|
||||
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
|
||||
implementation 'androidx.compose.material3:material3:1.1.0-alpha04'
|
||||
|
||||
implementation "androidx.camera:camera-camera2:1.2.1"
|
||||
implementation "androidx.camera:camera-lifecycle:1.2.1"
|
||||
implementation "androidx.camera:camera-view:1.2.1"
|
||||
|
||||
implementation "com.google.zxing:core:3.3.3"
|
||||
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
|
||||
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
|
||||
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
|
||||
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
|
||||
}
|
73
app/build.gradle.kts
Normal file
73
app/build.gradle.kts
Normal file
|
@ -0,0 +1,73 @@
|
|||
plugins {
|
||||
id("com.android.application")
|
||||
id("org.jetbrains.kotlin.android")
|
||||
}
|
||||
|
||||
android {
|
||||
namespace = "com.henryhiles.qscan"
|
||||
compileSdk = 33
|
||||
|
||||
defaultConfig {
|
||||
applicationId = "com.henryhiles.qscan"
|
||||
minSdk = 29
|
||||
targetSdk = 33
|
||||
versionCode = 1
|
||||
versionName = "1.0"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
named("release") {
|
||||
isMinifyEnabled = false
|
||||
setProguardFiles(
|
||||
listOf(
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||
targetCompatibility = JavaVersion.VERSION_1_8
|
||||
}
|
||||
kotlinOptions {
|
||||
jvmTarget = "1.8"
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
buildConfig = true
|
||||
}
|
||||
composeOptions {
|
||||
kotlinCompilerExtensionVersion = "1.2.0"
|
||||
}
|
||||
packagingOptions {
|
||||
resources {
|
||||
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("androidx.core:core-ktx:1.9.0")
|
||||
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
|
||||
implementation("androidx.activity:activity-compose:1.6.1")
|
||||
|
||||
implementation("androidx.compose.ui:ui:1.3.3")
|
||||
implementation("androidx.compose.ui:ui-tooling-preview:1.3.3")
|
||||
implementation("androidx.compose.material3:material3:1.1.0-alpha06")
|
||||
implementation("androidx.compose.material:material-icons-extended:1.3.1")
|
||||
|
||||
implementation("androidx.camera:camera-camera2:1.2.1")
|
||||
implementation("androidx.camera:camera-lifecycle:1.2.1")
|
||||
implementation("androidx.camera:camera-view:1.2.1")
|
||||
|
||||
implementation("com.google.zxing:core:3.3.3")
|
||||
|
||||
debugImplementation("androidx.compose.ui:ui-tooling:1.3.3")
|
||||
debugImplementation("androidx.compose.ui:ui-test-manifest:1.3.3")
|
||||
}
|
2
app/proguard-rules.pro
vendored
2
app/proguard-rules.pro
vendored
|
@ -1,6 +1,6 @@
|
|||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
# proguardFiles setting in build.gradle.kts.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
@file:OptIn(ExperimentalMaterial3Api::class)
|
||||
|
||||
package com.henryhiles.qscan
|
||||
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Bundle
|
||||
import android.util.Size
|
||||
|
@ -17,6 +17,7 @@ import androidx.camera.core.ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST
|
|||
import androidx.camera.lifecycle.ProcessCameraProvider
|
||||
import androidx.camera.view.PreviewView
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.selection.SelectionContainer
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment.Companion.CenterHorizontally
|
||||
|
@ -46,7 +47,8 @@ class MainActivity : ComponentActivity() {
|
|||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
//@OptIn(ExperimentalMaterial3Api::class)
|
||||
@ExperimentalMaterial3Api
|
||||
@Composable
|
||||
fun Screen() {
|
||||
var code by remember { mutableStateOf("") }
|
||||
|
@ -103,13 +105,12 @@ fun Screen() {
|
|||
if (code != "") {
|
||||
val uriHandler = LocalUriHandler.current
|
||||
val isURL = URLUtil.isValidUrl(code)
|
||||
val activity = lifeCycleOwner as Activity
|
||||
val sharedPref =
|
||||
activity.getPreferences(Context.MODE_PRIVATE)
|
||||
with(sharedPref.edit()) {
|
||||
putBoolean("", true)
|
||||
apply()
|
||||
}
|
||||
// val sharedPref =
|
||||
// activity.getPreferences(Context.MODE_PRIVATE)
|
||||
// with(sharedPref.edit()) {
|
||||
// putBoolean("", true)
|
||||
// apply()
|
||||
// }
|
||||
|
||||
AlertDialog(onDismissRequest = { code = "" }) {
|
||||
Surface(
|
||||
|
@ -121,11 +122,14 @@ fun Screen() {
|
|||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.align(CenterHorizontally)
|
||||
)
|
||||
Text(
|
||||
text = if (isURL) "This QR code will take you to $code, are you sure you want to go there?" else "The content of that QR Code is \"$code\"",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
SelectionContainer {
|
||||
Text(
|
||||
text = if (isURL) "This QR code will take you to $code, are you sure you want to go there?" else "The content of that QR Code is \"$code\"",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.End
|
||||
|
@ -148,6 +152,37 @@ fun Screen() {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else AlertDialog(onDismissRequest = {}) {
|
||||
Surface(
|
||||
shape = MaterialTheme.shapes.large
|
||||
) {
|
||||
Column(modifier = Modifier.padding(16.dp)) {
|
||||
Text(
|
||||
text = "No camera permission",
|
||||
style = MaterialTheme.typography.headlineSmall,
|
||||
modifier = Modifier.align(CenterHorizontally)
|
||||
)
|
||||
SelectionContainer {
|
||||
Text(
|
||||
text = "Camera permission is needed for this app to function.",
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
modifier = Modifier.padding(16.dp)
|
||||
)
|
||||
}
|
||||
|
||||
Row(
|
||||
modifier = Modifier.fillMaxWidth(),
|
||||
horizontalArrangement = Arrangement.End
|
||||
) {
|
||||
TextButton(onClick = { }) {
|
||||
Text(
|
||||
text = "Grant Permission",
|
||||
style = MaterialTheme.typography.labelLarge
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,7 +58,6 @@ fun QScanTheme(
|
|||
|
||||
MaterialTheme(
|
||||
colorScheme = colorScheme,
|
||||
typography = Typography,
|
||||
content = content
|
||||
)
|
||||
}
|
|
@ -1,34 +0,0 @@
|
|||
package com.henryhiles.qscan.ui.theme
|
||||
|
||||
import androidx.compose.material3.Typography
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
// Set of Material typography styles to start with
|
||||
val Typography = Typography(
|
||||
bodyLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 16.sp,
|
||||
lineHeight = 24.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
/* Other default text styles to override
|
||||
titleLarge = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Normal,
|
||||
fontSize = 22.sp,
|
||||
lineHeight = 28.sp,
|
||||
letterSpacing = 0.sp
|
||||
),
|
||||
labelSmall = TextStyle(
|
||||
fontFamily = FontFamily.Default,
|
||||
fontWeight = FontWeight.Medium,
|
||||
fontSize = 11.sp,
|
||||
lineHeight = 16.sp,
|
||||
letterSpacing = 0.5.sp
|
||||
)
|
||||
*/
|
||||
)
|
|
@ -2,5 +2,4 @@
|
|||
<resources>
|
||||
|
||||
<style name="Theme.QScan" parent="android:Theme.Material.Light.NoActionBar" />
|
||||
|
||||
</resources>
|
10
build.gradle
10
build.gradle
|
@ -1,10 +0,0 @@
|
|||
buildscript {
|
||||
ext {
|
||||
compose_version = '1.2.0'
|
||||
}
|
||||
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
plugins {
|
||||
id 'com.android.application' version '7.4.1' apply false
|
||||
id 'com.android.library' version '7.4.1' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
|
||||
}
|
5
build.gradle.kts
Normal file
5
build.gradle.kts
Normal file
|
@ -0,0 +1,5 @@
|
|||
plugins {
|
||||
id("com.android.application") version "7.4.1" apply false
|
||||
id("com.android.library") version "7.4.1" apply false
|
||||
id("org.jetbrains.kotlin.android") version "1.7.0" apply false
|
||||
}
|
|
@ -13,4 +13,4 @@ dependencyResolutionManagement {
|
|||
}
|
||||
}
|
||||
rootProject.name = "QScan"
|
||||
include ':app'
|
||||
include(":app")
|
Reference in a new issue