cleanup
This commit is contained in:
parent
ed9c8a1d05
commit
af1ee97d83
24 changed files with 65 additions and 192 deletions
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -92,12 +91,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
|
|||
commandQueue.extendedBolus(insulinAfterConstraint, durationInMinutes, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -161,12 +160,7 @@ class FillDialog : DialogFragmentWithDate() {
|
|||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
|
@ -206,12 +205,7 @@ class InsulinDialog : DialogFragmentWithDate() {
|
|||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.view.LayoutInflater
|
||||
|
@ -14,7 +13,8 @@ import dagger.android.support.DaggerDialogFragment
|
|||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.databinding.DialogLoopBinding
|
||||
import info.nightscout.androidaps.events.*
|
||||
import info.nightscout.androidaps.events.EventPreferenceChange
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||
import info.nightscout.androidaps.interfaces.*
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
import info.nightscout.androidaps.logging.UserEntryLogger
|
||||
|
@ -53,6 +53,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
private var _binding: DialogLoopBinding? = null
|
||||
private var loopHandler = Handler()
|
||||
private var refreshDialog: Runnable? = null
|
||||
|
||||
// This property is only valid between onCreateView and
|
||||
// onDestroyView.
|
||||
private val binding get() = _binding!!
|
||||
|
@ -293,12 +294,7 @@ class LoopDialog : DaggerDialogFragment() {
|
|||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
|
@ -121,12 +120,7 @@ class TempBasalDialog : DialogFragmentWithDate() {
|
|||
val callback: Callback = object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.dialogs
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
|
@ -142,12 +141,7 @@ class TreatmentDialog : DialogFragmentWithDate() {
|
|||
commandQueue.bolus(detailedBolusInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -613,12 +613,7 @@ open class LoopPlugin @Inject constructor(
|
|||
commandQueue.tempBasalAbsolute(0.0, durationInMinutes, true, profile!!, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -626,12 +621,7 @@ open class LoopPlugin @Inject constructor(
|
|||
commandQueue.tempBasalPercent(0, durationInMinutes, true, profile!!, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -640,12 +630,7 @@ open class LoopPlugin @Inject constructor(
|
|||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.extendedbolusdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.extendedbolusdeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -658,12 +643,7 @@ open class LoopPlugin @Inject constructor(
|
|||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), info.nightscout.androidaps.dana.R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -33,7 +33,6 @@ import info.nightscout.androidaps.skins.SkinProvider
|
|||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.alertDialogs.OKDialog
|
||||
import info.nightscout.androidaps.utils.buildHelper.BuildHelper
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||
import info.nightscout.androidaps.utils.protection.ProtectionCheck
|
||||
import info.nightscout.androidaps.utils.resources.ResourceHelper
|
||||
|
@ -42,6 +41,7 @@ import info.nightscout.androidaps.utils.sharedPreferences.SP
|
|||
import info.nightscout.androidaps.utils.ui.SingleClickButton
|
||||
import info.nightscout.androidaps.utils.ui.UIRunnable
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import java.util.*
|
||||
import javax.inject.Inject
|
||||
|
||||
|
@ -158,12 +158,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
commandQueue.cancelExtended(object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.extendedbolusdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.extendedbolusdeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -178,12 +173,7 @@ class ActionsFragment : DaggerFragment() {
|
|||
commandQueue.cancelTempBasal(true, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.general.automation.actions
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.widget.LinearLayout
|
||||
import androidx.annotation.DrawableRes
|
||||
import dagger.android.HasAndroidInjector
|
||||
|
@ -29,6 +28,7 @@ class ActionAlarm(injector: HasAndroidInjector) : Action(injector) {
|
|||
constructor(injector: HasAndroidInjector, text: String) : this(injector) {
|
||||
this.text = InputString(injector, text)
|
||||
}
|
||||
|
||||
override fun friendlyName(): Int = R.string.alarm
|
||||
override fun shortDescription(): String = resourceHelper.gs(R.string.alarm_message, text.value)
|
||||
@DrawableRes override fun icon(): Int = R.drawable.ic_access_alarm_24dp
|
||||
|
@ -36,13 +36,7 @@ class ActionAlarm(injector: HasAndroidInjector) : Action(injector) {
|
|||
override fun isValid(): Boolean = text.value.isNotEmpty()
|
||||
|
||||
override fun doAction(callback: Callback) {
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.modern_alarm)
|
||||
i.putExtra("status", text.value)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.alarm))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
|
||||
ErrorHelperActivity.runAlarm(context, text.value, resourceHelper.gs(R.string.alarm), R.raw.modern_alarm)
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.treatments
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.data.DetailedBolusInfo
|
||||
|
@ -47,12 +46,7 @@ class CarbsGenerator @Inject constructor(
|
|||
commandQueue.bolus(carbInfo, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.treatments;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
@ -679,12 +678,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
|
||||
String status = String.format(resourceHelper.gs(R.string.error_adding_treatment_message), treatment.insulin, (int) treatment.carbs, dateUtil.dateAndTimeString(treatment.date));
|
||||
|
||||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.error);
|
||||
i.putExtra("title", resourceHelper.gs(R.string.error_adding_treatment_title));
|
||||
i.putExtra("status", status);
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
ErrorHelperActivity.Companion.runAlarm(context, status, resourceHelper.gs(R.string.error_adding_treatment_title), R.raw.error);
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(FirebaseAnalytics.Param.ITEM_LIST_ID, "TreatmentClash");
|
||||
|
|
|
@ -116,12 +116,7 @@ class CommandQueue @Inject constructor(
|
|||
setProfile(it, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.failedupdatebasalprofile))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.failedupdatebasalprofile), R.raw.boluserror)
|
||||
}
|
||||
if (result.enacted) rxBus.send(EventNewBasalProfile())
|
||||
}
|
||||
|
|
|
@ -361,12 +361,7 @@ class BolusWizard @Inject constructor(
|
|||
commandQueue.bolus(this, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||
} else
|
||||
scheduleEatReminder()
|
||||
}
|
||||
|
@ -394,12 +389,7 @@ class BolusWizard @Inject constructor(
|
|||
commandQueue.tempBasalAbsolute(0.0, 120, true, profile, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.tempbasaldeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -409,9 +399,9 @@ class BolusWizard @Inject constructor(
|
|||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.putExtra(ErrorHelperActivity.SOUND_ID, R.raw.boluserror)
|
||||
i.putExtra(ErrorHelperActivity.STATUS, result.comment)
|
||||
i.putExtra(ErrorHelperActivity.TITLE, resourceHelper.gs(R.string.tempbasaldeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
}
|
||||
|
@ -435,12 +425,7 @@ class BolusWizard @Inject constructor(
|
|||
commandQueue.bolus(this, object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.treatmentdeliveryerror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(ctx, result.comment, resourceHelper.gs(R.string.treatmentdeliveryerror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package info.nightscout.androidaps.activities
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import androidx.annotation.RawRes
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.dialogs.ErrorDialog
|
||||
import info.nightscout.androidaps.plugins.general.nsclient.NSUpload
|
||||
|
@ -16,13 +19,28 @@ class ErrorHelperActivity : DialogAppCompatActivity() {
|
|||
super.onCreate(savedInstanceState)
|
||||
val errorDialog = ErrorDialog()
|
||||
errorDialog.helperActivity = this
|
||||
errorDialog.status = intent.getStringExtra("status")
|
||||
errorDialog.sound = intent.getIntExtra("soundid", R.raw.error)
|
||||
errorDialog.title = intent.getStringExtra("title")
|
||||
errorDialog.status = intent.getStringExtra(STATUS)
|
||||
errorDialog.sound = intent.getIntExtra(SOUND_ID, R.raw.error)
|
||||
errorDialog.title = intent.getStringExtra(TITLE)
|
||||
errorDialog.show(supportFragmentManager, "Error")
|
||||
|
||||
if (sp.getBoolean(R.string.key_ns_create_announcements_from_errors, true)) {
|
||||
nsUpload.uploadError(intent.getStringExtra("status"))
|
||||
nsUpload.uploadError(intent.getStringExtra(STATUS))
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val SOUND_ID = "soundId"
|
||||
const val STATUS = "status"
|
||||
const val TITLE = "title"
|
||||
|
||||
fun runAlarm(ctx: Context, status: String, title : String, @RawRes soundId: Int = 0) {
|
||||
val i = Intent(ctx, ErrorHelperActivity::class.java)
|
||||
i.putExtra(SOUND_ID, soundId)
|
||||
i.putExtra(STATUS, status)
|
||||
i.putExtra(TITLE, title)
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
ctx.startActivity(i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import android.os.Binder
|
|||
import android.os.Handler
|
||||
import android.os.IBinder
|
||||
import dagger.android.DaggerService
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.core.R
|
||||
import info.nightscout.androidaps.interfaces.NotificationHolderInterface
|
||||
import info.nightscout.androidaps.logging.AAPSLogger
|
||||
|
@ -69,7 +70,7 @@ class AlarmSoundService : DaggerService() {
|
|||
|
||||
player?.let { if (it.isPlaying) it.stop() }
|
||||
|
||||
if (intent?.hasExtra("soundid") == true) resourceId = intent.getIntExtra("soundid", R.raw.error)
|
||||
if (intent?.hasExtra(ErrorHelperActivity.SOUND_ID) == true) resourceId = intent.getIntExtra(ErrorHelperActivity.SOUND_ID, R.raw.error)
|
||||
player = MediaPlayer()
|
||||
try {
|
||||
val afd = resourceHelper.openRawResourceFd(resourceId) ?: return START_STICKY
|
||||
|
|
|
@ -7,6 +7,7 @@ import android.content.ServiceConnection
|
|||
import android.os.Build
|
||||
import android.os.IBinder
|
||||
import androidx.annotation.RequiresApi
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
import info.nightscout.androidaps.interfaces.NotificationHolderInterface
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
|
@ -67,7 +68,7 @@ class AlarmSoundServiceHelper @Inject constructor(
|
|||
|
||||
private fun getServiceIntent(context: Context, sound: Int): Intent {
|
||||
val alarm = Intent(context, AlarmSoundService::class.java)
|
||||
alarm.putExtra("soundid", sound)
|
||||
alarm.putExtra(ErrorHelperActivity.SOUND_ID, sound)
|
||||
return alarm
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.dana.activities
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.activities.ErrorHelperActivity
|
||||
|
@ -18,9 +17,9 @@ import info.nightscout.androidaps.plugins.bus.RxBusWrapper
|
|||
import info.nightscout.androidaps.plugins.pump.common.defs.PumpType
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import info.nightscout.androidaps.utils.rx.AapsSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.rxkotlin.plusAssign
|
||||
import java.text.DecimalFormat
|
||||
import javax.inject.Inject
|
||||
import kotlin.math.max
|
||||
|
@ -154,12 +153,7 @@ class DanaUserOptionsActivity : NoSplashAppCompatActivity() {
|
|||
commandQueue.setUserOptions(object : Callback() {
|
||||
override fun run() {
|
||||
if (!result.success) {
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.boluserror)
|
||||
i.putExtra("status", result.comment)
|
||||
i.putExtra("title", resourceHelper.gs(R.string.pumperror))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(context, result.comment, resourceHelper.gs(R.string.pumperror), R.raw.boluserror)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.danaRv2.services;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Binder;
|
||||
import android.os.SystemClock;
|
||||
|
||||
|
@ -205,12 +204,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
|
|||
if (Math.abs(timeDiff) > 60 * 60 * 1.5) {
|
||||
aapsLogger.debug(LTag.PUMP, "Pump time difference: " + timeDiff + " seconds - large difference");
|
||||
//If time-diff is very large, warn user until we can synchronize history readings properly
|
||||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.error);
|
||||
i.putExtra("status", resourceHelper.gs(R.string.largetimediff));
|
||||
i.putExtra("title", resourceHelper.gs(R.string.largetimedifftitle));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
ErrorHelperActivity.Companion.runAlarm(context, resourceHelper.gs(R.string.largetimediff), resourceHelper.gs(R.string.largetimedifftitle), R.raw.error);
|
||||
|
||||
//deinitialize pump
|
||||
danaPump.reset();
|
||||
|
|
|
@ -168,12 +168,7 @@ class DanaRSService : DaggerService() {
|
|||
if (abs(timeDiff) > 60 * 60 * 1.5) {
|
||||
aapsLogger.debug(LTag.PUMPCOMM, "Pump time difference: $timeDiff seconds - large difference")
|
||||
//If time-diff is very large, warn user until we can synchronize history readings properly
|
||||
val i = Intent(context, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", R.raw.error)
|
||||
i.putExtra("status", resourceHelper.gs(R.string.largetimediff))
|
||||
i.putExtra("title", resourceHelper.gs(R.string.largetimedifftitle))
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
context.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(context, resourceHelper.gs(R.string.largetimediff), resourceHelper.gs(R.string.largetimedifftitle), R.raw.error)
|
||||
|
||||
//de-initialize pump
|
||||
danaPump.reset()
|
||||
|
|
|
@ -2,7 +2,6 @@ package info.nightscout.androidaps.plugins.pump.medtronic;
|
|||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.ServiceConnection;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
|
@ -876,13 +875,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
// LOG.debug("MedtronicPumpPlugin::deliverBolus - Show dialog. Context: "
|
||||
// + MainApp.instance().getApplicationContext());
|
||||
|
||||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.boluserror);
|
||||
i.putExtra("status", getResourceHelper().gs(R.string.medtronic_cmd_cancel_bolus_not_supported));
|
||||
i.putExtra("title", getResourceHelper().gs(R.string.medtronic_warning));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
|
||||
ErrorHelperActivity.Companion.runAlarm(context,getResourceHelper().gs(R.string.medtronic_cmd_cancel_bolus_not_supported), getResourceHelper().gs(R.string.medtronic_warning), R.raw.boluserror);
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
@ -1563,12 +1556,7 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter
|
|||
if (rileyLinkMedtronicService.verifyConfiguration()) {
|
||||
serviceTaskExecutor.startTask(new WakeAndTuneTask(getInjector()));
|
||||
} else {
|
||||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.boluserror);
|
||||
i.putExtra("status", getResourceHelper().gs(R.string.medtronic_error_operation_not_possible_no_configuration));
|
||||
i.putExtra("title", getResourceHelper().gs(R.string.medtronic_warning));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
ErrorHelperActivity.Companion.runAlarm(context, getResourceHelper().gs(R.string.medtronic_error_operation_not_possible_no_configuration), getResourceHelper().gs(R.string.medtronic_warning), R.raw.boluserror);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -878,9 +878,9 @@ public class OmnipodErosPumpPlugin extends PumpPluginBase implements PumpInterfa
|
|||
}
|
||||
|
||||
Intent i = new Intent(context, ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", 0);
|
||||
i.putExtra("status", resourceHelper.gs(R.string.omnipod_pulse_log_value) + ":\n" + result.toString());
|
||||
i.putExtra("title", resourceHelper.gs(R.string.omnipod_pulse_log));
|
||||
i.putExtra(ErrorHelperActivity.SOUND_ID, 0);
|
||||
i.putExtra(ErrorHelperActivity.STATUS, resourceHelper.gs(R.string.omnipod_pulse_log_value) + ":\n" + result.toString());
|
||||
i.putExtra(ErrorHelperActivity.TITLE, resourceHelper.gs(R.string.omnipod_pulse_log));
|
||||
i.putExtra("clipboardContent", result.toString());
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(i);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.eros.manager;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.Duration;
|
||||
|
@ -957,12 +956,7 @@ public class AapsOmnipodManager {
|
|||
}
|
||||
|
||||
private void showErrorDialog(String message, Integer sound) {
|
||||
Intent intent = new Intent(context, ErrorHelperActivity.class);
|
||||
intent.putExtra("soundid", sound);
|
||||
intent.putExtra("status", message);
|
||||
intent.putExtra("title", resourceHelper.gs(R.string.error));
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
ErrorHelperActivity.Companion.runAlarm(context, message, resourceHelper.gs(R.string.error), sound);
|
||||
}
|
||||
|
||||
private void showPodFaultNotification(FaultEventCode faultEventCode) {
|
||||
|
|
|
@ -537,12 +537,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
|
|||
|
||||
private fun displayErrorDialog(title: String, message: String, withSound: Boolean) {
|
||||
context?.let {
|
||||
val i = Intent(it, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", if (withSound) R.raw.boluserror else 0)
|
||||
i.putExtra("status", message)
|
||||
i.putExtra("title", title)
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
it.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -209,12 +209,7 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
|
|||
|
||||
private fun displayErrorDialog(title: String, message: String, @Suppress("SameParameterValue") withSound: Boolean) {
|
||||
context.let {
|
||||
val i = Intent(it, ErrorHelperActivity::class.java)
|
||||
i.putExtra("soundid", if (withSound) R.raw.boluserror else 0)
|
||||
i.putExtra("status", message)
|
||||
i.putExtra("title", title)
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
it.startActivity(i)
|
||||
ErrorHelperActivity.runAlarm(it, message, title, if (withSound) R.raw.boluserror else 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue