diff --git a/res/layout/dialog_progress.xml b/res/layout/dialog_progress.xml index 8b016dd41..bf606d092 100644 --- a/res/layout/dialog_progress.xml +++ b/res/layout/dialog_progress.xml @@ -1,52 +1,39 @@ - + android:layout_height="wrap_content"> - - - - + android:layout_marginLeft="16dp" + android:layout_marginRight="16dp" + android:layout_marginTop="16dp"> - + - + - + - \ No newline at end of file + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 6e75882e3..9d5b24395 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -356,6 +356,7 @@ Add account Delete account Are you sure you want to delete your account data? + Switching account… diff --git a/src/org/thoughtcrime/securesms/connect/AccountManager.java b/src/org/thoughtcrime/securesms/connect/AccountManager.java index 31504bc98..51472c733 100644 --- a/src/org/thoughtcrime/securesms/connect/AccountManager.java +++ b/src/org/thoughtcrime/securesms/connect/AccountManager.java @@ -184,7 +184,7 @@ public class AccountManager { Account prevAccount = maybeGetAccount(new File(activity.getFilesDir(), prevDbName)); if (prevAccount!=null) { - new SwitchAccountAsyncTask(activity, R.string.switch_account, prevAccount, inCreationDbName).execute(); + new SwitchAccountAsyncTask(activity, R.string.switching_account, prevAccount, inCreationDbName).execute(); } } @@ -212,7 +212,7 @@ public class AccountManager { private final @Nullable String deleteDbName; public SwitchAccountAsyncTask(Activity activity, int title, @Nullable Account destAccount, @Nullable String deleteDbName) { - super(activity, title, R.string.one_moment); + super(activity, null, activity.getString(title)); this.activityWeakReference = new WeakReference<>(activity); this.destAccount = destAccount; this.deleteDbName = deleteDbName; @@ -284,11 +284,11 @@ public class AccountManager { .setSingleChoiceItems(menu.toArray(new String[menu.size()]), presel, (dialog, which) -> { dialog.dismiss(); if (which==addAccount) { - new SwitchAccountAsyncTask(activity, R.string.add_account, null, null).execute(); + new SwitchAccountAsyncTask(activity, R.string.one_moment, null, null).execute(); } else { // switch account Account account = accounts.get(which); if (!account.isCurrent()) { - new SwitchAccountAsyncTask(activity, R.string.switch_account, account, null).execute(); + new SwitchAccountAsyncTask(activity, R.string.switching_account, account, null).execute(); } } }); diff --git a/src/org/thoughtcrime/securesms/util/views/ProgressDialog.java b/src/org/thoughtcrime/securesms/util/views/ProgressDialog.java index 18b36e967..0e10dbf20 100644 --- a/src/org/thoughtcrime/securesms/util/views/ProgressDialog.java +++ b/src/org/thoughtcrime/securesms/util/views/ProgressDialog.java @@ -1,5 +1,6 @@ package org.thoughtcrime.securesms.util.views; +import android.app.Dialog; import android.content.Context; import android.graphics.PorterDuff; import android.os.Bundle; @@ -7,6 +8,7 @@ import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; import androidx.appcompat.app.AlertDialog; import android.view.View; +import android.widget.Button; import android.widget.ProgressBar; import android.widget.TextView; @@ -38,9 +40,22 @@ public class ProgressDialog extends AlertDialog { } } + private boolean isButtonVisible(int which) { + Button button = getButton(which); + if (button==null) { + return false; + } + return button.getVisibility()==View.VISIBLE; + } + @Override public void show() { super.show(); + + if (isButtonVisible(Dialog.BUTTON_POSITIVE) || isButtonVisible(Dialog.BUTTON_NEGATIVE) || isButtonVisible(Dialog.BUTTON_NEUTRAL)) { + findViewById(R.id.noButtonsSpacer).setVisibility(View.GONE); + } + progressBar = findViewById(R.id.progressBar); textView = findViewById(R.id.text); setupProgressBar();