restyle the event detail screen

This commit is contained in:
tibbi 2017-02-02 22:14:02 +01:00
parent 32dae4e3d9
commit cddd52ffa9
30 changed files with 150 additions and 116 deletions

View File

@ -2,6 +2,7 @@ package com.simplemobiletools.calendar.activities
import android.app.DatePickerDialog
import android.app.TimePickerDialog
import android.graphics.PorterDuff
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
@ -68,7 +69,6 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
event_end_date.setOnClickListener { setupEndDate() }
event_end_time.setOnClickListener { setupEndTime() }
event_end_checkbox.setOnCheckedChangeListener { compoundButton, isChecked -> endCheckboxChecked(isChecked) }
event_all_day.setOnCheckedChangeListener { compoundButton, isChecked -> toggleAllDay(isChecked) }
event_reminder.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
@ -81,6 +81,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
}
updateTextColors(event_scrollview)
updateIconColors()
}
private fun setupEditEvent() {
@ -88,8 +89,6 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
title = resources.getString(R.string.edit_event)
mEventStartDateTime = Formatter.getDateTimeFromTS(mEvent.startTS)
mEventEndDateTime = Formatter.getDateTimeFromTS(mEvent.endTS)
event_end_checkbox.isChecked = mEventStartDateTime != mEventEndDateTime
endCheckboxChecked(event_end_checkbox.isChecked)
event_title.setText(mEvent.title)
event_description.setText(mEvent.description)
}
@ -159,15 +158,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
fun toggleAllDay(isChecked: Boolean) {
event_start_time.beGoneIf(isChecked)
event_end_checkbox.beGoneIf(isChecked)
event_end_date.beGoneIf(isChecked || !event_end_checkbox.isChecked)
event_end_time.beGoneIf(isChecked || !event_end_checkbox.isChecked)
}
fun endCheckboxChecked(isChecked: Boolean) {
hideKeyboard()
event_end_date.beVisibleIf(isChecked)
event_end_time.beVisibleIf(isChecked)
event_end_time.beGoneIf(isChecked)
}
fun reminderItemSelected() {
@ -241,7 +232,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
val newStartTS = mEventStartDateTime.seconds()
val newEndTS = mEventEndDateTime.seconds()
if (event_end_checkbox.isChecked && newStartTS > newEndTS) {
if (newStartTS > newEndTS) {
toast(R.string.end_before_start)
return
}
@ -250,7 +241,7 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
val newDescription = event_description.value
mEvent.apply {
startTS = newStartTS
endTS = if (event_end_checkbox.isChecked) newEndTS else newStartTS
endTS = newEndTS
title = newTitle
description = newDescription
reminderMinutes = getReminderMinutes()
@ -370,6 +361,12 @@ class EventActivity : SimpleActivity(), DBHelper.EventUpdateListener {
}
}
private fun updateIconColors() {
event_time_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
event_repetition_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
event_reminder_image.setColorFilter(config.textColor, PorterDuff.Mode.SRC_IN)
}
override fun eventInserted(event: Event) {
if (DateTime.now().isAfter(mEventStartDateTime.millis)) {
toast(R.string.past_event_added)

Binary file not shown.

After

Width:  |  Height:  |  Size: 560 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 805 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 366 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 721 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 967 B

View File

@ -9,21 +9,16 @@
<RelativeLayout
android:id="@+id/event_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_title_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title"
android:textSize="@dimen/day_text_size"/>
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/event_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/event_title_label"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_marginRight="@dimen/activity_margin"
android:layout_marginTop="@dimen/activity_margin"
android:hint="@string/title"
android:inputType="textCapSentences"
android:maxLength="30"
android:maxLines="1"
@ -31,44 +26,58 @@
android:textCursorDrawable="@null"
android:textSize="@dimen/day_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_description_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_title"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/description"
android:textSize="@dimen/day_text_size"/>
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/event_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_description_label"
android:layout_below="@+id/event_title"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_marginRight="@dimen/activity_margin"
android:layout_marginTop="@dimen/activity_margin"
android:gravity="top"
android:hint="@string/description"
android:inputType="textCapSentences|textMultiLine"
android:minEms="20"
android:textCursorDrawable="@null"
android:textSize="@dimen/day_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_start_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<ImageView
android:id="@+id/event_description_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@+id/event_description"
android:layout_marginBottom="@dimen/normal_margin"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/start"
android:textSize="@dimen/day_text_size"/>
android:background="#66808080"/>
<ImageView
android:id="@+id/event_time_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_all_day"
android:layout_alignTop="@+id/event_all_day"
android:layout_below="@+id/event_description_divider"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_marginStart="@dimen/normal_margin"
android:alpha="0.8"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_clock"/>
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/event_all_day"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/event_description"
android:layout_marginTop="@dimen/medium_margin"
android:padding="@dimen/medium_margin"
android:layout_below="@+id/event_description_divider"
android:layout_marginEnd="@dimen/normal_margin"
android:layout_marginLeft="@dimen/small_margin"
android:layout_marginRight="@dimen/normal_margin"
android:layout_marginStart="@dimen/small_margin"
android:layout_toEndOf="@+id/event_time_image"
android:layout_toRightOf="@+id/event_time_image"
android:paddingBottom="@dimen/normal_margin"
android:paddingTop="@dimen/normal_margin"
android:text="@string/all_day"
android:textSize="@dimen/day_text_size"
app:switchPadding="@dimen/small_margin"/>
@ -77,8 +86,13 @@
android:id="@+id/event_start_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_start_label"
android:padding="@dimen/activity_margin"
android:layout_alignLeft="@+id/event_all_day"
android:layout_alignStart="@+id/event_all_day"
android:layout_below="@+id/event_time_image"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="January 1 1970"
android:textSize="@dimen/day_text_size"/>
@ -86,69 +100,85 @@
android:id="@+id/event_start_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_start_label"
android:layout_toRightOf="@id/event_start_date"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/event_time_image"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"
android:text="00:00"
android:textSize="@dimen/day_text_size"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/event_end_checkbox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_start_date"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/end"
android:textSize="@dimen/day_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_end_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_end_checkbox"
android:layout_alignLeft="@+id/event_all_day"
android:layout_alignStart="@+id/event_all_day"
android:layout_below="@+id/event_start_date"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="January 1 1970"
android:textSize="@dimen/day_text_size"
android:visibility="gone"/>
android:textSize="@dimen/day_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_end_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_end_checkbox"
android:layout_toRightOf="@id/event_end_date"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_below="@+id/event_start_time"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"
android:text="00:00"
android:textSize="@dimen/day_text_size"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_reminder_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_end_time"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/reminder"
android:textSize="@dimen/day_text_size"/>
<ImageView
android:id="@+id/event_date_time_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@+id/event_end_date"
android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginTop="@dimen/medium_margin"
android:background="#66808080"/>
<ImageView
android:id="@+id/event_reminder_image"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_reminder"
android:layout_alignTop="@+id/event_reminder"
android:layout_below="@+id/event_date_time_divider"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_marginStart="@dimen/normal_margin"
android:alpha="0.8"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_bell"/>
<com.simplemobiletools.commons.views.MyAppCompatSpinner
android:id="@+id/event_reminder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_reminder_label"
android:layout_below="@+id/event_date_time_divider"
android:layout_toRightOf="@+id/event_reminder_image"
android:entries="@array/reminders"
android:padding="@dimen/activity_margin"/>
android:padding="@dimen/normal_margin"/>
<ImageView
android:id="@+id/event_reminder_divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:layout_below="@+id/event_reminder"
android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginTop="@dimen/medium_margin"
android:background="#66808080"/>
<LinearLayout
android:id="@+id/custom_reminder_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/event_reminder"
android:layout_below="@+id/event_reminder_divider"
android:layout_marginLeft="@dimen/activity_margin"
android:orientation="horizontal"
android:visibility="gone">
@ -170,7 +200,8 @@
android:layout_height="match_parent"
android:entries="@array/custom_reminders"
android:gravity="center_vertical"
android:paddingLeft="@dimen/activity_margin"/>
android:paddingLeft="@dimen/activity_margin"
android:paddingStart="@dimen/activity_margin"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/custom_reminder_other_val"
@ -178,25 +209,31 @@
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="@dimen/activity_margin"
android:paddingStart="@dimen/activity_margin"
android:text="@string/before"/>
</LinearLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/event_repetition_label"
<ImageView
android:id="@+id/event_repetition_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/custom_reminder_holder"
android:layout_marginTop="@dimen/activity_margin"
android:text="@string/repetition"
android:textSize="@dimen/day_text_size"/>
android:layout_height="match_parent"
android:layout_alignBottom="@+id/event_repetition"
android:layout_alignTop="@+id/event_repetition"
android:layout_below="@+id/event_date_time_divider"
android:layout_marginLeft="@dimen/normal_margin"
android:layout_marginStart="@dimen/normal_margin"
android:alpha="0.8"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_repeat"/>
<com.simplemobiletools.commons.views.MyAppCompatSpinner
android:id="@+id/event_repetition"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/event_repetition_label"
android:layout_below="@+id/custom_reminder_holder"
android:layout_toRightOf="@+id/event_repetition_image"
android:entries="@array/repetition"
android:padding="@dimen/activity_margin"/>
android:padding="@dimen/normal_margin"/>
</RelativeLayout>
</ScrollView>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">Termin erfolgreich in der Vergangenheit hinzugefügt</string>
<string name="event_updated">Termin erfolgreich aktualisiert</string>
<string name="reminder">Erinnerung</string>
<string name="off">Aus</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">Zu Beginn</string>
<string name="custom">Benutzerdefiniert</string>
<string name="repetition">Wiederholung</string>
<string name="none">Keine</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Täglich</string>
<string name="weekly">Wöchentlich</string>
<string name="biweekly">Zweiwöchentlich</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">El evento en el pasado se ha añadido con éxito</string>
<string name="event_updated">El evento se ha actualizado con éxito</string>
<string name="reminder">Recordatorio</string>
<string name="off">Apagado</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">Al inicio</string>
<string name="custom">Personalizado</string>
<string name="repetition">Repetición</string>
<string name="none">Ninguno</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Diario</string>
<string name="weekly">Semanal</string>
<string name="biweekly">Quincenal</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">Evénement dans le passé ajouté avec succès</string>
<string name="event_updated">Evénement ajouté avec succès</string>
<string name="reminder">Rappel</string>
<string name="off">Désactivé</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">Au démarrage</string>
<string name="custom">Personnalisé</string>
<string name="repetition">Répétition</string>
<string name="none">Aucune</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Quotidienne</string>
<string name="weekly">Hebdomadaire</string>
<string name="biweekly">Bihebdomadaire</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">भुत में इवेंट सफलतापूर्वक जोड़ा गया</string>
<string name="event_updated">इवेंट सफलतापूर्वक अपडेट किया गया</string>
<string name="reminder">रिमाइंडर</string>
<string name="off">ऑफ</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">शुरुआत के समय</string>
<string name="custom">Custom</string>
<string name="repetition">दुहराव</string>
<string name="none">कोई नहीं</string>
<string name="no_repetition">No repetition</string>
<string name="daily">रोज</string>
<string name="weekly">साप्ताहिक</string>
<string name="biweekly">हर दो सफ्ताह</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">Korábbi bejegyzés hozzáadva</string>
<string name="event_updated">Bejegyzés frissítve</string>
<string name="reminder">Emlékeztető</string>
<string name="off">Ki</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">A kezdetekor</string>
<string name="custom">Egyedi</string>
<string name="repetition">Ismétlés</string>
<string name="none">Nincs</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Naponta</string>
<string name="weekly">Hetente</string>
<string name="biweekly">Kéthetente</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">Event in the past added successfully</string>
<string name="event_updated">Evento aggiornato correttamente</string>
<string name="reminder">Promemoria</string>
<string name="off">Off</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">All\'inizio</string>
<string name="custom">Custom</string>
<string name="repetition">Repetition</string>
<string name="none">None</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Daily</string>
<string name="weekly">Weekly</string>
<string name="biweekly">Biweekly</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">אירוע בעבר הוסף בהצלחה</string>
<string name="event_updated">האירוע עודכן בהצלחה</string>
<string name="reminder">תזכורת</string>
<string name="off">כבוי</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">בהתחלה</string>
<string name="custom">מותאם אישית</string>
<string name="repetition">Repetition</string>
<string name="none">ללא</string>
<string name="no_repetition">No repetition</string>
<string name="daily">יום-יומית</string>
<string name="weekly">שבועית</string>
<string name="biweekly">דו-שבועית</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">過去のイベントを正常に追加しました</string>
<string name="event_updated">イベントを正常に更新しました</string>
<string name="reminder">リマインダー</string>
<string name="off">オフ</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">開始時</string>
<string name="custom">カスタム</string>
<string name="repetition">繰り返し</string>
<string name="none">なし</string>
<string name="no_repetition">No repetition</string>
<string name="daily">毎日</string>
<string name="weekly">毎週</string>
<string name="biweekly">隔週</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">Evento no passado adicionado com sucesso</string>
<string name="event_updated">Evento atualizado com sucesso</string>
<string name="reminder">Lembrete</string>
<string name="off">Desligado</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">No início</string>
<string name="custom">Personalizado</string>
<string name="repetition">Repetição</string>
<string name="none">Nenhuma</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Diária</string>
<string name="weekly">Semanal</string>
<string name="biweekly">Bissemanal</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">Событие в прошлом успешно создано</string>
<string name="event_updated">Событие успешно обновлено</string>
<string name="reminder">Напоминание</string>
<string name="off">Отключено</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">С наступлением события</string>
<string name="custom">Настраиваемое</string>
<string name="repetition">Повторять</string>
<string name="none">Нет</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Ежедневно</string>
<string name="weekly">Еженедельно</string>
<string name="biweekly">Раз в две недели</string>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">Händelsen ät tillagd</string>
<string name="event_updated">Händelsen uppdaterad</string>
<string name="reminder">Påminnelse</string>
<string name="off">Av</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">Vid start</string>
<string name="custom">Egen</string>
<string name="repetition">Repetition</string>
<string name="none">Ingen</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Dagligen</string>
<string name="weekly">Veckovis</string>
<string name="biweekly">Varannan vecka</string>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="reminders">
<item>@string/off</item>
<item>@string/no_reminder</item>
<item>@string/at_start</item>
<item>@string/custom</item>
</string-array>
@ -13,7 +13,7 @@
</string-array>
<string-array name="repetition">
<item>@string/none</item>
<item>@string/no_repetition</item>
<item>@string/daily</item>
<item>@string/weekly</item>
<item>@string/biweekly</item>

View File

@ -26,11 +26,11 @@
<string name="past_event_added">Event in the past added successfully</string>
<string name="event_updated">Event updated successfully</string>
<string name="reminder">Reminder</string>
<string name="off">Off</string>
<string name="no_reminder">No reminder</string>
<string name="at_start">At start</string>
<string name="custom">Custom</string>
<string name="repetition">Repetition</string>
<string name="none">None</string>
<string name="no_repetition">No repetition</string>
<string name="daily">Daily</string>
<string name="weekly">Weekly</string>
<string name="biweekly">Biweekly</string>