Minor bugs fixed in ParsePost.

This commit is contained in:
Alex Ning 2021-12-03 21:04:19 +08:00
parent b0d9a15dfd
commit c809de6350
15 changed files with 25 additions and 25 deletions

View File

@ -1260,8 +1260,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
mFetchPostInfoLinearLayout.setOnClickListener(view -> refresh()); mFetchPostInfoLinearLayout.setOnClickListener(view -> refresh());
showErrorView(R.string.load_posts_error); showErrorView(R.string.load_posts_error);
} }
if (!(refreshLoadState instanceof LoadState.Loading) // #563 if (!(refreshLoadState instanceof LoadState.Loading) && appendLoadState instanceof LoadState.NotLoading) {
&& appendLoadState instanceof LoadState.NotLoading) {
if (appendLoadState.getEndOfPaginationReached() && mAdapter.getItemCount() < 1) { if (appendLoadState.getEndOfPaginationReached() && mAdapter.getItemCount() < 1) {
noPostFound(); noPostFound();
} }

View File

@ -572,7 +572,7 @@ public class ParsePost {
galleryItemCaptionUrl = galleryItem.getString(JSONUtils.CAPTION_URL_KEY).trim(); galleryItemCaptionUrl = galleryItem.getString(JSONUtils.CAPTION_URL_KEY).trim();
} }
if ((previews.isEmpty()) && mimeType.contains("jpg") || mimeType.contains("png")) { if (previews.isEmpty() && (mimeType.contains("jpg") || mimeType.contains("png"))) {
previews.add(new Post.Preview(galleryItemUrl, singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.X_KEY), previews.add(new Post.Preview(galleryItemUrl, singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.X_KEY),
singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.Y_KEY), galleryItemCaption, galleryItemCaptionUrl)); singleGalleryObject.getJSONObject(JSONUtils.S_KEY).getInt(JSONUtils.Y_KEY), galleryItemCaption, galleryItemCaptionUrl));
} }

View File

@ -150,8 +150,9 @@ public class Utils {
public static CharSequence trimTrailingWhitespace(CharSequence source) { public static CharSequence trimTrailingWhitespace(CharSequence source) {
if(source == null) if (source == null) {
return ""; return "";
}
int i = source.length(); int i = source.length();