diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 54dacba..b5b73dc 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -43,7 +43,13 @@ + android:label="@string/settings_title" > + + + + diff --git a/src/com/github/nutomic/controldlna/gui/PreferencesActivity.java b/src/com/github/nutomic/controldlna/gui/PreferencesActivity.java index 39d0689..e29ae94 100644 --- a/src/com/github/nutomic/controldlna/gui/PreferencesActivity.java +++ b/src/com/github/nutomic/controldlna/gui/PreferencesActivity.java @@ -29,10 +29,13 @@ package com.github.nutomic.controldlna.gui; import android.content.Intent; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.preference.Preference; import android.preference.PreferenceActivity; import android.preference.PreferenceScreen; +import android.support.v4.app.NavUtils; +import android.view.MenuItem; import com.github.nutomic.controldlna.R; @@ -46,11 +49,28 @@ public class PreferencesActivity extends PreferenceActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + // There is currently no way to get ActionBar in PreferenceActivity on pre-honeycomb with + // compatibility library, so we'll have to do a version check. + if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + getActionBar().setDisplayHomeAsUpEnabled(true); + } + addPreferencesFromResource(R.xml.preferences); final PreferenceScreen screen = getPreferenceScreen(); mContactDev = screen.findPreference(KEY_CONTACT_DEV); } + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + NavUtils.navigateUpFromSameTask(this); + return true; + default: + return super.onOptionsItemSelected(item); + } + } + @Override public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {