Fixes when loading next toots.
This commit is contained in:
parent
56190e49df
commit
9bc6e4795e
|
@ -196,8 +196,7 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
}
|
}
|
||||||
max_id = apiResponse.getMax_id();
|
max_id = apiResponse.getMax_id();
|
||||||
List<Notification> notifications = apiResponse.getNotifications();
|
List<Notification> notifications = apiResponse.getNotifications();
|
||||||
//The initial call comes from a classic tab refresh
|
|
||||||
flag_loading = (max_id == null );
|
|
||||||
if( !swiped && firstLoad && (notifications == null || notifications.size() == 0))
|
if( !swiped && firstLoad && (notifications == null || notifications.size() == 0))
|
||||||
textviewNoAction.setVisibility(View.VISIBLE);
|
textviewNoAction.setVisibility(View.VISIBLE);
|
||||||
else
|
else
|
||||||
|
@ -215,16 +214,20 @@ public class DisplayNotificationsFragment extends Fragment implements OnRetrieve
|
||||||
MainActivity.countNewNotifications++;
|
MainActivity.countNewNotifications++;
|
||||||
this.notifications.add(tmpNotification);
|
this.notifications.add(tmpNotification);
|
||||||
}
|
}
|
||||||
|
if( firstLoad) {
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + this.userId, notifications.get(0).getId());
|
editor.putString(Helper.LAST_NOTIFICATION_MAX_ID + this.userId, notifications.get(0).getId());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
lastReadNotifications = notifications.get(0).getId();
|
lastReadNotifications = notifications.get(0).getId();
|
||||||
|
}
|
||||||
notificationsListAdapter.notifyDataSetChanged();
|
notificationsListAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
if( firstLoad )
|
if( firstLoad )
|
||||||
((MainActivity)context).updateNotifCounter();
|
((MainActivity)context).updateNotifCounter();
|
||||||
swipeRefreshLayout.setRefreshing(false);
|
swipeRefreshLayout.setRefreshing(false);
|
||||||
firstLoad = false;
|
firstLoad = false;
|
||||||
|
//The initial call comes from a classic tab refresh
|
||||||
|
flag_loading = (max_id == null );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -77,6 +77,7 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
private String lastReadStatus;
|
private String lastReadStatus;
|
||||||
private String userId;
|
private String userId;
|
||||||
public static ArrayList<Status> tempStatuses = new ArrayList<>();
|
public static ArrayList<Status> tempStatuses = new ArrayList<>();
|
||||||
|
private int lastTotalItemCount = 0;
|
||||||
|
|
||||||
public DisplayStatusFragment(){
|
public DisplayStatusFragment(){
|
||||||
}
|
}
|
||||||
|
@ -311,12 +312,16 @@ public class DisplayStatusFragment extends Fragment implements OnRetrieveFeedsIn
|
||||||
}
|
}
|
||||||
this.statuses.add(tmpStatus);
|
this.statuses.add(tmpStatus);
|
||||||
}
|
}
|
||||||
lastReadStatus = statuses.get(0).getId();
|
|
||||||
|
if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME) {
|
||||||
SharedPreferences.Editor editor = sharedpreferences.edit();
|
SharedPreferences.Editor editor = sharedpreferences.edit();
|
||||||
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
String userId = sharedpreferences.getString(Helper.PREF_KEY_ID, null);
|
||||||
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId());
|
editor.putString(Helper.LAST_HOMETIMELINE_MAX_ID + userId, statuses.get(0).getId());
|
||||||
editor.apply();
|
editor.apply();
|
||||||
|
lastReadStatus = statuses.get(0).getId();
|
||||||
|
}
|
||||||
statusListAdapter.notifyDataSetChanged();
|
statusListAdapter.notifyDataSetChanged();
|
||||||
|
if( firstLoad && type == RetrieveFeedsAsyncTask.Type.HOME)
|
||||||
//Display new value in counter
|
//Display new value in counter
|
||||||
try {
|
try {
|
||||||
((MainActivity) context).updateHomeCounter();
|
((MainActivity) context).updateHomeCounter();
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent">
|
||||||
<ListView
|
<ListView
|
||||||
android:id="@+id/lv_status"
|
android:id="@+id/lv_status"
|
||||||
android:transcriptMode="normal"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:scrollbars="none"
|
android:scrollbars="none"
|
||||||
|
|
Loading…
Reference in New Issue