From a6dca03bc70783c772dcc64c25efd1b8168c318d Mon Sep 17 00:00:00 2001 From: Moez Bhatti Date: Mon, 13 Aug 2018 01:37:50 +0200 Subject: [PATCH] Fix DetailedChip colors, migrate it and Contact list item to ConstraintLayout --- .../QKSMS/feature/compose/DetailedChipView.kt | 10 +- .../main/res/layout/contact_chip_detailed.xml | 115 ++++++++-------- .../src/main/res/layout/contact_list_item.xml | 128 +++++++++--------- .../res/layout/contact_number_list_item.xml | 2 - 4 files changed, 135 insertions(+), 120 deletions(-) diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/DetailedChipView.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/DetailedChipView.kt index f7391f76..5bcca0da 100755 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/DetailedChipView.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/DetailedChipView.kt @@ -25,6 +25,7 @@ import android.widget.RelativeLayout import com.moez.QKSMS.R import com.moez.QKSMS.common.util.Colors import com.moez.QKSMS.common.util.extensions.setBackgroundTint +import com.moez.QKSMS.common.util.extensions.setTint import com.moez.QKSMS.injection.appComponent import com.moez.QKSMS.model.Contact import kotlinx.android.synthetic.main.contact_chip_detailed.view.* @@ -46,13 +47,18 @@ class DetailedChipView(context: Context) : RelativeLayout(context) { isFocusable = true isFocusableInTouchMode = true - card.setBackgroundTint(colors.theme().theme) + colors.theme().let { theme -> + card.setBackgroundTint(theme.theme) + name.setTextColor(theme.textPrimary) + info.setTextColor(theme.textTertiary) + delete.setTint(theme.textPrimary) + } } fun setContact(contact: Contact) { avatar.setContact(contact) name.text = contact.name - info.text = contact.numbers.map { it.address }.toString() + info.text = contact.numbers.joinToString(", ") { it.address } } fun show() { diff --git a/presentation/src/main/res/layout/contact_chip_detailed.xml b/presentation/src/main/res/layout/contact_chip_detailed.xml index b4bf0456..9ad72373 100755 --- a/presentation/src/main/res/layout/contact_chip_detailed.xml +++ b/presentation/src/main/res/layout/contact_chip_detailed.xml @@ -17,65 +17,72 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:layout_margin="8dp" + android:background="@drawable/rounded_rectangle_2dp" + android:elevation="8dp" + android:gravity="center_vertical" + android:paddingBottom="8dp" + android:paddingStart="16dp" + android:paddingTop="8dp" + tools:backgroundTint="@color/tools_theme"> - + + + android:layout_marginStart="16dp" + android:ellipsize="end" + android:maxLines="1" + android:scrollHorizontally="true" + app:layout_constraintBottom_toTopOf="@id/info" + app:layout_constraintEnd_toStartOf="@id/delete" + app:layout_constraintHorizontal_bias="0" + app:layout_constraintStart_toEndOf="@id/avatar" + app:layout_constraintTop_toTopOf="parent" + app:layout_constraintVertical_chainStyle="packed" + app:textSize="primary" + tools:text="Moez Bhatti" + tools:textColor="@color/textPrimaryDark" /> - + - + - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/presentation/src/main/res/layout/contact_list_item.xml b/presentation/src/main/res/layout/contact_list_item.xml index 9a633a29..b6a696f8 100644 --- a/presentation/src/main/res/layout/contact_list_item.xml +++ b/presentation/src/main/res/layout/contact_list_item.xml @@ -17,78 +17,82 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see . --> - + android:layout_height="wrap_content"> - + + + + + + + + - - - - - - - - - - - - - - - - - - + android:layout_height="56dp" + android:background="?attr/selectableItemBackground" /> - \ No newline at end of file + \ No newline at end of file diff --git a/presentation/src/main/res/layout/contact_number_list_item.xml b/presentation/src/main/res/layout/contact_number_list_item.xml index 26fe8f79..88aa8d17 100644 --- a/presentation/src/main/res/layout/contact_number_list_item.xml +++ b/presentation/src/main/res/layout/contact_number_list_item.xml @@ -28,7 +28,6 @@ android:id="@+id/address" android:layout_width="0dp" android:layout_height="40dp" - android:layout_marginStart="72dp" android:layout_weight="1" android:gravity="center_vertical" app:textColor="secondary" @@ -41,7 +40,6 @@ style="@style/TextSecondary" android:layout_width="wrap_content" android:layout_height="40dp" - android:layout_marginEnd="16dp" android:gravity="center_vertical" tools:text="Mobile" tools:textColor="@color/textTertiary" />