nsclient allow general preferences

This commit is contained in:
Milos Kozak 2018-09-11 20:08:59 +02:00
parent 69544f67b5
commit f7269a806d
4 changed files with 7 additions and 9 deletions

View file

@ -89,7 +89,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
pref.setSummary("******"); pref.setSummary("******");
} else if (pref.getKey().equals(MainApp.gs(R.string.key_danars_name))) { } else if (pref.getKey().equals(MainApp.gs(R.string.key_danars_name))) {
pref.setSummary(SP.getString(R.string.key_danars_name, "")); pref.setSummary(SP.getString(R.string.key_danars_name, ""));
} else if (editTextPref.getText() != null ) { } else if (editTextPref.getText() != null) {
((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage()); ((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
pref.setSummary(editTextPref.getText()); pref.setSummary(editTextPref.getText());
} else if (pref.getKey().contains("smscommunicator_allowednumbers") && TextUtils.isEmpty(editTextPref.getText().trim())) { } else if (pref.getKey().contains("smscommunicator_allowednumbers") && TextUtils.isEmpty(editTextPref.getText().trim())) {
@ -183,9 +183,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
addPreferencesFromResourceIfEnabled(NSClientPlugin.getPlugin(), PluginType.GENERAL); addPreferencesFromResourceIfEnabled(NSClientPlugin.getPlugin(), PluginType.GENERAL);
addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginType.GENERAL); addPreferencesFromResourceIfEnabled(SmsCommunicatorPlugin.getPlugin(), PluginType.GENERAL);
if (!Config.NSCLIENT) { addPreferencesFromResource(R.xml.pref_others);
addPreferencesFromResource(R.xml.pref_others);
}
addPreferencesFromResource(R.xml.pref_datachoices); addPreferencesFromResource(R.xml.pref_datachoices);
addPreferencesFromResourceIfEnabled(WearPlugin.getPlugin(), PluginType.GENERAL); addPreferencesFromResourceIfEnabled(WearPlugin.getPlugin(), PluginType.GENERAL);

View file

@ -1,8 +1,6 @@
package info.nightscout.androidaps.tabs; package info.nightscout.androidaps.tabs;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
@ -14,8 +12,10 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.logging.L;
import info.nightscout.utils.SP;
/** /**
* Created by mike on 30.05.2016. * Created by mike on 30.05.2016.
@ -57,8 +57,7 @@ public class TabPageAdapter extends FragmentPagerAdapter {
@Override @Override
public CharSequence getPageTitle(int position) { public CharSequence getPageTitle(int position) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); if (SP.getBoolean(R.string.key_short_tabtitles, false)) {
if (preferences.getBoolean("short_tabtitles", false)) {
return visibleFragmentList.get(position).getNameShort(); return visibleFragmentList.get(position).getNameShort();
} }
return visibleFragmentList.get(position).getName(); return visibleFragmentList.get(position).getName();

View file

@ -1203,6 +1203,7 @@
<string name="key_loop_openmode_min_change" translatable="false">loop_openmode_min_change</string> <string name="key_loop_openmode_min_change" translatable="false">loop_openmode_min_change</string>
<string name="loop_openmode_min_change">Minimal request change [%]</string> <string name="loop_openmode_min_change">Minimal request change [%]</string>
<string name="loop_openmode_min_change_summary">Loop will popup new change request only if change is bigger than this value. Default value is 30%</string> <string name="loop_openmode_min_change_summary">Loop will popup new change request only if change is bigger than this value. Default value is 30%</string>
<string name="key_short_tabtitles" translatable="false">short_tabtitles</string>
<plurals name="objective_days"> <plurals name="objective_days">
<item quantity="one">%1$d day</item> <item quantity="one">%1$d day</item>

View file

@ -69,7 +69,7 @@
</PreferenceScreen> </PreferenceScreen>
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="short_tabtitles" android:key="@string/key_short_tabtitles"
android:title="@string/short_tabtitles" /> android:title="@string/short_tabtitles" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceScreen android:title="@string/localalertsettings_title"> <PreferenceScreen android:title="@string/localalertsettings_title">