Added button to view EML

pull/199/head
M66B 3 years ago
parent e55913c1f8
commit 155a8f32aa

@ -41,6 +41,7 @@ import android.view.MenuItem;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
@ -91,6 +92,7 @@ public class ActivityEML extends ActivityBase {
private RecyclerView rvAttachment; private RecyclerView rvAttachment;
private TextView tvBody; private TextView tvBody;
private TextView tvStructure; private TextView tvStructure;
private ImageButton ibEml;
private ContentLoadingProgressBar pbWait; private ContentLoadingProgressBar pbWait;
private Group grpReady; private Group grpReady;
@ -119,6 +121,7 @@ public class ActivityEML extends ActivityBase {
rvAttachment = findViewById(R.id.rvAttachment); rvAttachment = findViewById(R.id.rvAttachment);
tvBody = findViewById(R.id.tvBody); tvBody = findViewById(R.id.tvBody);
tvStructure = findViewById(R.id.tvStructure); tvStructure = findViewById(R.id.tvStructure);
ibEml = findViewById(R.id.ibEml);
pbWait = findViewById(R.id.pbWait); pbWait = findViewById(R.id.pbWait);
grpReady = findViewById(R.id.grpReady); grpReady = findViewById(R.id.grpReady);
@ -161,6 +164,38 @@ public class ActivityEML extends ActivityBase {
} }
}); });
ibEml.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Bundle args = new Bundle();
args.putParcelable("uri", getIntent().getData());
new SimpleTask<File>() {
@Override
protected File onExecute(Context context, Bundle args) throws Throwable {
File dir = new File(getCacheDir(), "shared");
if (!dir.exists())
dir.mkdir();
File file = new File(dir, "email.eml");
Uri uri = args.getParcelable("uri");
Helper.copy(context, uri, file);
return file;
}
@Override
protected void onExecuted(Bundle args, File file) {
Helper.share(ActivityEML.this, file, "text/plain", file.getName());
}
@Override
protected void onException(Bundle args, Throwable ex) {
Log.unexpectedError(getSupportFragmentManager(), ex);
}
}.execute(ActivityEML.this, args, "eml:share");
}
});
// Initialize // Initialize
if (!Helper.isDarkTheme(this)) { if (!Helper.isDarkTheme(this)) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);

@ -285,12 +285,24 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="3dp" android:layout_marginTop="3dp"
android:fontFamily="monospace" android:fontFamily="monospace"
android:minHeight="30dp"
android:text="Structure" android:text="Structure"
android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true" android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<ImageButton
android:id="@+id/ibEml"
android:layout_width="36dp"
android:layout_height="36dp"
android:layout_marginEnd="6dp"
android:background="?attr/selectableItemBackground"
android:padding="3dp"
app:layout_constraintBottom_toBottomOf="@id/tvStructure"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/baseline_code_24" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

Loading…
Cancel
Save