Media description improvements (#898)
* Enforce 420-character limit on media descriptions in the UI * Persist media descriptions with drafts * Defer media description update until after upload finishes * Make description field 2 lines for better visibility of hint text * Reuse Gson instance * Force retranslation of modified string "hint_describe_for_visually_impaired" * Add bounds check when reading serialized media descriptions
This commit is contained in:
parent
026292122d
commit
690e612f8b
30 changed files with 103 additions and 48 deletions
|
|
@ -25,7 +25,7 @@ import android.support.annotation.NonNull;
|
|||
* DB version & declare DAO
|
||||
*/
|
||||
|
||||
@Database(entities = {TootEntity.class, AccountEntity.class, InstanceEntity.class}, version = 8, exportSchema = false)
|
||||
@Database(entities = {TootEntity.class, AccountEntity.class, InstanceEntity.class}, version = 9, exportSchema = false)
|
||||
public abstract class AppDatabase extends RoomDatabase {
|
||||
|
||||
public abstract TootDao tootDao();
|
||||
|
|
@ -98,4 +98,11 @@ public abstract class AppDatabase extends RoomDatabase {
|
|||
database.execSQL("ALTER TABLE `AccountEntity` ADD COLUMN `emojis` TEXT NOT NULL DEFAULT '[]'");
|
||||
}
|
||||
};
|
||||
|
||||
public static final Migration MIGRATION_8_9 = new Migration(8, 9) {
|
||||
@Override
|
||||
public void migrate(@NonNull SupportSQLiteDatabase database) {
|
||||
database.execSQL("ALTER TABLE `TootEntity` ADD COLUMN `descriptions` TEXT DEFAULT '[]'");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -40,6 +40,9 @@ public class TootEntity {
|
|||
@ColumnInfo(name = "urls")
|
||||
private final String urls;
|
||||
|
||||
@ColumnInfo(name = "descriptions")
|
||||
private final String descriptions;
|
||||
|
||||
@ColumnInfo(name = "contentWarning")
|
||||
private final String contentWarning;
|
||||
|
||||
|
|
@ -57,12 +60,13 @@ public class TootEntity {
|
|||
@ColumnInfo(name = "visibility")
|
||||
private final Status.Visibility visibility;
|
||||
|
||||
public TootEntity(int uid, String text, String urls, String contentWarning, String inReplyToId,
|
||||
public TootEntity(int uid, String text, String urls, String descriptions, String contentWarning, String inReplyToId,
|
||||
@Nullable String inReplyToText, @Nullable String inReplyToUsername,
|
||||
Status.Visibility visibility) {
|
||||
this.uid = uid;
|
||||
this.text = text;
|
||||
this.urls = urls;
|
||||
this.descriptions = descriptions;
|
||||
this.contentWarning = contentWarning;
|
||||
this.inReplyToId = inReplyToId;
|
||||
this.inReplyToText = inReplyToText;
|
||||
|
|
@ -86,6 +90,10 @@ public class TootEntity {
|
|||
return urls;
|
||||
}
|
||||
|
||||
public String getDescriptions() {
|
||||
return descriptions;
|
||||
}
|
||||
|
||||
public String getInReplyToId() {
|
||||
return inReplyToId;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue