Card layout for EML

pull/199/head
M66B 4 years ago
parent 80512c7d5f
commit 94ef34cb97

@ -24,6 +24,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.Uri;
import android.os.Bundle;
import android.text.Spannable;
@ -33,6 +34,7 @@ import android.text.TextUtils;
import android.text.method.ArrowKeyMovementMethod;
import android.text.style.ForegroundColorSpan;
import android.text.style.URLSpan;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
@ -46,6 +48,8 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat;
import androidx.preference.PreferenceManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -98,7 +102,9 @@ public class ActivityEML extends ActivityBase {
super.onCreate(savedInstanceState);
getSupportActionBar().setSubtitle("EML");
setContentView(R.layout.activity_eml);
View view = LayoutInflater.from(this).inflate(R.layout.activity_eml, null);
setContentView(view);
tvFrom = findViewById(R.id.tvFrom);
tvTo = findViewById(R.id.tvTo);
@ -154,6 +160,15 @@ public class ActivityEML extends ActivityBase {
}
});
// Initialize
if (!Helper.isDarkTheme(this)) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean beige = prefs.getBoolean("beige", true);
view.setBackgroundColor(ContextCompat.getColor(this, beige
? R.color.lightColorBackground_cards_beige
: R.color.lightColorBackground_cards));
}
vSeparatorAttachments.setVisibility(View.GONE);
grpReady.setVisibility(View.GONE);

@ -9,6 +9,9 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingHorizontal="6dp"
android:paddingVertical="12dp"
android:scrollbarStyle="outsideOverlay"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
@ -21,268 +24,281 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:drawableStart="@drawable/twotone_info_24"
android:drawablePadding="6dp"
android:text="@string/title_hint_eml"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:id="@+id/vSeparatorHeader"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="3dp"
android:background="?attr/colorSeparator"
<androidx.cardview.widget.CardView
android:id="@+id/cardMessage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="3dp"
android:layout_marginTop="12dp"
app:cardBackgroundColor="?attr/colorCardBackground"
app:cardCornerRadius="6dp"
app:cardElevation="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvHint" />
app:layout_constraintTop_toBottomOf="@id/tvHint">
<eu.faircode.email.FixedTextView
android:id="@+id/tvFromTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_from"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHeader" />
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="6dp"
android:paddingVertical="12dp">
<eu.faircode.email.FixedTextView
android:id="@+id/tvFrom"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="From"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvFromTitle"
app:layout_constraintTop_toBottomOf="@id/vSeparatorHeader" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvFromTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_from"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvToTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_to"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvFrom" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvFrom"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="From"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvFromTitle"
app:layout_constraintTop_toTopOf="parent" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvTo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="To"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvToTitle"
app:layout_constraintTop_toBottomOf="@id/tvFrom" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvToTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_to"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvFrom" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvReplyToTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_reply_to"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTo" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvTo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="To"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvToTitle"
app:layout_constraintTop_toBottomOf="@id/tvFrom" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvReplyTo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Reply to"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvReplyToTitle"
app:layout_constraintTop_toBottomOf="@id/tvTo" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvReplyToTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_reply_to"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvTo" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCcTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_cc"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReplyTo" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvReplyTo"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Reply to"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvReplyToTitle"
app:layout_constraintTop_toBottomOf="@id/tvTo" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="CC"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvCcTitle"
app:layout_constraintTop_toBottomOf="@id/tvReplyTo" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCcTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_cc"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReplyTo" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBccTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_bcc"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCc" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvCc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="CC"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvCcTitle"
app:layout_constraintTop_toBottomOf="@id/tvReplyTo" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBcc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="BCC"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvBccTitle"
app:layout_constraintTop_toBottomOf="@id/tvCc" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBccTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_bcc"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCc" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSentTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_sent"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBcc" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBcc"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="BCC"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvBccTitle"
app:layout_constraintTop_toBottomOf="@id/tvCc" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Sent"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvSentTitle"
app:layout_constraintTop_toBottomOf="@id/tvBcc" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSentTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_sent"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBcc" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvReceivedTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_received"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSent" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Sent"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvSentTitle"
app:layout_constraintTop_toBottomOf="@id/tvBcc" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvReceived"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Received"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvReceivedTitle"
app:layout_constraintTop_toBottomOf="@id/tvSent" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvReceivedTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_received"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSent" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSubject"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Subject"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReceived" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvReceived"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:text="Received"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@id/tvReceivedTitle"
app:layout_constraintTop_toBottomOf="@id/tvSent" />
<View
android:id="@+id/vSeparatorAttachments"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="3dp"
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubject" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvSubject"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Subject"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
android:textStyle="italic"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvReceived" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvAttachment"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vSeparatorAttachments" />
<View
android:id="@+id/vSeparatorAttachments"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="3dp"
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSubject" />
<View
android:id="@+id/vSeparatorBody"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="3dp"
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rvAttachment" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rvAttachment"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/vSeparatorAttachments" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBody"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="Body"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorBody" />
<View
android:id="@+id/vSeparatorBody"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="3dp"
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/rvAttachment" />
<View
android:id="@+id/vSeparatorStructure"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="3dp"
android:background="?attr/colorSeparator"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBody" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvBody"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="Body"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorBody" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvStructure"
android:layout_width="0dp"
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cardStructure"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:fontFamily="monospace"
android:text="Structure"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
android:layout_marginHorizontal="3dp"
android:layout_marginTop="12dp"
app:cardBackgroundColor="?attr/colorCardBackground"
app:cardCornerRadius="6dp"
app:cardElevation="0dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/vSeparatorStructure" />
app:layout_constraintTop_toBottomOf="@id/cardMessage">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="6dp"
android:paddingVertical="12dp">
<eu.faircode.email.FixedTextView
android:id="@+id/tvStructure"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:fontFamily="monospace"
android:text="Structure"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.constraintlayout.widget.Group
android:id="@+id/grpReady"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="
vSeparatorHeader,
tvFromTitle,tvFrom,
tvToTitle,tvTo,
tvReplyToTitle,tvReplyTo,
tvCcTitle,tvCc,
tvBccTitle,tvBcc,
tvSentTitle,tvSent,
tvReceivedTitle,tvReceived,
tvSubject,
rvAttachment,
vSeparatorBody,tvBody,
vSeparatorStructure,tvStructure" />
app:constraint_referenced_ids="cardMessage,cardStructure" />
</androidx.constraintlayout.widget.ConstraintLayout>
</eu.faircode.email.ScrollViewEx>

Loading…
Cancel
Save