add holders for multiple phone numbers and emails

This commit is contained in:
tibbi 2017-12-18 16:57:24 +01:00
parent 4b05d5366f
commit 21a85dfa53
4 changed files with 108 additions and 62 deletions

View File

@ -113,10 +113,10 @@ class ContactActivity : SimpleActivity() {
//contact_start_call.setOnClickListener { startCallIntent(contact!!.number) }
//contact_send_email.setOnClickListener { sendEmailIntent(contact!!.email) }
contact_source.setOnClickListener { showAccountSourcePicker() }
contact_number_type.setOnClickListener { }
contact_email_type.setOnClickListener { }
contact_number_add_new.setOnClickListener { }
contact_email_add_new.setOnClickListener { }
// contact_number_type.setOnClickListener { }
// contact_email_type.setOnClickListener { }
contact_number_add_new.setOnClickListener { addNewPhoneNumberField() }
contact_email_add_new.setOnClickListener { addNewEmailField() }
updateTextColors(contact_scrollview)
wasActivityInitialized = true
@ -150,8 +150,8 @@ class ContactActivity : SimpleActivity() {
contact!!.phoneNumbers.forEachIndexed { index, number ->
if (index == 0) {
contact_number.setText(number.value)
contact_number_type.setText(number.getTextId())
/*contact_number.setText(number.value)
contact_number_type.setText(number.getTextId())*/
} else {
}
@ -159,8 +159,8 @@ class ContactActivity : SimpleActivity() {
contact!!.emails.forEachIndexed { index, email ->
if (index == 0) {
contact_email.setText(email.value)
contact_email_type.setText(email.getTextId())
/*contact_email.setText(email.value)
contact_email_type.setText(email.getTextId())*/
} else {
}
@ -194,6 +194,14 @@ class ContactActivity : SimpleActivity() {
}
}
private fun addNewPhoneNumberField() {
}
private fun addNewEmailField() {
}
private fun deleteContact() {
ConfirmationDialog(this) {
ContactsHelper(this).deleteContact(contact!!)

View File

@ -122,49 +122,31 @@
android:id="@+id/contact_number_image"
android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_number"
android:layout_alignTop="@+id/contact_numbers_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_phone"/>
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_number"
<LinearLayout
android:id="@+id/contact_numbers_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_surname"
android:layout_centerVertical="true"
android:layout_marginTop="@dimen/normal_margin"
android:layout_toLeftOf="@+id/contact_number_type"
android:layout_toRightOf="@+id/contact_name_image"
android:hint="@string/number"
android:inputType="phone"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size"/>
android:layout_marginTop="@dimen/medium_margin"
android:layout_toRightOf="@+id/contact_number_image"
android:orientation="vertical">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_number_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/contact_number"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_number"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
android:text="@string/mobile"
android:textSize="@dimen/bigger_text_size"/>
<include layout="@layout/item_phone_number"/>
</LinearLayout>
<ImageView
android:id="@+id/contact_number_add_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_number"
android:layout_below="@+id/contact_numbers_holder"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/small_margin"
android:background="@drawable/button_background"
@ -178,49 +160,31 @@
android:id="@+id/contact_email_image"
android:layout_width="@dimen/contact_icons_size"
android:layout_height="@dimen/contact_icons_size"
android:layout_alignTop="@+id/contact_email"
android:layout_alignTop="@+id/contact_emails_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_email"/>
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_email"
<LinearLayout
android:id="@+id/contact_emails_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_number_add_new"
android:layout_centerVertical="true"
android:layout_marginTop="@dimen/medium_margin"
android:layout_toLeftOf="@+id/contact_email_type"
android:layout_toRightOf="@+id/contact_name_image"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size"/>
android:orientation="vertical">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_email_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/contact_email"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_email"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
android:text="@string/home"
android:textSize="@dimen/bigger_text_size"/>
<include layout="@layout/item_email"/>
</LinearLayout>
<ImageView
android:id="@+id/contact_email_add_new"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/contact_email"
android:layout_below="@+id/contact_emails_holder"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/small_margin"
android:background="@drawable/button_background"

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_email_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_email_type"
android:layout_toStartOf="@+id/contact_email_type"
android:hint="@string/email"
android:inputType="textEmailAddress"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_email_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/contact_email"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_email"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
android:text="@string/home"
android:textSize="@dimen/bigger_text_size"/>
</RelativeLayout>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/contact_number_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyEditText
android:id="@+id/contact_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/contact_number_type"
android:layout_toStartOf="@+id/contact_number_type"
android:hint="@string/number"
android:inputType="phone"
android:lines="1"
android:maxLines="1"
android:singleLine="true"
android:textSize="@dimen/bigger_text_size"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/contact_number_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/contact_number"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="@+id/contact_number"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:paddingLeft="@dimen/medium_margin"
android:paddingRight="@dimen/medium_margin"
android:text="@string/mobile"
android:textSize="@dimen/bigger_text_size"/>
</RelativeLayout>