From 0bd7f987d06f735c48f37cfba940452c4f21c967 Mon Sep 17 00:00:00 2001 From: Thomas Date: Sun, 15 May 2022 15:24:00 +0200 Subject: [PATCH] Fix #49 - Hidden timelines create an offset --- .../app/fedilab/android/client/entities/Pinned.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/fedilab/android/client/entities/Pinned.java b/app/src/main/java/app/fedilab/android/client/entities/Pinned.java index b0d3bcb7..91277aaf 100644 --- a/app/src/main/java/app/fedilab/android/client/entities/Pinned.java +++ b/app/src/main/java/app/fedilab/android/client/entities/Pinned.java @@ -24,6 +24,7 @@ import com.google.gson.annotations.SerializedName; import com.google.gson.reflect.TypeToken; import java.io.Serializable; +import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -155,7 +156,17 @@ public class Pinned implements Serializable { } try { Cursor c = db.query(Sqlite.TABLE_PINNED_TIMELINES, null, Sqlite.COL_INSTANCE + " = '" + account.instance + "' AND " + Sqlite.COL_USER_ID + " = '" + account.user_id + "'", null, null, null, Sqlite.COL_UPDATED_AT + " DESC", "1"); - return cursorToPined(c); + Pinned pinned = cursorToPined(c); + List pinnedTimelines = new ArrayList<>(); + if (pinned != null) { + for (PinnedTimeline pinnedTimeline : pinned.pinnedTimelines) { + if (pinnedTimeline.displayed) { + pinnedTimelines.add(pinnedTimeline); + } + } + pinned.pinnedTimelines = pinnedTimelines; + } + return pinned; } catch (Exception e) { return null; }