add a menu item for adding holidays
- move the holiday files in Raw folder
This commit is contained in:
parent
7a4f244897
commit
cf11065223
|
@ -125,6 +125,7 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
R.id.change_view -> showViewDialog()
|
||||
R.id.go_to_today -> goToToday()
|
||||
R.id.filter -> showFilterDialog()
|
||||
R.id.add_holidays -> addHolidays()
|
||||
R.id.import_events -> tryImportEvents()
|
||||
R.id.export_events -> tryExportEvents()
|
||||
R.id.settings -> launchSettings()
|
||||
|
@ -188,6 +189,10 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
}
|
||||
}
|
||||
|
||||
private fun addHolidays() {
|
||||
val items = getHolidayRadioItems()
|
||||
}
|
||||
|
||||
private fun updateView(view: Int) {
|
||||
calendar_fab.beGoneIf(view == YEARLY_VIEW)
|
||||
mIsMonthSelected = view == MONTHLY_VIEW
|
||||
|
@ -509,6 +514,52 @@ class MainActivity : SimpleActivity(), NavigationListener {
|
|||
}
|
||||
}
|
||||
|
||||
private fun getHolidayRadioItems(): ArrayList<RadioItem> {
|
||||
val items = ArrayList<RadioItem>()
|
||||
|
||||
LinkedHashMap<String, Int>().apply {
|
||||
put("Algeria", R.raw.algeria)
|
||||
put("België", R.raw.belgium)
|
||||
put("Bolivia", R.raw.bolivia)
|
||||
put("Brasil", R.raw.brazil)
|
||||
put("Canada", R.raw.canada)
|
||||
put("Česká republika", R.raw.czech)
|
||||
put("Deutschland", R.raw.germany)
|
||||
put("Eesti", R.raw.estonia)
|
||||
put("Éire", R.raw.ireland)
|
||||
put("France", R.raw.france)
|
||||
put("Hanguk", R.raw.southkorea)
|
||||
put("Hellas", R.raw.greece)
|
||||
put("Ísland", R.raw.iceland)
|
||||
put("Italia", R.raw.italy)
|
||||
put("Magyarország", R.raw.hungary)
|
||||
put("Nederland", R.raw.netherlands)
|
||||
put("Nihon", R.raw.japan)
|
||||
put("Norge", R.raw.norway)
|
||||
put("Pākistān", R.raw.pakistan)
|
||||
put("Polska", R.raw.poland)
|
||||
put("Portugal", R.raw.portugal)
|
||||
put("Rossiya", R.raw.russia)
|
||||
put("Schweiz", R.raw.switzerland)
|
||||
put("Slovenija", R.raw.slovenia)
|
||||
put("Slovensko", R.raw.slovakia)
|
||||
put("Suomi", R.raw.finland)
|
||||
put("Sverige", R.raw.sweden)
|
||||
put("United States", R.raw.unitedstates)
|
||||
|
||||
var i = 0
|
||||
for ((country, file) in this) {
|
||||
items.add(RadioItem(i++, country, file))
|
||||
}
|
||||
}
|
||||
|
||||
RadioGroupDialog(this, items, -1) {
|
||||
|
||||
}
|
||||
|
||||
return items
|
||||
}
|
||||
|
||||
private fun checkWhatsNewDialog() {
|
||||
arrayListOf<Release>().apply {
|
||||
add(Release(39, R.string.release_39))
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package com.simplemobiletools.calendar.helpers
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.simplemobiletools.calendar.R
|
||||
import com.simplemobiletools.calendar.extensions.dbHelper
|
||||
import com.simplemobiletools.calendar.extensions.isXMonthlyRepetition
|
||||
import com.simplemobiletools.calendar.extensions.isXWeeklyRepetition
|
||||
import com.simplemobiletools.calendar.extensions.seconds
|
||||
import com.simplemobiletools.calendar.helpers.IcsImporter.ImportResult.*
|
||||
import com.simplemobiletools.calendar.models.Event
|
||||
import com.simplemobiletools.calendar.models.EventType
|
||||
import org.joda.time.DateTimeZone
|
||||
import org.joda.time.format.DateTimeFormat
|
||||
|
@ -47,7 +47,9 @@ class IcsImporter {
|
|||
if (line.trim().isEmpty())
|
||||
continue
|
||||
|
||||
if (line.substring(0, 1) == " ") {
|
||||
Log.e("DEBUG", "line $line")
|
||||
|
||||
/*if (line.substring(0, 1) == " ") {
|
||||
line = prevLine + line.trim()
|
||||
eventsFailed--
|
||||
}
|
||||
|
@ -105,7 +107,7 @@ class IcsImporter {
|
|||
eventsImported++
|
||||
resetValues()
|
||||
}
|
||||
prevLine = line
|
||||
prevLine = line*/
|
||||
}
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
android:icon="@drawable/ic_filter"
|
||||
android:title="@string/filter"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/add_holidays"
|
||||
android:title="@string/add_holidays"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/import_events"
|
||||
android:title="@string/import_events_from_ics"
|
||||
|
|
Loading…
Reference in New Issue