mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 21:03:54 +01:00
* Fixed #4906 : Peer review: "thank the contributor" should show snackbar instead of notification * changes the snackbar to toast * added the tests * minor changes * minor changes - 2
This commit is contained in:
parent
11bc72c514
commit
1ae013d2b3
2 changed files with 31 additions and 12 deletions
|
|
@ -156,21 +156,25 @@ public class ReviewController {
|
|||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe((result) -> {
|
||||
String message;
|
||||
String title;
|
||||
if (result) {
|
||||
title = context.getString(R.string.send_thank_success_title);
|
||||
message = context.getString(R.string.send_thank_success_message, media.getDisplayTitle());
|
||||
} else {
|
||||
title = context.getString(R.string.send_thank_failure_title);
|
||||
message = context.getString(R.string.send_thank_failure_message, media.getDisplayTitle());
|
||||
}
|
||||
|
||||
showNotification(title, message);
|
||||
|
||||
displayThanksToast(context,result);
|
||||
}, Timber::e);
|
||||
}
|
||||
|
||||
@SuppressLint("StringFormatInvalid")
|
||||
private void displayThanksToast(final Context context, final boolean result){
|
||||
final String message;
|
||||
final String title;
|
||||
if (result) {
|
||||
title = context.getString(R.string.send_thank_success_title);
|
||||
message = context.getString(R.string.send_thank_success_message, media.getDisplayTitle());
|
||||
} else {
|
||||
title = context.getString(R.string.send_thank_failure_title);
|
||||
message = context.getString(R.string.send_thank_failure_message, media.getDisplayTitle());
|
||||
}
|
||||
|
||||
ViewUtil.showShortToast(context,message);
|
||||
}
|
||||
|
||||
private void showNotification(String title, String message) {
|
||||
notificationBuilder.setDefaults(NotificationCompat.DEFAULT_ALL)
|
||||
.setContentTitle(title)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue