[Android] Fix UninitializedPropertyAccessException
Nicolas Pomepuy
git at videolan.org
Wed Jul 31 15:15:53 CEST 2019
vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Wed Jul 31 07:07:11 2019 +0200| [409a8f89632986237649bb91d31ec01c107151c0] | committer: Geoffrey Métais
Fix UninitializedPropertyAccessException
> https://code.videolan.org/videolan/vlc-android/commit/409a8f89632986237649bb91d31ec01c107151c0
---
.../vlc/gui/browser/BaseBrowserFragment.kt | 30 +++++++++++-----------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
index c35b7798b..27ad6b923 100644
--- a/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/browser/BaseBrowserFragment.kt
@@ -183,7 +183,7 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
override fun onSaveInstanceState(outState: Bundle) {
outState.putString(KEY_MRL, mrl)
outState.putParcelable(KEY_MEDIA, currentMedia)
- outState.putInt(KEY_POSITION, layoutManager.findFirstCompletelyVisibleItemPosition())
+ outState.putInt(KEY_POSITION, if (::layoutManager.isInitialized) layoutManager.findFirstCompletelyVisibleItemPosition() else 0)
super.onSaveInstanceState(outState)
}
@@ -236,22 +236,22 @@ abstract class BaseBrowserFragment : MediaBrowserFragment<BrowserModel>(), IRefr
* Update views visibility and emptiness info
*/
protected open fun updateEmptyView() {
- swipeRefreshLayout.let {
- if (Util.isListEmpty(viewModel.dataset.value)) {
- if (it.isRefreshing) {
- binding.empty.setText(R.string.loading)
- binding.empty.visibility = View.VISIBLE
- binding.networkList.visibility = View.GONE
- } else {
- binding.empty.setText(R.string.directory_empty)
- binding.empty.visibility = View.VISIBLE
- binding.networkList.visibility = View.GONE
- }
- } else if (binding.empty.visibility == View.VISIBLE) {
- binding.empty.visibility = View.GONE
- binding.networkList.visibility = View.VISIBLE
+ swipeRefreshLayout.let {
+ if (Util.isListEmpty(viewModel.dataset.value)) {
+ if (it.isRefreshing) {
+ binding.empty.setText(R.string.loading)
+ binding.empty.visibility = View.VISIBLE
+ binding.networkList.visibility = View.GONE
+ } else {
+ binding.empty.setText(R.string.directory_empty)
+ binding.empty.visibility = View.VISIBLE
+ binding.networkList.visibility = View.GONE
}
+ } else if (binding.empty.visibility == View.VISIBLE) {
+ binding.empty.visibility = View.GONE
+ binding.networkList.visibility = View.VISIBLE
}
+ }
}
override fun refresh() = viewModel.refresh()
More information about the Android
mailing list