Add confirmation before loading reviews for contacts
This commit is contained in:
parent
d65828f369
commit
c130c7853f
|
@ -52,16 +52,37 @@ public class InfoDialogHelper {
|
|||
ReviewsSummaryHelper.populateSummary(view.findViewById(R.id.reviews_summary),
|
||||
numberInfo.communityDatabaseItem);
|
||||
|
||||
builder.setView(view);
|
||||
|
||||
builder.setNeutralButton(R.string.online_reviews, (d, w)
|
||||
-> ReviewsActivity.startForNumber(context, numberInfo.number));
|
||||
|
||||
builder.setNegativeButton(R.string.back, null);
|
||||
builder.setView(view)
|
||||
.setNeutralButton(R.string.online_reviews, null)
|
||||
.setNegativeButton(R.string.back, null);
|
||||
|
||||
if (onDismissListener != null) builder.setOnDismissListener(onDismissListener);
|
||||
|
||||
builder.show();
|
||||
AlertDialog dialog = builder.create();
|
||||
|
||||
// avoid dismissing the original dialog on button press
|
||||
|
||||
Runnable action = () -> {
|
||||
ReviewsActivity.startForNumber(context, numberInfo.number);
|
||||
dialog.dismiss();
|
||||
};
|
||||
|
||||
dialog.setOnShowListener(x -> {
|
||||
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setOnClickListener(v -> {
|
||||
if (numberInfo.contactItem != null) {
|
||||
new AlertDialog.Builder(context)
|
||||
.setTitle(R.string.load_reviews_confirmation_title)
|
||||
.setMessage(R.string.load_reviews_confirmation_message)
|
||||
.setPositiveButton(android.R.string.yes, (d1, w) -> action.run())
|
||||
.setNegativeButton(android.R.string.no, null)
|
||||
.show();
|
||||
} else {
|
||||
action.run();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -70,6 +70,9 @@
|
|||
<string name="back">Back</string>
|
||||
<string name="no">No</string>
|
||||
|
||||
<string name="load_reviews_confirmation_title">Are you sure?</string>
|
||||
<string name="load_reviews_confirmation_message">Loading online reviews will leak the number to a 3rd party service. Are you sure you want to do it with a number present in your Contacts?</string>
|
||||
|
||||
<string name="incoming_call_notifications">Incoming call notifications</string>
|
||||
<string name="block_calls">Block unwanted calls</string>
|
||||
<string name="auto_updates">Auto-update database</string>
|
||||
|
|
Loading…
Reference in New Issue