diff --git a/CHANGES.md b/CHANGES.md
index 761d8a4634..c3469f0661 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -14,6 +14,7 @@ Improvements 🙌:
- Handle events of type "m.room.server_acl" (#890)
- Room creation form: add advanced section to disable federation (#1314)
- Move "Enable Encryption" from room setting screen to room profile screen (#2394)
+ - Home empty screens quick design update (#2347)
- Improve Invite user screen (seamless search for matrix ID)
Bugfix 🐛:
diff --git a/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt b/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt
new file mode 100644
index 0000000000..b1b30da156
--- /dev/null
+++ b/vector/src/main/java/im/vector/app/core/extensions/ConstraintLayout.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2020 New Vector Ltd
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package im.vector.app.core.extensions
+
+import androidx.constraintlayout.widget.ConstraintLayout
+import androidx.constraintlayout.widget.ConstraintSet
+
+fun ConstraintLayout.updateConstraintSet(block: (ConstraintSet) -> Unit) {
+ ConstraintSet().let {
+ it.clone(this)
+ block.invoke(it)
+ it.applyTo(this)
+ }
+}
diff --git a/vector/src/main/java/im/vector/app/core/platform/StateView.kt b/vector/src/main/java/im/vector/app/core/platform/StateView.kt
index 2af3235cdf..9ecb03cb15 100755
--- a/vector/src/main/java/im/vector/app/core/platform/StateView.kt
+++ b/vector/src/main/java/im/vector/app/core/platform/StateView.kt
@@ -21,8 +21,10 @@ import android.graphics.drawable.Drawable
import android.util.AttributeSet
import android.view.View
import android.widget.FrameLayout
+import androidx.constraintlayout.widget.ConstraintSet
import androidx.core.view.isVisible
import im.vector.app.R
+import im.vector.app.core.extensions.updateConstraintSet
import kotlinx.android.synthetic.main.view_state.view.*
class StateView @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null, defStyle: Int = 0)
@@ -31,7 +33,12 @@ class StateView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
sealed class State {
object Content : State()
object Loading : State()
- data class Empty(val title: CharSequence? = null, val image: Drawable? = null, val message: CharSequence? = null) : State()
+ data class Empty(
+ val title: CharSequence? = null,
+ val image: Drawable? = null,
+ val isBigImage: Boolean = false,
+ val message: CharSequence? = null
+ ) : State()
data class Error(val message: CharSequence? = null) : State()
}
@@ -71,6 +78,9 @@ class StateView @JvmOverloads constructor(context: Context, attrs: AttributeSet?
is State.Loading -> Unit
is State.Empty -> {
emptyImageView.setImageDrawable(newState.image)
+ emptyView.updateConstraintSet {
+ it.constrainPercentHeight(R.id.emptyImageView, if (newState.isBigImage) 0.5f else 0.1f)
+ }
emptyMessageView.text = newState.message
emptyTitleView.text = newState.title
}
diff --git a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt
index 60c2745b44..b4f525c119 100644
--- a/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt
+++ b/vector/src/main/java/im/vector/app/features/home/room/list/RoomListFragment.kt
@@ -294,28 +294,30 @@ class RoomListFragment @Inject constructor(
RoomListDisplayMode.NOTIFICATIONS -> {
if (hasNoRoom) {
StateView.State.Empty(
- getString(R.string.room_list_catchup_welcome_title),
- ContextCompat.getDrawable(requireContext(), R.drawable.ic_home_bottom_catchup),
- getString(R.string.room_list_catchup_welcome_body)
+ title = getString(R.string.room_list_catchup_welcome_title),
+ image = ContextCompat.getDrawable(requireContext(), R.drawable.ic_home_bottom_catchup),
+ message = getString(R.string.room_list_catchup_welcome_body)
)
} else {
StateView.State.Empty(
- getString(R.string.room_list_catchup_empty_title),
- ContextCompat.getDrawable(requireContext(), R.drawable.ic_noun_party_popper),
- getString(R.string.room_list_catchup_empty_body))
+ title = getString(R.string.room_list_catchup_empty_title),
+ image = ContextCompat.getDrawable(requireContext(), R.drawable.ic_noun_party_popper),
+ message = getString(R.string.room_list_catchup_empty_body))
}
}
RoomListDisplayMode.PEOPLE ->
StateView.State.Empty(
- getString(R.string.room_list_people_empty_title),
- ContextCompat.getDrawable(requireContext(), R.drawable.ic_home_bottom_chat),
- getString(R.string.room_list_people_empty_body)
+ title = getString(R.string.room_list_people_empty_title),
+ image = ContextCompat.getDrawable(requireContext(), R.drawable.empty_state_dm),
+ isBigImage = true,
+ message = getString(R.string.room_list_people_empty_body)
)
RoomListDisplayMode.ROOMS ->
StateView.State.Empty(
- getString(R.string.room_list_rooms_empty_title),
- ContextCompat.getDrawable(requireContext(), R.drawable.ic_home_bottom_group),
- getString(R.string.room_list_rooms_empty_body)
+ title = getString(R.string.room_list_rooms_empty_title),
+ image = ContextCompat.getDrawable(requireContext(), R.drawable.empty_state_room),
+ isBigImage = true,
+ message = getString(R.string.room_list_rooms_empty_body)
)
else ->
// Always display the content in this mode, because if the footer
diff --git a/vector/src/main/res/drawable-nodpi/empty_state_dm.png b/vector/src/main/res/drawable-nodpi/empty_state_dm.png
new file mode 100644
index 0000000000..12eedc803f
Binary files /dev/null and b/vector/src/main/res/drawable-nodpi/empty_state_dm.png differ
diff --git a/vector/src/main/res/drawable-nodpi/empty_state_room.png b/vector/src/main/res/drawable-nodpi/empty_state_room.png
new file mode 100644
index 0000000000..4fd93b2893
Binary files /dev/null and b/vector/src/main/res/drawable-nodpi/empty_state_room.png differ
diff --git a/vector/src/main/res/layout/view_state.xml b/vector/src/main/res/layout/view_state.xml
index 2d11daadbc..11f176e405 100644
--- a/vector/src/main/res/layout/view_state.xml
+++ b/vector/src/main/res/layout/view_state.xml
@@ -20,7 +20,9 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
- android:padding="@dimen/layout_horizontal_margin">
+ android:padding="@dimen/layout_horizontal_margin"
+ android:visibility="gone"
+ tools:visibility="visible">
-
-
+
+
-
-
+ app:layout_constraintTop_toBottomOf="@id/emptyImageView"
+ app:layout_constraintVertical_chainStyle="packed"
+ tools:text="@string/room_list_people_empty_title" />
+ app:layout_constraintTop_toBottomOf="@+id/emptyTitleView"
+ app:layout_constraintVertical_chainStyle="packed"
+ tools:text="@string/room_list_people_empty_body" />
diff --git a/vector/src/main/res/values-land/styles.xml b/vector/src/main/res/values-land/styles.xml
new file mode 100644
index 0000000000..df40b71183
--- /dev/null
+++ b/vector/src/main/res/values-land/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml
index f82e7f6fe7..2cb6eb9af9 100644
--- a/vector/src/main/res/values/strings.xml
+++ b/vector/src/main/res/values/strings.xml
@@ -1644,9 +1644,9 @@
Welcome home!
Catch up on unread messages here
Conversations
- Your direct message conversations will be displayed here
+ Your direct message conversations will be displayed here. Tap the + bottom right to start some.
Rooms
- Your rooms will be displayed here
+ Your rooms will be displayed here. Tap the + bottom right to find existing ones or start some of your own.
Reactions
Agree
diff --git a/vector/src/main/res/values/styles.xml b/vector/src/main/res/values/styles.xml
index 09f17a77b4..8cc1fe70d8 100644
--- a/vector/src/main/res/values/styles.xml
+++ b/vector/src/main/res/values/styles.xml
@@ -3,4 +3,8 @@
+
+
\ No newline at end of file