mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
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:
parent
ff9f43ef8b
commit
e32f8d3d36
2 changed files with 13 additions and 7 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -351,9 +351,7 @@ public class ShareActivity
|
|||
|
||||
if (Intent.ACTION_SEND.equals(intent.getAction())) {
|
||||
mediaUri = intent.getParcelableExtra(Intent.EXTRA_STREAM);
|
||||
|
||||
contentProviderUri = mediaUri;
|
||||
|
||||
mediaUri = ContributionUtils.saveFileBeingUploadedTemporarily(this, mediaUri);
|
||||
|
||||
if (intent.hasExtra(UploadService.EXTRA_SOURCE)) {
|
||||
|
|
@ -361,7 +359,10 @@ public class ShareActivity
|
|||
} else {
|
||||
source = Contribution.SOURCE_EXTERNAL;
|
||||
}
|
||||
if (intent.hasExtra("isDirectUpload")) {
|
||||
|
||||
boolean isDirectUpload = intent.getBooleanExtra("isDirectUpload", false);
|
||||
|
||||
if (isDirectUpload) {
|
||||
Timber.d("This was initiated by a direct upload from Nearby");
|
||||
isNearbyUpload = true;
|
||||
wikiDataEntityId = intent.getStringExtra(WIKIDATA_ENTITY_ID_PREF);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue