From 8766bf2eb1e6e5b970d3a10f174751271583b9a0 Mon Sep 17 00:00:00 2001 From: Andy Scherzinger Date: Sun, 2 May 2021 21:40:33 +0200 Subject: [PATCH] add contacts shimmer and improve link-based conversation creation items Signed-off-by: Andy Scherzinger --- .../talk/controllers/ContactsController.java | 55 ++++++++++++------- app/src/main/res/drawable/round_bgnd.xml | 24 ++++++++ .../res/layout/controller_contacts_rv.xml | 50 ++++++++++++----- .../layout/conversation_privacy_toggle.xml | 4 +- .../res/layout/join_conversation_via_link.xml | 4 +- .../res/layout/rv_item_contact_shimmer.xml | 48 ++++++++++++++++ 6 files changed, 151 insertions(+), 34 deletions(-) create mode 100644 app/src/main/res/drawable/round_bgnd.xml create mode 100644 app/src/main/res/layout/rv_item_contact_shimmer.xml diff --git a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java b/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java index cde5fdbca..ecf9915c3 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/ContactsController.java +++ b/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.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 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 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) { diff --git a/app/src/main/res/drawable/round_bgnd.xml b/app/src/main/res/drawable/round_bgnd.xml new file mode 100644 index 000000000..f4f807528 --- /dev/null +++ b/app/src/main/res/drawable/round_bgnd.xml @@ -0,0 +1,24 @@ + + + + + diff --git a/app/src/main/res/layout/controller_contacts_rv.xml b/app/src/main/res/layout/controller_contacts_rv.xml index fb917bbc2..e85dd4956 100644 --- a/app/src/main/res/layout/controller_contacts_rv.xml +++ b/app/src/main/res/layout/controller_contacts_rv.xml @@ -18,24 +18,48 @@ ~ along with this program. If not, see . --> - + + + + + + + + + + + + + + + + + + + app:tint="@color/white" /> + app:tint="@color/white" /> + + + + + + + +