add a new radio button for the weekly view

This commit is contained in:
tibbi
2017-01-10 21:35:54 +01:00
parent c58ffc9439
commit 6e02465bdf
4 changed files with 14 additions and 0 deletions

View File

@ -108,6 +108,8 @@ class MainActivity : SimpleActivity(), EventListFragment.DeleteListener {
fillYearlyViewPager() fillYearlyViewPager()
} else if (config.storedView == EVENTS_LIST_VIEW) { } else if (config.storedView == EVENTS_LIST_VIEW) {
fillEventsList() fillEventsList()
} else if (config.storedView == WEEKLY_VIEW) {
} else { } else {
val targetDay = DateTime().toString(Formatter.DAYCODE_PATTERN) val targetDay = DateTime().toString(Formatter.DAYCODE_PATTERN)
fillMonthlyViewPager(targetDay) fillMonthlyViewPager(targetDay)

View File

@ -8,6 +8,7 @@ import com.simplemobiletools.calendar.R
import com.simplemobiletools.calendar.extensions.config import com.simplemobiletools.calendar.extensions.config
import com.simplemobiletools.calendar.helpers.EVENTS_LIST_VIEW import com.simplemobiletools.calendar.helpers.EVENTS_LIST_VIEW
import com.simplemobiletools.calendar.helpers.MONTHLY_VIEW import com.simplemobiletools.calendar.helpers.MONTHLY_VIEW
import com.simplemobiletools.calendar.helpers.WEEKLY_VIEW
import com.simplemobiletools.calendar.helpers.YEARLY_VIEW import com.simplemobiletools.calendar.helpers.YEARLY_VIEW
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import kotlinx.android.synthetic.main.dialog_change_views.view.* import kotlinx.android.synthetic.main.dialog_change_views.view.*
@ -33,12 +34,14 @@ class ChangeViewDialog(val activity: Activity, val callback: (newView: Int) -> U
} }
fun getNewView(id: Int) = when (id) { fun getNewView(id: Int) = when (id) {
R.id.dialog_radio_weekly -> WEEKLY_VIEW
R.id.dialog_radio_yearly -> YEARLY_VIEW R.id.dialog_radio_yearly -> YEARLY_VIEW
R.id.dialog_radio_events_list -> EVENTS_LIST_VIEW R.id.dialog_radio_events_list -> EVENTS_LIST_VIEW
else -> MONTHLY_VIEW else -> MONTHLY_VIEW
} }
fun getSavedItem() = when (activity.config.storedView) { fun getSavedItem() = when (activity.config.storedView) {
WEEKLY_VIEW -> R.id.dialog_radio_weekly
YEARLY_VIEW -> R.id.dialog_radio_yearly YEARLY_VIEW -> R.id.dialog_radio_yearly
EVENTS_LIST_VIEW -> R.id.dialog_radio_events_list EVENTS_LIST_VIEW -> R.id.dialog_radio_events_list
else -> R.id.dialog_radio_monthly else -> R.id.dialog_radio_monthly

View File

@ -12,6 +12,7 @@ val EVENT_ID = "event_id"
val MONTHLY_VIEW = 1 val MONTHLY_VIEW = 1
val YEARLY_VIEW = 2 val YEARLY_VIEW = 2
val EVENTS_LIST_VIEW = 3 val EVENTS_LIST_VIEW = 3
val WEEKLY_VIEW = 4
val REMINDER_OFF = -1 val REMINDER_OFF = -1
val REMINDER_AT_START = 0 val REMINDER_AT_START = 0

View File

@ -6,6 +6,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/activity_margin"> android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/dialog_radio_weekly"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/weekly_view"/>
<com.simplemobiletools.commons.views.MyCompatRadioButton <com.simplemobiletools.commons.views.MyCompatRadioButton
android:id="@+id/dialog_radio_monthly" android:id="@+id/dialog_radio_monthly"
android:layout_width="match_parent" android:layout_width="match_parent"