From 47f7d8d0b36b54a5934daaa6975e05c87e761383 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Fri, 8 Oct 2010 17:54:24 +0100 Subject: Add a conformation dialog when clearing the browser history This adds a confirmation dialog when clearing the browser history from the main browser menu or from the history page menu. This matches the behaviour of the clear history option on the browser settings page. Bug: 2149140 Change-Id: I6f0f5910b5df20aa5b43263165cb3cfbbed6b87d --- src/com/android/browser/BrowserHistoryPage.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/com/android/browser') diff --git a/src/com/android/browser/BrowserHistoryPage.java b/src/com/android/browser/BrowserHistoryPage.java index 72d8c28a7..ab622b16c 100644 --- a/src/com/android/browser/BrowserHistoryPage.java +++ b/src/com/android/browser/BrowserHistoryPage.java @@ -17,11 +17,14 @@ package com.android.browser; import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; import android.app.Fragment; import android.app.LoaderManager.LoaderCallbacks; import android.content.ClipboardManager; import android.content.Context; import android.content.CursorLoader; +import android.content.DialogInterface; import android.content.Intent; import android.content.Loader; import android.content.pm.PackageManager; @@ -200,8 +203,22 @@ public class BrowserHistoryPage extends Fragment public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.clear_history_menu_id: - Browser.clearHistory(getActivity().getContentResolver()); - mCallbacks.onRemoveParentChildRelationships(); + AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()) + .setTitle(R.string.clear) + .setMessage(R.string.pref_privacy_clear_history_dlg) + .setIcon(android.R.drawable.ic_dialog_alert) + .setNegativeButton(R.string.cancel, null) + .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + if (which == DialogInterface.BUTTON_POSITIVE) { + Browser.clearHistory(getActivity().getContentResolver()); + mCallbacks.onRemoveParentChildRelationships(); + } + } + }); + final Dialog dialog = builder.create(); + dialog.show(); return true; default: -- cgit v1.2.3