Browse Source

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

renovate/org.robolectric-robolectric-4.x
Austin Huang 4 years ago
parent
commit
0dc33d0b35
No known key found for this signature in database GPG Key ID: 84C23AA04587A91F
  1. 8
      app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java
  2. 4
      app/src/main/res/layout/fragment_profile.xml
  3. 23
      app/src/main/res/layout/layout_profile_details.xml
  4. 3
      app/src/main/res/values/dimens.xml

8
app/src/main/java/awais/instagrabber/fragments/main/ProfileFragment.java

@ -588,10 +588,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
binding.swipeRefreshLayout.setEnabled(false); binding.swipeRefreshLayout.setEnabled(false);
binding.privatePage1.setImageResource(R.drawable.ic_outline_info_24); binding.privatePage1.setImageResource(R.drawable.ic_outline_info_24);
binding.privatePage2.setText(R.string.no_acc); 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); binding.privatePage.setVisibility(View.VISIBLE);
return; return;
} }
@ -683,6 +679,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
binding.postsRecyclerView.refresh(); binding.postsRecyclerView.refresh();
} }
profileDetailsBinding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE); profileDetailsBinding.isVerified.setVisibility(profileModel.isVerified() ? View.VISIBLE : View.GONE);
profileDetailsBinding.isPrivate.setVisibility(profileModel.isPrivate() ? View.VISIBLE : View.GONE);
final long profileId = profileModel.getPk(); final long profileId = profileModel.getPk();
if (isLoggedIn) { if (isLoggedIn) {
fetchStoryAndHighlights(profileId); fetchStoryAndHighlights(profileId);
@ -917,11 +914,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} else { } else {
profileDetailsBinding.mainFollowers.setClickable(false); profileDetailsBinding.mainFollowers.setClickable(false);
profileDetailsBinding.mainFollowing.setClickable(false); profileDetailsBinding.mainFollowing.setClickable(false);
// error
binding.privatePage1.setImageResource(R.drawable.lock); binding.privatePage1.setImageResource(R.drawable.lock);
binding.privatePage2.setText(R.string.priv_acc); binding.privatePage2.setText(R.string.priv_acc);
binding.privatePage.setVisibility(View.VISIBLE); binding.privatePage.setVisibility(View.VISIBLE);
binding.postsRecyclerView.setVisibility(View.GONE); binding.postsRecyclerView.setVisibility(View.GONE);
binding.swipeRefreshLayout.setRefreshing(false);
} }
} }
@ -1206,7 +1203,6 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
} }
private void updateSwipeRefreshState() { private void updateSwipeRefreshState() {
Log.d("austin_debug", "usrs: " + binding.postsRecyclerView.isFetching());
binding.swipeRefreshLayout.setRefreshing(binding.postsRecyclerView.isFetching()); binding.swipeRefreshLayout.setRefreshing(binding.postsRecyclerView.isFetching());
} }

4
app/src/main/res/layout/fragment_profile.xml

@ -50,8 +50,8 @@
<androidx.appcompat.widget.AppCompatImageView <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/privatePage1" 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" /> app:srcCompat="@drawable/lock" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView

23
app/src/main/res/layout/layout_profile_details.xml

@ -36,6 +36,7 @@
app:chipIconTint="@color/deep_purple_200" app:chipIconTint="@color/deep_purple_200"
app:layout_constraintBottom_toTopOf="@id/fav_chip" app:layout_constraintBottom_toTopOf="@id/fav_chip"
app:layout_constraintStart_toEndOf="@id/mainProfileImage" app:layout_constraintStart_toEndOf="@id/mainProfileImage"
app:layout_constraintTop_toTopOf="parent"
app:rippleColor="@color/purple_200" app:rippleColor="@color/purple_200"
tools:visibility="visible" /> tools:visibility="visible" />
@ -50,6 +51,7 @@
app:chipBackgroundColor="@null" app:chipBackgroundColor="@null"
app:layout_constraintBottom_toTopOf="@id/fav_chip" app:layout_constraintBottom_toTopOf="@id/fav_chip"
app:layout_constraintStart_toEndOf="@id/btnFollow" app:layout_constraintStart_toEndOf="@id/btnFollow"
app:layout_constraintTop_toTopOf="parent"
tools:text="omg what do u expect" tools:text="omg what do u expect"
tools:visibility="visible" /> tools:visibility="visible" />
@ -66,6 +68,7 @@
app:chipIconTint="@color/blue_700" app:chipIconTint="@color/blue_700"
app:layout_constraintBottom_toTopOf="@id/fav_chip" app:layout_constraintBottom_toTopOf="@id/fav_chip"
app:layout_constraintStart_toEndOf="@id/mainStatus" app:layout_constraintStart_toEndOf="@id/mainStatus"
app:layout_constraintTop_toTopOf="parent"
app:rippleColor="@color/blue_A400" app:rippleColor="@color/blue_A400"
tools:visibility="visible" /> tools:visibility="visible" />
@ -81,6 +84,7 @@
app:chipIconTint="@color/red_600" app:chipIconTint="@color/red_600"
app:layout_constraintBottom_toTopOf="@id/fav_chip" app:layout_constraintBottom_toTopOf="@id/fav_chip"
app:layout_constraintStart_toEndOf="@id/btnSaved" app:layout_constraintStart_toEndOf="@id/btnSaved"
app:layout_constraintTop_toTopOf="parent"
app:rippleColor="@color/red_300" app:rippleColor="@color/red_300"
tools:visibility="visible" /> tools:visibility="visible" />
@ -109,6 +113,7 @@
app:chipBackgroundColor="@null" app:chipBackgroundColor="@null"
app:chipIcon="@drawable/ic_outline_person_pin_24" app:chipIcon="@drawable/ic_outline_person_pin_24"
app:chipIconTint="@color/deep_orange_800" app:chipIconTint="@color/deep_orange_800"
app:layout_constraintBottom_toTopOf="@+id/mainFullName"
app:layout_constraintStart_toEndOf="@id/mainProfileImage" app:layout_constraintStart_toEndOf="@id/mainProfileImage"
app:layout_constraintTop_toBottomOf="@id/fav_chip" app:layout_constraintTop_toBottomOf="@id/fav_chip"
app:rippleColor="@color/deep_orange_400" app:rippleColor="@color/deep_orange_400"
@ -124,6 +129,7 @@
app:chipBackgroundColor="@null" app:chipBackgroundColor="@null"
app:chipIcon="@drawable/ic_round_send_24" app:chipIcon="@drawable/ic_round_send_24"
app:chipIconTint="@color/green" app:chipIconTint="@color/green"
app:layout_constraintBottom_toTopOf="@+id/mainFullName"
app:layout_constraintStart_toEndOf="@id/btnTagged" app:layout_constraintStart_toEndOf="@id/btnTagged"
app:layout_constraintTop_toBottomOf="@id/fav_chip" app:layout_constraintTop_toBottomOf="@id/fav_chip"
app:rippleColor="@color/green" app:rippleColor="@color/green"
@ -161,6 +167,23 @@
app:srcCompat="@drawable/verified" app:srcCompat="@drawable/verified"
tools:visibility="visible" /> 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 <CheckBox
android:id="@+id/fav_cb" android:id="@+id/fav_cb"
android:layout_width="wrap_content" android:layout_width="wrap_content"

3
app/src/main/res/values/dimens.xml

@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<dimen name="profile_info_container_bottom_space">8dp</dimen> <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_picture_size">90dp</dimen>
<dimen name="profile_chip_size">40dp</dimen> <dimen name="profile_chip_size">40dp</dimen>

Loading…
Cancel
Save