mirror of https://github.com/M66B/FairEmail.git
Primary depends on synchronize
This commit is contained in:
parent
2e33cc65e0
commit
3313e944ed
|
@ -37,6 +37,7 @@ import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
|
import android.widget.CompoundButton;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
|
@ -63,8 +64,8 @@ public class FragmentAccount extends FragmentEx {
|
||||||
private EditText etPort;
|
private EditText etPort;
|
||||||
private EditText etUser;
|
private EditText etUser;
|
||||||
private TextInputLayout tilPassword;
|
private TextInputLayout tilPassword;
|
||||||
private CheckBox cbPrimary;
|
|
||||||
private CheckBox cbSynchronize;
|
private CheckBox cbSynchronize;
|
||||||
|
private CheckBox cbPrimary;
|
||||||
private Button btnOk;
|
private Button btnOk;
|
||||||
private ProgressBar pbCheck;
|
private ProgressBar pbCheck;
|
||||||
// TODO: loading spinner
|
// TODO: loading spinner
|
||||||
|
@ -99,8 +100,8 @@ public class FragmentAccount extends FragmentEx {
|
||||||
etPort = view.findViewById(R.id.etPort);
|
etPort = view.findViewById(R.id.etPort);
|
||||||
etUser = view.findViewById(R.id.etUser);
|
etUser = view.findViewById(R.id.etUser);
|
||||||
tilPassword = view.findViewById(R.id.tilPassword);
|
tilPassword = view.findViewById(R.id.tilPassword);
|
||||||
cbPrimary = view.findViewById(R.id.cbPrimary);
|
|
||||||
cbSynchronize = view.findViewById(R.id.cbSynchronize);
|
cbSynchronize = view.findViewById(R.id.cbSynchronize);
|
||||||
|
cbPrimary = view.findViewById(R.id.cbPrimary);
|
||||||
btnOk = view.findViewById(R.id.btnOk);
|
btnOk = view.findViewById(R.id.btnOk);
|
||||||
pbCheck = view.findViewById(R.id.pbCheck);
|
pbCheck = view.findViewById(R.id.pbCheck);
|
||||||
|
|
||||||
|
@ -128,6 +129,13 @@ public class FragmentAccount extends FragmentEx {
|
||||||
|
|
||||||
pbCheck.setVisibility(View.GONE);
|
pbCheck.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
|
cbPrimary.setEnabled(checked);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
btnOk.setOnClickListener(new View.OnClickListener() {
|
btnOk.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -141,8 +149,8 @@ public class FragmentAccount extends FragmentEx {
|
||||||
args.putString("port", etPort.getText().toString());
|
args.putString("port", etPort.getText().toString());
|
||||||
args.putString("user", etUser.getText().toString());
|
args.putString("user", etUser.getText().toString());
|
||||||
args.putString("password", tilPassword.getEditText().getText().toString());
|
args.putString("password", tilPassword.getEditText().getText().toString());
|
||||||
args.putBoolean("primary", cbPrimary.isChecked());
|
|
||||||
args.putBoolean("synchronize", cbSynchronize.isChecked());
|
args.putBoolean("synchronize", cbSynchronize.isChecked());
|
||||||
|
args.putBoolean("primary", cbPrimary.isChecked());
|
||||||
|
|
||||||
getLoaderManager().restartLoader(ActivityView.LOADER_ACCOUNT_PUT, args, putLoaderCallbacks).forceLoad();
|
getLoaderManager().restartLoader(ActivityView.LOADER_ACCOUNT_PUT, args, putLoaderCallbacks).forceLoad();
|
||||||
}
|
}
|
||||||
|
@ -156,8 +164,9 @@ public class FragmentAccount extends FragmentEx {
|
||||||
etPort.setText(account == null ? null : Long.toString(account.port));
|
etPort.setText(account == null ? null : Long.toString(account.port));
|
||||||
etUser.setText(account == null ? null : account.user);
|
etUser.setText(account == null ? null : account.user);
|
||||||
tilPassword.getEditText().setText(account == null ? null : account.password);
|
tilPassword.getEditText().setText(account == null ? null : account.password);
|
||||||
cbPrimary.setChecked(account == null ? true : account.primary);
|
|
||||||
cbSynchronize.setChecked(account == null ? true : account.synchronize);
|
cbSynchronize.setChecked(account == null ? true : account.synchronize);
|
||||||
|
cbPrimary.setChecked(account == null ? true : account.primary);
|
||||||
|
cbPrimary.setEnabled(account == null ? true : account.synchronize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -198,8 +207,8 @@ public class FragmentAccount extends FragmentEx {
|
||||||
account.port = Integer.parseInt(port);
|
account.port = Integer.parseInt(port);
|
||||||
account.user = user;
|
account.user = user;
|
||||||
account.password = Objects.requireNonNull(args.getString("password"));
|
account.password = Objects.requireNonNull(args.getString("password"));
|
||||||
account.primary = args.getBoolean("primary");
|
|
||||||
account.synchronize = args.getBoolean("synchronize");
|
account.synchronize = args.getBoolean("synchronize");
|
||||||
|
account.primary = (account.synchronize && args.getBoolean("primary"));
|
||||||
|
|
||||||
// Check IMAP server
|
// Check IMAP server
|
||||||
List<EntityFolder> folders = new ArrayList<>();
|
List<EntityFolder> folders = new ArrayList<>();
|
||||||
|
|
|
@ -64,8 +64,8 @@ public class FragmentIdentity extends FragmentEx {
|
||||||
private EditText etPort;
|
private EditText etPort;
|
||||||
private EditText etUser;
|
private EditText etUser;
|
||||||
private TextInputLayout tilPassword;
|
private TextInputLayout tilPassword;
|
||||||
private CheckBox cbPrimary;
|
|
||||||
private CheckBox cbSynchronize;
|
private CheckBox cbSynchronize;
|
||||||
|
private CheckBox cbPrimary;
|
||||||
private Button btnOk;
|
private Button btnOk;
|
||||||
private ProgressBar pbCheck;
|
private ProgressBar pbCheck;
|
||||||
// TODO: loading spinner
|
// TODO: loading spinner
|
||||||
|
@ -95,8 +95,8 @@ public class FragmentIdentity extends FragmentEx {
|
||||||
etPort = view.findViewById(R.id.etPort);
|
etPort = view.findViewById(R.id.etPort);
|
||||||
etUser = view.findViewById(R.id.etUser);
|
etUser = view.findViewById(R.id.etUser);
|
||||||
tilPassword = view.findViewById(R.id.tilPassword);
|
tilPassword = view.findViewById(R.id.tilPassword);
|
||||||
cbPrimary = view.findViewById(R.id.cbPrimary);
|
|
||||||
cbSynchronize = view.findViewById(R.id.cbSynchronize);
|
cbSynchronize = view.findViewById(R.id.cbSynchronize);
|
||||||
|
cbPrimary = view.findViewById(R.id.cbPrimary);
|
||||||
btnOk = view.findViewById(R.id.btnOk);
|
btnOk = view.findViewById(R.id.btnOk);
|
||||||
pbCheck = view.findViewById(R.id.pbCheck);
|
pbCheck = view.findViewById(R.id.pbCheck);
|
||||||
|
|
||||||
|
@ -146,6 +146,13 @@ public class FragmentIdentity extends FragmentEx {
|
||||||
|
|
||||||
pbCheck.setVisibility(View.GONE);
|
pbCheck.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@Override
|
||||||
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||||
|
cbPrimary.setEnabled(checked);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
btnOk.setOnClickListener(new View.OnClickListener() {
|
btnOk.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -162,8 +169,8 @@ public class FragmentIdentity extends FragmentEx {
|
||||||
args.putString("port", etPort.getText().toString());
|
args.putString("port", etPort.getText().toString());
|
||||||
args.putString("user", etUser.getText().toString());
|
args.putString("user", etUser.getText().toString());
|
||||||
args.putString("password", tilPassword.getEditText().getText().toString());
|
args.putString("password", tilPassword.getEditText().getText().toString());
|
||||||
args.putBoolean("primary", cbPrimary.isChecked());
|
|
||||||
args.putBoolean("synchronize", cbSynchronize.isChecked());
|
args.putBoolean("synchronize", cbSynchronize.isChecked());
|
||||||
|
args.putBoolean("primary", cbPrimary.isChecked());
|
||||||
|
|
||||||
getLoaderManager().restartLoader(ActivityView.LOADER_IDENTITY_PUT, args, putLoaderCallbacks).forceLoad();
|
getLoaderManager().restartLoader(ActivityView.LOADER_IDENTITY_PUT, args, putLoaderCallbacks).forceLoad();
|
||||||
}
|
}
|
||||||
|
@ -180,8 +187,9 @@ public class FragmentIdentity extends FragmentEx {
|
||||||
etPort.setText(identity == null ? null : Long.toString(identity.port));
|
etPort.setText(identity == null ? null : Long.toString(identity.port));
|
||||||
etUser.setText(identity == null ? null : identity.user);
|
etUser.setText(identity == null ? null : identity.user);
|
||||||
tilPassword.getEditText().setText(identity == null ? null : identity.password);
|
tilPassword.getEditText().setText(identity == null ? null : identity.password);
|
||||||
cbPrimary.setChecked(identity == null ? true : identity.primary);
|
|
||||||
cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
|
cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
|
||||||
|
cbPrimary.setChecked(identity == null ? true : identity.primary);
|
||||||
|
cbPrimary.setEnabled(identity == null ? true : identity.synchronize);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -226,8 +234,8 @@ public class FragmentIdentity extends FragmentEx {
|
||||||
identity.starttls = starttls;
|
identity.starttls = starttls;
|
||||||
identity.user = Objects.requireNonNull(args.getString("user"));
|
identity.user = Objects.requireNonNull(args.getString("user"));
|
||||||
identity.password = Objects.requireNonNull(args.getString("password"));
|
identity.password = Objects.requireNonNull(args.getString("password"));
|
||||||
identity.primary = args.getBoolean("primary");
|
|
||||||
identity.synchronize = args.getBoolean("synchronize");
|
identity.synchronize = args.getBoolean("synchronize");
|
||||||
|
identity.primary = (identity.synchronize && args.getBoolean("primary"));
|
||||||
|
|
||||||
if (TextUtils.isEmpty(identity.name))
|
if (TextUtils.isEmpty(identity.name))
|
||||||
throw new IllegalArgumentException(getContext().getString(R.string.title_no_name));
|
throw new IllegalArgumentException(getContext().getString(R.string.title_no_name));
|
||||||
|
|
|
@ -158,15 +158,6 @@
|
||||||
android:inputType="textPassword" />
|
android:inputType="textPassword" />
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/cbPrimary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:text="@string/title_primary_account"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/cbSynchronize"
|
android:id="@+id/cbSynchronize"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -174,7 +165,16 @@
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:text="@string/title_synchronize_account"
|
android:text="@string/title_synchronize_account"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/cbPrimary" />
|
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cbPrimary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:text="@string/title_primary_account"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnOk"
|
android:id="@+id/btnOk"
|
||||||
|
@ -183,7 +183,7 @@
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:text="@android:string/ok"
|
android:text="@android:string/ok"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
|
app:layout_constraintTop_toBottomOf="@id/cbPrimary" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/pbCheck"
|
android:id="@+id/pbCheck"
|
||||||
|
|
|
@ -210,15 +210,6 @@
|
||||||
android:inputType="textPassword" />
|
android:inputType="textPassword" />
|
||||||
</android.support.design.widget.TextInputLayout>
|
</android.support.design.widget.TextInputLayout>
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/cbPrimary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="12dp"
|
|
||||||
android:text="@string/title_primary_identity"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
|
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/cbSynchronize"
|
android:id="@+id/cbSynchronize"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -226,7 +217,16 @@
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:text="@string/title_synchronize_identity"
|
android:text="@string/title_synchronize_identity"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/cbPrimary" />
|
app:layout_constraintTop_toBottomOf="@id/tilPassword" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/cbPrimary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:text="@string/title_primary_identity"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnOk"
|
android:id="@+id/btnOk"
|
||||||
|
@ -235,7 +235,7 @@
|
||||||
android:layout_marginTop="12dp"
|
android:layout_marginTop="12dp"
|
||||||
android:text="@android:string/ok"
|
android:text="@android:string/ok"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/cbSynchronize" />
|
app:layout_constraintTop_toBottomOf="@id/cbPrimary" />
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/pbCheck"
|
android:id="@+id/pbCheck"
|
||||||
|
|
Loading…
Reference in New Issue