From 0cb158b703b6f285d996316d42126f0bb277fda5 Mon Sep 17 00:00:00 2001 From: ChrisUnderhill Date: Sun, 9 Feb 2020 06:00:00 +0000 Subject: [PATCH 1/2] Link to the loading splash screen while waiting --- .../java/com/kill/bill/TestAzureActivity.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/com/kill/bill/TestAzureActivity.java b/app/src/main/java/com/kill/bill/TestAzureActivity.java index 5a30b9c..11479d2 100644 --- a/app/src/main/java/com/kill/bill/TestAzureActivity.java +++ b/app/src/main/java/com/kill/bill/TestAzureActivity.java @@ -162,11 +162,12 @@ public void run() { } - private static class GetImageText extends AsyncTask { - private final ProgressDialog dialog; + private class GetImageText extends AsyncTask { + //private final ProgressDialog dialog; public GetImageText(Activity activity) { - this.dialog = new ProgressDialog(activity); + //this.dialog = new ProgressDialog(activity); + } @Override @@ -290,15 +291,19 @@ protected String doInBackground(String... strings) { @Override protected void onPreExecute() { super.onPreExecute(); - dialog.setMessage("Analysing your receipt"); - dialog.show(); + //dialog.setMessage("Analysing your receipt"); + //dialog.show(); + Intent intent = new Intent(TestAzureActivity.this, Splash.class); + startActivity(intent); } @Override protected void onPostExecute(String s) { super.onPostExecute(s); - dialog.dismiss(); + //dialog.dismiss(); System.out.println("Payload: " + s); + Intent intent = new Intent(TestAzureActivity.this, TransactionList.class); + startActivity(intent); } } } From 8518deec2a3223936873775a2a7e2235385a0145 Mon Sep 17 00:00:00 2001 From: ChrisUnderhill Date: Sun, 9 Feb 2020 06:10:30 +0000 Subject: [PATCH 2/2] Improved loading screen --- .../main/java/com/kill/bill/TestAzureActivity.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/kill/bill/TestAzureActivity.java b/app/src/main/java/com/kill/bill/TestAzureActivity.java index 0a340a6..edff73f 100644 --- a/app/src/main/java/com/kill/bill/TestAzureActivity.java +++ b/app/src/main/java/com/kill/bill/TestAzureActivity.java @@ -90,6 +90,11 @@ protected void onActivityResult(int requestCode, int resultCode, @Nullable Inten bm = (Bitmap) Objects.requireNonNull(data.getExtras()).get("data"); + + Intent intent = new Intent(TestAzureActivity.this, Splash.class); + intent.setFlags(intent.getFlags() | Intent.FLAG_ACTIVITY_NO_HISTORY); + startActivity(intent); + //((ImageView) findViewById(R.id.image)).setImageBitmap(bm); SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss", Locale.ENGLISH); @@ -237,7 +242,7 @@ protected String doInBackground(String... strings) { } else { jsonConnection.disconnect(); jsonConnection.connect(); - Thread.sleep(50); + Thread.sleep(200); } } @@ -285,8 +290,6 @@ protected void onPreExecute() { super.onPreExecute(); //dialog.setMessage("Analysing your receipt"); //dialog.show(); - Intent intent = new Intent(TestAzureActivity.this, Splash.class); - startActivity(intent); } @Override @@ -294,7 +297,7 @@ protected void onPostExecute(String s) { super.onPostExecute(s); //dialog.dismiss(); System.out.println("Payload: " + s); - Intent intent = new Intent(TestAzureActivity.this, TransactionList.class); + Intent intent = new Intent(TestAzureActivity.this, PayLoadParser.class); startActivity(intent); } }