diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java b/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java index 51bcc7bd4d..8fe3c7a577 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java @@ -233,7 +233,6 @@ public void updatePaths(int pos) { @Override public void onSaveInstanceState(@NonNull Bundle outState) { - super.onSaveInstanceState(outState); if (sharedPrefs != null) { sharedPrefs.edit().putInt(PREFERENCE_CURRENT_TAB, MainActivity.currentTab).apply(); @@ -249,6 +248,7 @@ public void onSaveInstanceState(@NonNull Bundle outState) { fragmentManager.putFragment(outState, KEY_FRAGMENT_1, fragments.get(1)); outState.putInt(KEY_POSITION, viewPager.getCurrentItem()); } + super.onSaveInstanceState(outState); } public void setPagingEnabled(boolean isPaging) { diff --git a/app/src/main/java/com/amaze/filemanager/ui/views/FastScroller.java b/app/src/main/java/com/amaze/filemanager/ui/views/FastScroller.java index bcf4b122d6..caedde4a1d 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/views/FastScroller.java +++ b/app/src/main/java/com/amaze/filemanager/ui/views/FastScroller.java @@ -70,11 +70,12 @@ public FastScroller(@NonNull Context context, AttributeSet attributeSet, int i) } private float computeHandlePosition() { + if (recyclerView == null) return -1; View firstVisibleView = recyclerView.getChildAt(0); + if (firstVisibleView == null) return -1; handle.setVisibility(VISIBLE); float recyclerViewOversize; // how much is recyclerView bigger than fastScroller int recyclerViewAbsoluteScroll; - if (firstVisibleView == null || recyclerView == null) return -1; recyclerViewOversize = firstVisibleView.getHeight() / columns * recyclerView.getAdapter().getItemCount() - getHeightMinusPadding();