Loading presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt +14 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ package com.moez.QKSMS.feature.compose.part import android.content.ContentUris import android.content.Context import android.view.Gravity import android.view.View import android.widget.FrameLayout import com.moez.QKSMS.R import com.moez.QKSMS.common.Navigator import com.moez.QKSMS.common.util.Colors Loading Loading @@ -49,11 +51,18 @@ class VCardBinder( override fun canBindPart(part: MmsPart) = part.isVCard() override fun bindPart(view: View, part: MmsPart, message: Message, canGroupWithPrevious: Boolean, canGroupWithNext: Boolean) { override fun bindPart( view: View, part: MmsPart, message: Message, canGroupWithPrevious: Boolean, canGroupWithNext: Boolean ) { val uri = ContentUris.withAppendedId(CursorToPartImpl.CONTENT_URI, part.id) val bubble = BubbleUtils.getBubble(canGroupWithPrevious, canGroupWithNext, message.isMe()) view.setOnClickListener { navigator.saveVcard(uri) } view.vCardBackground.setBackgroundResource(BubbleUtils.getBubble(canGroupWithPrevious, canGroupWithNext, message.isMe())) view.vCardBackground.setBackgroundResource(bubble) Observable.just(uri) .map(context.contentResolver::openInputStream) Loading @@ -62,12 +71,15 @@ class VCardBinder( .observeOn(AndroidSchedulers.mainThread()) .subscribe { vcard -> view.name?.text = vcard.formattedName.value } val params = view.vCardBackground.layoutParams as FrameLayout.LayoutParams if (!message.isMe()) { view.vCardBackground.layoutParams = params.apply { gravity = Gravity.START } view.vCardBackground.setBackgroundTint(theme.theme) view.vCardAvatar.setTint(theme.textPrimary) view.name.setTextColor(theme.textPrimary) view.label.setTextColor(theme.textTertiary) } else { view.vCardBackground.layoutParams = params.apply { gravity = Gravity.END } view.vCardBackground.setBackgroundTint(view.context.resolveThemeColor(R.attr.bubbleColor)) view.vCardAvatar.setTint(view.context.resolveThemeColor(android.R.attr.textColorSecondary)) view.name.setTextColor(view.context.resolveThemeColor(android.R.attr.textColorPrimary)) Loading presentation/src/main/res/layout/mms_vcard_list_item.xml +42 −45 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- <?xml version="1.0" encoding="utf-8"?><!-- ~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com> ~ ~ This file is part of QKSMS. Loading @@ -17,21 +16,17 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>. --> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="2dp"> <View <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/vCardBackground" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="@id/label" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="@id/name" /> android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:id="@+id/vCardAvatar" Loading @@ -48,9 +43,9 @@ android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingEnd="12dp" android:paddingStart="12dp" android:paddingTop="8dp" android:paddingEnd="12dp" android:textColor="?android:attr/textColorPrimary" app:layout_constraintStart_toEndOf="@id/vCardAvatar" app:textSize="primary" Loading @@ -60,9 +55,9 @@ android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="8dp" android:paddingEnd="12dp" android:paddingStart="12dp" android:paddingEnd="12dp" android:paddingBottom="8dp" android:text="@string/compose_vcard_label" android:textColor="?android:attr/textColorTertiary" app:layout_constraintStart_toStartOf="@id/name" Loading @@ -70,3 +65,5 @@ app:textSize="secondary" /> </androidx.constraintlayout.widget.ConstraintLayout> </FrameLayout> No newline at end of file Loading
presentation/src/main/java/com/moez/QKSMS/feature/compose/part/VCardBinder.kt +14 −2 Original line number Diff line number Diff line Loading @@ -20,7 +20,9 @@ package com.moez.QKSMS.feature.compose.part import android.content.ContentUris import android.content.Context import android.view.Gravity import android.view.View import android.widget.FrameLayout import com.moez.QKSMS.R import com.moez.QKSMS.common.Navigator import com.moez.QKSMS.common.util.Colors Loading Loading @@ -49,11 +51,18 @@ class VCardBinder( override fun canBindPart(part: MmsPart) = part.isVCard() override fun bindPart(view: View, part: MmsPart, message: Message, canGroupWithPrevious: Boolean, canGroupWithNext: Boolean) { override fun bindPart( view: View, part: MmsPart, message: Message, canGroupWithPrevious: Boolean, canGroupWithNext: Boolean ) { val uri = ContentUris.withAppendedId(CursorToPartImpl.CONTENT_URI, part.id) val bubble = BubbleUtils.getBubble(canGroupWithPrevious, canGroupWithNext, message.isMe()) view.setOnClickListener { navigator.saveVcard(uri) } view.vCardBackground.setBackgroundResource(BubbleUtils.getBubble(canGroupWithPrevious, canGroupWithNext, message.isMe())) view.vCardBackground.setBackgroundResource(bubble) Observable.just(uri) .map(context.contentResolver::openInputStream) Loading @@ -62,12 +71,15 @@ class VCardBinder( .observeOn(AndroidSchedulers.mainThread()) .subscribe { vcard -> view.name?.text = vcard.formattedName.value } val params = view.vCardBackground.layoutParams as FrameLayout.LayoutParams if (!message.isMe()) { view.vCardBackground.layoutParams = params.apply { gravity = Gravity.START } view.vCardBackground.setBackgroundTint(theme.theme) view.vCardAvatar.setTint(theme.textPrimary) view.name.setTextColor(theme.textPrimary) view.label.setTextColor(theme.textTertiary) } else { view.vCardBackground.layoutParams = params.apply { gravity = Gravity.END } view.vCardBackground.setBackgroundTint(view.context.resolveThemeColor(R.attr.bubbleColor)) view.vCardAvatar.setTint(view.context.resolveThemeColor(android.R.attr.textColorSecondary)) view.name.setTextColor(view.context.resolveThemeColor(android.R.attr.textColorPrimary)) Loading
presentation/src/main/res/layout/mms_vcard_list_item.xml +42 −45 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- <?xml version="1.0" encoding="utf-8"?><!-- ~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com> ~ ~ This file is part of QKSMS. Loading @@ -17,21 +16,17 @@ ~ You should have received a copy of the GNU General Public License ~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>. --> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="wrap_content" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="2dp"> <View <androidx.constraintlayout.widget.ConstraintLayout android:id="@+id/vCardBackground" android:layout_width="0dp" android:layout_height="0dp" app:layout_constraintBottom_toBottomOf="@id/label" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="@id/name" /> android:layout_width="wrap_content" android:layout_height="wrap_content"> <ImageView android:id="@+id/vCardAvatar" Loading @@ -48,9 +43,9 @@ android:id="@+id/name" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingEnd="12dp" android:paddingStart="12dp" android:paddingTop="8dp" android:paddingEnd="12dp" android:textColor="?android:attr/textColorPrimary" app:layout_constraintStart_toEndOf="@id/vCardAvatar" app:textSize="primary" Loading @@ -60,9 +55,9 @@ android:id="@+id/label" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingBottom="8dp" android:paddingEnd="12dp" android:paddingStart="12dp" android:paddingEnd="12dp" android:paddingBottom="8dp" android:text="@string/compose_vcard_label" android:textColor="?android:attr/textColorTertiary" app:layout_constraintStart_toStartOf="@id/name" Loading @@ -70,3 +65,5 @@ app:textSize="secondary" /> </androidx.constraintlayout.widget.ConstraintLayout> </FrameLayout> No newline at end of file