Skip to content
Snippets Groups Projects
Commit a206d2da authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

TV: Fix progress not showing during media scan

parent 5e92f74d
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -362,6 +362,12 @@ public class MainTvActivity extends BaseTvActivity implements OnItemViewSelected
mHandler.sendEmptyMessageDelayed(SHOW_LOADING, 300);
}
@Override
protected void onParsingServiceProgress() {
if (mProgressBar.getVisibility() == View.GONE)
mHandler.sendEmptyMessage(SHOW_LOADING);
}
@Override
protected void onParsingServiceFinished() {
update();
......
......@@ -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() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment