Small layout improvement, cleanup

pull/168/head
M66B 5 years ago
parent b5792a0005
commit 660c60f953

@ -52,22 +52,17 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import javax.mail.Flags; import javax.mail.Flags;
import javax.mail.Folder; import javax.mail.Folder;
import javax.mail.Message; import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session; import javax.mail.Session;
import javax.mail.internet.ContentType;
import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage;
public class ActivityEML extends ActivityBase { public class ActivityEML extends ActivityBase {
private Uri uri; private Uri uri;
private Result result;
private MessageHelper.AttachmentPart apart; private MessageHelper.AttachmentPart apart;
private static final int REQUEST_ATTACHMENT = 1; private static final int REQUEST_ATTACHMENT = 1;
@ -81,6 +76,7 @@ public class ActivityEML extends ActivityBase {
final TextView tvTo = findViewById(R.id.tvTo); final TextView tvTo = findViewById(R.id.tvTo);
final TextView tvFrom = findViewById(R.id.tvFrom); final TextView tvFrom = findViewById(R.id.tvFrom);
final TextView tvSubject = findViewById(R.id.tvSubject); final TextView tvSubject = findViewById(R.id.tvSubject);
final View vSeparatorAttachments = findViewById(R.id.vSeparatorAttachments);
final RecyclerView rvAttachment = findViewById(R.id.rvAttachment); final RecyclerView rvAttachment = findViewById(R.id.rvAttachment);
final TextView tvBody = findViewById(R.id.tvBody); final TextView tvBody = findViewById(R.id.tvBody);
final ContentLoadingProgressBar pbWait = findViewById(R.id.pbWait); final ContentLoadingProgressBar pbWait = findViewById(R.id.pbWait);
@ -90,6 +86,7 @@ public class ActivityEML extends ActivityBase {
LinearLayoutManager llm = new LinearLayoutManager(this); LinearLayoutManager llm = new LinearLayoutManager(this);
rvAttachment.setLayoutManager(llm); rvAttachment.setLayoutManager(llm);
vSeparatorAttachments.setVisibility(View.GONE);
grpReady.setVisibility(View.GONE); grpReady.setVisibility(View.GONE);
uri = getIntent().getData(); uri = getIntent().getData();
@ -147,27 +144,11 @@ public class ActivityEML extends ActivityBase {
@Override @Override
protected void onExecuted(Bundle args, Result result) { protected void onExecuted(Bundle args, Result result) {
ActivityEML.this.result = result;
tvFrom.setText(result.from); tvFrom.setText(result.from);
tvTo.setText(result.to); tvTo.setText(result.to);
tvSubject.setText(result.subject); tvSubject.setText(result.subject);
List<String> attachments = new ArrayList<>(); vSeparatorAttachments.setVisibility(result.parts.getAttachmentParts().size() > 0 ? View.VISIBLE : View.GONE);
for (MessageHelper.AttachmentPart apart : result.parts.getAttachmentParts()) {
StringBuilder sb = new StringBuilder();
try {
ContentType ct = new ContentType(apart.part.getContentType());
sb.append(ct.getBaseType().toLowerCase(Locale.ROOT));
} catch (MessagingException ex) {
sb.append(ex.getMessage());
}
if (apart.disposition != null)
sb.append(' ').append(apart.disposition);
if (apart.filename != null)
sb.append(' ').append(apart.filename);
attachments.add(sb.toString());
}
AdapterAttachmentEML adapter = new AdapterAttachmentEML( AdapterAttachmentEML adapter = new AdapterAttachmentEML(
ActivityEML.this, ActivityEML.this,

@ -142,7 +142,7 @@
vSeparatorHeader,tvFromTitle,tvFrom, vSeparatorHeader,tvFromTitle,tvFrom,
tvToTitle,tvTo, tvToTitle,tvTo,
tvSubject, tvSubject,
vSeparatorAttachments,rvAttachment, rvAttachment,
vSeparatorBody,tvBody" /> vSeparatorBody,tvBody" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView> </ScrollView>

Loading…
Cancel
Save