adding a Groups field at Edit Contact Activity

This commit is contained in:
tibbi 2018-03-18 11:08:01 +01:00
parent dbad01e1fc
commit 8ad98e7c12
12 changed files with 114 additions and 1 deletions

View File

@ -166,6 +166,7 @@ class EditContactActivity : ContactActivity() {
contact_event_image.applyColorFilter(textColor)
contact_notes_image.applyColorFilter(textColor)
contact_source_image.applyColorFilter(textColor)
contact_groups_image.applyColorFilter(textColor)
val adjustedPrimaryColor = getAdjustedPrimaryColor()
contact_number_add_new.applyColorFilter(adjustedPrimaryColor)
@ -176,6 +177,8 @@ class EditContactActivity : ContactActivity() {
contact_address_add_new.background.applyColorFilter(textColor)
contact_event_add_new.applyColorFilter(adjustedPrimaryColor)
contact_event_add_new.background.applyColorFilter(textColor)
contact_groups_add_new.applyColorFilter(adjustedPrimaryColor)
contact_groups_add_new.background.applyColorFilter(textColor)
contact_toggle_favorite.setOnClickListener { toggleFavorite() }
contact_photo.setOnClickListener { trySetPhoto() }
@ -186,6 +189,7 @@ class EditContactActivity : ContactActivity() {
contact_email_add_new.setOnClickListener { addNewEmailField() }
contact_address_add_new.setOnClickListener { addNewAddressField() }
contact_event_add_new.setOnClickListener { addNewEventField() }
contact_groups_add_new.setOnClickListener { addNewGroupField() }
contact_toggle_favorite.apply {
setImageDrawable(getStarDrawable(contact!!.starred == 1))
@ -653,6 +657,10 @@ class EditContactActivity : ContactActivity() {
contact_events_holder.addView(eventHolder)
}
private fun addNewGroupField() {
}
private fun toggleFavorite() {
val isStarred = isContactStarred()
contact_toggle_favorite.apply {

View File

@ -313,6 +313,44 @@
android:textCursorDrawable="@null"
android:textSize="@dimen/bigger_text_size"/>
<ImageView
android:id="@+id/contact_groups_image"
android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_groups_holder"
android:paddingBottom="@dimen/small_margin"
android:paddingEnd="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"
android:paddingTop="@dimen/medium_margin"
android:src="@drawable/ic_group"/>
<LinearLayout
android:id="@+id/contact_groups_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_notes"
android:layout_marginTop="@dimen/medium_margin"
android:layout_toRightOf="@+id/contact_name_image"
android:orientation="vertical">
<include layout="@layout/item_group"/>
</LinearLayout>
<ImageView
android:id="@+id/contact_groups_add_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_groups_holder"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/small_margin"
android:background="@drawable/button_background"
android:paddingBottom="@dimen/medium_margin"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin"
android:src="@drawable/ic_plus"/>
<ImageView
android:id="@+id/contact_source_image"
android:layout_width="@dimen/contact_icons_size"
@ -328,7 +366,7 @@
android:id="@+id/contact_source"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_notes"
android:layout_below="@+id/contact_groups_add_new"
android:layout_centerVertical="true"
android:layout_marginTop="@dimen/medium_margin"
android:layout_toRightOf="@+id/contact_name_image"

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_group_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_group"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_group_remove"
android:layout_toStartOf="@+id/contact_group_remove"
android:alpha="0.5"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/normal_margin"
android:paddingLeft="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"
android:paddingTop="@dimen/normal_margin"
android:text="@string/no_groups"
android:textSize="@dimen/bigger_text_size"/>
<ImageView
android:id="@+id/contact_group_remove"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/contact_group"
android:layout_alignTop="@+id/contact_group"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/medium_margin"
android:layout_marginLeft="@dimen/small_margin"
android:layout_marginRight="@dimen/small_margin"
android:layout_marginTop="@dimen/medium_margin"
android:background="@drawable/button_background"
android:padding="@dimen/medium_margin"
android:src="@drawable/ic_minus"
android:visibility="gone"/>
</RelativeLayout>

View File

@ -6,6 +6,7 @@
<string name="updating">Aktualisiere…</string>
<string name="phone_storage">Gerätespeicher</string>
<string name="phone_storage_hidden">Gerätespeicher (nicht sichtbar für andere Apps)</string>
<string name="no_groups">No groups</string>
<string name="new_contact">Neuer Kontakt</string>
<string name="edit_contact">Kontakt bearbeiten</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">Beim Klicken auf den Kontakt</string>
<string name="call_contact">Kontakt anrufen</string>
<string name="view_contact">Kontaktdetails ansehen</string>
<string name="show_favorites_tab">Show favorites tab</string>
<string name="show_groups_tab">Show groups tab</string>
<!-- Emails -->
<string name="email">Email</string>

View File

@ -6,6 +6,7 @@
<string name="updating">Mise à jour…</string>
<string name="phone_storage">Stockage du téléphone</string>
<string name="phone_storage_hidden">Stockage du téléphone (non visible par d\'autres applis)</string>
<string name="no_groups">No groups</string>
<string name="new_contact">Nouveau contact</string>
<string name="edit_contact">Modifier contact</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">Sur appui du contact</string>
<string name="call_contact">Appeler le contact</string>
<string name="view_contact">Voir les détails du contact</string>
<string name="show_favorites_tab">Show favorites tab</string>
<string name="show_groups_tab">Show groups tab</string>
<!-- Emails -->
<string name="email">E-mail</string>

View File

@ -6,6 +6,7 @@
<string name="updating">수정중…</string>
<string name="phone_storage">Phone storage</string>
<string name="phone_storage_hidden">Phone storage (not visible by other apps)</string>
<string name="no_groups">No groups</string>
<string name="new_contact">새로운 연락처</string>
<string name="edit_contact">연락처 수정</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">On contact click</string>
<string name="call_contact">Call contact</string>
<string name="view_contact">View contact details</string>
<string name="show_favorites_tab">Show favorites tab</string>
<string name="show_groups_tab">Show groups tab</string>
<!-- Emails -->
<string name="email">이메일</string>

View File

@ -6,6 +6,7 @@
<string name="updating">A atualizar…</string>
<string name="phone_storage">Armazenamento do telefone</string>
<string name="phone_storage_hidden">Armazenamento do telefone (não visível por outras alicações)</string>
<string name="no_groups">No groups</string>
<string name="new_contact">Novo contacto</string>
<string name="edit_contact">Editar contacto</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">Ao clicar no contacto</string>
<string name="call_contact">Ligar</string>
<string name="view_contact">Ver detalhes</string>
<string name="show_favorites_tab">Show favorites tab</string>
<string name="show_groups_tab">Show groups tab</string>
<!-- Emails -->
<string name="email">E-mail</string>

View File

@ -6,6 +6,7 @@
<string name="updating">Обновление…</string>
<string name="phone_storage">Память устройства</string>
<string name="phone_storage_hidden">Память устройства (не видна другим приложениям)</string>
<string name="no_groups">No groups</string>
<string name="new_contact">Новый контакт</string>
<string name="edit_contact">Редактировать контакт</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">При нажатии на контакт</string>
<string name="call_contact">Позвонить контакту</string>
<string name="view_contact">Просмотреть подробности о контакте</string>
<string name="show_favorites_tab">Show favorites tab</string>
<string name="show_groups_tab">Show groups tab</string>
<!-- Emails -->
<string name="email">Эл. почта</string>

View File

@ -6,6 +6,7 @@
<string name="updating">Upravuje sa…</string>
<string name="phone_storage">Úložisko mobilu</string>
<string name="phone_storage_hidden">Úložisko mobilu (neviditeľné pre ostatné apky)</string>
<string name="no_groups">Žiadne skupiny</string>
<string name="new_contact">Nový kontakt</string>
<string name="edit_contact">Upraviť kontakt</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">Po kliknutí na kontakt</string>
<string name="call_contact">Zavolať kontakt</string>
<string name="view_contact">Zobraziť údaje kontaktu</string>
<string name="show_favorites_tab">Zobraziť okno s obľúbenými</string>
<string name="show_groups_tab">Zobraziť okno so skupinami</string>
<!-- Emails -->
<string name="email">Email</string>

View File

@ -6,6 +6,7 @@
<string name="updating">Uppdaterar…</string>
<string name="phone_storage">Telefonens lagringsutrymme</string>
<string name="phone_storage_hidden">Telefonens lagringsutrymme (inte synligt för andra appar)</string>
<string name="no_groups">No groups</string>
<string name="new_contact">Ny kontakt</string>
<string name="edit_contact">Redigera kontakt</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">Vid kontakttryckning</string>
<string name="call_contact">Ring kontakt</string>
<string name="view_contact">Visa kontaktuppgifter</string>
<string name="show_favorites_tab">Show favorites tab</string>
<string name="show_groups_tab">Show groups tab</string>
<!-- Emails -->
<string name="email">E-post</string>

View File

@ -6,6 +6,7 @@
<string name="updating">更新中…</string>
<string name="phone_storage">手機空間</string>
<string name="phone_storage_hidden">手機空間 (其他程式不可見)</string>
<string name="no_groups">No groups</string>
<string name="new_contact">新聯絡人</string>
<string name="edit_contact">編輯聯絡人</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">點擊聯絡人</string>
<string name="call_contact">打電話給聯絡人</string>
<string name="view_contact">顯示聯絡人資料</string>
<string name="show_favorites_tab">Show favorites tab</string>
<string name="show_groups_tab">Show groups tab</string>
<!-- Emails -->
<string name="email">信箱</string>

View File

@ -6,6 +6,7 @@
<string name="updating">Updating…</string>
<string name="phone_storage">Phone storage</string>
<string name="phone_storage_hidden">Phone storage (not visible by other apps)</string>
<string name="no_groups">No groups</string>
<string name="new_contact">New contact</string>
<string name="edit_contact">Edit contact</string>
@ -27,6 +28,8 @@
<string name="on_contact_click">On contact click</string>
<string name="call_contact">Call contact</string>
<string name="view_contact">View contact details</string>
<string name="show_favorites_tab">Show favorites tab</string>
<string name="show_groups_tab">Show groups tab</string>
<!-- Emails -->
<string name="email">Email</string>