Methods Summary |
---|
private void | deriveFields()
derivedMimeTypes = (mimeTypes != null) ? mimeTypes.split("\n") : null;
// TODO: remove these special case icons
if (isExternalStorage()) {
derivedIcon = R.drawable.ic_root_sdcard;
} else if (isDownloads()) {
derivedIcon = R.drawable.ic_root_download;
} else if (isImages()) {
derivedIcon = R.drawable.ic_doc_image;
} else if (isVideos()) {
derivedIcon = R.drawable.ic_doc_video;
} else if (isAudio()) {
derivedIcon = R.drawable.ic_doc_audio;
}
|
public int | describeContents()
return 0;
|
public boolean | equals(java.lang.Object o)
if (o instanceof RootInfo) {
final RootInfo root = (RootInfo) o;
return Objects.equals(authority, root.authority) && Objects.equals(rootId, root.rootId);
} else {
return false;
}
|
public static com.android.documentsui.model.RootInfo | fromRootsCursor(java.lang.String authority, android.database.Cursor cursor)
final RootInfo root = new RootInfo();
root.authority = authority;
root.rootId = getCursorString(cursor, Root.COLUMN_ROOT_ID);
root.flags = getCursorInt(cursor, Root.COLUMN_FLAGS);
root.icon = getCursorInt(cursor, Root.COLUMN_ICON);
root.title = getCursorString(cursor, Root.COLUMN_TITLE);
root.summary = getCursorString(cursor, Root.COLUMN_SUMMARY);
root.documentId = getCursorString(cursor, Root.COLUMN_DOCUMENT_ID);
root.availableBytes = getCursorLong(cursor, Root.COLUMN_AVAILABLE_BYTES);
root.mimeTypes = getCursorString(cursor, Root.COLUMN_MIME_TYPES);
root.deriveFields();
return root;
|
public java.lang.String | getDirectoryString()
return !TextUtils.isEmpty(summary) ? summary : title;
|
public int | hashCode()
return Objects.hash(authority, rootId);
|
public boolean | isAudio()
return "com.android.providers.media.documents".equals(authority)
&& "audio_root".equals(rootId);
|
public boolean | isDownloads()
return "com.android.providers.downloads.documents".equals(authority);
|
public boolean | isExternalStorage()
return "com.android.externalstorage.documents".equals(authority);
|
public boolean | isImages()
return "com.android.providers.media.documents".equals(authority)
&& "images_root".equals(rootId);
|
public boolean | isRecents()
return authority == null && rootId == null;
|
public boolean | isVideos()
return "com.android.providers.media.documents".equals(authority)
&& "videos_root".equals(rootId);
|
public android.graphics.drawable.Drawable | loadDrawerIcon(android.content.Context context)
if (derivedIcon != 0) {
return IconUtils.applyTintColor(context, derivedIcon, R.color.item_root_icon);
} else {
return IconUtils.loadPackageIcon(context, authority, icon);
}
|
public android.graphics.drawable.Drawable | loadGridIcon(android.content.Context context)
if (derivedIcon != 0) {
return IconUtils.applyTintAttr(context, derivedIcon,
android.R.attr.textColorPrimaryInverse);
} else {
return IconUtils.loadPackageIcon(context, authority, icon);
}
|
public android.graphics.drawable.Drawable | loadIcon(android.content.Context context)
if (derivedIcon != 0) {
return context.getDrawable(derivedIcon);
} else {
return IconUtils.loadPackageIcon(context, authority, icon);
}
|
public android.graphics.drawable.Drawable | loadToolbarIcon(android.content.Context context)
if (derivedIcon != 0) {
return IconUtils.applyTintAttr(context, derivedIcon,
android.R.attr.colorControlNormal);
} else {
return IconUtils.loadPackageIcon(context, authority, icon);
}
|
public void | read(java.io.DataInputStream in)
final int version = in.readInt();
switch (version) {
case VERSION_DROP_TYPE:
authority = DurableUtils.readNullableString(in);
rootId = DurableUtils.readNullableString(in);
flags = in.readInt();
icon = in.readInt();
title = DurableUtils.readNullableString(in);
summary = DurableUtils.readNullableString(in);
documentId = DurableUtils.readNullableString(in);
availableBytes = in.readLong();
mimeTypes = DurableUtils.readNullableString(in);
deriveFields();
break;
default:
throw new ProtocolException("Unknown version " + version);
}
|
public void | reset()
authority = null;
rootId = null;
flags = 0;
icon = 0;
title = null;
summary = null;
documentId = null;
availableBytes = -1;
mimeTypes = null;
derivedPackageName = null;
derivedMimeTypes = null;
derivedIcon = 0;
|
public java.lang.String | toString()
return "Root{authority=" + authority + ", rootId=" + rootId + ", title=" + title + "}";
|
public void | write(java.io.DataOutputStream out)
out.writeInt(VERSION_DROP_TYPE);
DurableUtils.writeNullableString(out, authority);
DurableUtils.writeNullableString(out, rootId);
out.writeInt(flags);
out.writeInt(icon);
DurableUtils.writeNullableString(out, title);
DurableUtils.writeNullableString(out, summary);
DurableUtils.writeNullableString(out, documentId);
out.writeLong(availableBytes);
DurableUtils.writeNullableString(out, mimeTypes);
|
public void | writeToParcel(android.os.Parcel dest, int flags)
DurableUtils.writeToParcel(dest, this);
|