X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/e7493203deca0edc7edeb5fb26f2774ede84a479..7a941e0b0b4aecc448889720ea849ed288770e67:/src/com/owncloud/android/ui/activity/Preferences.java diff --git a/src/com/owncloud/android/ui/activity/Preferences.java b/src/com/owncloud/android/ui/activity/Preferences.java index 23ab550a..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; @@ -54,6 +56,7 @@ import android.widget.AdapterView.OnItemLongClickListener; import android.widget.ListAdapter; import android.widget.ListView; +import com.owncloud.android.BuildConfig; import com.owncloud.android.MainApp; import com.owncloud.android.R; import com.owncloud.android.authentication.AccountUtils; @@ -110,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"); @@ -203,8 +213,21 @@ public class Preferences extends PreferenceActivity } } + + if (BuildConfig.DEBUG) { + Preference pLog = findPreference("log"); + if (pLog != null ){ + pLog.setOnPreferenceClickListener(new OnPreferenceClickListener() { + @Override + public boolean onPreferenceClick(Preference preference) { + Intent loggerIntent = new Intent(getApplicationContext(),LogHistoryActivity.class); + startActivity(loggerIntent); + return true; + } + }); + } + } - boolean recommendEnabled = getResources().getBoolean(R.bool.recommend_enabled); Preference pRecommend = findPreference("recommend"); if (pRecommend != null){ @@ -223,7 +246,8 @@ public class Preferences extends PreferenceActivity Account currentAccount = AccountUtils.getCurrentOwnCloudAccount(Preferences.this); String username = currentAccount.name.substring(0, currentAccount.name.lastIndexOf('@')); - String recommendSubject = String.format(getString(R.string.recommend_subject), appName); + String recommendSubject = String.format(getString(R.string.recommend_subject), + appName); String recommendText = String.format(getString(R.string.recommend_text), appName, downloadUrl, username);