Second commit with mainly java files

This commit is contained in:
Philoul 2019-12-05 21:00:39 +01:00
parent c716ac006b
commit bfe7a34735
11 changed files with 78 additions and 83 deletions

View file

@ -83,7 +83,7 @@ public class CPPActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editTimeshift.editText.getText().toString());
}
editTimeshift = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 23d, 1d, new DecimalFormat("0"), true, true);
setLabelToPlusMinusView(view, "timeshift");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_timeshift));
container.addView(view);
return view;
} else if(col == 1){
@ -93,7 +93,7 @@ public class CPPActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editPercentage.editText.getText().toString());
}
editPercentage = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 50d, 150d, 1d, new DecimalFormat("0"), false);
setLabelToPlusMinusView(view, "percentage");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_percentage));
container.addView(view);
return view;
} else {

View file

@ -71,7 +71,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editCarbs.editText.getText().toString());
}
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), true);
setLabelToPlusMinusView(view, "carbs");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_carbs));
container.addView(view);
return view;
} else if(col == 1){
@ -81,7 +81,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editStartTime.editText.getText().toString());
}
editStartTime = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 300d, 15d, new DecimalFormat("0"), false);
setLabelToPlusMinusView(view, "start [min]");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_start_min));
container.addView(view);
return view;
} else if(col == 2){
@ -91,7 +91,7 @@ public class ECarbActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editDuration.editText.getText().toString());
}
editDuration = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 8d, 1d, new DecimalFormat("0"), false);
setLabelToPlusMinusView(view, "duration [h]");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_duration_h));
container.addView(view);
return view;
} else {

View file

@ -70,7 +70,7 @@ public class FillActivity extends ViewSelectorActivity {
def = SafeParse.stringToDouble(editInsulin.editText.getText().toString());
}
editInsulin = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 30d, 0.1d, new DecimalFormat("#0.0"), false);
setLabelToPlusMinusView(view, "insulin");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_insulin));
container.addView(view);
return view;
} else {

View file

@ -85,7 +85,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
double def = SafeParse.stringToDouble(time.editText.getText().toString());
time = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 24 * 60d, 5d, new DecimalFormat("0"), false);
}
setLabelToPlusMinusView(view, "duration");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_duration));
container.addView(view);
return view;
@ -105,9 +105,9 @@ public class TempTargetActivity extends ViewSelectorActivity {
lowRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
}
if(isSingleTarget){
setLabelToPlusMinusView(view, "target");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_target));
} else {
setLabelToPlusMinusView(view, "low");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_low));
}
container.addView(view);
return view;
@ -126,7 +126,7 @@ public class TempTargetActivity extends ViewSelectorActivity {
}
highRange = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 4d, 10d, 0.1d, new DecimalFormat("#0.0"), false);
}
setLabelToPlusMinusView(view, "high");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_high));
container.addView(view);
return view;
}else {

View file

@ -80,7 +80,7 @@ public class WizardActivity extends ViewSelectorActivity {
editCarbs = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 0d, 150d, 1d, new DecimalFormat("0"), false);
}
setLabelToPlusMinusView(view, "carbs");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_carbs));
container.addView(view);
return view;
} else if(col == 1 && hasPercentage){
@ -91,7 +91,7 @@ public class WizardActivity extends ViewSelectorActivity {
double def = SafeParse.stringToDouble(editPercentage.editText.getText().toString());
editPercentage = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 50d, 150d, 1d, new DecimalFormat("0"), false);
}
setLabelToPlusMinusView(view, "percentage");
setLabelToPlusMinusView(view, getResources().getString(R.string.action_percentage));
container.addView(view);
return view;
} else {

View file

@ -2,6 +2,7 @@ package info.nightscout.androidaps.interaction.menus;
import android.content.Intent;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.actions.FillActivity;
import info.nightscout.androidaps.interaction.utils.MenuListActivity;
@ -15,10 +16,10 @@ public class FillMenuActivity extends MenuListActivity {
@Override
protected String[] getElements() {
return new String[]{
"Preset 1",
"Preset 2",
"Preset 3",
"Free amount"
getResources().getString(R.string.action_preset_1),
getResources().getString(R.string.action_preset_2),
getResources().getString(R.string.action_preset_3),
getResources().getString(R.string.action_free_amount)
};
}

View file

@ -7,6 +7,7 @@ import android.preference.PreferenceManager;
import java.util.Vector;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.AAPSPreferences;
import info.nightscout.androidaps.interaction.actions.AcceptActivity;
@ -46,13 +47,13 @@ public class MainMenuActivity extends MenuListActivity {
boolean showWizard = sp.getBoolean("showWizard", true);
Vector<String> menuitems = new Vector<String>();
menuitems.add("TempT");
if(showWizard) menuitems.add("Wizard");
menuitems.add("eCarb");
menuitems.add("Bolus");
menuitems.add("Settings");
menuitems.add("Status");
if (showPrimeFill) menuitems.add("Prime/Fill");
menuitems.add(getResources().getString(R.string.menu_tempt));
if(showWizard) menuitems.add(getResources().getString(R.string.menu_wizard));
menuitems.add(getResources().getString(R.string.menu_ecarb));
menuitems.add(getResources().getString(R.string.menu_bolus));
menuitems.add(getResources().getString(R.string.menu_settings));
menuitems.add(getResources().getString(R.string.menu_status));
if (showPrimeFill) menuitems.add(getResources().getString(R.string.menu_prime_fill));
return menuitems.toArray(new String[menuitems.size()]);
}
@ -62,33 +63,33 @@ public class MainMenuActivity extends MenuListActivity {
Intent intent;
if ("Settings".equals(action)) {
if (getResources().getString(R.string.menu_settings).equals(action)) {
intent = new Intent(this, AAPSPreferences.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} else if ("Re-Sync".equals(action)) {
ListenerService.requestData(this);
} else if ("TempT".equals(action)) {
} else if (getResources().getString(R.string.menu_tempt).equals(action)) {
intent = new Intent(this, TempTargetActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} else if ("Bolus".equals(action)) {
} else if (getResources().getString(R.string.menu_bolus).equals(action)) {
intent = new Intent(this, BolusActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} else if ("Wizard".equals(action)) {
} else if (getResources().getString(R.string.menu_wizard).equals(action)) {
intent = new Intent(this, WizardActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} else if ("Status".equals(action)) {
} else if (getResources().getString(R.string.menu_status).equals(action)) {
intent = new Intent(this, StatusMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} else if ("Prime/Fill".equals(action)) {
} else if (getResources().getString(R.string.menu_prime_fill).equals(action)) {
intent = new Intent(this, FillMenuActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);
} else if ("eCarb".equals(action)) {
} else if (getResources().getString(R.string.menu_ecarb).equals(action)) {
intent = new Intent(this, ECarbActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(intent);

View file

@ -1,5 +1,6 @@
package info.nightscout.androidaps.interaction.menus;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.ListenerService;
import info.nightscout.androidaps.interaction.utils.MenuListActivity;
@ -12,23 +13,23 @@ public class StatusMenuActivity extends MenuListActivity {
@Override
protected String[] getElements() {
return new String[] {
"Pump",
"Loop",
"CPP",
"TDD"};
getResources().getString(R.string.status_pump),
getResources().getString(R.string.status_loop),
getResources().getString(R.string.status_cpp),
getResources().getString(R.string.status_tdd)};
}
@Override
protected void doAction(String action) {
if ("Pump".equals(action)) {
if (getResources().getString(R.string.status_pump).equals(action)) {
ListenerService.initiateAction(this, "status pump");
} else if ("Loop".equals(action)) {
} else if (getResources().getString(R.string.status_loop).equals(action)) {
ListenerService.initiateAction(this, "status loop");
} else if ("CPP".equals(action)) {
} else if (getResources().getString(R.string.status_cpp).equals(action)) {
ListenerService.initiateAction(this, "opencpp");
} else if ("TDD".equals(action)) {
} else if (getResources().getString(R.string.status_tdd).equals(action)) {
ListenerService.initiateAction(this, "tddstats");
}
}

View file

@ -2,11 +2,11 @@
<resources>
<string-array name="chart_timeframe">
<item>1 hour</item>
<item>2 hours</item>
<item>3 hours</item>
<item>4 hours</item>
<item>5 hours</item>
<item>@string/pref_1_hour</item>
<item>@string/pref_2_hours</item>
<item>@string/pref_3_hours</item>
<item>@string/pref_4_hours</item>
<item>@string/pref_5_hours</item>
</string-array>
<string-array name="chart_timeframe_values">
@ -18,9 +18,9 @@
</string-array>
<string-array name="delta_granularity">
<item>Low</item>
<item>Medium</item>
<item>High</item>
<item>@string/pref_low</item>
<item>@string/pref_medium</item>
<item>@string/pref_high</item>
</string-array>
<string-array name="delta_granularity_values">
@ -30,10 +30,10 @@
</string-array>
<string-array name="input_design">
<item>Default</item>
<item>Quick righty</item>
<item>Quick lefty</item>
<item>Modern Sparse</item>
<item>@string/pref_default</item>
<item>@string/pref_quick_righty</item>
<item>@string/pref_quick_lefty</item>
<item>@string/pref_modern_sparse</item>
</string-array>
<string-array name="input_design_values">
@ -44,13 +44,13 @@
</string-array>
<string-array name="complication_tap_action">
<item>Default</item>
<item>Menu</item>
<item>Wizard</item>
<item>Bolus</item>
<item>eCarb</item>
<item>Status</item>
<item>None</item>
<item>@string/menu_default</item>
<item>@string/menu_menu</item>
<item>@string/menu_wizard</item>
<item>@string/menu_bolus</item>
<item>@string/menu_ecarb</item>
<item>@string/menu_status</item>
<item>@string/menu_none</item>
</string-array>
<string-array name="complication_tap_action_values">

View file

@ -4,7 +4,6 @@
<string name="app_name">AAPS</string>
<string name="label_actions_activity">AAPS</string>
<string name="label_xdrip">AAPS</string>
<string name="label_xdrip_large">AAPS(Large)</string>
<string name="label_xdrip_big_chart">AAPS(BigChart)</string>
@ -26,8 +25,6 @@
<string name="pref_off">Off</string>
<string name="pref_vibrate_on_bolus">Vibrate on Bolus</string>
<string name="pref_units_for_actions">Units for Actions</string>
<string name="pref_mg_dl">mg/dl</string>
<string name="pref_mmol_l">mmol/l</string>
<string name="pref_show_date">Show Date</string>
<string name="pref_show_iob">Show IOB</string>
<string name="pref_show_cob">Show COB</string>
@ -77,8 +74,12 @@
<string name="menu_settings">Settings</string>
<string name="menu_status">Status</string>
<string name="menu_prime_fill">Prime/Fill</string>
<string name="menu_none">None</string>
<string name="menu_default">Default</string>
<string name="menu_menu">Menu</string>
<string name="action_duration">duration</string>
<string name="action_target">target</string>
<string name="action_low">low</string>
<string name="action_high">high</string>
<string name="action_carbs">carbs</string>
@ -105,17 +106,16 @@
<string name="activity_carb">Carb</string>
<string name="activity_IOB">IOB</string>
<string name="activity_g">g</string>
<string name="activity_U">U</string>
<string name="activity_no_status">no status</string>
<string name="unit_mg_dl">mg/dl</string>
<string name="unit_mmol_l">mmol/l</string>
<string name="unit_g">g</string>
<string name="unit_u">U</string>
<string name="unit_u_p_h">U/h</string>
<string name="unit_h">h</string>
<string name="unit_d">d</string>
<string name="unit_w">w/s</string>
<string name="label_warning_sync">No data!</string>
<string name="label_warning_old">Old data!</string>
<string name="label_warning_since">Since %1$s</string>
<string name="label_warning_sync_aaps">Sync with AAPS!</string>
<string name="msg_warning_sync">No data received since %1$s! Check if AAPS on the phone sends data to watch</string>
<string name="msg_warning_old">AAPS data is %1$s old! Check your sensor, xDrip+, NS, AAPS config or other!</string>
</resources>

View file

@ -204,6 +204,7 @@
android:title="@string/pref_wizard_in_menu"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="primefill"
@ -211,6 +212,7 @@
android:title="@string/pref_prime_in_menu"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="true"
android:key="singletarget"
@ -218,6 +220,7 @@
android:title="@string/pref_single_target"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="wizardpercentage"
@ -225,6 +228,7 @@
android:title="@string/pref_wizard_percentage"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<ListPreference
android:defaultValue="default"
android:entries="@array/complication_tap_action"
@ -232,6 +236,7 @@
android:key="complication_tap_action"
android:summary="What dialog to show after tap on complication"
android:title="@string/pref_complication_tap_action" />
<CheckBoxPreference
android:defaultValue="true"
android:key="complication_unicode"
@ -239,20 +244,7 @@
android:title="@string/pref_unicode_in_complications"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<ListPreference
android:defaultValue="default"
android:entries="@array/complication_tap_action"
android:entryValues="@array/complication_tap_action_values"
android:key="complication_tap_action"
android:summary="What dialog to show after tap on complication"
android:title="Complication Tap Action" />
<CheckBoxPreference
android:defaultValue="true"
android:key="complication_unicode"
android:summary="Use unicode special characters in complications."
android:title="Unicode in Complications"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<info.nightscout.androidaps.interaction.utils.VersionPreference
android:defaultValue="1"
android:entries="@array/input_design"