mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
Add some null checks and formatting.
This commit is contained in:
parent
f501f68f98
commit
644f2ddff8
@ -766,11 +766,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
|
||||
final String postCount = String.valueOf(profileModel.getMediaCount());
|
||||
|
||||
SpannableStringBuilder span = new SpannableStringBuilder(getResources().getQuantityString(R.plurals.main_posts_count,
|
||||
profileModel.getMediaCount() > 2000000000L
|
||||
? 2000000000
|
||||
: (int) profileModel.getMediaCount(),
|
||||
postCount));
|
||||
SpannableStringBuilder span = new SpannableStringBuilder(getResources().getQuantityString(
|
||||
R.plurals.main_posts_count,
|
||||
profileModel.getMediaCount() > 2000000000L ? 2000000000 : (int) profileModel.getMediaCount(),
|
||||
postCount)
|
||||
);
|
||||
span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
|
||||
span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
|
||||
profileDetailsBinding.mainPostCount.setText(span);
|
||||
@ -778,9 +778,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
|
||||
final String followersCountStr = String.valueOf(followersCount);
|
||||
final int followersCountStrLen = followersCountStr.length();
|
||||
span = new SpannableStringBuilder(getResources().getQuantityString(R.plurals.main_posts_followers,
|
||||
span = new SpannableStringBuilder(getResources().getQuantityString(
|
||||
R.plurals.main_posts_followers,
|
||||
followersCount > 2000000000L ? 2000000000 : (int) followersCount,
|
||||
followersCountStr));
|
||||
followersCountStr)
|
||||
);
|
||||
span.setSpan(new RelativeSizeSpan(1.2f), 0, followersCountStrLen, 0);
|
||||
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followersCountStrLen, 0);
|
||||
profileDetailsBinding.mainFollowers.setText(span);
|
||||
@ -788,8 +790,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
|
||||
final String followingCountStr = String.valueOf(followingCount);
|
||||
final int followingCountStrLen = followingCountStr.length();
|
||||
span = new SpannableStringBuilder(getString(R.string.main_posts_following,
|
||||
followingCountStr));
|
||||
span = new SpannableStringBuilder(getString(R.string.main_posts_following, followingCountStr));
|
||||
span.setSpan(new RelativeSizeSpan(1.2f), 0, followingCountStrLen, 0);
|
||||
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followingCountStrLen, 0);
|
||||
profileDetailsBinding.mainFollowing.setText(span);
|
||||
@ -815,9 +816,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
final String originalText = autoLinkItem.getOriginalText().trim();
|
||||
navigateToProfile(originalText);
|
||||
});
|
||||
profileDetailsBinding.mainBiography.addOnEmailClickListener(autoLinkItem -> Utils.openEmailAddress(getContext(),
|
||||
autoLinkItem.getOriginalText()
|
||||
.trim()));
|
||||
profileDetailsBinding.mainBiography.addOnEmailClickListener(autoLinkItem -> Utils.openEmailAddress(
|
||||
getContext(), autoLinkItem.getOriginalText().trim()));
|
||||
profileDetailsBinding.mainBiography
|
||||
.addOnURLClickListener(autoLinkItem -> Utils.openURL(getContext(), autoLinkItem.getOriginalText().trim()));
|
||||
profileDetailsBinding.mainBiography.setOnLongClickListener(v -> {
|
||||
@ -899,6 +899,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
return true;
|
||||
});
|
||||
}
|
||||
final MotionScene.Transition transition = root.getTransition(R.id.transition);
|
||||
if (!isReallyPrivate()) {
|
||||
if (isLoggedIn) {
|
||||
profileDetailsBinding.mainFollowing.setClickable(true);
|
||||
@ -924,13 +925,13 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
||||
binding.privatePage2.setVisibility(View.VISIBLE);
|
||||
binding.postsRecyclerView.setVisibility(View.GONE);
|
||||
binding.swipeRefreshLayout.setRefreshing(false);
|
||||
root.getTransition(R.id.transition).setEnable(false);
|
||||
if (transition != null) {
|
||||
transition.setEnable(false);
|
||||
}
|
||||
|
||||
if (profileModel.getMediaCount() == 0) {
|
||||
root.getTransition(R.id.transition).setEnable(false);
|
||||
}
|
||||
|
||||
if (profileModel.getMediaCount() == 0 && transition != null) {
|
||||
transition.setEnable(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void setupButtons(final long profileId) {
|
||||
|
Loading…
Reference in New Issue
Block a user