From 429bcc4e918bb38540f4095e94d6a187c94caac6 Mon Sep 17 00:00:00 2001 From: Austin Huang Date: Fri, 14 May 2021 15:00:31 -0400 Subject: [PATCH] fix #1255 --- .../fragments/main/ProfileFragment.java | 22 ++++++++++++------- app/src/main/res/layout/fragment_profile.xml | 5 ++++- app/src/main/res/xml/header_list_scene.xml | 7 ++++++ 3 files changed, 25 insertions(+), 9 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 17dfa964..e9870987 100644 --- a/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java +++ b/app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java @@ -662,17 +662,21 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe Toast.makeText(context, R.string.error_loading_profile, Toast.LENGTH_SHORT).show(); return; } - if (!postsSetupDone) { - setupPosts(); - } else { - binding.postsRecyclerView.refresh(); + final long profileId = profileModel.getPk(); + if (!isReallyPrivate()) { + if (!postsSetupDone) { + setupPosts(); + } + else { + binding.postsRecyclerView.refresh(); + } + if (isLoggedIn) { + fetchStoryAndHighlights(profileId); + } } profileDetailsBinding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE); profileDetailsBinding.isPrivate.setVisibility(profileModel.isPrivate() ? View.VISIBLE : View.GONE); - final long profileId = profileModel.getPk(); - if (isLoggedIn) { - fetchStoryAndHighlights(profileId); - } + setupButtons(profileId); final FavoriteRepository favoriteRepository = FavoriteRepository.getInstance(FavoriteDataSource.getInstance(getContext())); favoriteRepository.getFavorite(profileModel.getUsername(), FavoriteType.USER, new RepositoryCallback() { @@ -905,6 +909,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe binding.privatePage1.setImageResource(R.drawable.lock); binding.privatePage2.setText(R.string.priv_acc); binding.privatePage.setVisibility(View.VISIBLE); + binding.privatePage1.setVisibility(View.VISIBLE); + binding.privatePage2.setVisibility(View.VISIBLE); binding.postsRecyclerView.setVisibility(View.GONE); binding.swipeRefreshLayout.setRefreshing(false); } diff --git a/app/src/main/res/layout/fragment_profile.xml b/app/src/main/res/layout/fragment_profile.xml index 051dd0aa..48b36bfd 100644 --- a/app/src/main/res/layout/fragment_profile.xml +++ b/app/src/main/res/layout/fragment_profile.xml @@ -38,7 +38,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top" - android:layout_marginTop="@dimen/private_page_margins" android:gravity="center" android:orientation="vertical" android:visibility="gone" @@ -48,6 +47,8 @@ android:id="@+id/privatePage1" android:layout_width="@dimen/private_page_size" android:layout_height="@dimen/private_page_size" + android:visibility="gone" + tools:visibility="visible" app:srcCompat="@drawable/lock" /> diff --git a/app/src/main/res/xml/header_list_scene.xml b/app/src/main/res/xml/header_list_scene.xml index 389b7cb1..522990ee 100644 --- a/app/src/main/res/xml/header_list_scene.xml +++ b/app/src/main/res/xml/header_list_scene.xml @@ -9,6 +9,13 @@ motion:layout_constraintEnd_toEndOf="parent" motion:layout_constraintStart_toStartOf="parent" motion:layout_constraintTop_toTopOf="parent" /> +