mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixes #4296 - "Is this a picture of ...": Not too clear about which image it is asking me about (#4317)
* fix issue 4296 * minor improvements * minor improvement Co-authored-by: Pratham2305 <Pratham2305@users.noreply.github.com>
This commit is contained in:
parent
24f61a1142
commit
c269693625
3 changed files with 60 additions and 5 deletions
|
|
@ -85,6 +85,19 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
|||
|
||||
private boolean isExpanded = true;
|
||||
|
||||
/**
|
||||
* showNearbyFound will be true, if any nearby location found that needs pictures and the nearby popup is yet to be shown
|
||||
* Used to show and check if the nearby found popup is already shown
|
||||
*/
|
||||
private boolean showNearbyFound;
|
||||
|
||||
/**
|
||||
* nearbyPlace holds the detail of nearby place that need pictures, if any found
|
||||
*/
|
||||
private Place nearbyPlace;
|
||||
private UploadItem uploadItem;
|
||||
|
||||
|
||||
private UploadMediaDetailFragmentCallback callback;
|
||||
|
||||
public void setCallback(UploadMediaDetailFragmentCallback callback) {
|
||||
|
|
@ -232,13 +245,30 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Shows popup if any nearby location needing pictures matches uploadable picture's GPS location
|
||||
* Sets variables to Show popup if any nearby location needing pictures matches uploadable picture's GPS location
|
||||
* @param uploadItem
|
||||
* @param place
|
||||
*/
|
||||
@SuppressLint("StringFormatInvalid")
|
||||
@Override
|
||||
public void onNearbyPlaceFound(UploadItem uploadItem, Place place) {
|
||||
nearbyPlace = place;
|
||||
this.uploadItem = uploadItem;
|
||||
showNearbyFound = true;
|
||||
if(callback.getIndexInViewFlipper(this) == 0) {
|
||||
showNearbyPlaceFound(nearbyPlace);
|
||||
showNearbyFound = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows nearby place found popup
|
||||
* @param place
|
||||
*/
|
||||
@SuppressLint("StringFormatInvalid") // To avoid the unwanted lint warning that string 'upload_nearby_place_found_description' is not of a valid format
|
||||
private void showNearbyPlaceFound(Place place) {
|
||||
final View customLayout = getLayoutInflater().inflate(R.layout.custom_nearby_found, null);
|
||||
ImageView nearbyFoundImage = customLayout.findViewById(R.id.nearbyItemImage);
|
||||
nearbyFoundImage.setImageURI(uploadItem.getMediaUri());
|
||||
DialogUtil.showAlertDialog(getActivity(),
|
||||
getString(R.string.upload_nearby_place_found_title),
|
||||
String.format(Locale.getDefault(),
|
||||
|
|
@ -249,7 +279,8 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
|||
},
|
||||
() -> {
|
||||
|
||||
});
|
||||
},
|
||||
customLayout, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -262,10 +293,17 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
|||
callback.onNextButtonClicked(callback.getIndexInViewFlipper(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* This method gets called whenever the next/previous button is pressed
|
||||
*/
|
||||
@Override
|
||||
protected void onBecameVisible() {
|
||||
super.onBecameVisible();
|
||||
presenter.fetchTitleAndDescription(callback.getIndexInViewFlipper(this));
|
||||
if(showNearbyFound) {
|
||||
showNearbyPlaceFound(nearbyPlace);
|
||||
showNearbyFound = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
17
app/src/main/res/layout/custom_nearby_found.xml
Normal file
17
app/src/main/res/layout/custom_nearby_found.xml
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nearbyItemImage"
|
||||
android:layout_width="@dimen/giant_height"
|
||||
android:layout_height="@dimen/giant_height"
|
||||
android:layout_margin="@dimen/progressbar_stroke"
|
||||
android:scaleType="fitCenter"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -460,8 +460,8 @@ Upload your first media by tapping on the add button.</string>
|
|||
<string name="images_featured_explanation">Featured pictures are images from highly skilled photographers and illustrators that the Wikimedia Commons community has chosen as some of the highest quality on the site.</string>
|
||||
<string name="images_via_nearby_explanation">Images Uploaded via Nearby places are the images which are uploaded by discovering places on the map.</string>
|
||||
<string name="thanks_received_explanation">This feature allows editors to send a Thank you notification to users who make useful edits – by using a small thank link on the history page or diff page.</string>
|
||||
<string name="copy_image_caption_description">Copy to subsequent Media</string>
|
||||
<string name="copied_successfully">Copied Successfully</string>
|
||||
<string name="copy_image_caption_description">Copy to subsequent media</string>
|
||||
<string name="copied_successfully">Copied</string>
|
||||
<string name="welcome_do_upload_content_description">Examples of good images to upload to Commons</string>
|
||||
<string name="welcome_dont_upload_content_description">Examples of images not to upload</string>
|
||||
<string name="skip_image">Skip this image</string>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue