Summarize: error handling

pull/215/head
M66B 8 months ago
parent fef76265be
commit 53090f2f44

@ -53,6 +53,7 @@ public class FragmentDialogSummarize extends FragmentDialogBase {
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 TextView tvError = view.findViewById(R.id.tvError);
final ContentLoadingProgressBar pbWait = view.findViewById(R.id.pbWait);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
@ -81,6 +82,7 @@ public class FragmentDialogSummarize extends FragmentDialogBase {
protected void onPreExecute(Bundle args) {
tvSummary.setVisibility(View.GONE);
tvElapsed.setVisibility(View.GONE);
tvError.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE);
args.putLong("start", new Date().getTime());
}
@ -155,8 +157,8 @@ public class FragmentDialogSummarize extends FragmentDialogBase {
@Override
protected void onException(Bundle args, Throwable ex) {
tvSummary.setText(new ThrowableWrapper(ex).toSafeString());
tvSummary.setVisibility(View.VISIBLE);
tvError.setText(new ThrowableWrapper(ex).toSafeString());
tvError.setVisibility(View.VISIBLE);
}
}.execute(this, args, "message:summarize");

@ -70,6 +70,19 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSummary" />
<TextView
android:id="@+id/tvError"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:fontFamily="monospace"
android:text="Error"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textIsSelectable="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvElapsed" />
<eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbWait"
style="@style/Base.Widget.AppCompat.ProgressBar"
@ -79,7 +92,7 @@
android:indeterminate="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvElapsed"
app:layout_constraintTop_toBottomOf="@id/tvError"
app:show_delay="0" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
Loading…
Cancel
Save