Cleanup some styles

This commit is contained in:
topjohnwu 2020-08-29 21:42:05 -07:00
parent e0642b018d
commit 782adc9a9f
8 changed files with 3 additions and 101 deletions

View File

@ -255,29 +255,6 @@ fun TextView.setStrikeThroughEnabled(useStrikeThrough: Boolean) {
} }
} }
interface OnPopupMenuItemClickListener {
fun onMenuItemClick(itemId: Int)
}
@BindingAdapter("popupMenu", "popupMenuOnClickListener", requireAll = false)
fun View.setPopupMenu(popupMenu: Int, listener: OnPopupMenuItemClickListener) {
val menu = tag as? PopupMenu ?: let {
val themeWrapper = ContextThemeWrapper(context, R.style.Foundation_PopupMenu)
PopupMenu(themeWrapper, this)
}
tag = menu.apply {
this.menu.clear()
menuInflater.inflate(popupMenu, this.menu)
setOnMenuItemClickListener {
listener.onMenuItemClick(it.itemId)
true
}
}
setOnClickListener {
(tag as PopupMenu).show()
}
}
@BindingAdapter("spanCount") @BindingAdapter("spanCount")
fun RecyclerView.setSpanCount(count: Int) { fun RecyclerView.setSpanCount(count: Int) {
when (val lama = layoutManager) { when (val lama = layoutManager) {

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?colorPrimary">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="?colorPrimary" />
</shape>
</item>
</ripple>

View File

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="?colorPrimary" />

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="@color/defColorPrimaryVariant" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
</selector>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape android:shape="rectangle">
<corners android:radius="@dimen/r1" />
<solid android:color="@color/defColorPrimaryVariant" />
</shape>
</item>
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/transparent" />
</shape>
</item>
</selector>

View File

@ -95,7 +95,6 @@
<CheckBox <CheckBox
gone="@{Info.isSAR}" gone="@{Info.isSAR}"
style="@style/WidgetFoundation.Checkbox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="@={Config.keepVerity}" android:checked="@={Config.keepVerity}"
@ -104,7 +103,6 @@
<CheckBox <CheckBox
gone="@{Info.isFBE}" gone="@{Info.isFBE}"
style="@style/WidgetFoundation.Checkbox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="@={Config.keepEnc}" android:checked="@={Config.keepEnc}"
@ -113,7 +111,6 @@
<CheckBox <CheckBox
gone="@{Info.ramdisk}" gone="@{Info.ramdisk}"
style="@style/WidgetFoundation.Checkbox"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:checked="@={Config.recovery}" android:checked="@={Config.recovery}"
@ -188,7 +185,6 @@
<RadioButton <RadioButton
android:id="@+id/method_download" android:id="@+id/method_download"
style="@style/WidgetFoundation.RadioButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/download_zip_only" android:text="@string/download_zip_only"
@ -196,14 +192,12 @@
<RadioButton <RadioButton
android:id="@+id/method_patch" android:id="@+id/method_patch"
style="@style/WidgetFoundation.RadioButton"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/select_patch_file" /> android:text="@string/select_patch_file" />
<RadioButton <RadioButton
android:id="@+id/method_direct" android:id="@+id/method_direct"
style="@style/WidgetFoundation.RadioButton"
gone="@{!viewModel.rooted}" gone="@{!viewModel.rooted}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -211,7 +205,6 @@
<RadioButton <RadioButton
android:id="@+id/method_inactive_slot" android:id="@+id/method_inactive_slot"
style="@style/WidgetFoundation.RadioButton"
gone="@{!viewModel.isRooted || !Info.isAB}" gone="@{!viewModel.isRooted || !Info.isAB}"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -7,7 +7,7 @@
<style name="SplashTheme" parent="SplashThemeBase" /> <style name="SplashTheme" parent="SplashThemeBase" />
<style name="Foundation" parent="Theme.MaterialComponents.Light.NoActionBar"> <style name="Foundation" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<item name="android:windowBackground">?colorSurface</item> <item name="android:windowBackground">?colorSurface</item>
</style> </style>
@ -24,29 +24,18 @@
</style> </style>
<!--endregion--> <!--endregion-->
<style name="Foundation.PopupMenu" parent="Widget.AppCompat.PopupMenu"> <style name="Foundation.PopupMenu" parent="Widget.MaterialComponents.PopupMenu">
<item name="android:textColor">?colorOnSurface</item>
<item name="android:itemBackground">?colorSurfaceVariant</item>
<item name="android:itemTextAppearance">@style/AppearanceFoundation.Caption</item> <item name="android:itemTextAppearance">@style/AppearanceFoundation.Caption</item>
<item name="android:textStyle">bold</item> <item name="android:textStyle">bold</item>
</style> </style>
<style name="Foundation.Base" parent="Foundation.Compat"> <style name="Foundation.Default" parent="Foundation.Compat">
<item name="android:fontFamily">@font/exo</item> <item name="android:fontFamily">@font/exo</item>
<item name="android:includeFontPadding">false</item> <item name="android:includeFontPadding">false</item>
<!--///-->
<item name="selectableItemBackground">@drawable/bg_selectable</item>
<item name="selectableItemBackgroundBorderless">@drawable/bg_selectable_borderless</item>
<item name="actionBarSize">@dimen/internal_action_bar_size</item> <item name="actionBarSize">@dimen/internal_action_bar_size</item>
<item name="popupMenuStyle">@style/Foundation.PopupMenu</item> <item name="popupMenuStyle">@style/Foundation.PopupMenu</item>
</style> </style>
<style name="Foundation.Default" parent="Foundation.Base">
<item name="android:windowBackground">?colorSurface</item>
</style>
<style name="Foundation.Floating" parent="Empty"> <style name="Foundation.Floating" parent="Empty">
<item name="android:windowIsFloating">true</item> <item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item> <item name="android:windowIsTranslucent">true</item>

View File

@ -166,22 +166,6 @@
<item name="tint">@color/color_error_transient</item> <item name="tint">@color/color_error_transient</item>
</style> </style>
<style name="WidgetFoundation.Checkbox" parent="Widget.AppCompat.CompoundButton.CheckBox">
<item name="android:textColor">?attr/colorOnSurface</item>
<item name="android:textAppearance">@style/AppearanceFoundation.Body</item>
<item name="android:paddingStart">@dimen/l1</item>
<item name="android:paddingEnd">@dimen/l1</item>
<item name="tint">?colorPrimary</item>
</style>
<style name="WidgetFoundation.RadioButton" parent="Widget.AppCompat.CompoundButton.RadioButton">
<item name="android:textColor">?attr/colorOnSurface</item>
<item name="android:textAppearance">@style/AppearanceFoundation.Body</item>
<item name="android:paddingStart">@dimen/l1</item>
<item name="android:paddingEnd">@dimen/l1</item>
<item name="tint">?colorPrimary</item>
</style>
<style name="WidgetFoundation.ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal"> <style name="WidgetFoundation.ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:indeterminate">false</item> <item name="android:indeterminate">false</item>
<item name="android:layout_height">4dp</item> <item name="android:layout_height">4dp</item>