From 18cf4b14c82103cb1698ae3c4c898a774e7fbbfc Mon Sep 17 00:00:00 2001 From: Andries Smit Date: Thu, 24 Mar 2022 12:15:56 +0100 Subject: [PATCH] chore: move dialog and header style to theme --- .../androidaps/dialogs/CalibrationDialog.kt | 1 + .../androidaps/dialogs/CarbsDialog.kt | 1 + .../androidaps/dialogs/CareDialog.kt | 1 + .../androidaps/dialogs/ExtendedBolusDialog.kt | 1 + .../androidaps/dialogs/FillDialog.kt | 1 + .../androidaps/dialogs/InsulinDialog.kt | 1 + .../androidaps/dialogs/ProfileSwitchDialog.kt | 1 + .../androidaps/dialogs/TempBasalDialog.kt | 1 + .../androidaps/dialogs/TempTargetDialog.kt | 1 + .../androidaps/dialogs/TreatmentDialog.kt | 1 + .../androidaps/dialogs/WizardDialog.kt | 9 --- .../main/res/layout/dialog_calibration.xml | 10 +--- app/src/main/res/layout/dialog_carbs.xml | 9 +-- app/src/main/res/layout/dialog_care.xml | 10 ++-- .../main/res/layout/dialog_extendedbolus.xml | 9 +-- app/src/main/res/layout/dialog_fill.xml | 9 +-- app/src/main/res/layout/dialog_insulin.xml | 9 +-- app/src/main/res/layout/dialog_loop.xml | 9 +-- .../main/res/layout/dialog_profileswitch.xml | 9 +-- app/src/main/res/layout/dialog_tempbasal.xml | 9 +-- app/src/main/res/layout/dialog_temptarget.xml | 9 +-- app/src/main/res/layout/dialog_treatment.xml | 10 +--- app/src/main/res/layout/dialog_wizard.xml | 9 +-- app/src/main/res/layout/dialog_wizardinfo.xml | 9 +-- .../overview_editquickwizard_dialog.xml | 7 +-- .../dialogs/ChooseOperationDialog.kt | 2 + .../res/layout/automation_dialog_action.xml | 9 +-- .../automation_dialog_choose_action.xml | 10 ++-- .../automation_dialog_choose_operation.xml | 9 +-- .../automation_dialog_choose_trigger.xml | 9 +-- .../layout/automation_dialog_edit_trigger.xml | 9 +-- .../res/layout/automation_dialog_event.xml | 9 +-- .../androidaps/dialogs/BolusProgressDialog.kt | 16 ----- .../dialogs/DialogFragmentWithDate.kt | 11 ---- core/src/main/res/drawable-hdpi/dialog.xml | 33 ++++------ .../main/res/drawable-hdpi/dialog_header.xml | 12 ++++ .../drawable/ic_trending_flat_white_48dp.xml | 13 ++-- .../main/res/layout/dialog_alert_custom.xml | 10 ++-- .../main/res/layout/dialog_bolusprogress.xml | 8 +-- core/src/main/res/layout/dialog_error.xml | 8 +-- .../main/res/layout/dialog_profileviewer.xml | 9 +-- core/src/main/res/values-night/styles.xml | 1 - core/src/main/res/values/attrs.xml | 2 - core/src/main/res/values/colors.xml | 2 +- core/src/main/res/values/styles.xml | 14 ++++- .../layout/danars_pairing_progress_dialog.xml | 60 +++++++++---------- 46 files changed, 164 insertions(+), 238 deletions(-) create mode 100644 core/src/main/res/drawable-hdpi/dialog_header.xml diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt index 20a0de18de..bd5daaf965 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CalibrationDialog.kt @@ -27,6 +27,7 @@ import javax.inject.Inject class CalibrationDialog : DialogFragmentWithDate() { @Inject lateinit var injector: HasAndroidInjector + @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var xDripBroadcast: XDripBroadcast @Inject lateinit var uel: UserEntryLogger diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt index ce39706342..ff4f64e0f4 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CarbsDialog.kt @@ -41,6 +41,7 @@ import kotlin.math.max class CarbsDialog : DialogFragmentWithDate() { @Inject lateinit var ctx: Context + @Inject lateinit var rh: ResourceHelper @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var defaultValueHelper: DefaultValueHelper @Inject lateinit var profileFunction: ProfileFunction diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt index d466956251..03cb215a7f 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/CareDialog.kt @@ -41,6 +41,7 @@ class CareDialog : DialogFragmentWithDate() { @Inject lateinit var injector: HasAndroidInjector @Inject lateinit var ctx: Context + @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var translator: Translator @Inject lateinit var uel: UserEntryLogger diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt index 0f76468de0..7d4525bd8f 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ExtendedBolusDialog.kt @@ -35,6 +35,7 @@ import kotlin.math.abs class ExtendedBolusDialog : DialogFragmentWithDate() { @Inject lateinit var ctx: Context + @Inject lateinit var rh: ResourceHelper @Inject lateinit var constraintChecker: ConstraintChecker @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var activePlugin: ActivePlugin diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt index 7dd9f8eb1b..cb26aa1a5a 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/FillDialog.kt @@ -41,6 +41,7 @@ import kotlin.math.abs class FillDialog : DialogFragmentWithDate() { @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var rh: ResourceHelper @Inject lateinit var ctx: Context @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var activePlugin: ActivePlugin diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt index d9b2b027d8..a4172a8727 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/InsulinDialog.kt @@ -44,6 +44,7 @@ import kotlin.math.max class InsulinDialog : DialogFragmentWithDate() { @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var rh: ResourceHelper @Inject lateinit var defaultValueHelper: DefaultValueHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var commandQueue: CommandQueue diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt index 935d511153..41efc7e42c 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/ProfileSwitchDialog.kt @@ -46,6 +46,7 @@ import kotlin.collections.ArrayList class ProfileSwitchDialog : DialogFragmentWithDate() { + @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var repository: AppRepository diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt index f6d23f5fab..aba8fb579f 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempBasalDialog.kt @@ -33,6 +33,7 @@ import kotlin.math.abs class TempBasalDialog : DialogFragmentWithDate() { @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueue diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt index a4edaa61ff..dba15262a5 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TempTargetDialog.kt @@ -42,6 +42,7 @@ import javax.inject.Inject class TempTargetDialog : DialogFragmentWithDate() { @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var rh: ResourceHelper @Inject lateinit var profileFunction: ProfileFunction @Inject lateinit var defaultValueHelper: DefaultValueHelper @Inject lateinit var uel: UserEntryLogger diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt index 8083f3c3d5..55fd9a773b 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/TreatmentDialog.kt @@ -43,6 +43,7 @@ import kotlin.math.abs class TreatmentDialog : DialogFragmentWithDate() { @Inject lateinit var constraintChecker: ConstraintChecker + @Inject lateinit var rh: ResourceHelper @Inject lateinit var activePlugin: ActivePlugin @Inject lateinit var commandQueue: CommandQueue @Inject lateinit var ctx: Context diff --git a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt index de01e72d60..9af21b0194 100644 --- a/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt +++ b/app/src/main/java/info/nightscout/androidaps/dialogs/WizardDialog.kt @@ -2,9 +2,6 @@ package info.nightscout.androidaps.dialogs import android.annotation.SuppressLint import android.content.Context -import android.graphics.PorterDuff -import android.graphics.PorterDuffColorFilter -import android.graphics.drawable.Drawable import android.os.Bundle import android.text.Editable import android.text.TextWatcher @@ -16,7 +13,6 @@ import android.view.WindowManager import android.widget.AdapterView import android.widget.ArrayAdapter import android.widget.CompoundButton -import androidx.core.content.ContextCompat import androidx.fragment.app.FragmentManager import dagger.android.HasAndroidInjector import dagger.android.support.DaggerDialogFragment @@ -124,11 +120,6 @@ class WizardDialog : DaggerDialogFragment() { isCancelable = true dialog?.setCanceledOnTouchOutside(false) - val drawable: Drawable? = context?.let { ContextCompat.getDrawable(it, info.nightscout.androidaps.core.R.drawable.dialog) } - drawable?.setColorFilter(PorterDuffColorFilter((context?.let { rh.gac(it, info.nightscout.androidaps.core.R.attr.dialogFragmentBackground) }!!), PorterDuff.Mode.SRC_IN)) - - dialog?.window?.setBackgroundDrawable(drawable) - _binding = DialogWizardBinding.inflate(inflater, container, false) return binding.root } diff --git a/app/src/main/res/layout/dialog_calibration.xml b/app/src/main/res/layout/dialog_calibration.xml index 45c65d5d8f..e52e675e3c 100644 --- a/app/src/main/res/layout/dialog_calibration.xml +++ b/app/src/main/res/layout/dialog_calibration.xml @@ -2,11 +2,10 @@ - + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> @@ -11,12 +12,10 @@ android:orientation="vertical"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> - - - - - - - - - \ No newline at end of file + + + + + + + + + diff --git a/core/src/main/res/drawable-hdpi/dialog_header.xml b/core/src/main/res/drawable-hdpi/dialog_header.xml new file mode 100644 index 0000000000..566a450adc --- /dev/null +++ b/core/src/main/res/drawable-hdpi/dialog_header.xml @@ -0,0 +1,12 @@ + + + + + + + + + + diff --git a/core/src/main/res/drawable/ic_trending_flat_white_48dp.xml b/core/src/main/res/drawable/ic_trending_flat_white_48dp.xml index a9bd780027..4e09f3b696 100644 --- a/core/src/main/res/drawable/ic_trending_flat_white_48dp.xml +++ b/core/src/main/res/drawable/ic_trending_flat_white_48dp.xml @@ -1,5 +1,10 @@ - - + + diff --git a/core/src/main/res/layout/dialog_alert_custom.xml b/core/src/main/res/layout/dialog_alert_custom.xml index 3c2df5b99b..d14304e946 100644 --- a/core/src/main/res/layout/dialog_alert_custom.xml +++ b/core/src/main/res/layout/dialog_alert_custom.xml @@ -4,17 +4,15 @@ --> + android:layout_height="match_parent"> + android:layout_gravity="center" > + android:layout_gravity="center"> + android:layout_gravity="center"> + android:layout_gravity="center"> @color/black - @color/background_dark 12dp diff --git a/core/src/main/res/values/attrs.xml b/core/src/main/res/values/attrs.xml index 1bd7fb7ff7..d13f25f935 100644 --- a/core/src/main/res/values/attrs.xml +++ b/core/src/main/res/values/attrs.xml @@ -86,7 +86,5 @@ - - \ No newline at end of file diff --git a/core/src/main/res/values/colors.xml b/core/src/main/res/values/colors.xml index 3d7f2cb4a1..e81a1bfbab 100644 --- a/core/src/main/res/values/colors.xml +++ b/core/src/main/res/values/colors.xml @@ -52,7 +52,7 @@ #505050 - #303030 + #CCCCCC #121212 #FFFFFF #FFFFFF diff --git a/core/src/main/res/values/styles.xml b/core/src/main/res/values/styles.xml index 470ce43d08..6e65161349 100644 --- a/core/src/main/res/values/styles.xml +++ b/core/src/main/res/values/styles.xml @@ -113,7 +113,6 @@ @color/white - @color/background_light 12dp @@ -149,6 +148,19 @@ true + + + +