Fixed spinner + improved ripple (#310)

This commit is contained in:
Bram van de Kerkhof 2016-05-25 00:09:24 +02:00 committed by inorichi
parent 6af78418a4
commit 26f4f53ec2
10 changed files with 41 additions and 35 deletions

View file

@ -164,7 +164,7 @@ class CatalogueFragment : BaseRxFragment<CataloguePresenter>(), FlexibleViewHold
val spinnerAdapter = ArrayAdapter(themedContext,
android.R.layout.simple_spinner_item, presenter.sources)
spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
spinnerAdapter.setDropDownViewResource(R.layout.spinner_item)
val onItemSelected = object : AdapterView.OnItemSelectedListener {
override fun onItemSelected(parent: AdapterView<*>, view: View?, position: Int, id: Long) {

View file

@ -1,16 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorAccentDark"
>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/rippleColorDark">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/selectorColorDark" />
<color android:color="@color/rippleColorDark"/>
</item>
<item android:state_activated="true">
<color android:color="@color/selectorColorDark" />
<color android:color="@color/rippleColorDark"/>
</item>
<item>
@ -18,6 +16,4 @@
</item>
</selector>
</item>
</ripple>

View file

@ -1,16 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/colorAccentLight"
>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/rippleColorLight">
<item>
<selector>
<item android:state_selected="true">
<color android:color="@color/selectorColorLight" />
<color android:color="@color/rippleColorLight"/>
</item>
<item android:state_activated="true">
<color android:color="@color/selectorColorLight" />
<color android:color="@color/rippleColorLight"/>
</item>
<item>
@ -18,6 +16,4 @@
</item>
</selector>
</item>
</ripple>

View file

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<selector android:exitFadeDuration="@android:integer/config_longAnimTime"
xmlns:android="http://schemas.android.com/apk/res/android">
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_longAnimTime">
<item android:state_focused="true" android:drawable="@color/selectorColorDark"/>
<item android:state_pressed="true" android:drawable="@color/selectorColorDark"/>
<item android:state_activated="true" android:drawable="@color/selectorColorDark"/>
<item android:drawable="@color/rippleColorDark" android:state_focused="true"/>
<item android:drawable="@color/rippleColorDark" android:state_pressed="true"/>
<item android:drawable="@color/rippleColorDark" android:state_activated="true"/>
<item android:drawable="@color/dialogDark"/>
</selector>

View file

@ -8,12 +8,12 @@
<!--<item android:drawable="?android:attr/colorBackground"/>-->
<!--</selector>-->
<selector android:exitFadeDuration="@android:integer/config_longAnimTime"
xmlns:android="http://schemas.android.com/apk/res/android">
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_longAnimTime">
<item android:state_focused="true" android:drawable="@color/selectorColorLight"/>
<item android:state_pressed="true" android:drawable="@color/selectorColorLight"/>
<item android:state_activated="true" android:drawable="@color/selectorColorLight"/>
<item android:drawable="@color/rippleColorLight" android:state_focused="true"/>
<item android:drawable="@color/rippleColorLight" android:state_pressed="true"/>
<item android:drawable="@color/rippleColorLight" android:state_activated="true"/>
<item android:drawable="@color/dialogLight"/>
</selector>

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="@style/Theme.Widget.SpinnerItem"
android:layout_width="match_parent"
android:layout_height="?attr/dropdownListPreferredItemHeight"
android:ellipsize="marquee"
android:singleLine="true"/>

View file

@ -21,4 +21,5 @@
<attr name="selectable_list_drawable" format="reference|integer" />
<attr name="selectable_library_drawable" format="reference|integer"/>
<attr name="divider_drawable" format="reference|integer" />
<attr name="text_color_primary" format="reference|integer"/>
</resources>

View file

@ -10,6 +10,8 @@
<color name="textColorSecondaryLight">@color/md_black_1000_54</color>
<color name="textColorHintLight">@color/md_black_1000_38</color>
<color name="dividerLight">@color/md_black_1000_12</color>
<color name="rippleColorLight">@color/md_black_1000_12</color>
<color name="statusBarLight">@color/md_grey_300</color>
<color name="appBarLight">@color/md_grey_100</color>
@ -24,6 +26,7 @@
<color name="textColorSecondaryDark">@color/md_white_1000_70</color>
<color name="textColorHintDark">@color/md_white_1000_50</color>
<color name="dividerDark">@color/md_white_1000_12</color>
<color name="rippleColorDark">@color/md_white_1000_20</color>
<color name="statusBarDark">@color/md_black_1000</color>
<color name="appBarDark">@color/md_grey_900</color>
@ -45,6 +48,7 @@
<color name="md_white_1000">#FFFFFFFF</color>
<color name="md_white_1000_70">#B3FFFFFF</color>
<color name="md_white_1000_50">#80FFFFFF</color>
<color name="md_white_1000_20">#33FFFFFF</color>
<color name="md_white_1000_12">#1FFFFFFF</color>
<!-- Material Design Colors -->

View file

@ -4,9 +4,7 @@
<!--========-->
<!--Toolbars-->
<!--========-->
<style name="Theme.ActionBar" parent="@style/ThemeOverlay.AppCompat.ActionBar">
<item name="android:spinnerDropDownItemStyle">@style/ActionBarSpinnerItem</item>
</style>
<style name="Theme.ActionBar" parent="@style/ThemeOverlay.AppCompat.ActionBar"/>
<style name="Theme.ActionBar.Light" parent="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="popupTheme">@style/ThemeOverlay.AppCompat.Light</item>
@ -160,6 +158,12 @@
<item name="buttonTint">@color/md_white_1000</item>
</style>
<style name="Theme.Widget.SpinnerItem" parent="Widget.AppCompat.DropDownItem.Spinner">
<item name="android:textColor">?attr/text_color_primary</item>
<item name="android:background">?attr/selectable_list_drawable</item>
</style>
<!--===-->
<!--OLD-->
<!--===-->
@ -172,11 +176,6 @@
<item name="android:textColor">?android:attr/textColorPrimary</item>
<item name="android:textAppearance">@style/TextAppearance.AppCompat.Title</item>
</style>
<style name="ActionBarSpinnerItem" parent="@style/Widget.AppCompat.Light.DropDownItem.Spinner">
<item name="android:textColor">@color/textColorPrimaryLight</item>
<item name="android:background">@drawable/list_item_selector_light</item>
</style>
<style name="FilePickerTheme" parent="NNF_BaseTheme.Light">
<item name="colorPrimary">@color/colorPrimary</item>

View file

@ -32,6 +32,7 @@
<item name="selectable_list_drawable">@drawable/list_item_selector_light</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_light</item>
<item name="divider_drawable">@drawable/line_divider_light</item>
<item name="text_color_primary">@color/textColorPrimaryLight</item>
</style>
<style name="Theme.Tachiyomi" parent="Theme.Base">
@ -66,6 +67,7 @@
<item name="selectable_list_drawable">@drawable/list_item_selector_dark</item>
<item name="selectable_library_drawable">@drawable/library_item_selector_dark</item>
<item name="divider_drawable">@drawable/line_divider_dark</item>
<item name="text_color_primary">@color/textColorPrimaryDark</item>
</style>
<style name="Theme.Tachiyomi.Dark" parent="Theme.Base.Dark">