From: David A. Velasco Date: Mon, 1 Jun 2015 11:52:08 +0000 (+0200) Subject: Fixed title and up button in Settings activity X-Git-Tag: oc-android-1.7.2~1^2~23^2~21 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/78158aa4a35e738c6be565eab951a8f0f96eb65e?ds=sidebyside Fixed title and up button in Settings activity --- diff --git a/src/com/owncloud/android/ui/activity/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java index ef8c2226..0b55eeea 100644 --- a/src/com/owncloud/android/ui/activity/Preferences.java +++ b/src/com/owncloud/android/ui/activity/Preferences.java @@ -33,6 +33,7 @@ import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager.NameNotFoundException; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; @@ -43,7 +44,8 @@ import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceActivity; import android.preference.PreferenceCategory; import android.preference.PreferenceManager; -import android.support.v7.app.ActionBar; +//import android.support.v7.app.ActionBar; +import android.app.ActionBar; import android.view.ContextMenu; import android.view.ContextMenu.ContextMenuInfo; import android.view.Menu; @@ -111,11 +113,18 @@ public class Preferences extends PreferenceActivity mDbHandler = new DbHandler(getBaseContext()); addPreferencesFromResource(R.xml.preferences); - // TODO: Add Toolbar -// ActionBar actionBar = getSherlock().getActionBar(); -// actionBar.setIcon(DisplayUtils.getSeasonalIconId()); -// actionBar.setDisplayHomeAsUpEnabled(true); -// actionBar.setTitle(R.string.actionbar_settings); + // Set properties of Action Bar in an ugly workaround to build correctly without upgrading minSdk + // TODO : increase minSdk; scheduled for next realease, don't wont to mix with this US + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { + ActionBar actionBar = getActionBar(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) { + actionBar.setIcon(DisplayUtils.getSeasonalIconId()); + } + actionBar.setDisplayHomeAsUpEnabled(true); + actionBar.setTitle(R.string.actionbar_settings); + } else { + setTitle(R.string.actionbar_settings); + } // For adding content description tag to a title field in the action bar int actionBarTitleId = getResources().getIdentifier("action_bar_title", "id", "android");