Bug 1085386 - Finish preference activity when hitting action bar "up" button. r=liuche
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Mon, 17 Nov 2014 11:42:47 -0800
changeset 240420 885334253d3a435994151a4c276a08b13da3455a
parent 240345 31722b673a74201a92605d9aee05ed8615901435
child 240421 1cdf743b10cb2ca5438acbb04e5667a8555a8ca3
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1085386
milestone36.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1085386 - Finish preference activity when hitting action bar "up" button. r=liuche
mobile/android/search/java/org/mozilla/search/SearchPreferenceActivity.java
--- a/mobile/android/search/java/org/mozilla/search/SearchPreferenceActivity.java
+++ b/mobile/android/search/java/org/mozilla/search/SearchPreferenceActivity.java
@@ -14,16 +14,17 @@ import org.mozilla.gecko.db.BrowserContr
 import android.app.AlertDialog;
 import android.content.DialogInterface;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
 import android.preference.Preference;
 import android.preference.PreferenceActivity;
 import android.util.Log;
+import android.view.MenuItem;
 import android.widget.Toast;
 
 /**
  * This activity allows users to modify the settings for the search activity.
  *
  * A note on implementation: At the moment, we don't have tablet-specific designs.
  * Therefore, this implementation uses the old-style PreferenceActivity. When
  * we start optimizing for tablets, we can migrate to Fennec's PreferenceFragment
@@ -100,9 +101,18 @@ public class SearchPreferenceActivity ex
                             .getString(R.string.pref_clearHistory_confirmation), Toast.LENGTH_SHORT).show();
                 } else {
                     Log.e(LOG_TAG, "Error clearing search history.");
                 }
             }
         };
         clearHistoryTask.execute();
     }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            finish();
+            return true;
+        }
+        return false;
+    }
 }