ProfileSwitchDialog

This commit is contained in:
Milos Kozak 2019-12-18 20:59:33 +01:00
parent e15a2d6b88
commit 8d874e14d3
18 changed files with 517 additions and 55 deletions

View file

@ -170,8 +170,8 @@ public class ProfileFunctions {
return profileSwitch;
}
public static void doProfileSwitch(final ProfileStore profileStore, final String profileName, final int duration, final int percentage, final int timeshift) {
ProfileSwitch profileSwitch = prepareProfileSwitch(profileStore, profileName, duration, percentage, timeshift, System.currentTimeMillis());
public static void doProfileSwitch(final ProfileStore profileStore, final String profileName, final int duration, final int percentage, final int timeshift, final long date) {
ProfileSwitch profileSwitch = prepareProfileSwitch(profileStore, profileName, duration, percentage, timeshift, date);
TreatmentsPlugin.getPlugin().addToHistoryProfileSwitch(profileSwitch);
if (percentage == 90 && duration == 10)
SP.putBoolean(R.string.key_objectiveuseprofileswitch, true);

View file

@ -23,6 +23,7 @@ import info.nightscout.androidaps.plugins.general.actions.dialogs.NewExtendedBol
import info.nightscout.androidaps.plugins.general.actions.dialogs.NewTempBasalDialog
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog
import info.nightscout.androidaps.plugins.general.overview.dialogs.ProfileSwitchDialog
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
import info.nightscout.androidaps.queue.Callback
import info.nightscout.androidaps.utils.*
@ -47,11 +48,7 @@ class ActionsFragment : Fragment() {
super.onViewCreated(view, savedInstanceState)
actions_profileswitch.setOnClickListener {
val newDialog = NewNSTreatmentDialog()
val profileSwitch = CareportalFragment.PROFILESWITCH
profileSwitch.executeProfileSwitch = true
newDialog.setOptions(profileSwitch, R.string.careportal_profileswitch)
fragmentManager?.let { newDialog.show(it, "NewNSTreatmentDialog") }
fragmentManager?.let { ProfileSwitchDialog().show(it, "Actions") }
}
actions_temptarget.setOnClickListener {
val newTTDialog = NewNSTreatmentDialog()

View file

@ -21,6 +21,7 @@ import info.nightscout.androidaps.plugins.general.automation.elements.InputProfi
import info.nightscout.androidaps.plugins.general.automation.elements.LabelWithElement;
import info.nightscout.androidaps.plugins.general.automation.elements.LayoutBuilder;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.androidaps.utils.DateUtil;
import info.nightscout.androidaps.utils.JsonHelper;
public class ActionProfileSwitch extends Action {
@ -66,7 +67,7 @@ public class ActionProfileSwitch extends Action {
return;
}
ProfileFunctions.doProfileSwitch(profileStore, profileName, 0, 100, 0);
ProfileFunctions.doProfileSwitch(profileStore, profileName, 0, 100, 0, DateUtil.now());
if (callback != null)
callback.result(new PumpEnactResult().success(true).comment(R.string.ok)).run();
}

View file

@ -63,7 +63,6 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
public static final OptionsToShow TEMPBASALSTART = new OptionsToShow(R.id.careportal_tempbasalstart, R.string.careportal_tempbasalstart).date().bg().duration().percent().absolute();
public static final OptionsToShow TEMPBASALEND = new OptionsToShow(R.id.careportal_tempbasalend, R.string.careportal_tempbasalend).date().bg();
public static final OptionsToShow PROFILESWITCH = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch).date().duration().profile();
public static final OptionsToShow PROFILESWITCHDIRECT = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch).duration().profile();
public static final OptionsToShow OPENAPSOFFLINE = new OptionsToShow(R.id.careportal_openapsoffline, R.string.careportal_openapsoffline).date().duration();
public static final OptionsToShow TEMPTARGET = new OptionsToShow(R.id.careportal_temporarytarget, R.string.careportal_temporarytarget).date().duration().tempTarget();
@ -180,7 +179,6 @@ public class CareportalFragment extends Fragment implements View.OnClickListener
newDialog.setOptions(NOTE, R.string.careportal_note);
break;
case R.id.careportal_profileswitch:
PROFILESWITCH.executeProfileSwitch = false;
newDialog.setOptions(PROFILESWITCH, R.string.careportal_profileswitch);
break;
case R.id.careportal_pumpsitechange:

View file

@ -672,7 +672,7 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
ret += "\n";
}
if (data.has("created_at")) {
ret += MainApp.gs(R.string.careportal_newnstreatment_eventtime_label);
ret += MainApp.gs(R.string.event_time_label);
ret += ": ";
ret += eventTime.toLocaleString();
ret += "\n";
@ -703,11 +703,7 @@ public class NewNSTreatmentDialog extends AppCompatDialogFragment implements Vie
void createNSTreatment(JSONObject data) {
if (options.executeProfileSwitch) {
if (data.has("profile")) {
ProfileFunctions.doProfileSwitch(profileStore, JsonHelper.safeGetString(data, "profile"), JsonHelper.safeGetInt(data, "duration"), JsonHelper.safeGetInt(data, "percentage"), JsonHelper.safeGetInt(data, "timeshift"));
}
} else if (options.executeTempTarget) {
if (options.executeTempTarget) {
final int duration = JsonHelper.safeGetInt(data, "duration");
final double targetBottom = JsonHelper.safeGetDouble(data, "targetBottom");
final double targetTop = JsonHelper.safeGetDouble(data, "targetTop");

View file

@ -20,7 +20,6 @@ public class OptionsToShow {
public boolean tempTarget;
// perform direct actions
public boolean executeProfileSwitch = false;
public boolean executeTempTarget = false;
public OptionsToShow(int eventType, int eventName) {

View file

@ -93,6 +93,7 @@ import info.nightscout.androidaps.plugins.general.overview.dialogs.CalibrationDi
import info.nightscout.androidaps.plugins.general.overview.dialogs.NewCarbsDialog;
import info.nightscout.androidaps.plugins.general.overview.dialogs.NewInsulinDialog;
import info.nightscout.androidaps.plugins.general.overview.dialogs.NewTreatmentDialog;
import info.nightscout.androidaps.plugins.general.overview.dialogs.ProfileSwitchDialog;
import info.nightscout.androidaps.plugins.general.overview.dialogs.WizardDialog;
import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData;
import info.nightscout.androidaps.plugins.general.wear.ActionStringHandler;
@ -744,11 +745,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
updateGUI("suspendmenu");
return true;
} else if (item.getTitle().equals(MainApp.gs(R.string.careportal_profileswitch))) {
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
final OptionsToShow profileswitch = CareportalFragment.PROFILESWITCHDIRECT;
profileswitch.executeProfileSwitch = true;
newDialog.setOptions(profileswitch, R.string.careportal_profileswitch);
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");
FragmentManager manager = getFragmentManager();
if (manager != null)
new ProfileSwitchDialog().show(manager, "Overview");
} else if (item.getTitle().equals(MainApp.gs(R.string.danar_viewprofile))) {
Bundle args = new Bundle();
args.putLong("time", DateUtil.now());

View file

@ -0,0 +1,115 @@
package info.nightscout.androidaps.plugins.general.overview.dialogs
import android.app.DatePickerDialog
import android.app.TimePickerDialog
import android.os.Bundle
import android.text.format.DateFormat
import android.view.*
import androidx.fragment.app.DialogFragment
import info.nightscout.androidaps.utils.DateUtil
import kotlinx.android.synthetic.main.datetime.*
import kotlinx.android.synthetic.main.okcancel.*
import org.slf4j.LoggerFactory
import java.util.*
abstract class DialogFragmentWithDate : DialogFragment() {
private val log = LoggerFactory.getLogger(DialogFragmentWithDate::class.java)
var eventTime = DateUtil.now()
var eventTimeChanged = false
//one shot guards
private var okClicked: Boolean = false
companion object {
private var seconds: Int = (Math.random() * 59.0).toInt()
}
override fun onStart() {
super.onStart()
dialog?.window?.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
override fun onSaveInstanceState(savedInstanceState: Bundle) {
super.onSaveInstanceState(savedInstanceState)
savedInstanceState.putLong("eventTime", eventTime)
savedInstanceState.putBoolean("eventTimeChanged", eventTimeChanged)
}
fun onCreateView() {
dialog?.window?.requestFeature(Window.FEATURE_NO_TITLE)
dialog?.window?.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN)
isCancelable = true
dialog?.setCanceledOnTouchOutside(false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
eventTime = savedInstanceState?.getLong("eventTime") ?: DateUtil.now()
eventTimeChanged = savedInstanceState?.getBoolean("eventTimeChanged") ?: false
overview_eventdate.text = DateUtil.dateString(eventTime)
overview_eventtime.text = DateUtil.timeString(eventTime)
// create an OnDateSetListener
val dateSetListener = DatePickerDialog.OnDateSetListener { _, year, monthOfYear, dayOfMonth ->
val cal = Calendar.getInstance()
cal.timeInMillis = eventTime
cal.set(Calendar.YEAR, year)
cal.set(Calendar.MONTH, monthOfYear)
cal.set(Calendar.DAY_OF_MONTH, dayOfMonth)
eventTime = cal.timeInMillis
eventTimeChanged = true
overview_eventdate.text = DateUtil.dateString(eventTime)
}
overview_eventdate.setOnClickListener {
context?.let {
val cal = Calendar.getInstance()
cal.timeInMillis = eventTime
DatePickerDialog(it, dateSetListener,
cal.get(Calendar.YEAR),
cal.get(Calendar.MONTH),
cal.get(Calendar.DAY_OF_MONTH)
).show()
}
}
// create an OnTimeSetListener
val timeSetListener = TimePickerDialog.OnTimeSetListener { _, hour, minute ->
val cal = Calendar.getInstance()
cal.timeInMillis = eventTime
cal.set(Calendar.HOUR_OF_DAY, hour)
cal.set(Calendar.MINUTE, minute)
cal.set(Calendar.SECOND, seconds++) // randomize seconds to prevent creating record of the same time, if user choose time manually
eventTime = cal.timeInMillis
eventTimeChanged = true
overview_eventtime.text = DateUtil.timeString(eventTime)
}
overview_eventtime.setOnClickListener {
context?.let {
val cal = Calendar.getInstance()
cal.timeInMillis = eventTime
TimePickerDialog(it, timeSetListener,
cal.get(Calendar.HOUR_OF_DAY),
cal.get(Calendar.MINUTE),
DateFormat.is24HourFormat(context)
).show()
}
}
ok.setOnClickListener {
synchronized(okClicked) {
if (okClicked) {
log.debug("guarding: ok already clicked")
} else {
okClicked = true
submit()
}
dismiss()
}
}
cancel.setOnClickListener { dismiss() }
}
abstract fun submit()
}

View file

@ -0,0 +1,87 @@
package info.nightscout.androidaps.plugins.general.overview.dialogs
import android.os.Bundle
import android.view.*
import android.widget.ArrayAdapter
import com.google.common.base.Joiner
import info.nightscout.androidaps.Constants
import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.HtmlHelper
import info.nightscout.androidaps.utils.OKDialog
import kotlinx.android.synthetic.main.okcancel.*
import kotlinx.android.synthetic.main.overview_profileswitch_dialog.*
import org.slf4j.LoggerFactory
import java.text.DecimalFormat
import java.util.*
class ProfileSwitchDialog : DialogFragmentWithDate() {
override fun onSaveInstanceState(savedInstanceState: Bundle) {
super.onSaveInstanceState(savedInstanceState)
savedInstanceState.putDouble("overview_profileswitch_duration", overview_profileswitch_duration.value)
savedInstanceState.putDouble("overview_profileswitch_percentage", overview_profileswitch_percentage.value)
savedInstanceState.putDouble("overview_profileswitch_timeshift", overview_profileswitch_timeshift.value)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?): View? {
onCreateView()
return inflater.inflate(R.layout.overview_profileswitch_dialog, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
overview_profileswitch_duration.setParams(savedInstanceState?.getDouble("overview_profileswitch_duration")
?: 0.0, 0.0, Constants.MAX_PROFILE_SWITCH_DURATION, 10.0, DecimalFormat("0"), false, ok)
overview_profileswitch_percentage.setParams(savedInstanceState?.getDouble("overview_profileswitch_percentage")
?: 100.0, Constants.CPP_MIN_PERCENTAGE.toDouble(), Constants.CPP_MAX_PERCENTAGE.toDouble(), 1.0, DecimalFormat("0"), false, ok)
overview_profileswitch_timeshift.setParams(savedInstanceState?.getDouble("overview_profileswitch_timeshift")
?: 0.0, Constants.CPP_MIN_TIMESHIFT.toDouble(), Constants.CPP_MAX_TIMESHIFT.toDouble(), 1.0, DecimalFormat("0"), false, ok)
// profile
context?.let { context ->
val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile
?: return
val profileList = profileStore.getProfileList()
val adapter = ArrayAdapter(context, R.layout.spinner_centered, profileList)
overview_profileswitch_profile.adapter = adapter
// set selected to actual profile
for (p in profileList.indices)
if (profileList[p] == ProfileFunctions.getInstance().getProfileName(false))
overview_profileswitch_profile.setSelection(p)
} ?: return
}
override fun submit() {
val profileStore = ConfigBuilderPlugin.getPlugin().activeProfileInterface?.profile ?: return
val actions: LinkedList<String> = LinkedList()
val duration = overview_profileswitch_duration.value
if (duration > 0)
actions.add(MainApp.gs(R.string.duration) + ": " + MainApp.gs(R.string.format_hours, duration))
val profile = overview_profileswitch_profile.selectedItem.toString()
actions.add(MainApp.gs(R.string.profile).toString() + ": " + profile)
val percent = overview_profileswitch_percentage.value.toInt()
if (percent != 100)
actions.add(MainApp.gs(R.string.percent) + ": " + percent + "%")
val timeShift = overview_profileswitch_timeshift.value.toInt()
if (timeShift != 0)
actions.add(MainApp.gs(R.string.careportal_newnstreatment_timeshift_label) + ": " + MainApp.gs(R.string.format_hours, timeShift.toDouble()))
val notes = overview_profileswitch_notes.text.toString()
if (notes.isNotEmpty())
actions.add(MainApp.gs(R.string.careportal_newnstreatment_notes_label) + ": " + notes)
if (eventTimeChanged)
actions.add(MainApp.gs(R.string.time) + ": " + DateUtil.dateAndTimeString(eventTime))
activity?.let { activity ->
OKDialog.showConfirmation(activity, HtmlHelper.fromHtml(Joiner.on("<br/>").join(actions))) {
ProfileFunctions.doProfileSwitch(profileStore, profile, duration.toInt(), percent, timeShift, eventTime)
}
}
}
}

View file

@ -459,7 +459,7 @@ object SmsCommunicatorPlugin : PluginBase(PluginDescription()
val finalPercentage = percentage
messageToConfirm = AuthRequest(this, receivedSms, reply, passCode, object : SmsAction(list[pindex - 1] as String, finalPercentage) {
override fun run() {
ProfileFunctions.doProfileSwitch(store, list[pindex - 1] as String, 0, finalPercentage, 0)
ProfileFunctions.doProfileSwitch(store, list[pindex - 1] as String, 0, finalPercentage, 0, DateUtil.now())
sendSMS(Sms(receivedSms.phoneNumber, R.string.profileswitchcreated))
}
})

View file

@ -16,8 +16,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.data.Profile
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.configBuilder.ConfigBuilderPlugin
import info.nightscout.androidaps.plugins.general.careportal.CareportalFragment
import info.nightscout.androidaps.plugins.general.careportal.Dialogs.NewNSTreatmentDialog
import info.nightscout.androidaps.plugins.general.overview.dialogs.ProfileSwitchDialog
import info.nightscout.androidaps.plugins.insulin.InsulinOrefBasePlugin.MIN_DIA
import info.nightscout.androidaps.plugins.profile.local.events.EventLocalProfileChanged
import info.nightscout.androidaps.utils.*
@ -170,11 +169,7 @@ class LocalProfileFragment : Fragment() {
localprofile_profileswitch.setOnClickListener {
// TODO: select in dialog LocalProfilePlugin.currentProfileIndex
val newDialog = NewNSTreatmentDialog()
val profileSwitch = CareportalFragment.PROFILESWITCHDIRECT
profileSwitch.executeProfileSwitch = true
newDialog.setOptions(profileSwitch, R.string.careportal_profileswitch)
fragmentManager?.let { newDialog.show(it, "NewNSTreatmentDialog") }
fragmentManager?.let { ProfileSwitchDialog().show(it, "NewNSTreatmentDialog") }
}
localprofile_reset.setOnClickListener {

View file

@ -12,6 +12,7 @@ import info.nightscout.androidaps.R
import info.nightscout.androidaps.plugins.bus.RxBus
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunctions
import info.nightscout.androidaps.plugins.profile.ns.events.EventNSProfileUpdateGUI
import info.nightscout.androidaps.utils.DateUtil
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.FabricPrivacy
import info.nightscout.androidaps.utils.OKDialog
@ -42,7 +43,7 @@ class NSProfileFragment : Fragment() {
OKDialog.showConfirmation(activity,
MainApp.gs(R.string.activate_profile) + ": " + name + " ?"
) {
ProfileFunctions.doProfileSwitch(store, name, 0, 100, 0)
ProfileFunctions.doProfileSwitch(store, name, 0, 100, 0, DateUtil.now())
}
}
}

View file

@ -30,6 +30,7 @@ import info.nightscout.androidaps.plugins.general.maintenance.ImportExportPrefs;
import info.nightscout.androidaps.plugins.general.nsclient.NSClientPlugin;
import info.nightscout.androidaps.plugins.general.nsclient.events.EventNSClientStatus;
import info.nightscout.androidaps.plugins.general.nsclient.services.NSClientService;
import info.nightscout.androidaps.plugins.general.overview.dialogs.ProfileSwitchDialog;
import info.nightscout.androidaps.plugins.profile.local.LocalProfileFragment;
import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin;
import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment;
@ -304,11 +305,7 @@ public class SWDefinition {
.add(new SWButton()
.text(R.string.doprofileswitch)
.action(() -> {
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
final OptionsToShow profileSwitch = CareportalFragment.PROFILESWITCHDIRECT;
profileSwitch.executeProfileSwitch = true;
newDialog.setOptions(profileSwitch, R.string.careportal_profileswitch);
newDialog.show(getActivity().getSupportFragmentManager(), "NewNSTreatmentDialog");
new ProfileSwitchDialog().show(getActivity().getSupportFragmentManager(), "SetupWizard");
}))
.validator(() -> ProfileFunctions.getInstance().getProfile() != null)
.visibility(() -> ProfileFunctions.getInstance().getProfile() == null);

View file

@ -5,9 +5,10 @@ import android.content.Context;
import android.content.DialogInterface;
import android.os.Handler;
import android.os.SystemClock;
import android.text.Spanned;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.ContextThemeWrapper;
import android.text.Spanned;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -69,14 +70,30 @@ public class OKDialog {
}
}
public static void showConfirmation(final Activity activity, String message, final Runnable runnable) {
AlertDialog alertDialog = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme))
public static void showConfirmation(final Activity activity, String message, final Runnable ok) {
showConfirmation(activity, message, ok, null);
}
public static void showConfirmation(final Activity activity, Spanned message, final Runnable ok) {
showConfirmation(activity, message, ok, null);
}
public static void showConfirmation(final Activity activity, Spanned message, final Runnable ok, final Runnable cancel) {
new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme))
.setMessage(message)
.setTitle(MainApp.gs(R.string.confirmation))
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
dialog.dismiss();
if (runnable != null) {
if (ok != null) {
SystemClock.sleep(100);
activity.runOnUiThread(runnable);
activity.runOnUiThread(ok);
}
})
.setNegativeButton(android.R.string.cancel, (dialog, which) -> {
dialog.dismiss();
if (cancel != null) {
SystemClock.sleep(100);
activity.runOnUiThread(cancel);
}
})
.setNegativeButton(android.R.string.cancel, null)
@ -84,8 +101,9 @@ public class OKDialog {
}
public static void showConfirmation(final Activity activity, String message, final Runnable ok, final Runnable cancel) {
AlertDialog alertDialog = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme))
new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme))
.setMessage(message)
.setTitle(MainApp.gs(R.string.confirmation))
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
dialog.dismiss();
if (ok != null) {

View file

@ -544,7 +544,7 @@
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
android:text="@string/careportal_newnstreatment_eventtime_label"
android:text="@string/event_time_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/event_time_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
android:text="@string/event_time_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<TextView
android:id="@+id/overview_eventdate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="10dp"
android:text="2017/05/05" />
<TextView
android:id="@+id/overview_eventtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:padding="10dp"
android:text="08:20pm" />
</LinearLayout>

View file

@ -0,0 +1,224 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true"
android:minWidth="300dp"
android:orientation="vertical"
android:padding="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_actions_profileswitch" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:text="@string/careportal_profileswitch"
android:textAlignment="center"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
android:text="@string/careportal_newnstreatment_duration_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<info.nightscout.androidaps.utils.NumberPicker
android:id="@+id/overview_profileswitch_duration"
android:layout_width="130dp"
android:layout_height="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:minWidth="45dp"
android:paddingLeft="5dp"
android:text="min"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
android:text="@string/careportal_newnstreatment_profile_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<Spinner
android:id="@+id/overview_profileswitch_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_gravity="center_vertical" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
android:text=""
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<Button
android:id="@+id/overview_profileswitch_reusebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/reuse" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:minWidth="45dp"
android:paddingLeft="5dp"
android:text=" "
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
android:text="@string/careportal_newnstreatment_percentage_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<info.nightscout.androidaps.utils.NumberPicker
android:id="@+id/overview_profileswitch_percentage"
android:layout_width="130dp"
android:layout_height="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:minWidth="45dp"
android:paddingLeft="5dp"
android:text="%"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
android:text="@string/careportal_newnstreatment_timeshift_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<info.nightscout.androidaps.utils.NumberPicker
android:id="@+id/overview_profileswitch_timeshift"
android:layout_width="130dp"
android:layout_height="40dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:minWidth="45dp"
android:paddingLeft="5dp"
android:text="h"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:width="120dp"
android:padding="10dp"
android:text="@string/careportal_newnstreatment_notes_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<EditText
android:id="@+id/overview_profileswitch_notes"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="180dp"
android:inputType="text" />
</LinearLayout>
<include layout="@layout/datetime" />
<include layout="@layout/okcancel" />
</LinearLayout>
</ScrollView>

View file

@ -238,7 +238,7 @@
<string name="careportal_newnstreatment_percent_label">Percent</string>
<string name="careportal_newnstreatment_absolute_label">Absolute</string>
<string name="careportal_newnstreatment_notes_label">Notes</string>
<string name="careportal_newnstreatment_eventtime_label">Event time</string>
<string name="event_time_label">Event time</string>
<string name="careportal_newnstreatment_profile_label">Profile</string>
<string name="careportal_newnstreatment_enteredby_title">Entered By</string>
<string name="careportal_newnstreatment_glucosetype">Glucose type</string>