mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-15 19:27:31 +00:00
Merge pull request #1219 from raniapl/raniapl/development
Disable scrolling on empty profiles - Fix issues #1093, #1135, #1061
This commit is contained in:
commit
55624dbdce
@ -616,9 +616,12 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
Log.e(TAG, "Error fetching profile relationship", t);
|
Log.e(TAG, "Error fetching profile relationship", t);
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
try {
|
try {
|
||||||
if (t == null) Toast.makeText(context, R.string.error_loading_profile_loggedin, Toast.LENGTH_LONG).show();
|
if (t == null)
|
||||||
else Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
|
Toast.makeText(context, R.string.error_loading_profile_loggedin, Toast.LENGTH_LONG).show();
|
||||||
} catch (final Throwable ignored) {}
|
else
|
||||||
|
Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
|
} catch (final Throwable ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -628,9 +631,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
Log.e(TAG, "Error fetching profile", t);
|
Log.e(TAG, "Error fetching profile", t);
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
try {
|
try {
|
||||||
if (t == null) Toast.makeText(context, R.string.error_loading_profile_loggedin, Toast.LENGTH_LONG).show();
|
if (t == null)
|
||||||
|
Toast.makeText(context, R.string.error_loading_profile_loggedin, Toast.LENGTH_LONG).show();
|
||||||
else Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
|
else Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
} catch (final Throwable ignored) {}
|
} catch (final Throwable ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
@ -647,9 +652,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
Log.e(TAG, "Error fetching profile", t);
|
Log.e(TAG, "Error fetching profile", t);
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
try {
|
try {
|
||||||
if (t == null) Toast.makeText(context, R.string.error_loading_profile, Toast.LENGTH_LONG).show();
|
if (t == null)
|
||||||
|
Toast.makeText(context, R.string.error_loading_profile, Toast.LENGTH_LONG).show();
|
||||||
else Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
|
else Toast.makeText(context, t.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
} catch (final Throwable ignored) {}
|
} catch (final Throwable ignored) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -666,14 +673,14 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
if (!isReallyPrivate()) {
|
if (!isReallyPrivate()) {
|
||||||
if (!postsSetupDone) {
|
if (!postsSetupDone) {
|
||||||
setupPosts();
|
setupPosts();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
binding.postsRecyclerView.refresh();
|
binding.postsRecyclerView.refresh();
|
||||||
}
|
}
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
fetchStoryAndHighlights(profileId);
|
fetchStoryAndHighlights(profileId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
profileDetailsBinding.isPrivate.setVisibility(profileModel.isPrivate() ? View.VISIBLE : View.GONE);
|
||||||
|
|
||||||
@ -693,10 +700,12 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
result.getDateAdded()
|
result.getDateAdded()
|
||||||
), new RepositoryCallback<Void>() {
|
), new RepositoryCallback<Void>() {
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(final Void result) {}
|
public void onSuccess(final Void result) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataNotAvailable() {}
|
public void onDataNotAvailable() {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -719,7 +728,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataNotAvailable() {}
|
public void onDataNotAvailable() {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -741,7 +751,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataNotAvailable() {}
|
public void onDataNotAvailable() {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@ -755,11 +766,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
|
|
||||||
final String postCount = String.valueOf(profileModel.getMediaCount());
|
final String postCount = String.valueOf(profileModel.getMediaCount());
|
||||||
|
|
||||||
SpannableStringBuilder span = new SpannableStringBuilder(getResources().getQuantityString(R.plurals.main_posts_count,
|
SpannableStringBuilder span = new SpannableStringBuilder(getResources().getQuantityString(
|
||||||
profileModel.getMediaCount() > 2000000000L
|
R.plurals.main_posts_count,
|
||||||
? 2000000000
|
profileModel.getMediaCount() > 2000000000L ? 2000000000 : (int) profileModel.getMediaCount(),
|
||||||
: (int) profileModel.getMediaCount(),
|
postCount)
|
||||||
postCount));
|
);
|
||||||
span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
|
span.setSpan(new RelativeSizeSpan(1.2f), 0, postCount.length(), 0);
|
||||||
span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
|
span.setSpan(new StyleSpan(Typeface.BOLD), 0, postCount.length(), 0);
|
||||||
profileDetailsBinding.mainPostCount.setText(span);
|
profileDetailsBinding.mainPostCount.setText(span);
|
||||||
@ -767,9 +778,11 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
|
|
||||||
final String followersCountStr = String.valueOf(followersCount);
|
final String followersCountStr = String.valueOf(followersCount);
|
||||||
final int followersCountStrLen = followersCountStr.length();
|
final int followersCountStrLen = followersCountStr.length();
|
||||||
span = new SpannableStringBuilder(getResources().getQuantityString(R.plurals.main_posts_followers,
|
span = new SpannableStringBuilder(getResources().getQuantityString(
|
||||||
followersCount > 2000000000L ? 2000000000 : (int) followersCount,
|
R.plurals.main_posts_followers,
|
||||||
followersCountStr));
|
followersCount > 2000000000L ? 2000000000 : (int) followersCount,
|
||||||
|
followersCountStr)
|
||||||
|
);
|
||||||
span.setSpan(new RelativeSizeSpan(1.2f), 0, followersCountStrLen, 0);
|
span.setSpan(new RelativeSizeSpan(1.2f), 0, followersCountStrLen, 0);
|
||||||
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followersCountStrLen, 0);
|
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followersCountStrLen, 0);
|
||||||
profileDetailsBinding.mainFollowers.setText(span);
|
profileDetailsBinding.mainFollowers.setText(span);
|
||||||
@ -777,8 +790,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
|
|
||||||
final String followingCountStr = String.valueOf(followingCount);
|
final String followingCountStr = String.valueOf(followingCount);
|
||||||
final int followingCountStrLen = followingCountStr.length();
|
final int followingCountStrLen = followingCountStr.length();
|
||||||
span = new SpannableStringBuilder(getString(R.string.main_posts_following,
|
span = new SpannableStringBuilder(getString(R.string.main_posts_following, followingCountStr));
|
||||||
followingCountStr));
|
|
||||||
span.setSpan(new RelativeSizeSpan(1.2f), 0, followingCountStrLen, 0);
|
span.setSpan(new RelativeSizeSpan(1.2f), 0, followingCountStrLen, 0);
|
||||||
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followingCountStrLen, 0);
|
span.setSpan(new StyleSpan(Typeface.BOLD), 0, followingCountStrLen, 0);
|
||||||
profileDetailsBinding.mainFollowing.setText(span);
|
profileDetailsBinding.mainFollowing.setText(span);
|
||||||
@ -804,9 +816,8 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
final String originalText = autoLinkItem.getOriginalText().trim();
|
final String originalText = autoLinkItem.getOriginalText().trim();
|
||||||
navigateToProfile(originalText);
|
navigateToProfile(originalText);
|
||||||
});
|
});
|
||||||
profileDetailsBinding.mainBiography.addOnEmailClickListener(autoLinkItem -> Utils.openEmailAddress(getContext(),
|
profileDetailsBinding.mainBiography.addOnEmailClickListener(autoLinkItem -> Utils.openEmailAddress(
|
||||||
autoLinkItem.getOriginalText()
|
getContext(), autoLinkItem.getOriginalText().trim()));
|
||||||
.trim()));
|
|
||||||
profileDetailsBinding.mainBiography
|
profileDetailsBinding.mainBiography
|
||||||
.addOnURLClickListener(autoLinkItem -> Utils.openURL(getContext(), autoLinkItem.getOriginalText().trim()));
|
.addOnURLClickListener(autoLinkItem -> Utils.openURL(getContext(), autoLinkItem.getOriginalText().trim()));
|
||||||
profileDetailsBinding.mainBiography.setOnLongClickListener(v -> {
|
profileDetailsBinding.mainBiography.setOnLongClickListener(v -> {
|
||||||
@ -888,6 +899,7 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
final MotionScene.Transition transition = root.getTransition(R.id.transition);
|
||||||
if (!isReallyPrivate()) {
|
if (!isReallyPrivate()) {
|
||||||
if (isLoggedIn) {
|
if (isLoggedIn) {
|
||||||
profileDetailsBinding.mainFollowing.setClickable(true);
|
profileDetailsBinding.mainFollowing.setClickable(true);
|
||||||
@ -913,6 +925,12 @@ public class ProfileFragment extends Fragment implements SwipeRefreshLayout.OnRe
|
|||||||
binding.privatePage2.setVisibility(View.VISIBLE);
|
binding.privatePage2.setVisibility(View.VISIBLE);
|
||||||
binding.postsRecyclerView.setVisibility(View.GONE);
|
binding.postsRecyclerView.setVisibility(View.GONE);
|
||||||
binding.swipeRefreshLayout.setRefreshing(false);
|
binding.swipeRefreshLayout.setRefreshing(false);
|
||||||
|
if (transition != null) {
|
||||||
|
transition.setEnable(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (profileModel.getMediaCount() == 0 && transition != null) {
|
||||||
|
transition.setEnable(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
style="@style/Widget.MaterialComponents.Button.TextButton"
|
style="@style/Widget.MaterialComponents.Button.TextButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginRight="8dp"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
android:layout_gravity="bottom|end"
|
android:layout_gravity="bottom|end"
|
||||||
android:backgroundTint="@color/black_a50"
|
android:backgroundTint="@color/black_a50"
|
||||||
android:text="@string/action_download"
|
android:text="@string/action_download"
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
android:id="@+id/chats"
|
android:id="@+id/chats"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
|
android:layout_marginBottom="8dp"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
tools:listitem="@layout/layout_dm_base" />
|
tools:listitem="@layout/layout_dm_base" />
|
||||||
|
Loading…
Reference in New Issue
Block a user