Fix issue #607 - Issue with fetchmore

This commit is contained in:
Thomas 2023-01-03 17:29:53 +01:00
parent a81f27faff
commit 886f066071
4 changed files with 10 additions and 6 deletions

View File

@ -634,7 +634,9 @@ public class ComposeActivity extends BaseActivity implements ComposeAdapter.Mana
}
if (statusReply.spoiler_text != null) {
statusDraftList.get(0).spoiler_text = statusReply.spoiler_text;
statusDraftList.get(0).spoilerChecked = true;
if (statusReply.spoiler_text.trim().length() > 0) {
statusDraftList.get(0).spoilerChecked = true;
}
}
if (statusReply.language != null && !statusReply.language.isEmpty()) {
statusDraftList.get(0).language = statusReply.language;

View File

@ -109,8 +109,8 @@ public class Status implements Serializable, Cloneable {
public Attachment art_attachment;
public boolean isExpended = false;
public boolean isTruncated = true;
public boolean isFetchMore = false;
public PositionFetchMore positionFetchMore = PositionFetchMore.BOTTOM;
public transient boolean isFetchMore = false;
public transient PositionFetchMore positionFetchMore = PositionFetchMore.BOTTOM;
public boolean isChecked = false;
public String translationContent;
public boolean translationShown;

View File

@ -2031,7 +2031,6 @@ public class StatusAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder>
drawerFetchMoreBinding.fetchMoreMin.setOnClickListener(v -> {
status.isFetchMore = false;
int position = holder.getBindingAdapterPosition();
int position2 = getStatusPosition(statusList, status);
adapter.notifyItemChanged(position);
if (position < statusList.size() - 1) {
String fromId;

View File

@ -407,7 +407,7 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
binding.swipeContainer.setRefreshing(false);
binding.loadingNextElements.setVisibility(View.GONE);
flagLoading = false;
int currentPosition = mLayoutManager.findFirstVisibleItemPosition();
if (timelineStatuses != null && fetched_statuses != null && fetched_statuses.statuses != null && fetched_statuses.statuses.size() > 0) {
try {
if (statusToUpdate != null) {
@ -470,7 +470,10 @@ public class FragmentMastodonTimeline extends Fragment implements StatusAdapter.
update.onUpdate(0, timelineType, slug);
}
if (direction == DIRECTION.TOP && fetchingMissing) {
binding.recyclerView.scrollToPosition(getPosition(fetched_statuses.statuses.get(fetched_statuses.statuses.size() - 1)) + 1);
int newPosition = currentPosition + fetched_statuses.statuses.size() + 1;
if (newPosition < timelineStatuses.size()) {
binding.recyclerView.scrollToPosition(newPosition);
}
}
if (!fetchingMissing) {
if (fetched_statuses.pagination.max_id == null) {