commit eb53fdeaac243254b4ddcf647f20078d0efcf233
parent 49836dab30f4bb23b9ae3e1931dc872ac8fd5bb5
Author: Matyja Lukas Adam <lukas.matyja@students.bfh.ch>
Date: Tue, 18 Jun 2024 23:39:44 +0200
verification app add gui
Diffstat:
4 files changed, 97 insertions(+), 25 deletions(-)
diff --git a/verification-app/app/src/main/cpp/verification.cpp b/verification-app/app/src/main/cpp/verification.cpp
@@ -29,16 +29,6 @@
*/
#define TALER_AMOUNT_MAX_VALUE (1LLU << 52)
-extern "C"
-JNIEXPORT jstring JNICALL
-Java_taler_donau_verification_Results_stringFromJNI(
- JNIEnv* env,
- jobject /* this */) {
- std::string hello = "Hello from C++";
- LOGI("hhdh");
- return env->NewStringUTF(hello.c_str());
-}
-
/**
* Define as empty, GNUNET_PACKED should suffice, but this won't work on W32
*/
diff --git a/verification-app/app/src/main/java/taler/donau/verification/Results.java b/verification-app/app/src/main/java/taler/donau/verification/Results.java
@@ -16,6 +16,7 @@
package taler.donau.verification;
+import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
@@ -48,7 +49,10 @@ public class Results extends AppCompatActivity {
private String salt;
private String eddsaSignature;
private String publicKey;
- TextView textView;
+ TextView sigStatusView;
+ TextView yearView;
+ TextView taxidView;
+ TextView totalView;
public enum SignatureStatus {
INVALID_NUMBER_OF_ARGUMENTS,
@@ -58,14 +62,16 @@ public class Results extends AppCompatActivity {
}
+ @SuppressLint("MissingInflatedId")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_results);
- textView = findViewById(R.id.textView);
- //textView.setText(stringFromJNI());
+ sigStatusView = findViewById(R.id.sigStatus);
+ yearView = findViewById(R.id.year);
+ taxidView = findViewById(R.id.taxid);
+ totalView = findViewById(R.id.total);
Intent intent = getIntent();
- textView.setText(intent.getStringExtra("QR-String"));
String[] parts = intent.getStringExtra("QR-String").split("/");
if (parts == null || parts.length != NUMBER_OF_ARGUMENTS) {
@@ -108,25 +114,27 @@ public class Results extends AppCompatActivity {
View rootView = findViewById(R.id.root_view);
switch (es) {
case INVALID_NUMBER_OF_ARGUMENTS:
- textView.setText(R.string.invalid_number_of_arguments);
+ sigStatusView.setText(R.string.invalid_number_of_arguments);
rootView.setBackgroundResource(R.color.red);
break;
case MALFORMED_ARGUMENT:
- textView.setText(R.string.malformed_argument);
+ sigStatusView.setText(R.string.malformed_argument);
rootView.setBackgroundResource(R.color.red);
break;
case SIGNATURE_INVALID:
- textView.setText(R.string.invalid_signature);
+ sigStatusView.setText(R.string.invalid_signature);
rootView.setBackgroundResource(R.color.red);
break;
case SIGNATURE_VALID:
- textView.setText(R.string.valid_signature);
+ sigStatusView.setText(R.string.valid_signature);
+ yearView.setText(year);
+ taxidView.setText("tbd");
+ totalView.setText(totalAmount);
rootView.setBackgroundResource(R.color.green);
break;
}
}
- public native String stringFromJNI();
public native int ed25519_verify(String year, String totalAmount,
String taxId, String salt,
String eddsaSignature, String publicKey);
diff --git a/verification-app/app/src/main/res/layout/fragment_results.xml b/verification-app/app/src/main/res/layout/fragment_results.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/root_view"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
@@ -8,7 +8,9 @@ android:paddingStart="10dp"
android:paddingEnd="10dp"
android:orientation="vertical"
tools:context=".MainActivity">
+
<ImageView
+ android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="200dp"
@@ -17,11 +19,82 @@ tools:context=".MainActivity">
android:src="@drawable/ngi_taler_logo"
android:contentDescription="@string/NGI_TALER_logo" />
+<TableLayout
+ android:id="@+id/tableLayout"
+ android:layout_below="@+id/image"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:stretchColumns="1">
+
+ <!-- Row 1 -->
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:textStyle="bold"
+ android:text="Year: "
+ android:textSize="18sp" />
+
+ <TextView
+ android:id="@+id/year"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:textSize="18sp" />
+ </TableRow>
+
+ <!-- Row 2 -->
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:textStyle="bold"
+ android:text="Tax Id: "
+ android:textSize="18sp" />
+
+ <TextView
+ android:id="@+id/taxid"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:textSize="18sp" />
+ </TableRow>
+
+ <!-- Row 3 -->
+ <TableRow
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:textStyle="bold"
+ android:text="Total Amount: "
+ android:textSize="18sp" />
+
+ <TextView
+ android:id="@+id/total"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:textSize="18sp" />
+ </TableRow>
+
+</TableLayout>
+
<TextView
- android:id="@+id/textView"
+ android:id="@+id/sigStatus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:layout_centerInParent="true"/>
-
-</LinearLayout>
+</RelativeLayout>
+\ No newline at end of file
diff --git a/verification-app/app/src/main/res/values/strings.xml b/verification-app/app/src/main/res/values/strings.xml
@@ -4,6 +4,6 @@
<string name="with_adapter">List</string>
<string name="invalid_number_of_arguments">Invalid number of arguments!</string>
<string name="malformed_argument">Malformed argument!</string>
- <string name="invalid_signature">Donation Statment signature is invalid!</string>
- <string name="valid_signature">Donation Statment signature is valid!</string>
+ <string name="invalid_signature">Donation Statement signature is invalid!</string>
+ <string name="valid_signature">Donation Statement signature is valid!</string>
</resources>
\ No newline at end of file