Show headers in EML viewer

pull/194/merge
M66B 3 years ago
parent 2b1c50c73a
commit 220eb6dfda

@ -47,6 +47,7 @@ import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AlertDialog;
import androidx.cardview.widget.CardView;
import androidx.constraintlayout.widget.Group;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@ -94,6 +95,8 @@ public class ActivityEML extends ActivityBase {
private TextView tvBody;
private TextView tvStructure;
private ImageButton ibEml;
private CardView cardHeaders;
private TextView tvHeaders;
private ContentLoadingProgressBar pbWait;
private Group grpReady;
@ -123,6 +126,8 @@ public class ActivityEML extends ActivityBase {
tvBody = findViewById(R.id.tvBody);
tvStructure = findViewById(R.id.tvStructure);
ibEml = findViewById(R.id.ibEml);
cardHeaders = findViewById(R.id.cardHeaders);
tvHeaders = findViewById(R.id.tvHeaders);
pbWait = findViewById(R.id.pbWait);
grpReady = findViewById(R.id.grpReady);
@ -205,6 +210,7 @@ public class ActivityEML extends ActivityBase {
FragmentDialogTheme.setBackground(this, view, false);
vSeparatorAttachments.setVisibility(View.GONE);
grpReady.setVisibility(View.GONE);
cardHeaders.setVisibility(View.GONE);
load();
}
@ -281,6 +287,8 @@ public class ActivityEML extends ActivityBase {
getStructure(imessage, ssb, 0, textColorLink);
result.structure = ssb;
result.headers = HtmlHelper.highlightHeaders(context, helper.getHeaders(), false);
return result;
}
}
@ -358,7 +366,9 @@ public class ActivityEML extends ActivityBase {
tvBody.setText(result.body);
tvStructure.setText(result.structure);
tvHeaders.setText(result.headers);
grpReady.setVisibility(View.VISIBLE);
cardHeaders.setVisibility(!BuildConfig.PLAY_STORE_RELEASE ? View.VISIBLE : View.GONE);
}
@Override
@ -672,5 +682,6 @@ public class ActivityEML extends ActivityBase {
MessageHelper.MessageParts parts;
Spanned body;
Spanned structure;
Spanned headers;
}
}

@ -306,6 +306,41 @@
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cardHeaders"
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/cardStructure">
<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/tvHeaders"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:fontFamily="monospace"
android:minHeight="30dp"
android:text="Headers"
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"

Loading…
Cancel
Save