Added from/subject to summarize dialog

This commit is contained in:
M66B 2024-05-14 13:11:59 +02:00
parent 90e527cb60
commit f7148dad57
4 changed files with 37 additions and 4 deletions

View File

@ -7280,6 +7280,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private void onActionSummarize(TupleMessageEx message) {
Bundle args = new Bundle();
args.putLong("id", message.id);
args.putString("from", MessageHelper.formatAddresses(message.from));
args.putString("subject", message.subject);
FragmentDialogSummarize fragment = new FragmentDialogSummarize();
fragment.setArguments(args);

View File

@ -48,6 +48,8 @@ public class FragmentDialogSummarize extends FragmentDialogBase {
final Context context = getContext();
final View view = LayoutInflater.from(context).inflate(R.layout.dialog_summarize, null);
final TextView tvCaption = view.findViewById(R.id.tvCaption);
final TextView tvFrom = view.findViewById(R.id.tvFrom);
final TextView tvSubject = view.findViewById(R.id.tvSubject);
final TextView tvSummary = view.findViewById(R.id.tvSummary);
final TextView tvElapsed = view.findViewById(R.id.tvElapsed);
final ContentLoadingProgressBar pbWait = view.findViewById(R.id.pbWait);
@ -67,8 +69,11 @@ public class FragmentDialogSummarize extends FragmentDialogBase {
float textSize = Helper.getTextSize(context, zoom) * message_zoom / 100f;
tvSummary.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
Bundle args = getArguments();
tvCaption.setText(prompt);
tvSummary.setText(null);
tvFrom.setText(args.getString("from"));
tvSubject.setText(args.getString("subject"));
new SimpleTask<String>() {
@Override
@ -152,7 +157,7 @@ public class FragmentDialogSummarize extends FragmentDialogBase {
tvSummary.setText(new ThrowableWrapper(ex).toSafeString());
tvSummary.setVisibility(View.VISIBLE);
}
}.execute(this, getArguments(), "message:summarize");
}.execute(this, args, "message:summarize");
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setView(view)

View File

@ -1637,6 +1637,8 @@ public class FragmentMessages extends FragmentBase
Bundle args = new Bundle();
args.putLong("id", result.single.id);
args.putString("from", MessageHelper.formatAddresses(result.single.from));
args.putString("subject", result.single.subject);
FragmentDialogSummarize fragment = new FragmentDialogSummarize();
fragment.setArguments(args);

View File

@ -23,17 +23,41 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvFrom"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="From"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaption" />
<TextView
android:id="@+id/tvSubject"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="Subject"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvFrom" />
<TextView
android:id="@+id/tvSummary"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginTop="12dp"
android:text="Text"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCaption" />
app:layout_constraintTop_toBottomOf="@id/tvSubject" />
<TextView
android:id="@+id/tvElapsed"