add a background grid
This commit is contained in:
parent
ff4b7374c2
commit
9dba6e05ef
|
@ -18,12 +18,11 @@ class EventListWidgetAdapterOld(val context: Context, val mEvents: List<ListItem
|
|||
val ITEM_EVENT = 0
|
||||
val ITEM_HEADER = 1
|
||||
|
||||
private val mInflater: LayoutInflater
|
||||
private val mInflater: LayoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
private var mTopDivider: Drawable? = null
|
||||
private var mTextColor = 0
|
||||
|
||||
init {
|
||||
mInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
mTopDivider = context.resources.getDrawable(R.drawable.divider)
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.simplemobiletools.calendar.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.BaseAdapter
|
||||
import com.simplemobiletools.calendar.R
|
||||
|
||||
class WeekEventsAdapter(val context: Context) : BaseAdapter() {
|
||||
private val mInflater: LayoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater
|
||||
|
||||
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
|
||||
return mInflater.inflate(R.layout.week_grid_item, parent, false)
|
||||
}
|
||||
|
||||
override fun getItem(position: Int) = null
|
||||
|
||||
override fun getItemId(position: Int) = 0L
|
||||
|
||||
override fun getCount() = 24 * 7
|
||||
}
|
|
@ -8,6 +8,7 @@ import android.view.ViewGroup
|
|||
import android.view.ViewTreeObserver
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.activities.MainActivity
|
||||
import com.simplemobiletools.calendar.adapters.WeekEventsAdapter
|
||||
import com.simplemobiletools.calendar.helpers.DBHelper
|
||||
import com.simplemobiletools.calendar.models.Event
|
||||
import com.simplemobiletools.calendar.views.MyScrollView
|
||||
|
@ -34,6 +35,8 @@ class WeekFragment : Fragment(), DBHelper.GetEventsListener {
|
|||
mView.week_events_scrollview.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
}
|
||||
})
|
||||
|
||||
mView.week_events_grid.adapter = WeekEventsAdapter(context)
|
||||
return mView
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/weekly_view_day_letters_height"
|
||||
android:overScrollMode="never"
|
||||
android:paddingTop="@dimen/medium_margin"
|
||||
android:scrollbars="none">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -78,9 +78,14 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<android.support.v4.widget.Space
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/weekly_view_events_height"/>
|
||||
<GridView
|
||||
android:id="@+id/week_events_grid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/weekly_view_events_height"
|
||||
android:background="@color/divider_grey"
|
||||
android:horizontalSpacing="1dp"
|
||||
android:numColumns="7"
|
||||
android:verticalSpacing="1dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
</com.simplemobiletools.calendar.views.MyScrollView>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/week_holder"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/weekly_view_row_minus_one_height"
|
||||
android:background="@android:color/white">
|
||||
|
||||
</RelativeLayout>
|
|
@ -4,6 +4,7 @@
|
|||
<dimen name="yearly_padding_full">6dp</dimen>
|
||||
|
||||
<dimen name="weekly_view_row_height">60dp</dimen>
|
||||
<dimen name="weekly_view_row_minus_one_height">59dp</dimen>
|
||||
<dimen name="weekly_view_events_height">1440dp</dimen> <!-- weekly_view_row_height * 24 hours -->
|
||||
<dimen name="weekly_view_day_letters_height">24dp</dimen>
|
||||
|
||||
|
|
Loading…
Reference in New Issue