convert SingleClickButton to Materialbutton

This commit is contained in:
osodebailar 2022-04-18 18:24:57 +02:00
parent 4398a433c3
commit b53d789679
13 changed files with 66 additions and 54 deletions

View file

@ -43,7 +43,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/profile_switch"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_profileswitch"
@ -58,7 +58,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/temp_target"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_temptarget_high"
@ -73,7 +73,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/set_temp_basal"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_starttempbasal"
@ -88,7 +88,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/cancel_temp_basal"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_cancelbasal"
@ -104,7 +104,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/extended_bolus"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_startextbolus"
@ -119,7 +119,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/extended_bolus_cancel"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_actions_cancelextbolus"
@ -190,7 +190,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/bg_check"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_bgcheck"
@ -205,7 +205,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/fill"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_cp_pump_canula"
@ -220,7 +220,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/cgm_sensor_insert"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_cgm_insert"
@ -235,7 +235,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/pump_battery_change"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_pump_battery"
@ -250,7 +250,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/note"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_note"
@ -265,7 +265,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/exercise"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_exercise"
@ -280,7 +280,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/announcement"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_announcement"
@ -295,7 +295,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/question"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:drawableTop="@drawable/ic_cp_question"
@ -343,7 +343,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/history_browser"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pump_history"
@ -358,7 +358,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/tdd_stats"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_cp_stats"

View file

@ -178,7 +178,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/copy_to_local_profile"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_clone_48"
@ -257,7 +257,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/compare_profiles"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="@drawable/ic_compare_profiles"

View file

@ -97,7 +97,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/otp_reset"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_marginStart="10dp"

View file

@ -72,7 +72,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_closeloop"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
@ -88,7 +88,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_lgsloop"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
@ -104,7 +104,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_openloop"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
@ -120,7 +120,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_enable"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
@ -136,7 +136,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disable"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_gravity="center"
@ -180,7 +180,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_resume"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_gravity="center"
@ -203,7 +203,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_suspend_1h"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -217,7 +217,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_suspend_2h"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -232,7 +232,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_suspend_3h"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -247,7 +247,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_suspend_10h"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -289,7 +289,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_reconnect"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
@ -312,7 +312,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_15m"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -326,7 +326,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_30m"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -340,7 +340,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_1h"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -354,7 +354,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_2h"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -368,7 +368,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/overview_disconnect_3h"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"

View file

@ -72,7 +72,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/reusebutton"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:drawablePadding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View file

@ -140,7 +140,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/target_cancel"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -155,7 +155,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/eating_soon"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -170,7 +170,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/activity"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -185,7 +185,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/hypo"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="0.5"

View file

@ -8,7 +8,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/refresh_from_nightscout"
style="?android:attr/buttonStyle"
style="@style/GrayButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"

View file

@ -9,7 +9,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/accept_temp_button"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="5dp"
@ -38,7 +38,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/treatment_button"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -52,7 +52,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/insulin_button"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -65,7 +65,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/carbs_button"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -78,7 +78,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/wizard_button"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -91,7 +91,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/calibration_button"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -105,7 +105,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/cgm_button"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"
@ -119,7 +119,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/quick_wizard_button"
style="?android:attr/buttonStyle"
style="@style/ButtonSmallFontStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_marginEnd="-4dp"

View file

@ -587,7 +587,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/combo_refresh_button"
style="@style/ButtonSmallFontStyle"
style="@style/GrayButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.5"

View file

@ -2,12 +2,11 @@ package info.nightscout.androidaps.utils.ui
import android.content.Context
import android.util.AttributeSet
import androidx.appcompat.R
import androidx.appcompat.widget.AppCompatButton
import info.nightscout.androidaps.core.R
import info.nightscout.shared.logging.StacktraceLoggerWrapper
import org.slf4j.Logger
class SingleClickButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.attr.buttonStyle) : AppCompatButton(context, attrs, defStyleAttr) {
class SingleClickButton @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = R.style.Widget_MaterialComponents_Button) : com.google.android.material.button.MaterialButton(context, attrs, defStyleAttr) {
override fun performClick(): Boolean = guardClick { super.performClick() }
override fun callOnClick(): Boolean = guardClick { super.callOnClick() }

View file

@ -35,7 +35,7 @@
<color name="tabSelectedText">@color/black_alpha_90</color>
<!-- Buttons-->
<color name="buttonBackground">#B2B2B2</color>
<color name="buttonBackground">#BABABA</color>
<color name="buttonText">#000000</color>
<color name="okButtonText">@color/colorAccent</color>
<color name="okButtonSelected">#33969696</color>

View file

@ -47,6 +47,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_activate_pod"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_activate_pod"
@ -67,6 +68,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_deactivate_pod"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_deactivate_pod"
@ -95,6 +97,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_play_test_beep"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_play_test_beep"
@ -108,6 +111,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_pod_history"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_pod_history"
@ -128,6 +132,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_discard_pod"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_discard_pod"

View file

@ -75,6 +75,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_activate_pod"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_activate_pod"
@ -95,6 +96,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_deactivate_pod"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_deactivate_pod"
@ -123,6 +125,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_play_test_beep"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_play_test_beep"
@ -143,6 +146,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_discard_pod"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_discard_pod"
@ -180,6 +184,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_reset_rileylink_config"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_activity_reset_rileylink_config"
@ -200,6 +205,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_pod_history"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_pod_history"
@ -227,6 +233,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_rileylink_stats"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_rl_stats"
@ -247,6 +254,7 @@
<info.nightscout.androidaps.utils.ui.SingleClickButton
android:id="@+id/button_pulse_log"
style="@style/ButtonSmallFontStyle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableTop="@drawable/ic_pod_management_pulse_log"