Browse Source

add contacts shimmer and improve link-based conversation creation items

Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Andy Scherzinger 4 years ago
parent
commit
8766bf2eb1

+ 36 - 19
app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java

@@ -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;
-    @Inject
-    EventBus eventBus;
-    @Inject
-    AppPreferences appPreferences;
-    @BindView(R.id.progressBar)
-    ProgressBar progressBar;
+
+    @BindView(R.id.loading_content)
+    LinearLayout loadingContent;
+
     @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.colorPrimary, 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) {

+ 24 - 0
app/src/main/res/drawable/round_bgnd.xml

@@ -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>

+ 37 - 13
app/src/main/res/layout/controller_contacts_rv.xml

@@ -18,24 +18,48 @@
   ~ 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
-        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
     <include
         layout="@layout/join_conversation_via_link"
         layout="@layout/join_conversation_via_link"

+ 3 - 1
app/src/main/res/layout/conversation_privacy_toggle.xml

@@ -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: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"

+ 3 - 1
app/src/main/res/layout/join_conversation_via_link.xml

@@ -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"

+ 48 - 0
app/src/main/res/layout/rv_item_contact_shimmer.xml

@@ -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>