Loading src/com/android/documentsui/BaseActivity.java +6 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,12 @@ public abstract class BaseActivity } mInjector.actions.loadDocumentsForCurrentStack(); expandAppBar(); DirectoryFragment dir = getDirectoryFragment(); if (dir != null) { dir.scrollToTop(); } } @Override Loading src/com/android/documentsui/dirlist/DirectoryFragment.java +23 −3 Original line number Diff line number Diff line Loading @@ -1095,6 +1095,15 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On return R.id.container_directory; } /** * Scroll recycler view in fregment to top */ public void scrollToTop() { if (mRecView != null) { mRecView.scrollToPosition(0); } } @Override public void onRefresh() { // Remove thumbnail cache. We do this not because we're worried about stale thumbnails as it Loading Loading @@ -1145,11 +1154,25 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mRestoredState = null; } // Restore any previous instance state final SparseArray<Parcelable> container = mState.dirConfigs.remove(mLocalState.getConfigKey()); final int curSortedDimensionId = mState.sortModel.getSortedDimensionId(); final SortDimension curSortedDimension = mState.sortModel.getDimensionById(curSortedDimensionId); // Default not restore to avoid app bar layout expand to confuse users. if (container != null && !getArguments().getBoolean(Shared.EXTRA_IGNORE_STATE, true)) { getView().restoreHierarchyState(container); } else if (mLocalState.mLastSortDimensionId != curSortedDimension.getId() || mLocalState.mLastSortDimensionId == SortModel.SORT_DIMENSION_ID_UNKNOWN || mLocalState.mLastSortDirection != curSortedDimension.getSortDirection()) { // Scroll to the top if the sort order actually changed. mRecView.smoothScrollToPosition(0); } mLocalState.mLastSortDimensionId = curSortedDimension.getId(); mLocalState.mLastSortDirection = curSortedDimension.getSortDirection(); Loading @@ -1168,9 +1191,6 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mInjector.menuManager.updateOptionMenu(); mActivity.updateHeaderTitle(); mActivity.expandAppBar(); // Always back to top avoid app bar layout overlay on container. mRecView.scrollToPosition(0); setPreDrawListener(true); } Loading Loading
src/com/android/documentsui/BaseActivity.java +6 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,12 @@ public abstract class BaseActivity } mInjector.actions.loadDocumentsForCurrentStack(); expandAppBar(); DirectoryFragment dir = getDirectoryFragment(); if (dir != null) { dir.scrollToTop(); } } @Override Loading
src/com/android/documentsui/dirlist/DirectoryFragment.java +23 −3 Original line number Diff line number Diff line Loading @@ -1095,6 +1095,15 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On return R.id.container_directory; } /** * Scroll recycler view in fregment to top */ public void scrollToTop() { if (mRecView != null) { mRecView.scrollToPosition(0); } } @Override public void onRefresh() { // Remove thumbnail cache. We do this not because we're worried about stale thumbnails as it Loading Loading @@ -1145,11 +1154,25 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mRestoredState = null; } // Restore any previous instance state final SparseArray<Parcelable> container = mState.dirConfigs.remove(mLocalState.getConfigKey()); final int curSortedDimensionId = mState.sortModel.getSortedDimensionId(); final SortDimension curSortedDimension = mState.sortModel.getDimensionById(curSortedDimensionId); // Default not restore to avoid app bar layout expand to confuse users. if (container != null && !getArguments().getBoolean(Shared.EXTRA_IGNORE_STATE, true)) { getView().restoreHierarchyState(container); } else if (mLocalState.mLastSortDimensionId != curSortedDimension.getId() || mLocalState.mLastSortDimensionId == SortModel.SORT_DIMENSION_ID_UNKNOWN || mLocalState.mLastSortDirection != curSortedDimension.getSortDirection()) { // Scroll to the top if the sort order actually changed. mRecView.smoothScrollToPosition(0); } mLocalState.mLastSortDimensionId = curSortedDimension.getId(); mLocalState.mLastSortDirection = curSortedDimension.getSortDirection(); Loading @@ -1168,9 +1191,6 @@ public class DirectoryFragment extends Fragment implements SwipeRefreshLayout.On mInjector.menuManager.updateOptionMenu(); mActivity.updateHeaderTitle(); mActivity.expandAppBar(); // Always back to top avoid app bar layout overlay on container. mRecView.scrollToPosition(0); setPreDrawListener(true); } Loading