199 lines
9.4 KiB
Kotlin
199 lines
9.4 KiB
Kotlin
package {{appid}}.schedule.abstractDataTypes.convention
|
|
|
|
import {{appid}}.R
|
|
import {{appid}}.helper.Language
|
|
import {{appid}}.schedule.abstractDataTypes.GregorianCalendarRange
|
|
import org.jetbrains.anko.opaque
|
|
import java.util.*
|
|
|
|
object {{classname}} : Convention {
|
|
override val id = "{{classname}}"
|
|
override val name = "{{escape_string_into_kotlin(edition['name'][edition['language']])}}"
|
|
override val genericName = "{{escape_string_into_kotlin(convention['name'][convention['language']])}}"
|
|
override val hashtagReminder: String? = {{ '"'+hashtagreminder+'"' if hashtagreminder|length > 0 else 'null' }}
|
|
override val timeZone = SimpleTimeZone(
|
|
{{tzexp}},
|
|
"Other/{{escape_string_into_kotlin(classname)}}"
|
|
)
|
|
override val r621checker = {{ 'true' if edition['rule_621_checker'] else 'false' }}
|
|
override val theme = Dataset.Strings.string_{{edition['theme']['uuid']}}
|
|
override val rules = Dataset.Strings.string_{{convention['statute']['uuid']}}
|
|
override val notificationFireMinutesBefore = 15
|
|
override val startCalendarOn: GregorianCalendar = GregorianCalendar(
|
|
{{minevdatetime.year}}, {{minevdatetime.month-1}}, {{minevdatetime.day}},
|
|
{{minevdatetime.hour}}, {{minevdatetime.minute}}
|
|
)
|
|
override val paddingStartOfDayMillis: Long = 6*3600*1000
|
|
override val officialLifespan = GregorianCalendarRange(
|
|
GregorianCalendar(
|
|
{{edition['ceremony_opening_time']['yr']}}, {{edition['ceremony_opening_time']['mo']-1}}, {{edition['ceremony_opening_time']['dy']}},
|
|
{{edition['ceremony_opening_time']['hr']}}, {{edition['ceremony_opening_time']['mn']}}
|
|
),
|
|
GregorianCalendar(
|
|
{{edition['ceremony_closing_time']['yr']}}, {{edition['ceremony_closing_time']['mo']-1}}, {{edition['ceremony_closing_time']['dy']}},
|
|
{{edition['ceremony_closing_time']['hr']}}, {{edition['ceremony_closing_time']['mn']}}
|
|
)
|
|
)
|
|
override val nextEdition = GregorianCalendar(
|
|
{{edition['next_edition']['yr']}}, {{edition['next_edition']['mo']-1}}, {{edition['next_edition']['dy']}}
|
|
)
|
|
override val splitDayIn = 24
|
|
override val days = listOf(
|
|
{% for evdate in evdates %}
|
|
GregorianCalendar({{evdate.year}}, {{evdate.month-1}}, {{evdate.day}})
|
|
{%- if not loop.last -%} , {%- endif -%}
|
|
{%- endfor %}
|
|
)
|
|
override val mapHotel = Dataset.Files.file_{{edition['map_hotel']['uuid']}}
|
|
override val mapDealers = Dataset.Files.file_{{edition['map_dealers']['uuid']}}
|
|
override val bannerInEventAsset = Dataset.Files.file_{{edition['banner_during']['uuid']}}
|
|
override val bannerPreEventAsset = Dataset.Files.file_{{edition['banner_before']['uuid']}}
|
|
override val bannerPostEventAsset = Dataset.Files.file_{{edition['banner_after']['uuid']}}
|
|
override val bannerPreEventBefore = GregorianCalendar(
|
|
{{edition['banner_1st_change']['yr']}}, {{edition['banner_1st_change']['mo']-1}}, {{edition['banner_1st_change']['dy']}},
|
|
{{edition['banner_1st_change']['hr']}}, {{edition['banner_1st_change']['mn']}}
|
|
)
|
|
override val bannerPostEventAfter = GregorianCalendar(
|
|
{{edition['banner_2nd_change']['yr']}}, {{edition['banner_2nd_change']['mo']-1}}, {{edition['banner_2nd_change']['dy']}},
|
|
{{edition['banner_2nd_change']['hr']}}, {{edition['banner_2nd_change']['mn']}}
|
|
)
|
|
override val socialMedias: List<SocialMedia> = listOf(
|
|
{% for sm in convention['social_medias'] %}
|
|
Dataset.SocialMedias.socialmedia_{{sm['alias']}}
|
|
{%- if not loop.last -%} , {%- endif -%}
|
|
{%- endfor %}
|
|
)
|
|
override val registrationTiers = listOf(
|
|
{% for rt in edition['registration_tiers'] %}
|
|
Dataset.RegistrationTiers.registationtier_{{rt['uuid']}}
|
|
{%- if not loop.last -%} , {%- endif -%}
|
|
{%- endfor %}
|
|
)
|
|
|
|
override val lowestRegistrationTier = Dataset.RegistrationTiers.registationtier_{{edition['lowest_registration_tier']}}
|
|
override val tags = listOf(
|
|
{% for tg in edition['tags'] %}
|
|
Dataset.Tags.tag_{{tg['uuid']}}
|
|
{%- if not loop.last -%} , {%- endif -%}
|
|
{%- endfor %}
|
|
)
|
|
override val places = listOf(
|
|
{% for plc in edition['places'] %}
|
|
Dataset.Places.place_{{plc['uuid']}}
|
|
{%- if not loop.last -%} , {%- endif -%}
|
|
{%- endfor %}
|
|
)
|
|
|
|
override val events = listOf(
|
|
{% for ev in edition['events'] -%}
|
|
Dataset.Events.event_{{ev['uuid']}}
|
|
{%- if not loop.last -%} , {%- endif %}
|
|
{% endfor %}
|
|
)
|
|
|
|
object Dataset {
|
|
object Strings {
|
|
{% for uuid, item in strings.items() -%}
|
|
val string_{{uuid}} = mapOf( // {{ item['alias'] }}{{ item['label'] }}
|
|
Language.PT to "{{ escape_string_into_kotlin(item['pt']) }}",
|
|
Language.EN to "{{ escape_string_into_kotlin(item['en']) }}",
|
|
Language.ES to "{{ escape_string_into_kotlin(item['es']) }}"
|
|
)
|
|
{% endfor -%}
|
|
val string_None = mapOf(
|
|
Language.PT to "",
|
|
Language.EN to "",
|
|
Language.ES to ""
|
|
)
|
|
}
|
|
object Files {
|
|
{% for uuid, item in files.items() -%}
|
|
val file_{{uuid}} = mapOf( // {{ item['alias'] }}{{ item['label'] }}
|
|
Language.PT to "{{ escape_string_into_kotlin(item['pt']).strip('/') }}",
|
|
Language.EN to "{{ escape_string_into_kotlin(item['en']).strip('/') }}",
|
|
Language.ES to "{{ escape_string_into_kotlin(item['es']).strip('/') }}"
|
|
)
|
|
{% endfor %}
|
|
}
|
|
object SocialMedias {
|
|
{% for sm in convention['social_medias'] -%}
|
|
val socialmedia_{{sm['alias']}} = SocialMedia(
|
|
Dataset.Strings.string_{{sm['name']['uuid']}},
|
|
Dataset.Strings.string_{{sm['url']['uuid']}},
|
|
R.drawable.{{sm['icon']}},
|
|
0x{{ sm['color']['color'].strip('#') }}.opaque
|
|
)
|
|
{% endfor %}
|
|
}
|
|
|
|
object RegistrationTiers {
|
|
{% for rt in edition['registration_tiers'] -%}
|
|
val registationtier_{{rt['uuid']}} = RegistrationTier(
|
|
{{rt['level']}},
|
|
Dataset.Strings.string_{{rt['tier']['uuid']}},
|
|
listOf(
|
|
{% for rb in rt['benefits'] %}
|
|
Dataset.Strings.string_{{rb['uuid']}}
|
|
{%- if not loop.last -%} , {%- endif -%}
|
|
{%- endfor %}
|
|
)
|
|
)
|
|
{% endfor %}
|
|
}
|
|
|
|
object Tags {
|
|
{% for tg in edition['tags'] -%}
|
|
val tag_{{tg['uuid']}} = Tag(Dataset.Strings.string_{{tg['label']['uuid']}}, 0x{{ tg['color']['color'].strip('#') }}.opaque)
|
|
{% endfor %}
|
|
}
|
|
|
|
object Places {
|
|
{% for plc in edition['places'] -%}
|
|
val place_{{plc['uuid']}} = Place(Dataset.Strings.string_{{plc['label']['uuid']}}, 0x{{ plc['color']['color'].strip('#') }}.opaque)
|
|
{% endfor %}
|
|
}
|
|
|
|
object Events {
|
|
{% for ev in edition['events'] -%}
|
|
val event_{{ev['uuid']}} = Event("{{ escape_string_into_kotlin(ev['conbook_key']) }}",
|
|
listOf({{', '.join(list(map(str, ev['conbook_pages'])))}}),
|
|
Dataset.Strings.string_{{ev['title']['uuid']}},
|
|
Dataset.Strings.string_{{ev['subtitle']['uuid']}},
|
|
Dataset.Strings.string_{{ev['description']['uuid']}},
|
|
GregorianCalendarRange(
|
|
GregorianCalendar(
|
|
{{ev['time_start']['yr']}}, {{ev['time_start']['mo']-1}}, {{ev['time_start']['dy']}},
|
|
{{ev['time_start']['hr']}}, {{ev['time_start']['mn']}}
|
|
),
|
|
GregorianCalendar(
|
|
{{ev['time_end']['yr']}}, {{ev['time_end']['mo']-1}}, {{ev['time_end']['dy']}},
|
|
{{ev['time_end']['hr']}}, {{ev['time_end']['mn']}}
|
|
)
|
|
),
|
|
listOf(
|
|
{% for it in ev['places'] -%}
|
|
Dataset.Places.place_{{it}}
|
|
{%- if not loop.last -%} , {%- endif %}
|
|
{% endfor %}
|
|
),
|
|
listOf(
|
|
{% for it in ev['attendable_by'] -%}
|
|
Dataset.RegistrationTiers.registationtier_{{it}}
|
|
{%- if not loop.last -%} , {%- endif %}
|
|
{% endfor %}
|
|
),
|
|
listOf(
|
|
{% for it in ev['categories'] -%}
|
|
Dataset.Tags.tag_{{it}}
|
|
{%- if not loop.last -%} , {%- endif %}
|
|
{% endfor %}
|
|
),
|
|
{{ 'null' if ev['language']==edition['language'] else 'Language.'+ev['language'].upper() }},
|
|
{{ 'true' if ev['hidden_from_time_table'] else 'false' }},
|
|
{{ 'null' if ev['picture']['uuid'] is none else 'Dataset.Files.file_'+ev['picture']['uuid'] }}
|
|
)
|
|
{% endfor %}
|
|
}
|
|
}
|
|
}
|