Fixes issue #42 - scrolling issue
This commit is contained in:
parent
1a4f3b008a
commit
537f853c83
|
@ -184,6 +184,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
swiped = false;
|
swiped = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int previousPosition = notifications.size();
|
||||||
max_id = apiResponse.getMax_id();
|
max_id = apiResponse.getMax_id();
|
||||||
List<Notification> notifications = apiResponse.getNotifications();
|
List<Notification> notifications = apiResponse.getNotifications();
|
||||||
|
|
||||||
|
@ -211,7 +212,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
MainActivity.lastNotificationId = notifications.get(0).getId();
|
MainActivity.lastNotificationId = notifications.get(0).getId();
|
||||||
updateNotificationLastId(sharedpreferences, this.userId, notifications.get(0).getId());
|
updateNotificationLastId(sharedpreferences, this.userId, notifications.get(0).getId());
|
||||||
}
|
}
|
||||||
notificationsListAdapter.notifyDataSetChanged();
|
notificationsListAdapter.notifyItemRangeInserted(previousPosition, notifications.size());
|
||||||
}
|
}
|
||||||
if( firstLoad )
|
if( firstLoad )
|
||||||
((MainActivity)context).updateNotifCounter();
|
((MainActivity)context).updateNotifCounter();
|
||||||
|
|
|
@ -152,6 +152,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
public void onRefresh() {
|
public void onRefresh() {
|
||||||
max_id = null;
|
max_id = null;
|
||||||
statuses = new ArrayList<>();
|
statuses = new ArrayList<>();
|
||||||
|
statuses.clear();
|
||||||
firstLoad = true;
|
firstLoad = true;
|
||||||
flag_loading = true;
|
flag_loading = true;
|
||||||
swiped = true;
|
swiped = true;
|
||||||
|
@ -234,6 +235,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
flag_loading = false;
|
flag_loading = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int previousPosition = this.statuses.size();
|
||||||
List<Status> statuses = apiResponse.getStatuses();
|
List<Status> statuses = apiResponse.getStatuses();
|
||||||
max_id = apiResponse.getMax_id();
|
max_id = apiResponse.getMax_id();
|
||||||
|
|
||||||
|
@ -243,8 +245,6 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
else
|
else
|
||||||
textviewNoAction.setVisibility(View.GONE);
|
textviewNoAction.setVisibility(View.GONE);
|
||||||
if( swiped ){
|
if( swiped ){
|
||||||
statusListAdapter = new StatusListAdapter(context, type, targetedId, isOnWifi, behaviorWithAttachments, positionSpinnerTrans, this.statuses);
|
|
||||||
lv_status.setAdapter(statusListAdapter);
|
|
||||||
swiped = false;
|
swiped = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,8 +260,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
this.statuses.add(tmpStatus);
|
this.statuses.add(tmpStatus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME && statuses.size() > 0) {
|
||||||
if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME) {
|
|
||||||
//Update the id of the last toot retrieved
|
//Update the id of the last toot retrieved
|
||||||
MainActivity.lastHomeId = statuses.get(0).getId();
|
MainActivity.lastHomeId = statuses.get(0).getId();
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
|
@ -270,7 +269,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
editor.apply();
|
editor.apply();
|
||||||
lastReadStatus = statuses.get(0).getId();
|
lastReadStatus = statuses.get(0).getId();
|
||||||
}
|
}
|
||||||
statusListAdapter.notifyDataSetChanged();
|
statusListAdapter.notifyItemRangeInserted(previousPosition, statuses.size());
|
||||||
if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME)
|
if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME)
|
||||||
//Display new value in counter
|
//Display new value in counter
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue