Revert "Removed drafts warning from identities"

This reverts commit 1dee158194.
This commit is contained in:
M66B 2020-08-21 07:42:45 +02:00
parent 352f757ede
commit fba7599c8c
4 changed files with 26 additions and 6 deletions

View File

@ -80,6 +80,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
private TextView tvSignKeyId;
private TextView tvLast;
private TextView tvMaxSize;
private TextView tvDrafts;
private TextView tvError;
private TwoStateOwner powner = new TwoStateOwner(owner, "IdentityPopup");
@ -101,6 +102,7 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
tvSignKeyId = itemView.findViewById(R.id.tvSignKeyId);
tvLast = itemView.findViewById(R.id.tvLast);
tvMaxSize = itemView.findViewById(R.id.tvMaxSize);
tvDrafts = itemView.findViewById(R.id.tvDrafts);
tvError = itemView.findViewById(R.id.tvError);
}
@ -165,6 +167,8 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
tvMaxSize.setText(identity.max_size == null ? null : Helper.humanReadableByteCount(identity.max_size));
tvMaxSize.setVisibility(identity.max_size == null ? View.GONE : View.VISIBLE);
tvDrafts.setVisibility(identity.drafts == null ? View.VISIBLE : View.GONE);
tvError.setText(identity.error);
tvError.setVisibility(identity.error == null ? View.GONE : View.VISIBLE);
}

View File

@ -32,12 +32,13 @@ public interface DaoIdentity {
@Query(TupleIdentityView.query)
LiveData<List<TupleIdentityView>> liveIdentityView();
@Query("SELECT identity.*, account.name AS accountName" +
@Query("SELECT identity.*, account.name AS accountName, folder.id AS drafts" +
" FROM identity" +
" JOIN account ON account.id = identity.account")
" JOIN account ON account.id = identity.account" +
" LEFT JOIN folder ON folder.account = account.id AND folder.type = '" + EntityFolder.DRAFTS + "'")
LiveData<List<TupleIdentityEx>> liveIdentities();
@Query("SELECT identity.*, account.name AS accountName" +
@Query("SELECT identity.*, account.name AS accountName, folder.id AS drafts" +
" FROM identity" +
" JOIN account ON account.id = identity.account" +
" JOIN folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" +
@ -45,7 +46,7 @@ public interface DaoIdentity {
" AND account.synchronize")
LiveData<List<TupleIdentityEx>> liveComposableIdentities();
@Query("SELECT identity.*, account.name AS accountName" +
@Query("SELECT identity.*, account.name AS accountName, folder.id AS drafts" +
" FROM identity" +
" JOIN account ON account.id = identity.account" +
" JOIN folder ON folder.account = identity.account AND folder.type = '" + EntityFolder.DRAFTS + "'" +

View File

@ -23,13 +23,15 @@ import java.util.Objects;
public class TupleIdentityEx extends EntityIdentity {
public String accountName;
public Long drafts;
@Override
public boolean equals(Object obj) {
if (obj instanceof TupleIdentityEx) {
TupleIdentityEx other = (TupleIdentityEx) obj;
return (super.equals(obj) &&
Objects.equals(accountName, other.accountName));
Objects.equals(accountName, other.accountName) &&
Objects.equals(drafts, other.drafts));
} else
return false;
}

View File

@ -178,6 +178,19 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/tvLast" />
<eu.faircode.email.FixedTextView
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"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/vwColor"
app:layout_constraintTop_toBottomOf="@id/tvLast" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvError"
android:layout_width="0dp"
@ -190,7 +203,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/tvDrafts" />
<View
android:id="@+id/marginBottom"