mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-23 09:10:04 +02:00
Some fixes with cache and notifications
This commit is contained in:
parent
bb4851e424
commit
c4dbe80a05
2 changed files with 15 additions and 2 deletions
|
@ -14,6 +14,8 @@ package app.fedilab.android.client.entities.api;
|
||||||
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
* You should have received a copy of the GNU General Public License along with Fedilab; if not,
|
||||||
* see <http://www.gnu.org/licenses>. */
|
* see <http://www.gnu.org/licenses>. */
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.annotations.SerializedName;
|
import com.google.gson.annotations.SerializedName;
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
@ -45,6 +47,15 @@ public class Notification {
|
||||||
BOTTOM
|
BOTTOM
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable Object obj) {
|
||||||
|
boolean same = false;
|
||||||
|
if (obj instanceof Notification) {
|
||||||
|
same = this.id.equals(((Notification) obj).id);
|
||||||
|
}
|
||||||
|
return same;
|
||||||
|
}
|
||||||
|
|
||||||
public transient List<Notification> relatedNotifications;
|
public transient List<Notification> relatedNotifications;
|
||||||
public boolean isFetchMore;
|
public boolean isFetchMore;
|
||||||
public boolean isFetchMoreHidden = false;
|
public boolean isFetchMoreHidden = false;
|
||||||
|
|
|
@ -508,8 +508,10 @@ public class FragmentMastodonNotification extends Fragment implements Notificati
|
||||||
//We compare the date of each status and we only add status having a date greater than the another, it is inserted at this position
|
//We compare the date of each status and we only add status having a date greater than the another, it is inserted at this position
|
||||||
//Pinned messages are ignored because their date can be older
|
//Pinned messages are ignored because their date can be older
|
||||||
if (notificationReceived.id.compareTo(notificationsAlreadyPresent.id) > 0) {
|
if (notificationReceived.id.compareTo(notificationsAlreadyPresent.id) > 0) {
|
||||||
notificationList.add(position, notificationReceived);
|
if (!notificationList.contains(notificationReceived)) {
|
||||||
notificationAdapter.notifyItemInserted(position);
|
notificationList.add(position, notificationReceived);
|
||||||
|
notificationAdapter.notifyItemInserted(position);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
position++;
|
position++;
|
||||||
|
|
Loading…
Reference in a new issue