bolus progress dialog without activity context
This commit is contained in:
parent
74107f58fe
commit
bf7a96b3e7
5 changed files with 53 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity android:name=".PreferencesActivity" />
|
<activity android:name=".PreferencesActivity" />
|
||||||
|
<activity android:name=".plugins.Overview.Dialogs.BolusProgressHelperActivity" android:theme="@style/Theme.AppCompat.Translucent" />
|
||||||
<activity android:name=".AgreementActivity" />
|
<activity android:name=".AgreementActivity" />
|
||||||
<activity android:name=".plugins.DanaR.History.DanaRHistoryActivity" />
|
<activity android:name=".plugins.DanaR.History.DanaRHistoryActivity" />
|
||||||
<activity android:name=".plugins.DanaRKorean.History.DanaRHistoryActivity" />
|
<activity android:name=".plugins.DanaRKorean.History.DanaRHistoryActivity" />
|
||||||
|
|
|
@ -46,6 +46,7 @@ import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.DetermineBasalResultAMA;
|
import info.nightscout.androidaps.plugins.OpenAPSAMA.DetermineBasalResultAMA;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.DetermineBasalResultMA;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.DetermineBasalResultMA;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||||
|
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressHelperActivity;
|
||||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
|
@ -470,6 +471,12 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
||||||
bolusProgressDialog = new BolusProgressDialog();
|
bolusProgressDialog = new BolusProgressDialog();
|
||||||
bolusProgressDialog.setInsulin(insulin);
|
bolusProgressDialog.setInsulin(insulin);
|
||||||
bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress");
|
bolusProgressDialog.show(((AppCompatActivity) context).getSupportFragmentManager(), "BolusProgress");
|
||||||
|
} else {
|
||||||
|
Intent i = new Intent();
|
||||||
|
i.putExtra("insulin", insulin.doubleValue());
|
||||||
|
i.setClass(MainApp.instance(), BolusProgressHelperActivity.class);
|
||||||
|
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
|
MainApp.instance().startActivity(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
MainApp.bus().post(new EventBolusRequested(insulin));
|
MainApp.bus().post(new EventBolusRequested(insulin));
|
||||||
|
|
|
@ -29,6 +29,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
TextView statusView;
|
TextView statusView;
|
||||||
TextView stopPressedView;
|
TextView stopPressedView;
|
||||||
ProgressBar progressBar;
|
ProgressBar progressBar;
|
||||||
|
BolusProgressHelperActivity helperActivity;
|
||||||
|
|
||||||
static double amount;
|
static double amount;
|
||||||
public static boolean bolusEnded = false;
|
public static boolean bolusEnded = false;
|
||||||
|
@ -45,6 +46,10 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
bolusEnded = false;
|
bolusEnded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHelperActivity(BolusProgressHelperActivity activity){
|
||||||
|
this.helperActivity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
@ -71,6 +76,14 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
if (bolusEnded) dismiss();
|
if (bolusEnded) dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dismiss(){
|
||||||
|
super.dismiss();
|
||||||
|
if (helperActivity!= null){
|
||||||
|
helperActivity.finish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
package info.nightscout.androidaps.plugins.Overview.Dialogs;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v7.app.AppCompatActivity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adrian on 09/02/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class BolusProgressHelperActivity extends AppCompatActivity {
|
||||||
|
public BolusProgressHelperActivity() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
this.getIntent().getDoubleExtra("insulin", 0d);
|
||||||
|
BolusProgressDialog bolusProgressDialog = new BolusProgressDialog();
|
||||||
|
bolusProgressDialog.setHelperActivity(this);
|
||||||
|
bolusProgressDialog.setInsulin(this.getIntent().getDoubleExtra("insulin", 0d));
|
||||||
|
bolusProgressDialog.show(this.getSupportFragmentManager(), "BolusProgress");
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,4 +14,12 @@
|
||||||
|
|
||||||
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
|
||||||
|
|
||||||
|
<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar">
|
||||||
|
<item name="android:windowNoTitle">true</item>
|
||||||
|
<item name="android:windowBackground">@android:color/transparent</item>
|
||||||
|
<item name="android:colorBackgroundCacheHint">@null</item>
|
||||||
|
<item name="android:windowIsTranslucent">true</item>
|
||||||
|
<item name="android:windowAnimationStyle">@android:style/Animation</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Reference in a new issue