materialdatetimepicker update
This commit is contained in:
parent
86a826e65a
commit
7cca9892dc
16 changed files with 54 additions and 68 deletions
|
@ -238,7 +238,7 @@ dependencies {
|
||||||
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
implementation 'androidx.gridlayout:gridlayout:1.0.0'
|
||||||
implementation 'com.google.android.material:material:1.0.0'
|
implementation 'com.google.android.material:material:1.0.0'
|
||||||
implementation 'androidx.percentlayout:percentlayout:1.0.0'
|
implementation 'androidx.percentlayout:percentlayout:1.0.0'
|
||||||
implementation "com.wdullaer:materialdatetimepicker:2.3.0"
|
implementation 'com.wdullaer:materialdatetimepicker:4.2.3'
|
||||||
|
|
||||||
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
|
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ import info.nightscout.androidaps.utils.T;
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||||
import io.reactivex.disposables.CompositeDisposable;
|
import io.reactivex.disposables.CompositeDisposable;
|
||||||
|
|
||||||
public class HistoryBrowseActivity extends NoSplashActivity {
|
public class HistoryBrowseActivity extends NoSplashAppCompatActivity {
|
||||||
private static Logger log = LoggerFactory.getLogger(HistoryBrowseActivity.class);
|
private static Logger log = LoggerFactory.getLogger(HistoryBrowseActivity.class);
|
||||||
private CompositeDisposable disposable = new CompositeDisposable();
|
private CompositeDisposable disposable = new CompositeDisposable();
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ public class HistoryBrowseActivity extends NoSplashActivity {
|
||||||
);
|
);
|
||||||
dpd.setThemeDark(true);
|
dpd.setThemeDark(true);
|
||||||
dpd.dismissOnPause(true);
|
dpd.dismissOnPause(true);
|
||||||
dpd.show(getFragmentManager(), "Datepickerdialog");
|
dpd.show(getSupportFragmentManager(), "Datepickerdialog");
|
||||||
});
|
});
|
||||||
|
|
||||||
bgGraph.getGridLabelRenderer().setGridColor(MainApp.gc(R.color.graphgrid));
|
bgGraph.getGridLabelRenderer().setGridColor(MainApp.gc(R.color.graphgrid));
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers;
|
package info.nightscout.androidaps.plugins.general.automation.triggers;
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.ContextWrapper;
|
import android.content.ContextWrapper;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
|
@ -84,11 +84,11 @@ public abstract class Trigger {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
Activity scanForActivity(Context cont) {
|
AppCompatActivity scanForActivity(Context cont) {
|
||||||
if (cont == null)
|
if (cont == null)
|
||||||
return null;
|
return null;
|
||||||
else if (cont instanceof Activity)
|
else if (cont instanceof AppCompatActivity)
|
||||||
return (Activity) cont;
|
return (AppCompatActivity) cont;
|
||||||
else if (cont instanceof ContextWrapper)
|
else if (cont instanceof ContextWrapper)
|
||||||
return scanForActivity(((ContextWrapper) cont).getBaseContext());
|
return scanForActivity(((ContextWrapper) cont).getBaseContext());
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers;
|
package info.nightscout.androidaps.plugins.general.automation.triggers;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -9,6 +8,7 @@ import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.dpro.widgets.WeekdaysPicker;
|
import com.dpro.widgets.WeekdaysPicker;
|
||||||
|
@ -294,9 +294,9 @@ public class TriggerRecurringTime extends Trigger {
|
||||||
);
|
);
|
||||||
tpd.setThemeDark(true);
|
tpd.setThemeDark(true);
|
||||||
tpd.dismissOnPause(true);
|
tpd.dismissOnPause(true);
|
||||||
Activity a = scanForActivity(root.getContext());
|
AppCompatActivity a = scanForActivity(root.getContext());
|
||||||
if (a != null)
|
if (a != null)
|
||||||
tpd.show(a.getFragmentManager(), "TimePickerDialog");
|
tpd.show(a.getSupportFragmentManager(), "TimePickerDialog");
|
||||||
});
|
});
|
||||||
|
|
||||||
int px = MainApp.dpToPx(10);
|
int px = MainApp.dpToPx(10);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers;
|
package info.nightscout.androidaps.plugins.general.automation.triggers;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
|
@ -142,9 +142,9 @@ public class TriggerTime extends Trigger {
|
||||||
);
|
);
|
||||||
dpd.setThemeDark(true);
|
dpd.setThemeDark(true);
|
||||||
dpd.dismissOnPause(true);
|
dpd.dismissOnPause(true);
|
||||||
Activity a = scanForActivity(root.getContext());
|
AppCompatActivity a = scanForActivity(root.getContext());
|
||||||
if (a != null)
|
if (a != null)
|
||||||
dpd.show(a.getFragmentManager(), "DatePickerDialog");
|
dpd.show(a.getSupportFragmentManager(), "DatePickerDialog");
|
||||||
});
|
});
|
||||||
timeButton.setOnClickListener(view -> {
|
timeButton.setOnClickListener(view -> {
|
||||||
GregorianCalendar calendar = new GregorianCalendar();
|
GregorianCalendar calendar = new GregorianCalendar();
|
||||||
|
@ -162,9 +162,9 @@ public class TriggerTime extends Trigger {
|
||||||
);
|
);
|
||||||
tpd.setThemeDark(true);
|
tpd.setThemeDark(true);
|
||||||
tpd.dismissOnPause(true);
|
tpd.dismissOnPause(true);
|
||||||
Activity a = scanForActivity(root.getContext());
|
AppCompatActivity a = scanForActivity(root.getContext());
|
||||||
if (a != null)
|
if (a != null)
|
||||||
tpd.show(a.getFragmentManager(), "TimePickerDialog");
|
tpd.show(a.getSupportFragmentManager(), "TimePickerDialog");
|
||||||
});
|
});
|
||||||
|
|
||||||
int px = MainApp.dpToPx(10);
|
int px = MainApp.dpToPx(10);
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.androidaps.plugins.general.automation.triggers;
|
package info.nightscout.androidaps.plugins.general.automation.triggers;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
import androidx.fragment.app.FragmentManager;
|
import androidx.fragment.app.FragmentManager;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
import com.google.common.base.Optional;
|
||||||
|
@ -18,7 +18,6 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
|
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
@ -33,14 +32,14 @@ import info.nightscout.androidaps.utils.T;
|
||||||
|
|
||||||
public class TriggerTimeRange extends Trigger {
|
public class TriggerTimeRange extends Trigger {
|
||||||
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
|
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
|
||||||
|
|
||||||
// in minutes since midnight 60 means 1AM
|
// in minutes since midnight 60 means 1AM
|
||||||
private int start;
|
private int start;
|
||||||
private int end;
|
private int end;
|
||||||
long timeZoneOffset = DateUtil.getTimeZoneOffsetMs();
|
long timeZoneOffset = DateUtil.getTimeZoneOffsetMs();
|
||||||
|
|
||||||
public TriggerTimeRange() {
|
public TriggerTimeRange() {
|
||||||
|
|
||||||
start = getMinSinceMidnight(DateUtil.now());
|
start = getMinSinceMidnight(DateUtil.now());
|
||||||
end = getMinSinceMidnight(DateUtil.now());
|
end = getMinSinceMidnight(DateUtil.now());
|
||||||
}
|
}
|
||||||
|
@ -60,11 +59,11 @@ public class TriggerTimeRange extends Trigger {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
boolean doRun = false;
|
boolean doRun = false;
|
||||||
if ( start < end && start < currentMinSinceMidnight && currentMinSinceMidnight < end)
|
if (start < end && start < currentMinSinceMidnight && currentMinSinceMidnight < end)
|
||||||
doRun = true;
|
doRun = true;
|
||||||
|
|
||||||
// handle cases like 10PM to 6AM
|
// handle cases like 10PM to 6AM
|
||||||
else if ( start > end && (start < currentMinSinceMidnight || currentMinSinceMidnight < end))
|
else if (start > end && (start < currentMinSinceMidnight || currentMinSinceMidnight < end))
|
||||||
doRun = true;
|
doRun = true;
|
||||||
|
|
||||||
if (doRun) {
|
if (doRun) {
|
||||||
|
@ -129,8 +128,8 @@ public class TriggerTimeRange extends Trigger {
|
||||||
}
|
}
|
||||||
|
|
||||||
TriggerTimeRange period(int start, int end) {
|
TriggerTimeRange period(int start, int end) {
|
||||||
this.start = getMinSinceMidnight(start*60000);
|
this.start = getMinSinceMidnight(start * 60000);
|
||||||
this.end = getMinSinceMidnight(end*60000);
|
this.end = getMinSinceMidnight(end * 60000);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +144,7 @@ public class TriggerTimeRange extends Trigger {
|
||||||
}
|
}
|
||||||
|
|
||||||
long toMilis(long minutesSinceMidnight) {
|
long toMilis(long minutesSinceMidnight) {
|
||||||
return minutesSinceMidnight*60*1000;
|
return minutesSinceMidnight * 60 * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMinSinceMidnight(long time) {
|
public int getMinSinceMidnight(long time) {
|
||||||
|
@ -157,11 +156,11 @@ public class TriggerTimeRange extends Trigger {
|
||||||
return (calendar.get(Calendar.HOUR_OF_DAY) * 60) + calendar.get(Calendar.MINUTE);
|
return (calendar.get(Calendar.HOUR_OF_DAY) * 60) + calendar.get(Calendar.MINUTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getStart(){
|
int getStart() {
|
||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getEnd(){
|
int getEnd() {
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +169,8 @@ public class TriggerTimeRange extends Trigger {
|
||||||
TextView label = new TextView(root.getContext());
|
TextView label = new TextView(root.getContext());
|
||||||
TextView startButton = new TextView(root.getContext());
|
TextView startButton = new TextView(root.getContext());
|
||||||
TextView endButton = new TextView(root.getContext());
|
TextView endButton = new TextView(root.getContext());
|
||||||
log.debug("Start is: " + start );
|
log.debug("Start is: " + start);
|
||||||
log.debug("End is: " + end );
|
log.debug("End is: " + end);
|
||||||
startButton.setText(DateUtil.timeString(toMilis(start) - timeZoneOffset));
|
startButton.setText(DateUtil.timeString(toMilis(start) - timeZoneOffset));
|
||||||
endButton.setText(MainApp.gs(R.string.and) + " " + DateUtil.timeString(toMilis(end) - timeZoneOffset));
|
endButton.setText(MainApp.gs(R.string.and) + " " + DateUtil.timeString(toMilis(end) - timeZoneOffset));
|
||||||
|
|
||||||
|
@ -193,9 +192,9 @@ public class TriggerTimeRange extends Trigger {
|
||||||
);
|
);
|
||||||
tpd.setThemeDark(true);
|
tpd.setThemeDark(true);
|
||||||
tpd.dismissOnPause(true);
|
tpd.dismissOnPause(true);
|
||||||
Activity a = scanForActivity(root.getContext());
|
AppCompatActivity a = scanForActivity(root.getContext());
|
||||||
if (a != null)
|
if (a != null)
|
||||||
tpd.show(a.getFragmentManager(), "TimePickerDialog");
|
tpd.show(a.getSupportFragmentManager(), "TimePickerDialog");
|
||||||
});
|
});
|
||||||
endButton.setOnClickListener(view -> {
|
endButton.setOnClickListener(view -> {
|
||||||
GregorianCalendar calendar = new GregorianCalendar();
|
GregorianCalendar calendar = new GregorianCalendar();
|
||||||
|
@ -213,9 +212,9 @@ public class TriggerTimeRange extends Trigger {
|
||||||
);
|
);
|
||||||
tpd.setThemeDark(true);
|
tpd.setThemeDark(true);
|
||||||
tpd.dismissOnPause(true);
|
tpd.dismissOnPause(true);
|
||||||
Activity a = scanForActivity(root.getContext());
|
AppCompatActivity a = scanForActivity(root.getContext());
|
||||||
if (a != null)
|
if (a != null)
|
||||||
tpd.show(a.getFragmentManager(), "TimePickerDialog");
|
tpd.show(a.getSupportFragmentManager(), "TimePickerDialog");
|
||||||
});
|
});
|
||||||
|
|
||||||
int px = MainApp.dpToPx(10);
|
int px = MainApp.dpToPx(10);
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.general.careportal.Dialogs;
|
package info.nightscout.androidaps.plugins.general.careportal.Dialogs;
|
||||||
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import androidx.fragment.app.DialogFragment;
|
|
||||||
import androidx.appcompat.app.AlertDialog;
|
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.text.format.DateFormat;
|
import android.text.format.DateFormat;
|
||||||
|
@ -20,9 +18,12 @@ import android.widget.RadioButton;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.appcompat.app.AlertDialog;
|
||||||
|
import androidx.appcompat.app.AppCompatDialogFragment;
|
||||||
|
import androidx.fragment.app.DialogFragment;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
||||||
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
|
|
||||||
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
|
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
|
||||||
|
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
|
@ -39,7 +40,6 @@ import java.util.List;
|
||||||
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;
|
||||||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
|
||||||
import info.nightscout.androidaps.data.Profile;
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.ProfileStore;
|
import info.nightscout.androidaps.data.ProfileStore;
|
||||||
import info.nightscout.androidaps.db.BgReading;
|
import info.nightscout.androidaps.db.BgReading;
|
||||||
|
@ -51,6 +51,7 @@ import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions;
|
||||||
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
|
import info.nightscout.androidaps.plugins.general.careportal.OptionsToShow;
|
||||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload;
|
||||||
|
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin;
|
||||||
import info.nightscout.androidaps.utils.DateUtil;
|
import info.nightscout.androidaps.utils.DateUtil;
|
||||||
import info.nightscout.androidaps.utils.DefaultValueHelper;
|
import info.nightscout.androidaps.utils.DefaultValueHelper;
|
||||||
|
@ -61,11 +62,9 @@ import info.nightscout.androidaps.utils.SP;
|
||||||
import info.nightscout.androidaps.utils.SafeParse;
|
import info.nightscout.androidaps.utils.SafeParse;
|
||||||
import info.nightscout.androidaps.utils.Translator;
|
import info.nightscout.androidaps.utils.Translator;
|
||||||
|
|
||||||
public class NewNSTreatmentDialog extends DialogFragment implements View.OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
|
public class NewNSTreatmentDialog extends AppCompatDialogFragment implements View.OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
|
||||||
private static Logger log = LoggerFactory.getLogger(NewNSTreatmentDialog.class);
|
private static Logger log = LoggerFactory.getLogger(NewNSTreatmentDialog.class);
|
||||||
|
|
||||||
private Activity context;
|
|
||||||
|
|
||||||
private static OptionsToShow options;
|
private static OptionsToShow options;
|
||||||
private static String event;
|
private static String event;
|
||||||
|
|
||||||
|
@ -119,18 +118,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAttach(Activity activity) {
|
|
||||||
context = activity;
|
|
||||||
super.onAttach(activity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onDetach() {
|
|
||||||
super.onDetach();
|
|
||||||
this.context = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
@ -421,18 +408,18 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
);
|
);
|
||||||
dpd.setThemeDark(true);
|
dpd.setThemeDark(true);
|
||||||
dpd.dismissOnPause(true);
|
dpd.dismissOnPause(true);
|
||||||
dpd.show(context.getFragmentManager(), "Datepickerdialog");
|
dpd.show(getActivity().getSupportFragmentManager(), "Datepickerdialog");
|
||||||
break;
|
break;
|
||||||
case R.id.careportal_newnstreatment_eventtime:
|
case R.id.careportal_newnstreatment_eventtime:
|
||||||
TimePickerDialog tpd = TimePickerDialog.newInstance(
|
TimePickerDialog tpd = TimePickerDialog.newInstance(
|
||||||
this,
|
this,
|
||||||
calendar.get(Calendar.HOUR_OF_DAY),
|
calendar.get(Calendar.HOUR_OF_DAY),
|
||||||
calendar.get(Calendar.MINUTE),
|
calendar.get(Calendar.MINUTE),
|
||||||
DateFormat.is24HourFormat(context)
|
DateFormat.is24HourFormat(getContext())
|
||||||
);
|
);
|
||||||
tpd.setThemeDark(true);
|
tpd.setThemeDark(true);
|
||||||
tpd.dismissOnPause(true);
|
tpd.dismissOnPause(true);
|
||||||
tpd.show(context.getFragmentManager(), "Timepickerdialog");
|
tpd.show(getActivity().getSupportFragmentManager(), "Timepickerdialog");
|
||||||
break;
|
break;
|
||||||
case R.id.ok:
|
case R.id.ok:
|
||||||
confirmNSTreatmentCreation();
|
confirmNSTreatmentCreation();
|
||||||
|
@ -469,7 +456,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {
|
public void onTimeSet(TimePickerDialog view, int hourOfDay, int minute, int second) {
|
||||||
eventTime.setHours(hourOfDay);
|
eventTime.setHours(hourOfDay);
|
||||||
eventTime.setMinutes(minute);
|
eventTime.setMinutes(minute);
|
||||||
eventTime.setSeconds(this.seconds++); // randomize seconds to prevent creating record of the same time, if user choose time manually
|
eventTime.setSeconds(this.seconds++); // randomize seconds to prevent creating record of the same time, if user choose time manually
|
||||||
|
@ -477,7 +464,6 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
updateBGforDateTime();
|
updateBGforDateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JSONObject gatherData() {
|
JSONObject gatherData() {
|
||||||
String enteredBy = SP.getString("careportal_enteredby", "");
|
String enteredBy = SP.getString("careportal_enteredby", "");
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
|
@ -702,6 +688,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
}
|
}
|
||||||
|
|
||||||
void confirmNSTreatmentCreation() {
|
void confirmNSTreatmentCreation() {
|
||||||
|
Context context = getContext();
|
||||||
if (context != null) {
|
if (context != null) {
|
||||||
final JSONObject data = gatherData();
|
final JSONObject data = gatherData();
|
||||||
final String confirmText = buildConfirmText(data);
|
final String confirmText = buildConfirmText(data);
|
||||||
|
@ -715,7 +702,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void createNSTreatment(JSONObject data) {
|
void createNSTreatment(JSONObject data) {
|
||||||
if (options.executeProfileSwitch) {
|
if (options.executeProfileSwitch) {
|
||||||
if (data.has("profile")) {
|
if (data.has("profile")) {
|
||||||
ProfileFunctions.doProfileSwitch(profileStore, JsonHelper.safeGetString(data, "profile"), JsonHelper.safeGetInt(data, "duration"), JsonHelper.safeGetInt(data, "percentage"), JsonHelper.safeGetInt(data, "timeshift"));
|
ProfileFunctions.doProfileSwitch(profileStore, JsonHelper.safeGetString(data, "profile"), JsonHelper.safeGetInt(data, "duration"), JsonHelper.safeGetInt(data, "percentage"), JsonHelper.safeGetInt(data, "timeshift"));
|
||||||
|
|
|
@ -142,7 +142,7 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -567,7 +567,7 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
android:layout_marginRight="30dp" />
|
android:layout_marginRight="30dp" />
|
||||||
|
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:entries="@array/quickWizardYesNo"/>
|
android:entries="@array/quickWizardYesNo"/>
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,6 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -179,7 +179,7 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@
|
||||||
android:layout_marginLeft="30dp"
|
android:layout_marginLeft="30dp"
|
||||||
android:layout_marginRight="30dp" />
|
android:layout_marginRight="30dp" />
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_marginBottom="15dp" />
|
android:layout_marginBottom="15dp" />
|
||||||
|
|
||||||
<include layout="@layout/mdtp_done_button" />
|
<include layout="@layout/okcancel" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue