Simplify color selection

This commit is contained in:
M66B 2019-09-29 14:45:00 +02:00
parent a685da21a9
commit 97bc466942
12 changed files with 160 additions and 224 deletions

3
.gitmodules vendored
View File

@ -1,3 +1,6 @@
[submodule "colorpicker"]
path = colorpicker
url = https://github.com/M66B/colorpicker.git
[submodule "qcolorpicker"]
path = qcolorpicker
url = https://github.com/QuadFlask/colorpicker.git

View File

@ -0,0 +1,114 @@
package eu.faircode.email;
/*
This file is part of FairEmail.
FairEmail is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FairEmail is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018-2019 by Marcel Bokhorst (M66B)
*/
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.View;
import androidx.appcompat.widget.AppCompatButton;
import androidx.core.graphics.ColorUtils;
public class ButtonColor extends AppCompatButton {
private int color = Color.TRANSPARENT;
public ButtonColor(Context context) {
super(context);
}
public ButtonColor(Context context, AttributeSet attrs) {
super(context, attrs);
}
public ButtonColor(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
public Parcelable onSaveInstanceState() {
Parcelable superState = super.onSaveInstanceState();
return new SavedState(superState, this.color);
}
@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState savedState = (SavedState) state;
super.onRestoreInstanceState(savedState.getSuperState());
setColor(savedState.getColor());
}
void setColor(Integer color) {
if (color == null)
color = Color.TRANSPARENT;
this.color = color;
GradientDrawable background = new GradientDrawable();
background.setColor(color);
background.setStroke(
Helper.dp2pixels(getContext(), 1),
Helper.resolveColor(getContext(), R.attr.colorSeparator));
setBackground(background);
double lum = ColorUtils.calculateLuminance(color);
setTextColor(lum < 0.5 ? Color.WHITE : Color.BLACK);
}
int getColor() {
return this.color;
}
static class SavedState extends View.BaseSavedState {
private int color;
private SavedState(Parcelable superState, int color) {
super(superState);
this.color = color;
}
private SavedState(Parcel in) {
super(in);
color = in.readInt();
}
public int getColor() {
return this.color;
}
@Override
public void writeToParcel(Parcel destination, int flags) {
super.writeToParcel(destination, flags);
destination.writeInt(color);
}
public static final Parcelable.Creator<SavedState> CREATOR = new Creator<SavedState>() {
public SavedState createFromParcel(Parcel in) {
return new SavedState(in);
}
public SavedState[] newArray(int size) {
return new SavedState[size];
}
};
}
}

View File

