ToastUtils -> :core:ui

This commit is contained in:
Milos Kozak 2022-11-14 13:25:09 +01:00
parent d8bfcad7e9
commit a2f048adc4
63 changed files with 135 additions and 84 deletions

View file

@ -27,12 +27,12 @@ import info.nightscout.androidaps.activities.PreferencesActivity
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8PumpLogReset
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.general.maintenance.formats.EncryptedPrefsFormat
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.alertDialogs.PrefImportSummaryDialog
import info.nightscout.androidaps.utils.protection.PasswordCheck
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.dialogs.TwoMessagesAlertDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources

View file

@ -45,17 +45,17 @@ import info.nightscout.androidaps.plugins.general.overview.graphData.GraphData
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.ui.elements.SingleClickButton
import info.nightscout.core.ui.UIRunnable
import info.nightscout.automation.AutomationPlugin
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.iob.displayText
import info.nightscout.core.profile.toSignedUnitsString
import info.nightscout.core.profile.toTargetRangeString
import info.nightscout.core.profile.toUnits
import info.nightscout.core.ui.UIRunnable
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.elements.SingleClickButton
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.wizard.QuickWizard
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources

View file

@ -17,7 +17,7 @@ import info.nightscout.androidaps.plugins.general.overview.graphExtensions.Effec
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.GlucoseValueDataPoint
import info.nightscout.androidaps.plugins.general.overview.graphExtensions.TimeAsXAxisLabelFormatter
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.utils.Round

View file

@ -16,13 +16,13 @@ import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.services.AlarmSoundServiceHelper
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.iob.generateCOBString
import info.nightscout.core.iob.round
import info.nightscout.core.profile.fromMgdlToUnits
import info.nightscout.core.profile.toMgdl
import info.nightscout.core.profile.toTargetRangeString
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.wizard.BolusWizard
import info.nightscout.core.wizard.QuickWizard
import info.nightscout.core.wizard.QuickWizardEntry

View file

@ -18,7 +18,7 @@ import androidx.annotation.StyleRes
import androidx.appcompat.view.ContextThemeWrapper
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import info.nightscout.androidaps.R
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.maintenance.Prefs
import info.nightscout.interfaces.maintenance.PrefsStatus
import info.nightscout.shared.extensions.runOnUiThread

View file

@ -110,7 +110,6 @@
<string name="openapsma_maxiob_summary">This value is called Max IOB in OpenAPS context\nThis is maximal insulin in [U] APS can deliver at once.</string>
<string name="language" translatable="false">Language</string>
<string name="password_preferences_encrypt_prompt">You will be asked for master password, which will be used to encrypt exported preferences.</string>
<string name="password_preferences_decrypt_prompt">You will be asked for master password, which is needed to decrypt imported preferences.</string>
<string name="preferences_export_canceled">Export canceled! Preferences were NOT exported!</string>
<string name="preferences_import_canceled">Import canceled! Preferences were NOT imported!</string>
<string name="preferences_import_impossible">Cannot import preferences!</string>

View file

@ -11,7 +11,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.automation.AutomationEvent
import info.nightscout.automation.AutomationPlugin
import info.nightscout.automation.R
@ -23,6 +22,7 @@ import info.nightscout.automation.events.EventAutomationUpdateAction
import info.nightscout.automation.events.EventAutomationUpdateGui
import info.nightscout.automation.events.EventAutomationUpdateTrigger
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.shared.extensions.toVisibility

View file

@ -9,14 +9,14 @@ import android.widget.LinearLayout
import androidx.core.app.ActivityCompat
import com.google.common.base.Optional
import dagger.android.HasAndroidInjector
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.automation.AutomationPlugin
import info.nightscout.automation.R
import info.nightscout.automation.elements.ComparatorConnect
import info.nightscout.automation.elements.InputDropdownMenu
import info.nightscout.automation.elements.LayoutBuilder
import info.nightscout.automation.elements.StaticLabel
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.utils.JsonHelper
import info.nightscout.rx.events.EventBTChange
import info.nightscout.rx.logging.LTag
import org.json.JSONObject

View file

