mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-02-06 06:34:46 +01:00
Fix comments disappear in ViewPostDetailFragment after the system kills Infinity.
This commit is contained in:
parent
9819059e29
commit
7db721f297
@ -12,6 +12,7 @@ import android.graphics.drawable.Drawable;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.DisplayMetrics;
|
import android.util.DisplayMetrics;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.HapticFeedbackConstants;
|
import android.view.HapticFeedbackConstants;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
@ -323,7 +324,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
int totalItemCount = mLinearLayoutManager.getItemCount();
|
int totalItemCount = mLinearLayoutManager.getItemCount();
|
||||||
int firstVisibleItemPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
|
int firstVisibleItemPosition = mLinearLayoutManager.findFirstVisibleItemPosition();
|
||||||
|
|
||||||
if ((visibleItemCount + firstVisibleItemPosition >= totalItemCount) && firstVisibleItemPosition >= 0) {
|
if (mCommentsAdapter != null && mCommentsAdapter.getItemCount() >= 1 && (visibleItemCount + firstVisibleItemPosition >= totalItemCount) && firstVisibleItemPosition >= 0) {
|
||||||
fetchMoreComments();
|
fetchMoreComments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,7 +404,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
|
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int direction) {
|
||||||
if (touchHelper != null) {
|
if (touchHelper != null) {
|
||||||
touchHelper.attachToRecyclerView(null);
|
touchHelper.attachToRecyclerView(null);
|
||||||
touchHelper.attachToRecyclerView(mRecyclerView);
|
touchHelper.attachToRecyclerView((mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView));
|
||||||
if (mCommentsAdapter != null) {
|
if (mCommentsAdapter != null) {
|
||||||
mCommentsAdapter.onItemSwipe(viewHolder, direction, swipeLeftAction, swipeRightAction);
|
mCommentsAdapter.onItemSwipe(viewHolder, direction, swipeLeftAction, swipeRightAction);
|
||||||
}
|
}
|
||||||
@ -467,7 +468,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (enableSwipeAction) {
|
if (enableSwipeAction) {
|
||||||
touchHelper.attachToRecyclerView(mRecyclerView);
|
touchHelper.attachToRecyclerView((mCommentsRecyclerView == null ? mRecyclerView : mCommentsRecyclerView));
|
||||||
}
|
}
|
||||||
|
|
||||||
mSwipeRefreshLayout.setOnRefreshListener(() -> refresh(true, true));
|
mSwipeRefreshLayout.setOnRefreshListener(() -> refresh(true, true));
|
||||||
@ -1797,10 +1798,11 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (stateChanged) {
|
if (stateChanged) {
|
||||||
if (mCommentsRecyclerView != null) {
|
if (mCommentsRecyclerView == null) {
|
||||||
refreshAdapter(mRecyclerView, mConcatAdapter);
|
refreshAdapter(mRecyclerView, mConcatAdapter);
|
||||||
} else {
|
} else {
|
||||||
refreshAdapter(mRecyclerView, mPostAdapter);
|
refreshAdapter(mRecyclerView, mPostAdapter);
|
||||||
|
refreshAdapter(mCommentsRecyclerView, mCommentsAdapter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user