[Android] Improve the medialibrary scan progress UI
Nicolas Pomepuy
git at videolan.org
Thu May 20 08:17:26 UTC 2021
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue May 18 15:58:16 2021 +0200| [ec88ee31f52419b723c1813c9a158b42f6a3f233] | committer: Nicolas Pomepuy
Improve the medialibrary scan progress UI
Fixes #2011
> https://code.videolan.org/videolan/vlc-android/commit/ec88ee31f52419b723c1813c9a158b42f6a3f233
---
.../res/drawable/rounded_corners_scan_progress.xml | 9 +++++
.../resources/src/main/res/values/dimens.xml | 1 -
application/vlc-android/res/layout/main.xml | 2 +-
.../vlc-android/res/layout/scan_progress.xml | 43 ++++++++++++++--------
application/vlc-android/res/layout/secondary.xml | 2 +-
.../src/org/videolan/vlc/MediaParsingService.kt | 2 +-
6 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/application/resources/src/main/res/drawable/rounded_corners_scan_progress.xml b/application/resources/src/main/res/drawable/rounded_corners_scan_progress.xml
new file mode 100644
index 000000000..a17fa9a76
--- /dev/null
+++ b/application/resources/src/main/res/drawable/rounded_corners_scan_progress.xml
@@ -0,0 +1,9 @@
+<shape
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:shape="rectangle">
+ <solid android:color="?attr/background_default_darker">
+ </solid>
+ <corners android:radius="24dp">
+ </corners>
+
+</shape>
\ No newline at end of file
diff --git a/application/resources/src/main/res/values/dimens.xml b/application/resources/src/main/res/values/dimens.xml
index 9693faa79..f2d806ade 100644
--- a/application/resources/src/main/res/values/dimens.xml
+++ b/application/resources/src/main/res/values/dimens.xml
@@ -85,7 +85,6 @@
<dimen name="fastscroller_track_padding">5dp</dimen>
<dimen name="audio_player_cover_margin">8dp</dimen>
<dimen name="audio_player_elevation">8dp</dimen>
- <dimen name="progress_layout_height">20dp</dimen>
<dimen name="dialog_sd_wisard_width">320dp</dimen>
<dimen name="dialog_sd_wisard_height">420dp</dimen>
diff --git a/application/vlc-android/res/layout/main.xml b/application/vlc-android/res/layout/main.xml
index 16cbdc09a..87892e491 100644
--- a/application/vlc-android/res/layout/main.xml
+++ b/application/vlc-android/res/layout/main.xml
@@ -25,7 +25,7 @@
<androidx.appcompat.widget.ViewStubCompat
android:id="@+id/scan_viewstub"
android:layout_width="match_parent"
- android:layout_height="@dimen/progress_layout_height"
+ android:layout_height="wrap_content"
app:layout_anchor="@+id/navigation"
app:layout_anchorGravity="top"
android:layout_gravity="top"
diff --git a/application/vlc-android/res/layout/scan_progress.xml b/application/vlc-android/res/layout/scan_progress.xml
index aacd33f8a..143207090 100644
--- a/application/vlc-android/res/layout/scan_progress.xml
+++ b/application/vlc-android/res/layout/scan_progress.xml
@@ -1,25 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/scan_progress_layout"
android:layout_width="match_parent"
- android:layout_height="@dimen/progress_layout_height">
-
- <ProgressBar
- android:id="@+id/scan_progress_bar"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:max="100"
- style="@android:style/Widget.ProgressBar.Horizontal"
- android:progressDrawable="?attr/progress_mini_player"
- android:background="?attr/background_default" />
-
+ android:layout_height="wrap_content">
<TextView
android:id="@+id/scan_progress_text"
- android:layout_width="match_parent"
+ android:layout_width="wrap_content"
android:layout_height="match_parent"
+ android:layout_marginStart="16dp"
+ android:layout_marginBottom="8dp"
+ android:background="@drawable/rounded_corners_scan_progress"
android:gravity="center"
android:maxLines="1"
- android:textColor="?attr/font_default"
+ android:paddingStart="16dp"
+ android:paddingTop="4dp"
+ android:paddingEnd="16dp"
+ android:paddingBottom="4dp"
android:text="@string/loading_medialibrary"
- android:textSize="12sp" />
-</RelativeLayout>
\ No newline at end of file
+ android:textColor="?attr/font_default"
+ android:textSize="12sp"
+ app:layout_constraintBottom_toTopOf="@+id/scan_progress_bar"
+ app:layout_constraintStart_toStartOf="parent" />
+ <ProgressBar
+ android:id="@+id/scan_progress_bar"
+ style="@android:style/Widget.ProgressBar.Horizontal"
+ android:layout_width="0dp"
+ android:layout_height="4dp"
+ android:background="?attr/background_default"
+ android:max="100"
+ android:progressDrawable="?attr/progress_mini_player"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent" />
+</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
diff --git a/application/vlc-android/res/layout/secondary.xml b/application/vlc-android/res/layout/secondary.xml
index ac3724080..c779a564f 100644
--- a/application/vlc-android/res/layout/secondary.xml
+++ b/application/vlc-android/res/layout/secondary.xml
@@ -22,7 +22,7 @@
<androidx.appcompat.widget.ViewStubCompat
android:id="@+id/scan_viewstub"
android:layout_width="match_parent"
- android:layout_height="@dimen/progress_layout_height"
+ android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout="@layout/scan_progress" />
diff --git a/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt b/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
index 0dc3399de..5b3514aa2 100644
--- a/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
+++ b/application/vlc-android/src/org/videolan/vlc/MediaParsingService.kt
@@ -343,7 +343,7 @@ class MediaParsingService : LifecycleService(), DevicesDiscoveryCb {
lastNotificationTime = currentTime
val discovery = withContext(Dispatchers.Default) {
val progressText = when {
- parsing > 0 -> getString(R.string.ml_parse_media) + " " + parsing + "%"
+ parsing > 0 -> getString(R.string.ml_parse_media) + " " + parsing + "% ยท " + Uri.parse(currentDiscovery).lastPathSegment
currentDiscovery != null -> getString(R.string.ml_discovering) + " " + Uri.decode(currentDiscovery?.removeFileProtocole())
else -> getString(R.string.ml_parse_media)
}
More information about the Android
mailing list