From: luca020400 Date: Sun, 24 May 2015 22:47:17 +0000 (-0700) Subject: samsung: doze: Add back button to action bar X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=78fa4868ed2f31c0c7c28d9a991a5ef8cc1af34e;p=GitHub%2FLineageOS%2Fandroid_hardware_samsung.git samsung: doze: Add back button to action bar Change-Id: Ia56183c8c2d5a6bc25c84f1d1b9823b84bc936c9 --- diff --git a/doze/src/com/cyanogenmod/settings/device/TouchscreenGestureSettings.java b/doze/src/com/cyanogenmod/settings/device/TouchscreenGestureSettings.java index e685c7e..dc18422 100644 --- a/doze/src/com/cyanogenmod/settings/device/TouchscreenGestureSettings.java +++ b/doze/src/com/cyanogenmod/settings/device/TouchscreenGestureSettings.java @@ -18,11 +18,14 @@ package com.cyanogenmod.settings.device; import com.android.internal.util.cm.ScreenType; +import android.app.ActionBar; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.SwitchPreference; import android.provider.Settings; +import android.view.Menu; +import android.view.MenuItem; public class TouchscreenGestureSettings extends PreferenceActivity { @@ -50,6 +53,9 @@ public class TouchscreenGestureSettings extends PreferenceActivity { mPocketPreference = (SwitchPreference) findPreference(KEY_GESTURE_POCKET); mPocketPreference.setEnabled(dozeEnabled); + + final ActionBar actionBar = getActionBar(); + actionBar.setDisplayHomeAsUpEnabled(true); } @Override @@ -62,6 +68,15 @@ public class TouchscreenGestureSettings extends PreferenceActivity { } } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == android.R.id.home) { + onBackPressed(); + return true; + } + return false; + } + private boolean enableDoze(boolean enable) { return Settings.Secure.putInt(getContentResolver(), Settings.Secure.DOZE_ENABLED, enable ? 1 : 0);