1
0
mirror of https://github.com/KokaKiwi/BarInsta synced 2024-11-08 07:57:28 +00:00

fix private page layout/refresh issue, plus close #799

This commit is contained in:
Austin Huang 2021-03-26 22:24:00 -04:00
parent f035826de2
commit 0dc33d0b35
No known key found for this signature in database
GPG Key ID: 84C23AA04587A91F
4 changed files with 29 additions and 9 deletions

View File

@ -588,10 +588,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
binding.swipeRefreshLayout.setEnabled(false);
binding.privatePage1.setImageResource(R.drawable.ic_outline_info_24);
binding.privatePage2.setText(R.string.no_acc);
final CoordinatorLayout.LayoutParams layoutParams = (CoordinatorLayout.LayoutParams) binding.privatePage.getLayoutParams();
layoutParams.topMargin = 0;
layoutParams.gravity = Gravity.CENTER;
binding.privatePage.setLayoutParams(layoutParams);
binding.privatePage.setVisibility(View.VISIBLE);
return;
}
@ -683,6 +679,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
binding.postsRecyclerView.refresh();
}
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);
@ -917,11 +914,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} else {
profileDetailsBinding.mainFollowers.setClickable(false);
profileDetailsBinding.mainFollowing.setClickable(false);
// error
binding.privatePage1.setImageResource(R.drawable.lock);
binding.privatePage2.setText(R.string.priv_acc);
binding.privatePage.setVisibility(View.VISIBLE);
binding.postsRecyclerView.setVisibility(View.GONE);
binding.swipeRefreshLayout.setRefreshing(false);
}
}
@ -1206,7 +1203,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
}
private void updateSwipeRefreshState() {
Log.d("austin_debug", "usrs: " + binding.postsRecyclerView.isFetching());
binding.swipeRefreshLayout.setRefreshing(binding.postsRecyclerView.isFetching());
}

View File

@ -50,8 +50,8 @@
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/privatePage1"
android:layout_width="@dimen/private_page_margins"
android:layout_height="@dimen/private_page_margins"
android:layout_width="@dimen/private_page_size"
android:layout_height="@dimen/private_page_size"
app:srcCompat="@drawable/lock" />
<androidx.appcompat.widget.AppCompatTextView

View File

@ -36,6 +36,7 @@
app:chipIconTint="@color/deep_purple_200"
app:layout_constraintBottom_toTopOf="@id/fav_chip"
app:layout_constraintStart_toEndOf="@id/mainProfileImage"
app:layout_constraintTop_toTopOf="parent"
app:rippleColor="@color/purple_200"
tools:visibility="visible" />
@ -50,6 +51,7 @@
app:chipBackgroundColor="@null"
app:layout_constraintBottom_toTopOf="@id/fav_chip"
app:layout_constraintStart_toEndOf="@id/btnFollow"
app:layout_constraintTop_toTopOf="parent"
tools:text="omg what do u expect"
tools:visibility="visible" />
@ -66,6 +68,7 @@
app:chipIconTint="@color/blue_700"
app:layout_constraintBottom_toTopOf="@id/fav_chip"
app:layout_constraintStart_toEndOf="@id/mainStatus"
app:layout_constraintTop_toTopOf="parent"
app:rippleColor="@color/blue_A400"
tools:visibility="visible" />
@ -81,6 +84,7 @@
app:chipIconTint="@color/red_600"
app:layout_constraintBottom_toTopOf="@id/fav_chip"
app:layout_constraintStart_toEndOf="@id/btnSaved"
app:layout_constraintTop_toTopOf="parent"
app:rippleColor="@color/red_300"
tools:visibility="visible" />
@ -109,6 +113,7 @@
app:chipBackgroundColor="@null"
app:chipIcon="@drawable/ic_outline_person_pin_24"
app:chipIconTint="@color/deep_orange_800"
app:layout_constraintBottom_toTopOf="@+id/mainFullName"
app:layout_constraintStart_toEndOf="@id/mainProfileImage"
app:layout_constraintTop_toBottomOf="@id/fav_chip"
app:rippleColor="@color/deep_orange_400"
@ -124,6 +129,7 @@
app:chipBackgroundColor="@null"
app:chipIcon="@drawable/ic_round_send_24"
app:chipIconTint="@color/green"
app:layout_constraintBottom_toTopOf="@+id/mainFullName"
app:layout_constraintStart_toEndOf="@id/btnTagged"
app:layout_constraintTop_toBottomOf="@id/fav_chip"
app:rippleColor="@color/green"
@ -161,6 +167,23 @@
app:srcCompat="@drawable/verified"
tools:visibility="visible" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/isPrivate"
android:layout_width="25dp"
android:layout_height="match_parent"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:scaleType="fitCenter"
android:tint="@color/red_500"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/mainFullName"
app:layout_constraintStart_toEndOf="@id/isVerified"
app:layout_constraintTop_toBottomOf="@id/btnTagged"
app:srcCompat="@drawable/lock"
tools:visibility="visible" />
<CheckBox
android:id="@+id/fav_cb"
android:layout_width="wrap_content"

View File

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="profile_info_container_bottom_space">8dp</dimen>
<dimen name="private_page_margins">@dimen/profile_picture_size</dimen>
<dimen name="private_page_margins">30dp</dimen>
<dimen name="private_page_size">90dp</dimen>
<dimen name="profile_picture_size">90dp</dimen>
<dimen name="profile_chip_size">40dp</dimen>