1
0
Fork 0
mirror of https://github.com/MatomoCamp/matomocamp-companion-android.git synced 2024-09-19 16:13:46 +02:00

Improved ListView styling by using built-in attribute listChoiceBackgroundIndicator

This commit is contained in:
Christophe Beyls 2015-12-26 17:45:30 +01:00
parent f31af2f492
commit 63bd76f5ed
4 changed files with 25 additions and 6 deletions

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Improved item background selector which looks more material-ish (no blue color) -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/transparent" android:state_window_focused="false"/>
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:drawable="@drawable/abc_list_selector_disabled_holo_dark" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/abc_list_selector_disabled_holo_dark" android:state_enabled="false" android:state_focused="true"/>
<item android:drawable="@drawable/list_selector_background_transition_holo_dark" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/list_selector_background_transition_holo_dark" android:state_focused="false" android:state_pressed="true"/>
<item android:drawable="@drawable/list_focused_holo_dark" android:state_focused="true"/>
</selector>

View file

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Improved item background selector which looks more material-ish (no blue color) -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/transparent" android:state_window_focused="false"/>
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:drawable="@drawable/abc_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/abc_list_selector_disabled_holo_light" android:state_enabled="false" android:state_focused="true"/>
<item android:drawable="@drawable/list_selector_background_transition_holo_light" android:state_focused="true" android:state_pressed="true"/>
<item android:drawable="@drawable/list_selector_background_transition_holo_light" android:state_focused="false" android:state_pressed="true"/>
<item android:drawable="@drawable/list_focused_holo_light" android:state_focused="true"/>
</selector>

View file

@ -6,9 +6,10 @@
<style name="AppTheme" parent="Base.AppTheme">
<item name="android:textColorSecondary">@color/secondary_text</item>
<item name="android:progressBarStyleHorizontal">@style/ProgressBar.Fosdem</item>
<item name="android:listViewStyle">@style/ListView.Fosdem</item>
<item name="android:fastScrollThumbDrawable">@drawable/fosdem_fastscroll_thumb_holo</item>
<item name="android:selectableItemBackground">?attr/selectableItemBackground</item>
<item name="android:listChoiceBackgroundIndicator">?attr/listChoiceBackgroundIndicator
</item>
</style>
<style name="ProgressBar.Fosdem" parent="android:Widget.Holo.ProgressBar.Horizontal">
@ -18,8 +19,4 @@
<item name="android:progressDrawable">@drawable/fosdem_progress_horizontal_holo_light</item>
</style>
<style name="ListView.Fosdem" parent="android:Widget.Holo.Light.ListView">
<item name="android:listSelector">?attr/selectableItemBackground</item>
</style>
</resources>

View file

@ -49,7 +49,7 @@
</style>
<style name="ListView.Fosdem" parent="android:Widget.ListView.White">
<item name="android:listSelector">?attr/selectableItemBackground</item>
<item name="android:listSelector">?attr/listChoiceBackgroundIndicator</item>
<item name="android:fadingEdge">none</item>
</style>