Added option to hide folders

Fixes #134
pull/145/head
M66B 6 years ago
parent 4c8a217edd
commit fe65235de6

@ -0,0 +1,994 @@
{
"formatVersion": 1,
"database": {
"version": 19,
"identityHash": "8be67722423e2c0044f7be118b861ea3",
"entities": [
{
"tableName": "identity",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `email` TEXT NOT NULL, `replyto` TEXT, `account` INTEGER NOT NULL, `host` TEXT NOT NULL, `port` INTEGER NOT NULL, `starttls` INTEGER NOT NULL, `user` TEXT NOT NULL, `password` TEXT NOT NULL, `auth_type` INTEGER NOT NULL, `primary` INTEGER NOT NULL, `synchronize` INTEGER NOT NULL, `store_sent` INTEGER NOT NULL, `state` TEXT, `error` TEXT, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "email",
"columnName": "email",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "replyto",
"columnName": "replyto",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "account",
"columnName": "account",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "host",
"columnName": "host",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "port",
"columnName": "port",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "starttls",
"columnName": "starttls",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "user",
"columnName": "user",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "password",
"columnName": "password",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "auth_type",
"columnName": "auth_type",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "primary",
"columnName": "primary",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "synchronize",
"columnName": "synchronize",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "store_sent",
"columnName": "store_sent",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "error",
"columnName": "error",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_identity_account",
"unique": false,
"columnNames": [
"account"
],
"createSql": "CREATE INDEX `index_identity_account` ON `${TABLE_NAME}` (`account`)"
}
],
"foreignKeys": [
{
"table": "account",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"account"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "account",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT, `signature` TEXT, `host` TEXT NOT NULL, `port` INTEGER NOT NULL, `user` TEXT NOT NULL, `password` TEXT NOT NULL, `auth_type` INTEGER NOT NULL, `primary` INTEGER NOT NULL, `synchronize` INTEGER NOT NULL, `color` INTEGER, `store_sent` INTEGER NOT NULL, `poll_interval` INTEGER NOT NULL, `seen_until` INTEGER, `state` TEXT, `error` TEXT)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "signature",
"columnName": "signature",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "host",
"columnName": "host",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "port",
"columnName": "port",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "user",
"columnName": "user",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "password",
"columnName": "password",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "auth_type",
"columnName": "auth_type",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "primary",
"columnName": "primary",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "synchronize",
"columnName": "synchronize",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "color",
"columnName": "color",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "store_sent",
"columnName": "store_sent",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "poll_interval",
"columnName": "poll_interval",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seen_until",
"columnName": "seen_until",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "error",
"columnName": "error",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "folder",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER, `name` TEXT NOT NULL, `type` TEXT NOT NULL, `unified` INTEGER NOT NULL, `synchronize` INTEGER NOT NULL, `after` INTEGER NOT NULL, `display` TEXT, `hide` INTEGER NOT NULL, `state` TEXT, `error` TEXT, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "account",
"columnName": "account",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "unified",
"columnName": "unified",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "synchronize",
"columnName": "synchronize",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "after",
"columnName": "after",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "display",
"columnName": "display",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "hide",
"columnName": "hide",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "state",
"columnName": "state",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "error",
"columnName": "error",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_folder_account_name",
"unique": true,
"columnNames": [
"account",
"name"
],
"createSql": "CREATE UNIQUE INDEX `index_folder_account_name` ON `${TABLE_NAME}` (`account`, `name`)"
},
{
"name": "index_folder_account",
"unique": false,
"columnNames": [
"account"
],
"createSql": "CREATE INDEX `index_folder_account` ON `${TABLE_NAME}` (`account`)"
},
{
"name": "index_folder_name",
"unique": false,
"columnNames": [
"name"
],
"createSql": "CREATE INDEX `index_folder_name` ON `${TABLE_NAME}` (`name`)"
},
{
"name": "index_folder_type",
"unique": false,
"columnNames": [
"type"
],
"createSql": "CREATE INDEX `index_folder_type` ON `${TABLE_NAME}` (`type`)"
},
{
"name": "index_folder_unified",
"unique": false,
"columnNames": [
"unified"
],
"createSql": "CREATE INDEX `index_folder_unified` ON `${TABLE_NAME}` (`unified`)"
}
],
"foreignKeys": [
{
"table": "account",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"account"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "message",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `account` INTEGER, `folder` INTEGER NOT NULL, `identity` INTEGER, `replying` INTEGER, `uid` INTEGER, `msgid` TEXT, `references` TEXT, `deliveredto` TEXT, `inreplyto` TEXT, `thread` TEXT, `avatar` TEXT, `from` TEXT, `to` TEXT, `cc` TEXT, `bcc` TEXT, `reply` TEXT, `headers` TEXT, `subject` TEXT, `size` INTEGER, `content` INTEGER NOT NULL, `sent` INTEGER, `received` INTEGER NOT NULL, `stored` INTEGER NOT NULL, `seen` INTEGER NOT NULL, `flagged` INTEGER NOT NULL, `ui_seen` INTEGER NOT NULL, `ui_flagged` INTEGER NOT NULL, `ui_hide` INTEGER NOT NULL, `ui_found` INTEGER NOT NULL, `error` TEXT, FOREIGN KEY(`account`) REFERENCES `account`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`identity`) REFERENCES `identity`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`replying`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "account",
"columnName": "account",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "folder",
"columnName": "folder",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "identity",
"columnName": "identity",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "replying",
"columnName": "replying",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "uid",
"columnName": "uid",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "msgid",
"columnName": "msgid",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "references",
"columnName": "references",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "deliveredto",
"columnName": "deliveredto",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "inreplyto",
"columnName": "inreplyto",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "thread",
"columnName": "thread",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "avatar",
"columnName": "avatar",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "from",
"columnName": "from",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "to",
"columnName": "to",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "cc",
"columnName": "cc",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "bcc",
"columnName": "bcc",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "reply",
"columnName": "reply",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "headers",
"columnName": "headers",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "subject",
"columnName": "subject",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "size",
"columnName": "size",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "content",
"columnName": "content",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sent",
"columnName": "sent",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "received",
"columnName": "received",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "stored",
"columnName": "stored",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "seen",
"columnName": "seen",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "flagged",
"columnName": "flagged",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "ui_seen",
"columnName": "ui_seen",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "ui_flagged",
"columnName": "ui_flagged",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "ui_hide",
"columnName": "ui_hide",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "ui_found",
"columnName": "ui_found",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "error",
"columnName": "error",
"affinity": "TEXT",
"notNull": false
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_message_account",
"unique": false,
"columnNames": [
"account"
],
"createSql": "CREATE INDEX `index_message_account` ON `${TABLE_NAME}` (`account`)"
},
{
"name": "index_message_folder",
"unique": false,
"columnNames": [
"folder"
],
"createSql": "CREATE INDEX `index_message_folder` ON `${TABLE_NAME}` (`folder`)"
},
{
"name": "index_message_identity",
"unique": false,
"columnNames": [
"identity"
],
"createSql": "CREATE INDEX `index_message_identity` ON `${TABLE_NAME}` (`identity`)"
},
{
"name": "index_message_replying",
"unique": false,
"columnNames": [
"replying"
],
"createSql": "CREATE INDEX `index_message_replying` ON `${TABLE_NAME}` (`replying`)"
},
{
"name": "index_message_folder_uid",
"unique": true,
"columnNames": [
"folder",
"uid"
],
"createSql": "CREATE UNIQUE INDEX `index_message_folder_uid` ON `${TABLE_NAME}` (`folder`, `uid`)"
},
{
"name": "index_message_msgid_folder",
"unique": true,
"columnNames": [
"msgid",
"folder"
],
"createSql": "CREATE UNIQUE INDEX `index_message_msgid_folder` ON `${TABLE_NAME}` (`msgid`, `folder`)"
},
{
"name": "index_message_thread",
"unique": false,
"columnNames": [
"thread"
],
"createSql": "CREATE INDEX `index_message_thread` ON `${TABLE_NAME}` (`thread`)"
},
{
"name": "index_message_received",
"unique": false,
"columnNames": [
"received"
],
"createSql": "CREATE INDEX `index_message_received` ON `${TABLE_NAME}` (`received`)"
},
{
"name": "index_message_ui_seen",
"unique": false,
"columnNames": [
"ui_seen"
],
"createSql": "CREATE INDEX `index_message_ui_seen` ON `${TABLE_NAME}` (`ui_seen`)"
},
{
"name": "index_message_ui_hide",
"unique": false,
"columnNames": [
"ui_hide"
],
"createSql": "CREATE INDEX `index_message_ui_hide` ON `${TABLE_NAME}` (`ui_hide`)"
},
{
"name": "index_message_ui_found",
"unique": false,
"columnNames": [
"ui_found"
],
"createSql": "CREATE INDEX `index_message_ui_found` ON `${TABLE_NAME}` (`ui_found`)"
}
],
"foreignKeys": [
{
"table": "account",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"account"
],
"referencedColumns": [
"id"
]
},
{
"table": "folder",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"folder"
],
"referencedColumns": [
"id"
]
},
{
"table": "identity",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"identity"
],
"referencedColumns": [
"id"
]
},
{
"table": "message",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"replying"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "attachment",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `message` INTEGER NOT NULL, `sequence` INTEGER NOT NULL, `name` TEXT, `type` TEXT NOT NULL, `cid` TEXT, `size` INTEGER, `progress` INTEGER, `available` INTEGER NOT NULL, FOREIGN KEY(`message`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "message",
"columnName": "message",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "sequence",
"columnName": "sequence",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "type",
"columnName": "type",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "cid",
"columnName": "cid",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "size",
"columnName": "size",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "progress",
"columnName": "progress",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "available",
"columnName": "available",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_attachment_message",
"unique": false,
"columnNames": [
"message"
],
"createSql": "CREATE INDEX `index_attachment_message` ON `${TABLE_NAME}` (`message`)"
},
{
"name": "index_attachment_message_sequence",
"unique": true,
"columnNames": [
"message",
"sequence"
],
"createSql": "CREATE UNIQUE INDEX `index_attachment_message_sequence` ON `${TABLE_NAME}` (`message`, `sequence`)"
},
{
"name": "index_attachment_message_cid",
"unique": true,
"columnNames": [
"message",
"cid"
],
"createSql": "CREATE UNIQUE INDEX `index_attachment_message_cid` ON `${TABLE_NAME}` (`message`, `cid`)"
}
],
"foreignKeys": [
{
"table": "message",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"message"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "operation",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `folder` INTEGER NOT NULL, `message` INTEGER NOT NULL, `name` TEXT NOT NULL, `args` TEXT NOT NULL, `created` INTEGER NOT NULL, FOREIGN KEY(`folder`) REFERENCES `folder`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`message`) REFERENCES `message`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "folder",
"columnName": "folder",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "message",
"columnName": "message",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "args",
"columnName": "args",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "created",
"columnName": "created",
"affinity": "INTEGER",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_operation_folder",
"unique": false,
"columnNames": [
"folder"
],
"createSql": "CREATE INDEX `index_operation_folder` ON `${TABLE_NAME}` (`folder`)"
},
{
"name": "index_operation_message",
"unique": false,
"columnNames": [
"message"
],
"createSql": "CREATE INDEX `index_operation_message` ON `${TABLE_NAME}` (`message`)"
}
],
"foreignKeys": [
{
"table": "folder",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"folder"
],
"referencedColumns": [
"id"
]
},
{
"table": "message",
"onDelete": "CASCADE",
"onUpdate": "NO ACTION",
"columns": [
"message"
],
"referencedColumns": [
"id"
]
}
]
},
{
"tableName": "answer",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `name` TEXT NOT NULL, `text` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "name",
"columnName": "name",
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "text",
"columnName": "text",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [],
"foreignKeys": []
},
{
"tableName": "log",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `time` INTEGER NOT NULL, `data` TEXT NOT NULL)",
"fields": [
{
"fieldPath": "id",
"columnName": "id",
"affinity": "INTEGER",
"notNull": false
},
{
"fieldPath": "time",
"columnName": "time",
"affinity": "INTEGER",
"notNull": true
},
{
"fieldPath": "data",
"columnName": "data",
"affinity": "TEXT",
"notNull": true
}
],
"primaryKey": {
"columnNames": [
"id"
],
"autoGenerate": true
},
"indices": [
{
"name": "index_log_time",
"unique": false,
"columnNames": [
"time"
],
"createSql": "CREATE INDEX `index_log_time` ON `${TABLE_NAME}` (`time`)"
}
],
"foreignKeys": []
}
],
"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, \"8be67722423e2c0044f7be118b861ea3\")"
]
}
}

@ -75,7 +75,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
ViewHolder(View itemView) {
super(itemView);
this.itemView = itemView;
this.itemView = itemView.findViewById(R.id.clItem);
ivState = itemView.findViewById(R.id.ivState);
tvName = itemView.findViewById(R.id.tvName);
tvMessages = itemView.findViewById(R.id.tvMessages);
@ -97,6 +97,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
}
private void bindTo(TupleFolderEx folder) {
itemView.setAlpha(folder.hide ? 0.5f : 1.0f);
if ("connected".equals(folder.state))
ivState.setImageResource(R.drawable.baseline_cloud_24);
else if ("connecting".equals(folder.state))
@ -284,6 +286,13 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
setHasStableIds(true);
}
private boolean showAll = false;
public void showHidden(boolean show) {
showAll = show;
set(all);
}
public void set(@NonNull List<TupleFolderEx> folders) {
Log.i(Helper.TAG, "Set folders=" + folders.size());
@ -307,13 +316,17 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
}
});
all.clear();
all.addAll(folders);
all = folders;
List<TupleFolderEx> shown = new ArrayList<>();
for (TupleFolderEx folder : folders)
if (!folder.hide || showAll)
shown.add(folder);
DiffUtil.DiffResult diff = DiffUtil.calculateDiff(new MessageDiffCallback(filtered, all));
DiffUtil.DiffResult diff = DiffUtil.calculateDiff(new MessageDiffCallback(filtered, shown));
filtered.clear();
filtered.addAll(all);
filtered.addAll(shown);
diff.dispatchUpdatesTo(new ListUpdateCallback() {
@Override

@ -45,7 +45,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 18,
version = 19,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -243,6 +243,13 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `folder` ADD COLUMN `display` TEXT");
}
})
.addMigrations(new Migration(18, 19) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `folder` ADD COLUMN `hide` INTEGER NOT NULL DEFAULT 0");
}
})
.build();
}

@ -121,8 +121,15 @@ public interface DaoFolder {
" AND type = :type")
int setFolderUser(long account, String type);
@Query("UPDATE folder SET name = :name, display = :display, synchronize = :synchronize, unified = :unified, after = :after WHERE id = :id")
int setFolderProperties(long id, String name, String display, boolean synchronize, boolean unified, int after);
@Query("UPDATE folder" +
" SET name = :name" +
", display = :display" +
", hide = :hide" +
", synchronize = :synchronize" +
", unified = :unified" +
", after = :after" +
" WHERE id = :id")
int setFolderProperties(long id, String name, String display, boolean hide, boolean synchronize, boolean unified, int after);
@Query("UPDATE folder SET name = :name WHERE account = :account AND name = :old")
int renameFolder(long account, String old, String name);

@ -58,15 +58,17 @@ public class EntityFolder implements Parcelable {
public Long account; // Outbox = null
@NonNull
public String name;
public String display;
@NonNull
public String type;
@NonNull
public Boolean unified = false;
@NonNull
public Boolean synchronize;
@NonNull
public Integer after; // days
public String display;
@NonNull
public Boolean hide = false;
@NonNull
public Boolean unified = false;
public String state;
public String error;
@ -135,6 +137,9 @@ public class EntityFolder implements Parcelable {
this.type.equals(other.type) &&
this.synchronize.equals(other.synchronize) &&
this.after.equals(other.after) &&
(this.display == null ? other.display == null : this.display.equals(other.display)) &&
this.hide == other.hide &&
this.unified == other.unified &&
(this.state == null ? other.state == null : this.state.equals(other.state)) &&
(this.error == null ? other.error == null : this.error.equals(other.error)));
} else

@ -50,6 +50,7 @@ public class FragmentFolder extends FragmentEx {
private ViewGroup view;
private EditText etRename;
private EditText etDisplay;
private CheckBox cbHide;
private CheckBox cbSynchronize;
private CheckBox cbUnified;
private EditText etAfter;
@ -83,6 +84,7 @@ public class FragmentFolder extends FragmentEx {
// Get controls
etRename = view.findViewById(R.id.etRename);
etDisplay = view.findViewById(R.id.etDisplay);
cbHide = view.findViewById(R.id.cbHide);
cbSynchronize = view.findViewById(R.id.cbSynchronize);
cbUnified = view.findViewById(R.id.cbUnified);
etAfter = view.findViewById(R.id.etAfter);
@ -104,8 +106,9 @@ public class FragmentFolder extends FragmentEx {
args.putLong("account", account);
args.putString("name", etRename.getText().toString());
args.putString("display", etDisplay.getText().toString());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("hide", cbHide.isChecked());
args.putBoolean("unified", cbUnified.isChecked());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putString("after", etAfter.getText().toString());
new SimpleTask<Void>() {
@ -115,8 +118,9 @@ public class FragmentFolder extends FragmentEx {
long aid = args.getLong("account");
String name = args.getString("name");
String display = args.getString("display");
boolean synchronize = args.getBoolean("synchronize");
boolean hide = args.getBoolean("hide");
boolean unified = args.getBoolean("unified");
boolean synchronize = args.getBoolean("synchronize");
String after = args.getString("after");
if (TextUtils.isEmpty(display) || display.equals(name))
@ -150,6 +154,7 @@ public class FragmentFolder extends FragmentEx {
create.account = aid;
create.name = name;
create.display = display;
create.hide = hide;
create.type = EntityFolder.USER;
create.unified = unified;
create.synchronize = synchronize;
@ -168,7 +173,7 @@ public class FragmentFolder extends FragmentEx {
if (folder != null) {
Log.i(Helper.TAG, "Updating folder=" + name);
db.folder().setFolderProperties(id, name, display, synchronize, unified, days);
db.folder().setFolderProperties(id, name, display, hide, synchronize, unified, days);
if (!synchronize)
db.folder().setFolderError(id, null);
}
@ -313,6 +318,7 @@ public class FragmentFolder extends FragmentEx {
etRename.setText(folder == null ? null : folder.name);
etDisplay.setText(folder == null ? null : (folder.display == null ? folder.name : folder.display));
etDisplay.setHint(folder == null ? null : folder.name);
cbHide.setChecked(folder == null ? false : folder.hide);
cbUnified.setChecked(folder == null ? false : folder.unified);
etAfter.setText(Integer.toString(folder == null ? EntityFolder.DEFAULT_USER_SYNC : folder.after));
}

@ -25,8 +25,10 @@ import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CompoundButton;
import android.widget.ImageButton;
import android.widget.ProgressBar;
import android.widget.ToggleButton;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
@ -42,6 +44,7 @@ import androidx.recyclerview.widget.RecyclerView;
public class FragmentFolders extends FragmentEx {
private ImageButton ibHintActions;
private ToggleButton tbShowHidden;
private RecyclerView rvFolder;
private ProgressBar pbWait;
private Group grpHintActions;
@ -67,6 +70,7 @@ public class FragmentFolders extends FragmentEx {
// Get controls
ibHintActions = view.findViewById(R.id.ibHintActions);
tbShowHidden = view.findViewById(R.id.tbShowHidden);
rvFolder = view.findViewById(R.id.rvFolder);
pbWait = view.findViewById(R.id.pbWait);
grpHintActions = view.findViewById(R.id.grpHintActions);
@ -84,6 +88,13 @@ public class FragmentFolders extends FragmentEx {
}
});
tbShowHidden.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
adapter.showHidden(isChecked);
}
});
rvFolder.setHasFixedSize(false);
LinearLayoutManager llm = new LinearLayoutManager(getContext());
rvFolder.setLayoutManager(llm);
@ -105,6 +116,7 @@ public class FragmentFolders extends FragmentEx {
});
// Initialize
tbShowHidden.setVisibility(View.GONE);
grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
@ -138,6 +150,14 @@ public class FragmentFolders extends FragmentEx {
return;
}
boolean hidden = false;
for (TupleFolderEx folder : folders)
if (folder.hide) {
hidden = true;
break;
}
tbShowHidden.setVisibility(hidden ? View.VISIBLE : View.GONE);
adapter.set(folders);
pbWait.setVisibility(View.GONE);

@ -54,11 +54,11 @@
app:layout_constraintTop_toBottomOf="@id/tvDisplay" />
<CheckBox
android:id="@+id/cbSynchronize"
android:id="@+id/cbHide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_synchronize_folder"
android:text="@string/title_hide_folder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etDisplay" />
@ -69,7 +69,16 @@
android:layout_marginTop="12dp"
android:text="@string/title_unified_folder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
app:layout_constraintTop_toBottomOf="@id/cbHide" />
<CheckBox
android:id="@+id/cbSynchronize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_synchronize_folder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbUnified" />
<!-- after -->
@ -81,7 +90,7 @@
android:text="@string/title_after"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbUnified" />
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
<EditText
android:id="@+id/etAfter"

@ -40,6 +40,19 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHintActions" />
<ToggleButton
android:id="@+id/tbShowHidden"
style="@style/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="0dp"
android:minWidth="0dp"
android:textOff="@string/title_show_folders"
android:textOn="@string/title_hide_folders"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparator" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvFolder"
android:layout_width="0dp"
@ -49,7 +62,7 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparator" />
app:layout_constraintTop_toBottomOf="@id/tbShowHidden" />
<ProgressBar
android:id="@+id/pbWait"

@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/clItem"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/ivState"
android:layout_width="24dp"
@ -113,3 +118,4 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvError" />
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>

@ -137,6 +137,9 @@
<string name="title_folder_name">Folder name</string>
<string name="title_display_name">Display name</string>
<string name="title_hide_folder">Hide from list</string>
<string name="title_hide_folders">Hide hidden folders</string>
<string name="title_show_folders">Show hidden folders</string>
<string name="title_synchronize_folder">Synchronize (receive messages)</string>
<string name="title_unified_folder">Show in unified inbox</string>
<string name="title_after">Synchronize (days)</string>

Loading…
Cancel
Save