add option to always expand content warnings (#1422)
parent
923bd32aea
commit
9885065f02
@ -0,0 +1,693 @@ |
|||||||
|
{ |
||||||
|
"formatVersion": 1, |
||||||
|
"database": { |
||||||
|
"version": 18, |
||||||
|
"identityHash": "33d7d9b8ba14c87b96ce795c337bfc57", |
||||||
|
"entities": [ |
||||||
|
{ |
||||||
|
"tableName": "TootEntity", |
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uid` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `text` TEXT, `urls` TEXT, `descriptions` TEXT, `contentWarning` TEXT, `inReplyToId` TEXT, `inReplyToText` TEXT, `inReplyToUsername` TEXT, `visibility` INTEGER)", |
||||||
|
"fields": [ |
||||||
|
{ |
||||||
|
"fieldPath": "uid", |
||||||
|
"columnName": "uid", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "text", |
||||||
|
"columnName": "text", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "urls", |
||||||
|
"columnName": "urls", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "descriptions", |
||||||
|
"columnName": "descriptions", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "contentWarning", |
||||||
|
"columnName": "contentWarning", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "inReplyToId", |
||||||
|
"columnName": "inReplyToId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "inReplyToText", |
||||||
|
"columnName": "inReplyToText", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "inReplyToUsername", |
||||||
|
"columnName": "inReplyToUsername", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "visibility", |
||||||
|
"columnName": "visibility", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": false |
||||||
|
} |
||||||
|
], |
||||||
|
"primaryKey": { |
||||||
|
"columnNames": [ |
||||||
|
"uid" |
||||||
|
], |
||||||
|
"autoGenerate": true |
||||||
|
}, |
||||||
|
"indices": [], |
||||||
|
"foreignKeys": [] |
||||||
|
}, |
||||||
|
{ |
||||||
|
"tableName": "AccountEntity", |
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `domain` TEXT NOT NULL, `accessToken` TEXT NOT NULL, `isActive` INTEGER NOT NULL, `accountId` TEXT NOT NULL, `username` TEXT NOT NULL, `displayName` TEXT NOT NULL, `profilePictureUrl` TEXT NOT NULL, `notificationsEnabled` INTEGER NOT NULL, `notificationsMentioned` INTEGER NOT NULL, `notificationsFollowed` INTEGER NOT NULL, `notificationsReblogged` INTEGER NOT NULL, `notificationsFavorited` INTEGER NOT NULL, `notificationsPolls` INTEGER NOT NULL, `notificationSound` INTEGER NOT NULL, `notificationVibration` INTEGER NOT NULL, `notificationLight` INTEGER NOT NULL, `defaultPostPrivacy` INTEGER NOT NULL, `defaultMediaSensitivity` INTEGER NOT NULL, `alwaysShowSensitiveMedia` INTEGER NOT NULL, `alwaysOpenSpoiler` INTEGER NOT NULL, `mediaPreviewEnabled` INTEGER NOT NULL, `lastNotificationId` TEXT NOT NULL, `activeNotifications` TEXT NOT NULL, `emojis` TEXT NOT NULL, `tabPreferences` TEXT NOT NULL, `notificationsFilter` TEXT NOT NULL)", |
||||||
|
"fields": [ |
||||||
|
{ |
||||||
|
"fieldPath": "id", |
||||||
|
"columnName": "id", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "domain", |
||||||
|
"columnName": "domain", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "accessToken", |
||||||
|
"columnName": "accessToken", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "isActive", |
||||||
|
"columnName": "isActive", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "accountId", |
||||||
|
"columnName": "accountId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "username", |
||||||
|
"columnName": "username", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "displayName", |
||||||
|
"columnName": "displayName", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "profilePictureUrl", |
||||||
|
"columnName": "profilePictureUrl", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationsEnabled", |
||||||
|
"columnName": "notificationsEnabled", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationsMentioned", |
||||||
|
"columnName": "notificationsMentioned", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationsFollowed", |
||||||
|
"columnName": "notificationsFollowed", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationsReblogged", |
||||||
|
"columnName": "notificationsReblogged", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationsFavorited", |
||||||
|
"columnName": "notificationsFavorited", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationsPolls", |
||||||
|
"columnName": "notificationsPolls", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationSound", |
||||||
|
"columnName": "notificationSound", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationVibration", |
||||||
|
"columnName": "notificationVibration", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationLight", |
||||||
|
"columnName": "notificationLight", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "defaultPostPrivacy", |
||||||
|
"columnName": "defaultPostPrivacy", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "defaultMediaSensitivity", |
||||||
|
"columnName": "defaultMediaSensitivity", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "alwaysShowSensitiveMedia", |
||||||
|
"columnName": "alwaysShowSensitiveMedia", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "alwaysOpenSpoiler", |
||||||
|
"columnName": "alwaysOpenSpoiler", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "mediaPreviewEnabled", |
||||||
|
"columnName": "mediaPreviewEnabled", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastNotificationId", |
||||||
|
"columnName": "lastNotificationId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "activeNotifications", |
||||||
|
"columnName": "activeNotifications", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "emojis", |
||||||
|
"columnName": "emojis", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "tabPreferences", |
||||||
|
"columnName": "tabPreferences", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "notificationsFilter", |
||||||
|
"columnName": "notificationsFilter", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
} |
||||||
|
], |
||||||
|
"primaryKey": { |
||||||
|
"columnNames": [ |
||||||
|
"id" |
||||||
|
], |
||||||
|
"autoGenerate": true |
||||||
|
}, |
||||||
|
"indices": [ |
||||||
|
{ |
||||||
|
"name": "index_AccountEntity_domain_accountId", |
||||||
|
"unique": true, |
||||||
|
"columnNames": [ |
||||||
|
"domain", |
||||||
|
"accountId" |
||||||
|
], |
||||||
|
"createSql": "CREATE UNIQUE INDEX `index_AccountEntity_domain_accountId` ON `${TABLE_NAME}` (`domain`, `accountId`)" |
||||||
|
} |
||||||
|
], |
||||||
|
"foreignKeys": [] |
||||||
|
}, |
||||||
|
{ |
||||||
|
"tableName": "InstanceEntity", |
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`instance` TEXT NOT NULL, `emojiList` TEXT, `maximumTootCharacters` INTEGER, PRIMARY KEY(`instance`))", |
||||||
|
"fields": [ |
||||||
|
{ |
||||||
|
"fieldPath": "instance", |
||||||
|
"columnName": "instance", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "emojiList", |
||||||
|
"columnName": "emojiList", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "maximumTootCharacters", |
||||||
|
"columnName": "maximumTootCharacters", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": false |
||||||
|
} |
||||||
|
], |
||||||
|
"primaryKey": { |
||||||
|
"columnNames": [ |
||||||
|
"instance" |
||||||
|
], |
||||||
|
"autoGenerate": false |
||||||
|
}, |
||||||
|
"indices": [], |
||||||
|
"foreignKeys": [] |
||||||
|
}, |
||||||
|
{ |
||||||
|
"tableName": "TimelineStatusEntity", |
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`serverId` TEXT NOT NULL, `url` TEXT, `timelineUserId` INTEGER NOT NULL, `authorServerId` TEXT, `inReplyToId` TEXT, `inReplyToAccountId` TEXT, `content` TEXT, `createdAt` INTEGER NOT NULL, `emojis` TEXT, `reblogsCount` INTEGER NOT NULL, `favouritesCount` INTEGER NOT NULL, `reblogged` INTEGER NOT NULL, `favourited` INTEGER NOT NULL, `sensitive` INTEGER NOT NULL, `spoilerText` TEXT, `visibility` INTEGER, `attachments` TEXT, `mentions` TEXT, `application` TEXT, `reblogServerId` TEXT, `reblogAccountId` TEXT, `poll` TEXT, PRIMARY KEY(`serverId`, `timelineUserId`), FOREIGN KEY(`authorServerId`, `timelineUserId`) REFERENCES `TimelineAccountEntity`(`serverId`, `timelineUserId`) ON UPDATE NO ACTION ON DELETE NO ACTION )", |
||||||
|
"fields": [ |
||||||
|
{ |
||||||
|
"fieldPath": "serverId", |
||||||
|
"columnName": "serverId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "url", |
||||||
|
"columnName": "url", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "timelineUserId", |
||||||
|
"columnName": "timelineUserId", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "authorServerId", |
||||||
|
"columnName": "authorServerId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "inReplyToId", |
||||||
|
"columnName": "inReplyToId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "inReplyToAccountId", |
||||||
|
"columnName": "inReplyToAccountId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "content", |
||||||
|
"columnName": "content", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "createdAt", |
||||||
|
"columnName": "createdAt", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "emojis", |
||||||
|
"columnName": "emojis", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "reblogsCount", |
||||||
|
"columnName": "reblogsCount", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "favouritesCount", |
||||||
|
"columnName": "favouritesCount", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "reblogged", |
||||||
|
"columnName": "reblogged", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "favourited", |
||||||
|
"columnName": "favourited", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "sensitive", |
||||||
|
"columnName": "sensitive", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "spoilerText", |
||||||
|
"columnName": "spoilerText", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "visibility", |
||||||
|
"columnName": "visibility", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "attachments", |
||||||
|
"columnName": "attachments", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "mentions", |
||||||
|
"columnName": "mentions", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "application", |
||||||
|
"columnName": "application", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "reblogServerId", |
||||||
|
"columnName": "reblogServerId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "reblogAccountId", |
||||||
|
"columnName": "reblogAccountId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "poll", |
||||||
|
"columnName": "poll", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
} |
||||||
|
], |
||||||
|
"primaryKey": { |
||||||
|
"columnNames": [ |
||||||
|
"serverId", |
||||||
|
"timelineUserId" |
||||||
|
], |
||||||
|
"autoGenerate": false |
||||||
|
}, |
||||||
|
"indices": [ |
||||||
|
{ |
||||||
|
"name": "index_TimelineStatusEntity_authorServerId_timelineUserId", |
||||||
|
"unique": false, |
||||||
|
"columnNames": [ |
||||||
|
"authorServerId", |
||||||
|
"timelineUserId" |
||||||
|
], |
||||||
|
"createSql": "CREATE INDEX `index_TimelineStatusEntity_authorServerId_timelineUserId` ON `${TABLE_NAME}` (`authorServerId`, `timelineUserId`)" |
||||||
|
} |
||||||
|
], |
||||||
|
"foreignKeys": [ |
||||||
|
{ |
||||||
|
"table": "TimelineAccountEntity", |
||||||
|
"onDelete": "NO ACTION", |
||||||
|
"onUpdate": "NO ACTION", |
||||||
|
"columns": [ |
||||||
|
"authorServerId", |
||||||
|
"timelineUserId" |
||||||
|
], |
||||||
|
"referencedColumns": [ |
||||||
|
"serverId", |
||||||
|
"timelineUserId" |
||||||
|
] |
||||||
|
} |
||||||
|
] |
||||||
|
}, |
||||||
|
{ |
||||||
|
"tableName": "TimelineAccountEntity", |
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`serverId` TEXT NOT NULL, `timelineUserId` INTEGER NOT NULL, `localUsername` TEXT NOT NULL, `username` TEXT NOT NULL, `displayName` TEXT NOT NULL, `url` TEXT NOT NULL, `avatar` TEXT NOT NULL, `emojis` TEXT NOT NULL, `bot` INTEGER NOT NULL, PRIMARY KEY(`serverId`, `timelineUserId`))", |
||||||
|
"fields": [ |
||||||
|
{ |
||||||
|
"fieldPath": "serverId", |
||||||
|
"columnName": "serverId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "timelineUserId", |
||||||
|
"columnName": "timelineUserId", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "localUsername", |
||||||
|
"columnName": "localUsername", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "username", |
||||||
|
"columnName": "username", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "displayName", |
||||||
|
"columnName": "displayName", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "url", |
||||||
|
"columnName": "url", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "avatar", |
||||||
|
"columnName": "avatar", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "emojis", |
||||||
|
"columnName": "emojis", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "bot", |
||||||
|
"columnName": "bot", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
} |
||||||
|
], |
||||||
|
"primaryKey": { |
||||||
|
"columnNames": [ |
||||||
|
"serverId", |
||||||
|
"timelineUserId" |
||||||
|
], |
||||||
|
"autoGenerate": false |
||||||
|
}, |
||||||
|
"indices": [], |
||||||
|
"foreignKeys": [] |
||||||
|
}, |
||||||
|
{ |
||||||
|
"tableName": "ConversationEntity", |
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`accountId` INTEGER NOT NULL, `id` TEXT NOT NULL, `accounts` TEXT NOT NULL, `unread` INTEGER NOT NULL, `s_id` TEXT NOT NULL, `s_url` TEXT, `s_inReplyToId` TEXT, `s_inReplyToAccountId` TEXT, `s_account` TEXT NOT NULL, `s_content` TEXT NOT NULL, `s_createdAt` INTEGER NOT NULL, `s_emojis` TEXT NOT NULL, `s_favouritesCount` INTEGER NOT NULL, `s_favourited` INTEGER NOT NULL, `s_sensitive` INTEGER NOT NULL, `s_spoilerText` TEXT NOT NULL, `s_attachments` TEXT NOT NULL, `s_mentions` TEXT NOT NULL, `s_showingHiddenContent` INTEGER NOT NULL, `s_expanded` INTEGER NOT NULL, `s_collapsible` INTEGER NOT NULL, `s_collapsed` INTEGER NOT NULL, `s_poll` TEXT, PRIMARY KEY(`id`, `accountId`))", |
||||||
|
"fields": [ |
||||||
|
{ |
||||||
|
"fieldPath": "accountId", |
||||||
|
"columnName": "accountId", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "id", |
||||||
|
"columnName": "id", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "accounts", |
||||||
|
"columnName": "accounts", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "unread", |
||||||
|
"columnName": "unread", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.id", |
||||||
|
"columnName": "s_id", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.url", |
||||||
|
"columnName": "s_url", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.inReplyToId", |
||||||
|
"columnName": "s_inReplyToId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.inReplyToAccountId", |
||||||
|
"columnName": "s_inReplyToAccountId", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.account", |
||||||
|
"columnName": "s_account", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.content", |
||||||
|
"columnName": "s_content", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.createdAt", |
||||||
|
"columnName": "s_createdAt", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.emojis", |
||||||
|
"columnName": "s_emojis", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.favouritesCount", |
||||||
|
"columnName": "s_favouritesCount", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.favourited", |
||||||
|
"columnName": "s_favourited", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.sensitive", |
||||||
|
"columnName": "s_sensitive", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.spoilerText", |
||||||
|
"columnName": "s_spoilerText", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.attachments", |
||||||
|
"columnName": "s_attachments", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.mentions", |
||||||
|
"columnName": "s_mentions", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.showingHiddenContent", |
||||||
|
"columnName": "s_showingHiddenContent", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.expanded", |
||||||
|
"columnName": "s_expanded", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.collapsible", |
||||||
|
"columnName": "s_collapsible", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.collapsed", |
||||||
|
"columnName": "s_collapsed", |
||||||
|
"affinity": "INTEGER", |
||||||
|
"notNull": true |
||||||
|
}, |
||||||
|
{ |
||||||
|
"fieldPath": "lastStatus.poll", |
||||||
|
"columnName": "s_poll", |
||||||
|
"affinity": "TEXT", |
||||||
|
"notNull": false |
||||||
|
} |
||||||
|
], |
||||||
|
"primaryKey": { |
||||||
|
"columnNames": [ |
||||||
|
"id", |
||||||
|
"accountId" |
||||||
|
], |
||||||
|
"autoGenerate": false |
||||||
|
}, |
||||||
|
"indices": [], |
||||||
|
"foreignKeys": [] |
||||||
|
} |
||||||
|
], |
||||||
|
"views": [], |
||||||
|
"setupQueries": [ |
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", |
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '33d7d9b8ba14c87b96ce795c337bfc57')" |
||||||
|
] |
||||||
|
} |
||||||
|
} |
@ -1,199 +0,0 @@ |
|||||||
/* Copyright 2017 Andrew Dawson |
|
||||||
* |
|
||||||
* This file is a part of Tusky. |
|
||||||
* |
|
||||||
* This program is free software; you can redistribute it and/or modify it under the terms of the |
|
||||||
* GNU General Public License as published by the Free Software Foundation; either version 3 of the |
|
||||||
* License, or (at your option) any later version. |
|
||||||
* |
|
||||||
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
|
||||||
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
||||||
* Public License for more details. |
|
||||||
* |
|
||||||
* You should have received a copy of the GNU General Public License along with Tusky; if not, |
|
||||||
* see <http://www.gnu.org/licenses>. */
|
|
||||||
|
|
||||||
package com.keylesspalace.tusky.adapter; |
|
||||||
|
|
||||||
import androidx.annotation.NonNull; |
|
||||||
import androidx.annotation.Nullable; |
|
||||||
import androidx.recyclerview.widget.RecyclerView; |
|
||||||
import android.view.LayoutInflater; |
|
||||||
import android.view.View; |
|
||||||
import android.view.ViewGroup; |
|
||||||
import android.widget.TextView; |
|
||||||
|
|
||||||
import com.keylesspalace.tusky.R; |
|
||||||
import com.keylesspalace.tusky.entity.Account; |
|
||||||
import com.keylesspalace.tusky.entity.SearchResults; |
|
||||||
import com.keylesspalace.tusky.entity.Status; |
|
||||||
import com.keylesspalace.tusky.interfaces.LinkListener; |
|
||||||
import com.keylesspalace.tusky.interfaces.StatusActionListener; |
|
||||||
import com.keylesspalace.tusky.util.ViewDataUtils; |
|
||||||
import com.keylesspalace.tusky.viewdata.StatusViewData; |
|
||||||
|
|
||||||
import java.util.ArrayList; |
|
||||||
import java.util.Collections; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
public class SearchResultsAdapter extends RecyclerView.Adapter { |
|
||||||
private static final int VIEW_TYPE_ACCOUNT = 0; |
|
||||||
private static final int VIEW_TYPE_STATUS = 1; |
|
||||||
private static final int VIEW_TYPE_HASHTAG = 2; |
|
||||||
|
|
||||||
private List<Account> accountList; |
|
||||||
private List<Status> statusList; |
|
||||||
private List<StatusViewData.Concrete> concreteStatusList; |
|
||||||
private List<String> hashtagList; |
|
||||||
|
|
||||||
private boolean mediaPreviewsEnabled; |
|
||||||
private boolean alwaysShowSensitiveMedia; |
|
||||||
private boolean useAbsoluteTime; |
|
||||||
private boolean showBotOverlay; |
|
||||||
private boolean animateAvatar; |
|
||||||
|
|
||||||
private LinkListener linkListener; |
|
||||||
private StatusActionListener statusListener; |
|
||||||
|
|
||||||
public SearchResultsAdapter(LinkListener linkListener, |
|
||||||
StatusActionListener statusListener, |
|
||||||
boolean mediaPreviewsEnabled, |
|
||||||
boolean alwaysShowSensitiveMedia, |
|
||||||
boolean useAbsoluteTime, |
|
||||||
boolean showBotOverlay, |
|
||||||
boolean animateAvatar) { |
|
||||||
|
|
||||||
this.accountList = Collections.emptyList(); |
|
||||||
this.statusList = Collections.emptyList(); |
|
||||||
this.concreteStatusList = new ArrayList<>(); |
|
||||||
this.hashtagList = Collections.emptyList(); |
|
||||||
|
|
||||||
this.mediaPreviewsEnabled = mediaPreviewsEnabled; |
|
||||||
this.alwaysShowSensitiveMedia = alwaysShowSensitiveMedia; |
|
||||||
this.useAbsoluteTime = useAbsoluteTime; |
|
||||||
this.showBotOverlay = showBotOverlay; |
|
||||||
this.animateAvatar = animateAvatar; |
|
||||||
|
|
||||||
this.linkListener = linkListener; |
|
||||||
this.statusListener = statusListener; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@NonNull |
|
||||||
@Override |
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { |
|
||||||
switch (viewType) { |
|
||||||
default: |
|
||||||
case VIEW_TYPE_ACCOUNT: { |
|
||||||
View view = LayoutInflater.from(parent.getContext()) |
|
||||||
.inflate(R.layout.item_account, parent, false); |
|
||||||
return new AccountViewHolder(view); |
|
||||||
} |
|
||||||
case VIEW_TYPE_HASHTAG: { |
|
||||||
View view = LayoutInflater.from(parent.getContext()) |
|
||||||
.inflate(R.layout.item_hashtag, parent, false); |
|
||||||
return new HashtagViewHolder(view); |
|
||||||
} |
|
||||||
case VIEW_TYPE_STATUS: { |
|
||||||
View view = LayoutInflater.from(parent.getContext()) |
|
||||||
.inflate(R.layout.item_status, parent, false); |
|
||||||
return new StatusViewHolder(view, useAbsoluteTime); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int position) { |
|
||||||
if (position >= accountList.size()) { |
|
||||||
if(position >= accountList.size() + concreteStatusList.size()) { |
|
||||||
HashtagViewHolder holder = (HashtagViewHolder) viewHolder; |
|
||||||
int index = position - accountList.size() - concreteStatusList.size(); |
|
||||||
holder.setup(hashtagList.get(index), linkListener); |
|
||||||
} else { |
|
||||||
StatusViewHolder holder = (StatusViewHolder) viewHolder; |
|
||||||
int index = position - accountList.size(); |
|
||||||
holder.setupWithStatus(concreteStatusList.get(index), statusListener, |
|
||||||
mediaPreviewsEnabled, showBotOverlay, animateAvatar); |
|
||||||
} |
|
||||||
} else { |
|
||||||
AccountViewHolder holder = (AccountViewHolder) viewHolder; |
|
||||||
holder.setupWithAccount(accountList.get(position)); |
|
||||||
holder.setupLinkListener(linkListener); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public int getItemCount() { |
|
||||||
return accountList.size() + hashtagList.size() + concreteStatusList.size(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public int getItemViewType(int position) { |
|
||||||
if (position >= accountList.size()) { |
|
||||||
if(position >= accountList.size() + concreteStatusList.size()) { |
|
||||||
return VIEW_TYPE_HASHTAG; |
|
||||||
} else { |
|
||||||
return VIEW_TYPE_STATUS; |
|
||||||
} |
|
||||||
} else { |
|
||||||
return VIEW_TYPE_ACCOUNT; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Nullable public Status getStatusAtPosition(int position) { |
|
||||||
return statusList.get(position - accountList.size()); |
|
||||||
} |
|
||||||
|
|
||||||
@Nullable public StatusViewData.Concrete getConcreteStatusAtPosition(int position) { |
|
||||||
return concreteStatusList.get(position - accountList.size()); |
|
||||||
} |
|
||||||
|
|
||||||
public void updateStatusAtPosition(StatusViewData.Concrete status, int position, boolean doNotify) { |
|
||||||
concreteStatusList.set(position - accountList.size(), status); |
|
||||||
if(doNotify) { |
|
||||||
notifyItemChanged(position); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void removeStatusAtPosition(int position) { |
|
||||||
concreteStatusList.remove(position - accountList.size()); |
|
||||||
notifyItemRemoved(position); |
|
||||||
} |
|
||||||
|
|
||||||
public void updateSearchResults(SearchResults results) { |
|
||||||
if (results != null) { |
|
||||||
accountList = results.getAccounts(); |
|
||||||
statusList = results.getStatuses(); |
|
||||||
concreteStatusList.clear(); |
|
||||||
for(Status status: results.getStatuses()) { |
|
||||||
concreteStatusList.add(ViewDataUtils.statusToViewData( |
|
||||||
status, |
|
||||||
alwaysShowSensitiveMedia |
|
||||||
)); |
|
||||||
} |
|
||||||
hashtagList = results.getHashtags(); |
|
||||||
|
|
||||||
} else { |
|
||||||
accountList = Collections.emptyList(); |
|
||||||
statusList = Collections.emptyList(); |
|
||||||
concreteStatusList.clear(); |
|
||||||
hashtagList = Collections.emptyList(); |
|
||||||
|
|
||||||
} |
|
||||||
notifyDataSetChanged(); |
|
||||||
} |
|
||||||
|
|
||||||
private static class HashtagViewHolder extends RecyclerView.ViewHolder { |
|
||||||
private TextView hashtag; |
|
||||||
|
|
||||||
HashtagViewHolder(View itemView) { |
|
||||||
super(itemView); |
|
||||||
hashtag = itemView.findViewById(R.id.hashtag); |
|
||||||
} |
|
||||||
|
|
||||||
void setup(final String tag, final LinkListener listener) { |
|
||||||
hashtag.setText(String.format("#%s", tag)); |
|
||||||
hashtag.setOnClickListener(v -> listener.onViewTag(tag)); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue