mirror of
https://github.com/M66B/FairEmail.git
synced 2025-12-20 17:21:40 +01:00
Show manual setup after quick setup failure
This commit is contained in:
@@ -43,6 +43,7 @@ import android.widget.TextView;
|
|||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.constraintlayout.widget.Group;
|
import androidx.constraintlayout.widget.Group;
|
||||||
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
@@ -440,6 +441,8 @@ public class FragmentQuickSetup extends FragmentBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onExecuted(Bundle args, EmailProvider result) {
|
protected void onExecuted(Bundle args, EmailProvider result) {
|
||||||
|
setManual(false);
|
||||||
|
|
||||||
boolean check = args.getBoolean("check");
|
boolean check = args.getBoolean("check");
|
||||||
if (check) {
|
if (check) {
|
||||||
tvImap.setText(result == null ? null : result.imap.toString());
|
tvImap.setText(result == null ? null : result.imap.toString());
|
||||||
@@ -459,6 +462,7 @@ public class FragmentQuickSetup extends FragmentBase {
|
|||||||
@Override
|
@Override
|
||||||
protected void onException(final Bundle args, Throwable ex) {
|
protected void onException(final Bundle args, Throwable ex) {
|
||||||
Log.e(ex);
|
Log.e(ex);
|
||||||
|
setManual(true);
|
||||||
EmailProvider provider = args.getParcelable("provider");
|
EmailProvider provider = args.getParcelable("provider");
|
||||||
|
|
||||||
if (ex instanceof AuthenticationFailedException) {
|
if (ex instanceof AuthenticationFailedException) {
|
||||||
@@ -514,6 +518,18 @@ public class FragmentQuickSetup extends FragmentBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setManual(boolean manual) {
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
|
if (activity == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Intent intent = activity.getIntent();
|
||||||
|
if (intent == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
intent.putExtra("manual", manual);
|
||||||
|
}
|
||||||
}.execute(this, args, "setup:quick");
|
}.execute(this, args, "setup:quick");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -109,17 +109,7 @@ public class FragmentSetup extends FragmentBase {
|
|||||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||||
setSubtitle(R.string.title_setup);
|
setSubtitle(R.string.title_setup);
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState != null)
|
||||||
FragmentActivity activity = getActivity();
|
|
||||||
if (activity != null) {
|
|
||||||
Intent intent = activity.getIntent();
|
|
||||||
if (intent.hasExtra("manual")) {
|
|
||||||
manual = intent.getBooleanExtra("manual", false);
|
|
||||||
intent.removeExtra("manual");
|
|
||||||
activity.setIntent(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
manual = savedInstanceState.getBoolean("fair:manual");
|
manual = savedInstanceState.getBoolean("fair:manual");
|
||||||
|
|
||||||
textColorPrimary = Helper.resolveColor(getContext(), android.R.attr.textColorPrimary);
|
textColorPrimary = Helper.resolveColor(getContext(), android.R.attr.textColorPrimary);
|
||||||
@@ -298,8 +288,7 @@ public class FragmentSetup extends FragmentBase {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
manual = !manual;
|
manual = !manual;
|
||||||
ibManual.setImageLevel(manual ? 0 /* less */ : 1 /* more */);
|
updateManual();
|
||||||
grpManual.setVisibility(manual ? View.VISIBLE : View.GONE);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -312,8 +301,7 @@ public class FragmentSetup extends FragmentBase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ibManual.setImageLevel(manual ? 0 /* less */ : 1 /* more */);
|
updateManual();
|
||||||
grpManual.setVisibility(manual ? View.VISIBLE : View.GONE);
|
|
||||||
|
|
||||||
btnAccount.setOnClickListener(new View.OnClickListener() {
|
btnAccount.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -534,6 +522,8 @@ public class FragmentSetup extends FragmentBase {
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
|
||||||
|
updateManual();
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||||
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
cm.registerDefaultNetworkCallback(networkCallback);
|
cm.registerDefaultNetworkCallback(networkCallback);
|
||||||
@@ -579,6 +569,21 @@ public class FragmentSetup extends FragmentBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateManual() {
|
||||||
|
FragmentActivity activity = getActivity();
|
||||||
|
if (activity != null) {
|
||||||
|
Intent intent = activity.getIntent();
|
||||||
|
if (intent.hasExtra("manual")) {
|
||||||
|
manual = intent.getBooleanExtra("manual", false);
|
||||||
|
intent.removeExtra("manual");
|
||||||
|
activity.setIntent(intent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ibManual.setImageLevel(manual ? 0 /* less */ : 1 /* more */);
|
||||||
|
grpManual.setVisibility(manual ? View.VISIBLE : View.GONE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
|
||||||
for (int i = 0; i < permissions.length; i++)
|
for (int i = 0; i < permissions.length; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user