[Android] Fix empty and loading views in TV browser
Geoffrey Métais
git at videolan.org
Mon Feb 8 18:33:12 CET 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Mon Feb 8 18:32:39 2016 +0100| [b958666a83071a4b3194c3d86a12ee304940693c] | committer: Geoffrey Métais
Fix empty and loading views in TV browser
> https://code.videolan.org/videolan/vlc-android/commit/b958666a83071a4b3194c3d86a12ee304940693c
---
.../vlc/gui/tv/browser/SortedBrowserFragment.java | 17 ++++++++++++++---
.../vlc/gui/tv/browser/VerticalGridActivity.java | 1 +
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
index 945e558..0008c2d 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/SortedBrowserFragment.java
@@ -73,6 +73,7 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
public static final String SELECTED_ITEM = "selected";
public static final int UPDATE_DISPLAY = 1;
public static final int UPDATE_ITEM = 2;
+ public static final int HIDE_LOADING = 3;
protected Uri mUri;
protected MediaBrowser mMediaBrowser;
@@ -166,15 +167,15 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
if (mUri == null) { // we are at root level
sort();
}
+ ((BrowserActivityInterface)getActivity()).updateEmptyView(false);
((BrowserActivityInterface)getActivity()).showProgress(false);
}
public void onMediaRemoved(int index, Media media) {}
public void onBrowseEnd() {
- ((BrowserActivityInterface)getActivity()).showProgress(false);
- ((BrowserActivityInterface)getActivity()).updateEmptyView(mAdapter.size() == 0);
sort();
+ mHandler.sendEmptyMessage(HIDE_LOADING);
}
@Override
@@ -230,7 +231,7 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
adapter.addAll(0, item.mediaList);
mAdapter.add(new ListRow(header, adapter));
}
- ((BrowserActivityInterface)getActivity()).updateEmptyView(mAdapter.size() == 0);
+ mHandler.sendEmptyMessageDelayed(HIDE_LOADING, 3000);
}
protected void addMedia(Media media){
@@ -249,6 +250,12 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
mMediaItemMap.put(letter, item);
}
((BrowserActivityInterface)getActivity()).showProgress(false);
+ ((BrowserActivityInterface)getActivity()).updateEmptyView(false);
+ mHandler.removeMessages(HIDE_LOADING);
+ }
+
+ public boolean isEmpty() {
+ return mMediaItemMap.isEmpty();
}
@Override
@@ -302,6 +309,10 @@ public abstract class SortedBrowserFragment extends BrowseFragment implements Br
case UPDATE_DISPLAY:
owner.updateList();
break;
+ case HIDE_LOADING:
+ ((VerticalGridActivity)owner.getActivity()).showProgress(false);
+ ((VerticalGridActivity)owner.getActivity()).updateEmptyView(owner.isEmpty());
+ break;
}
}
}
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.java b/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.java
index 3d6dd30..62bfb1f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.java
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/browser/VerticalGridActivity.java
@@ -85,6 +85,7 @@ public class VerticalGridActivity extends BaseTvActivity implements BrowserActiv
runOnUiThread(new Runnable() {
@Override
public void run() {
+ mEmptyView.setVisibility(View.GONE);
mContentLoadingProgressBar.setVisibility(show ? View.VISIBLE : View.GONE);
}
});
More information about the Android
mailing list