Improves bookmark record

This commit is contained in:
stom79 2017-12-09 07:42:46 +01:00
parent e6847d2b89
commit 4cd3d8bf3c
1 changed files with 3 additions and 4 deletions

View File

@ -119,10 +119,10 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
lv_status.addOnScrollListener(new RecyclerView.OnScrollListener() {
public void onScrolled(RecyclerView recyclerView, int dx, int dy)
{
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
if(dy > 0){
int visibleItemCount = mLayoutManager.getChildCount();
int totalItemCount = mLayoutManager.getItemCount();
int firstVisibleItem = mLayoutManager.findFirstVisibleItemPosition();
if(firstVisibleItem + visibleItemCount == totalItemCount && context != null) {
if(!flag_loading ) {
flag_loading = true;
@ -138,7 +138,8 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
} else {
nextElementLoader.setVisibility(View.GONE);
}
if(statuses != null && statuses.size() > firstVisibleItem )
}
if(statuses != null && statuses.size() > firstVisibleItem )
if( context instanceof BaseMainActivity){
((BaseMainActivity) context).setBookmark(statuses.get(firstVisibleItem).getId());
SharedPreferences.Editor editor = sharedpreferences.edit();
@ -147,8 +148,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
editor.putString(Helper.BOOKMARK_ID + userId, String.valueOf(bookmarkL));
editor.apply();
}
}
}
});