Commit 1c88c622 authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Network: Fix lists title visibility

parent 0d3958d5
...@@ -77,7 +77,7 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements Simpl ...@@ -77,7 +77,7 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements Simpl
if (mRoot) ((NetworkProvider) mProvider).getFavorites().observe(this, new Observer<List<MediaLibraryItem>>() { if (mRoot) ((NetworkProvider) mProvider).getFavorites().observe(this, new Observer<List<MediaLibraryItem>>() {
@Override @Override
public void onChanged(@Nullable List<MediaLibraryItem> mediaLibraryItems) { 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); favoritesAdapter.submitList(mediaLibraryItems);
} }
}); });
...@@ -210,30 +210,29 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements Simpl ...@@ -210,30 +210,29 @@ public class NetworkBrowserFragment extends BaseBrowserFragment implements Simpl
* Update views visibility and emptiness info * Update views visibility and emptiness info
*/ */
protected void updateEmptyView() { protected void updateEmptyView() {
if (mEmptyView == null) return; if (mBinding == null) return;
if (ExternalMonitor.connected.getValue()) { if (ExternalMonitor.connected.getValue()) {
if (Util.isListEmpty(getProvider().getDataset().getValue())) { if (Util.isListEmpty(getProvider().getDataset().getValue())) {
if (mSwipeRefreshLayout == null || mSwipeRefreshLayout.isRefreshing()) { if (mSwipeRefreshLayout == null || mSwipeRefreshLayout.isRefreshing()) {
mEmptyView.setText(R.string.loading); mBinding.empty.setText(R.string.loading);
mEmptyView.setVisibility(View.VISIBLE); mBinding.empty.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.GONE); mBinding.networkList.setVisibility(View.GONE);
} else { } else {
if (mRoot) if (mRoot) mBinding.empty.setText(allowLAN() ? R.string.network_shares_discovery : R.string.network_connection_needed);
mEmptyView.setText(allowLAN() ? R.string.network_shares_discovery : R.string.network_connection_needed); else mBinding.empty.setText(R.string.network_empty);
else mBinding.empty.setVisibility(View.VISIBLE);
mEmptyView.setText(R.string.network_empty); mBinding.networkList.setVisibility(View.GONE);
mEmptyView.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.GONE);
mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_HIDE_LOADING); mHandler.sendEmptyMessage(BrowserFragmentHandler.MSG_HIDE_LOADING);
} }
} else if (mEmptyView.getVisibility() == View.VISIBLE) { } else if (mBinding.empty.getVisibility() == View.VISIBLE) {
mEmptyView.setVisibility(View.GONE); mBinding.empty.setVisibility(View.GONE);
mRecyclerView.setVisibility(View.VISIBLE); mBinding.networkList.setVisibility(View.VISIBLE);
} }
} else { } else {
mEmptyView.setText(R.string.network_connection_needed); mBinding.empty.setText(R.string.network_connection_needed);
mEmptyView.setVisibility(View.VISIBLE); mBinding.empty.setVisibility(View.VISIBLE);
mRecyclerView.setVisibility(View.GONE); mBinding.networkList.setVisibility(View.GONE);
mBinding.setShowFavorites(false);
} }
} }
......
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