Added account warning about no identities

This commit is contained in:
M66B 2019-04-27 11:37:10 +02:00
parent ccd1e532fd
commit cf55c8984b
5 changed files with 26 additions and 1 deletions

View File

@ -70,6 +70,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
private ImageView ivState;
private TextView tvHost;
private TextView tvLast;
private TextView tvIdentity;
private TextView tvDrafts;
private TextView tvWarning;
private TextView tvError;
@ -88,6 +89,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
ivState = itemView.findViewById(R.id.ivState);
tvHost = itemView.findViewById(R.id.tvHost);
tvLast = itemView.findViewById(R.id.tvLast);
tvIdentity = itemView.findViewById(R.id.tvIdentity);
tvDrafts = itemView.findViewById(R.id.tvDrafts);
tvWarning = itemView.findViewById(R.id.tvWarning);
tvError = itemView.findViewById(R.id.tvError);
@ -139,6 +141,7 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
tvLast.setText(context.getString(R.string.title_last_connected,
account.last_connected == null ? "-" : df.format(account.last_connected)));
tvIdentity.setVisibility(account.identities > 0 || !settings ? View.GONE : View.VISIBLE);
tvDrafts.setVisibility(account.drafts || !settings ? View.GONE : View.VISIBLE);
tvWarning.setText(account.warning);

View File

@ -52,6 +52,10 @@ public interface DaoAccount {
" AND folder.type <> '" + EntityFolder.OUTBOX + "'" +
" AND NOT ui_seen" +
" AND NOT ui_hide) AS unseen" +
", (SELECT COUNT(identity.id)" +
" FROM identity" +
" WHERE identity.account = account.id" +
" AND identity.synchronize) AS identities" +
", (SELECT COUNT(message.id)" +
" FROM message" +
" JOIN folder ON folder.id = message.folder" +

View File

@ -23,6 +23,7 @@ public class TupleAccountEx extends EntityAccount {
public int unseen;
public int unsent;
public int operations;
public int identities; // synchronizing
public boolean drafts;
public boolean uiEquals(Object obj) {
@ -30,6 +31,7 @@ public class TupleAccountEx extends EntityAccount {
TupleAccountEx other = (TupleAccountEx) obj;
return (super.equals(obj) &&
this.unseen == other.unseen &&
this.identities == other.identities &&
this.drafts == other.drafts);
} else
return false;
@ -43,6 +45,7 @@ public class TupleAccountEx extends EntityAccount {
this.unseen == other.unseen &&
this.unsent == other.unsent &&
this.operations == other.operations &&
this.identities == other.identities &&
this.drafts == other.drafts);
} else
return false;

View File

@ -130,6 +130,20 @@
app:layout_constraintStart_toEndOf="@+id/ivState"
app:layout_constraintTop_toBottomOf="@id/tvHost" />
<TextView
android:id="@+id/tvIdentity"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="@string/title_identity_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
android:id="@+id/tvDrafts"
android:layout_width="0dp"
@ -142,7 +156,7 @@
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/vwColor"
app:layout_constraintTop_toBottomOf="@id/tvLast" />
app:layout_constraintTop_toBottomOf="@id/tvIdentity" />
<TextView
android:id="@+id/tvWarning"

View File

@ -292,6 +292,7 @@
<string name="title_no_utf8">This provider does not support UTF-8</string>
<string name="title_no_sync">Synchronization errors since %1$s</string>
<string name="title_sync_errors">Synchronizing some folders failed</string>
<string name="title_identity_required">An identity is required to send messages</string>
<string name="title_drafts_required">A drafts folder is required to send messages</string>
<string name="title_account_delete">Delete this account permanently?</string>
<string name="title_identity_delete">Delete this identity permanently?</string>