Fix title/desc prefill bug (#1794)

* Move isDirectUpload putExtra above Wikidata edits try catch block

* Check value of boolean isDirectUpload in intent

* Change to getBooleanExtra to prevent NPE

* Fix whitespaces, logging, and lint issues
This commit is contained in:
Josephine Lim 2018-08-05 02:03:31 +10:00 committed by Vivek Maskara
parent ff9f43ef8b
commit e32f8d3d36
2 changed files with 13 additions and 7 deletions

View file

@ -95,7 +95,7 @@ public class ContributionController {
public void handleImagePicked(int requestCode, @Nullable Uri uri, boolean isDirectUpload, String wikiDataEntityId) {
FragmentActivity activity = fragment.getActivity();
Timber.d("handleImagePicked() called with onActivityResult()");
Timber.d("handleImagePicked() called with onActivityResult(). Boolean isDirectUpload: " + isDirectUpload + "String wikiDataEntityId: " + wikiDataEntityId);
Intent shareIntent = new Intent(activity, ShareActivity.class);
shareIntent.setAction(ACTION_SEND);
switch (requestCode) {
@ -113,21 +113,26 @@ public class ContributionController {
shareIntent.setType("image/jpeg");
shareIntent.putExtra(EXTRA_STREAM, lastGeneratedCaptureUri);
shareIntent.putExtra(EXTRA_SOURCE, SOURCE_CAMERA);
break;
default:
break;
}
Timber.i("Image selected");
shareIntent.putExtra("isDirectUpload", isDirectUpload);
Timber.d("Put extras into image intent, isDirectUpload is " + isDirectUpload);
try {
shareIntent.putExtra("isDirectUpload", isDirectUpload);
if (wikiDataEntityId != null && !wikiDataEntityId.equals("")) {
shareIntent.putExtra(WIKIDATA_ENTITY_ID_PREF, wikiDataEntityId);
}
activity.startActivity(shareIntent);
} catch (SecurityException e) {
Timber.e(e, "Security Exception");
}
if (activity != null) {
activity.startActivity(shareIntent);
}
}
void saveState(Bundle outState) {