mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 00:07:39 +00:00
Fixed design issues in dialogs
Dark theme not being properly implemented Icons were not set
This commit is contained in:
parent
47e236788c
commit
7f0a87742a
@ -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)
|
||||
}
|
@ -16,7 +16,7 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/Widget.Card"
|
||||
style="?styleCardElevated"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
app:cardUseCompatPadding="true"
|
||||
@ -130,16 +130,6 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_scroll" />
|
||||
|
||||
<View
|
||||
android:id="@+id/dialog_base_button_0_divider"
|
||||
style="@style/Widget.Divider.Horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_space" />
|
||||
gone="@{data.buttonPositive.icon == 0 && data.buttonPositive.title.length ==
|
||||
0}"
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/dialog_base_button_1"
|
||||
style="?styleButtonText"
|
||||
@ -152,45 +142,10 @@
|
||||
android:text="@{data.buttonPositive.title}"
|
||||
app:icon="@{data.buttonPositive.icon}"
|
||||
app:iconGravity="textStart"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_0_divider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_space"
|
||||
tools:icon="@drawable/ic_bug_md2"
|
||||
tools:text="Button 1" />
|
||||
|
||||
<!--<LinearLayout
|
||||
style="@style/Widget.DialogButton"
|
||||
gone="@{data.buttonPositive.icon == 0 && data.buttonPositive.title.length == 0}"
|
||||
android:clickable="@{data.buttonPositive.isEnabled()}"
|
||||
android:filterTouchesWhenObscured="true"
|
||||
android:focusable="@{data.buttonPositive.isEnabled()}"
|
||||
android:onClick="@{() -> data.buttonPositive.clicked()}"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_0_divider">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
style="@style/Widget.Icon.DialogButton"
|
||||
gone="@{data.buttonPositive.icon == 0}"
|
||||
srcCompat="@{data.buttonPositive.icon}"
|
||||
tools:src="@drawable/ic_delete" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/Widget.Text.DialogButton"
|
||||
gone="@{data.buttonPositive.title.length == 0}"
|
||||
android:text="@{data.buttonPositive.title}"
|
||||
tools:text="Button 1" />
|
||||
|
||||
</LinearLayout>-->
|
||||
|
||||
<View
|
||||
android:id="@+id/dialog_base_button_1_divider"
|
||||
style="@style/Widget.Divider.Horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_1" />
|
||||
gone="@{data.buttonNeutral.icon == 0 && data.buttonNeutral.title.length ==
|
||||
0}"
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/dialog_base_button_2"
|
||||
style="?styleButtonText"
|
||||
@ -203,46 +158,10 @@
|
||||
android:text="@{data.buttonNeutral.title}"
|
||||
app:icon="@{data.buttonNeutral.icon}"
|
||||
app:iconGravity="textStart"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_1_divider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_1"
|
||||
tools:icon="@drawable/ic_bug_md2"
|
||||
tools:text="Button 1" />
|
||||
|
||||
<!--<LinearLayout
|
||||
android:id="@+id/dialog_base_button_2"
|
||||
style="@style/Widget.DialogButton"
|
||||
gone="@{data.buttonNeutral.icon == 0 && data.buttonNeutral.title.length == 0}"
|
||||
android:clickable="@{data.buttonNeutral.isEnabled()}"
|
||||
android:filterTouchesWhenObscured="true"
|
||||
android:focusable="@{data.buttonNeutral.isEnabled()}"
|
||||
android:onClick="@{() -> data.buttonNeutral.clicked()}"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_1_divider">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
style="@style/Widget.Icon.DialogButton"
|
||||
gone="@{data.buttonNeutral.icon == 0}"
|
||||
srcCompat="@{data.buttonNeutral.icon}"
|
||||
tools:src="@drawable/ic_delete" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/Widget.Text.DialogButton"
|
||||
gone="@{data.buttonNeutral.title.length == 0}"
|
||||
android:text="@{data.buttonNeutral.title}"
|
||||
tools:text="Button 2" />
|
||||
|
||||
</LinearLayout>-->
|
||||
|
||||
<View
|
||||
android:id="@+id/dialog_base_button_2_divider"
|
||||
style="@style/Widget.Divider.Horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_2" />
|
||||
gone="@{data.buttonNegative.icon == 0 && data.buttonNegative.title.length ==
|
||||
0}"
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/dialog_base_button_3"
|
||||
style="?styleButtonText"
|
||||
@ -254,46 +173,10 @@
|
||||
android:onClick="@{() -> data.buttonNegative.clicked()}"
|
||||
android:text="@{data.buttonNegative.title}"
|
||||
app:icon="@{data.buttonNegative.icon}"
|
||||
app:iconGravity="textStart"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_2_divider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_2"
|
||||
tools:icon="@drawable/ic_bug_md2"
|
||||
tools:text="Button 1" />
|
||||
|
||||
<!--<LinearLayout
|
||||
android:id="@+id/dialog_base_button_3"
|
||||
style="@style/Widget.DialogButton"
|
||||
gone="@{data.buttonNegative.icon == 0 && data.buttonNegative.title.length == 0}"
|
||||
android:clickable="@{data.buttonNegative.isEnabled()}"
|
||||
android:filterTouchesWhenObscured="true"
|
||||
android:focusable="@{data.buttonNegative.isEnabled()}"
|
||||
android:onClick="@{() -> data.buttonNegative.clicked()}"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_2_divider">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
style="@style/Widget.Icon.DialogButton"
|
||||
gone="@{data.buttonNegative.icon == 0}"
|
||||
srcCompat="@{data.buttonNegative.icon}"
|
||||
tools:src="@drawable/ic_delete" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/Widget.Text.DialogButton"
|
||||
gone="@{data.buttonNegative.title.length == 0}"
|
||||
android:text="@{data.buttonNegative.title}"
|
||||
tools:text="Button 3" />
|
||||
|
||||
</LinearLayout>-->
|
||||
|
||||
<View
|
||||
android:id="@+id/dialog_base_button_3_divider"
|
||||
style="@style/Widget.Divider.Horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_3" />
|
||||
gone="@{data.buttonIDGAF.icon == 0 && data.buttonIDGAF.title.length == 0}"
|
||||
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/dialog_base_button_4"
|
||||
style="?styleButtonText"
|
||||
@ -305,38 +188,10 @@
|
||||
android:onClick="@{() -> data.buttonIDGAF.clicked()}"
|
||||
android:text="@{data.buttonIDGAF.title}"
|
||||
app:icon="@{data.buttonIDGAF.icon}"
|
||||
app:iconGravity="textStart"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_3_divider"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_3"
|
||||
tools:icon="@drawable/ic_bug_md2"
|
||||
tools:text="Button 1" />
|
||||
|
||||
<!--<LinearLayout
|
||||
android:id="@+id/dialog_base_button_4"
|
||||
style="@style/Widget.DialogButton"
|
||||
gone="@{data.buttonIDGAF.icon == 0 && data.buttonIDGAF.title.length == 0}"
|
||||
android:clickable="@{data.buttonIDGAF.isEnabled()}"
|
||||
android:filterTouchesWhenObscured="true"
|
||||
android:focusable="@{data.buttonIDGAF.isEnabled()}"
|
||||
android:onClick="@{() -> data.buttonIDGAF.clicked()}"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/dialog_base_button_3_divider">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
style="@style/Widget.Icon.DialogButton"
|
||||
gone="@{data.buttonIDGAF.icon == 0}"
|
||||
srcCompat="@{data.buttonIDGAF.icon}"
|
||||
tools:src="@drawable/ic_delete" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/Widget.Text.DialogButton"
|
||||
gone="@{data.buttonIDGAF.title.length == 0}"
|
||||
android:text="@{data.buttonIDGAF.title}"
|
||||
tools:text="Button 4" />
|
||||
|
||||
</LinearLayout>-->
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
Loading…
x
Reference in New Issue
Block a user