mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-03 19:34:15 +01:00
Show when folder is executing operations
This commit is contained in:
@@ -201,7 +201,9 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
||||
vwColor.setVisibility(account < 0 ? View.VISIBLE : View.GONE);
|
||||
|
||||
if (folder.sync_state == null || "requested".equals(folder.sync_state)) {
|
||||
if ("waiting".equals(folder.state))
|
||||
if (folder.executing > 0)
|
||||
ivState.setImageResource(R.drawable.baseline_list_24);
|
||||
else if ("waiting".equals(folder.state))
|
||||
ivState.setImageResource(R.drawable.baseline_hourglass_empty_24);
|
||||
else if ("connected".equals(folder.state))
|
||||
ivState.setImageResource(R.drawable.baseline_cloud_24);
|
||||
|
||||
@@ -85,6 +85,8 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
||||
ivItem.setImageResource(R.drawable.baseline_compare_arrows_24);
|
||||
else if ("downloading".equals(folder.sync_state))
|
||||
ivItem.setImageResource(R.drawable.baseline_cloud_download_24);
|
||||
else if (folder.executing > 0)
|
||||
ivItem.setImageResource(R.drawable.baseline_list_24);
|
||||
else
|
||||
ivItem.setImageResource("connected".equals(folder.state)
|
||||
? R.drawable.baseline_folder_24
|
||||
@@ -206,7 +208,8 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
||||
Objects.equals(f1.state, f2.state) &&
|
||||
Objects.equals(f1.sync_state, f2.sync_state) &&
|
||||
f1.unseen == f2.unseen &&
|
||||
f1.operations == f2.operations);
|
||||
f1.operations == f2.operations &&
|
||||
f1.executing == f2.executing);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
|
||||
// https://developer.android.com/topic/libraries/architecture/room.html
|
||||
|
||||
@Database(
|
||||
version = 81,
|
||||
version = 82,
|
||||
entities = {
|
||||
EntityIdentity.class,
|
||||
EntityAccount.class,
|
||||
@@ -816,6 +816,14 @@ public abstract class DB extends RoomDatabase {
|
||||
db.execSQL("ALTER TABLE `operation` ADD COLUMN `state` TEXT");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(81, 82) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i("DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("CREATE INDEX `index_operation_account` ON `operation` (`account`)");
|
||||
db.execSQL("CREATE INDEX `index_operation_state` ON `operation` (`state`)");
|
||||
}
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ public interface DaoFolder {
|
||||
", COUNT(message.id) AS messages" +
|
||||
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
||||
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
||||
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id AND operation.state = 'executing') AS executing" +
|
||||
", (SELECT COUNT(child.id) FROM folder child WHERE child.parent = folder.id) AS childs" +
|
||||
" FROM folder" +
|
||||
" LEFT JOIN account ON account.id = folder.account" +
|
||||
@@ -80,6 +81,7 @@ public interface DaoFolder {
|
||||
", COUNT(message.id) AS messages" +
|
||||
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
||||
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
||||
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id AND operation.state = 'executing') AS executing" +
|
||||
", (SELECT COUNT(child.id) FROM folder child WHERE child.parent = folder.id) AS childs" +
|
||||
" FROM folder" +
|
||||
" JOIN account ON account.id = folder.account" +
|
||||
@@ -92,7 +94,8 @@ public interface DaoFolder {
|
||||
@Query("SELECT folder.*" +
|
||||
", account.`order` AS accountOrder, account.name AS accountName, account.color AS accountColor" +
|
||||
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
||||
", (SELECT COUNT(*) FROM operation WHERE operation.folder = folder.id) AS operations" +
|
||||
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id) AS operations" +
|
||||
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id AND operation.state = 'executing') AS executing" +
|
||||
" FROM folder" +
|
||||
" LEFT JOIN account ON account.id = folder.account" +
|
||||
" LEFT JOIN message ON message.folder = folder.id AND NOT message.ui_hide" +
|
||||
@@ -118,6 +121,7 @@ public interface DaoFolder {
|
||||
", COUNT(message.id) AS messages" +
|
||||
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
||||
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
||||
", (SELECT COUNT(operation.id) FROM operation WHERE operation.folder = folder.id AND operation.state = 'executing') AS executing" +
|
||||
", (SELECT COUNT(child.id) FROM folder child WHERE child.parent = folder.id) AS childs" +
|
||||
" FROM folder" +
|
||||
" LEFT JOIN account ON account.id = folder.account" +
|
||||
|
||||
@@ -47,9 +47,11 @@ import static androidx.room.ForeignKey.CASCADE;
|
||||
@ForeignKey(childColumns = "message", entity = EntityMessage.class, parentColumns = "id", onDelete = CASCADE)
|
||||
},
|
||||
indices = {
|
||||
@Index(value = {"account"}),
|
||||
@Index(value = {"folder"}),
|
||||
@Index(value = {"message"}),
|
||||
@Index(value = {"name"})
|
||||
@Index(value = {"name"}),
|
||||
@Index(value = {"state"})
|
||||
}
|
||||
)
|
||||
public class EntityOperation {
|
||||
|
||||
@@ -35,6 +35,7 @@ public class TupleFolderEx extends EntityFolder implements Serializable {
|
||||
public int messages;
|
||||
public int content;
|
||||
public int unseen;
|
||||
public int executing;
|
||||
public int childs;
|
||||
|
||||
@Override
|
||||
@@ -48,6 +49,7 @@ public class TupleFolderEx extends EntityFolder implements Serializable {
|
||||
this.messages == other.messages &&
|
||||
this.content == other.content &&
|
||||
this.unseen == other.unseen &&
|
||||
this.executing == other.executing &&
|
||||
this.childs == other.childs);
|
||||
} else
|
||||
return false;
|
||||
|
||||
@@ -32,6 +32,7 @@ public class TupleFolderNav extends EntityFolder implements Serializable {
|
||||
public Integer accountColor;
|
||||
public int unseen;
|
||||
public int operations;
|
||||
public int executing;
|
||||
|
||||
@Override
|
||||
Comparator getComparator(final Context context) {
|
||||
|
||||
Reference in New Issue
Block a user