Skip to content

Commit c493971

Browse files
committed
Upload file
1 parent 8a139bc commit c493971

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

pio/src/main/java/com/tool/tree/DocumentsProvider.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,22 @@ private File getFileForDocId(String docId, boolean checkExists) throws FileNotFo
118118

119119
@Override
120120
public Cursor queryRoots(String[] projection) {
121-
ApplicationInfo appInfo = getContext().getApplicationInfo();
122-
String label = appInfo.loadLabel(getContext().getPackageManager()).toString();
123-
MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_ROOT_PROJECTION);
124-
MatrixCursor.RowBuilder row = result.newRow();
121+
final MatrixCursor result =
122+
new MatrixCursor(DEFAULT_ROOT_PROJECTION);
123+
final MatrixCursor.RowBuilder row = result.newRow();
125124
row.add(Root.COLUMN_ROOT_ID, packageName);
126125
row.add(Root.COLUMN_DOCUMENT_ID, packageName);
127-
if (dataDir != null && dataDir.exists()) {
128-
row.add(Root.COLUMN_AVAILABLE_BYTES,
129-
dataDir.getFreeSpace());
130-
}
131126
row.add(Root.COLUMN_FLAGS,
132-
Root.FLAG_SUPPORTS_CREATE |
133-
Root.FLAG_SUPPORTS_IS_CHILD |
134-
Root.FLAG_SUPPORTS_RECENTS);
135-
row.add(Root.COLUMN_TITLE, label);
127+
Root.FLAG_SUPPORTS_CREATE
128+
| Root.FLAG_SUPPORTS_IS_CHILD
129+
| Root.FLAG_SUPPORTS_RECENTS
130+
| Root.FLAG_LOCAL_ONLY);
131+
row.add(Root.COLUMN_TITLE,
132+
getContext().getString(R.string.app_name));
136133
row.add(Root.COLUMN_MIME_TYPES, "*/*");
137-
row.add(Root.COLUMN_ICON, appInfo.icon);
134+
row.add(Root.COLUMN_AVAILABLE_BYTES,
135+
dataDir != null ? dataDir.getFreeSpace() : 0);
136+
row.add(Root.COLUMN_ICON, R.mipmap.ic_launcher);
138137
return result;
139138
}
140139

0 commit comments

Comments
 (0)