|
|
|
@ -63,6 +63,7 @@ import androidx.annotation.Nullable;
|
|
|
|
|
import androidx.constraintlayout.widget.ConstraintLayout;
|
|
|
|
|
import androidx.constraintlayout.widget.Group;
|
|
|
|
|
import androidx.fragment.app.FragmentTransaction;
|
|
|
|
|
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
|
|
|
|
|
|
|
|
import com.android.colorpicker.ColorPickerDialog;
|
|
|
|
|
import com.android.colorpicker.ColorPickerSwatch;
|
|
|
|
@ -134,6 +135,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
private Spinner spLeft;
|
|
|
|
|
private Spinner spRight;
|
|
|
|
|
|
|
|
|
|
private CheckBox cbIdentity;
|
|
|
|
|
private Button btnSave;
|
|
|
|
|
private ContentLoadingProgressBar pbSave;
|
|
|
|
|
private TextView tvError;
|
|
|
|
@ -211,6 +213,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
spLeft = view.findViewById(R.id.spLeft);
|
|
|
|
|
spRight = view.findViewById(R.id.spRight);
|
|
|
|
|
|
|
|
|
|
cbIdentity = view.findViewById(R.id.cbIdentity);
|
|
|
|
|
btnSave = view.findViewById(R.id.btnSave);
|
|
|
|
|
pbSave = view.findViewById(R.id.pbSave);
|
|
|
|
|
tvError = view.findViewById(R.id.tvError);
|
|
|
|
@ -264,6 +267,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
etPrefix.setText(provider.prefix);
|
|
|
|
|
|
|
|
|
|
grpFolders.setVisibility(View.GONE);
|
|
|
|
|
cbIdentity.setVisibility(View.GONE);
|
|
|
|
|
btnSave.setVisibility(View.GONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -457,6 +461,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
btnCheck.setVisibility(View.GONE);
|
|
|
|
|
pbCheck.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
|
|
cbIdentity.setVisibility(View.GONE);
|
|
|
|
|
btnSave.setVisibility(View.GONE);
|
|
|
|
|
pbSave.setVisibility(View.GONE);
|
|
|
|
|
tvError.setVisibility(View.GONE);
|
|
|
|
@ -703,6 +708,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
@Override
|
|
|
|
|
protected void onException(Bundle args, Throwable ex) {
|
|
|
|
|
grpFolders.setVisibility(View.GONE);
|
|
|
|
|
cbIdentity.setVisibility(View.GONE);
|
|
|
|
|
btnSave.setVisibility(View.GONE);
|
|
|
|
|
|
|
|
|
|
if (ex instanceof IllegalArgumentException)
|
|
|
|
@ -775,7 +781,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
args.putSerializable("left", left);
|
|
|
|
|
args.putSerializable("right", right);
|
|
|
|
|
|
|
|
|
|
new SimpleTask<Void>() {
|
|
|
|
|
new SimpleTask<Long>() {
|
|
|
|
|
@Override
|
|
|
|
|
protected void onPreExecute(Bundle args) {
|
|
|
|
|
saving = true;
|
|
|
|
@ -794,7 +800,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected Void onExecute(Context context, Bundle args) throws Throwable {
|
|
|
|
|
protected Long onExecute(Context context, Bundle args) throws Throwable {
|
|
|
|
|
long id = args.getLong("id");
|
|
|
|
|
|
|
|
|
|
int auth_type = args.getInt("auth_type");
|
|
|
|
@ -1053,12 +1059,18 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
nm.cancel("receive", account.id.intValue());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
return account.id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void onExecuted(Bundle args, Void data) {
|
|
|
|
|
protected void onExecuted(Bundle args, Long id) {
|
|
|
|
|
getFragmentManager().popBackStack();
|
|
|
|
|
if (cbIdentity.isChecked()) {
|
|
|
|
|
LocalBroadcastManager lbm = LocalBroadcastManager.getInstance(getContext());
|
|
|
|
|
lbm.sendBroadcast(
|
|
|
|
|
new Intent(ActivitySetup.ACTION_EDIT_IDENTITY)
|
|
|
|
|
.putExtra("account", id));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1155,6 +1167,8 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
cbBrowse.setChecked(account == null ? true : account.browse);
|
|
|
|
|
etInterval.setText(account == null ? "" : Long.toString(account.poll_interval));
|
|
|
|
|
|
|
|
|
|
cbIdentity.setChecked(account == null);
|
|
|
|
|
|
|
|
|
|
color = (account == null || account.color == null ? Color.TRANSPARENT : account.color);
|
|
|
|
|
|
|
|
|
|
new SimpleTask<EntityAccount>() {
|
|
|
|
@ -1451,6 +1465,7 @@ public class FragmentAccount extends FragmentBase {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
grpFolders.setVisibility(folders.size() > 1 ? View.VISIBLE : View.GONE);
|
|
|
|
|
cbIdentity.setVisibility(folders.size() > 1 ? View.VISIBLE : View.GONE);
|
|
|
|
|
btnSave.setVisibility(folders.size() > 1 ? View.VISIBLE : View.GONE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|