@ -1,10 +1,24 @@
package info.nightscout.androidaps.utils.protection
import androidx.biometric.BiometricPrompt
import androidx.biometric.BiometricPrompt.*
import androidx.biometric.BiometricPrompt.AuthenticationResult
import androidx.biometric.BiometricPrompt.ERROR_CANCELED
import androidx.biometric.BiometricPrompt.ERROR_HW_NOT_PRESENT
import androidx.biometric.BiometricPrompt.ERROR_HW_UNAVAILABLE
import androidx.biometric.BiometricPrompt.ERROR_LOCKOUT
import androidx.biometric.BiometricPrompt.ERROR_LOCKOUT_PERMANENT
import androidx.biometric.BiometricPrompt.ERROR_NEGATIVE_BUTTON
import androidx.biometric.BiometricPrompt.ERROR_NO_BIOMETRICS
import androidx.biometric.BiometricPrompt.ERROR_NO_DEVICE_CREDENTIAL
import androidx.biometric.BiometricPrompt.ERROR_NO_SPACE
import androidx.biometric.BiometricPrompt.ERROR_TIMEOUT
import androidx.biometric.BiometricPrompt.ERROR_UNABLE_TO_PROCESS
import androidx.biometric.BiometricPrompt.ERROR_USER_CANCELED
import androidx.biometric.BiometricPrompt.ERROR_VENDOR
import androidx.biometric.BiometricPrompt.PromptInfo
import androidx.fragment.app.FragmentActivity
import info.nightscout.core.main.R
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.shared.extensions.runOnUiThread
import java.util.concurrent.Executors

View file

@ -14,8 +14,8 @@ import androidx.annotation.StringRes
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import info.nightscout.androidaps.plugins.general.maintenance.PrefFileListProvider
import info.nightscout.androidaps.utils.CryptoUtil
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.main.R
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.shared.sharedPreferences.SP
import java.io.File

View file

