mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
upload: made duplicate picture dialog more informative and added checkbox to never show again (#4045)
This commit is contained in:
parent
0b5f56b682
commit
cbca290e4d
3 changed files with 54 additions and 14 deletions
|
|
@ -8,6 +8,7 @@ import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.CheckBox;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
@ -272,19 +273,33 @@ public class UploadMediaDetailFragment extends UploadBaseFragment implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void showDuplicatePicturePopup(UploadItem uploadItem) {
|
public void showDuplicatePicturePopup(UploadItem uploadItem) {
|
||||||
String uploadTitleFormat = getString(R.string.upload_title_duplicate);
|
if (defaultKvStore.getBoolean("showDuplicatePicturePopup", true)) {
|
||||||
DialogUtil.showAlertDialog(getActivity(),
|
String uploadTitleFormat = getString(R.string.upload_title_duplicate);
|
||||||
getString(R.string.duplicate_image_found),
|
View checkBoxView = View
|
||||||
String.format(Locale.getDefault(),
|
.inflate(getActivity(), R.layout.nearby_permission_dialog, null);
|
||||||
uploadTitleFormat,
|
CheckBox checkBox = (CheckBox) checkBoxView.findViewById(R.id.never_ask_again);
|
||||||
uploadItem.getFileName()),
|
checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||||
getString(R.string.upload),
|
if (isChecked) {
|
||||||
getString(R.string.cancel),
|
defaultKvStore.putBoolean("showDuplicatePicturePopup", false);
|
||||||
() -> {
|
}
|
||||||
uploadItem.setImageQuality(ImageUtils.IMAGE_KEEP);
|
});
|
||||||
onNextButtonClicked();
|
DialogUtil.showAlertDialog(getActivity(),
|
||||||
}, null);
|
getString(R.string.duplicate_image_found),
|
||||||
|
String.format(Locale.getDefault(),
|
||||||
|
uploadTitleFormat,
|
||||||
|
uploadItem.getFileName()),
|
||||||
|
getString(R.string.upload),
|
||||||
|
getString(R.string.cancel),
|
||||||
|
() -> {
|
||||||
|
uploadItem.setImageQuality(ImageUtils.IMAGE_KEEP);
|
||||||
|
onNextButtonClicked();
|
||||||
|
}, null,
|
||||||
|
checkBoxView,
|
||||||
|
false);
|
||||||
|
} else {
|
||||||
|
uploadItem.setImageQuality(ImageUtils.IMAGE_KEEP);
|
||||||
|
onNextButtonClicked();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,31 @@ object DialogUtil {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun showAlertDialog(
|
||||||
|
activity: Activity,
|
||||||
|
title: String,
|
||||||
|
message: String,
|
||||||
|
positiveButtonText: String?,
|
||||||
|
negativeButtonText: String?,
|
||||||
|
onPositiveBtnClick: Runnable?,
|
||||||
|
onNegativeBtnClick: Runnable?,
|
||||||
|
customView: View?,
|
||||||
|
cancelable: Boolean
|
||||||
|
) {
|
||||||
|
createAndShowDialogSafely(
|
||||||
|
activity = activity,
|
||||||
|
title = title,
|
||||||
|
message = message,
|
||||||
|
positiveButtonText = positiveButtonText,
|
||||||
|
negativeButtonText = negativeButtonText,
|
||||||
|
onPositiveBtnClick = onPositiveBtnClick,
|
||||||
|
onNegativeBtnClick = onNegativeBtnClick,
|
||||||
|
customView = customView,
|
||||||
|
cancelable = cancelable
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun showAlertDialog(
|
fun showAlertDialog(
|
||||||
activity: Activity,
|
activity: Activity,
|
||||||
|
|
|
||||||
|
|
@ -441,7 +441,7 @@
|
||||||
<string name="next">Next</string>
|
<string name="next">Next</string>
|
||||||
<string name="previous">Previous</string>
|
<string name="previous">Previous</string>
|
||||||
<string name="submit">Submit</string>
|
<string name="submit">Submit</string>
|
||||||
<string formatted="true" name="upload_title_duplicate">A file with the file name %1$s exists. Are you sure you want to proceed?</string>
|
<string formatted="true" name="upload_title_duplicate">A file with the file name %1$s exists. Are you sure you want to proceed?\n\nNote: A suitable suffix will be added to the file name automatically.</string>
|
||||||
<string name="map_application_missing">No compatible map application could be found on your device. Please install a map application to use this feature.</string>
|
<string name="map_application_missing">No compatible map application could be found on your device. Please install a map application to use this feature.</string>
|
||||||
<string name="navigation_item_bookmarks">Bookmarks</string>
|
<string name="navigation_item_bookmarks">Bookmarks</string>
|
||||||
<string name="title_activity_bookmarks">Bookmarks</string>
|
<string name="title_activity_bookmarks">Bookmarks</string>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue