Add fake filter view + refine UI

This commit is contained in:
ganfra 2018-10-30 11:47:05 +01:00
parent 55efd226bb
commit ec27951850
9 changed files with 104 additions and 53 deletions

View File

@ -1,12 +1,12 @@
package im.vector.riotredesign.core.platform

import android.content.Context
import android.support.constraint.ConstraintLayout
import android.util.AttributeSet
import android.view.View
import android.widget.Checkable
import android.widget.FrameLayout

class CheckableConstraintLayout : ConstraintLayout, Checkable {
class CheckableFrameLayout : FrameLayout, Checkable {

private var mChecked = false

View File

@ -64,10 +64,10 @@ class RoomDetailFragment : RiotFragment(), TimelineEventAdapter.Callback {
layoutManager.stackFromEnd = true
timelineAdapter.registerAdapterDataObserver(object : RecyclerView.AdapterDataObserver() {
override fun onItemRangeInserted(positionStart: Int, itemCount: Int) {
/*if (layoutManager.findFirstVisibleItemPosition() == 0) {
if (layoutManager.findFirstVisibleItemPosition() == 0) {
layoutManager.scrollToPosition(0)
}
*/

}
})
recyclerView.layoutManager = layoutManager

View File

@ -5,7 +5,7 @@ import android.widget.ImageView
import android.widget.TextView
import im.vector.riotredesign.R
import im.vector.riotredesign.core.epoxy.KotlinModel
import im.vector.riotredesign.core.platform.CheckableConstraintLayout
import im.vector.riotredesign.core.platform.CheckableFrameLayout


data class RoomSummaryItem(
@ -17,11 +17,11 @@ data class RoomSummaryItem(

private val titleView by bind<TextView>(R.id.titleView)
private val avatarImageView by bind<ImageView>(R.id.avatarImageView)
private val rootView by bind<CheckableConstraintLayout>(R.id.itemRoomLayout)
private val rootView by bind<CheckableFrameLayout>(R.id.itemRoomLayout)

override fun bind() {
rootView.isChecked = isSelected
titleView.setOnClickListener { listener?.invoke() }
rootView.setOnClickListener { listener?.invoke() }
titleView.text = title
avatarImageView.setImageDrawable(avatarDrawable)
}

View File

@ -1,18 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<shape>
<solid android:color="@android:color/white"/>
</shape>
</item>

<item android:state_checked="true">
<shape>
<solid android:color="@android:color/white"/>
<solid android:color="@android:color/white" />
<corners android:radius="4dp" />
</shape>
</item>
<item>
<shape>
<solid android:color="@android:color/transparent"/>
<solid android:color="@android:color/transparent" />
</shape>
</item>


View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/light_blue_grey" />
<corners android:radius="4dp" />
</shape>

View File

@ -34,7 +34,7 @@

<TextView
android:id="@+id/toolbarTitleView"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
@ -50,7 +50,7 @@

<TextView
android:id="@+id/toolbarSubtitleView"
android:layout_width="wrap_content"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:layout_marginEnd="8dp"

View File

@ -1,13 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<im.vector.riotredesign.core.platform.StateView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/stateView"


<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/pale_grey">

<com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/epoxyRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<EditText
android:id="@+id/filterRoomView"
android:layout_width="0dp"
android:layout_height="32dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:background="@drawable/bg_search_edit_text"
android:drawableLeft="@drawable/ic_search_white"
android:drawablePadding="8dp"
android:drawableTint="#9fa9ba"
android:hint="Filter by name..."
android:paddingLeft="8dp"
app:layout_constraintBottom_toTopOf="@+id/stateView"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</im.vector.riotredesign.core.platform.StateView>
<im.vector.riotredesign.core.platform.StateView
android:id="@+id/stateView"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="0dp"
android:layout_marginEnd="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/filterRoomView">

<com.airbnb.epoxy.EpoxyRecyclerView
android:id="@+id/epoxyRecyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</im.vector.riotredesign.core.platform.StateView>

</android.support.constraint.ConstraintLayout>

View File

@ -1,36 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>

<im.vector.riotredesign.core.platform.CheckableConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<im.vector.riotredesign.core.platform.CheckableFrameLayout
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:id="@+id/itemRoomLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="8dp"
android:paddingRight="16dp"
android:foreground="?attr/selectableItemBackground"
android:background="@drawable/bg_room_item"
android:minHeight="48dp">
android:clickable="true"
android:focusable="true">

<ImageView
android:id="@+id/avatarImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" />

<TextView
android:id="@+id/titleView"
android:layout_width="0dp"
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
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/avatarImageView"
app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/full_names" />
android:minHeight="48dp">

</im.vector.riotredesign.core.platform.CheckableConstraintLayout>
<ImageView
android:id="@+id/avatarImageView"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="16dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:src="@tools:sample/avatars" />

<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/avatarImageView"
app:layout_constraintTop_toTopOf="parent"
tools:text="@tools:sample/full_names" />

</android.support.constraint.ConstraintLayout>

</im.vector.riotredesign.core.platform.CheckableFrameLayout>

View File

@ -4,20 +4,22 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:minHeight="24dp"
android:padding="16dp"
android:background="?attr/selectableItemBackground"
tools:background="@color/pale_grey">

<TextView
android:id="@+id/roomCategoryTitleView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_height="0dp"
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:gravity="center_vertical"
android:text="DIRECT MESSAGES"
android:textColor="@color/bluey_grey_two"
app:layout_constraintBottom_toBottomOf="parent"
@ -28,9 +30,9 @@

<ImageView
android:id="@+id/roomCategoryAddButton"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginEnd="8dp"
android:layout_width="32dp"
android:layout_height="32dp"

android:scaleType="centerInside"
android:src="@drawable/ic_add_circle_white"
android:tint="@color/bluey_grey_two"