diff --git a/app/src/main/java/org/dystopia/email/ColorDialogFragment.java b/app/src/main/java/org/dystopia/email/ColorDialogFragment.java
index a1b7a00e..f8b1a84f 100644
--- a/app/src/main/java/org/dystopia/email/ColorDialogFragment.java
+++ b/app/src/main/java/org/dystopia/email/ColorDialogFragment.java
@@ -64,6 +64,7 @@ public class ColorDialogFragment extends DialogFragment {
color = savedInstanceState == null ? args.getInt("color") : savedInstanceState.getInt("dialog:color");
String title = args.getString("title");
boolean reset = args.getBoolean("reset", false);
+ boolean hasColor = color != Color.TRANSPARENT;
Context context = getContext();
int editTextColor = Helper.resolveColor(context, android.R.attr.editTextColor);
@@ -90,12 +91,15 @@ public class ColorDialogFragment extends DialogFragment {
}
});
- if (color != Color.TRANSPARENT) {
+ if (!hasColor) {
+ builder.initialColor(Helper.resolveColor(getContext(), android.R.attr.colorPrimary));
+ } else {
builder.initialColor(color);
}
if (reset) {
- builder.setNegativeButton(R.string.title_reset, new DialogInterface.OnClickListener() {
+ int negativeText = !hasColor ? R.string.title_cancel : R.string.title_reset;
+ builder.setNegativeButton(negativeText, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
getArguments().putInt("color", Color.TRANSPARENT);
diff --git a/app/src/main/java/org/dystopia/email/FragmentAccount.java b/app/src/main/java/org/dystopia/email/FragmentAccount.java
index cfa5dee1..e2e55df2 100644
--- a/app/src/main/java/org/dystopia/email/FragmentAccount.java
+++ b/app/src/main/java/org/dystopia/email/FragmentAccount.java
@@ -34,7 +34,6 @@ import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.graphics.Color;
-import android.graphics.drawable.GradientDrawable;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -54,14 +53,13 @@ import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageButton;
-import android.widget.ImageView;
+import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.ScrollView;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.annotation.RequiresApi;
import androidx.constraintlayout.widget.Group;
import androidx.core.content.ContextCompat;
import androidx.fragment.app.FragmentResultListener;
@@ -109,7 +107,7 @@ public class FragmentAccount extends FragmentEx {
private EditText etName;
private ViewButtonColor btnColor;
- private ImageView ibColorReset;
+ private LinearLayout llContainerColor;
private EditText etSignature;
private CheckBox cbSynchronize;
@@ -178,6 +176,7 @@ public class FragmentAccount extends FragmentEx {
btnAutoConfig = view.findViewById(R.id.btnAutoConfig);
etHost = view.findViewById(R.id.etHost);
+ llContainerColor = view.findViewById(R.id.llContainerColor);
etPort = view.findViewById(R.id.etPort);
cbStartTls = view.findViewById(R.id.cbStartTls);
cbInsecure = view.findViewById(R.id.cbInsecure);
@@ -190,7 +189,6 @@ public class FragmentAccount extends FragmentEx {
etName = view.findViewById(R.id.etName);
btnColor = view.findViewById(R.id.btnColor);
tvName = view.findViewById(R.id.tvName);
- ibColorReset = view.findViewById(R.id.ibColorReset);
etSignature = view.findViewById(R.id.etSignature);
cbSynchronize = view.findViewById(R.id.cbSynchronize);
@@ -377,7 +375,7 @@ public class FragmentAccount extends FragmentEx {
});
btnColor.setColor(color);
- btnColor.setOnClickListener(
+ llContainerColor.setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -392,15 +390,6 @@ public class FragmentAccount extends FragmentEx {
}
});
- ibColorReset.setOnClickListener(
- new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- btnColor.setColor(Color.TRANSPARENT);
- ibColorReset.setVisibility(View.GONE);
- }
- });
-
cbSynchronize.setOnCheckedChangeListener(
new CompoundButton.OnCheckedChangeListener() {
@Override
@@ -1101,7 +1090,6 @@ public class FragmentAccount extends FragmentEx {
if (resultCode == RESULT_OK) {
color = result.getInt("color");
btnColor.setColor(color);
- ibColorReset.setVisibility(View.VISIBLE);
}
} catch (Throwable ex) {
Log.e(Helper.TAG, "Set account color error: " + ex + "\n" + Log.getStackTraceString(ex));
diff --git a/app/src/main/java/org/dystopia/email/ViewButtonColor.java b/app/src/main/java/org/dystopia/email/ViewButtonColor.java
index 43fa6118..1d41c653 100644
--- a/app/src/main/java/org/dystopia/email/ViewButtonColor.java
+++ b/app/src/main/java/org/dystopia/email/ViewButtonColor.java
@@ -68,6 +68,7 @@ public class ViewButtonColor extends AppCompatButton {
background.setStroke(
ViewHelper.dp2px(getContext(), 1),
Helper.resolveColor(getContext(), R.attr.colorSeparator));
+ background.setCornerRadius(50);
setBackground(background);
if (color == Color.TRANSPARENT)
diff --git a/app/src/main/res/layout/fragment_account.xml b/app/src/main/res/layout/fragment_account.xml
index 61291a23..23d8d4e5 100644
--- a/app/src/main/res/layout/fragment_account.xml
+++ b/app/src/main/res/layout/fragment_account.xml
@@ -221,39 +221,34 @@
-
-
+ android:id="@+id/llContainerColor"
+ android:clickable="true"
+ android:focusable="true"
+ android:orientation="horizontal"
+ android:layout_width="fill_parent"
+ android:layout_height="fill_parent"
+ android:gravity="center"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tilPassword">
-
+ android:background="@color/colorAccent"
+ android:tag="disable" />
+ app:layout_constraintTop_toBottomOf="@id/llContainerColor" />
diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml
index 63a491a5..c9c39c14 100644
--- a/app/src/main/res/values-en/strings.xml
+++ b/app/src/main/res/values-en/strings.xml
@@ -262,4 +262,5 @@
You don\'t have identities configured yet
Reset
Color
+ Cancel
diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml
index 553dc596..2cf8a817 100644
--- a/app/src/main/res/values-es-rES/strings.xml
+++ b/app/src/main/res/values-es-rES/strings.xml
@@ -262,4 +262,7 @@
Ver detalles
Aún no tienes cuentas configuradas
Aún no tienes identidades configuradas
+ Reiniciar
+ Color
+ Cancelar
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 09b3a52d..2fe808d8 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -329,4 +329,5 @@
You don\'t have identities configured yet
Reset
Color
+ Cancel