OAuth configuring

pull/184/head
M66B 4 years ago
parent 89d4e109e3
commit d0dd9e677d

@ -92,7 +92,7 @@ public class FragmentOAuth extends FragmentBase {
private EditText etEmail;
private Button btnOAuth;
private ContentLoadingProgressBar pbOAuth;
private TextView tvAuthorized;
private TextView tvConfiguring;
private TextView tvGmailHint;
private TextView tvError;
@ -102,8 +102,6 @@ public class FragmentOAuth extends FragmentBase {
private Group grpError;
private static final int OAUTH_TIMEOUT = 20 * 1000; // milliseconds
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@ -129,7 +127,7 @@ public class FragmentOAuth extends FragmentBase {
etEmail = view.findViewById(R.id.etEmail);
btnOAuth = view.findViewById(R.id.btnOAuth);
pbOAuth = view.findViewById(R.id.pbOAuth);
tvAuthorized = view.findViewById(R.id.tvAuthorized);
tvConfiguring = view.findViewById(R.id.tvConfiguring);
tvGmailHint = view.findViewById(R.id.tvGmailHint);
tvError = view.findViewById(R.id.tvError);
@ -160,7 +158,7 @@ public class FragmentOAuth extends FragmentBase {
etName.setVisibility(askAccount ? View.VISIBLE : View.GONE);
etEmail.setVisibility(askAccount ? View.VISIBLE : View.GONE);
pbOAuth.setVisibility(View.GONE);
tvAuthorized.setVisibility(View.GONE);
tvConfiguring.setVisibility(View.GONE);
tvGmailHint.setVisibility("gmail".equals(id) ? View.VISIBLE : View.GONE);
hideError();
@ -318,8 +316,6 @@ public class FragmentOAuth extends FragmentBase {
if (auth == null)
throw AuthorizationException.fromIntent(data);
tvAuthorized.setVisibility(View.VISIBLE);
final EmailProvider provider = EmailProvider.getProvider(getContext(), auth.state);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
@ -384,6 +380,16 @@ public class FragmentOAuth extends FragmentBase {
args.putString("address", etEmail.getText().toString().trim());
new SimpleTask<Void>() {
@Override
protected void onPreExecute(Bundle args) {
tvConfiguring.setVisibility(View.VISIBLE);
}
@Override
protected void onPostExecute(Bundle args) {
tvConfiguring.setVisibility(View.GONE);
}
@Override
protected Void onExecute(Context context, Bundle args) throws Throwable {
String id = args.getString("id");
@ -613,8 +619,6 @@ public class FragmentOAuth extends FragmentBase {
private void showError(Throwable ex) {
Log.e(ex);
pbOAuth.setVisibility(View.GONE);
if (ex instanceof IllegalArgumentException)
tvError.setText(ex.getMessage());
else

@ -74,18 +74,14 @@
app:layout_constraintTop_toTopOf="@id/btnOAuth" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvAuthorized"
android:id="@+id/tvConfiguring"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:drawableStart="@drawable/baseline_check_24"
android:drawablePadding="6dp"
android:text="@string/title_setup_done"
android:layout_marginTop="12dp"
android:text="@string/title_setup_configuring"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorPrimary"
app:layout_constraintBottom_toBottomOf="@id/btnOAuth"
app:layout_constraintStart_toEndOf="@id/pbOAuth"
app:layout_constraintTop_toTopOf="@id/btnOAuth" />
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnOAuth" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvGmailHint"
@ -96,7 +92,7 @@
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnOAuth" />
app:layout_constraintTop_toBottomOf="@id/tvConfiguring" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvErrorTitle"

@ -210,6 +210,7 @@
<string name="title_setup_done">Done</string>
<string name="title_setup_still">Still to do</string>
<string name="title_setup_error">Error</string>
<string name="title_setup_configuring">Configuring account &#8230;</string>
<string name="title_setup_export">Export settings</string>
<string name="title_setup_import">Import settings</string>

Loading…
Cancel
Save