From 7ea992dfac30dd23663da581505f9837d168879e Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Fri, 28 Aug 2020 19:50:47 +0300 Subject: [PATCH] fixup: progress --- .../ktnx/mobileledger/ui/activity/MainActivity.java | 12 ++++++------ app/src/main/res/layout/main_app_layout.xml | 1 + 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index 91951306..9cacf3a1 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -634,18 +634,18 @@ public class MainActivity extends ProfileThemedActivity { Logger.debug("progress", "indeterminate"); } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { - progressBar.setMin(0); + if (progressBar.isIndeterminate()) { + progressBar.setIndeterminate(false); } Logger.debug("progress", String.format(Locale.US, "%d/%d", progress.getProgress(), progress.getTotal())); progressBar.setMax(progress.getTotal()); - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { - progressBar.setProgress(progress.getProgress(), true); - } + // for some reason animation doesn't work - no progress is shown (stick at 0) + // on lineageOS 14.1 (Nougat, 7.1.2) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) + progressBar.setProgress(progress.getProgress(), false); else progressBar.setProgress(progress.getProgress()); - progressBar.setIndeterminate(false); } } public void fabShouldShow() { diff --git a/app/src/main/res/layout/main_app_layout.xml b/app/src/main/res/layout/main_app_layout.xml index 8eeba2d9..784e0b6a 100644 --- a/app/src/main/res/layout/main_app_layout.xml +++ b/app/src/main/res/layout/main_app_layout.xml @@ -115,6 +115,7 @@ android:layout_weight="1" android:indeterminate="true" android:padding="0dp" + android:min="0" android:progressTint="?colorPrimary" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" /> -- 2.39.5