use of com.android.documentsui.model.RootInfo in project android_frameworks_base by ResurrectionRemix.
the class FilesActivity method onResume.
@Override
public void onResume() {
super.onResume();
final RootInfo root = getCurrentRoot();
// the user what has happened, let them close us. Less surprising.
if (mRoots.getRootBlocking(root.authority, root.rootId) == null) {
finish();
}
}
use of com.android.documentsui.model.RootInfo in project android_frameworks_base by crdroidandroid.
the class RootsFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
final Context context = getActivity();
final RootsCache roots = DocumentsApplication.getRootsCache(context);
final State state = ((BaseActivity) context).getDisplayState();
mCallbacks = new LoaderCallbacks<Collection<RootInfo>>() {
@Override
public Loader<Collection<RootInfo>> onCreateLoader(int id, Bundle args) {
return new RootsLoader(context, roots, state);
}
@Override
public void onLoadFinished(Loader<Collection<RootInfo>> loader, Collection<RootInfo> result) {
if (!isAdded()) {
return;
}
Intent handlerAppIntent = getArguments().getParcelable(EXTRA_INCLUDE_APPS);
mAdapter = new RootsAdapter(context, result, handlerAppIntent, state);
mList.setAdapter(mAdapter);
onCurrentRootChanged();
}
@Override
public void onLoaderReset(Loader<Collection<RootInfo>> loader) {
mAdapter = null;
mList.setAdapter(null);
}
};
}
use of com.android.documentsui.model.RootInfo in project android_frameworks_base by crdroidandroid.
the class RootsCache method getRootOneshot.
/**
* Return the requested {@link RootInfo}, but only loading the roots for the
* requested authority. This is useful when we want to load fast without
* waiting for all the other roots to come back.
*/
public RootInfo getRootOneshot(String authority, String rootId) {
synchronized (mLock) {
RootInfo root = getRootLocked(authority, rootId);
if (root == null) {
mRoots.putAll(authority, loadRootsForAuthority(mContext.getContentResolver(), authority, false));
root = getRootLocked(authority, rootId);
}
return root;
}
}
use of com.android.documentsui.model.RootInfo in project android_frameworks_base by crdroidandroid.
the class RootsCacheTest method testMatchingRoots_DirectoryCopy.
public void testMatchingRoots_DirectoryCopy() throws Exception {
RootInfo downloads = buildForMimeTypes("*/*");
downloads.authority = "com.android.providers.downloads.documents";
mRoots.add(downloads);
mState.acceptMimes = new String[] { "*/*" };
mState.directoryCopy = true;
// basically we're asserting that the results don't contain downloads
assertContainsExactly(newArrayList(mNull, mWild, mImages, mAudio, mDocs, mMalformed1, mMalformed2), getMatchingRoots(mRoots, mState));
}
use of com.android.documentsui.model.RootInfo in project android_frameworks_base by crdroidandroid.
the class RootsCacheTest method buildForMimeTypes.
private static RootInfo buildForMimeTypes(String... mimeTypes) {
final RootInfo root = new RootInfo();
root.derivedMimeTypes = mimeTypes;
return root;
}
Aggregations