|
|
@ -27,8 +27,10 @@ import android.graphics.drawable.GradientDrawable;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.preference.PreferenceManager;
|
|
|
|
import android.preference.PreferenceManager;
|
|
|
|
|
|
|
|
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.util.Patterns;
|
|
|
|
import android.util.Patterns;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.view.Menu;
|
|
|
|
import android.view.Menu;
|
|
|
@ -47,6 +49,7 @@ import android.widget.ImageView;
|
|
|
|
import android.widget.ProgressBar;
|
|
|
|
import android.widget.ProgressBar;
|
|
|
|
import android.widget.ScrollView;
|
|
|
|
import android.widget.ScrollView;
|
|
|
|
import android.widget.Spinner;
|
|
|
|
import android.widget.Spinner;
|
|
|
|
|
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
|
|
|
|
|
|
import com.android.colorpicker.ColorPickerDialog;
|
|
|
|
import com.android.colorpicker.ColorPickerDialog;
|
|
|
|
import com.android.colorpicker.ColorPickerSwatch;
|
|
|
|
import com.android.colorpicker.ColorPickerSwatch;
|
|
|
@ -73,15 +76,21 @@ import androidx.fragment.app.FragmentTransaction;
|
|
|
|
|
|
|
|
|
|
|
|
public class FragmentIdentity extends FragmentEx {
|
|
|
|
public class FragmentIdentity extends FragmentEx {
|
|
|
|
private ViewGroup view;
|
|
|
|
private ViewGroup view;
|
|
|
|
|
|
|
|
|
|
|
|
private EditText etName;
|
|
|
|
private EditText etName;
|
|
|
|
private EditText etEmail;
|
|
|
|
private EditText etEmail;
|
|
|
|
private EditText etDisplay;
|
|
|
|
|
|
|
|
private Spinner spAccount;
|
|
|
|
private Spinner spAccount;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private EditText etDisplay;
|
|
|
|
|
|
|
|
private Button btnColor;
|
|
|
|
|
|
|
|
private View vwColor;
|
|
|
|
|
|
|
|
private ImageView ibColorDefault;
|
|
|
|
|
|
|
|
private EditText etSignature;
|
|
|
|
|
|
|
|
private ImageButton ibPro;
|
|
|
|
|
|
|
|
|
|
|
|
private Button btnAdvanced;
|
|
|
|
private Button btnAdvanced;
|
|
|
|
private EditText etReplyTo;
|
|
|
|
private TextView tvProvider;
|
|
|
|
private EditText etBcc;
|
|
|
|
|
|
|
|
private CheckBox cbDeliveryReceipt;
|
|
|
|
|
|
|
|
private CheckBox cbReadReceipt;
|
|
|
|
|
|
|
|
private Spinner spProvider;
|
|
|
|
private Spinner spProvider;
|
|
|
|
private EditText etDomain;
|
|
|
|
private EditText etDomain;
|
|
|
|
private Button btnAutoConfig;
|
|
|
|
private Button btnAutoConfig;
|
|
|
@ -92,19 +101,19 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
private EditText etUser;
|
|
|
|
private EditText etUser;
|
|
|
|
private TextInputLayout tilPassword;
|
|
|
|
private TextInputLayout tilPassword;
|
|
|
|
|
|
|
|
|
|
|
|
private Button btnColor;
|
|
|
|
|
|
|
|
private View vwColor;
|
|
|
|
|
|
|
|
private ImageView ibColorDefault;
|
|
|
|
|
|
|
|
private EditText etSignature;
|
|
|
|
|
|
|
|
private ImageButton ibPro;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private CheckBox cbSynchronize;
|
|
|
|
private CheckBox cbSynchronize;
|
|
|
|
private CheckBox cbPrimary;
|
|
|
|
private CheckBox cbPrimary;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private EditText etReplyTo;
|
|
|
|
|
|
|
|
private EditText etBcc;
|
|
|
|
|
|
|
|
private CheckBox cbDeliveryReceipt;
|
|
|
|
|
|
|
|
private CheckBox cbReadReceipt;
|
|
|
|
private Spinner spSent;
|
|
|
|
private Spinner spSent;
|
|
|
|
|
|
|
|
|
|
|
|
private Button btnSave;
|
|
|
|
private Button btnSave;
|
|
|
|
private ProgressBar pbSave;
|
|
|
|
private ProgressBar pbSave;
|
|
|
|
private ProgressBar pbWait;
|
|
|
|
private ProgressBar pbWait;
|
|
|
|
|
|
|
|
|
|
|
|
private Group grpAdvanced;
|
|
|
|
private Group grpAdvanced;
|
|
|
|
|
|
|
|
|
|
|
|
private long id = -1;
|
|
|
|
private long id = -1;
|
|
|
@ -135,19 +144,18 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
etName = view.findViewById(R.id.etName);
|
|
|
|
etName = view.findViewById(R.id.etName);
|
|
|
|
etEmail = view.findViewById(R.id.etEmail);
|
|
|
|
etEmail = view.findViewById(R.id.etEmail);
|
|
|
|
spAccount = view.findViewById(R.id.spAccount);
|
|
|
|
spAccount = view.findViewById(R.id.spAccount);
|
|
|
|
|
|
|
|
|
|
|
|
btnAdvanced = view.findViewById(R.id.btnAdvanced);
|
|
|
|
|
|
|
|
etDisplay = view.findViewById(R.id.etDisplay);
|
|
|
|
etDisplay = view.findViewById(R.id.etDisplay);
|
|
|
|
etReplyTo = view.findViewById(R.id.etReplyTo);
|
|
|
|
btnColor = view.findViewById(R.id.btnColor);
|
|
|
|
etBcc = view.findViewById(R.id.etBcc);
|
|
|
|
vwColor = view.findViewById(R.id.vwColor);
|
|
|
|
cbDeliveryReceipt = view.findViewById(R.id.cbDeliveryReceipt);
|
|
|
|
ibColorDefault = view.findViewById(R.id.ibColorDefault);
|
|
|
|
cbReadReceipt = view.findViewById(R.id.cbReadReceipt);
|
|
|
|
etSignature = view.findViewById(R.id.etSignature);
|
|
|
|
|
|
|
|
ibPro = view.findViewById(R.id.ibPro);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnAdvanced = view.findViewById(R.id.btnAdvanced);
|
|
|
|
|
|
|
|
tvProvider = view.findViewById(R.id.tvProvider);
|
|
|
|
spProvider = view.findViewById(R.id.spProvider);
|
|
|
|
spProvider = view.findViewById(R.id.spProvider);
|
|
|
|
|
|
|
|
|
|
|
|
etDomain = view.findViewById(R.id.etDomain);
|
|
|
|
etDomain = view.findViewById(R.id.etDomain);
|
|
|
|
btnAutoConfig = view.findViewById(R.id.btnAutoConfig);
|
|
|
|
btnAutoConfig = view.findViewById(R.id.btnAutoConfig);
|
|
|
|
|
|
|
|
|
|
|
|
etHost = view.findViewById(R.id.etHost);
|
|
|
|
etHost = view.findViewById(R.id.etHost);
|
|
|
|
cbStartTls = view.findViewById(R.id.cbStartTls);
|
|
|
|
cbStartTls = view.findViewById(R.id.cbStartTls);
|
|
|
|
cbInsecure = view.findViewById(R.id.cbInsecure);
|
|
|
|
cbInsecure = view.findViewById(R.id.cbInsecure);
|
|
|
@ -155,19 +163,19 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
etUser = view.findViewById(R.id.etUser);
|
|
|
|
etUser = view.findViewById(R.id.etUser);
|
|
|
|
tilPassword = view.findViewById(R.id.tilPassword);
|
|
|
|
tilPassword = view.findViewById(R.id.tilPassword);
|
|
|
|
|
|
|
|
|
|
|
|
btnColor = view.findViewById(R.id.btnColor);
|
|
|
|
|
|
|
|
vwColor = view.findViewById(R.id.vwColor);
|
|
|
|
|
|
|
|
ibColorDefault = view.findViewById(R.id.ibColorDefault);
|
|
|
|
|
|
|
|
etSignature = view.findViewById(R.id.etSignature);
|
|
|
|
|
|
|
|
ibPro = view.findViewById(R.id.ibPro);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbSynchronize = view.findViewById(R.id.cbSynchronize);
|
|
|
|
cbSynchronize = view.findViewById(R.id.cbSynchronize);
|
|
|
|
cbPrimary = view.findViewById(R.id.cbPrimary);
|
|
|
|
cbPrimary = view.findViewById(R.id.cbPrimary);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
etReplyTo = view.findViewById(R.id.etReplyTo);
|
|
|
|
|
|
|
|
etBcc = view.findViewById(R.id.etBcc);
|
|
|
|
|
|
|
|
cbDeliveryReceipt = view.findViewById(R.id.cbDeliveryReceipt);
|
|
|
|
|
|
|
|
cbReadReceipt = view.findViewById(R.id.cbReadReceipt);
|
|
|
|
spSent = view.findViewById(R.id.spSent);
|
|
|
|
spSent = view.findViewById(R.id.spSent);
|
|
|
|
|
|
|
|
|
|
|
|
btnSave = view.findViewById(R.id.btnSave);
|
|
|
|
btnSave = view.findViewById(R.id.btnSave);
|
|
|
|
pbSave = view.findViewById(R.id.pbSave);
|
|
|
|
pbSave = view.findViewById(R.id.pbSave);
|
|
|
|
pbWait = view.findViewById(R.id.pbWait);
|
|
|
|
pbWait = view.findViewById(R.id.pbWait);
|
|
|
|
|
|
|
|
|
|
|
|
grpAdvanced = view.findViewById(R.id.grpAdvanced);
|
|
|
|
grpAdvanced = view.findViewById(R.id.grpAdvanced);
|
|
|
|
|
|
|
|
|
|
|
|
// Wire controls
|
|
|
|
// Wire controls
|
|
|
@ -229,6 +237,63 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vwColor.setBackgroundColor(color);
|
|
|
|
|
|
|
|
btnColor.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
if (Helper.isPro(getContext())) {
|
|
|
|
|
|
|
|
int[] colors = getContext().getResources().getIntArray(R.array.colorPicker);
|
|
|
|
|
|
|
|
ColorPickerDialog colorPickerDialog = new ColorPickerDialog();
|
|
|
|
|
|
|
|
colorPickerDialog.initialize(R.string.title_account_color, colors, color, 4, colors.length);
|
|
|
|
|
|
|
|
colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onColorSelected(int color) {
|
|
|
|
|
|
|
|
setColor(color);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
colorPickerDialog.show(getFragmentManager(), "colorpicker");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
|
|
|
|
|
|
|
fragmentTransaction.hide(FragmentIdentity.this);
|
|
|
|
|
|
|
|
fragmentTransaction.add(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
|
|
|
|
|
|
|
fragmentTransaction.commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ibColorDefault.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
setColor(Color.TRANSPARENT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ibPro.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
|
|
|
|
|
|
|
fragmentTransaction.hide(FragmentIdentity.this);
|
|
|
|
|
|
|
|
fragmentTransaction.add(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
|
|
|
|
|
|
|
fragmentTransaction.commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnAdvanced.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
int visibility = (grpAdvanced.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
grpAdvanced.setVisibility(visibility);
|
|
|
|
|
|
|
|
cbInsecure.setVisibility(insecure ? visibility : View.GONE);
|
|
|
|
|
|
|
|
if (visibility == View.VISIBLE)
|
|
|
|
|
|
|
|
new Handler().post(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
((ScrollView) view).smoothScrollTo(0, tvProvider.getTop());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
spProvider.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
spProvider.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
|
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
|
|
|
@ -250,6 +315,23 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
etDomain.addTextChangedListener(new TextWatcher() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onTextChanged(CharSequence text, int start, int before, int count) {
|
|
|
|
|
|
|
|
btnAutoConfig.setEnabled(text.length() > 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void afterTextChanged(Editable s) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
btnAutoConfig.setEnabled(false);
|
|
|
|
|
|
|
|
|
|
|
|
btnAutoConfig.setOnClickListener(new View.OnClickListener() {
|
|
|
|
btnAutoConfig.setOnClickListener(new View.OnClickListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onClick(View v) {
|
|
|
|
public void onClick(View v) {
|
|
|
@ -262,8 +344,10 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
new SimpleTask<SRVRecord>() {
|
|
|
|
new SimpleTask<SRVRecord>() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected SRVRecord onLoad(Context context, Bundle args) throws Throwable {
|
|
|
|
protected SRVRecord onLoad(Context context, Bundle args) throws Throwable {
|
|
|
|
String domain = args.getString("domain");
|
|
|
|
String dns = "_submission._tcp." + args.getString("domain");
|
|
|
|
Record[] records = new Lookup("_submission._tcp." + domain, Type.SRV).run();
|
|
|
|
Log.i("Lookup dns=" + dns);
|
|
|
|
|
|
|
|
Record[] records = new Lookup(dns, Type.SRV).run();
|
|
|
|
|
|
|
|
Log.i("Found dns=" + (records == null ? -1 : records.length));
|
|
|
|
if (records != null)
|
|
|
|
if (records != null)
|
|
|
|
for (int i = 0; i < records.length; i++) {
|
|
|
|
for (int i = 0; i < records.length; i++) {
|
|
|
|
SRVRecord srv = (SRVRecord) records[i];
|
|
|
|
SRVRecord srv = (SRVRecord) records[i];
|
|
|
@ -298,22 +382,6 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
btnAdvanced.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
int visibility = (grpAdvanced.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
|
|
|
|
|
|
|
|
grpAdvanced.setVisibility(visibility);
|
|
|
|
|
|
|
|
cbInsecure.setVisibility(insecure ? visibility : View.GONE);
|
|
|
|
|
|
|
|
if (visibility == View.VISIBLE)
|
|
|
|
|
|
|
|
new Handler().post(new Runnable() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void run() {
|
|
|
|
|
|
|
|
((ScrollView) view).smoothScrollTo(0, etDisplay.getTop());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbStartTls.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
cbStartTls.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
@ -321,47 +389,6 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
vwColor.setBackgroundColor(color);
|
|
|
|
|
|
|
|
btnColor.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
if (Helper.isPro(getContext())) {
|
|
|
|
|
|
|
|
int[] colors = getContext().getResources().getIntArray(R.array.colorPicker);
|
|
|
|
|
|
|
|
ColorPickerDialog colorPickerDialog = new ColorPickerDialog();
|
|
|
|
|
|
|
|
colorPickerDialog.initialize(R.string.title_account_color, colors, color, 4, colors.length);
|
|
|
|
|
|
|
|
colorPickerDialog.setOnColorSelectedListener(new ColorPickerSwatch.OnColorSelectedListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onColorSelected(int color) {
|
|
|
|
|
|
|
|
setColor(color);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
colorPickerDialog.show(getFragmentManager(), "colorpicker");
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
|
|
|
|
|
|
|
fragmentTransaction.hide(FragmentIdentity.this);
|
|
|
|
|
|
|
|
fragmentTransaction.add(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
|
|
|
|
|
|
|
fragmentTransaction.commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ibColorDefault.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
setColor(Color.TRANSPARENT);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ibPro.setOnClickListener(new View.OnClickListener() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void onClick(View v) {
|
|
|
|
|
|
|
|
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
|
|
|
|
|
|
|
|
fragmentTransaction.hide(FragmentIdentity.this);
|
|
|
|
|
|
|
|
fragmentTransaction.add(R.id.content_frame, new FragmentPro()).addToBackStack("pro");
|
|
|
|
|
|
|
|
fragmentTransaction.commit();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
|
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
|
|
@ -406,24 +433,27 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
protected Void onLoad(Context context, Bundle args) throws Throwable {
|
|
|
|
protected Void onLoad(Context context, Bundle args) throws Throwable {
|
|
|
|
long id = args.getLong("id");
|
|
|
|
long id = args.getLong("id");
|
|
|
|
String name = args.getString("name");
|
|
|
|
String name = args.getString("name");
|
|
|
|
|
|
|
|
String email = args.getString("email");
|
|
|
|
long account = args.getLong("account");
|
|
|
|
long account = args.getLong("account");
|
|
|
|
|
|
|
|
|
|
|
|
String display = args.getString("display");
|
|
|
|
String display = args.getString("display");
|
|
|
|
String email = args.getString("email");
|
|
|
|
Integer color = args.getInt("color");
|
|
|
|
String replyto = args.getString("replyto");
|
|
|
|
String signature = args.getString("signature");
|
|
|
|
String bcc = args.getString("bcc");
|
|
|
|
|
|
|
|
boolean delivery_receipt = args.getBoolean("delivery_receipt");
|
|
|
|
int auth_type = args.getInt("auth_type");
|
|
|
|
boolean read_receipt = args.getBoolean("read_receipt");
|
|
|
|
|
|
|
|
String host = args.getString("host");
|
|
|
|
String host = args.getString("host");
|
|
|
|
boolean starttls = args.getBoolean("starttls");
|
|
|
|
boolean starttls = args.getBoolean("starttls");
|
|
|
|
boolean insecure = args.getBoolean("insecure");
|
|
|
|
boolean insecure = args.getBoolean("insecure");
|
|
|
|
String port = args.getString("port");
|
|
|
|
String port = args.getString("port");
|
|
|
|
String user = args.getString("user");
|
|
|
|
String user = args.getString("user");
|
|
|
|
String password = args.getString("password");
|
|
|
|
String password = args.getString("password");
|
|
|
|
Integer color = args.getInt("color");
|
|
|
|
|
|
|
|
String signature = args.getString("signature");
|
|
|
|
|
|
|
|
int auth_type = args.getInt("auth_type");
|
|
|
|
|
|
|
|
boolean synchronize = args.getBoolean("synchronize");
|
|
|
|
boolean synchronize = args.getBoolean("synchronize");
|
|
|
|
boolean primary = args.getBoolean("primary");
|
|
|
|
boolean primary = args.getBoolean("primary");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String replyto = args.getString("replyto");
|
|
|
|
|
|
|
|
String bcc = args.getString("bcc");
|
|
|
|
|
|
|
|
boolean delivery_receipt = args.getBoolean("delivery_receipt");
|
|
|
|
|
|
|
|
boolean read_receipt = args.getBoolean("read_receipt");
|
|
|
|
EntityFolder sent = (EntityFolder) args.getSerializable("sent");
|
|
|
|
EntityFolder sent = (EntityFolder) args.getSerializable("sent");
|
|
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(name))
|
|
|
|
if (TextUtils.isEmpty(name))
|
|
|
@ -495,24 +525,26 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
if (identity == null)
|
|
|
|
if (identity == null)
|
|
|
|
identity = new EntityIdentity();
|
|
|
|
identity = new EntityIdentity();
|
|
|
|
identity.name = name;
|
|
|
|
identity.name = name;
|
|
|
|
|
|
|
|
identity.email = email;
|
|
|
|
identity.account = account;
|
|
|
|
identity.account = account;
|
|
|
|
identity.display = display;
|
|
|
|
identity.display = display;
|
|
|
|
identity.email = email;
|
|
|
|
identity.color = color;
|
|
|
|
identity.replyto = replyto;
|
|
|
|
identity.signature = signature;
|
|
|
|
identity.bcc = bcc;
|
|
|
|
|
|
|
|
identity.delivery_receipt = delivery_receipt;
|
|
|
|
identity.auth_type = auth_type;
|
|
|
|
identity.read_receipt = read_receipt;
|
|
|
|
|
|
|
|
identity.host = host;
|
|
|
|
identity.host = host;
|
|
|
|
identity.starttls = starttls;
|
|
|
|
identity.starttls = starttls;
|
|
|
|
identity.insecure = insecure;
|
|
|
|
identity.insecure = insecure;
|
|
|
|
identity.port = Integer.parseInt(port);
|
|
|
|
identity.port = Integer.parseInt(port);
|
|
|
|
identity.user = user;
|
|
|
|
identity.user = user;
|
|
|
|
identity.password = password;
|
|
|
|
identity.password = password;
|
|
|
|
identity.color = color;
|
|
|
|
|
|
|
|
identity.signature = signature;
|
|
|
|
|
|
|
|
identity.auth_type = auth_type;
|
|
|
|
|
|
|
|
identity.synchronize = synchronize;
|
|
|
|
identity.synchronize = synchronize;
|
|
|
|
identity.primary = (identity.synchronize && primary);
|
|
|
|
identity.primary = (identity.synchronize && primary);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
identity.replyto = replyto;
|
|
|
|
|
|
|
|
identity.bcc = bcc;
|
|
|
|
|
|
|
|
identity.delivery_receipt = delivery_receipt;
|
|
|
|
|
|
|
|
identity.read_receipt = read_receipt;
|
|
|
|
identity.store_sent = false;
|
|
|
|
identity.store_sent = false;
|
|
|
|
identity.sent_folder = (sent == null ? null : sent.id);
|
|
|
|
identity.sent_folder = (sent == null ? null : sent.id);
|
|
|
|
identity.error = null;
|
|
|
|
identity.error = null;
|
|
|
@ -602,21 +634,24 @@ public class FragmentIdentity extends FragmentEx {
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
if (savedInstanceState == null) {
|
|
|
|
etName.setText(identity == null ? null : identity.name);
|
|
|
|
etName.setText(identity == null ? null : identity.name);
|
|
|
|
etEmail.setText(identity == null ? null : identity.email);
|
|
|
|
etEmail.setText(identity == null ? null : identity.email);
|
|
|
|
|
|
|
|
|
|
|
|
etDisplay.setText(identity == null ? null : identity.display);
|
|
|
|
etDisplay.setText(identity == null ? null : identity.display);
|
|
|
|
etReplyTo.setText(identity == null ? null : identity.replyto);
|
|
|
|
etSignature.setText(identity == null || identity.signature == null ? null : Html.fromHtml(identity.signature));
|
|
|
|
etBcc.setText(identity == null ? null : identity.bcc);
|
|
|
|
|
|
|
|
cbDeliveryReceipt.setChecked(identity == null ? false : identity.delivery_receipt);
|
|
|
|
|
|
|
|
cbReadReceipt.setChecked(identity == null ? false : identity.read_receipt);
|
|
|
|
|
|
|
|
etHost.setText(identity == null ? null : identity.host);
|
|
|
|
etHost.setText(identity == null ? null : identity.host);
|
|
|
|
cbStartTls.setChecked(identity == null ? false : identity.starttls);
|
|
|
|
cbStartTls.setChecked(identity == null ? false : identity.starttls);
|
|
|
|
cbInsecure.setChecked(identity == null ? false : identity.insecure);
|
|
|
|
cbInsecure.setChecked(identity == null ? false : identity.insecure);
|
|
|
|
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);
|
|
|
|
etSignature.setText(identity == null || identity.signature == null ? null : Html.fromHtml(identity.signature));
|
|
|
|
|
|
|
|
cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
|
|
|
|
cbSynchronize.setChecked(identity == null ? true : identity.synchronize);
|
|
|
|
cbPrimary.setChecked(identity == null ? true : identity.primary);
|
|
|
|
cbPrimary.setChecked(identity == null ? true : identity.primary);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
etReplyTo.setText(identity == null ? null : identity.replyto);
|
|
|
|
|
|
|
|
etBcc.setText(identity == null ? null : identity.bcc);
|
|
|
|
|
|
|
|
cbDeliveryReceipt.setChecked(identity == null ? false : identity.delivery_receipt);
|
|
|
|
|
|
|
|
cbReadReceipt.setChecked(identity == null ? false : identity.read_receipt);
|
|
|
|
|
|
|
|
|
|
|
|
color = (identity == null || identity.color == null ? Color.TRANSPARENT : identity.color);
|
|
|
|
color = (identity == null || identity.color == null ? Color.TRANSPARENT : identity.color);
|
|
|
|
|
|
|
|
|
|
|
|
etName.requestFocus();
|
|
|
|
etName.requestFocus();
|
|
|
|