plusminis edit shows toast when hit limit
This commit is contained in:
parent
294f9d6c99
commit
88698576a2
4 changed files with 20 additions and 5 deletions
|
@ -17,6 +17,9 @@ import java.util.concurrent.Executors;
|
|||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
/**
|
||||
* Created by mike on 28.06.2016.
|
||||
*/
|
||||
|
@ -109,13 +112,21 @@ public class PlusMinusEditText implements View.OnKeyListener,
|
|||
|
||||
private void inc() {
|
||||
value += step;
|
||||
if (value > maxValue) value = maxValue;
|
||||
if (value > maxValue) {
|
||||
value = maxValue;
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.youareonallowedlimit));
|
||||
stopUpdating();
|
||||
}
|
||||
updateEditText();
|
||||
}
|
||||
|
||||
private void dec() {
|
||||
value -= step;
|
||||
if (value < minValue) value = minValue;
|
||||
if (value < minValue) {
|
||||
value = minValue;
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.youareonallowedlimit));
|
||||
stopUpdating();
|
||||
}
|
||||
updateEditText();
|
||||
}
|
||||
|
||||
|
@ -137,8 +148,10 @@ public class PlusMinusEditText implements View.OnKeyListener,
|
|||
}
|
||||
|
||||
private void stopUpdating() {
|
||||
mUpdater.shutdownNow();
|
||||
mUpdater = null;
|
||||
if (mUpdater != null) {
|
||||
mUpdater.shutdownNow();
|
||||
mUpdater = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ToastUtils {
|
|||
playSound(ctx, soundID);
|
||||
}
|
||||
|
||||
public static void playSound(final Context ctx, final int soundID) {
|
||||
private static void playSound(final Context ctx, final int soundID) {
|
||||
final MediaPlayer soundMP = MediaPlayer.create(ctx, soundID);
|
||||
soundMP.start();
|
||||
soundMP.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
|
||||
|
|
|
@ -299,4 +299,5 @@
|
|||
<string name="objectives_5_gate">Jeden týden úspěšného používání s běžným příjmem sacharidů</string>
|
||||
<string name="objectives_5_objective">Upravit bazály a koeficinty, když bude potřeba a povolit automatickou detekci citlivosti na inzulín</string>
|
||||
<string name="objectives_6_objective">Povolit další fukce pro běžné používání jako AMA</string>
|
||||
<string name="youareonallowedlimit">Dosaženo limitu</string>
|
||||
</resources>
|
|
@ -301,5 +301,6 @@
|
|||
<string name="objectives_5_objective">Adjust basals and ratios if needed, and then enable auto-sens</string>
|
||||
<string name="objectives_5_gate">1 week successful daytime looping with regular carb entry</string>
|
||||
<string name="objectives_6_objective">Enabling additional features for daytime use, such as advanced meal assist</string>
|
||||
<string name="youareonallowedlimit">You reached allowed limit</string>
|
||||
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue