add some linearlayouts as week columns

This commit is contained in:
tibbi 2017-01-16 22:29:59 +01:00
parent 5788eea57b
commit 190a2bdcab
4 changed files with 68 additions and 14 deletions

View File

@ -10,7 +10,7 @@ import com.simplemobiletools.calendar.fragments.WeekFragment
class MyWeekPagerAdapter(fm: FragmentManager, private val mListener: WeekFragment.WeekScrollListener) : FragmentStatePagerAdapter(fm) {
private val mFragments = SparseArray<WeekFragment>()
override fun getCount() = 1
override fun getCount() = 3
override fun getItem(position: Int): Fragment {
val bundle = Bundle()

View File

@ -13,17 +13,12 @@ class WeekEventsAdapter(val context: Context, val mEvents: List<Event>) : BaseAd
override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
var view = convertView
val viewHolder: ViewHolder
if (view == null) {
view = mInflater.inflate(R.layout.week_grid_item, parent, false)
viewHolder = ViewHolder(view)
view!!.tag = viewHolder
} else {
viewHolder = view.tag as ViewHolder
}
return view
return view!!
}
override fun getItem(position: Int) = mEvents[position]
@ -31,6 +26,4 @@ class WeekEventsAdapter(val context: Context, val mEvents: List<Event>) : BaseAd
override fun getItemId(position: Int) = 0L
override fun getCount() = 24 * 7
internal class ViewHolder(view: View)
}

View File

@ -72,7 +72,7 @@
android:overScrollMode="never"
android:scrollbars="none">
<LinearLayout
<RelativeLayout
android:id="@+id/week_events_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -87,6 +87,69 @@
android:numColumns="7"
android:verticalSpacing="1dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/weekly_view_events_height"
android:background="@android:color/transparent"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/week_column_1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/week_column_2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/week_column_3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/week_column_4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/week_column_5"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/week_column_6"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:orientation="vertical"/>
<LinearLayout
android:id="@+id/week_column_7"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@android:color/transparent"
android:orientation="vertical"/>
</LinearLayout>
</RelativeLayout>
</com.simplemobiletools.calendar.views.MyScrollView>
</LinearLayout>

View File

@ -4,6 +4,4 @@
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>
android:background="@android:color/white"/>