mirror of https://github.com/M66B/FairEmail.git
Added account warning when no drafts folder
This commit is contained in:
parent
3acb07b916
commit
b244c419b2
|
@ -70,6 +70,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
||||||
private ImageView ivState;
|
private ImageView ivState;
|
||||||
private TextView tvHost;
|
private TextView tvHost;
|
||||||
private TextView tvLast;
|
private TextView tvLast;
|
||||||
|
private TextView tvDrafts;
|
||||||
private TextView tvWarning;
|
private TextView tvWarning;
|
||||||
private TextView tvError;
|
private TextView tvError;
|
||||||
private Group grpSettings;
|
private Group grpSettings;
|
||||||
|
@ -87,6 +88,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
||||||
ivState = itemView.findViewById(R.id.ivState);
|
ivState = itemView.findViewById(R.id.ivState);
|
||||||
tvHost = itemView.findViewById(R.id.tvHost);
|
tvHost = itemView.findViewById(R.id.tvHost);
|
||||||
tvLast = itemView.findViewById(R.id.tvLast);
|
tvLast = itemView.findViewById(R.id.tvLast);
|
||||||
|
tvDrafts = itemView.findViewById(R.id.tvDrafts);
|
||||||
tvWarning = itemView.findViewById(R.id.tvWarning);
|
tvWarning = itemView.findViewById(R.id.tvWarning);
|
||||||
tvError = itemView.findViewById(R.id.tvError);
|
tvError = itemView.findViewById(R.id.tvError);
|
||||||
grpSettings = itemView.findViewById(R.id.grpSettings);
|
grpSettings = itemView.findViewById(R.id.grpSettings);
|
||||||
|
@ -137,6 +139,8 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
|
||||||
tvLast.setText(context.getString(R.string.title_last_connected,
|
tvLast.setText(context.getString(R.string.title_last_connected,
|
||||||
account.last_connected == null ? "-" : df.format(account.last_connected)));
|
account.last_connected == null ? "-" : df.format(account.last_connected)));
|
||||||
|
|
||||||
|
tvDrafts.setVisibility(account.drafts || !settings ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
tvWarning.setText(account.warning);
|
tvWarning.setText(account.warning);
|
||||||
tvWarning.setVisibility(account.warning == null || !settings ? View.GONE : View.VISIBLE);
|
tvWarning.setVisibility(account.warning == null || !settings ? View.GONE : View.VISIBLE);
|
||||||
|
|
||||||
|
|
|
@ -59,8 +59,10 @@ public interface DaoAccount {
|
||||||
" AND folder.type = '" + EntityFolder.OUTBOX + "'" +
|
" AND folder.type = '" + EntityFolder.OUTBOX + "'" +
|
||||||
" AND NOT ui_seen" +
|
" AND NOT ui_seen" +
|
||||||
" AND NOT ui_hide) AS unsent" +
|
" AND NOT ui_hide) AS unsent" +
|
||||||
|
", CASE WHEN drafts.id IS NULL THEN 0 ELSE 1 END AS drafts" +
|
||||||
" FROM account" +
|
" FROM account" +
|
||||||
" LEFT JOIN operation ON operation.account = account.id" +
|
" LEFT JOIN operation ON operation.account = account.id" +
|
||||||
|
" LEFT JOIN folder AS drafts ON drafts.account = account.id AND drafts.type = '" + EntityFolder.DRAFTS + "'" +
|
||||||
" WHERE :all OR account.synchronize" +
|
" WHERE :all OR account.synchronize" +
|
||||||
" GROUP BY account.id")
|
" GROUP BY account.id")
|
||||||
LiveData<List<TupleAccountEx>> liveAccountsEx(boolean all);
|
LiveData<List<TupleAccountEx>> liveAccountsEx(boolean all);
|
||||||
|
|
|
@ -23,12 +23,14 @@ public class TupleAccountEx extends EntityAccount {
|
||||||
public int unseen;
|
public int unseen;
|
||||||
public int unsent;
|
public int unsent;
|
||||||
public int operations;
|
public int operations;
|
||||||
|
public boolean drafts;
|
||||||
|
|
||||||
public boolean uiEquals(Object obj) {
|
public boolean uiEquals(Object obj) {
|
||||||
if (obj instanceof TupleAccountEx) {
|
if (obj instanceof TupleAccountEx) {
|
||||||
TupleAccountEx other = (TupleAccountEx) obj;
|
TupleAccountEx other = (TupleAccountEx) obj;
|
||||||
return (super.equals(obj) &&
|
return (super.equals(obj) &&
|
||||||
this.unseen == other.unseen);
|
this.unseen == other.unseen &&
|
||||||
|
this.drafts == other.drafts);
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +42,8 @@ public class TupleAccountEx extends EntityAccount {
|
||||||
return (super.equals(obj) &&
|
return (super.equals(obj) &&
|
||||||
this.unseen == other.unseen &&
|
this.unseen == other.unseen &&
|
||||||
this.unsent == other.unsent &&
|
this.unsent == other.unsent &&
|
||||||
this.operations == other.operations);
|
this.operations == other.operations &&
|
||||||
|
this.drafts == other.drafts);
|
||||||
} else
|
} else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,20 @@
|
||||||
app:layout_constraintStart_toEndOf="@+id/ivState"
|
app:layout_constraintStart_toEndOf="@+id/ivState"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvHost" />
|
app:layout_constraintTop_toBottomOf="@id/tvHost" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvDrafts"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:layout_marginEnd="6dp"
|
||||||
|
android:text="@string/title_drafts_required"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
|
android:textColor="?attr/colorWarning"
|
||||||
|
android:textIsSelectable="true"
|
||||||
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/vwColor"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/tvLast" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvWarning"
|
android:id="@+id/tvWarning"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -138,7 +152,7 @@
|
||||||
android:textIsSelectable="true"
|
android:textIsSelectable="true"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toEndOf="@id/vwColor"
|
app:layout_constraintStart_toEndOf="@id/vwColor"
|
||||||
app:layout_constraintTop_toBottomOf="@id/tvLast" />
|
app:layout_constraintTop_toBottomOf="@id/tvDrafts" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tvError"
|
android:id="@+id/tvError"
|
||||||
|
|
Loading…
Reference in New Issue