From ec27951850616f416ce7101b25c55a1836c46f52 Mon Sep 17 00:00:00 2001 From: ganfra Date: Tue, 30 Oct 2018 11:47:05 +0100 Subject: [PATCH] Add fake filter view + refine UI --- ...raintLayout.kt => CheckableFrameLayout.kt} | 4 +- .../home/room/detail/RoomDetailFragment.kt | 4 +- .../home/room/list/RoomSummaryItem.kt | 6 +- app/src/main/res/drawable/bg_room_item.xml | 11 ++-- .../main/res/drawable/bg_search_edit_text.xml | 5 ++ .../main/res/layout/fragment_room_detail.xml | 4 +- .../main/res/layout/fragment_room_list.xml | 48 ++++++++++++--- app/src/main/res/layout/item_room.xml | 61 +++++++++++-------- .../main/res/layout/item_room_category.xml | 14 +++-- 9 files changed, 104 insertions(+), 53 deletions(-) rename app/src/main/java/im/vector/riotredesign/core/platform/{CheckableConstraintLayout.kt => CheckableFrameLayout.kt} (90%) create mode 100644 app/src/main/res/drawable/bg_search_edit_text.xml diff --git a/app/src/main/java/im/vector/riotredesign/core/platform/CheckableConstraintLayout.kt b/app/src/main/java/im/vector/riotredesign/core/platform/CheckableFrameLayout.kt similarity index 90% rename from app/src/main/java/im/vector/riotredesign/core/platform/CheckableConstraintLayout.kt rename to app/src/main/java/im/vector/riotredesign/core/platform/CheckableFrameLayout.kt index 967c0a8c..28aadd58 100644 --- a/app/src/main/java/im/vector/riotredesign/core/platform/CheckableConstraintLayout.kt +++ b/app/src/main/java/im/vector/riotredesign/core/platform/CheckableFrameLayout.kt @@ -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 diff --git a/app/src/main/java/im/vector/riotredesign/features/home/room/detail/RoomDetailFragment.kt b/app/src/main/java/im/vector/riotredesign/features/home/room/detail/RoomDetailFragment.kt index ccb88653..efe9fcad 100644 --- a/app/src/main/java/im/vector/riotredesign/features/home/room/detail/RoomDetailFragment.kt +++ b/app/src/main/java/im/vector/riotredesign/features/home/room/detail/RoomDetailFragment.kt @@ -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 diff --git a/app/src/main/java/im/vector/riotredesign/features/home/room/list/RoomSummaryItem.kt b/app/src/main/java/im/vector/riotredesign/features/home/room/list/RoomSummaryItem.kt index c4b10606..c9f943c0 100644 --- a/app/src/main/java/im/vector/riotredesign/features/home/room/list/RoomSummaryItem.kt +++ b/app/src/main/java/im/vector/riotredesign/features/home/room/list/RoomSummaryItem.kt @@ -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(R.id.titleView) private val avatarImageView by bind(R.id.avatarImageView) - private val rootView by bind(R.id.itemRoomLayout) + private val rootView by bind(R.id.itemRoomLayout) override fun bind() { rootView.isChecked = isSelected - titleView.setOnClickListener { listener?.invoke() } + rootView.setOnClickListener { listener?.invoke() } titleView.text = title avatarImageView.setImageDrawable(avatarDrawable) } diff --git a/app/src/main/res/drawable/bg_room_item.xml b/app/src/main/res/drawable/bg_room_item.xml index 19bc072b..7a8d5873 100644 --- a/app/src/main/res/drawable/bg_room_item.xml +++ b/app/src/main/res/drawable/bg_room_item.xml @@ -1,18 +1,15 @@ - - - - - + - + + - + diff --git a/app/src/main/res/drawable/bg_search_edit_text.xml b/app/src/main/res/drawable/bg_search_edit_text.xml new file mode 100644 index 00000000..bba3fa26 --- /dev/null +++ b/app/src/main/res/drawable/bg_search_edit_text.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_room_detail.xml b/app/src/main/res/layout/fragment_room_detail.xml index 3dff21eb..0f22a314 100644 --- a/app/src/main/res/layout/fragment_room_detail.xml +++ b/app/src/main/res/layout/fragment_room_detail.xml @@ -34,7 +34,7 @@ - - + - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_room.xml b/app/src/main/res/layout/item_room.xml index c19e5a54..3f81df9e 100644 --- a/app/src/main/res/layout/item_room.xml +++ b/app/src/main/res/layout/item_room.xml @@ -1,36 +1,49 @@ - + android:clickable="true" + android:focusable="true"> - - - + android:minHeight="48dp"> - \ No newline at end of file + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/item_room_category.xml b/app/src/main/res/layout/item_room_category.xml index c0115b5a..480b7837 100644 --- a/app/src/main/res/layout/item_room_category.xml +++ b/app/src/main/res/layout/item_room_category.xml @@ -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">