update empty conversations screen and added shimmer effect for loading conversations initially

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-04-10 00:13:07 +02:00 committed by Marcel Hibbe
parent 77ea691d47
commit 02483c134d
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
5 changed files with 114 additions and 31 deletions

View File

@ -30,10 +30,8 @@ import android.graphics.Bitmap;
import android.os.Build; import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.text.Editable;
import android.text.InputType; import android.text.InputType;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
@ -41,7 +39,7 @@ import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo; import android.view.inputmethod.EditorInfo;
import android.widget.ProgressBar; import android.widget.LinearLayout;
import android.widget.RelativeLayout; import android.widget.RelativeLayout;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -155,8 +153,8 @@ public class ConversationsListController extends BaseController implements Searc
@BindView(R.id.swipeRefreshLayoutView) @BindView(R.id.swipeRefreshLayoutView)
SwipeRefreshLayout swipeRefreshLayout; SwipeRefreshLayout swipeRefreshLayout;
@BindView(R.id.progressBar) @BindView(R.id.loading_content)
ProgressBar progressBarView; LinearLayout loadingContent;
@BindView(R.id.emptyLayout) @BindView(R.id.emptyLayout)
RelativeLayout emptyLayoutView; RelativeLayout emptyLayoutView;
@ -216,7 +214,7 @@ public class ConversationsListController extends BaseController implements Searc
if (adapter == null) { if (adapter == null) {
adapter = new FlexibleAdapter<>(callItems, getActivity(), true); adapter = new FlexibleAdapter<>(callItems, getActivity(), true);
} else { } else {
progressBarView.setVisibility(View.GONE); loadingContent.setVisibility(View.GONE);
} }
adapter.addListener(this); adapter.addListener(this);
@ -416,7 +414,7 @@ public class ConversationsListController extends BaseController implements Searc
if (adapterWasNull) { if (adapterWasNull) {
adapterWasNull = false; adapterWasNull = false;
progressBarView.setVisibility(View.GONE); loadingContent.setVisibility(View.GONE);
} }
if (roomsOverall.getOcs().getData().size() > 0) { if (roomsOverall.getOcs().getData().size() > 0) {

View File

@ -25,42 +25,68 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ProgressBar <LinearLayout
android:id="@+id/progressBar" android:id="@+id/loading_content"
android:layout_width="@dimen/item_height" android:layout_width="match_parent"
android:layout_height="@dimen/item_height" android:layout_height="wrap_content"
android:layout_gravity="center" android:orientation="vertical">
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin" <include layout="@layout/rv_item_conversation_with_last_message_shimmer" />
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin" <include layout="@layout/rv_item_conversation_with_last_message_shimmer" />
android:indeterminate="true"
android:indeterminateTint="@color/colorPrimary" <include layout="@layout/rv_item_conversation_with_last_message_shimmer" />
android:indeterminateTintMode="src_in" />
<include layout="@layout/rv_item_conversation_with_last_message_shimmer" />
</LinearLayout>
<RelativeLayout <RelativeLayout
android:id="@+id/emptyLayout" android:id="@+id/emptyLayout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:visibility="gone"> android:layout_gravity="center"
android:visibility="gone"
tools:visibility="visible">
<ImageView <ImageView
android:id="@+id/noConversationsImageView" android:id="@+id/empty_list_icon"
android:layout_width="72dp" android:layout_width="match_parent"
android:layout_height="72dp" android:layout_height="72dp"
android:layout_centerInParent="true" android:contentDescription="@string/nc_app_name"
android:src="@drawable/ic_logo" android:src="@drawable/ic_logo"
android:tint="@color/colorPrimary" /> app:tint="#989898" />
<TextView <TextView
android:id="@+id/sendHiTextView" android:id="@+id/empty_list_view_headline"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@+id/noConversationsImageView" android:layout_below="@id/empty_list_icon"
android:layout_margin="8dp" android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:paddingTop="@dimen/standard_padding"
android:paddingBottom="@dimen/standard_half_padding"
android:text="@string/nc_conversations_empty" android:text="@string/nc_conversations_empty"
android:textAlignment="center" android:textAlignment="center"
android:textSize="20sp" /> android:textColor="@color/conversation_item_header"
android:textSize="22sp" />
<TextView
android:id="@+id/empty_list_view_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/empty_list_view_headline"
android:layout_gravity="center_horizontal"
android:ellipsize="end"
android:gravity="center"
android:paddingTop="@dimen/standard_half_padding"
android:paddingBottom="@dimen/standard_half_padding"
android:text="@string/nc_conversations_empty_details"
android:textAlignment="center"
android:textColor="@color/textColorMaxContrast"
android:textSize="16sp" />
</RelativeLayout> </RelativeLayout>
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout <androidx.swiperefreshlayout.widget.SwipeRefreshLayout

View File

@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud Talk application
~
~ @author Andy Scherzinger
~ Copyright (C) 2021 Andy Scherzinger <info@andy-scherzinger.de>
~
~ 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
~ the Free Software Foundation, either version 3 of the License, or
~ at your option) any later version.
~
~ This program is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
~
-->
<RelativeLayout 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="wrap_content"
android:layout_margin="@dimen/double_margin_between_elements">
<com.elyeproj.loaderviewlibrary.LoaderImageView
android:id="@+id/activity_icon"
android:layout_width="@dimen/small_item_height"
android:layout_height="@dimen/small_item_height"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/double_margin_between_elements"
android:contentDescription="@null"
app:corners="100" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_toEndOf="@id/activity_icon"
android:orientation="vertical">
<com.elyeproj.loaderviewlibrary.LoaderTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="128dp"
android:textStyle="bold" />
<com.elyeproj.loaderviewlibrary.LoaderTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="6dp" />
</LinearLayout>
</RelativeLayout>

View File

@ -259,7 +259,8 @@
<string name="nc_description_send_message_button">Nachricht senden</string> <string name="nc_description_send_message_button">Nachricht senden</string>
<!-- Empty states --> <!-- Empty states -->
<string name="nc_conversations_empty">Treten Sie einer Unterhaltung bei oder starten Sie eine neue\n Sagen Sie Hallo zu Ihren Freunden und Kollegen!</string> <string name="nc_conversations_empty">Treten Sie einer Unterhaltung bei \noder starten Sie eine neue</string>
<string name="nc_conversations_empty_details">Sagen Sie Hallo zu Ihren Freunden und Kollegen!</string>
<string name="nc_hello">Hallo</string> <string name="nc_hello">Hallo</string>
<!-- Other --> <!-- Other -->

View File

@ -287,7 +287,8 @@
<string name="nc_description_send_message_button">Send message</string> <string name="nc_description_send_message_button">Send message</string>
<!-- Empty states --> <!-- Empty states -->
<string name="nc_conversations_empty">Join a conversation or start a new one\n Say hi to your friends and colleagues!</string> <string name="nc_conversations_empty">Join a conversation or start a new one</string>
<string name="nc_conversations_empty_details">Say hi to your friends and colleagues!</string>
<string name="nc_hello">Hello</string> <string name="nc_hello">Hello</string>
<!-- Other --> <!-- Other -->