Add quick room category to list (WIP, not clean at all)
|
@ -2,5 +2,5 @@ package im.vector.riotredesign.core.extensions
|
|||
|
||||
|
||||
fun CharSequence.firstCharAsString(): String {
|
||||
return this[0].toString()
|
||||
return if (isNotEmpty()) this[0].toString() else ""
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package im.vector.riotredesign.features.home.room.list
|
||||
|
||||
import android.support.annotation.DrawableRes
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.core.epoxy.KotlinModel
|
||||
|
||||
data class RoomCategoryItem(
|
||||
val title: CharSequence,
|
||||
@DrawableRes val expandDrawable: Int,
|
||||
val listener: (() -> Unit)? = null
|
||||
) : KotlinModel(R.layout.item_room_category) {
|
||||
|
||||
override fun bind() {
|
||||
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package im.vector.riotredesign.features.home.room.list
|
|||
import android.content.Context
|
||||
import com.airbnb.epoxy.Typed2EpoxyController
|
||||
import im.vector.matrix.android.api.session.room.model.RoomSummary
|
||||
import im.vector.riotredesign.R
|
||||
import im.vector.riotredesign.features.home.RoomSummaryViewHelper
|
||||
|
||||
class RoomSummaryController(private val context: Context,
|
||||
|
@ -10,6 +11,13 @@ class RoomSummaryController(private val context: Context,
|
|||
) : Typed2EpoxyController<List<RoomSummary>, RoomSummary>() {
|
||||
|
||||
override fun buildModels(summaries: List<RoomSummary>?, selected: RoomSummary?) {
|
||||
RoomCategoryItem(
|
||||
title = "DIRECT MESSAGES",
|
||||
expandDrawable = R.drawable.ic_expand_more_white
|
||||
)
|
||||
.id("direct_messages")
|
||||
.addTo(this)
|
||||
|
||||
summaries?.forEach {
|
||||
val roomSummaryViewHelper = RoomSummaryViewHelper(it)
|
||||
RoomSummaryItem(
|
||||
|
@ -27,4 +35,4 @@ class RoomSummaryController(private val context: Context,
|
|||
fun onRoomSelected(room: RoomSummary)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ data class RoomSummaryItem(
|
|||
) : KotlinModel(R.layout.item_room) {
|
||||
|
||||
private val titleView by bind<TextView>(R.id.titleView)
|
||||
private val avatarImageView by bind<ImageView>(R.id.toolbarAvatarImageView)
|
||||
private val avatarImageView by bind<ImageView>(R.id.avatarImageView)
|
||||
private val rootView by bind<CheckableConstraintLayout>(R.id.itemRoomLayout)
|
||||
|
||||
override fun bind() {
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/black" android:state_checked="true" />
|
||||
<item android:color="@color/bluey_grey_two" />
|
||||
|
||||
</selector>
|
After Width: | Height: | Size: 404 B |
After Width: | Height: | Size: 185 B |
After Width: | Height: | Size: 203 B |
After Width: | Height: | Size: 492 B |
After Width: | Height: | Size: 266 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 158 B |
After Width: | Height: | Size: 306 B |
After Width: | Height: | Size: 509 B |
After Width: | Height: | Size: 216 B |
After Width: | Height: | Size: 248 B |
After Width: | Height: | Size: 574 B |
After Width: | Height: | Size: 770 B |
After Width: | Height: | Size: 297 B |
After Width: | Height: | Size: 347 B |
After Width: | Height: | Size: 899 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 375 B |
After Width: | Height: | Size: 447 B |
After Width: | Height: | Size: 1.1 KiB |
|
@ -10,7 +10,7 @@
|
|||
android:minHeight="48dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/toolbarAvatarImageView"
|
||||
android:id="@+id/avatarImageView"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:layout_marginStart="16dp"
|
||||
|
@ -19,16 +19,17 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:src="@tools:sample/avatars" />
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
<TextView
|
||||
android:id="@+id/titleView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:duplicateParentState="true"
|
||||
android:textColor="@color/color_room_title"
|
||||
android:textSize="14sp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/toolbarAvatarImageView"
|
||||
app:layout_constraintStart_toEndOf="@id/avatarImageView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:text="@tools:sample/full_names" />
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:minHeight="24dp"
|
||||
android:padding="16dp"
|
||||
tools:background="@color/pale_grey">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/roomCategoryTitleView"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:gravity="center_vertical"
|
||||
android:drawableLeft="@drawable/ic_expand_more_white"
|
||||
android:drawableTint="@color/bluey_grey_two"
|
||||
android:foregroundTint="@color/bluey_grey_two"
|
||||
android:text="DIRECT MESSAGES"
|
||||
android:textColor="@color/bluey_grey_two"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/roomCategoryAddButton"
|
||||
app:layout_constraintHorizontal_bias="0.0"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/roomCategoryAddButton"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_add_circle_white"
|
||||
android:tint="@color/bluey_grey_two"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
|
@ -9,5 +9,10 @@
|
|||
<color name="bluey_grey">#a5a5a6</color>
|
||||
<color name="slate_grey">#5f6268</color>
|
||||
<color name="sky_blue">#7bb2ea</color>
|
||||
|
||||
<color name="bluey_grey_two">#929eb4</color>
|
||||
<color name="light_blue_grey">#c1c9d6</color>
|
||||
<color name="dark_grey">#2e2f32</color>
|
||||
<color name="light_grey_blue">#9fa9ba</color>
|
||||
<color name="cool_grey">#a5aab2</color>
|
||||
<color name="pale_grey_two">#ebedf8</color>
|
||||
</resources>
|
||||
|
|