dd some padding above the events list

This commit is contained in:
tibbi 2016-10-23 21:03:13 +02:00
parent 9db5933255
commit fe323be23d
3 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package com.simplemobiletools.calendar.adapters package com.simplemobiletools.calendar.adapters
import android.content.Context import android.content.Context
import android.graphics.drawable.Drawable
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -13,14 +14,16 @@ import com.simplemobiletools.calendar.models.ListItem
import com.simplemobiletools.calendar.models.ListSection import com.simplemobiletools.calendar.models.ListSection
import kotlinx.android.synthetic.main.event_item.view.* import kotlinx.android.synthetic.main.event_item.view.*
class EventsListAdapter(context: Context, private val mEvents: List<ListItem>) : BaseAdapter() { class EventsListAdapter(context: Context, val mEvents: List<ListItem>) : BaseAdapter() {
val ITEM_EVENT = 0 val ITEM_EVENT = 0
val ITEM_HEADER = 1 val ITEM_HEADER = 1
private val mInflater: LayoutInflater private val mInflater: LayoutInflater
private var mTopDivider: Drawable? = null
init { init {
mInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater mInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
mTopDivider = context.resources.getDrawable(R.drawable.divider)
} }
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View { override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
@ -58,6 +61,7 @@ class EventsListAdapter(context: Context, private val mEvents: List<ListItem>) :
} else { } else {
val item = mEvents[position] as ListSection val item = mEvents[position] as ListSection
viewHolder.title.text = item.title viewHolder.title.text = item.title
viewHolder.title.setCompoundDrawablesWithIntrinsicBounds(null, if (position == 0) null else mTopDivider, null, null)
} }
return view return view

View File

@ -6,5 +6,6 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="1dp" android:drawablePadding="1dp"
android:drawableTop="@drawable/divider" android:drawableTop="@drawable/divider"
android:paddingTop="@dimen/small_padding"
android:textSize="@dimen/normal_text_size" android:textSize="@dimen/normal_text_size"
android:textStyle="bold"/> android:textStyle="bold"/>

View File

@ -7,4 +7,5 @@
android:choiceMode="multipleChoiceModal" android:choiceMode="multipleChoiceModal"
android:clipToPadding="false" android:clipToPadding="false"
android:divider="@null" android:divider="@null"
android:paddingLeft="@dimen/activity_margin"/> android:paddingLeft="@dimen/activity_margin"
android:paddingTop="@dimen/medium_padding"/>