add contacts shimmer and improve link-based conversation creation items

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
Andy Scherzinger 2021-05-02 21:40:33 +02:00
parent d152ac2a3c
commit 8766bf2eb1
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B
6 changed files with 151 additions and 34 deletions

View File

@ -23,11 +23,11 @@ package com.nextcloud.talk.controllers;
import android.app.SearchManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.text.InputType;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
@ -36,7 +36,8 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.EditorInfo;
import android.widget.ProgressBar;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import com.bluelinelabs.conductor.RouterTransaction;
@ -46,7 +47,6 @@ import com.kennyc.bottomsheet.BottomSheet;
import com.nextcloud.talk.R;
import com.nextcloud.talk.activities.MagicCallActivity;
import com.nextcloud.talk.adapters.items.GenericTextHeaderItem;
import com.nextcloud.talk.adapters.items.ProgressItem;
import com.nextcloud.talk.adapters.items.UserItem;
import com.nextcloud.talk.api.NcApi;
import com.nextcloud.talk.application.NextcloudTalkApplication;
@ -62,8 +62,6 @@ import com.nextcloud.talk.models.json.autocomplete.AutocompleteUser;
import com.nextcloud.talk.models.json.conversations.Conversation;
import com.nextcloud.talk.models.json.conversations.RoomOverall;
import com.nextcloud.talk.models.json.participants.Participant;
import com.nextcloud.talk.models.json.sharees.Sharee;
import com.nextcloud.talk.models.json.sharees.ShareesOverall;
import com.nextcloud.talk.utils.ApiUtils;
import com.nextcloud.talk.utils.ConductorRemapping;
import com.nextcloud.talk.utils.KeyboardUtils;
@ -90,6 +88,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.SearchView;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.view.MenuItemCompat;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
@ -121,17 +120,14 @@ public class ContactsController extends BaseController implements SearchView.OnQ
@Nullable
@BindView(R.id.initial_relative_layout)
RelativeLayout initialRelativeLayout;
@Nullable
@BindView(R.id.secondary_relative_layout)
RelativeLayout secondaryRelativeLayout;
@Inject
UserUtils userUtils;
@Inject
EventBus eventBus;
@Inject
AppPreferences appPreferences;
@BindView(R.id.progressBar)
ProgressBar progressBar;
@BindView(R.id.loading_content)
LinearLayout loadingContent;
@BindView(R.id.recycler_view)
RecyclerView recyclerView;
@ -147,11 +143,27 @@ public class ContactsController extends BaseController implements SearchView.OnQ
@BindView(R.id.joinConversationViaLinkRelativeLayout)
RelativeLayout joinConversationViaLinkLayout;
@BindView(R.id.joinConversationViaLinkImageView)
ImageView joinConversationViaLinkImageView;
@BindView(R.id.public_call_link)
ImageView publicCallLinkImageView;
@BindView(R.id.generic_rv_layout)
CoordinatorLayout genericRvLayout;
@Inject
NcApi ncApi;
@Inject
UserUtils userUtils;
@Inject
EventBus eventBus;
@Inject
AppPreferences appPreferences;
private String credentials;
private UserEntity currentUser;
private Disposable contactsQueryDisposable;
@ -160,8 +172,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
private List<AbstractFlexibleItem> contactItems;
private BottomSheet bottomSheet;
private View view;
private int currentPage;
private int currentSearchPage;
private SmoothScrollLinearLayoutManager layoutManager;
@ -174,8 +184,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
private HashMap<String, GenericTextHeaderItem> userHeaderItems = new HashMap<>();
private boolean alreadyFetching = false;
private boolean canFetchFurther = true;
private boolean canFetchSearchFurther = true;
private MenuItem doneMenuItem;
@ -229,7 +237,6 @@ public class ContactsController extends BaseController implements SearchView.OnQ
joinConversationViaLinkLayout.setVisibility(View.GONE);
conversationPrivacyToogleLayout.setVisibility(View.GONE);
}
}
@Override
@ -658,12 +665,22 @@ public class ContactsController extends BaseController implements SearchView.OnQ
}
});
joinConversationViaLinkImageView
.getBackground()
.setColorFilter(ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null),
PorterDuff.Mode.SRC_IN);
publicCallLinkImageView
.getBackground()
.setColorFilter(ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null),
PorterDuff.Mode.SRC_IN);
disengageProgressBar();
}
private void disengageProgressBar() {
if (!alreadyFetching) {
progressBar.setVisibility(View.GONE);
loadingContent.setVisibility(View.GONE);
genericRvLayout.setVisibility(View.VISIBLE);
if (isNewConversationView) {

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Nextcloud Android client application
@author Andy Scherzinger
Copyright (C) 2019 Andy Scherzinger
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#ffffff"/>
</shape>

View File

@ -18,24 +18,48 @@
~ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<LinearLayout 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:gravity="center"
android:orientation="vertical"
android:animateLayoutChanges="true">
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="@dimen/item_height"
android:layout_height="@dimen/item_height"
android:layout_gravity="center"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:indeterminate="true"
android:indeterminateTint="@color/colorPrimary"
android:indeterminateTintMode="src_in" />
<LinearLayout
android:id="@+id/loading_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<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>
<include
layout="@layout/join_conversation_via_link"

View File

@ -43,9 +43,11 @@
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/standard_margin"
android:background="@drawable/round_bgnd"
android:contentDescription="@null"
android:padding="@dimen/standard_half_padding"
android:src="@drawable/ic_public_black_24px"
app:tint="@color/colorPrimary" />
app:tint="@color/white" />
<TextView
android:layout_width="match_parent"

View File

@ -37,9 +37,11 @@
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/standard_margin"
android:background="@drawable/round_bgnd"
android:contentDescription="@null"
android:padding="@dimen/standard_half_padding"
android:src="@drawable/ic_public_black_24px"
app:tint="@color/colorPrimary" />
app:tint="@color/white" />
<TextView
android:layout_width="match_parent"

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Nextcloud Talk application
~
~ @author Andy Scherzinger
~ Copyright (C) 2021 Andy Scherzinger
~
~ 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_marginStart="@dimen/standard_margin"
android:layout_marginTop="@dimen/standard_half_margin"
android:layout_marginEnd="@dimen/standard_margin"
android:layout_marginBottom="@dimen/standard_half_margin"
android:orientation="vertical">
<com.elyeproj.loaderviewlibrary.LoaderTextView
android:id="@+id/simple_drawee_view"
android:layout_width="@dimen/avatar_size"
android:layout_height="@dimen/avatar_size"
android:layout_centerVertical="true"
android:layout_marginEnd="@dimen/standard_margin"
app:corners="100"
app:custom_color="@color/nc_shimmer_default_color" />
<com.elyeproj.loaderviewlibrary.LoaderTextView
android:id="@+id/name_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@id/simple_drawee_view"
app:custom_color="@color/nc_shimmer_default_color" />
</RelativeLayout>