mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixes copy to subsequent media functionality for nearby uploaded images (#5326)
This commit is contained in:
parent
fd6ba00fbd
commit
8aee7a680d
1 changed files with 24 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ import static fr.free.nrw.commons.utils.ImageUtils.getErrorMessageForResult;
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
|
|
@ -546,6 +547,29 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
||||||
@Override
|
@Override
|
||||||
public void updateMediaDetails(List<UploadMediaDetail> uploadMediaDetails) {
|
public void updateMediaDetails(List<UploadMediaDetail> uploadMediaDetails) {
|
||||||
uploadMediaDetailAdapter.setItems(uploadMediaDetails);
|
uploadMediaDetailAdapter.setItems(uploadMediaDetails);
|
||||||
|
showNearbyFound =
|
||||||
|
showNearbyFound && (
|
||||||
|
uploadMediaDetails == null || uploadMediaDetails.isEmpty() || listContainsEmptyDetails(
|
||||||
|
uploadMediaDetails));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if the media details that come in here are empty
|
||||||
|
* (empty caption AND empty description, with caption being the decider here)
|
||||||
|
* this method allows usage of nearby place caption and description if any
|
||||||
|
* else it takes the media details saved in prior for this picture
|
||||||
|
* @param uploadMediaDetails saved media details,
|
||||||
|
* ex: in case when "copy to subsequent media" button is clicked
|
||||||
|
* for a previous image
|
||||||
|
* @return boolean whether the details are empty or not
|
||||||
|
*/
|
||||||
|
private boolean listContainsEmptyDetails(List<UploadMediaDetail> uploadMediaDetails) {
|
||||||
|
for (UploadMediaDetail uploadDetail: uploadMediaDetails) {
|
||||||
|
if (!TextUtils.isEmpty(uploadDetail.getCaptionText()) && !TextUtils.isEmpty(uploadDetail.getDescriptionText())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue