Merge pull request #1209 from nextcloud/contactsImprovements

Add contacts shimmer and improve link-based conversation creation items
This commit is contained in:
Marcel Hibbe 2021-05-03 15:03:14 +02:00 committed by GitHub
commit e32207d11d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 160 additions and 40 deletions

View File

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

View File

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

View File

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

View File

@ -51,6 +51,8 @@
<color name="controller_chat_separator">#484848</color> <color name="controller_chat_separator">#484848</color>
<color name="colorBackgroundDarker">#2C2C2C</color>
<!-- Chat window incoming message text & informational --> <!-- Chat window incoming message text & informational -->
<color name="bg_bottom_sheet">#121212</color> <color name="bg_bottom_sheet">#121212</color>
<color name="bg_message_list_incoming_bubble">#484848</color> <color name="bg_message_list_incoming_bubble">#484848</color>

View File

@ -57,6 +57,7 @@
<color name="controller_call_incomingCallTextView">#E9FFFFFF</color> <color name="controller_call_incomingCallTextView">#E9FFFFFF</color>
<color name="grey950">#111111</color> <color name="grey950">#111111</color>
<color name="textColorMaxContrast">#767676</color> <color name="textColorMaxContrast">#767676</color>
<color name="colorBackgroundDarker">#DBDBDB</color>
<!-- Emoji list in chat window --> <!-- Emoji list in chat window -->
<color name="emoji_icons">#61000000</color> <color name="emoji_icons">#61000000</color>

View File

@ -1 +1 @@
489 485

View File

@ -1,2 +1,2 @@
DO NOT TOUCH; GENERATED BY DRONE DO NOT TOUCH; GENERATED BY DRONE
<span class="mdl-layout-title">Lint Report: 3 errors and 369 warnings</span> <span class="mdl-layout-title">Lint Report: 3 errors and 371 warnings</span>