[Android] TV: Fix progress not showing during media scan
Geoffrey Métais
git at videolan.org
Wed Sep 13 19:12:22 CEST 2017
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Sep 13 19:11:48 2017 +0200| [a206d2da78f39621f1aca5727517455bb856d9fc] | committer: Geoffrey Métais
TV: Fix progress not showing during media scan
> https://code.videolan.org/videolan/vlc-android/commit/a206d2da78f39621f1aca5727517455bb856d9fc
---
vlc-android/res/layout/tv_main.xml | 6 ++++--
vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java | 6 ++++++
.../src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java | 11 ++++++++---
3 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/vlc-android/res/layout/tv_main.xml b/vlc-android/res/layout/tv_main.xml
index bc02494a5..2d3882098 100644
--- a/vlc-android/res/layout/tv_main.xml
+++ b/vlc-android/res/layout/tv_main.xml
@@ -8,11 +8,13 @@
android:id="@+id/browse_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
+
<ProgressBar
android:id="@+id/tv_main_progress"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
- android:layout_margin="10dp"
- android:visibility="gone"/>
+ android:layout_marginRight="128dp"
+ android:layout_marginTop="32dp"
+ android:visibility="gone" />
</FrameLayout>
\ No newline at end of file
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
index 7268a0d0a..3ab60af5b 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/MainTvActivity.java
@@ -363,6 +363,12 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
}
@Override
+ protected void onParsingServiceProgress() {
+ if (mProgressBar.getVisibility() == View.GONE)
+ mHandler.sendEmptyMessage(SHOW_LOADING);
+ }
+
+ @Override
protected void onParsingServiceFinished() {
update();
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
index 9c97c9124..27dc8330c 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/BaseTvActivity.java
@@ -71,14 +71,15 @@ public abstract class BaseTvActivity extends PlaybackServiceActivity {
super.onStart();
mIsVisible = true;
//Handle network connection state
- IntentFilter networkFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
+ final IntentFilter networkFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
- IntentFilter storageFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
+ final IntentFilter storageFilter = new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
storageFilter.addAction(Intent.ACTION_MEDIA_REMOVED);
storageFilter.addAction(Intent.ACTION_MEDIA_EJECT);
storageFilter.addDataScheme("file");
- IntentFilter parsingServiceFilter = new IntentFilter(MediaParsingService.ACTION_SERVICE_ENDED);
+ final IntentFilter parsingServiceFilter = new IntentFilter(MediaParsingService.ACTION_SERVICE_ENDED);
parsingServiceFilter.addAction(MediaParsingService.ACTION_SERVICE_STARTED);
+ parsingServiceFilter.addAction(MediaParsingService.ACTION_PROGRESS);
parsingServiceFilter.addAction(MediaParsingService.ACTION_NEW_STORAGE);
mRegistering = true;
@@ -119,6 +120,9 @@ public abstract class BaseTvActivity extends PlaybackServiceActivity {
case MediaParsingService.ACTION_SERVICE_STARTED:
onParsingServiceStarted();
break;
+ case MediaParsingService.ACTION_PROGRESS:
+ onParsingServiceProgress();
+ break;
case MediaParsingService.ACTION_NEW_STORAGE:
UiTools.newStorageDetected(BaseTvActivity.this, intent.getStringExtra(MediaParsingService.EXTRA_PATH));
break;
@@ -131,6 +135,7 @@ public abstract class BaseTvActivity extends PlaybackServiceActivity {
}
protected void onParsingServiceStarted() {}
+ protected void onParsingServiceProgress() {}
protected void onParsingServiceFinished() {}
protected final BroadcastReceiver mExternalDevicesReceiver = new BroadcastReceiver() {
More information about the Android
mailing list