Merge pull request #138 from AdrianLxM/adjusttargetsse

Short tab titles
This commit is contained in:
Milos Kozak 2017-01-22 11:35:29 +01:00 committed by GitHub
commit c4f8167424
37 changed files with 399 additions and 0 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

@ -21,6 +21,7 @@ public interface PluginBase {
String getFragmentClass();
String getName();
String getNameShort();
boolean isEnabled(int type);
boolean isVisibleInTabs(int type);
boolean canBeHidden(int type);

View file

@ -28,6 +28,17 @@ public class ActionsPlugin implements PluginBase {
return MainApp.sResources.getString(R.string.actions);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.actions_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL && fragmentEnabled;

View file

@ -24,6 +24,17 @@ public class CareportalPlugin implements PluginBase {
return MainApp.sResources.getString(R.string.careportal);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.careportal_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL && fragmentEnabled;

View file

@ -64,6 +64,17 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
return MainApp.instance().getString(R.string.circadian_percentage_profile);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.circadian_percentage_profile_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == PROFILE && fragmentEnabled;

View file

@ -100,6 +100,17 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
return MainApp.instance().getString(R.string.configbuilder);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.configbuilder_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL && true;

View file

@ -154,6 +154,17 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
return MainApp.instance().getString(R.string.danarpump);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.danarpump_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
if (type == PluginBase.PROFILE) return fragmentProfileEnabled && fragmentPumpEnabled;

View file

@ -154,6 +154,17 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
return MainApp.instance().getString(R.string.danarkoreanpump);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.danarpump_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
if (type == PluginBase.PROFILE) return fragmentProfileEnabled && fragmentPumpEnabled;

View file

@ -61,6 +61,17 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
return MainApp.instance().getString(R.string.localprofile);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.localprofile_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == PROFILE && fragmentEnabled;

View file

@ -81,6 +81,17 @@ public class LoopPlugin implements PluginBase {
return MainApp.instance().getString(R.string.loop);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.loop_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == LOOP && fragmentEnabled && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable;

View file

@ -74,6 +74,12 @@ public class MDIPlugin implements PluginBase, PumpInterface {
return MainApp.instance().getString(R.string.mdi);
}
@Override
public String getNameShort() {
// use long name as fallback (not visible in tabs)
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == PUMP && fragmentEnabled;

View file

@ -49,6 +49,17 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface {
return MainApp.instance().getString(R.string.profileviewer);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.profileviewer_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == PROFILE && fragmentEnabled;

View file

@ -49,6 +49,17 @@ public class ObjectivesPlugin implements PluginBase, ConstraintsInterface {
return MainApp.instance().getString(R.string.objectives);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.objectives_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == CONSTRAINTS && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable;

View file

@ -55,6 +55,17 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
return MainApp.instance().getString(R.string.openapsama);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.oaps_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == APS && fragmentEnabled && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable;

View file

@ -56,6 +56,17 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
return MainApp.instance().getString(R.string.openapsma);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.oaps_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == APS && fragmentEnabled && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable;

View file

@ -47,6 +47,17 @@ public class OverviewPlugin implements PluginBase {
return MainApp.instance().getString(R.string.overview);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.overview_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL;

View file

@ -38,6 +38,12 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
return MainApp.instance().getString(R.string.safety);
}
@Override
public String getNameShort() {
// use long name as fallback (no tabs)
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == CONSTRAINTS;

View file

@ -58,6 +58,17 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
return MainApp.instance().getString(R.string.simpleprofile);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.simpleprofile_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == PROFILE && fragmentEnabled;

View file

@ -116,6 +116,17 @@ public class SmsCommunicatorPlugin implements PluginBase {
return MainApp.sResources.getString(R.string.smscommunicator);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.smscommunicator_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL && fragmentEnabled;

View file

@ -27,6 +27,12 @@ public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
return MainApp.instance().getString(R.string.MM640g);
}
@Override
public String getNameShort() {
// use long name as fallback (no tabs)
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == BGSOURCE && fragmentEnabled;

View file

@ -26,6 +26,13 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
return MainApp.instance().getString(R.string.nsclient);
}
@Override
public String getNameShort() {
// use long name as fallback (not visible in tabs)
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == BGSOURCE && fragmentEnabled;

View file

@ -28,6 +28,12 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
return MainApp.instance().getString(R.string.xdrip);
}
@Override
public String getNameShort() {
// use long name as fallback (no tabs)
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == BGSOURCE && fragmentEnabled;

View file

@ -61,6 +61,17 @@ public class TempBasalsPlugin implements PluginBase, TempBasalsInterface {
return MainApp.instance().getString(R.string.tempbasals);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.tempbasals_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == TEMPBASAL && fragmentEnabled && MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable;

View file

@ -44,6 +44,17 @@ public class TempTargetRangePlugin implements PluginBase {
return MainApp.sResources.getString(R.string.temptargetrange);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.temptargetrange_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL && fragmentEnabled;

View file

@ -51,6 +51,17 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
return MainApp.instance().getString(R.string.treatments);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.treatments_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == TREATMENT && fragmentEnabled;

View file

@ -78,6 +78,17 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
return MainApp.instance().getString(R.string.virtualpump);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.virtualpump_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == PUMP && fragmentEnabled;

View file

@ -48,6 +48,17 @@ public class WearPlugin implements PluginBase {
return ctx.getString(R.string.wear);
}
@Override
public String getNameShort() {
String name = MainApp.sResources.getString(R.string.wear_shortname);
if (!name.trim().isEmpty()){
//only if translation exists
return name;
}
// use long name as fallback
return getName();
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL && fragmentEnabled;

View file

@ -61,6 +61,12 @@ public class PersistentNotificationPlugin implements PluginBase{
return ctx.getString(R.string.ongoingnotificaction);
}
@Override
public String getNameShort() {
// use long name as fallback (not visible in tabs)
return getName();
}
@Override
public boolean isEnabled(int type) {
return fragmentEnabled;

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) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
if(preferences.getBoolean("short_tabtitles", false)){
return visibleFragmentList.get(position).getNameShort();
}
return visibleFragmentList.get(position).getName();
}
@Override

View file

@ -376,4 +376,22 @@
<string name="wear">Wear</string>
<string name="wrongpumpdriverselected">Избран е грешен тип помпа</string>
<string name="minago">преди %d м.</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
<string name="treatments_shortname">" "</string>
<string name="temptargetrange_shortname">" "</string>
<string name="tempbasals_shortname">" "</string>
<string name="smscommunicator_shortname">" "</string>
<string name="simpleprofile_shortname">" "</string>
<string name="profileviewer_shortname">" "</string>
<string name="overview_shortname">" "</string>
<string name="objectives_shortname">" "</string>
<string name="oaps_shortname">" "</string>
<string name="loop_shortname">" "</string>
<string name="localprofile_shortname">" "</string>
<string name="danarpump_shortname">" "</string>
<string name="configbuilder_shortname">" "</string>
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
</resources>

View file

@ -401,4 +401,22 @@
<string name="short_avgdelta">Krátkodobý průměr</string>
<string name="temptargetrange">Dočasný cíl</string>
<string name="temptargetrange_refreshfromnightscout">Obnovit dočasné cíle z NS</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
<string name="treatments_shortname">" "</string>
<string name="temptargetrange_shortname">" "</string>
<string name="tempbasals_shortname">" "</string>
<string name="smscommunicator_shortname">" "</string>
<string name="simpleprofile_shortname">" "</string>
<string name="profileviewer_shortname">" "</string>
<string name="overview_shortname">" "</string>
<string name="objectives_shortname">" "</string>
<string name="oaps_shortname">" "</string>
<string name="loop_shortname">" "</string>
<string name="localprofile_shortname">" "</string>
<string name="danarpump_shortname">" "</string>
<string name="configbuilder_shortname">" "</string>
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
</resources>

View file

@ -312,4 +312,22 @@
<string name="absorption_rate">Absorptionsrate:</string>
<string name="configbuilder">Config Builder</string>
<string name="minago">vor %d min</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
<string name="treatments_shortname">" "</string>
<string name="temptargetrange_shortname">" "</string>
<string name="tempbasals_shortname">" "</string>
<string name="smscommunicator_shortname">" "</string>
<string name="simpleprofile_shortname">" "</string>
<string name="profileviewer_shortname">" "</string>
<string name="overview_shortname">" "</string>
<string name="objectives_shortname">" "</string>
<string name="oaps_shortname">" "</string>
<string name="loop_shortname">" "</string>
<string name="localprofile_shortname">" "</string>
<string name="danarpump_shortname">" "</string>
<string name="configbuilder_shortname">" "</string>
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
</resources>

View file

@ -1,4 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AndroidAPS</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
<string name="treatments_shortname">" "</string>
<string name="temptargetrange_shortname">" "</string>
<string name="tempbasals_shortname">" "</string>
<string name="smscommunicator_shortname">" "</string>
<string name="simpleprofile_shortname">" "</string>
<string name="profileviewer_shortname">" "</string>
<string name="overview_shortname">" "</string>
<string name="objectives_shortname">" "</string>
<string name="oaps_shortname">" "</string>
<string name="loop_shortname">" "</string>
<string name="localprofile_shortname">" "</string>
<string name="danarpump_shortname">" "</string>
<string name="configbuilder_shortname">" "</string>
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
</resources>

View file

@ -340,6 +340,24 @@
<string formatted="false" name="smscommunicator_basalreplywithcode">Para iniciar basal %.2fU/h responder con código %s</string>
<string name="androidaps_tempbasalstartnote">Inicio Basal Temporal</string>
<string name="androidaps_tempbasalendnote">Fin Basal Temporal</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
<string name="treatments_shortname">" "</string>
<string name="temptargetrange_shortname">" "</string>
<string name="tempbasals_shortname">" "</string>
<string name="smscommunicator_shortname">" "</string>
<string name="simpleprofile_shortname">" "</string>
<string name="profileviewer_shortname">" "</string>
<string name="overview_shortname">" "</string>
<string name="objectives_shortname">" "</string>
<string name="oaps_shortname">" "</string>
<string name="loop_shortname">" "</string>
<string name="localprofile_shortname">" "</string>
<string name="danarpump_shortname">" "</string>
<string name="configbuilder_shortname">" "</string>
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
<string name="activity">Actividad</string>
<string name="alert_dialog_storage_permission_text">Por favo reinicia el teléfono o AndroidAPS desde ajustes de sistema, sino AndroidAPS no guardara registros (importantes para trazar y verificar que el algoritmo funciona correctamente)</string>
<string name="array_of_elements">Matriz de %d elementos. Valor actual:</string>

View file

@ -382,4 +382,22 @@
<string name="sms_actualbg">BG:</string>
<string name="sms_lastbg">Last BG:</string>
<string name="mdi">MDI</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
<string name="treatments_shortname">" "</string>
<string name="temptargetrange_shortname">" "</string>
<string name="tempbasals_shortname">" "</string>
<string name="smscommunicator_shortname">" "</string>
<string name="simpleprofile_shortname">" "</string>
<string name="profileviewer_shortname">" "</string>
<string name="overview_shortname">" "</string>
<string name="objectives_shortname">" "</string>
<string name="oaps_shortname">" "</string>
<string name="loop_shortname">" "</string>
<string name="localprofile_shortname">" "</string>
<string name="danarpump_shortname">" "</string>
<string name="configbuilder_shortname">" "</string>
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
</resources>

View file

@ -429,4 +429,23 @@
<string name="initializing">Initializing ...</string>
<string name="careportal_temptarget">Temporary Target</string>
<string name="openapsama_autosens_adjusttargets">Allow autosens to adjust targets</string>
<string name="actions_shortname">ACT</string>
<string name="configbuilder_shortname">CONF</string>
<string name="loop_shortname">LOOP</string>
<string name="simpleprofile_shortname">SP</string>
<string name="oaps_shortname">OAPS</string>
<string name="temptargetrange_shortname">TT</string>
<string name="localprofile_shortname">LP</string>
<string name="danarpump_shortname">DANA</string>
<string name="circadian_percentage_profile_shortname">CPP</string>
<string name="tempbasals_shortname">TB</string>
<string name="overview_shortname">HOME</string>
<string name="virtualpump_shortname">VPUMP</string>
<string name="profileviewer_shortname">NSPROFILE</string>
<string name="treatments_shortname">TREAT</string>
<string name="careportal_shortname">CP</string>
<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>