Commit b958666a authored by Geoffrey Métais's avatar Geoffrey Métais

Fix empty and loading views in TV browser

parent 89c1a7d3
......@@ -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;
}
}
}
......
......@@ -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);
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment