X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserAndroid.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fcom%2Fstoutner%2Fprivacybrowser%2FUrlHistory.java;h=ec0b45e455acc659acc7c303077bfcf4079ddad9;hp=d2d4fecde081bf3e4ee1327243f38212e9f40c3f;hb=ac6db897f8e99a28a7e2d916238fbdf7a021ac55;hpb=eb1e349d876e09e2b82e4eb9d6dc199147e1cde5 diff --git a/app/src/main/java/com/stoutner/privacybrowser/UrlHistory.java b/app/src/main/java/com/stoutner/privacybrowser/UrlHistory.java index d2d4fecd..ec0b45e4 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/UrlHistory.java +++ b/app/src/main/java/com/stoutner/privacybrowser/UrlHistory.java @@ -150,6 +150,9 @@ public class UrlHistory extends AppCompatDialogFragment{ public interface UrlHistoryListener { // Send back the number of steps to move forward or back. void onUrlHistoryEntrySelected(int moveBackOrForwardSteps); + + // Clear the history. + void onClearHistory(); } // `urlHistoryListener` is used in `onAttach()` and `onCreateDialog()`. @@ -185,7 +188,16 @@ public class UrlHistory extends AppCompatDialogFragment{ dialogBuilder.setView(layoutInflater.inflate(R.layout.url_history_dialog, null)); // Set an `onClick()` listener on the negative button. - dialogBuilder.setNegativeButton(R.string.close, new DialogInterface.OnClickListener() { + dialogBuilder.setNegativeButton(R.string.clear_history, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + // Clear the history. + urlHistoryListener.onClearHistory(); + } + }); + + // Set an `onClick()` listener on the positive button. + dialogBuilder.setPositiveButton(R.string.close, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { // Do nothing if `Close` is clicked. The `Dialog` will automatically close.