From f418152059a7aed0ca3bc71c2d17321e78a95a3d Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Sat, 21 Jan 2017 23:48:05 +0100 Subject: [PATCH] sorten tab titles active --- .../info/nightscout/androidaps/PreferencesActivity.java | 3 +++ .../info/nightscout/androidaps/tabs/TabPageAdapter.java | 9 ++++++++- app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/pref_others.xml | 4 ++++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java b/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java index 8c19b68d85..92965a466f 100644 --- a/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java +++ b/app/src/main/java/info/nightscout/androidaps/PreferencesActivity.java @@ -40,6 +40,9 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre recreate(); MainApp.bus().post(new EventRefreshGui(true)); } + if (key.equals("short_tabtitles")) { + MainApp.bus().post(new EventRefreshGui(true)); + } updatePrefSummary(myPreferenceFragment.getPreference(key)); } diff --git a/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java b/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java index 466744d0c4..cedae6e9d7 100644 --- a/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java +++ b/app/src/main/java/info/nightscout/androidaps/tabs/TabPageAdapter.java @@ -1,6 +1,8 @@ package info.nightscout.androidaps.tabs; import android.content.Context; +import android.content.SharedPreferences; +import android.preference.PreferenceManager; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; @@ -36,7 +38,12 @@ public class TabPageAdapter extends FragmentStatePagerAdapter { @Override public CharSequence getPageTitle(int position) { - return visibleFragmentList.get(position).getNameShort(); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); + if(preferences.getBoolean("short_tabtitles", false)){ + return visibleFragmentList.get(position).getNameShort(); + } + return visibleFragmentList.get(position).getName(); + } @Override diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7bffaf9442..0d033d715f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -447,4 +447,5 @@ OBJ WEAR SMS + Shorten tab titles diff --git a/app/src/main/res/xml/pref_others.xml b/app/src/main/res/xml/pref_others.xml index d5de788edd..47178dbc25 100644 --- a/app/src/main/res/xml/pref_others.xml +++ b/app/src/main/res/xml/pref_others.xml @@ -40,5 +40,9 @@ android:inputType="numberDecimal"> +