Loading src/com/android/documentsui/DrawerController.java +4 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import androidx.drawerlayout.widget.DrawerLayout.DrawerListener; import androidx.legacy.app.ActionBarDrawerToggle; import com.android.documentsui.base.Display; import com.android.documentsui.base.Providers; /** * A facade over the various pieces comprising "roots fragment in a Drawer". Loading Loading @@ -201,6 +202,9 @@ public abstract class DrawerController implements DrawerListener { @Override public void onDrawerOpened(View drawerView) { mToggle.onDrawerOpened(drawerView); // Update the information for Storage's root DocumentsApplication.getProvidersCache(drawerView.getContext()).updateAuthorityAsync( Providers.AUTHORITY_STORAGE); } @Override Loading src/com/android/documentsui/sidebar/RootsFragment.java +19 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ import com.android.documentsui.base.BooleanConsumer; import com.android.documentsui.base.DocumentInfo; import com.android.documentsui.base.DocumentStack; import com.android.documentsui.base.Events; import com.android.documentsui.base.Providers; import com.android.documentsui.base.RootInfo; import com.android.documentsui.base.Shared; import com.android.documentsui.base.State; Loading Loading @@ -246,9 +247,21 @@ public class RootsFragment extends Fragment { final String excludePackage = excludeSelf ? activity.getCallingPackage() : null; List<Item> sortedItems = sortLoadResult(roots, excludePackage, handlerAppIntent, DocumentsApplication.getProvidersCache(getContext())); // Get the first visible position and offset final int firstPosition = mList.getFirstVisiblePosition(); View firstChild = mList.getChildAt(0); final int offset = firstChild != null ? firstChild.getTop() - mList.getPaddingTop() : 0; final int oriItemCount = mAdapter != null ? mAdapter.getCount() : 0; mAdapter = new RootsAdapter(activity, sortedItems, mDragListener); mList.setAdapter(mAdapter); // recover the position. if (oriItemCount == mAdapter.getCount()) { mList.setSelectionFromTop(firstPosition, offset); } mInjector.shortcutsUpdater.accept(roots); mInjector.appsRowManager.updateList(mApplicationItemList); mInjector.appsRowManager.updateView(activity); Loading Loading @@ -421,6 +434,12 @@ public class RootsFragment extends Fragment { @Override public void onResume() { super.onResume(); final Context context = getActivity(); // Update the information for Storage's root if (context != null) { DocumentsApplication.getProvidersCache(context).updateAuthorityAsync( Providers.AUTHORITY_STORAGE); } onDisplayStateChanged(); } Loading Loading
src/com/android/documentsui/DrawerController.java +4 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import androidx.drawerlayout.widget.DrawerLayout.DrawerListener; import androidx.legacy.app.ActionBarDrawerToggle; import com.android.documentsui.base.Display; import com.android.documentsui.base.Providers; /** * A facade over the various pieces comprising "roots fragment in a Drawer". Loading Loading @@ -201,6 +202,9 @@ public abstract class DrawerController implements DrawerListener { @Override public void onDrawerOpened(View drawerView) { mToggle.onDrawerOpened(drawerView); // Update the information for Storage's root DocumentsApplication.getProvidersCache(drawerView.getContext()).updateAuthorityAsync( Providers.AUTHORITY_STORAGE); } @Override Loading
src/com/android/documentsui/sidebar/RootsFragment.java +19 −0 Original line number Diff line number Diff line Loading @@ -66,6 +66,7 @@ import com.android.documentsui.base.BooleanConsumer; import com.android.documentsui.base.DocumentInfo; import com.android.documentsui.base.DocumentStack; import com.android.documentsui.base.Events; import com.android.documentsui.base.Providers; import com.android.documentsui.base.RootInfo; import com.android.documentsui.base.Shared; import com.android.documentsui.base.State; Loading Loading @@ -246,9 +247,21 @@ public class RootsFragment extends Fragment { final String excludePackage = excludeSelf ? activity.getCallingPackage() : null; List<Item> sortedItems = sortLoadResult(roots, excludePackage, handlerAppIntent, DocumentsApplication.getProvidersCache(getContext())); // Get the first visible position and offset final int firstPosition = mList.getFirstVisiblePosition(); View firstChild = mList.getChildAt(0); final int offset = firstChild != null ? firstChild.getTop() - mList.getPaddingTop() : 0; final int oriItemCount = mAdapter != null ? mAdapter.getCount() : 0; mAdapter = new RootsAdapter(activity, sortedItems, mDragListener); mList.setAdapter(mAdapter); // recover the position. if (oriItemCount == mAdapter.getCount()) { mList.setSelectionFromTop(firstPosition, offset); } mInjector.shortcutsUpdater.accept(roots); mInjector.appsRowManager.updateList(mApplicationItemList); mInjector.appsRowManager.updateView(activity); Loading Loading @@ -421,6 +434,12 @@ public class RootsFragment extends Fragment { @Override public void onResume() { super.onResume(); final Context context = getActivity(); // Update the information for Storage's root if (context != null) { DocumentsApplication.getProvidersCache(context).updateAuthorityAsync( Providers.AUTHORITY_STORAGE); } onDisplayStateChanged(); } Loading