- Added library for Wizard pages and all the classes for the integration.

- integration of Init Pod Wizard is done from visual point of view, now it just needs to be connected to driver
This commit is contained in:
Andy Rozman 2019-11-23 20:31:29 +00:00
parent c77cc018f0
commit 0749a7864c
19 changed files with 983 additions and 15 deletions

View file

@ -254,6 +254,8 @@ dependencies {
implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1" implementation "com.joanzapata.iconify:android-iconify-fontawesome:2.1.1"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar") implementation(name: "android-edittext-validator-v1.3.4-mod", ext: "aar")
implementation(name: "com.atech-software.android.library.wizardpager-1.1.0", ext: "aar")
implementation 'com.madgag.spongycastle:core:1.58.0.0' implementation 'com.madgag.spongycastle:core:1.58.0.0'
implementation("com.google.android:flexbox:0.3.0") { implementation("com.google.android:flexbox:0.3.0") {

View file

@ -308,6 +308,8 @@
<activity android:name=".plugins.pump.omnipod.dialogs.PodManagementActivity" /> <activity android:name=".plugins.pump.omnipod.dialogs.PodManagementActivity" />
<activity android:name=".plugins.pump.omnipod.dialogs.InitPodWizard" /> <activity android:name=".plugins.pump.omnipod.dialogs.InitPodWizard" />
<activity android:name="com.atech.android.library.wizardpager.WizardPagerActivity"
android:theme="@style/AppTheme.NoActionBar"/>
<uses-library <uses-library
android:name="org.apache.http.legacy" android:name="org.apache.http.legacy"

View file

@ -4,18 +4,20 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import info.nightscout.androidaps.R;
public enum PodInitActionType { public enum PodInitActionType {
PairAndPrimeWizardStep, // PairAndPrimeWizardStep(), //
PairPod(PairAndPrimeWizardStep), // PairPod(R.string.omnipod_init_pod_pair_pod, PairAndPrimeWizardStep), //
PrimePod(PairAndPrimeWizardStep), // PrimePod(R.string.omnipod_init_pod_prime_pod, PairAndPrimeWizardStep), //
FillCannulaSetBasalProfileWizardStep, FillCannulaSetBasalProfileWizardStep(),
FillCannula(FillCannulaSetBasalProfileWizardStep), FillCannula(R.string.omnipod_init_pod_fill_cannula, FillCannulaSetBasalProfileWizardStep),
SetBasalProfile(FillCannulaSetBasalProfileWizardStep); SetBasalProfile(R.string.omnipod_init_pod_set_basal_profile, FillCannulaSetBasalProfileWizardStep);
private int resourceId;
private PodInitActionType[] parent; private PodInitActionType parent;
private static Map<PodInitActionType, List<PodInitActionType>> stepsForWizardStep; private static Map<PodInitActionType, List<PodInitActionType>> stepsForWizardStep;
@ -26,13 +28,27 @@ public enum PodInitActionType {
} }
PodInitActionType() { PodInitActionType(int resourceId, PodInitActionType parent) {
this.resourceId = resourceId;
this.parent = parent;
} }
private PodInitActionType(PodInitActionType... parent) { PodInitActionType() {
this.parent = parent; }
public List<PodInitActionType> getChildren() {
List<PodInitActionType> outList = new ArrayList<>();
for (PodInitActionType value : values()) {
if (value.parent == this) {
outList.add(value);
}
}
return outList;
} }
@ -59,4 +75,8 @@ public enum PodInitActionType {
} }
public int getResourceId() {
return resourceId;
}
} }

View file

