From a5759b6c1bf1665f0dbd6db5df671169f7ed136f Mon Sep 17 00:00:00 2001 From: stamatiap Date: Tue, 27 Apr 2021 12:49:08 +0300 Subject: [PATCH 1/2] fix Add to favorites button's visibility - issue #1047 --- .../java/awais/instagrabber/fragments/main/ProfileFragment.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java index 15181356..69266a70 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java @@ -693,6 +693,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe fetchStoryAndHighlights(profileId); } setupButtons(profileId); + final boolean isNotMe = profileModel != null && !Objects.equals(profileId, myId); + profileDetailsBinding.favChip.setVisibility(isNotMe ? View.VISIBLE : View.GONE); profileDetailsBinding.favChip.setVisibility(View.VISIBLE); final FavoriteRepository favoriteRepository = FavoriteRepository.getInstance(FavoriteDataSource.getInstance(getContext())); favoriteRepository.getFavorite(profileModel.getUsername(), FavoriteType.USER, new RepositoryCallback() { From 990cb8fdcd047a6520a7259daa0493632004cf83 Mon Sep 17 00:00:00 2001 From: stamatiap Date: Wed, 28 Apr 2021 20:14:49 +0300 Subject: [PATCH 2/2] make needed changes - issue #1047 --- .../awais/instagrabber/fragments/main/ProfileFragment.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java index 69266a70..443178c5 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java @@ -693,9 +693,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe fetchStoryAndHighlights(profileId); } setupButtons(profileId); - final boolean isNotMe = profileModel != null && !Objects.equals(profileId, myId); - profileDetailsBinding.favChip.setVisibility(isNotMe ? View.VISIBLE : View.GONE); - profileDetailsBinding.favChip.setVisibility(View.VISIBLE); final FavoriteRepository favoriteRepository = FavoriteRepository.getInstance(FavoriteDataSource.getInstance(getContext())); favoriteRepository.getFavorite(profileModel.getUsername(), FavoriteType.USER, new RepositoryCallback() { @Override @@ -940,6 +937,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe profileDetailsBinding.btnSaved.setVisibility(View.VISIBLE); profileDetailsBinding.btnLiked.setVisibility(View.VISIBLE); profileDetailsBinding.btnDM.setVisibility(View.GONE); + profileDetailsBinding.favChip.setVisibility(View.GONE); profileDetailsBinding.btnSaved.setText(R.string.saved); if (!accountIsUpdated) updateAccountInfo(); return; @@ -948,6 +946,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe profileDetailsBinding.btnLiked.setVisibility(View.GONE); profileDetailsBinding.btnDM.setVisibility(disableDm ? View.GONE : View.VISIBLE); profileDetailsBinding.btnFollow.setVisibility(View.VISIBLE); + profileDetailsBinding.favChip.setVisibility(View.VISIBLE); final Context context = getContext(); if (context == null) return; if (profileModel.getFriendshipStatus().isFollowing() || profileModel.getFriendshipStatus().isFollowedBy()) {