Merge pull request #3692 from nextcloud/place-shimmer-below

Place shimmer on top of the view to avoid view jumping
This commit is contained in:
Marcel Hibbe 2024-03-05 13:30:23 +01:00 committed by GitHub
commit 528abff080
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 80 additions and 55 deletions

View File

@ -68,10 +68,10 @@ import com.nextcloud.talk.models.json.participants.Participant
import com.nextcloud.talk.openconversations.ListOpenConversationsActivity import com.nextcloud.talk.openconversations.ListOpenConversationsActivity
import com.nextcloud.talk.users.UserManager import com.nextcloud.talk.users.UserManager
import com.nextcloud.talk.utils.ApiUtils import com.nextcloud.talk.utils.ApiUtils
import com.nextcloud.talk.utils.CapabilitiesUtil
import com.nextcloud.talk.utils.SpreedFeatures import com.nextcloud.talk.utils.SpreedFeatures
import com.nextcloud.talk.utils.UserIdUtils.getIdForUser import com.nextcloud.talk.utils.UserIdUtils.getIdForUser
import com.nextcloud.talk.utils.bundle.BundleKeys import com.nextcloud.talk.utils.bundle.BundleKeys
import com.nextcloud.talk.utils.CapabilitiesUtil
import eu.davidea.flexibleadapter.FlexibleAdapter import eu.davidea.flexibleadapter.FlexibleAdapter
import eu.davidea.flexibleadapter.SelectableAdapter import eu.davidea.flexibleadapter.SelectableAdapter
import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager import eu.davidea.flexibleadapter.common.SmoothScrollLinearLayoutManager
@ -198,9 +198,11 @@ class ContactsActivity :
isAddingParticipantsView -> { isAddingParticipantsView -> {
resources!!.getString(R.string.nc_add_participants) resources!!.getString(R.string.nc_add_participants)
} }
isNewConversationView -> { isNewConversationView -> {
resources!!.getString(R.string.nc_select_participants) resources!!.getString(R.string.nc_select_participants)
} }
else -> { else -> {
resources!!.getString(R.string.nc_app_product_name) resources!!.getString(R.string.nc_app_product_name)
} }
@ -247,10 +249,12 @@ class ContactsActivity :
finish() finish()
true true
} }
R.id.contacts_selection_done -> { R.id.contacts_selection_done -> {
selectionDone() selectionDone()
true true
} }
else -> { else -> {
super.onOptionsItemSelected(item) super.onOptionsItemSelected(item)
} }
@ -280,11 +284,13 @@ class ContactsActivity :
roomType = "2" roomType = "2"
userId = selectedGroupIds.iterator().next() userId = selectedGroupIds.iterator().next()
} }
selectedCircleIds.size == 1 -> { selectedCircleIds.size == 1 -> {
roomType = "2" roomType = "2"
sourceType = "circles" sourceType = "circles"
userId = selectedCircleIds.iterator().next() userId = selectedCircleIds.iterator().next()
} }
else -> { else -> {
userId = selectedUserIds.iterator().next() userId = selectedUserIds.iterator().next()
} }
@ -564,9 +570,11 @@ class ContactsActivity :
participant.calculatedActorType == Participant.ActorType.GROUPS -> { participant.calculatedActorType == Participant.ActorType.GROUPS -> {
resources!!.getString(R.string.nc_groups) resources!!.getString(R.string.nc_groups)
} }
participant.calculatedActorType == Participant.ActorType.CIRCLES -> { participant.calculatedActorType == Participant.ActorType.CIRCLES -> {
resources!!.getString(R.string.nc_teams) resources!!.getString(R.string.nc_teams)
} }
else -> { else -> {
participant.displayName!!.substring(0, 1).uppercase(Locale.getDefault()) participant.displayName!!.substring(0, 1).uppercase(Locale.getDefault())
} }
@ -678,6 +686,7 @@ class ContactsActivity :
private fun disengageProgressBar() { private fun disengageProgressBar() {
if (!alreadyFetching) { if (!alreadyFetching) {
binding.contactsRv.visibility = View.VISIBLE
binding.loadingContent.visibility = View.GONE binding.loadingContent.visibility = View.GONE
binding.root.visibility = View.VISIBLE binding.root.visibility = View.VISIBLE
if (isNewConversationView) { if (isNewConversationView) {

View File

@ -3,8 +3,10 @@
~ ~
~ @author Andy Scherzinger ~ @author Andy Scherzinger
~ @author Marcel Hibbe ~ @author Marcel Hibbe
~ @author Parneet Singh
~ Copyright (C) 2018 Andy Scherzinger ~ Copyright (C) 2018 Andy Scherzinger
~ Copyright (C) 2023 Marcel Hibbe <dev@mhibbe.de> ~ Copyright (C) 2023 Marcel Hibbe <dev@mhibbe.de>
~ Copyright (C) 2024 Parneet Singh <gurayaparneet@gmail.com>
~ ~
~ This program is free software: you can redistribute it and/or modify ~ This program is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by ~ it under the terms of the GNU General Public License as published by
@ -19,18 +21,21 @@
~ You should have received a copy of the GNU General Public License ~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>. ~ along with this program. If not, see <http://www.gnu.org/licenses/>.
--> -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:animateLayoutChanges="true"> android:animateLayoutChanges="true">
<com.google.android.material.appbar.AppBarLayout <com.google.android.material.appbar.AppBarLayout
android:id="@+id/contacts_appbar" android:id="@+id/contacts_appbar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.appbar.MaterialToolbar <com.google.android.material.appbar.MaterialToolbar
android:id="@+id/contacts_toolbar" android:id="@+id/contacts_toolbar"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -44,44 +49,6 @@
tools:title="@string/nc_app_product_name" /> tools:title="@string/nc_app_product_name" />
</com.google.android.material.appbar.AppBarLayout> </com.google.android.material.appbar.AppBarLayout>
<LinearLayout
android:id="@+id/loading_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
tools:visibility="gone">
<include layout="@layout/rv_item_contact_shimmer" />
<include layout="@layout/rv_item_contact_shimmer" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.elyeproj.loaderviewlibrary.LoaderTextView
android:id="@+id/title_text_view"
android:layout_width="16dp"
android:layout_height="32dp"
android:layout_marginStart="72dp"
android:layout_marginTop="@dimen/standard_half_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_half_margin"
app:custom_color="@color/nc_shimmer_default_color" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="?android:attr/listDivider" />
</LinearLayout>
<include layout="@layout/rv_item_contact_shimmer" />
<include layout="@layout/rv_item_contact_shimmer" />
<include layout="@layout/rv_item_contact_shimmer" />
</LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/call_header_layout" android:id="@+id/call_header_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -89,8 +56,9 @@
android:layout_marginStart="@dimen/standard_margin" android:layout_marginStart="@dimen/standard_margin"
android:layout_marginTop="@dimen/standard_half_margin" android:layout_marginTop="@dimen/standard_half_margin"
android:layout_marginEnd="@dimen/standard_margin" android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_half_margin" app:layout_constraintEnd_toEndOf="parent"
android:orientation="vertical"> app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/contacts_appbar">
<RelativeLayout <RelativeLayout
android:id="@+id/public_conversation_create" android:id="@+id/public_conversation_create"
@ -149,10 +117,12 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="@dimen/standard_margin" android:layout_marginStart="@dimen/standard_margin"
android:layout_marginTop="@dimen/standard_half_margin" android:layout_marginTop="@dimen/standard_margin"
android:layout_marginEnd="@dimen/standard_margin" android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_half_margin" android:layout_marginBottom="@dimen/standard_half_margin"
android:orientation="vertical"> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/call_header_layout">
<ImageView <ImageView
android:id="@+id/list_open_conversations_image" android:id="@+id/list_open_conversations_image"
@ -178,15 +148,61 @@
android:textAppearance="@style/ListItem" /> android:textAppearance="@style/ListItem" />
</RelativeLayout> </RelativeLayout>
<RelativeLayout <LinearLayout
android:id="@+id/loading_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:orientation="vertical"
android:layout_marginTop="@dimen/standard_half_margin"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/list_open_conversations"
tools:visibility="gone">
<include layout="@layout/rv_item_contact_shimmer" />
<include layout="@layout/rv_item_contact_shimmer" />
<LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical">
<com.elyeproj.loaderviewlibrary.LoaderTextView
android:id="@+id/title_text_view"
android:layout_width="16dp"
android:layout_height="32dp"
android:layout_marginStart="72dp"
android:layout_marginTop="@dimen/standard_half_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_half_margin"
app:custom_color="@color/nc_shimmer_default_color" />
<View
android:layout_width="match_parent"
android:layout_height="1px"
android:background="?android:attr/listDivider" />
</LinearLayout>
<include layout="@layout/rv_item_contact_shimmer" />
<include layout="@layout/rv_item_contact_shimmer" />
<include layout="@layout/rv_item_contact_shimmer" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/contacts_rv" android:id="@+id/contacts_rv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="0dp"
app:layout_anchorGravity="center" /> android:visibility="gone"
</RelativeLayout> tools:visibility="visible"
</LinearLayout> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/list_open_conversations" />
</androidx.constraintlayout.widget.ConstraintLayout>