mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-22 06:01:12 +00:00
Small improvements
This commit is contained in:
parent
cf6ee7630f
commit
ca79bfc990
3 changed files with 50 additions and 3 deletions
|
@ -1138,6 +1138,7 @@ public class FragmentAccount extends FragmentEx {
|
||||||
Log.i("Accounts=" + accounts.length);
|
Log.i("Accounts=" + accounts.length);
|
||||||
for (final Account account : accounts)
|
for (final Account account : accounts)
|
||||||
if (name.equals(account.name)) {
|
if (name.equals(account.name)) {
|
||||||
|
btnAuthorize.setEnabled(false);
|
||||||
final Snackbar snackbar = Snackbar.make(view, R.string.title_authorizing, Snackbar.LENGTH_SHORT);
|
final Snackbar snackbar = Snackbar.make(view, R.string.title_authorizing, Snackbar.LENGTH_SHORT);
|
||||||
snackbar.show();
|
snackbar.show();
|
||||||
|
|
||||||
|
@ -1157,15 +1158,17 @@ public class FragmentAccount extends FragmentEx {
|
||||||
authorized = token;
|
authorized = token;
|
||||||
etUser.setText(account.name);
|
etUser.setText(account.name);
|
||||||
tilPassword.getEditText().setText(token);
|
tilPassword.getEditText().setText(token);
|
||||||
|
} catch (Throwable ex) {
|
||||||
|
Log.e(ex);
|
||||||
|
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||||
|
} finally {
|
||||||
|
btnAuthorize.setEnabled(true);
|
||||||
new Handler().postDelayed(new Runnable() {
|
new Handler().postDelayed(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
snackbar.dismiss();
|
snackbar.dismiss();
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
} catch (Throwable ex) {
|
|
||||||
Log.e(ex);
|
|
||||||
snackbar.setText(Helper.formatThrowable(ex));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -38,11 +38,14 @@ import android.net.ConnectivityManager;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
import android.text.Editable;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
import android.text.TextWatcher;
|
||||||
import android.text.method.LinkMovementMethod;
|
import android.text.method.LinkMovementMethod;
|
||||||
import android.util.Patterns;
|
import android.util.Patterns;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -215,6 +218,24 @@ public class FragmentSetup extends FragmentEx {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
TextWatcher credentialsWatcher = new TextWatcher() {
|
||||||
|
@Override
|
||||||
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||||
|
auth_type = Helper.AUTH_TYPE_PASSWORD;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterTextChanged(Editable s) {
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
etEmail.addTextChangedListener(credentialsWatcher);
|
||||||
|
tilPassword.getEditText().addTextChangedListener(credentialsWatcher);
|
||||||
|
|
||||||
tilPassword.setHintEnabled(false);
|
tilPassword.setHintEnabled(false);
|
||||||
|
|
||||||
btnQuick.setOnClickListener(new View.OnClickListener() {
|
btnQuick.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -833,6 +854,10 @@ public class FragmentSetup extends FragmentEx {
|
||||||
Log.i("Accounts=" + accounts.length);
|
Log.i("Accounts=" + accounts.length);
|
||||||
for (final Account account : accounts)
|
for (final Account account : accounts)
|
||||||
if (name.equals(account.name)) {
|
if (name.equals(account.name)) {
|
||||||
|
btnAuthorize.setEnabled(false);
|
||||||
|
final Snackbar snackbar = Snackbar.make(view, R.string.title_authorizing, Snackbar.LENGTH_SHORT);
|
||||||
|
snackbar.show();
|
||||||
|
|
||||||
am.getAuthToken(
|
am.getAuthToken(
|
||||||
account,
|
account,
|
||||||
Helper.getAuthTokenType(type),
|
Helper.getAuthTokenType(type),
|
||||||
|
@ -852,6 +877,14 @@ public class FragmentSetup extends FragmentEx {
|
||||||
} catch (Throwable ex) {
|
} catch (Throwable ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
Helper.unexpectedError(getContext(), getViewLifecycleOwner(), ex);
|
||||||
|
} finally {
|
||||||
|
btnAuthorize.setEnabled(true);
|
||||||
|
new Handler().postDelayed(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
snackbar.dismiss();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -45,6 +45,17 @@
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/etName" />
|
app:layout_constraintTop_toBottomOf="@id/etName" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tvAuthorizeRemark"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="6dp"
|
||||||
|
android:text="@string/title_optional"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Small"
|
||||||
|
app:layout_constraintBottom_toBottomOf="@id/btnAuthorize"
|
||||||
|
app:layout_constraintStart_toEndOf="@id/btnAuthorize"
|
||||||
|
app:layout_constraintTop_toTopOf="@id/btnAuthorize" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/etEmail"
|
android:id="@+id/etEmail"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue