Fix moreeee bugs

This commit is contained in:
blank X 2022-04-29 23:17:34 +07:00
parent 59fde090ad
commit c3744e2dd0
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 8 additions and 8 deletions

View File

@ -37,9 +37,9 @@ public class PickActivity extends Activity {
startActivityForResult(newIntent, 0); startActivityForResult(newIntent, 0);
} catch (ActivityNotFoundException e) { } catch (ActivityNotFoundException e) {
Log.e(TAG, getString(R.string.no_activity)); Log.e(TAG, getString(R.string.no_activity));
Toast.makeText(getApplicationContext(), msg, Toast.LENGH_SHORT) Toast.makeText(getApplicationContext(), R.string.no_activity,
.show(); Toast.LENGTH_SHORT).show();
setResult(Activity.RESULT_CANCELLED); setResult(RESULT_CANCELED);
finish(); finish();
} }
} }
@ -52,13 +52,13 @@ public class PickActivity extends Activity {
if (resultCode != RESULT_OK) { if (resultCode != RESULT_OK) {
Log.d(TAG, "Received resultCode = " + resultCode); Log.d(TAG, "Received resultCode = " + resultCode);
setResult(Activity.RESULT_CANCELLED); setResult(RESULT_CANCELED);
finish(); finish();
// probably not necessary but just in case or something // probably not necessary but just in case or something
return; return;
} else if (data == null) { } else if (data == null) {
Log.d(TAG, "Received data = null"); Log.d(TAG, "Received data = null");
setResult(Activity.RESULT_CANCELLED); setResult(RESULT_CANCELED);
finish(); finish();
return; return;
} }
@ -67,14 +67,14 @@ public class PickActivity extends Activity {
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
if (data.getData() != null) { if (data.getData() != null) {
intent.setData(data.getData()); intent.setData(data.getData());
setResult(Activity.RESULT_OK, intent); setResult(RESULT_OK, intent);
} else if (data.getClipData() != null) { } else if (data.getClipData() != null) {
// unsafe? // unsafe?
intent.setClipData(data.getClipData()); intent.setClipData(data.getClipData());
setResult(Activity.RESULT_OK, intent); setResult(RESULT_OK, intent);
} else { } else {
Log.d(TAG, "Received data.getData() = null and data.getClipData() = null"); Log.d(TAG, "Received data.getData() = null and data.getClipData() = null");
setResult(Activity.RESULT_CANCELLED); setResult(RESULT_CANCELED);
} }
finish(); finish();
} }