Temporary workaround for pod activation and deactivation wizard crashes on rotation
This commit is contained in:
parent
159c1f941d
commit
c56bc5ae61
9 changed files with 82 additions and 120 deletions
|
@ -5,7 +5,6 @@ import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
import info.nightscout.androidaps.plugins.pump.common.data.TempBasalPair;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
import info.nightscout.androidaps.plugins.pump.omnipod.comm.message.response.podinfo.PodInfoRecentPulseLog;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
|
||||||
|
|
||||||
public interface OmnipodCommunicationManagerInterface {
|
public interface OmnipodCommunicationManagerInterface {
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dialogs
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import androidx.fragment.app.FragmentStatePagerAdapter
|
||||||
import com.atech.android.library.wizardpager.WizardPagerActivity
|
import com.atech.android.library.wizardpager.WizardPagerActivity
|
||||||
import com.atech.android.library.wizardpager.WizardPagerContext
|
import com.atech.android.library.wizardpager.WizardPagerContext
|
||||||
import com.atech.android.library.wizardpager.data.WizardPagerSettings
|
import com.atech.android.library.wizardpager.data.WizardPagerSettings
|
||||||
|
@ -97,6 +98,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
pagerSettings.setBackStringResourceId(R.string.cancel)
|
pagerSettings.setBackStringResourceId(R.string.cancel)
|
||||||
pagerSettings.cancelAction = refreshAction
|
pagerSettings.cancelAction = refreshAction
|
||||||
pagerSettings.finishAction = refreshAction
|
pagerSettings.finishAction = refreshAction
|
||||||
|
pagerSettings.pagerAdapterBehavior = FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
||||||
|
|
||||||
val wizardPagerContext = WizardPagerContext.getInstance()
|
val wizardPagerContext = WizardPagerContext.getInstance()
|
||||||
|
|
||||||
|
@ -124,6 +126,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
pagerSettings.setBackStringResourceId(R.string.cancel)
|
pagerSettings.setBackStringResourceId(R.string.cancel)
|
||||||
pagerSettings.cancelAction = refreshAction
|
pagerSettings.cancelAction = refreshAction
|
||||||
pagerSettings.finishAction = refreshAction
|
pagerSettings.finishAction = refreshAction
|
||||||
|
pagerSettings.pagerAdapterBehavior = FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT
|
||||||
|
|
||||||
val wizardPagerContext = WizardPagerContext.getInstance();
|
val wizardPagerContext = WizardPagerContext.getInstance();
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod;
|
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.annotation.SuppressLint;
|
||||||
|
import android.content.Context;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -13,7 +15,7 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.atech.android.library.wizardpager.util.WizardPagesUtil;
|
import com.atech.android.library.wizardpager.util.WizardPagesUtil;
|
||||||
import com.tech.freak.wizardpager.model.Page;
|
import com.tech.freak.wizardpager.model.Page;
|
||||||
|
@ -30,7 +32,6 @@ import dagger.android.HasAndroidInjector;
|
||||||
import dagger.android.support.DaggerFragment;
|
import dagger.android.support.DaggerFragment;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||||
import info.nightscout.androidaps.plugins.configBuilder.ProfileFunction;
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitActionType;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||||
|
|
||||||
|
@ -38,7 +39,10 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.PodInitReceiver;
|
||||||
* Created by andy on 12/11/2019
|
* Created by andy on 12/11/2019
|
||||||
*/
|
*/
|
||||||
public class InitActionFragment extends DaggerFragment implements PodInitReceiver {
|
public class InitActionFragment extends DaggerFragment implements PodInitReceiver {
|
||||||
private static final String ARG_KEY = "key";
|
protected static final String ARG_KEY = "key";
|
||||||
|
protected static final String ARG_POD_INIT_ACTION_TYPE = "podInitActionType";
|
||||||
|
|
||||||
|
private static boolean isFirstView;
|
||||||
|
|
||||||
protected PageFragmentCallbacks mCallbacks;
|
protected PageFragmentCallbacks mCallbacks;
|
||||||
protected String mKey;
|
protected String mKey;
|
||||||
|
@ -51,39 +55,42 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
|
||||||
protected PodInitActionType podInitActionType;
|
protected PodInitActionType podInitActionType;
|
||||||
protected List<PodInitActionType> children;
|
protected List<PodInitActionType> children;
|
||||||
protected Map<PodInitActionType, CheckBox> mapCheckBoxes;
|
protected Map<PodInitActionType, CheckBox> mapCheckBoxes;
|
||||||
protected InitActionFragment instance;
|
|
||||||
|
|
||||||
protected PumpEnactResult callResult;
|
protected PumpEnactResult callResult;
|
||||||
|
|
||||||
@Inject HasAndroidInjector injector;
|
@Inject HasAndroidInjector injector;
|
||||||
|
|
||||||
|
|
||||||
public static InitActionFragment create(String key, PodInitActionType podInitActionType) {
|
public static InitActionFragment create(String key, PodInitActionType podInitActionType) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(ARG_KEY, key);
|
args.putString(ARG_KEY, key);
|
||||||
|
args.putSerializable(ARG_POD_INIT_ACTION_TYPE, podInitActionType);
|
||||||
|
|
||||||
InitActionFragment fragment = new InitActionFragment();
|
InitActionFragment fragment = new InitActionFragment();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
fragment.setPodInitActionType(podInitActionType);
|
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InitActionFragment() {
|
@SuppressLint("SourceLockedOrientationActivity")
|
||||||
this.instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
if (savedInstanceState == null) {
|
||||||
|
isFirstView = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
|
||||||
Bundle args = getArguments();
|
Bundle args = getArguments();
|
||||||
mKey = args.getString(ARG_KEY);
|
mKey = args.getString(ARG_KEY);
|
||||||
|
podInitActionType = (PodInitActionType) args.getSerializable(ARG_POD_INIT_ACTION_TYPE);
|
||||||
mPage = (InitActionPage) mCallbacks.onGetPage(mKey);
|
mPage = (InitActionPage) mCallbacks.onGetPage(mKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
super.onCreateView(inflater, container, savedInstanceState);
|
||||||
|
|
||||||
View rootView = inflater.inflate(R.layout.omnipod_initpod_init_action, container, false);
|
View rootView = inflater.inflate(R.layout.omnipod_initpod_init_action, container, false);
|
||||||
WizardPagesUtil.setTitle(mPage, rootView);
|
WizardPagesUtil.setTitle(mPage, rootView);
|
||||||
|
|
||||||
|
@ -98,7 +105,6 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
|
||||||
mapCheckBoxes = new HashMap<>();
|
mapCheckBoxes = new HashMap<>();
|
||||||
|
|
||||||
for (PodInitActionType child : children) {
|
for (PodInitActionType child : children) {
|
||||||
|
|
||||||
CheckBox checkBox1 = new CheckBox(getContext());
|
CheckBox checkBox1 = new CheckBox(getContext());
|
||||||
checkBox1.setText(child.getResourceId());
|
checkBox1.setText(child.getResourceId());
|
||||||
checkBox1.setClickable(false);
|
checkBox1.setClickable(false);
|
||||||
|
@ -129,15 +135,17 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
new InitPodTask(injector, instance).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new InitPodTask(injector, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
});
|
});
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(activity);
|
super.onAttach(context);
|
||||||
|
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
|
|
||||||
if (!(activity instanceof PageFragmentCallbacks)) {
|
if (!(activity instanceof PageFragmentCallbacks)) {
|
||||||
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
|
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
|
||||||
|
@ -152,46 +160,16 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
|
||||||
mCallbacks = null;
|
mCallbacks = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public PodInitActionType getPodInitActionType() {
|
|
||||||
return podInitActionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void setPodInitActionType(PodInitActionType podInitActionType) {
|
|
||||||
this.podInitActionType = podInitActionType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
public void onResume() {
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
super.onResume();
|
||||||
//System.out.println("ACTION: setUserVisibleHint="+ isVisibleToUser);
|
if (isFirstView) {
|
||||||
if (isVisibleToUser) {
|
isFirstView = false;
|
||||||
//System.out.println("ACTION: Visible");
|
|
||||||
new InitPodTask(injector, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
new InitPodTask(injector, this).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
|
||||||
|
|
||||||
} else {
|
|
||||||
System.out.println("ACTION: Not visible");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionOnReceiveResponse(String result) {
|
public void actionOnReceiveResponse(String result) {
|
||||||
// System.out.println("ACTION: actionOnReceiveResponse: " + result);
|
|
||||||
//
|
|
||||||
// boolean isOk = callResult.success;
|
|
||||||
//
|
|
||||||
// progressBar.setVisibility(View.GONE);
|
|
||||||
//
|
|
||||||
// if (!isOk) {
|
|
||||||
// errorView.setVisibility(View.VISIBLE);
|
|
||||||
// errorView.setText(callResult.comment);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// mPage.setActionCompleted(isOk);
|
|
||||||
//
|
|
||||||
// mPage.getData().putString(Page.SIMPLE_DATA_KEY, "ddd");
|
|
||||||
// mPage.notifyDataChanged();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -209,11 +187,10 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void processOnFinishedActions(boolean isOk, String errorMessage) {
|
private void processOnFinishedActions(boolean isOk, String errorMessage) {
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
getActivity().runOnUiThread(() -> {
|
if (activity != null) {
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
progressBar.setVisibility(View.GONE);
|
progressBar.setVisibility(View.GONE);
|
||||||
|
|
||||||
if (!isOk) {
|
if (!isOk) {
|
||||||
|
@ -229,17 +206,18 @@ public class InitActionFragment extends DaggerFragment implements PodInitReceive
|
||||||
mPage.notifyDataChanged();
|
mPage.notifyDataChanged();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setCheckBox(PodInitActionType podInitActionType, boolean isSuccess) {
|
public void setCheckBox(PodInitActionType podInitActionType, boolean isSuccess) {
|
||||||
getActivity().runOnUiThread(() -> {
|
FragmentActivity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
activity.runOnUiThread(() -> {
|
||||||
mapCheckBoxes.get(podInitActionType).setChecked(isSuccess);
|
mapCheckBoxes.get(podInitActionType).setChecked(isSuccess);
|
||||||
mapCheckBoxes.get(podInitActionType).setTextColor(isSuccess ? Color.rgb(34, 135, 91) :
|
mapCheckBoxes.get(podInitActionType).setTextColor(isSuccess ? Color.rgb(34, 135, 91) :
|
||||||
Color.rgb(168, 36, 15));
|
Color.rgb(168, 36, 15));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod;
|
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod;
|
||||||
|
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
@ -24,7 +23,9 @@ public class InitPodTask extends AsyncTask<Void, Void, String> {
|
||||||
this.initActionFragment = initActionFragment;
|
this.initActionFragment = initActionFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected void onPreExecute() {
|
protected void onPreExecute() {
|
||||||
|
super.onPreExecute();
|
||||||
initActionFragment.progressBar.setVisibility(View.VISIBLE);
|
initActionFragment.progressBar.setVisibility(View.VISIBLE);
|
||||||
initActionFragment.errorView.setVisibility(View.GONE);
|
initActionFragment.errorView.setVisibility(View.GONE);
|
||||||
initActionFragment.retryButton.setVisibility(View.GONE);
|
initActionFragment.retryButton.setVisibility(View.GONE);
|
||||||
|
@ -32,21 +33,20 @@ public class InitPodTask extends AsyncTask<Void, Void, String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String doInBackground(Void... params) {
|
protected String doInBackground(Void... params) {
|
||||||
|
|
||||||
if (initActionFragment.podInitActionType == PodInitActionType.PairAndPrimeWizardStep) {
|
if (initActionFragment.podInitActionType == PodInitActionType.PairAndPrimeWizardStep) {
|
||||||
initActionFragment.callResult = AapsOmnipodManager.getInstance().initPod(
|
initActionFragment.callResult = AapsOmnipodManager.getInstance().initPod(
|
||||||
initActionFragment.podInitActionType,
|
initActionFragment.podInitActionType,
|
||||||
initActionFragment.instance,
|
initActionFragment,
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
} else if (initActionFragment.podInitActionType == PodInitActionType.FillCannulaSetBasalProfileWizardStep) {
|
} else if (initActionFragment.podInitActionType == PodInitActionType.FillCannulaSetBasalProfileWizardStep) {
|
||||||
initActionFragment.callResult = AapsOmnipodManager.getInstance().initPod(
|
initActionFragment.callResult = AapsOmnipodManager.getInstance().initPod(
|
||||||
initActionFragment.podInitActionType,
|
initActionFragment.podInitActionType,
|
||||||
initActionFragment.instance,
|
initActionFragment,
|
||||||
profileFunction.getProfile()
|
profileFunction.getProfile()
|
||||||
);
|
);
|
||||||
} else if (initActionFragment.podInitActionType == PodInitActionType.DeactivatePodWizardStep) {
|
} else if (initActionFragment.podInitActionType == PodInitActionType.DeactivatePodWizardStep) {
|
||||||
initActionFragment.callResult = AapsOmnipodManager.getInstance().deactivatePod(initActionFragment.instance);
|
initActionFragment.callResult = AapsOmnipodManager.getInstance().deactivatePod(initActionFragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "OK";
|
return "OK";
|
||||||
|
@ -59,5 +59,4 @@ public class InitPodTask extends AsyncTask<Void, Void, String> {
|
||||||
initActionFragment.actionOnReceiveResponse(result);
|
initActionFragment.actionOnReceiveResponse(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,6 @@ public abstract class InitPodWizardModel extends AbstractWizardModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Fragment getReviewFragment() {
|
public Fragment getReviewFragment() {
|
||||||
PodInfoFragment.isInitPod = true;
|
return PodInfoFragment.create("initPodInfoFragment", true);
|
||||||
return new PodInfoFragment();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,7 @@ public class RemovePodWizardModel extends AbstractWizardModel {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PageList onNewRootPageList() {
|
protected PageList onNewRootPageList() {
|
||||||
|
|
||||||
return new PageList(
|
return new PageList(
|
||||||
|
|
||||||
new DisplayTextPage(this,
|
new DisplayTextPage(this,
|
||||||
R.string.omnipod_remove_pod_wizard_step1_title,
|
R.string.omnipod_remove_pod_wizard_step1_title,
|
||||||
R.string.omnipod_remove_pod_wizard_step1_desc,
|
R.string.omnipod_remove_pod_wizard_step1_desc,
|
||||||
|
@ -56,11 +54,8 @@ public class RemovePodWizardModel extends AbstractWizardModel {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Fragment getReviewFragment() {
|
public Fragment getReviewFragment() {
|
||||||
PodInfoFragment.isInitPod = false;
|
return PodInfoFragment.create("removePodInfoFragment", false);
|
||||||
return new PodInfoFragment();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages;
|
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -10,6 +11,8 @@ import android.widget.ArrayAdapter;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.tech.freak.wizardpager.model.ReviewItem;
|
import com.tech.freak.wizardpager.model.ReviewItem;
|
||||||
import com.tech.freak.wizardpager.ui.PageFragmentCallbacks;
|
import com.tech.freak.wizardpager.ui.PageFragmentCallbacks;
|
||||||
|
|
||||||
|
@ -28,32 +31,35 @@ import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
*/
|
*/
|
||||||
public class PodInfoFragment extends DaggerFragment {
|
public class PodInfoFragment extends DaggerFragment {
|
||||||
private static final String ARG_KEY = "key";
|
private static final String ARG_KEY = "key";
|
||||||
|
private static final String ARG_INIT_POD = "initPod";
|
||||||
|
|
||||||
@Inject OmnipodUtil omnipodUtil;
|
@Inject OmnipodUtil omnipodUtil;
|
||||||
@Inject PodStateManager podStateManager;
|
@Inject PodStateManager podStateManager;
|
||||||
|
|
||||||
private PageFragmentCallbacks mCallbacks;
|
private PageFragmentCallbacks mCallbacks;
|
||||||
private String mKey;
|
private String mKey;
|
||||||
private PodInfoPage mPage;
|
public boolean isInitPod;
|
||||||
public static boolean isInitPod = false;
|
|
||||||
private ArrayList<ReviewItem> mCurrentReviewItems;
|
private ArrayList<ReviewItem> mCurrentReviewItems;
|
||||||
|
|
||||||
public static PodInfoFragment create(String key, boolean initPod) {
|
public static PodInfoFragment create(String key, boolean initPod) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(ARG_KEY, key);
|
args.putString(ARG_KEY, key);
|
||||||
isInitPod = initPod;
|
args.putBoolean(ARG_INIT_POD, initPod);
|
||||||
|
|
||||||
PodInfoFragment fragment = new PodInfoFragment();
|
PodInfoFragment fragment = new PodInfoFragment();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PodInfoFragment() {
|
@SuppressLint("SourceLockedOrientationActivity") @Override
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
getActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
|
||||||
|
Bundle args = getArguments();
|
||||||
|
mKey = args.getString(ARG_KEY);
|
||||||
|
isInitPod = args.getBoolean(ARG_INIT_POD);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -61,7 +67,7 @@ public class PodInfoFragment extends DaggerFragment {
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
View rootView = inflater.inflate(R.layout.omnipod_initpod_pod_info, container, false);
|
View rootView = inflater.inflate(R.layout.omnipod_initpod_pod_info, container, false);
|
||||||
|
|
||||||
TextView titleView = (TextView) rootView.findViewById(R.id.podInfoTitle);
|
TextView titleView = rootView.findViewById(R.id.podInfoTitle);
|
||||||
titleView.setText(R.string.omnipod_init_pod_wizard_pod_info_title);
|
titleView.setText(R.string.omnipod_init_pod_wizard_pod_info_title);
|
||||||
titleView.setTextColor(getResources().getColor(com.tech.freak.wizardpager.R.color.review_green));
|
titleView.setTextColor(getResources().getColor(com.tech.freak.wizardpager.R.color.review_green));
|
||||||
|
|
||||||
|
@ -70,7 +76,6 @@ public class PodInfoFragment extends DaggerFragment {
|
||||||
R.string.omnipod_init_pod_wizard_pod_info_init_pod_description : //
|
R.string.omnipod_init_pod_wizard_pod_info_init_pod_description : //
|
||||||
R.string.omnipod_init_pod_wizard_pod_info_remove_pod_description);
|
R.string.omnipod_init_pod_wizard_pod_info_remove_pod_description);
|
||||||
|
|
||||||
|
|
||||||
if (isInitPod) {
|
if (isInitPod) {
|
||||||
if (createDataOfPod()) {
|
if (createDataOfPod()) {
|
||||||
|
|
||||||
|
@ -80,7 +85,6 @@ public class PodInfoFragment extends DaggerFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return rootView;
|
return rootView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,8 +112,10 @@ public class PodInfoFragment extends DaggerFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Activity activity) {
|
public void onAttach(Context context) {
|
||||||
super.onAttach(activity);
|
super.onAttach(context);
|
||||||
|
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
|
|
||||||
if (!(activity instanceof PageFragmentCallbacks)) {
|
if (!(activity instanceof PageFragmentCallbacks)) {
|
||||||
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
|
throw new ClassCastException("Activity must implement PageFragmentCallbacks");
|
||||||
|
@ -124,12 +130,6 @@ public class PodInfoFragment extends DaggerFragment {
|
||||||
mCallbacks = null;
|
mCallbacks = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private class PodInfoAdapter extends ArrayAdapter<ReviewItem> {
|
private class PodInfoAdapter extends ArrayAdapter<ReviewItem> {
|
||||||
|
|
||||||
private ArrayList<ReviewItem> dataSet;
|
private ArrayList<ReviewItem> dataSet;
|
||||||
|
|
|
@ -15,27 +15,17 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.In
|
||||||
* Created by andy on 29/11/2019
|
* Created by andy on 29/11/2019
|
||||||
*/
|
*/
|
||||||
public class RemoveActionFragment extends InitActionFragment implements PodInitReceiver {
|
public class RemoveActionFragment extends InitActionFragment implements PodInitReceiver {
|
||||||
private static final String ARG_KEY = "key";
|
|
||||||
|
|
||||||
public static RemoveActionFragment create(String key, PodInitActionType podInitActionType) {
|
public static RemoveActionFragment create(String key, PodInitActionType podInitActionType) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(ARG_KEY, key);
|
args.putString(InitActionFragment.ARG_KEY, key);
|
||||||
|
args.putSerializable(InitActionFragment.ARG_POD_INIT_ACTION_TYPE, podInitActionType);
|
||||||
|
|
||||||
RemoveActionFragment fragment = new RemoveActionFragment();
|
RemoveActionFragment fragment = new RemoveActionFragment();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
fragment.setPodInitActionType(podInitActionType);
|
|
||||||
return fragment;
|
return fragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RemoveActionFragment() {
|
|
||||||
this.instance = this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUserVisibleHint(boolean isVisibleToUser) {
|
|
||||||
super.setUserVisibleHint(isVisibleToUser);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void actionOnReceiveResponse(String result) {
|
public void actionOnReceiveResponse(String result) {
|
||||||
System.out.println("ACTION: actionOnReceiveResponse: " + result);
|
System.out.println("ACTION: actionOnReceiveResponse: " + result);
|
||||||
|
|
||||||
|
@ -67,6 +57,4 @@ public class RemoveActionFragment extends InitActionFragment implements PodInitR
|
||||||
setCheckBox(podInitActionType, isSuccess);
|
setCheckBox(podInitActionType, isSuccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodStateManage
|
||||||
/**
|
/**
|
||||||
* Created by andy on 4.8.2019
|
* Created by andy on 4.8.2019
|
||||||
*/
|
*/
|
||||||
// FIXME can be removed, we should just use EventOmnipodPumpValuesChanged
|
// FIXME Rename this class to EventRileyLinkStatusChanged and use EventOmnipodPumpValuesChanged
|
||||||
|
// for changes in Pod status
|
||||||
class EventOmnipodDeviceStatusChange : Event {
|
class EventOmnipodDeviceStatusChange : Event {
|
||||||
|
|
||||||
var rileyLinkServiceState: RileyLinkServiceState? = null
|
var rileyLinkServiceState: RileyLinkServiceState? = null
|
||||||
|
|
Loading…
Reference in a new issue