Apply account color to nav folders

pull/169/head
M66B 5 years ago
parent aa87f3e9a3
commit b661e1fc1c

@ -43,7 +43,6 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.ViewHolder> {
private Context context;
@ -106,10 +105,10 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
? R.drawable.baseline_folder_24
: R.drawable.baseline_folder_open_24);
if (folder.color == null || !ActivityBilling.isPro(context))
if (folder.accountColor == null || !ActivityBilling.isPro(context))
ivItem.clearColorFilter();
else
ivItem.setColorFilter(folder.color);
ivItem.setColorFilter(folder.accountColor);
}
int count;
@ -235,17 +234,7 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
TupleFolderNav f1 = prev.get(oldItemPosition);
TupleFolderNav f2 = next.get(newItemPosition);
return (f1.name.equals(f2.name) &&
f1.type.equals(f2.type) &&
Objects.equals(f1.display, f2.display) &&
Objects.equals(f1.state, f2.state) &&
Objects.equals(f1.sync_state, f2.sync_state) &&
Objects.equals(f1.last_sync, f2.last_sync) &&
f1.messages == f2.messages &&
f1.unseen == f2.unseen &&
f1.snoozed == f2.snoozed &&
f1.operations == f2.operations &&
f1.executing == f2.executing);
return f1.equals(f2);
}
}

@ -110,7 +110,7 @@ public interface DaoFolder {
LiveData<List<TupleFolderEx>> liveUnified(String type);
@Query("SELECT folder.*" +
", account.`order` AS accountOrder, account.name AS accountName" +
", account.`order` AS accountOrder, account.name AS accountName, COALESCE(folder.color, account.color) AS accountColor" +
", COUNT(message.id) AS messages" +
", SUM(CASE WHEN NOT message.ui_seen THEN 1 ELSE 0 END) AS unseen" +
", SUM(CASE WHEN message.ui_snoozed IS NULL THEN 0 ELSE 1 END) AS snoozed" +

@ -66,6 +66,7 @@ public class TupleFolderEx extends EntityFolder implements Serializable {
TupleFolderEx other = (TupleFolderEx) obj;
return (super.equals(obj) &&
Objects.equals(this.accountId, other.accountId) &&
Objects.equals(this.accountOrder, other.accountOrder) &&
Objects.equals(this.accountProtocol, other.accountProtocol) &&
Objects.equals(this.accountName, other.accountName) &&
Objects.equals(this.accountState, other.accountState) &&

@ -25,10 +25,12 @@ import java.io.Serializable;
import java.text.Collator;
import java.util.Comparator;
import java.util.Locale;
import java.util.Objects;
public class TupleFolderNav extends EntityFolder implements Serializable {
public Integer accountOrder;
public String accountName;
public Integer accountColor;
public int messages;
public int unseen;
public int snoozed;
@ -76,4 +78,21 @@ public class TupleFolderNav extends EntityFolder implements Serializable {
}
};
}
@Override
public boolean equals(Object obj) {
if (obj instanceof TupleFolderNav) {
TupleFolderNav other = (TupleFolderNav) obj;
return (super.equals(other) &&
Objects.equals(this.accountOrder, other.accountOrder) &&
Objects.equals(this.accountName, other.accountName) &&
Objects.equals(this.accountColor, other.accountColor) &&
this.messages == other.messages &&
this.unseen == other.unseen &&
this.snoozed == other.snoozed &&
this.operations == other.operations &&
this.executing == other.executing);
} else
return false;
}
}

Loading…
Cancel
Save