use numberPicker instead of editText
This commit is contained in:
parent
054003460c
commit
1147c28f04
2 changed files with 46 additions and 40 deletions
|
@ -17,6 +17,8 @@ import android.widget.TextView;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
@ -24,9 +26,7 @@ import info.nightscout.androidaps.interfaces.PluginType;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRS.services.DanaRSService;
|
import info.nightscout.utils.NumberPicker;
|
||||||
import info.nightscout.utils.SP;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Rumen Georgiev on 5/31/2018.
|
* Created by Rumen Georgiev on 5/31/2018.
|
||||||
*/
|
*/
|
||||||
|
@ -42,10 +42,10 @@ public class DanaRUserOptionsActivity extends Activity {
|
||||||
RadioButton pumpAlarmVibrate;
|
RadioButton pumpAlarmVibrate;
|
||||||
RadioButton pumpAlarmBoth;
|
RadioButton pumpAlarmBoth;
|
||||||
Switch pumpUnits;
|
Switch pumpUnits;
|
||||||
EditText screenTimeout;
|
NumberPicker screenTimeout;
|
||||||
EditText backlightTimeout;
|
NumberPicker backlightTimeout;
|
||||||
EditText shutdown;
|
NumberPicker shutdown;
|
||||||
EditText lowReservoir;
|
NumberPicker lowReservoir;
|
||||||
Button saveToPumpButton;
|
Button saveToPumpButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,11 +72,11 @@ public class DanaRUserOptionsActivity extends Activity {
|
||||||
pumpAlarmSound = (RadioButton) findViewById(R.id.danar_pumpalarm_sound);
|
pumpAlarmSound = (RadioButton) findViewById(R.id.danar_pumpalarm_sound);
|
||||||
pumpAlarmVibrate = (RadioButton) findViewById(R.id.danar_pumpalarm_vibrate);
|
pumpAlarmVibrate = (RadioButton) findViewById(R.id.danar_pumpalarm_vibrate);
|
||||||
pumpAlarmBoth = (RadioButton) findViewById(R.id.danar_pumpalarm_both);
|
pumpAlarmBoth = (RadioButton) findViewById(R.id.danar_pumpalarm_both);
|
||||||
screenTimeout = (EditText) findViewById(R.id.danar_screentimeout);
|
screenTimeout = (NumberPicker) findViewById(R.id.danar_screentimeout);
|
||||||
backlightTimeout = (EditText) findViewById(R.id.danar_backlight);
|
backlightTimeout = (NumberPicker) findViewById(R.id.danar_backlight);
|
||||||
pumpUnits = (Switch) findViewById(R.id.danar_units);
|
pumpUnits = (Switch) findViewById(R.id.danar_units);
|
||||||
shutdown = (EditText) findViewById(R.id.danar_shutdown);
|
shutdown = (NumberPicker) findViewById(R.id.danar_shutdown);
|
||||||
lowReservoir = (EditText) findViewById(R.id.danar_lowreservoir);
|
lowReservoir = (NumberPicker) findViewById(R.id.danar_lowreservoir);
|
||||||
saveToPumpButton = (Button) findViewById(R.id.save_user_options);
|
saveToPumpButton = (Button) findViewById(R.id.save_user_options);
|
||||||
|
|
||||||
saveToPumpButton.setOnClickListener(new View.OnClickListener() {
|
saveToPumpButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -118,17 +118,23 @@ public class DanaRUserOptionsActivity extends Activity {
|
||||||
beep.setChecked(true);
|
beep.setChecked(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
screenTimeout.setText(String.valueOf(pump.lcdOnTimeSec));
|
screenTimeout.setValue((double) pump.lcdOnTimeSec);
|
||||||
backlightTimeout.setText(String.valueOf(pump.backlightOnTimeSec));
|
screenTimeout.setStep(5d);
|
||||||
|
screenTimeout.setParams(5d,5d,240d,5d,new DecimalFormat("1"), false);
|
||||||
|
backlightTimeout.setValue((double) pump.backlightOnTimeSec);
|
||||||
|
backlightTimeout.setParams(0d,0d,60d,1d,new DecimalFormat("1"), false);
|
||||||
if(pump.lastSettingsRead == 0)
|
if(pump.lastSettingsRead == 0)
|
||||||
backlightTimeout.setText(String.valueOf(666));
|
log.debug("No settings loaded from pump!");
|
||||||
if (pump.getUnits() != null) {
|
if (pump.getUnits() != null) {
|
||||||
if(pump.getUnits().equals(Constants.MMOL)) {
|
if(pump.getUnits().equals(Constants.MMOL)) {
|
||||||
pumpUnits.setChecked(true);
|
pumpUnits.setChecked(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shutdown.setText(String.valueOf(pump.shutdownHour));
|
shutdown.setValue((double) pump.shutdownHour);
|
||||||
lowReservoir.setText(String.valueOf(pump.lowReservoirRate));
|
shutdown.setParams(0d,0d,24d,1d,new DecimalFormat("1"), false);
|
||||||
|
lowReservoir.setValue((double) pump.lowReservoirRate);
|
||||||
|
lowReservoir.setStep(10D);
|
||||||
|
lowReservoir.setParams(10d,10d,60d,10d,new DecimalFormat("10"), false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,13 +239,13 @@
|
||||||
android:text=":"
|
android:text=":"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<EditText
|
<info.nightscout.utils.NumberPicker
|
||||||
android:id="@+id/danar_screentimeout"
|
android:id="@+id/danar_screentimeout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp"
|
||||||
android:layout_weight="1"
|
android:layout_gravity="end"
|
||||||
android:ems="10"
|
android:paddingLeft="5dp"
|
||||||
android:inputType="number" />
|
android:paddingRight="5dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -288,13 +288,13 @@
|
||||||
android:text=":"
|
android:text=":"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<EditText
|
<info.nightscout.utils.NumberPicker
|
||||||
android:id="@+id/danar_backlight"
|
android:id="@+id/danar_backlight"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp"
|
||||||
android:layout_weight="1"
|
android:layout_gravity="end"
|
||||||
android:ems="10"
|
android:paddingLeft="5dp"
|
||||||
android:inputType="number" />
|
android:paddingRight="5dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -370,13 +370,13 @@
|
||||||
android:text=":"
|
android:text=":"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<EditText
|
<info.nightscout.utils.NumberPicker
|
||||||
android:id="@+id/danar_shutdown"
|
android:id="@+id/danar_shutdown"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp"
|
||||||
android:layout_weight="1"
|
android:layout_gravity="end"
|
||||||
android:ems="10"
|
android:paddingLeft="5dp"
|
||||||
android:inputType="number" />
|
android:paddingRight="5dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -419,13 +419,13 @@
|
||||||
android:text=":"
|
android:text=":"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<EditText
|
<info.nightscout.utils.NumberPicker
|
||||||
android:id="@+id/danar_lowreservoir"
|
android:id="@+id/danar_lowreservoir"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp"
|
||||||
android:layout_weight="1"
|
android:layout_gravity="end"
|
||||||
android:ems="10"
|
android:paddingLeft="5dp"
|
||||||
android:inputType="number" />
|
android:paddingRight="5dp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue