android: fix lint errors
RecentFilesAdapter.java:76: Error: Value must be ≥ 0 [Range] filename = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)); RecentFilesAdapter.java:97: Error: Value must be ≥ 0 [Range] length = cursor.getLong(cursor.getColumnIndex(OpenableColumns.SIZE)); file_explorer_grid_item.xml:42: Error: Inconsistent alignment specification between textAlignment and gravity attributes: was center_vertical, expected center_horizontal [RtlCompat] android:textAlignment="center" Signed-off-by: Rash419 <rashesh.padia@collabora.com> Change-Id: I663a89b0ecce03b067e1fa216a030a19fa578da5pull/7195/head
parent
f0ea15a9b9
commit
a02cde2565
|
@ -73,7 +73,7 @@ class RecentFilesAdapter extends RecyclerView.Adapter<RecentFilesAdapter.ViewHol
|
|||
try {
|
||||
cursor = activity.getContentResolver().query(uri, null, null, null, null);
|
||||
if (cursor != null && cursor.moveToFirst())
|
||||
filename = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
|
||||
filename = cursor.getString(cursor.getColumnIndexOrThrow(OpenableColumns.DISPLAY_NAME));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
} finally {
|
||||
|
@ -94,7 +94,7 @@ class RecentFilesAdapter extends RecyclerView.Adapter<RecentFilesAdapter.ViewHol
|
|||
try {
|
||||
cursor = activity.getContentResolver().query(uri, null, null, null, null);
|
||||
if (cursor != null && cursor.moveToFirst())
|
||||
length = cursor.getLong(cursor.getColumnIndex(OpenableColumns.SIZE));
|
||||
length = cursor.getLong(cursor.getColumnIndexOrThrow(OpenableColumns.SIZE));
|
||||
} catch (Exception e) {
|
||||
return 0;
|
||||
} finally {
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
android:layout_gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:gravity="center"
|
||||
android:maxLines="2"
|
||||
android:textAlignment="center"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
|
@ -52,8 +52,8 @@
|
|||
android:layout_gravity="center"
|
||||
android:contentDescription="@string/file_actions_icon_desc"
|
||||
android:scaleType="fitStart"
|
||||
android:tint="?android:attr/textColorPrimary"
|
||||
app:srcCompat="@drawable/ic_more_vert_black_24dp" />
|
||||
app:srcCompat="@drawable/ic_more_vert_black_24dp"
|
||||
app:tint="?android:attr/textColorPrimary" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
|
|
@ -642,6 +642,7 @@ public class LOActivity extends AppCompatActivity {
|
|||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||
super.onActivityResult(requestCode, resultCode, intent);
|
||||
if (resultCode != RESULT_OK) {
|
||||
if (requestCode == REQUEST_SELECT_IMAGE_FILE) {
|
||||
valueCallback.onReceiveValue(null);
|
||||
|
@ -660,18 +661,15 @@ public class LOActivity extends AppCompatActivity {
|
|||
requestCopy = true;
|
||||
if (getMimeType().equals("text/plain")) {
|
||||
requestCode = REQUEST_SAVEAS_ODT;
|
||||
}
|
||||
else if (getMimeType().equals("text/comma-separated-values")) {
|
||||
} else if (getMimeType().equals("text/comma-separated-values")) {
|
||||
requestCode = REQUEST_SAVEAS_ODS;
|
||||
}
|
||||
else if (getMimeType().equals("application/vnd.ms-excel.sheet.binary.macroenabled.12")) {
|
||||
} else if (getMimeType().equals("application/vnd.ms-excel.sheet.binary.macroenabled.12")) {
|
||||
requestCode = REQUEST_SAVEAS_ODS;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
String filename = getFileName(true);
|
||||
String extension = filename.substring(filename.lastIndexOf('.') + 1);
|
||||
requestCode = getRequestIDForFormat(extension);
|
||||
assert(requestCode != 0);
|
||||
assert (requestCode != 0);
|
||||
}
|
||||
}
|
||||
switch (requestCode) {
|
||||
|
@ -708,8 +706,7 @@ public class LOActivity extends AppCompatActivity {
|
|||
inputStream = new FileInputStream(tempFile);
|
||||
try {
|
||||
outputStream = getContentResolver().openOutputStream(intent.getData(), "wt");
|
||||
}
|
||||
catch (FileNotFoundException e) {
|
||||
} catch (FileNotFoundException e) {
|
||||
Log.i(TAG, "failed with the 'wt' mode, trying without: " + e.getMessage());
|
||||
outputStream = getContentResolver().openOutputStream(intent.getData());
|
||||
}
|
||||
|
@ -734,7 +731,7 @@ public class LOActivity extends AppCompatActivity {
|
|||
}
|
||||
}
|
||||
if (requestCopy == true) {
|
||||
assert(_tempFile != null);
|
||||
assert (_tempFile != null);
|
||||
mTempFile = _tempFile;
|
||||
getIntent().setData(intent.getData());
|
||||
/** add the document to recents */
|
||||
|
@ -1149,7 +1146,7 @@ public class LOActivity extends AppCompatActivity {
|
|||
try {
|
||||
cursor = getContentResolver().query(getIntent().getData(), null, null, null, null);
|
||||
if (cursor != null && cursor.moveToFirst())
|
||||
filename = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
|
||||
filename = cursor.getString(cursor.getColumnIndexOrThrow(OpenableColumns.DISPLAY_NAME));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue