Browse Source

Select folders to show in unified inbox

Fixed #47
Fixes #87
main
M66B 5 years ago
parent
commit
1e7ff72e55
13 changed files with 1005 additions and 11 deletions
  1. +919
    -0
      app/schemas/eu.faircode.email.DB/10.json
  2. +4
    -0
      app/src/main/java/eu/faircode/email/AdapterFolder.java
  3. +10
    -1
      app/src/main/java/eu/faircode/email/DB.java
  4. +3
    -3
      app/src/main/java/eu/faircode/email/DaoFolder.java
  5. +3
    -3
      app/src/main/java/eu/faircode/email/DaoMessage.java
  6. +5
    -1
      app/src/main/java/eu/faircode/email/EntityFolder.java
  7. +1
    -0
      app/src/main/java/eu/faircode/email/FragmentAccount.java
  8. +6
    -1
      app/src/main/java/eu/faircode/email/FragmentFolder.java
  9. +10
    -0
      app/src/main/res/drawable/baseline_folder_special_24.xml
  10. +10
    -1
      app/src/main/res/layout/fragment_folder.xml
  11. +21
    -1
      app/src/main/res/layout/fragment_legend.xml
  12. +11
    -0
      app/src/main/res/layout/item_folder.xml
  13. +2
    -0
      app/src/main/res/values/strings.xml

+ 919
- 0
app/schemas/eu.faircode.email.DB/10.json View File

@ -0,0 +1,919 @@
{
"formatVersion": 1,
"database": {
"version": 10,
"identityHash": "8a267f8f3cb9ef409377dbdb7cb706d4",
"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, `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, `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": "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": "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, `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": "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, `inreplyto` TEXT, `thread` TEXT, `from` TEXT, `to` TEXT, `cc` TEXT, `bcc` TEXT, `reply` TEXT, `headers` TEXT, `subject` TEXT, `sent` INTEGER, `received` INTEGER NOT NULL, `stored` INTEGER NOT NULL, `seen` INTEGER NOT NULL, `ui_seen` 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": "inreplyto",
"columnName": "inreplyto",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "thread",
"columnName": "thread",
"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": "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": "ui_seen",
"columnName": "ui_seen",
"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, `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": "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`)"
}
],
"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, \"8a267f8f3cb9ef409377dbdb7cb706d4\")"
]
}
}

+ 4
- 0
app/src/main/java/eu/faircode/email/AdapterFolder.java View File

@ -54,6 +54,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
TextView tvName;
TextView tvMessages;
TextView tvType;
ImageView ivUnified;
TextView tvAfter;
ImageView ivSync;
ImageView ivState;
@ -67,6 +68,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
tvName = itemView.findViewById(R.id.tvName);
tvMessages = itemView.findViewById(R.id.tvMessages);
tvType = itemView.findViewById(R.id.tvType);
ivUnified = itemView.findViewById(R.id.ivUnified);
tvAfter = itemView.findViewById(R.id.tvAfter);
ivSync = itemView.findViewById(R.id.ivSync);
tvError = itemView.findViewById(R.id.tvError);
@ -106,6 +108,8 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
context.getPackageName());
tvType.setText(resid > 0 ? context.getString(resid) : folder.type);
ivUnified.setVisibility(folder.unified ? View.VISIBLE : View.GONE);
tvAfter.setText(Integer.toString(folder.after));
ivSync.setVisibility(folder.synchronize ? View.VISIBLE : View.INVISIBLE);


+ 10
- 1
app/src/main/java/eu/faircode/email/DB.java View File

@ -45,7 +45,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 9,
version = 10,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -175,6 +175,15 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `message` ADD COLUMN `headers` TEXT");
}
})
.addMigrations(new Migration(9, 10) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `folder` ADD COLUMN `unified` INTEGER NOT NULL DEFAULT 0");
db.execSQL("CREATE INDEX `index_folder_unified` ON `folder` (`unified`)");
db.execSQL("UPDATE `folder` SET unified = 1 WHERE type = '" + EntityFolder.INBOX + "'");
}
})
.build();
}


+ 3
- 3
app/src/main/java/eu/faircode/email/DaoFolder.java View File

@ -61,7 +61,7 @@ public interface DaoFolder {
" JOIN account ON account.id = folder.account" +
" JOIN message ON message.folder = folder.id AND NOT message.ui_hide" +
" WHERE account.`synchronize`" +
" AND folder.type = '" + EntityFolder.INBOX + "'" +
" AND folder.unified" +
" GROUP BY folder.id")
LiveData<List<TupleFolderEx>> liveUnified();
@ -114,8 +114,8 @@ public interface DaoFolder {
" AND type = :type")
int setFolderUser(long account, String type);
@Query("UPDATE folder SET synchronize = :synchronize, after = :after WHERE id = :id")
int setFolderProperties(long id, boolean synchronize, int after);
@Query("UPDATE folder SET synchronize = :synchronize, unified = :unified, after = :after WHERE id = :id")
int setFolderProperties(long id, boolean synchronize, boolean unified, int after);
@Query("DELETE FROM folder WHERE account= :account AND name = :name")
void deleteFolder(Long account, String name);


+ 3
- 3
app/src/main/java/eu/faircode/email/DaoMessage.java View File

@ -39,14 +39,14 @@ public interface DaoMessage {
", COUNT(message.id) as count" +
", SUM(CASE WHEN message.ui_seen THEN 0 ELSE 1 END) as unseen" +
", (SELECT COUNT(a.id) FROM attachment a WHERE a.message = message.id) AS attachments" +
", MAX(CASE WHEN folder.type = '" + EntityFolder.INBOX + "' THEN message.id ELSE 0 END) as dummy" +
", MAX(CASE WHEN folder.unified THEN message.id ELSE 0 END) as dummy" +
" FROM message" +
" JOIN account ON account.id = message.account" +
" JOIN folder ON folder.id = message.folder" +
" WHERE account.`synchronize`" +
" AND (NOT message.ui_hide OR :debug)" +
" GROUP BY CASE WHEN message.thread IS NULL THEN message.id ELSE message.thread END" +
" HAVING SUM(CASE WHEN folder.type = '" + EntityFolder.INBOX + "' THEN 1 ELSE 0 END) > 0" +
" HAVING SUM(unified) > 0" +
" ORDER BY message.received DESC")
DataSource.Factory<Integer, TupleMessageEx> pagedUnifiedInbox(boolean debug);
@ -127,7 +127,7 @@ public interface DaoMessage {
" JOIN account ON account.id = message.account" +
" JOIN folder ON folder.id = message.folder" +
" WHERE account.`synchronize`" +
" AND folder.type = '" + EntityFolder.INBOX + "'" +
" AND folder.unified" +
" AND NOT message.ui_seen AND NOT message.ui_hide" +
" AND (account.seen_until IS NULL OR message.stored > account.seen_until)" +
" ORDER BY message.received")


+ 5
- 1
app/src/main/java/eu/faircode/email/EntityFolder.java View File

@ -42,9 +42,11 @@ import static androidx.room.ForeignKey.CASCADE;
@Index(value = {"account", "name"}, unique = true),
@Index(value = {"account"}),
@Index(value = {"name"}),
@Index(value = {"type"})
@Index(value = {"type"}),
@Index(value = {"unified"})
}
)
public class EntityFolder implements Parcelable {
static final String TABLE_NAME = "folder";
@ -56,6 +58,8 @@ public class EntityFolder implements Parcelable {
@NonNull
public String type;
@NonNull
public Boolean unified = false;
@NonNull
public Boolean synchronize;
@NonNull
public Integer after; // days


+ 1
- 0
app/src/main/java/eu/faircode/email/FragmentAccount.java View File

@ -556,6 +556,7 @@ public class FragmentAccount extends FragmentEx {
inbox.name = "INBOX";
inbox.type = EntityFolder.INBOX;
inbox.synchronize = true;
inbox.unified = true;
inbox.after = EntityFolder.DEFAULT_INBOX_SYNC;
folders.add(inbox);


+ 6
- 1
app/src/main/java/eu/faircode/email/FragmentFolder.java View File

@ -38,6 +38,7 @@ import androidx.lifecycle.Observer;
public class FragmentFolder extends FragmentEx {
private ViewGroup view;
private CheckBox cbSynchronize;
private CheckBox cbUnified;
private EditText etAfter;
private Button btnSave;
private ProgressBar pbSave;
@ -63,6 +64,7 @@ public class FragmentFolder extends FragmentEx {
// Get controls
cbSynchronize = view.findViewById(R.id.cbSynchronize);
cbUnified = view.findViewById(R.id.cbUnified);
etAfter = view.findViewById(R.id.etAfter);
pbSave = view.findViewById(R.id.pbSave);
btnSave = view.findViewById(R.id.btnSave);
@ -78,6 +80,7 @@ public class FragmentFolder extends FragmentEx {
Bundle args = new Bundle();
args.putLong("id", id);
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("unified", cbUnified.isChecked());
args.putString("after", etAfter.getText().toString());
new SimpleTask<Void>() {
@ -85,6 +88,7 @@ public class FragmentFolder extends FragmentEx {
protected Void onLoad(Context context, Bundle args) {
long id = args.getLong("id");
boolean synchronize = args.getBoolean("synchronize");
boolean unified = args.getBoolean("unified");
String after = args.getString("after");
int days = (TextUtils.isEmpty(after) ? 7 : Integer.parseInt(after));
@ -92,7 +96,7 @@ public class FragmentFolder extends FragmentEx {
try {
db.beginTransaction();
db.folder().setFolderProperties(id, synchronize, days);
db.folder().setFolderProperties(id, synchronize, unified, days);
if (!synchronize)
db.folder().setFolderError(id, null);
@ -157,6 +161,7 @@ public class FragmentFolder extends FragmentEx {
once = true;
cbSynchronize.setChecked(folder.synchronize);
cbUnified.setChecked(folder.unified);
etAfter.setText(Integer.toString(folder.after));
}


+ 10
- 0
app/src/main/res/drawable/baseline_folder_special_24.xml View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M20,6h-8l-2,-2L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,8c0,-1.1 -0.9,-2 -2,-2zM17.94,17L15,15.28 12.06,17l0.78,-3.33 -2.59,-2.24 3.41,-0.29L15,8l1.34,3.14 3.41,0.29 -2.59,2.24 0.78,3.33z"/>
</vector>

+ 10
- 1
app/src/main/res/layout/fragment_folder.xml View File

@ -22,6 +22,15 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<CheckBox
android:id="@+id/cbUnified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_unified_folder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
<!-- after -->
<TextView
@ -32,7 +41,7 @@
android:text="@string/title_after"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
app:layout_constraintTop_toBottomOf="@id/cbUnified" />
<EditText
android:id="@+id/etAfter"


+ 21
- 1
app/src/main/res/layout/fragment_legend.xml View File

@ -108,6 +108,26 @@
app:layout_constraintStart_toEndOf="@id/ivPrimary"
app:layout_constraintTop_toTopOf="@id/ivPrimary" />
<ImageView
android:id="@+id/ivUnified"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginTop="12dp"
android:src="@drawable/baseline_folder_special_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivPrimary" />
<TextView
android:id="@+id/tvUnified"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="18dp"
android:text="@string/title_legend_unified"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintBottom_toBottomOf="@id/ivUnified"
app:layout_constraintStart_toEndOf="@id/ivUnified"
app:layout_constraintTop_toTopOf="@id/ivUnified" />
<ImageView
android:id="@+id/ivDisconnected"
android:layout_width="24dp"
@ -115,7 +135,7 @@
android:layout_marginTop="12dp"
android:src="@drawable/baseline_cloud_off_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivPrimary" />
app:layout_constraintTop_toBottomOf="@id/ivUnified" />
<TextView
android:id="@+id/tvDisconnected"


+ 11
- 0
app/src/main/res/layout/item_folder.xml View File

@ -9,6 +9,7 @@
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="6dp"
android:background="?attr/colorButtonNormal"
android:src="@drawable/baseline_edit_24"
app:layout_constraintBottom_toBottomOf="@+id/ivMessages"
app:layout_constraintStart_toStartOf="parent"
@ -70,6 +71,16 @@
app:layout_constraintStart_toEndOf="@+id/ivState"
app:layout_constraintTop_toTopOf="@id/ivState" />
<ImageView
android:id="@+id/ivUnified"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="6dp"
android:src="@drawable/baseline_folder_special_24"
app:layout_constraintBottom_toBottomOf="@id/ivState"
app:layout_constraintStart_toEndOf="@id/tvType"
app:layout_constraintTop_toTopOf="@id/ivState" />
<TextView
android:id="@+id/tvAfter"
android:layout_width="wrap_content"


+ 2
- 0
app/src/main/res/values/strings.xml View File

@ -117,6 +117,7 @@
<string name="title_folder_unseen" translatable="false">%1$s (%2$d)</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>
<string name="title_folder_unified">Unified inbox</string>
@ -197,6 +198,7 @@
<string name="title_legend_thread">Conversation</string>
<string name="title_legend_synchronize">Synchronize</string>
<string name="title_legend_primary">Primary</string>
<string name="title_legend_unified">Unified inbox</string>
<string name="title_legend_disconnected">Disconnected</string>
<string name="title_legend_connecting">Connecting</string>
<string name="title_legend_connected">Connected</string>


Loading…
Cancel
Save