add a list of hours at weekly view

This commit is contained in:
tibbi 2017-01-15 13:41:57 +01:00
parent 357f57e0ee
commit 6221129678
3 changed files with 46 additions and 2 deletions

View File

@ -8,6 +8,7 @@ import android.support.v4.view.ViewPager
import android.view.Menu
import android.view.MenuItem
import android.view.View
import android.widget.TextView
import com.simplemobiletools.calendar.BuildConfig
import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.adapters.MyMonthPagerAdapter
@ -134,6 +135,7 @@ class MainActivity : SimpleActivity(), EventListFragment.DeleteListener {
}
private fun fillMonthlyViewPager(targetDay: String) {
main_weekly_scrollview.visibility = View.GONE
calendar_fab.visibility = View.VISIBLE
val codes = getMonths(targetDay)
val monthlyAdapter = MyMonthPagerAdapter(supportFragmentManager, codes, this)
@ -160,12 +162,20 @@ class MainActivity : SimpleActivity(), EventListFragment.DeleteListener {
private fun fillWeeklyViewPager() {
val weeklyAdapter = MyWeekPagerAdapter(supportFragmentManager)
main_view_pager.apply {
adapter = weeklyAdapter
main_view_pager.visibility = View.GONE
calendar_event_list_holder.visibility = View.GONE
main_weekly_scrollview.visibility = View.VISIBLE
for (i in 1..23) {
val view = layoutInflater.inflate(R.layout.weekly_view_hour_textview, null, false) as TextView
val value = i.toString()
view.text = if (value.length == 2) value else "0$value"
week_view_hours_holder.addView(view)
}
}
private fun fillYearlyViewPager() {
main_weekly_scrollview.visibility = View.GONE
calendar_fab.visibility = View.GONE
val targetYear = DateTime().toString(Formatter.YEAR_PATTERN).toInt()
val years = getYears(targetYear)
@ -224,6 +234,7 @@ class MainActivity : SimpleActivity(), EventListFragment.DeleteListener {
title = getString(R.string.app_launcher_name)
main_view_pager.adapter = null
main_view_pager.visibility = View.GONE
main_weekly_scrollview.visibility = View.GONE
calendar_event_list_holder.visibility = View.VISIBLE
if (mEventListFragment == null)

View File

@ -6,6 +6,30 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView
android:id="@+id/main_weekly_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:visibility="gone">
<LinearLayout
android:id="@+id/week_view_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:id="@+id/week_view_hours_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
</ScrollView>
<com.simplemobiletools.commons.views.MyViewPager
android:id="@+id/main_view_pager"
android:layout_width="match_parent"

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<com.simplemobiletools.commons.views.MyTextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom"
android:minHeight="60dp"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"/>