[Android] Network: Fix lists title visibility
Geoffrey Métais
git at videolan.org
Fri Apr 20 13:53:32 CEST 2018
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Apr 20 13:48:55 2018 +0200| [1c88c622ce29d908e97142fe0555a711cc0b7f7d] | committer: Geoffrey Métais
Network: Fix lists title visibility
> https://code.videolan.org/videolan/vlc-android/commit/1c88c622ce29d908e97142fe0555a711cc0b7f7d
---
.../vlc/gui/browser/NetworkBrowserFragment.java | 33 +++++++++++-----------
1 file changed, 16 insertions(+), 17 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java b/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
index 6ecf0cd77..868c16883 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/NetworkBrowserFragment.java
@@ -77,7 +77,7 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements Simpl
if (mRoot) ((NetworkProvider) mProvider).getFavorites().observe(this, new Observer<List<MediaLibraryItem>>() {
@Override
public void onChanged(@Nullable List<MediaLibraryItem> mediaLibraryItems) {
- mBinding.favoritesTitle.setVisibility(Util.isListEmpty(mediaLibraryItems) ? View.GONE : View.VISIBLE);
+ mBinding.setShowFavorites(!Util.isListEmpty(mediaLibraryItems));
favoritesAdapter.submitList(mediaLibraryItems);
}
});
@@ -210,30 +210,29 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements Simpl
* Update views visibility and emptiness info
*/
protected void updateEmptyView() {
- if (mEmptyView == null) return;
+ if (mBinding == null) return;
if (ExternalMonitor.connected.getValue()) {
if (Util.isListEmpty(getProvider().getDataset().getValue())) {
if (mSwipeRefreshLayout == null || mSwipeRefreshLayout.isRefreshing()) {
- mEmptyView.setText(R.string.loading);
- mEmptyView.setVisibility(View.VISIBLE);
- mRecyclerView.setVisibility(View.GONE);
+ mBinding.empty.setText(R.string.loading);
+ mBinding.empty.setVisibility(View.VISIBLE);
+ mBinding.networkList.setVisibility(View.GONE);
} else {
- if (mRoot)
- mEmptyView.setText(allowLAN() ? R.string.network_shares_discovery : R.string.network_connection_needed);
- else
- mEmptyView.setText(R.string.network_empty);
- mEmptyView.setVisibility(View.VISIBLE);
- mRecyclerView.setVisibility(View.GONE);
+ if (mRoot) mBinding.empty.setText(allowLAN() ? R.string.network_shares_discovery : R.string.network_connection_needed);
+ else mBinding.empty.setText(R.string.network_empty);
+ mBinding.empty.setVisibility(View.VISIBLE);
+ mBinding.networkList.setVisibility(View.GONE);
mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_HIDE_LOADING);
}
- } else if (mEmptyView.getVisibility() == View.VISIBLE) {
- mEmptyView.setVisibility(View.GONE);
- mRecyclerView.setVisibility(View.VISIBLE);
+ } else if (mBinding.empty.getVisibility() == View.VISIBLE) {
+ mBinding.empty.setVisibility(View.GONE);
+ mBinding.networkList.setVisibility(View.VISIBLE);
}
} else {
- mEmptyView.setText(R.string.network_connection_needed);
- mEmptyView.setVisibility(View.VISIBLE);
- mRecyclerView.setVisibility(View.GONE);
+ mBinding.empty.setText(R.string.network_connection_needed);
+ mBinding.empty.setVisibility(View.VISIBLE);
+ mBinding.networkList.setVisibility(View.GONE);
+ mBinding.setShowFavorites(false);
}
}
More information about the Android
mailing list