@ -24,7 +24,6 @@ import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
@ -43,7 +42,6 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RadioGroup;
import android.widget.ScrollView;
import android.widget.Spinner;
@ -93,9 +91,7 @@ public class FragmentAccount extends FragmentBase {
private EditText etRealm;
private EditText etName;
private Button btnColor;
private View vwColor;
private ImageButton ibColorDefault;
private ButtonColor btnColor;
private TextView tvColorPro;
private Button btnAdvanced;
@ -142,7 +138,6 @@ public class FragmentAccount extends FragmentBase {
private long copy = -1;
private int auth = MailService.AUTH_TYPE_PASSWORD;
private boolean saving = false;
private int color = Color.TRANSPARENT;
private static final int REQUEST_COLOR = 1;
private static final int REQUEST_SAVE = 2;
@ -191,8 +186,6 @@ public class FragmentAccount extends FragmentBase {
etName = view.findViewById(R.id.etName);
btnColor = view.findViewById(R.id.btnColor);
vwColor = view.findViewById(R.id.vwColor);
ibColorDefault = view.findViewById(R.id.ibColorDefault);
tvColorPro = view.findViewById(R.id.tvColorPro);
btnAdvanced = view.findViewById(R.id.btnAdvanced);
@ -307,24 +300,16 @@ public class FragmentAccount extends FragmentBase {
}
});
setColor(color);
btnColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentDialogColor fragment = new FragmentDialogColor();
fragment.initialize(R.string.title_color, color, new Bundle(), getContext());
fragment.initialize(R.string.title_color, btnColor.getColor(), new Bundle(), getContext());
fragment.setTargetFragment(FragmentAccount.this, REQUEST_COLOR);
fragment.show(getFragmentManager(), "account:color");
}
});
ibColorDefault.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setColor(Color.TRANSPARENT);
}
});
Helper.linkPro(tvColorPro);
btnAdvanced.setOnClickListener(new View.OnClickListener() {
@ -693,7 +678,7 @@ public class FragmentAccount extends FragmentBase {
args.putString("realm", etRealm.getText().toString());
args.putString("name", etName.getText().toString());
args.putInt("color", color);
args.putInt("color", btnColor.getColor());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
@ -1129,7 +1114,6 @@ public class FragmentAccount extends FragmentBase {
outState.putString("fair:password", tilPassword.getEditText().getText().toString());
outState.putInt("fair:advanced", grpAdvanced.getVisibility());
outState.putInt("fair:auth", auth);
outState.putInt("fair:color", color);
super.onSaveInstanceState(outState);
}
@ -1191,6 +1175,7 @@ public class FragmentAccount extends FragmentBase {
etRealm.setText(account == null ? null : account.realm);
etName.setText(account == null ? null : account.name);
btnColor.setColor(account == null ? null : account.color);
boolean pro = ActivityBilling.isPro(getContext());
cbNotify.setChecked(account != null && account.notify && pro);
@ -1204,7 +1189,6 @@ public class FragmentAccount extends FragmentBase {
cbPartialFetch.setChecked(account == null ? true : account.partial_fetch);
auth = (account == null ? MailService.AUTH_TYPE_PASSWORD : account.auth_type);
color = (account == null || account.color == null ? Color.TRANSPARENT : account.color);
new SimpleTask<EntityAccount>() {
@Override
@ -1231,7 +1215,6 @@ public class FragmentAccount extends FragmentBase {
tilPassword.getEditText().setText(savedInstanceState.getString("fair:password"));
grpAdvanced.setVisibility(savedInstanceState.getInt("fair:advanced"));
auth = savedInstanceState.getInt("fair:auth");
color = savedInstanceState.getInt("fair:color");
}
Helper.setViewsEnabled(view, true);
@ -1241,7 +1224,6 @@ public class FragmentAccount extends FragmentBase {
tilPassword.setEnabled(false);
}
setColor(color);
cbPrimary.setEnabled(cbSynchronize.isChecked());
// Consider previous check/save/delete as cancelled
@ -1329,7 +1311,7 @@ public class FragmentAccount extends FragmentBase {
if (resultCode == RESULT_OK && data != null) {
if (ActivityBilling.isPro(getContext())) {
Bundle args = data.getBundleExtra("args");
setColor(args.getInt("color"));
btnColor.setColor(args.getInt("color"));
} else
startActivity(new Intent(getContext(), ActivityBilling.class));
}
@ -1356,15 +1338,6 @@ public class FragmentAccount extends FragmentBase {
}
}
private void setColor(int color) {
this.color = color;
GradientDrawable border = new GradientDrawable();
border.setColor(color);
border.setStroke(1, Helper.resolveColor(getContext(), R.attr.colorSeparator));
vwColor.setBackground(border);
}
private void onDelete() {
Bundle args = new Bundle();
args.putLong("id", id);

View File

@ -25,7 +25,6 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@ -47,7 +46,6 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RadioGroup;
import android.widget.ScrollView;
import android.widget.Spinner;
@ -84,9 +82,7 @@ public class FragmentIdentity extends FragmentBase {
private Spinner spAccount;
private EditText etDisplay;
private Button btnColor;
private View vwColor;
private ImageButton ibColorDefault;
private ButtonColor btnColor;
private TextView tvColorPro;
private EditText etSignature;
private Button btnHtml;
@ -133,7 +129,6 @@ public class FragmentIdentity extends FragmentBase {
private long copy = -1;
private int auth = MailService.AUTH_TYPE_PASSWORD;
private boolean saving = false;
private int color = Color.TRANSPARENT;
private static final int REQUEST_COLOR = 1;
private static final int REQUEST_SAVE = 2;
@ -167,8 +162,6 @@ public class FragmentIdentity extends FragmentBase {
spAccount = view.findViewById(R.id.spAccount);
etDisplay = view.findViewById(R.id.etDisplay);
btnColor = view.findViewById(R.id.btnColor);
vwColor = view.findViewById(R.id.vwColor);
ibColorDefault = view.findViewById(R.id.ibColorDefault);
tvColorPro = view.findViewById(R.id.tvColorPro);
etSignature = view.findViewById(R.id.etSignature);
btnHtml = view.findViewById(R.id.btnHtml);
@ -290,24 +283,16 @@ public class FragmentIdentity extends FragmentBase {
}
});
setColor(color);
btnColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentDialogColor fragment = new FragmentDialogColor();
fragment.initialize(R.string.title_flag_color, color, new Bundle(), getContext());
fragment.initialize(R.string.title_flag_color, btnColor.getColor(), new Bundle(), getContext());
fragment.setTargetFragment(FragmentIdentity.this, REQUEST_COLOR);
fragment.show(getFragmentManager(), "identity:color");
}
});
ibColorDefault.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setColor(Color.TRANSPARENT);
}
});
Helper.linkPro(tvColorPro);
etSignature.addTextChangedListener(new TextWatcher() {
@ -516,6 +501,7 @@ public class FragmentIdentity extends FragmentBase {
args.putString("name", name);
args.putString("email", etEmail.getText().toString().trim());
args.putString("display", etDisplay.getText().toString());
args.putInt("color", btnColor.getColor());
args.putBoolean("sender_extra", cbSenderExtra.isChecked());
args.putString("sender_extra_regex", etSenderExtra.getText().toString());
args.putString("replyto", etReplyTo.getText().toString().trim());
@ -533,7 +519,6 @@ public class FragmentIdentity extends FragmentBase {
args.putString("password", tilPassword.getEditText().getText().toString());
args.putString("realm", etRealm.getText().toString());
args.putBoolean("use_ip", cbUseIp.isChecked());
args.putInt("color", color);
args.putString("signature", (String) etSignature.getTag());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
@ -858,7 +843,6 @@ public class FragmentIdentity extends FragmentBase {
outState.putString("fair:password", tilPassword.getEditText().getText().toString());
outState.putInt("fair:advanced", grpAdvanced.getVisibility());
outState.putInt("fair:auth", auth);
outState.putInt("fair:color", color);
outState.putString("fair:html", (String) etSignature.getTag());
super.onSaveInstanceState(outState);
}
@ -884,6 +868,7 @@ public class FragmentIdentity extends FragmentBase {
etEmail.setText(identity == null ? null : identity.email);
etDisplay.setText(identity == null ? null : identity.display);
btnColor.setColor(identity == null ? null : identity.color);
String signature = (identity == null ? null : identity.signature);
etSignature.setText(TextUtils.isEmpty(signature) ? null : HtmlHelper.fromHtml(signature));
@ -909,7 +894,6 @@ public class FragmentIdentity extends FragmentBase {
cbReadReceipt.setChecked(identity == null ? false : identity.read_receipt);
auth = (identity == null ? MailService.AUTH_TYPE_PASSWORD : identity.auth_type);
color = (identity == null || identity.color == null ? Color.TRANSPARENT : identity.color);
if (identity == null || copy > 0)
new SimpleTask<Integer>() {
@ -932,7 +916,6 @@ public class FragmentIdentity extends FragmentBase {
tilPassword.getEditText().setText(savedInstanceState.getString("fair:password"));
grpAdvanced.setVisibility(savedInstanceState.getInt("fair:advanced"));
auth = savedInstanceState.getInt("fair:auth");
color = savedInstanceState.getInt("fair:color");
etSignature.setTag(savedInstanceState.getString("fair:html"));
}
@ -943,8 +926,6 @@ public class FragmentIdentity extends FragmentBase {
tilPassword.setEnabled(false);
}
setColor(color);
cbPrimary.setEnabled(cbSynchronize.isChecked());
pbWait.setVisibility(View.GONE);
@ -1073,7 +1054,7 @@ public class FragmentIdentity extends FragmentBase {
if (resultCode == RESULT_OK && data != null) {
if (ActivityBilling.isPro(getContext())) {
Bundle args = data.getBundleExtra("args");
setColor(args.getInt("color"));
btnColor.setColor(args.getInt("color"));
} else
startActivity(new Intent(getContext(), ActivityBilling.class));
}
@ -1104,15 +1085,6 @@ public class FragmentIdentity extends FragmentBase {
}
}
private void setColor(int color) {
this.color = color;
GradientDrawable border = new GradientDrawable();
border.setColor(color);
border.setStroke(1, Helper.resolveColor(getContext(), R.attr.colorSeparator));
vwColor.setBackground(border);
}
private void onDelete() {
Bundle args = new Bundle();
args.putLong("id", id);

View File

@ -23,7 +23,6 @@ import android.app.NotificationManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@ -38,7 +37,6 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.RadioGroup;
import android.widget.ScrollView;
import android.widget.TextView;
@ -69,9 +67,7 @@ public class FragmentPop extends FragmentBase {
private TextInputLayout tilPassword;
private EditText etName;
private Button btnColor;
private View vwColor;
private ImageButton ibColorDefault;
private ButtonColor btnColor;
private TextView tvColorPro;
private CheckBox cbSynchronize;
@ -87,7 +83,6 @@ public class FragmentPop extends FragmentBase {
private long id = -1;
private boolean saving = false;
private int color = Color.TRANSPARENT;
private static final int REQUEST_COLOR = 1;
private static final int REQUEST_DELETE = 2;
@ -120,8 +115,6 @@ public class FragmentPop extends FragmentBase {
etName = view.findViewById(R.id.etName);
btnColor = view.findViewById(R.id.btnColor);
vwColor = view.findViewById(R.id.vwColor);
ibColorDefault = view.findViewById(R.id.ibColorDefault);
tvColorPro = view.findViewById(R.id.tvColorPro);
cbSynchronize = view.findViewById(R.id.cbSynchronize);
@ -136,24 +129,16 @@ public class FragmentPop extends FragmentBase {
pbWait = view.findViewById(R.id.pbWait);
setColor(color);
btnColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentDialogColor fragment = new FragmentDialogColor();
fragment.initialize(R.string.title_color, color, new Bundle(), getContext());
fragment.initialize(R.string.title_color, btnColor.getColor(), new Bundle(), getContext());
fragment.setTargetFragment(FragmentPop.this, REQUEST_COLOR);
fragment.show(getFragmentManager(), "account:color");
}
});
ibColorDefault.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
setColor(Color.TRANSPARENT);
}
});
Helper.linkPro(tvColorPro);
cbSynchronize.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@ -193,7 +178,7 @@ public class FragmentPop extends FragmentBase {
args.putString("password", tilPassword.getEditText().getText().toString());
args.putString("name", etName.getText().toString());
args.putInt("color", color);
args.putInt("color", btnColor.getColor());
args.putBoolean("synchronize", cbSynchronize.isChecked());
args.putBoolean("primary", cbPrimary.isChecked());
@ -428,7 +413,6 @@ public class FragmentPop extends FragmentBase {
@Override
public void onSaveInstanceState(Bundle outState) {
outState.putString("fair:password", tilPassword.getEditText().getText().toString());
outState.putInt("fair:color", color);
super.onSaveInstanceState(outState);
}
@ -461,14 +445,13 @@ public class FragmentPop extends FragmentBase {
tilPassword.getEditText().setText(account == null ? null : account.password);
etName.setText(account == null ? null : account.name);
btnColor.setColor(account == null ? null : account.color);
cbSynchronize.setChecked(account == null ? true : account.synchronize);
cbPrimary.setChecked(account == null ? false : account.primary);
cbLeave.setChecked(account == null ? true : account.browse);
etInterval.setText(account == null ? "" : Long.toString(account.poll_interval));
color = (account == null || account.color == null ? Color.TRANSPARENT : account.color);
new SimpleTask<EntityAccount>() {
@Override
protected EntityAccount onExecute(Context context, Bundle args) {
@ -488,10 +471,8 @@ public class FragmentPop extends FragmentBase {
}.execute(FragmentPop.this, new Bundle(), "account:primary");
} else {
tilPassword.getEditText().setText(savedInstanceState.getString("fair:password"));
color = savedInstanceState.getInt("fair:color");
}
setColor(color);
cbPrimary.setEnabled(cbSynchronize.isChecked());
Helper.setViewsEnabled(view, true);
@ -529,15 +510,6 @@ public class FragmentPop extends FragmentBase {
}
}
private void setColor(int color) {
this.color = color;
GradientDrawable border = new GradientDrawable();
border.setColor(color);
border.setStroke(1, Helper.resolveColor(getContext(), R.attr.colorSeparator));
vwColor.setBackground(border);
}
private void onMenuDelete() {
Bundle aargs = new Bundle();
aargs.putString("question", getString(R.string.title_account_delete));
@ -558,7 +530,7 @@ public class FragmentPop extends FragmentBase {
if (resultCode == RESULT_OK && data != null) {
if (ActivityBilling.isPro(getContext())) {
Bundle args = data.getBundleExtra("args");
setColor(args.getInt("color"));
btnColor.setColor(args.getInt("color"));
} else
startActivity(new Intent(getContext(), ActivityBilling.class));
}

View File

@ -24,8 +24,6 @@ import android.app.TimePickerDialog;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Color;
import android.graphics.drawable.GradientDrawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@ -42,7 +40,6 @@ import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.NumberPicker;
import android.widget.ScrollView;
@ -113,9 +110,7 @@ public class FragmentRule extends FragmentBase {
private NumberPicker npDuration;
private CheckBox cbScheduleEnd;
private Button btnColor;
private View vwColor;
private ImageButton ibColorDefault;
private ButtonColor btnColor;
private Spinner spTarget;
private CheckBox cbMoveSeen;
@ -149,7 +144,6 @@ public class FragmentRule extends FragmentBase {
private long copy = -1;
private long account = -1;
private long folder = -1;
private int color = Color.TRANSPARENT;
private final static int MAX_CHECK = 10;
@ -218,8 +212,6 @@ public class FragmentRule extends FragmentBase {
cbScheduleEnd = view.findViewById(R.id.cbScheduleEnd);
btnColor = view.findViewById(R.id.btnColor);
vwColor = view.findViewById(R.id.vwColor);
ibColorDefault = view.findViewById(R.id.ibColorDefault);
spTarget = view.findViewById(R.id.spTarget);
cbMoveSeen = view.findViewById(R.id.cbMoveSeen);
@ -371,24 +363,16 @@ public class FragmentRule extends FragmentBase {
tvActionRemark.setVisibility(View.GONE);
onSelectColor(color);
btnColor.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentDialogColor fragment = new FragmentDialogColor();
fragment.initialize(R.string.title_flag_color, color, new Bundle(), getContext());
fragment.initialize(R.string.title_flag_color, btnColor.getColor(), new Bundle(), getContext());
fragment.setTargetFragment(FragmentRule.this, REQUEST_COLOR);
fragment.show(getFragmentManager(), "rule:color");
}
});
ibColorDefault.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onSelectColor(Color.TRANSPARENT);
}
});
tvAutomation.setText(getString(R.string.title_rule_automation_hint,
EntityRule.ACTION_AUTOMATION,
TextUtils.join(",", new String[]{
@ -511,7 +495,7 @@ public class FragmentRule extends FragmentBase {
}
Bundle args = data.getBundleExtra("args");
onSelectColor(args.getInt("color"));
btnColor.setColor(args.getInt("color"));
}
break;
case REQUEST_DELETE:
@ -551,15 +535,6 @@ public class FragmentRule extends FragmentBase {
}
}
private void onSelectColor(int color) {
this.color = color;
GradientDrawable border = new GradientDrawable();
border.setColor(color);
border.setStroke(1, Helper.resolveColor(getContext(), R.attr.colorSeparator));
vwColor.setBackground(border);
}
private void onDelete() {
Bundle args = new Bundle();
args.putLong("id", id);
@ -682,8 +657,9 @@ public class FragmentRule extends FragmentBase {
break;
case EntityRule.TYPE_FLAG:
onSelectColor(jaction.isNull("color")
? Color.TRANSPARENT : jaction.optInt("color", 0));
btnColor.setColor(
!jaction.has("color") || jaction.isNull("color")
? null : jaction.getInt("color"));
break;
case EntityRule.TYPE_MOVE:
@ -962,7 +938,7 @@ public class FragmentRule extends FragmentBase {
break;
case EntityRule.TYPE_FLAG:
jaction.put("color", color);
jaction.put("color", btnColor.getColor());
break;
case EntityRule.TYPE_MOVE:

View File

@ -320,11 +320,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etName" />
<Button
<eu.faircode.email.ButtonColor
android:id="@+id/btnColor"
style="@style/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:tag="disable"
@ -332,32 +333,11 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvColor" />
<View
android:id="@+id/vwColor"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="12dp"
android:background="?attr/colorAccent"
app:layout_constraintBottom_toBottomOf="@id/btnColor"
app:layout_constraintStart_toEndOf="@id/btnColor"
app:layout_constraintTop_toTopOf="@id/btnColor" />
<ImageButton
android:id="@+id/ibColorDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_default_color"
app:layout_constraintBottom_toBottomOf="@id/btnColor"
app:layout_constraintStart_toEndOf="@id/vwColor"
app:layout_constraintTop_toTopOf="@id/btnColor"
app:srcCompat="@drawable/baseline_delete_24" />
<TextView
android:id="@+id/tvColorHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/title_identity_color_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
@ -812,7 +792,7 @@
app:constraint_referenced_ids="
tvUser,etUser,tvPassword,tilPassword,tvOAuthSupport,tvRealm,etRealm,
tvName,tvNameRemark,etName,
tvColor,btnColor,vwColor,ibColorDefault,tvColorHint,tvColorPro" />
tvColor,btnColor,tvColorHint,tvColorPro" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpAdvanced"

View File

@ -114,11 +114,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etDisplay" />
<Button
<eu.faircode.email.ButtonColor
android:id="@+id/btnColor"
style="@style/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:tag="disable"
@ -126,32 +127,11 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvColor" />
<View
android:id="@+id/vwColor"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="12dp"
android:background="?attr/colorAccent"
app:layout_constraintBottom_toBottomOf="@id/btnColor"
app:layout_constraintStart_toEndOf="@id/btnColor"
app:layout_constraintTop_toTopOf="@id/btnColor" />
<ImageButton
android:id="@+id/ibColorDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_default_color"
app:layout_constraintBottom_toBottomOf="@id/btnColor"
app:layout_constraintStart_toEndOf="@id/vwColor"
app:layout_constraintTop_toTopOf="@id/btnColor"
app:srcCompat="@drawable/baseline_delete_24" />
<TextView
android:id="@+id/tvColorHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/title_identity_color_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"
@ -715,7 +695,7 @@
android:layout_height="0dp"
app:constraint_referenced_ids="
tvName,etName,tvEmail,etEmail,tvDisplay,etDisplay,
tvColor,btnColor,vwColor,ibColorDefault,tvColorHint,tvColorPro,
tvColor,btnColor,tvColorHint,tvColorPro,
tvSignature,etSignature,btnHtml,
btnAdvanced,btnSave" />

View File

@ -194,11 +194,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/etName" />
<Button
<eu.faircode.email.ButtonColor
android:id="@+id/btnColor"
style="@style/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:tag="disable"
@ -206,32 +207,11 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvColor" />
<View
android:id="@+id/vwColor"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="12dp"
android:background="?attr/colorAccent"
app:layout_constraintBottom_toBottomOf="@id/btnColor"
app:layout_constraintStart_toEndOf="@id/btnColor"
app:layout_constraintTop_toTopOf="@id/btnColor" />
<ImageButton
android:id="@+id/ibColorDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_default_color"
app:layout_constraintBottom_toBottomOf="@id/btnColor"
app:layout_constraintStart_toEndOf="@id/vwColor"
app:layout_constraintTop_toTopOf="@id/btnColor"
app:srcCompat="@drawable/baseline_delete_24" />
<TextView
android:id="@+id/tvColorHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:text="@string/title_identity_color_hint"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:textStyle="italic"

View File

@ -491,11 +491,12 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbScheduleEnd" />
<Button
<eu.faircode.email.ButtonColor
android:id="@+id/btnColor"
style="@style/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:minWidth="0dp"
android:minHeight="0dp"
android:tag="disable"
@ -503,28 +504,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvColor" />
<View
android:id="@+id/vwColor"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginStart="12dp"
android:background="?attr/colorAccent"
app:layout_constraintBottom_toBottomOf="@id/btnColor"
app:layout_constraintStart_toEndOf="@id/btnColor"
app:layout_constraintTop_toTopOf="@id/btnColor" />
<ImageButton
android:id="@+id/ibColorDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_legend_default_color"
app:layout_constraintBottom_toBottomOf="@id/btnColor"
app:layout_constraintStart_toEndOf="@id/vwColor"
app:layout_constraintTop_toTopOf="@id/btnColor"
app:srcCompat="@drawable/baseline_delete_24" />
<TextView
android:id="@+id/tvMoveTarget"
android:layout_width="wrap_content"
@ -641,7 +620,7 @@
android:id="@+id/grpFlag"
android:layout_width="0dp"
android:layout_height="0dp"
app:constraint_referenced_ids="tvColor,btnColor,vwColor,ibColorDefault" />
app:constraint_referenced_ids="tvColor,btnColor" />
<androidx.constraintlayout.widget.Group
android:id="@+id/grpMove"

View File

@ -1022,22 +1022,28 @@
<item>@color/pink</item>
<item>@color/purple</item>
<item>@color/deep_purple</item>
<item>@color/indigo</item>
<item>@color/blue</item>
<item>@color/light_blue</item>
<item>@color/cyan</item>
<item>@color/teal</item>
<item>@color/green</item>
<item>@color/light_green</item>
<item>@color/lime</item>
<item>@color/yellow</item>
<item>@color/amber</item>
<item>@color/orange</item>
<item>@color/deep_orange</item>
<item>@color/brown</item>
<item>@color/blue_grey</item>
<item>@color/grey</item>
<item>@color/dark_grey</item>
<item>@android:color/transparent</item>
</array>
<string name="fingerprint" translatable="false">17BA15C1AF55D925F98B99CEA4375D4CDF4C174B</string>

1
qcolorpicker Submodule

@ -0,0 +1 @@
Subproject commit 3583e34ac3895b3c01e89bab6a7d32bca124a974