@ -1,9 +1,16 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs package info.nightscout.androidaps.plugins.pump.omnipod.dialogs
import android.content.Intent
import android.os.Bundle import android.os.Bundle
import com.atech.android.library.wizardpager.WizardPagerActivity
import com.atech.android.library.wizardpager.WizardPagerContext
import com.atech.android.library.wizardpager.data.WizardPagerSettings
import com.atech.android.library.wizardpager.defs.WizardStepsWayType
import info.nightscout.androidaps.MainApp import info.nightscout.androidaps.MainApp
import info.nightscout.androidaps.R import info.nightscout.androidaps.R
import info.nightscout.androidaps.activities.NoSplashActivity import info.nightscout.androidaps.activities.NoSplashActivity
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodCancelAction
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodWizardModel
import info.nightscout.androidaps.utils.OKDialog import info.nightscout.androidaps.utils.OKDialog
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.* import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
@ -34,8 +41,32 @@ class PodManagementActivity : NoSplashActivity() {
fun initPodAction() { fun initPodAction() {
OKDialog.showConfirmation(this,
MainApp.gs(R.string.omnipod_cmd_init_pod_na), null) // TODO check if RL is running
val pagerSettings = WizardPagerSettings()
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
pagerSettings.setFinishStringResourceId(R.string.close)
pagerSettings.setFinishButtonBackground(R.drawable.finish_background)
pagerSettings.setNextButtonBackground(R.drawable.selectable_item_background)
pagerSettings.setBackStringResourceId(R.string.cancel)
pagerSettings.setCancelAction(InitPodCancelAction())
pagerSettings.setTheme(R.style.AppTheme_NoActionBar)
WizardPagerContext.getInstance().pagerSettings = pagerSettings
WizardPagerContext.getInstance().wizardModel = InitPodWizardModel(applicationContext)
val myIntent = Intent(this@PodManagementActivity, WizardPagerActivity::class.java)
this@PodManagementActivity.startActivity(myIntent)
//OKDialog.showConfirmation(this,
// MainApp.gs(R.string.omnipod_cmd_init_pod_na), null)
} }
fun removePodAction() { fun removePodAction() {

View file

@ -0,0 +1,21 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod;
import com.atech.android.library.wizardpager.defs.action.AbstractCancelAction;
public class InitPodCancelAction extends AbstractCancelAction {
@Override
public void execute(String cancelReason) {
if (cancelReason != null && cancelReason.trim().length() > 0) {
this.cancelActionText = cancelReason;
}
if (this.cancelActionText.equals("Cancel")) {
// TODO
// remove pod from SP
// do refresh of tab
}
}
}

View file

@ -0,0 +1,11 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod;
import com.atech.android.library.wizardpager.defs.action.AbstractFinishAction;
public class InitPodFinishAction extends AbstractFinishAction {
@Override
public void execute() {
// TODO
// do refresh of tab
}
}

View file

@ -0,0 +1,71 @@
/*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod;
import android.content.Context;
import androidx.fragment.app.Fragment;
import com.atech.android.library.wizardpager.model.DisplayTextPage;
import com.tech.freak.wizardpager.model.AbstractWizardModel;
import com.tech.freak.wizardpager.model.PageList;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitActionPage;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodInfoFragment;
public class InitPodWizardModel extends AbstractWizardModel {
public InitPodWizardModel(Context context) {
super(context);
}
@Override
protected PageList onNewRootPageList() {
return new PageList(
new DisplayTextPage(this,
R.string.omnipod_init_pod_wizard_step1_title,
R.string.omnipod_init_pod_wizard_step1_desc,
R.style.WizardPagePodContent).setRequired(true).setCancelReason("None"),
new InitActionPage(this,
R.string.omnipod_init_pod_wizard_step2_title,
PodInitActionType.PairAndPrimeWizardStep
).setRequired(true).setCancelReason("Cancel"),
new DisplayTextPage(this,
R.string.omnipod_init_pod_wizard_step3_title,
R.string.omnipod_init_pod_wizard_step3_desc,
R.style.WizardPagePodContent).setRequired(true).setCancelReason("Cancel"),
new InitActionPage(this,
R.string.omnipod_init_pod_wizard_step4_title,
PodInitActionType.FillCannulaSetBasalProfileWizardStep
).setRequired(true).setCancelReason("Cancel")
);
}
public Fragment getReviewFragment() {
PodInfoFragment.isInitPod = true;
return new PodInfoFragment();
}
}

View file

@ -0,0 +1,202 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages;
import android.app.Activity;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.fragment.app.Fragment;
import com.atech.android.library.wizardpager.util.WizardPagesUtil;
import com.tech.freak.wizardpager.model.Page;
import com.tech.freak.wizardpager.ui.PageFragmentCallbacks;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
/**
* Created by TechFreak on 04/09/2014.
*/
public class InitActionFragment extends Fragment {
private static final String ARG_KEY = "key";
private PageFragmentCallbacks mCallbacks;
private String mKey;
private InitActionPage mPage;
ProgressBar progressBar;
TextView errorView;
PodInitActionType podInitActionType;
List<PodInitActionType> children;
Map<PodInitActionType, CheckBox> mapCheckBoxes;
public static InitActionFragment create(String key, PodInitActionType podInitActionType) {
Bundle args = new Bundle();
args.putString(ARG_KEY, key);
InitActionFragment fragment = new InitActionFragment();
fragment.setArguments(args);
fragment.setPodInitActionType(podInitActionType);
return fragment;
}
public InitActionFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
mKey = args.getString(ARG_KEY);
mPage = (InitActionPage) mCallbacks.onGetPage(mKey);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.omnipod_initpod_init_action, container, false);
WizardPagesUtil.setTitle(mPage, rootView);
this.progressBar = rootView.findViewById(R.id.initAction_progressBar);
this.errorView = rootView.findViewById(R.id.initAction_textErrorMessage);
TextView headerView = rootView.findViewById(R.id.initAction_header);
LinearLayout linearLayout = rootView.findViewById(R.id.initAction_ItemsHolder);
children = podInitActionType.getChildren();
mapCheckBoxes = new HashMap<>();
for (PodInitActionType child : children) {
CheckBox checkBox1 = new CheckBox(getContext());
checkBox1.setText(child.getResourceId());
checkBox1.setClickable(false);
checkBox1.setTextAppearance(R.style.WizardPagePodListItem);
checkBox1.setHeight(140);
checkBox1.setTextSize(16);
checkBox1.setTextColor(headerView.getTextColors().getDefaultColor());
linearLayout.addView(checkBox1);
mapCheckBoxes.put(child, checkBox1);
}
return rootView;
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (!(activity instanceof PageFragmentCallbacks)) {
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
}
mCallbacks = (PageFragmentCallbacks) activity;
}
@Override
public void onDetach() {
super.onDetach();
mCallbacks = null;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
@Override
public void setMenuVisibility(boolean menuVisible) {
super.setMenuVisibility(menuVisible);
// In a future update to the support library, this should override setUserVisibleHint
// instead of setMenuVisibility.
}
public PodInitActionType getPodInitActionType() {
return podInitActionType;
}
public void setPodInitActionType(PodInitActionType podInitActionType) {
this.podInitActionType = podInitActionType;
}
@Override
public void setUserVisibleHint(boolean isVisibleToUser) {
super.setUserVisibleHint(isVisibleToUser);
System.out.println("ACTION: setUserVisibleHint="+ isVisibleToUser);
if (isVisibleToUser) {
System.out.println("ACTION: Visible");
new AsyncTask<Void, Void, String>() {
protected void onPreExecute() {
//progressBar.setVisibility(View.VISIBLE);
}
;
@Override
protected String doInBackground(Void... params) {
System.out.println("ACTION: doInBackground Started: ");
SystemClock.sleep(5000);
mPage.setActionCompleted(true);
System.out.println("ACTION: doInBackground Finished: ");
return "Test";
}
@Override
protected void onPostExecute(String result) {
super.onPostExecute(result);
System.out.println("ACTION: onPostExecute: " + result);
boolean isOk = false;
for (PodInitActionType actionType : mapCheckBoxes.keySet()) {
mapCheckBoxes.get(actionType).setChecked(true);
mapCheckBoxes.get(actionType).setTextColor(isOk ? Color.rgb(34, 135, 91) : Color.rgb(168, 36, 15));
}
progressBar.setVisibility(View.GONE);
if (!isOk) {
errorView.setVisibility(View.VISIBLE);
errorView.setText("Error containg pod.");
}
mPage.getData().putString(Page.SIMPLE_DATA_KEY, "ddd");
mPage.notifyDataChanged();
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
System.out.println("ACTION: Not visible");
}
}
}

View file

@ -0,0 +1,72 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages;
import androidx.annotation.StringRes;
import androidx.fragment.app.Fragment;
import com.tech.freak.wizardpager.model.ModelCallbacks;
import com.tech.freak.wizardpager.model.Page;
import com.tech.freak.wizardpager.model.ReviewItem;
import java.util.ArrayList;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
/**
* A page asking for a name and an email.
*/
public class InitActionPage extends Page {
private PodInitActionType podInitActionType;
private boolean actionCompleted = false;
private boolean actionSuccess = false;
public InitActionPage(ModelCallbacks callbacks, String title) {
super(callbacks, title);
}
public InitActionPage(ModelCallbacks callbacks, @StringRes int titleId, PodInitActionType podInitActionType) {
super(callbacks, titleId);
this.podInitActionType = podInitActionType;
}
@Override
public Fragment createFragment() {
return InitActionFragment.create(getKey(), this.podInitActionType);
}
@Override
public void getReviewItems(ArrayList<ReviewItem> dest) {
}
@Override
public boolean isCompleted() {
System.out.println("ACTION: Page.isCompleted " + actionCompleted);
return actionCompleted;
}
public void setActionCompleted(boolean success) {
this.actionCompleted = true;
this.actionSuccess = success;
}
/**
* This is used just if we want to override default behavior (for example when we enter Page we want prevent any action, until something happens.
*
* @return
*/
public boolean isBackActionPossible() {
return actionCompleted;
}
/**
* This is used just if we want to override default behavior (for example when we enter Page we want prevent any action, until something happens.
*
* @return
*/
public boolean isNextActionPossible() {
return actionSuccess;
}
}

View file

@ -0,0 +1,200 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.ListFragment;
import com.tech.freak.wizardpager.model.ModelCallbacks;
import com.tech.freak.wizardpager.model.Page;
import com.tech.freak.wizardpager.model.ReviewItem;
import com.tech.freak.wizardpager.ui.PageFragmentCallbacks;
import com.tech.freak.wizardpager.ui.ReviewFragment;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.FirmwareVersion;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
public class PodInfoFragment extends Fragment {
private static final String ARG_KEY = "key";
private PageFragmentCallbacks mCallbacks;
private String mKey;
private PodInfoPage mPage;
public static boolean isInitPod = false;
private ArrayList<ReviewItem> mCurrentReviewItems;
public static PodInfoFragment create(String key, boolean initPod) {
Bundle args = new Bundle();
args.putString(ARG_KEY, key);
isInitPod = initPod;
PodInfoFragment fragment = new PodInfoFragment();
fragment.setArguments(args);
return fragment;
}
public PodInfoFragment() {
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.omnipod_initpod_pod_info, container, false);
TextView titleView = (TextView) rootView.findViewById(R.id.podInfoTitle);
titleView.setText(R.string.omnipod_init_pod_wizard_pod_info_title);
titleView.setTextColor(getResources().getColor(com.tech.freak.wizardpager.R.color.review_green));
TextView headerText = rootView.findViewById(R.id.podInfoText);
headerText.setText(isInitPod ? //
R.string.omnipod_init_pod_wizard_pod_info_init_pod_description : //
R.string.omnipod_init_pod_wizard_pod_info_remove_pod_description);
if (isInitPod) {
createDataOfPod();
ListView listView = (ListView) rootView.findViewById(R.id.podInfoList);
listView.setAdapter(new PodInfoAdapter(mCurrentReviewItems, getContext()));
listView.setChoiceMode(ListView.CHOICE_MODE_NONE);
}
return rootView;
}
private void createDataOfPod() {
// TODO
PodSessionState podSessionState = new PodSessionState(DateTimeZone.UTC,
483748738,
new DateTime(),
new FirmwareVersion(1,0,0),
new FirmwareVersion(1,0,0),
574875,
5487584,
1,
1
);
mCurrentReviewItems = new ArrayList<>();
mCurrentReviewItems.add(new ReviewItem("Pod Address", "" + podSessionState.getAddress(), "33"));
mCurrentReviewItems.add(new ReviewItem("Activated At", podSessionState.getActivatedAt().toString("dd.MM.yyyy HH:mm:ss"), "34"));
mCurrentReviewItems.add(new ReviewItem("Firmware Version", podSessionState.getPiVersion().toString(), "35"));
mCurrentReviewItems.add(new ReviewItem("LOT", "" + podSessionState.getLot(), "36"));
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (!(activity instanceof PageFragmentCallbacks)) {
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
}
mCallbacks = (PageFragmentCallbacks) activity;
}
@Override
public void onDetach() {
super.onDetach();
mCallbacks = null;
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
}
private class PodInfoAdapter extends ArrayAdapter<ReviewItem> {
private ArrayList<ReviewItem> dataSet;
Context mContext;
// View lookup cache
public PodInfoAdapter(ArrayList<ReviewItem> data, Context context) {
super(context, com.tech.freak.wizardpager.R.layout.list_item_review, data);
this.dataSet = data;
this.mContext=context;
}
private int lastPosition = -1;
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// Get the data item for this position
ReviewItem dataModel = getItem(position);
// Check if an existing view is being reused, otherwise inflate the view
ViewHolder viewHolder; // view lookup cache stored in tag
final View result;
if (convertView == null) {
viewHolder = new ViewHolder();
LayoutInflater inflater = LayoutInflater.from(getContext());
convertView = inflater.inflate(R.layout.omnipod_initpod_pod_info_item, parent, false);
viewHolder.txtName = (TextView) convertView.findViewById(android.R.id.text1);
viewHolder.txtType = (TextView) convertView.findViewById(android.R.id.text2);
result=convertView;
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
result=convertView;
}
viewHolder.txtName.setText(dataModel.getTitle());
viewHolder.txtType.setText(dataModel.getDisplayValue());
// Return the completed view to render on screen
return convertView;
}
}
private static class ViewHolder {
TextView txtName;
TextView txtType;
}
}

View file

@ -0,0 +1,36 @@
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages;
import androidx.fragment.app.Fragment;
import com.tech.freak.wizardpager.model.ModelCallbacks;
import com.tech.freak.wizardpager.model.Page;
import com.tech.freak.wizardpager.model.ReviewItem;
import java.util.ArrayList;
/**
* A page asking for a name and an email.
*/
public class PodInfoPage extends Page {
public static final String NAME_DATA_KEY = "name";
public static final String EMAIL_DATA_KEY = "email";
public PodInfoPage(ModelCallbacks callbacks, String title) {
super(callbacks, title);
}
@Override
public Fragment createFragment() {
return PodInfoFragment.create(getKey(), true);
}
@Override
public void getReviewItems(ArrayList<ReviewItem> dest) {
}
@Override
public boolean isCompleted() {
return true;
}
}

View file

@ -0,0 +1,75 @@
/*
* Copyright 2012 Roman Nurik
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.removepod;
import android.content.Context;
import androidx.fragment.app.Fragment;
import com.atech.android.library.wizardpager.model.DisplayTextPage;
import com.atech.android.library.wizardpager.ui.DisplayTextFragment;
import com.tech.freak.wizardpager.model.AbstractWizardModel;
import com.tech.freak.wizardpager.model.PageList;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitActionPage;
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodInfoFragment;
public class RemovePodWizardModel extends AbstractWizardModel {
public RemovePodWizardModel(Context context) {
super(context);
}
@Override
protected PageList onNewRootPageList() {
// TODO
return new PageList(
new DisplayTextPage(this,
R.string.omnipod_init_pod_wizard_step1_title,
R.string.omnipod_init_pod_wizard_step1_desc,
R.style.WizardPagePodContent).setRequired(true).setCancelReason("None"),
new InitActionPage(this,
R.string.omnipod_init_pod_wizard_step2_title,
PodInitActionType.PairAndPrimeWizardStep
).setRequired(true).setCancelReason("Cancel"),
new DisplayTextPage(this,
R.string.omnipod_init_pod_wizard_step3_title,
R.string.omnipod_init_pod_wizard_step3_desc,
R.style.WizardPagePodContent).setRequired(true).setCancelReason("Cancel"),
new InitActionPage(this,
R.string.omnipod_init_pod_wizard_step4_title,
PodInitActionType.FillCannulaSetBasalProfileWizardStep).setRequired(true).setCancelReason("Cancel")
//new PodInfoPage(this, "Pod Info").setRequired(true)
);
}
public Fragment getReviewFragment() {
// TODO
PodInfoFragment.isInitPod = false;
return DisplayTextFragment.create(null, 0, 0);
}
}

View file

@ -0,0 +1,74 @@
<!--
Copyright 2012 Roman Nurik
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/WizardPageContainer"
android:orientation="vertical">
<TextView style="@style/WizardPageTitle" />
<TextView
android:id="@+id/initAction_header"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="40dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
style="@style/WizardPagePodContent"
android:text="@string/omnipod_init_pod_wizard_step2_action_header" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginLeft="70dp"
android:layout_marginRight="70dp"
android:layout_weight="1">
<LinearLayout
android:id="@+id/initAction_ItemsHolder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/initAction_textErrorMessage"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
style="@style/WizardPagePodContent"
android:visibility="gone" />
<ProgressBar
android:id="@+id/initAction_progressBar"
android:layout_width="match_parent"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
android:layout_height="80dp" />
<TextView
android:id="@+id/initAction_footer"
android:layout_width="match_parent"
android:layout_height="30dp" />
</LinearLayout>

View file

@ -0,0 +1,56 @@
<!--
Copyright 2012 Roman Nurik
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/WizardPageContainer"
android:orientation="vertical">
<TextView
android:id="@+id/podInfoTitle"
style="@style/WizardPageTitle" />
<TextView
android:id="@+id/podInfoText"
android:layout_width="match_parent"
android:layout_height="150dp"
android:layout_marginTop="20dp"
android:layout_marginBottom="40dp"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
style="@style/WizardPagePodContent"
/>
<LinearLayout
style="@style/ButtonBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ListView android:id="@+id/podInfoList"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:saveEnabled="false"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"
style="@style/PodInfoListView"
android:listSelector="@color/ribbonWarning"
android:scrollbarStyle="outsideInset" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,45 @@
<!--
Copyright 2012 Roman Nurik
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="@dimen/list_item_height_small"
android:orientation="horizontal"
android:baselineAligned="true"
android:paddingLeft="@dimen/list_item_padding_left"
android:paddingRight="@dimen/list_item_padding_right"
android:paddingTop="12dp"
android:paddingBottom="12dp">
<TextView android:id="@android:id/text1"
style="?android:textAppearanceSmall"
android:textColor="@color/text_light"
android:textAllCaps="false"
android:textStyle="bold"
android:ellipsize="end"
android:layout_width="100sp"
android:layout_height="wrap_content"
android:layout_marginRight="16dp" />
<TextView android:id="@android:id/text2"
style="?android:textAppearanceMedium"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/design_default_color_primary_dark"
android:layout_weight="1" />
</LinearLayout>

View file

@ -104,7 +104,7 @@
android:layout_marginBottom="3dp" android:layout_marginBottom="3dp"
android:textAllCaps="false" android:textAllCaps="false"
android:layout_weight="0.5" android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cp_pump_canula" android:drawableTop="@drawable/icon_danarhistory"
android:text="@string/omnipod_cmd_pod_history" /> android:text="@string/omnipod_cmd_pod_history" />

View file

@ -1661,6 +1661,23 @@
<string name="omnipod_namexxx" translatable="false">Omnipod</string> <string name="omnipod_namexxx" translatable="false">Omnipod</string>
<string name="omnipod_init_pod_wizard_step1_title">Fill the Pod</string>
<string name="omnipod_init_pod_wizard_step1_desc">\nFill new Pod with Insulin.\n\n\nAfter filling Pod, listen for 2 beeps, then press "Next".\n\n\n<b>Note:</b> Do not remove needle cap at this time.</string>
<string name="omnipod_init_pod_wizard_step2_title">Pair and Prime the Pod</string>
<string name="omnipod_init_pod_wizard_step2_action_header">We are trying to communicate with Pod.\n\nWhen all items are checked, you can press Next. If you decide to Cancel, you will have to discard the Pod.</string>
<string name="omnipod_init_pod_wizard_step3_title">Attach the Pod</string>
<string name="omnipod_init_pod_wizard_step3_desc">\nPrepare infusion site. Remove Pods needle cap.\n\nIf cannula sticks out press <b>Cancel</b> (Pod will need to be discarded).\n\nPress <b>Next</b> to insert cannula and begin Basal Delivery.</string>
<string name="omnipod_init_pod_wizard_step4_title">Fill Cannula and Start Basal delivery</string>
<string name="omnipod_init_pod_wizard_pod_info_title">Pod Info</string>
<string name="omnipod_init_pod_wizard_pod_info_init_pod_description">Pod is now active.\n\nBasal has been programmed.\n\nCheck infusion site and cannula. If cannula seems incorrectly inserted, please replace the Pod.</string>
<string name="omnipod_init_pod_wizard_pod_info_remove_pod_description">Pod Info</string>
<string name="omnipod_init_pod_pair_pod">Pair Pod</string>
<string name="omnipod_init_pod_prime_pod">Prime Pod</string>
<string name="omnipod_init_pod_fill_cannula">Fill Cannula</string>
<string name="omnipod_init_pod_set_basal_profile">Set Basal Profile</string>
<!-- Omnipod Dash --> <!-- Omnipod Dash -->
<!-- Omnipod - Base --> <!-- Omnipod - Base -->

View file

@ -49,4 +49,37 @@
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="WizardPagePodContent">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">8dp</item>
<item name="android:paddingLeft">20px</item>
<item name="android:paddingRight">20px</item>
<item name="android:textSize">18sp</item>
<!-- <item name="android:textColor">?android:textColorPrimary</item> -->
</style>
<style name="WizardPagePodListItem">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">20dp</item>
<item name="android:layout_marginTop">20dp</item>
<item name="android:paddingTop">20px</item>
<item name="android:paddingBottom">20px</item>
<item name="android:paddingLeft">60px</item>
<item name="android:paddingRight">60px</item>
<item name="android:textSize">18sp</item>
<!-- <item name="android:textColor">#000000</item> -->
</style>
<style name="PodInfoListView" parent="@android:style/Widget.ListView">
<item name="android:background">@color/colorLightGray</item>
<item name="android:cacheColorHint">@android:color/transparent</item>
<item name="android:divider">@android:color/black</item>
<item name="android:dividerHeight">1dp</item>
</style>
</resources> </resources>