add a new View listing all future events within a year

This commit is contained in:
tibbi 2016-10-22 23:12:26 +02:00
parent 6e3676bcc2
commit 2f0cf1a024
10 changed files with 23 additions and 5 deletions

View File

@ -11,6 +11,7 @@ public class Constants {
public static final int MONTHLY_VIEW = 1;
public static final int YEARLY_VIEW = 2;
public static final int EVENTS_LIST_VIEW = 3;
public static final int DAY = 86400;
public static final int WEEK = 604800;

View File

@ -2,7 +2,6 @@ package com.simplemobiletools.calendar.activities
import android.content.Intent
import android.os.Bundle
import android.os.Handler
import android.support.v4.view.ViewPager
import android.view.Menu
import android.view.MenuItem
@ -87,15 +86,16 @@ class MainActivity : SimpleActivity(), NavigationListener, ChangeViewDialog.Chan
mIsMonthSelected = view == Constants.MONTHLY_VIEW
mConfig.view = view
updateViewPager()
Handler().postDelayed({ invalidateOptionsMenu() }, 500)
}
private fun updateViewPager() {
if (mConfig.view == Constants.MONTHLY_VIEW) {
if (mConfig.view == Constants.YEARLY_VIEW) {
fillYearlyViewPager()
} else if (mConfig.view == Constants.EVENTS_LIST_VIEW) {
view_pager.adapter = null
} else {
val targetDay = DateTime().toString(Formatter.DAYCODE_PATTERN)
fillMonthlyViewPager(targetDay)
} else {
fillYearlyViewPager()
}
}

View File

@ -32,6 +32,7 @@ class ChangeViewDialog(val activity: Activity) : AlertDialog.Builder(activity),
fun getNewView(id: Int): Int {
return when (id) {
R.id.dialog_radio_yearly -> Constants.YEARLY_VIEW
R.id.dialog_radio_events_list -> Constants.EVENTS_LIST_VIEW
else -> Constants.MONTHLY_VIEW
}
}
@ -39,6 +40,7 @@ class ChangeViewDialog(val activity: Activity) : AlertDialog.Builder(activity),
fun getSavedItem(): Int {
return when (Config.newInstance(activity).view) {
Constants.YEARLY_VIEW -> R.id.dialog_radio_yearly
Constants.EVENTS_LIST_VIEW -> R.id.dialog_radio_events_list
else -> R.id.dialog_radio_monthly
}
}

View File

@ -22,4 +22,13 @@
android:paddingTop="@dimen/activity_margin"
android:text="@string/yearly_view"/>
<RadioButton
android:id="@+id/dialog_radio_events_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/simple_event_list"/>
</RadioGroup>

View File

@ -7,6 +7,7 @@
<string name="change_view">Change view</string>
<string name="monthly_view">Monthly view</string>
<string name="yearly_view">Yearly view</string>
<string name="simple_event_list">Simple event list</string>
<!-- Event -->
<string name="event">Termin</string>

View File

@ -7,6 +7,7 @@
<string name="change_view">Change view</string>
<string name="monthly_view">Monthly view</string>
<string name="yearly_view">Yearly view</string>
<string name="simple_event_list">Simple event list</string>
<!-- Event -->
<string name="event">Evento</string>

View File

@ -7,6 +7,7 @@
<string name="change_view">Change view</string>
<string name="monthly_view">Monthly view</string>
<string name="yearly_view">Yearly view</string>
<string name="simple_event_list">Simple event list</string>
<!-- Event -->
<string name="event">イベント</string>

View File

@ -7,6 +7,7 @@
<string name="change_view">Change view</string>
<string name="monthly_view">Monthly view</string>
<string name="yearly_view">Yearly view</string>
<string name="simple_event_list">Simple event list</string>
<!-- Event -->
<string name="event">Evento</string>

View File

@ -7,6 +7,7 @@
<string name="change_view">Change view</string>
<string name="monthly_view">Monthly view</string>
<string name="yearly_view">Yearly view</string>
<string name="simple_event_list">Simple event list</string>
<!-- Event -->
<string name="event">Händelse</string>

View File

@ -7,6 +7,7 @@
<string name="change_view">Change view</string>
<string name="monthly_view">Monthly view</string>
<string name="yearly_view">Yearly view</string>
<string name="simple_event_list">Simple event list</string>
<!-- Event -->
<string name="event">Event</string>