@ -1,7 +1,6 @@
package info.nightscout.androidaps.utils.ui
import android.Manifest
import kotlin.jvm.JvmOverloads
import android.bluetooth.BluetoothManager
import android.content.Context
import android.content.pm.PackageManager
@ -10,8 +9,8 @@ import android.util.AttributeSet
import androidx.core.app.ActivityCompat
import androidx.preference.ListPreference
import info.nightscout.core.main.R
import info.nightscout.androidaps.utils.ToastUtils
import java.util.*
import info.nightscout.core.ui.toast.ToastUtils
import java.util.Vector
class BluetoothDevicePreference @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : ListPreference(context, attrs) {

View file

@ -23,9 +23,7 @@ import android.widget.Button
import android.widget.LinearLayout
import info.nightscout.core.main.R
import info.nightscout.core.main.databinding.NumberPickerLayoutBinding
import info.nightscout.shared.extensions.toVisibility
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.shared.SafeParse
import info.nightscout.core.ui.toast.ToastUtils
import java.text.NumberFormat
import java.util.concurrent.Executors
import java.util.concurrent.ScheduledExecutorService
@ -69,6 +67,20 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
false
})
private fun Boolean.toVisibility() = if (this) View.VISIBLE else View.GONE
private fun stringToDouble(inputString: String?, defaultValue: Double = 0.0): Double {
var input = inputString ?: return defaultValue
var result = defaultValue
input = input.replace(",", ".")
input = input.replace("", "-")
if (input == "") return defaultValue
try {
result = input.toDouble()
} catch (e: Exception) {
// log.error("Error parsing " + input + " to double");
}
return result
}
private inner class UpdateCounterTask(private val mInc: Boolean) : Runnable {
private var repeated = 0
@ -121,7 +133,7 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
override fun afterTextChanged(s: Editable) {
if (focused) currentValue = SafeParse.stringToDouble(binding.editText.text.toString())
if (focused) currentValue = stringToDouble(binding.editText.text.toString())
callValueChangedListener()
val inValid = currentValue > maxValue || currentValue < minValue
okButton?.visibility = inValid.not().toVisibility()
@ -174,7 +186,7 @@ open class NumberPicker(context: Context, attrs: AttributeSet? = null) : LinearL
binding.editText.addTextChangedListener(textWatcher)
binding.editText.onFocusChangeListener = OnFocusChangeListener { _: View?, hasFocus: Boolean ->
if (!hasFocus) {
currentValue = SafeParse.stringToDouble(binding.editText.text.toString())
currentValue = stringToDouble(binding.editText.text.toString())
if (currentValue > maxValue) {
currentValue = maxValue
ToastUtils.warnToast(context, R.string.youareonallowedlimit)

View file

@ -0,0 +1,18 @@
package info.nightscout.core.toast
import android.content.Context
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.rx.bus.RxBus
fun ToastUtils.showToastAdNotification(
ctx: Context?, rxBus: RxBus,
string: String?, soundID: Int
) {
showToastInUiThread(ctx, string)
playSound(ctx, soundID)
val notification = Notification(Notification.TOAST_ALARM, string!!, Notification.URGENT)
rxBus.send(EventNewNotification(notification))
}

View file

@ -9,6 +9,10 @@ apply from: "${project.rootDir}/core/core-main/android_dependencies.gradle"
android {
namespace 'info.nightscout.core.ui'
buildFeatures {
viewBinding true
}
}
dependencies {

View file

@ -1,10 +1,12 @@
package info.nightscout.androidaps.utils
package info.nightscout.core.ui.toast
import android.annotation.SuppressLint
import android.content.Context
import android.media.MediaPlayer
import android.os.Handler
import android.os.Looper
import android.text.Html
import android.text.Spanned
import android.view.LayoutInflater
import android.widget.ImageView
import android.widget.TextView
@ -12,12 +14,8 @@ import android.widget.Toast
import androidx.annotation.DrawableRes
import androidx.annotation.StringRes
import androidx.appcompat.view.ContextThemeWrapper
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.core.main.R
import info.nightscout.core.ui.R
import info.nightscout.core.ui.getThemeColor
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.utils.HtmlHelper
import info.nightscout.rx.bus.RxBus
object ToastUtils {
@ -78,29 +76,23 @@ object ToastUtils {
val toast: Toast =
Toast.makeText(
ctx,
HtmlHelper.fromHtml("<font color='" + ContextThemeWrapper(ctx, R.style.AppTheme).getThemeColor(R.attr.toastBaseTextColor) + "'>" + string + "</font>"),
fromHtml("<font color='" + ContextThemeWrapper(ctx, R.style.AppTheme).getThemeColor(R.attr.toastBaseTextColor) + "'>" + string + "</font>"),
Toast.LENGTH_SHORT
)
toast.show()
}
}
fun showToastInUiThread(
ctx: Context?, rxBus: RxBus,
string: String?, soundID: Int
) {
showToastInUiThread(ctx, string)
playSound(ctx, soundID)
val notification = Notification(Notification.TOAST_ALARM, string!!, Notification.URGENT)
rxBus.send(EventNewNotification(notification))
}
private fun playSound(ctx: Context?, soundID: Int) {
fun playSound(ctx: Context?, soundID: Int) {
val soundMP = MediaPlayer.create(ctx, soundID)
soundMP.start()
soundMP.setOnCompletionListener { obj: MediaPlayer -> obj.release() }
}
private fun fromHtml(source: String): Spanned {
return Html.fromHtml(source, Html.FROM_HTML_MODE_LEGACY)
}
object Long {
fun warnToast(ctx: Context?, string: String) {

View file

@ -9,4 +9,7 @@
<string name="yes">Yes</string>
<string name="no">No</string>
<!-- TwoMessagesDialog -->
<string name="password_preferences_decrypt_prompt">You will be asked for master password, which is needed to decrypt imported preferences.</string>
</resources>

View file

@ -14,8 +14,8 @@ import android.provider.Settings
import androidx.core.content.ContextCompat
import androidx.fragment.app.FragmentActivity
import info.nightscout.androidaps.activities.DaggerAppCompatActivityWithResult
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.AndroidPermission
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.notifications.Notification

View file

@ -2,8 +2,9 @@ package info.nightscout.implementation
import android.content.Context
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.main.R
import info.nightscout.core.toast.showToastAdNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.transactions.InsertTherapyEventAnnouncementTransaction
import info.nightscout.interfaces.utils.HardLimits
@ -101,7 +102,7 @@ class HardLimitsImpl @Inject constructor(
msg += rh.gs(R.string.valuelimitedto, value, newValue)
aapsLogger.error(msg)
disposable += repository.runTransaction(InsertTherapyEventAnnouncementTransaction(msg)).subscribe()
ToastUtils.showToastInUiThread(context, rxBus, msg, R.raw.error)
ToastUtils.showToastAdNotification(context, rxBus, msg, R.raw.error)
}
return newValue
}

View file

@ -5,7 +5,7 @@ import android.content.Intent
import android.os.Bundle
import info.nightscout.androidaps.annotations.OpenForTesting
import info.nightscout.androidaps.receivers.Intents
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.GlucoseValue
import info.nightscout.interfaces.GlucoseUnit
import info.nightscout.interfaces.XDripBroadcast

View file

@ -5,7 +5,7 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.plugins.R
import info.nightscout.plugins.constraints.objectives.events.EventObjectivesUpdateGui
import info.nightscout.plugins.constraints.objectives.objectives.Objective

View file

@ -14,9 +14,9 @@ import com.google.common.primitives.Ints.min
import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.interfaces.smsCommunicator.SmsCommunicator

View file

@ -12,10 +12,10 @@ import info.nightscout.androidaps.extensions.blockFromJsonArray
import info.nightscout.androidaps.extensions.pureProfileFromJson
import info.nightscout.androidaps.receivers.DataWorkerStorage
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.profile.ProfileStoreObject
import info.nightscout.core.profile.toMgdl
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.GlucoseUnit

View file

@ -12,8 +12,9 @@ import androidx.preference.PreferenceFragmentCompat
import androidx.preference.PreferenceScreen
import androidx.preference.SwitchPreference
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.toast.showToastAdNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
@ -186,7 +187,7 @@ class NSClientPlugin @Inject constructor(
}
return fromHtml(newTextLog.toString())
} catch (e: OutOfMemoryError) {
ToastUtils.showToastInUiThread(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error)
ToastUtils.showToastAdNotification(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error)
}
return fromHtml("")
}

View file

@ -12,8 +12,9 @@ import androidx.work.OneTimeWorkRequest
import androidx.work.WorkInfo
import androidx.work.WorkManager
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.toast.showToastAdNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.BuildHelper
import info.nightscout.interfaces.Config
import info.nightscout.interfaces.Constants
@ -226,7 +227,7 @@ class NSClientV3Plugin @Inject constructor(
}
return HtmlHelper.fromHtml(newTextLog.toString())
} catch (e: OutOfMemoryError) {
ToastUtils.showToastInUiThread(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error)
ToastUtils.showToastAdNotification(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error)
}
return HtmlHelper.fromHtml("")
}

View file

@ -7,8 +7,9 @@ import androidx.preference.PreferenceFragmentCompat
import dagger.android.HasAndroidInjector
import info.nightscout.androidaps.events.EventNewBG
import info.nightscout.androidaps.receivers.ReceiverStatusStore
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.toast.showToastAdNotification
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.Constants
import info.nightscout.interfaces.plugin.PluginBase
import info.nightscout.interfaces.plugin.PluginDescription
@ -171,7 +172,7 @@ class TidepoolPlugin @Inject constructor(
}
textLog = HtmlHelper.fromHtml(newTextLog.toString())
} catch (e: OutOfMemoryError) {
ToastUtils.showToastInUiThread(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error)
ToastUtils.showToastAdNotification(context, rxBus, "Out of memory!\nStop using this phone !!!", R.raw.error)
}
}

View file

@ -20,6 +20,7 @@ dependencies {
implementation project(':app-wear-shared:shared')
implementation project(':core:core-main')
implementation project(':core:fabric')
implementation project(':core:ui')
implementation project(':pump:dana')
implementation project(':interfaces')
}

View file

@ -40,8 +40,8 @@ import info.nightscout.androidaps.danar.comm.MsgHistorySuspend;
import info.nightscout.androidaps.danar.comm.MsgPCCommStart;
import info.nightscout.androidaps.danar.comm.MsgPCCommStop;
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification;
import info.nightscout.androidaps.utils.ToastUtils;
import info.nightscout.core.fabric.FabricPrivacy;
import info.nightscout.core.ui.toast.ToastUtils;
import info.nightscout.interfaces.notifications.Notification;
import info.nightscout.interfaces.plugin.ActivePlugin;
import info.nightscout.interfaces.profile.Profile;

View file

@ -20,8 +20,8 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.notifications.Notification

View file

@ -26,7 +26,7 @@ import info.nightscout.androidaps.danars.databinding.DanarsBlescannerActivityBin
import info.nightscout.androidaps.danars.events.EventDanaRSDeviceChange
import info.nightscout.androidaps.extensions.safeEnable
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.shared.sharedPreferences.SP
import java.util.regex.Pattern
import javax.inject.Inject

View file

@ -34,7 +34,7 @@ import info.nightscout.androidaps.extensions.notify
import info.nightscout.androidaps.extensions.waitMillis
import info.nightscout.androidaps.plugins.general.overview.events.EventDismissNotification
import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotification
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.notifications.Notification
import info.nightscout.interfaces.pump.PumpSync
import info.nightscout.rx.bus.RxBus

View file

@ -36,6 +36,7 @@ dependencies {
api "androidx.room:room-ktx:$room_version"
api "androidx.room:room-runtime:$room_version"
api "androidx.room:room-rxjava3:$room_version"
implementation project(path: ':core:ui')
kapt "androidx.room:room-compiler:$room_version"
api "com.squareup.okhttp3:okhttp:$okhttp3_version"

View file

@ -18,8 +18,8 @@ import info.nightscout.androidaps.plugins.general.overview.events.EventNewNotifi
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.DetailedBolusInfoStorage
import info.nightscout.androidaps.plugins.pump.common.bolusInfo.TemporaryBasalStorage
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.constraints.Constraint
import info.nightscout.interfaces.constraints.Constraints
import info.nightscout.interfaces.notifications.Notification

View file

@ -29,7 +29,7 @@ import info.nightscout.androidaps.diaconn.databinding.DiaconnG8BlescannerActivit
import info.nightscout.androidaps.diaconn.events.EventDiaconnG8DeviceChange
import info.nightscout.androidaps.extensions.safeEnable
import info.nightscout.androidaps.plugins.pump.common.ble.BlePreCheck
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.shared.sharedPreferences.SP
import java.util.UUID
import javax.inject.Inject

View file

@ -9,8 +9,8 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.diaconn.DiaconnG8Pump
import info.nightscout.androidaps.diaconn.R
import info.nightscout.androidaps.diaconn.databinding.DiaconnG8UserOptionsActivityBinding
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.queue.Callback
import info.nightscout.interfaces.queue.CommandQueue

View file

@ -27,7 +27,7 @@ import info.nightscout.androidaps.diaconn.packet.InjectionBlockReportPacket
import info.nightscout.androidaps.diaconn.packet.InsulinLackReportPacket
import info.nightscout.androidaps.extensions.notify
import info.nightscout.androidaps.extensions.waitMillis
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.ui.ActivityNames
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.events.EventPumpStatusChanged

View file

@ -3,12 +3,16 @@ package info.nightscout.androidaps.plugins.pump.eopatch.ui
import android.os.Bundle
import android.view.View
import androidx.lifecycle.ViewModelProvider
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewModel.SetupStep.*
import info.nightscout.androidaps.plugins.pump.eopatch.R
import info.nightscout.androidaps.plugins.pump.eopatch.code.PatchStep
import info.nightscout.androidaps.plugins.pump.eopatch.databinding.FragmentEopatchConnectNewBinding
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewModel
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewModel.SetupStep.ACTIVATION_FAILED
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewModel.SetupStep.BONDING_FAILED
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewModel.SetupStep.GET_PATCH_INFO_FAILED
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewModel.SetupStep.SCAN_FAILED
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewModel.SetupStep.SELF_TEST_FAILED
import info.nightscout.core.ui.toast.ToastUtils
class EopatchConnectNewFragment : EoBaseFragment<FragmentEopatchConnectNewBinding>() {

View file

@ -14,7 +14,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.core.code.BolusType
import info.nightscout.androidaps.plugins.pump.eopatch.databinding.FragmentEopatchOverviewBinding
import info.nightscout.androidaps.plugins.pump.eopatch.extension.takeOne
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchOverviewViewModel
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.rx.AapsSchedulers
import info.nightscout.rx.bus.RxBus
import info.nightscout.rx.logging.AAPSLogger

View file

@ -9,7 +9,7 @@ import info.nightscout.androidaps.plugins.pump.eopatch.R
import info.nightscout.androidaps.plugins.pump.eopatch.code.PatchStep
import info.nightscout.androidaps.plugins.pump.eopatch.databinding.FragmentEopatchRotateKnobBinding
import info.nightscout.androidaps.plugins.pump.eopatch.ui.viewmodel.EopatchViewModel
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
class EopatchRotateKnobFragment : EoBaseFragment<FragmentEopatchRotateKnobBinding>() {

View file

@ -11,9 +11,9 @@ import com.google.common.collect.Lists
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.interfaces.stats.TddCalculator
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.EffectiveProfileSwitch
import info.nightscout.database.impl.AppRepository
import info.nightscout.interfaces.plugin.ActivePlugin

View file

@ -3,7 +3,7 @@ package info.nightscout.ui.activities
import android.os.Bundle
import android.widget.ArrayAdapter
import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.interfaces.plugin.ActivePlugin
import info.nightscout.interfaces.profile.ProfileFunction
import info.nightscout.interfaces.ui.ActivityNames

View file

@ -20,9 +20,9 @@ import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.Bolus
import info.nightscout.database.entities.BolusCalculatorResult
import info.nightscout.database.entities.Carbs

View file

@ -16,10 +16,10 @@ import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.Translator
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.TherapyEvent
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources

View file

@ -19,9 +19,9 @@ import info.nightscout.androidaps.extensions.iobCalc
import info.nightscout.androidaps.extensions.isInProgress
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.ExtendedBolus
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources

View file

@ -22,9 +22,9 @@ import info.nightscout.androidaps.events.EventNewHistoryData
import info.nightscout.androidaps.extensions.getCustomizedName
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources
import info.nightscout.database.entities.ValueWithUnit

View file

@ -22,10 +22,10 @@ import info.nightscout.androidaps.extensions.highValueToUnitsToString
import info.nightscout.androidaps.extensions.lowValueToUnitsToString
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.Translator
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.TemporaryTarget
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources

View file

@ -20,9 +20,9 @@ import info.nightscout.androidaps.extensions.toStringFull
import info.nightscout.androidaps.extensions.toTemporaryBasal
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ActionModeHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.ExtendedBolus
import info.nightscout.database.entities.TemporaryBasal
import info.nightscout.database.entities.UserEntry.Action

View file

@ -13,10 +13,10 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import dagger.android.support.DaggerFragment
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.userEntry.UserEntryPresentationHelper
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources

View file

@ -14,11 +14,11 @@ import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.GlucoseStatusProvider
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.androidaps.utils.protection.ProtectionCheck.Protection.BOLUS
import info.nightscout.core.profile.toMgdl
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.TemporaryTarget
import info.nightscout.database.entities.UserEntry.Action
import info.nightscout.database.entities.UserEntry.Sources

View file

@ -9,9 +9,9 @@ import com.google.common.base.Joiner
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.constraints.Constraint

View file

@ -10,9 +10,9 @@ import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.TherapyEvent
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit

View file

@ -13,12 +13,12 @@ import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.extensions.toSignedString
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.profile.toMgdl
import info.nightscout.core.pumpExtensions.insertBolusTransaction
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.TemporaryTarget
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit

View file

@ -12,10 +12,10 @@ import android.view.WindowManager
import androidx.fragment.app.FragmentManager
import dagger.android.support.DaggerDialogFragment
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.OfflineEvent
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit

View file

@ -13,10 +13,10 @@ import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.profile.toMgdl
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.TemporaryTarget
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit

View file

@ -9,9 +9,9 @@ import com.google.common.base.Joiner
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.interfaces.constraints.Constraint

View file

@ -11,11 +11,11 @@ import com.google.common.collect.Lists
import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.DefaultValueHelper
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.profile.toCurrentUnitsString
import info.nightscout.core.profile.toMgdl
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.TemporaryTarget
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit

View file

@ -12,11 +12,11 @@ import info.nightscout.androidaps.dialogs.DialogFragmentWithDate
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.logging.UserEntryLogger
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.pumpExtensions.insertBolusTransaction
import info.nightscout.core.pumpExtensions.insertCarbsTransaction
import info.nightscout.core.ui.dialogs.OKDialog
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.database.entities.UserEntry
import info.nightscout.database.entities.ValueWithUnit
import info.nightscout.database.impl.AppRepository

View file

@ -22,12 +22,12 @@ import info.nightscout.androidaps.data.ProfileSealed
import info.nightscout.androidaps.extensions.formatColor
import info.nightscout.androidaps.extensions.valueToUnits
import info.nightscout.androidaps.utils.DecimalFormatter
import info.nightscout.androidaps.utils.ToastUtils
import info.nightscout.androidaps.utils.protection.ProtectionCheck
import info.nightscout.core.fabric.FabricPrivacy
import info.nightscout.core.iob.round
import info.nightscout.core.profile.toMgdl
import info.nightscout.core.profile.toUnitsString
import info.nightscout.core.ui.toast.ToastUtils
import info.nightscout.core.wizard.BolusWizard
import info.nightscout.database.impl.AppRepository
import info.nightscout.database.impl.ValueWrapper