mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2024-12-24 15:31:05 +01:00
add some background and foreground effect to list items
This commit is contained in:
parent
0fb3f20a2b
commit
bd033389f0
@ -23,6 +23,7 @@ class EventsAdapter(val activity: SimpleActivity, val mItems: List<Event>, val i
|
||||
val markedItems = HashSet<Int>()
|
||||
|
||||
fun toggleItemSelection(itemView: View, select: Boolean, pos: Int = -1) {
|
||||
itemView.event_item_frame.isSelected = select
|
||||
if (pos == -1)
|
||||
return
|
||||
|
||||
|
17
app/src/main/res/drawable-v21/selector.xml
Normal file
17
app/src/main/res/drawable-v21/selector.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item>
|
||||
<selector>
|
||||
<item
|
||||
android:drawable="@color/activated_item_foreground"
|
||||
android:state_selected="true"/>
|
||||
</selector>
|
||||
</item>
|
||||
<item>
|
||||
<ripple android:color="@color/pressed_item_foreground">
|
||||
<item android:id="@android:id/mask">
|
||||
<color android:color="@android:color/white"/>
|
||||
</item>
|
||||
</ripple>
|
||||
</item>
|
||||
</layer-list>
|
@ -2,5 +2,5 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<solid
|
||||
android:color="@color/dark_grey_pressed_mask"/>
|
||||
android:color="@color/mediumGrey"/>
|
||||
</shape>
|
||||
|
5
app/src/main/res/drawable/selector.xml
Normal file
5
app/src/main/res/drawable/selector.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@color/pressed_item_foreground" android:state_pressed="true"/>
|
||||
<item android:drawable="@color/activated_item_foreground" android:state_selected="true"/>
|
||||
</selector>
|
@ -1,10 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
android:id="@+id/event_item_holder"
|
||||
<FrameLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/event_item_frame"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:foreground="@drawable/selector">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/event_item_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/event_item_background"
|
||||
android:paddingBottom="@dimen/event_padding"
|
||||
android:paddingTop="@dimen/event_padding">
|
||||
|
||||
@ -46,3 +52,4 @@
|
||||
android:textSize="@dimen/day_text_size"/>
|
||||
|
||||
</RelativeLayout>
|
||||
</FrameLayout>
|
||||
|
@ -4,7 +4,8 @@
|
||||
<color name="colorPrimaryDark">#ffe27725</color>
|
||||
<color name="colorAccent">@color/colorPrimary</color>
|
||||
|
||||
<color name="dark_grey_pressed_mask">#11000000</color>
|
||||
<color name="pressed_item_foreground">#08000000</color>
|
||||
<color name="activated_item_foreground">#44888888</color>
|
||||
<color name="mediumGrey">#18000000</color>
|
||||
<color name="divider_grey">#44cccccc</color>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user