mirror of
https://github.com/M66B/FairEmail.git
synced 2026-03-29 13:24:52 +02:00
Added long press account to edit account color
This commit is contained in:
@@ -488,6 +488,10 @@ public class FragmentAccounts extends FragmentBase {
|
||||
|
||||
try {
|
||||
switch (requestCode) {
|
||||
case ActivitySetup.REQUEST_EDIT_ACCOUNT_COLOR:
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
onEditAccountColor(data.getBundleExtra("args"));
|
||||
break;
|
||||
case ActivitySetup.REQUEST_DELETE_ACCOUNT:
|
||||
if (resultCode == RESULT_OK && data != null)
|
||||
onDeleteAccount(data.getBundleExtra("args"));
|
||||
@@ -506,6 +510,33 @@ public class FragmentAccounts extends FragmentBase {
|
||||
}
|
||||
}
|
||||
|
||||
private void onEditAccountColor(Bundle args) {
|
||||
if (!ActivityBilling.isPro(getContext())) {
|
||||
startActivity(new Intent(getContext(), ActivityBilling.class));
|
||||
return;
|
||||
}
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
@Override
|
||||
protected Void onExecute(Context context, Bundle args) {
|
||||
long id = args.getLong("id");
|
||||
Integer color = args.getInt("color");
|
||||
|
||||
if (color == Color.TRANSPARENT)
|
||||
color = null;
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
db.account().setAccountColor(id, color);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onException(Bundle args, Throwable ex) {
|
||||
Log.unexpectedError(getParentFragmentManager(), ex);
|
||||
}
|
||||
}.execute(this, args, "edit:color");
|
||||
}
|
||||
|
||||
private void onDeleteAccount(Bundle args) {
|
||||
long account = args.getLong("account");
|
||||
String name = args.getString("name");
|
||||
|
||||
Reference in New Issue
Block a user