From 7f0a87742a2561c94d6fc3a53d1cc04be2e8776a Mon Sep 17 00:00:00 2001 From: Viktor De Pasquale Date: Sun, 20 Oct 2019 17:26:00 +0200 Subject: [PATCH] Fixed design issues in dialogs Dark theme not being properly implemented Icons were not set --- .../magisk/utils/DataBindingAdapters.kt | 6 + .../main/res/layout/dialog_magisk_base.xml | 155 +----------------- 2 files changed, 11 insertions(+), 150 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt b/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt index be15e5fce..75032ff20 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt +++ b/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt @@ -27,6 +27,7 @@ import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.LinearLayoutManager import androidx.recyclerview.widget.RecyclerView import androidx.viewpager.widget.ViewPager +import com.google.android.material.button.MaterialButton import com.google.android.material.floatingactionbutton.FloatingActionButton import com.google.android.material.navigation.NavigationView import com.topjohnwu.magisk.R @@ -377,4 +378,9 @@ fun View.rotationTo(value: Int) { .rotation(value.toFloat()) .setInterpolator(FastOutSlowInInterpolator()) .start() +} + +@BindingAdapter("app:icon") +fun MaterialButton.setIconRes(res: Int) { + setIconResource(res) } \ No newline at end of file diff --git a/app/src/main/res/layout/dialog_magisk_base.xml b/app/src/main/res/layout/dialog_magisk_base.xml index f18c144b6..0823d5323 100644 --- a/app/src/main/res/layout/dialog_magisk_base.xml +++ b/app/src/main/res/layout/dialog_magisk_base.xml @@ -16,7 +16,7 @@ android:layout_height="match_parent"> - - gone="@{data.buttonPositive.icon == 0 && data.buttonPositive.title.length == - 0}" - - - - - gone="@{data.buttonNeutral.icon == 0 && data.buttonNeutral.title.length == - 0}" - - - - - gone="@{data.buttonNegative.icon == 0 && data.buttonNegative.title.length == - 0}" - - - - - gone="@{data.buttonIDGAF.icon == 0 && data.buttonIDGAF.title.length == 0}" - - - -