[Android] Update app

This commit is contained in:
2026-01-22 13:08:38 +01:00
parent 0219e718dc
commit 28acb2070c
10 changed files with 38 additions and 32 deletions

View File

@@ -6,6 +6,7 @@
<GradleProjectSettings> <GradleProjectSettings>
<option name="testRunner" value="CHOOSE_PER_TEST" /> <option name="testRunner" value="CHOOSE_PER_TEST" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="/usr/share/java/gradle" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" /> <option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules"> <option name="modules">
<set> <set>

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

@@ -5,14 +5,14 @@ plugins {
android { android {
namespace = "com.janishutz.libreevent" namespace = "com.janishutz.libreevent"
compileSdk = 35 compileSdk = 36
defaultConfig { defaultConfig {
applicationId = "com.janishutz.libreevent" applicationId = "com.janishutz.libreevent"
minSdk = 24 minSdk = 24
targetSdk = 35 targetSdk = 36
versionCode = 5 versionCode = 6
versionName = "1.0.1" versionName = "1.1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
} }

View File

@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"> xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="true"
tools:ignore="UnnecessaryRequiredFeature" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<application <application
android:allowBackup="true" android:allowBackup="true"
@@ -11,7 +16,7 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/Theme.LibreeventEntryControl" android:theme="@style/Theme.LibreeventEntryControl"
tools:targetApi="31"> tools:targetApi="35">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true"> android:exported="true">
@@ -26,8 +31,4 @@
android:exported="true"> android:exported="true">
</activity> </activity>
</application> </application>
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="true" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest> </manifest>

View File

@@ -13,6 +13,7 @@ import com.journeyapps.barcodescanner.CaptureActivity
import com.journeyapps.barcodescanner.CaptureManager import com.journeyapps.barcodescanner.CaptureManager
import com.journeyapps.barcodescanner.DecoratedBarcodeView import com.journeyapps.barcodescanner.DecoratedBarcodeView
import java.util.Date import java.util.Date
import androidx.core.content.edit
class ScannerActivity : CaptureActivity() { class ScannerActivity : CaptureActivity() {
@@ -30,10 +31,10 @@ class ScannerActivity : CaptureActivity() {
val logoutButton = findViewById<Button>(R.id.logoutButton) val logoutButton = findViewById<Button>(R.id.logoutButton)
logoutButton.setOnClickListener { logoutButton.setOnClickListener {
val sharedPref = applicationContext.getSharedPreferences( "login", MODE_PRIVATE ) val sharedPref = applicationContext.getSharedPreferences( "login", MODE_PRIVATE )
val editor = sharedPref.edit() sharedPref.edit {
editor.remove( "password" ) remove("password")
editor.remove( "loginOk" ) remove("loginOk")
editor.apply() }
val switchIntent = Intent(this, MainActivity::class.java) val switchIntent = Intent(this, MainActivity::class.java)
switchIntent.putExtra("hasSwitched", true) switchIntent.putExtra("hasSwitched", true)
startActivity(switchIntent) startActivity(switchIntent)
@@ -52,14 +53,12 @@ class ScannerActivity : CaptureActivity() {
captureManager.initializeFromIntent(intent, null) captureManager.initializeFromIntent(intent, null)
captureManager.decode() captureManager.decode()
barcodeView.decodeContinuous(object : BarcodeCallback { barcodeView.decodeContinuous { result ->
override fun barcodeResult(result: BarcodeResult?) {
if (result != null) { if (result != null) {
val scannedData = result.text // This is the scanned data (e.g., QR code content) val scannedData = result.text // This is the scanned data (e.g., QR code content)
handleScanResult(scannedData) handleScanResult(scannedData)
} }
} }
})
} }
private fun handleScanResult(result: String) { private fun handleScanResult(result: String) {
@@ -73,14 +72,18 @@ class ScannerActivity : CaptureActivity() {
lastScanned = result lastScanned = result
val alertDialogBuilder = AlertDialog.Builder(this) val alertDialogBuilder = AlertDialog.Builder(this)
if ( status == "ticketValid" ) { when (status) {
"ticketValid" -> {
alertDialogBuilder.setTitle("Ticket is valid") alertDialogBuilder.setTitle("Ticket is valid")
} else if ( status == "ticketInvalid" ) { }
"ticketInvalid" -> {
alertDialogBuilder.setTitle("Ticket is invalid") alertDialogBuilder.setTitle("Ticket is invalid")
} else if ( status == "Error" ) { }
"Error" -> {
alertDialogBuilder.setTitle("There was an error connecting") alertDialogBuilder.setTitle("There was an error connecting")
alertDialogBuilder.setMessage("Please log out and log in again") alertDialogBuilder.setMessage("Please log out and log in again")
} }
}
alertDialogBuilder.setIcon(android.R.drawable.ic_dialog_alert) alertDialogBuilder.setIcon(android.R.drawable.ic_dialog_alert)

View File

@@ -16,7 +16,8 @@
android:id="@+id/logoutButton" android:id="@+id/logoutButton"
android:layout_width="122dp" android:layout_width="122dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="Log out" /> android:text="@string/log_out" />
</com.journeyapps.barcodescanner.DecoratedBarcodeView> </com.journeyapps.barcodescanner.DecoratedBarcodeView>
</FrameLayout> </FrameLayout>

View File

@@ -1,3 +1,4 @@
<resources> <resources>
<string name="app_name">libreevent entry control</string> <string name="app_name">libreevent entry control</string>
<string name="log_out">Log out</string>
</resources> </resources>

View File

@@ -1,5 +1,5 @@
// 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.9.1" apply false id("com.android.application") version "8.13.1" apply false
id("org.jetbrains.kotlin.android") version "1.9.0" apply false id("org.jetbrains.kotlin.android") version "1.9.0" apply false
} }

View File

@@ -1,6 +1,6 @@
#Sun Sep 03 11:15:46 CEST 2023 #Sun Sep 03 11:15:46 CEST 2023
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists