From 57fbb426362eb97cfa2b0c5b25887238b363f60a Mon Sep 17 00:00:00 2001 From: Shubham Tyagi Date: Tue, 1 Oct 2024 16:11:10 +0530 Subject: [PATCH] fix crash --- .../github/subhamtyagi/ocr/MainActivity.java | 4 ++-- app/src/main/res/layout/activity_main.xml | 24 +++++++------------ 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/app/src/main/java/io/github/subhamtyagi/ocr/MainActivity.java b/app/src/main/java/io/github/subhamtyagi/ocr/MainActivity.java index c207e9a..1d5626c 100644 --- a/app/src/main/java/io/github/subhamtyagi/ocr/MainActivity.java +++ b/app/src/main/java/io/github/subhamtyagi/ocr/MainActivity.java @@ -608,7 +608,7 @@ private boolean downloadTrainingData(String dataType, String lang) { handler.post(() -> { mProgressSpinner.setVisibility(View.GONE); mProgressBar.setVisibility(View.VISIBLE); - mProgressMessage.setText(String.format("%d %s %d", 0, getString(R.string.percentage_downloaded), size)); // Update message + mProgressMessage.setText("0"+ getString(R.string.percentage_downloaded)+ size); mProgressBar.setProgress(0); // Reset progress bar to 0 }); @@ -625,7 +625,7 @@ private boolean downloadTrainingData(String dataType, String lang) { int percentage = (downloaded * 100) / totalContentSize; handler.post(() -> { mProgressBar.setProgress(percentage); - mProgressMessage.setText(String.format("%d %s %d", percentage, getString(R.string.percentage_downloaded), size)); + mProgressMessage.setText(percentage+getString(R.string.percentage_downloaded)+size+"."); }); } output.flush(); diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 16ab80f..33472f0 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -17,11 +17,11 @@ tools:progress="20" tools:visibility="visible" /> - + android:textSize="18sp" /> - + android:textSize="16sp" /> + android:layout_marginTop="16dp" /> + app:indicatorColor="@color/colorAccent" /> - +