Commit 3fe41331 authored by Joey Rizzoli's avatar Joey Rizzoli
Browse files

Add back key to actionbar



Change-Id: Ia90237a923244996d77a9fe0d59b7280af7b882a
Signed-off-by: default avatarJoey Rizzoli <joey@lineageos.org>
parent b9b9cce8
......@@ -16,6 +16,7 @@
package org.lineageos.openweathermapprovider;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
......@@ -24,7 +25,9 @@ import android.preference.EditTextPreference;
import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.view.MenuItem;
import android.widget.Toast;
import android.widget.Toolbar;
public class SettingsActivity extends Activity {
......@@ -37,11 +40,26 @@ public class SettingsActivity extends Activity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.ic_back);
}
getFragmentManager().beginTransaction()
.replace(android.R.id.content, new ServicePrefsFragment())
.commit();
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
finish();
}
return super.onOptionsItemSelected(item);
}
public static class ServicePrefsFragment extends PreferenceFragment implements Preference.OnPreferenceChangeListener {
private EditTextPreference mApiKeyPreference;
......
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="@android:color/white"
android:pathData="M20,11H7.83l5.59,-5.59L12,4l-8,8 8,8 1.41,-1.41L7.83,13H20v-2z"/>
</vector>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment