Added progress bar to forward raw

pull/194/merge
M66B 3 years ago
parent 62380c4da6
commit 07f30a9288

@ -31,6 +31,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
@ -53,14 +54,21 @@ public class FragmentDialogForwardRaw extends FragmentDialogBase {
@NonNull
@Override
public Dialog onCreateDialog(@Nullable Bundle savedInstanceState) {
Bundle args = getArguments();
long account = args.getLong("account");
long[] ids = args.getLongArray("ids");
if (savedInstanceState != null)
enabled = savedInstanceState.getBoolean("fair:enabled");
View dview = LayoutInflater.from(getContext()).inflate(R.layout.dialog_forward_raw, null);
ProgressBar pbDownloaded = dview.findViewById(R.id.pbDownloaded);
TextView tvRemaining = dview.findViewById(R.id.tvRemaining);
TextView tvOption = dview.findViewById(R.id.tvOption);
TextView tvNoInternet = dview.findViewById(R.id.tvNoInternet);
pbDownloaded.setProgress(0);
pbDownloaded.setMax(ids.length);
tvRemaining.setText(getString(R.string.title_eml_downloaded, "-"));
tvOption.setOnClickListener(new View.OnClickListener() {
@ -152,6 +160,8 @@ public class FragmentDialogForwardRaw extends FragmentDialogBase {
if (remaining == null)
return;
pbDownloaded.setProgress(ids.length - remaining);
String of = getString(R.string.title_of,
NF.format(ids.length - remaining),
NF.format(ids.length));
@ -179,8 +189,6 @@ public class FragmentDialogForwardRaw extends FragmentDialogBase {
.setPositiveButton(R.string.title_send, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
long account = getArguments().getLong("account");
long[] ids = getArguments().getLongArray("ids");
send(account, ids);
}
})

@ -46,17 +46,27 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvRemark" />
<ProgressBar
android:id="@+id/pbDownloaded"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:progress="25"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOption" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvRemaining"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
android:layout_marginTop="12dp"
android:text="@string/title_eml_downloaded"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textColor="?android:attr/textColorPrimary"
android:textStyle="bold"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvOption" />
app:layout_constraintTop_toBottomOf="@id/pbDownloaded" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvNoInternet"

Loading…
Cancel
Save