mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Removed all hardcoded string in DeleteHelper (#3052)
* Removed hardcoded strings in DeleteHelper * Revert "Removed hardcoded strings in DeleteHelper" This reverts commit4bc55fc3af. * Removed all hardcoded strings in DeleteHelper. * fixed test problems * Correction strings in DeleteHelper * decision problem with color of info icon #2940 * Correction DeleteHelper and string.xml * minor fix * fixed problems in DeleteHelper.java and strings.xml * and another little fix * Revert "and another little fix" This reverts commitfe4ea5255f. * Revert "decision problem with color of info icon #2940" This reverts commit5895cc8785.
This commit is contained in:
parent
b71dac33ae
commit
108e28c89a
2 changed files with 32 additions and 25 deletions
|
|
@ -59,7 +59,7 @@ public class DeleteHelper {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Single<Boolean> makeDeletion(Context context, Media media, String reason) {
|
public Single<Boolean> makeDeletion(Context context, Media media, String reason) {
|
||||||
viewUtil.showShortToast(context, "Trying to nominate " + media.getDisplayTitle() + " for deletion");
|
viewUtil.showShortToast(context, context.getString((R.string.delete_helper_make_deletion_toast), media.getDisplayTitle()));
|
||||||
return Single.fromCallable(() -> delete(media, reason))
|
return Single.fromCallable(() -> delete(media, reason))
|
||||||
.flatMap(result -> Single.fromCallable(() ->
|
.flatMap(result -> Single.fromCallable(() ->
|
||||||
showDeletionNotification(context, media, result)));
|
showDeletionNotification(context, media, result)));
|
||||||
|
|
@ -123,14 +123,14 @@ public class DeleteHelper {
|
||||||
|
|
||||||
private boolean showDeletionNotification(Context context, Media media, boolean result) {
|
private boolean showDeletionNotification(Context context, Media media, boolean result) {
|
||||||
String message;
|
String message;
|
||||||
String title = "Nominating for Deletion";
|
String title = context.getString(R.string.delete_helper_show_deletion_title);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
title += ": Success";
|
title += ": " + context.getString(R.string.delete_helper_show_deletion_title_success);
|
||||||
message = "Successfully nominated " + media.getDisplayTitle() + " deletion.";
|
message = context.getString((R.string.delete_helper_show_deletion_message_if),media.getDisplayTitle());
|
||||||
} else {
|
} else {
|
||||||
title += ": Failed";
|
title += ": " + context.getString(R.string.delete_helper_show_deletion_title_failed);
|
||||||
message = "Could not request deletion.";
|
message = context.getString(R.string.delete_helper_show_deletion_message_else) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/" + media.getFilename();
|
String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/" + media.getFilename();
|
||||||
|
|
@ -162,15 +162,15 @@ public class DeleteHelper {
|
||||||
|
|
||||||
|
|
||||||
if (problem == ReviewController.DeleteReason.SPAM) {
|
if (problem == ReviewController.DeleteReason.SPAM) {
|
||||||
reasonList[0] = context.getResources().getString(R.string.delete_reason_spam_selfie);
|
reasonList[0] = context.getString(R.string.delete_helper_ask_spam_selfie);
|
||||||
reasonList[1] = context.getResources().getString(R.string.delete_reason_spam_blurry);
|
reasonList[1] = context.getString(R.string.delete_helper_ask_spam_blurry);
|
||||||
reasonList[2] = context.getResources().getString(R.string.delete_reason_spam_nonsense);
|
reasonList[2] = context.getString(R.string.delete_helper_ask_spam_nonsense);
|
||||||
reasonList[3] = context.getResources().getString(R.string.delete_reason_spam_other);
|
reasonList[3] = context.getString(R.string.delete_helper_ask_spam_other);
|
||||||
} else if (problem == ReviewController.DeleteReason.COPYRIGHT_VIOLATION) {
|
} else if (problem == ReviewController.DeleteReason.COPYRIGHT_VIOLATION) {
|
||||||
reasonList[0] = context.getResources().getString(R.string.delete_reason_copyright_pressphoto);
|
reasonList[0] = context.getString(R.string.delete_helper_ask_reason_copyright_press_photo);
|
||||||
reasonList[1] = context.getResources().getString(R.string.delete_reason_copyright_internetphoto);
|
reasonList[1] = context.getString(R.string.delete_helper_ask_reason_copyright_internet_photo);
|
||||||
reasonList[2] = context.getResources().getString(R.string.delete_reason_copyright_logo);
|
reasonList[2] = context.getString(R.string.delete_helper_ask_reason_copyright_logo);
|
||||||
reasonList[3] = context.getResources().getString(R.string.delete_reason_copyright_other);
|
reasonList[3] = context.getString(R.string.delete_helper_ask_reason_copyright_other);
|
||||||
}
|
}
|
||||||
|
|
||||||
alert.setMultiChoiceItems(reasonList, checkedItems, (dialogInterface, position, isChecked) -> {
|
alert.setMultiChoiceItems(reasonList, checkedItems, (dialogInterface, position, isChecked) -> {
|
||||||
|
|
@ -181,9 +181,9 @@ public class DeleteHelper {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
alert.setPositiveButton("OK", (dialogInterface, i) -> {
|
alert.setPositiveButton(context.getString(R.string.ok), (dialogInterface, i) -> {
|
||||||
|
|
||||||
String reason = "Because it is ";
|
String reason = context.getString(R.string.delete_helper_ask_alert_set_positive_button_reason) + " ";
|
||||||
for (int j = 0; j < mUserReason.size(); j++) {
|
for (int j = 0; j < mUserReason.size(); j++) {
|
||||||
reason = reason + reasonList[mUserReason.get(j)];
|
reason = reason + reasonList[mUserReason.get(j)];
|
||||||
if (j != mUserReason.size() - 1) {
|
if (j != mUserReason.size() - 1) {
|
||||||
|
|
@ -203,7 +203,7 @@ public class DeleteHelper {
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
alert.setNegativeButton("Cancel", (dialog, which) -> reviewCallback.onFailure());
|
alert.setNegativeButton(context.getString(R.string.cancel), (dialog, which) -> reviewCallback.onFailure());
|
||||||
AlertDialog d = alert.create();
|
AlertDialog d = alert.create();
|
||||||
d.show();
|
d.show();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -560,12 +560,19 @@ Upload your first media by tapping on the add button.</string>
|
||||||
<string name="dialog_box_text_nomination">Why should %1$s be deleted?</string>
|
<string name="dialog_box_text_nomination">Why should %1$s be deleted?</string>
|
||||||
<string name="review_is_uploaded_by">%1$s is uploaded by: %2$s</string>
|
<string name="review_is_uploaded_by">%1$s is uploaded by: %2$s</string>
|
||||||
<string name="default_description_language">Default description language</string>
|
<string name="default_description_language">Default description language</string>
|
||||||
<string name="delete_reason_spam_selfie">A selfie</string>
|
<string name="delete_helper_make_deletion_toast">Trying to nominate %1$s for deletion</string>
|
||||||
<string name="delete_reason_spam_blurry">Blurry</string>
|
<string name="delete_helper_show_deletion_title">Nominating for deletion</string>
|
||||||
<string name="delete_reason_spam_nonsense">Nonsense</string>
|
<string name="delete_helper_show_deletion_title_success">Success</string>
|
||||||
<string name="delete_reason_spam_other">Other</string>
|
<string name="delete_helper_show_deletion_message_if">Successfully nominated %1$s for deletion.</string>
|
||||||
<string name="delete_reason_copyright_pressphoto">Press photo</string>
|
<string name="delete_helper_show_deletion_title_failed">Failed</string>
|
||||||
<string name="delete_reason_copyright_internetphoto">Random photo from internet</string>
|
<string name="delete_helper_show_deletion_message_else">Could not request deletion.</string>
|
||||||
<string name="delete_reason_copyright_logo">Logo</string>
|
<string name="delete_helper_ask_spam_selfie">A selfie</string>
|
||||||
<string name="delete_reason_copyright_other">Other</string>
|
<string name="delete_helper_ask_spam_blurry">Blurry</string>
|
||||||
|
<string name="delete_helper_ask_spam_nonsense">Nonsense</string>
|
||||||
|
<string name="delete_helper_ask_spam_other">Other</string>
|
||||||
|
<string name="delete_helper_ask_reason_copyright_press_photo">Press photo</string>
|
||||||
|
<string name="delete_helper_ask_reason_copyright_internet_photo">Random photo from internet</string>
|
||||||
|
<string name="delete_helper_ask_reason_copyright_logo">Logo</string>
|
||||||
|
<string name="delete_helper_ask_reason_copyright_other">Other</string>
|
||||||
|
<string name="delete_helper_ask_alert_set_positive_button_reason">Because it is</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue