sorten tab titles active

This commit is contained in:
AdrianLxM 2017-01-21 23:48:05 +01:00
parent ea78dd5bc1
commit f418152059
4 changed files with 16 additions and 1 deletions

View file

@ -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));
}

View file

@ -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

View file

@ -447,4 +447,5 @@
<string name="objectives_shortname">OBJ</string>
<string name="wear_shortname">WEAR</string>
<string name="smscommunicator_shortname">SMS</string>
<string name="short_tabtitles">Shorten tab titles</string>
</resources>

View file

@ -40,5 +40,9 @@
android:inputType="numberDecimal">
</EditTextPreference>
</PreferenceScreen>
<SwitchPreference
android:defaultValue="false"
android:key="short_tabtitles"
android:title="@string/short_tabtitles"/>
</PreferenceCategory>
</PreferenceScreen>