add a location button for displaying the filled value on map, related to #216

This commit is contained in:
tibbi 2018-01-10 00:23:04 +01:00
parent 1bf5e223fa
commit c2f19d9dc0
33 changed files with 51 additions and 14 deletions

View File

@ -3,6 +3,8 @@ package com.simplemobiletools.calendar.activities
import android.annotation.SuppressLint
import android.app.DatePickerDialog
import android.app.TimePickerDialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.text.method.LinkMovementMethod
import android.view.Menu
@ -80,7 +82,7 @@ class EventActivity : SimpleActivity() {
updateCalDAVCalendar()
updateLocation()
event_location_button.setOnClickListener { setupLocation() }
event_show_on_map.setOnClickListener { showOnMap() }
event_start_date.setOnClickListener { setupStartDate() }
event_start_time.setOnClickListener { setupStartTime() }
event_end_date.setOnClickListener { setupEndDate() }
@ -651,8 +653,20 @@ class EventActivity : SimpleActivity() {
event_end_time.setTextColor(textColor)
}
private fun setupLocation() {
private fun showOnMap() {
if (event_location.value.isEmpty()) {
toast(R.string.please_fill_location)
return
}
val location = Uri.encode(event_location.value)
val uri = Uri.parse("geo:0,0?q=$location")
val intent = Intent(Intent.ACTION_VIEW, uri)
if (intent.resolveActivity(packageManager) != null) {
startActivity(intent)
} else {
toast(R.string.no_app_found)
}
}
@SuppressLint("NewApi")
@ -755,6 +769,6 @@ class EventActivity : SimpleActivity() {
event_reminder_image.applyColorFilter(textColor)
event_type_image.applyColorFilter(textColor)
event_caldav_calendar_image.applyColorFilter(textColor)
event_location_button.applyColorFilter(config.primaryColor)
event_show_on_map.applyColorFilter(getAdjustedPrimaryColor())
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 437 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 970 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -34,7 +34,7 @@
android:layout_below="@+id/event_title"
android:layout_marginLeft="@dimen/activity_margin"
android:layout_marginTop="@dimen/activity_margin"
android:layout_toLeftOf="@+id/event_location_button"
android:layout_toLeftOf="@+id/event_show_on_map"
android:hint="@string/location"
android:inputType="textCapWords"
android:maxLength="80"
@ -44,7 +44,7 @@
android:textSize="@dimen/day_text_size"/>
<ImageView
android:id="@+id/event_location_button"
android:id="@+id/event_show_on_map"
style="@style/MyBorderlessBackgroundStyle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
@ -54,9 +54,9 @@
android:layout_alignTop="@+id/event_location"
android:layout_marginEnd="@dimen/activity_margin"
android:layout_marginRight="@dimen/activity_margin"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
android:src="@drawable/ic_map"/>
android:paddingLeft="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"
android:src="@drawable/ic_place"/>
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/event_description"

View File

@ -26,6 +26,7 @@
<string name="event_added">Darvoud ouzhpennet gant berzh</string>
<string name="event_updated">Darvoud hizivaet gant berzh</string>
<string name="filter_events_by_type">Silañ an darvoudoù dre rizh</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Addegouezh</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Událost úspěšně přidána</string>
<string name="event_updated">Událost úspěšně změněna</string>
<string name="filter_events_by_type">Filtrovat události podle typu</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Opakovaná událost</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Begivenhed tilføjet</string>
<string name="event_updated">Begivenhed ændret</string>
<string name="filter_events_by_type">Filtrer begivenheder efter type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Gentagelse</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Termin erfolgreich hinzugefügt</string>
<string name="event_updated">Termin erfolgreich aktualisiert</string>
<string name="filter_events_by_type">Sortiere Termine nach Typ</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Wiederholung</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">El evento se ha añadido con éxito</string>
<string name="event_updated">El evento se ha actualizado con éxito</string>
<string name="filter_events_by_type">Filtrar eventos según tipo</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Repetición</string>

View File

@ -13,11 +13,11 @@
<string name="go_to_today">Aller à aujourd\'hui</string>
<string name="snooze">Snooze</string>
<!-- Titres des widgets -->
<!-- Widget titles -->
<string name="widget_monthly">Calendrier mensuel</string>
<string name="widget_list">Liste d\'événements du calendrier</string>
<!-- Événement -->
<!-- Event -->
<string name="event">Événement</string>
<string name="edit_event">Éditer l\'événement</string>
<string name="new_event">Nouvel événement</string>
@ -26,6 +26,7 @@
<string name="event_added">Événement ajouté avec succès</string>
<string name="event_updated">Événement ajouté avec succès</string>
<string name="filter_events_by_type">Filtrer les événements par type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Répétition</string>
@ -154,7 +155,7 @@
<string name="filename_without_ics">Nom de fichier (sans .ics)</string>
<string name="no_title">Pas de titre</string>
<!-- Détails d'un événement -->
<!-- Event details -->
<string name="title">Titre</string>
<string name="location">Lieu</string>
<string name="description">Description</string>
@ -163,7 +164,7 @@
<!-- Weekly view -->
<string name="week">Semaine</string>
<!-- Types d'événement -->
<!-- Event types -->
<string name="event_types">Type d\'événement</string>
<string name="add_new_type">Ajouter un nouveau type</string>
<string name="edit_type">Éditer le type</string>
@ -176,7 +177,7 @@
<string name="remove_affected_events">Supprimer de façon permanente les événements affectés</string>
<string name="unsync_caldav_calendar">Pour supprimer un calendrier CalDAV vous devez le désynchroniser</string>
<!-- Anniversaires -->
<!-- Holidays -->
<string name="holidays">Jours fériés</string>
<string name="add_holidays">Ajouter des jours fériés</string>
<string name="national_holidays">Jours fériés nationaux</string>
@ -185,7 +186,7 @@
<string name="importing_some_holidays_failed">L\'import de certains événements a échoué</string>
<string name="importing_holidays_failed">L\'import des jours fériés a échoué</string>
<!-- Paramètres -->
<!-- Settings -->
<string name="manage_event_types">Gestion des types d\'événements</string>
<string name="use_24_hour_format">Utiliser le format 24 heures</string>
<string name="sunday_first">Dimanche en premier jour</string>

View File

@ -27,6 +27,7 @@
<string name="event_updated">इवेंट सफलतापूर्वक अपडेट किया गया</string>
<string name="filter">Filter</string>
<string name="filter_events_by_type">Filter events by type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">दुहराव</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Bejegyzés hozzáadva</string>
<string name="event_updated">Bejegyzés frissítve</string>
<string name="filter_events_by_type">Filter events by type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Ismétlés</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Evento aggiunto correttamente</string>
<string name="event_updated">Evento aggiornato correttamente</string>
<string name="filter_events_by_type">Filtra eventi per tipologia</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Ripeti</string>

View File

@ -27,6 +27,7 @@
<string name="event_updated">האירוע עודכן בהצלחה</string>
<string name="filter">Filter</string>
<string name="filter_events_by_type">Filter events by type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Repetition</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">イベントを正常に追加しました</string>
<string name="event_updated">イベントを正常に更新しました</string>
<string name="filter_events_by_type">Filter events by type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">繰り返し</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">이벤트가 성공적으로 추가되었습니다</string>
<string name="event_updated">이벤트를 수정했습니다</string>
<string name="filter_events_by_type">유형별 이벤트</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">반복</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Hendelse vellykket lagt til</string>
<string name="event_updated">Hendelse vellykket oppdatert</string>
<string name="filter_events_by_type">Filtrer hendelser etter type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Gjentagelse</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Afspraak gemaakt</string>
<string name="event_updated">Afspraak bijgewerkt</string>
<string name="filter_events_by_type">Afspraken op type filteren</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Herhaling</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Hendelse vellykket lagt til</string>
<string name="event_updated">Hendelse vellykket oppdatert</string>
<string name="filter_events_by_type">Filtrer hendelser etter type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Gjentagelse</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Wydarzenie zostało dodane</string>
<string name="event_updated">Wydarzenie zostało zaktualizowane</string>
<string name="filter_events_by_type">Filtruj wydarzenia według typu</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Powtórzenie</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Evento adicionado com sucesso</string>
<string name="event_updated">Evento atualizado com sucesso</string>
<string name="filter_events_by_type">Filtrar eventos por tipo</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Repetição</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Evento adicionado com sucesso</string>
<string name="event_updated">Evento atualizado com sucesso</string>
<string name="filter_events_by_type">Filtrar eventos por tipo</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Repetição</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Событие успешно добавлено</string>
<string name="event_updated">Событие успешно обновлено</string>
<string name="filter_events_by_type">Фильтровать события по типу</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Повторять</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Udalosť bola úspešne pridaná</string>
<string name="event_updated">Udalosť bola úspešne upravená</string>
<string name="filter_events_by_type">Filtrovať udalosti podľa typu</string>
<string name="please_fill_location">Prosím zadajte polohu, ktorá má byť zobrazená na mape</string>
<!-- Event Repetition -->
<string name="repetition">Opakovanie</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Händelsen tillagd</string>
<string name="event_updated">Händelsen uppdaterad</string>
<string name="filter_events_by_type">Filtrera händelser efter typ</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Upprepning</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Etkinlik başarıyla eklendi</string>
<string name="event_updated">Etkinlik başarıyla güncellendi</string>
<string name="filter_events_by_type">Etkinlikleri türe göre filtreleyin</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Tekrarla</string>

View File

@ -26,6 +26,7 @@
<string name="event_added">Event added successfully</string>
<string name="event_updated">Event updated successfully</string>
<string name="filter_events_by_type">Filter events by type</string>
<string name="please_fill_location">Please fill in a location to be shown on the map</string>
<!-- Event Repetition -->
<string name="repetition">Repetition</string>