create custom view for avatarview, add to conversation layout

This commit is contained in:
Moez Bhatti
2017-08-28 23:54:49 -07:00
parent 1f63205089
commit aca0d14225
2 changed files with 45 additions and 16 deletions
@@ -0,0 +1,12 @@
package com.moez.QKSMS.ui.view
import android.content.Context
import android.util.AttributeSet
import android.widget.ImageView
class AvatarView(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : ImageView(context, attrs, defStyleAttr) {
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
constructor(context: Context) : this(context, null, 0)
}
@@ -1,28 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingBottom="8dp"
android:paddingEnd="16dp"
android:paddingStart="16dp"
android:paddingTop="8dp">
<TextView
android:id="@+id/title"
style="@style/TextPrimary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text="Moez Bhatti" />
<com.moez.QKSMS.ui.view.AvatarView
android:id="@+id/avatar"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_gravity="top"
android:background="@color/textSecondary" />
<TextView
android:id="@+id/snippet"
style="@style/TextSecondary"
android:layout_width="match_parent"
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
app:layout_constraintTop_toBottomOf="@+id/title"
tools:text="Hey! How's it going?" />
android:layout_weight="1"
android:orientation="vertical">
</android.support.constraint.ConstraintLayout>
<TextView
android:id="@+id/title"
style="@style/TextPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
tools:text="Moez Bhatti" />
<TextView
android:id="@+id/snippet"
style="@style/TextSecondary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="2dp"
tools:text="Hey! How's it going?" />
</LinearLayout>
</LinearLayout>