[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
+4 -4
View File
@@ -5,14 +5,14 @@ plugins {
android {
namespace = "com.janishutz.libreevent"
compileSdk = 35
compileSdk = 36
defaultConfig {
applicationId = "com.janishutz.libreevent"
minSdk = 24
targetSdk = 35
versionCode = 5
versionName = "1.0.1"
targetSdk = 36
versionCode = 6
versionName = "1.1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
Binary file not shown.
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
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
android:allowBackup="true"
@@ -11,7 +16,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LibreeventEntryControl"
tools:targetApi="31">
tools:targetApi="35">
<activity
android:name=".MainActivity"
android:exported="true">
@@ -26,8 +31,4 @@
android:exported="true">
</activity>
</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>
@@ -13,6 +13,7 @@ import com.journeyapps.barcodescanner.CaptureActivity
import com.journeyapps.barcodescanner.CaptureManager
import com.journeyapps.barcodescanner.DecoratedBarcodeView
import java.util.Date
import androidx.core.content.edit
class ScannerActivity : CaptureActivity() {
@@ -30,10 +31,10 @@ class ScannerActivity : CaptureActivity() {
val logoutButton = findViewById<Button>(R.id.logoutButton)
logoutButton.setOnClickListener {
val sharedPref = applicationContext.getSharedPreferences( "login", MODE_PRIVATE )
val editor = sharedPref.edit()
editor.remove( "password" )
editor.remove( "loginOk" )
editor.apply()
sharedPref.edit {
remove("password")
remove("loginOk")
}
val switchIntent = Intent(this, MainActivity::class.java)
switchIntent.putExtra("hasSwitched", true)
startActivity(switchIntent)
@@ -52,14 +53,12 @@ class ScannerActivity : CaptureActivity() {
captureManager.initializeFromIntent(intent, null)
captureManager.decode()
barcodeView.decodeContinuous(object : BarcodeCallback {
override fun barcodeResult(result: BarcodeResult?) {
if (result != null) {
val scannedData = result.text // This is the scanned data (e.g., QR code content)
handleScanResult(scannedData)
}
barcodeView.decodeContinuous { result ->
if (result != null) {
val scannedData = result.text // This is the scanned data (e.g., QR code content)
handleScanResult(scannedData)
}
})
}
}
private fun handleScanResult(result: String) {
@@ -73,13 +72,17 @@ class ScannerActivity : CaptureActivity() {
lastScanned = result
val alertDialogBuilder = AlertDialog.Builder(this)
if ( status == "ticketValid" ) {
alertDialogBuilder.setTitle("Ticket is valid")
} else if ( status == "ticketInvalid" ) {
alertDialogBuilder.setTitle("Ticket is invalid")
} else if ( status == "Error" ) {
alertDialogBuilder.setTitle("There was an error connecting")
alertDialogBuilder.setMessage("Please log out and log in again")
when (status) {
"ticketValid" -> {
alertDialogBuilder.setTitle("Ticket is valid")
}
"ticketInvalid" -> {
alertDialogBuilder.setTitle("Ticket is invalid")
}
"Error" -> {
alertDialogBuilder.setTitle("There was an error connecting")
alertDialogBuilder.setMessage("Please log out and log in again")
}
}
alertDialogBuilder.setIcon(android.R.drawable.ic_dialog_alert)
@@ -10,13 +10,14 @@
<com.journeyapps.barcodescanner.DecoratedBarcodeView
android:id="@+id/barcodeScannerView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
android:layout_height="match_parent">
<Button
android:id="@+id/logoutButton"
android:layout_width="122dp"
android:layout_height="wrap_content"
android:text="Log out" />
android:text="@string/log_out" />
</com.journeyapps.barcodescanner.DecoratedBarcodeView>
</FrameLayout>
@@ -1,3 +1,4 @@
<resources>
<string name="app_name">libreevent entry control</string>
<string name="log_out">Log out</string>
</resources>