diff --git a/app/src/main/java/org/tasks/activities/BaseListSettingsActivity.java b/app/src/main/java/org/tasks/activities/BaseListSettingsActivity.java index 72080f769..39ae1ef78 100644 --- a/app/src/main/java/org/tasks/activities/BaseListSettingsActivity.java +++ b/app/src/main/java/org/tasks/activities/BaseListSettingsActivity.java @@ -123,7 +123,7 @@ public abstract class BaseListSettingsActivity extends ThemedInjectingAppCompatA @OnClick(R.id.color_row) protected void showThemePicker() { - ColorWheelPicker.Companion.newColorWheel(null, 0, selectedColor) + ColorPalettePicker.Companion.newColorPalette(null, 0, selectedColor) .show(getSupportFragmentManager(), FRAG_TAG_COLOR_PICKER); } diff --git a/app/src/main/java/org/tasks/dialogs/ColorPalettePicker.kt b/app/src/main/java/org/tasks/dialogs/ColorPalettePicker.kt index b12fbaea5..5b507cb6f 100644 --- a/app/src/main/java/org/tasks/dialogs/ColorPalettePicker.kt +++ b/app/src/main/java/org/tasks/dialogs/ColorPalettePicker.kt @@ -16,6 +16,7 @@ import org.tasks.Callback import org.tasks.R import org.tasks.billing.Inventory import org.tasks.billing.PurchaseDialog +import org.tasks.dialogs.ColorWheelPicker.Companion.newColorWheel import org.tasks.injection.DialogFragmentComponent import org.tasks.injection.InjectingDialogFragment import org.tasks.themes.ThemeAccent @@ -27,16 +28,35 @@ class ColorPalettePicker : InjectingDialogFragment() { companion object { private const val FRAG_TAG_PURCHASE = "frag_tag_purchase" + private const val FRAG_TAG_COLOR_PICKER = "frag_tag_color_picker" private const val EXTRA_PALETTE = "extra_palette" const val EXTRA_SELECTED = ColorWheelPicker.EXTRA_SELECTED + fun newColorPalette( + target: Fragment?, + rc: Int, + selected: Int + ): ColorPalettePicker { + return newColorPalette(target, rc, selected, ColorPickerAdapter.Palette.COLORS) + } + fun newColorPalette( target: Fragment?, rc: Int, palette: ColorPickerAdapter.Palette + ): ColorPalettePicker { + return newColorPalette(target, rc, 0, palette) + } + + fun newColorPalette( + target: Fragment?, + rc: Int, + selected: Int, + palette: ColorPickerAdapter.Palette ): ColorPalettePicker { val args = Bundle() args.putSerializable(EXTRA_PALETTE, palette) + args.putInt(EXTRA_SELECTED, selected) val dialog = ColorPalettePicker() dialog.setTargetFragment(target, rc) dialog.arguments = args @@ -89,6 +109,13 @@ class ColorPalettePicker : InjectingDialogFragment() { dialogBuilder .newDialog() .setView(view) + if (palette == ColorPickerAdapter.Palette.COLORS) { + builder.setNeutralButton(R.string.color_wheel) { _, _ -> + val selected = arguments?.getInt(EXTRA_SELECTED) ?: 0 + newColorWheel(targetFragment, targetRequestCode, selected) + .show(parentFragmentManager, FRAG_TAG_COLOR_PICKER) + } + } if (inventory.purchasedThemes()) { builder.setNegativeButton(android.R.string.cancel, null) } else { diff --git a/app/src/main/java/org/tasks/dialogs/ColorWheelPicker.kt b/app/src/main/java/org/tasks/dialogs/ColorWheelPicker.kt index 449c41e6a..03a0d52ff 100644 --- a/app/src/main/java/org/tasks/dialogs/ColorWheelPicker.kt +++ b/app/src/main/java/org/tasks/dialogs/ColorWheelPicker.kt @@ -14,7 +14,6 @@ import com.flask.colorpicker.builder.ColorPickerDialogBuilder import org.tasks.R import org.tasks.billing.Inventory import org.tasks.billing.PurchaseActivity -import org.tasks.dialogs.ColorPalettePicker.Companion.newColorPalette import org.tasks.injection.DialogFragmentComponent import org.tasks.injection.InjectingDialogFragment import org.tasks.ui.NavigationDrawerFragment.REQUEST_PURCHASE @@ -25,7 +24,6 @@ private const val REQUEST_PURCHASE = 10010 class ColorWheelPicker : InjectingDialogFragment() { companion object { - private const val FRAG_TAG_COLOR_PICKER = "frag_tag_color_picker" const val EXTRA_SELECTED = "extra_selected" fun newColorWheel(target: Fragment?, rc: Int, selected: Int): ColorWheelPicker { @@ -72,14 +70,10 @@ class ColorWheelPicker : InjectingDialogFragment() { startActivityForResult(Intent(activity, PurchaseActivity::class.java), REQUEST_PURCHASE) } } + .setNegativeButton(android.R.string.cancel, null) if (selected != 0) { builder.initialColor(selected) } - val buttonText = if (inventory.purchasedThemes()) R.string.material_palette else R.string.free_colors - builder.setNegativeButton(buttonText) { _, _ -> - newColorPalette(targetFragment, targetRequestCode, ColorPickerAdapter.Palette.COLORS) - .show(parentFragmentManager, FRAG_TAG_COLOR_PICKER) - } dialog = builder.build() return dialog as Dialog } diff --git a/app/src/main/java/org/tasks/preferences/fragments/LookAndFeel.kt b/app/src/main/java/org/tasks/preferences/fragments/LookAndFeel.kt index 00ea912e1..e8a0421b0 100644 --- a/app/src/main/java/org/tasks/preferences/fragments/LookAndFeel.kt +++ b/app/src/main/java/org/tasks/preferences/fragments/LookAndFeel.kt @@ -25,7 +25,6 @@ import org.tasks.dialogs.ColorPalettePicker import org.tasks.dialogs.ColorPalettePicker.Companion.newColorPalette import org.tasks.dialogs.ColorPickerAdapter import org.tasks.dialogs.ColorWheelPicker -import org.tasks.dialogs.ColorWheelPicker.Companion.newColorWheel import org.tasks.dialogs.MyTimePickerDialog.newTimePicker import org.tasks.dialogs.ThemePickerDialog import org.tasks.dialogs.ThemePickerDialog.Companion.newThemePickerDialog @@ -388,13 +387,8 @@ class LookAndFeel : InjectingPreferenceFragment(), Preference.OnPreferenceChange ) { tintColorPreference(prefId, color) findPreference(prefId).setOnPreferenceClickListener { - if (palette == ColorPickerAdapter.Palette.COLORS) { - newColorWheel(this, requestCode, color) - .show(parentFragmentManager, FRAG_TAG_COLOR_PICKER) - } else { - newColorPalette(this, requestCode, palette) - .show(parentFragmentManager, FRAG_TAG_COLOR_PICKER) - } + newColorPalette(this, requestCode, color, palette) + .show(parentFragmentManager, FRAG_TAG_COLOR_PICKER) false } } diff --git a/app/src/main/java/org/tasks/preferences/fragments/ScrollableWidget.kt b/app/src/main/java/org/tasks/preferences/fragments/ScrollableWidget.kt index 973cd2ab3..36b4d016c 100644 --- a/app/src/main/java/org/tasks/preferences/fragments/ScrollableWidget.kt +++ b/app/src/main/java/org/tasks/preferences/fragments/ScrollableWidget.kt @@ -12,7 +12,6 @@ import org.tasks.LocalBroadcastManager import org.tasks.R import org.tasks.activities.FilterSelectionActivity import org.tasks.dialogs.ColorWheelPicker -import org.tasks.dialogs.ColorWheelPicker.Companion.newColorWheel import org.tasks.dialogs.ColorPalettePicker import org.tasks.dialogs.ColorPalettePicker.Companion.newColorPalette import org.tasks.dialogs.ColorPickerAdapter @@ -89,7 +88,7 @@ class ScrollableWidget : InjectingPreferenceFragment() { val colorPreference = findPreference(R.string.p_widget_color_v2) colorPreference.dependency = showHeader.key colorPreference.onPreferenceClickListener = Preference.OnPreferenceClickListener { - newColorWheel(this, REQUEST_COLOR_SELECTION, widgetPreferences.color) + newColorPalette(this, REQUEST_COLOR_SELECTION, widgetPreferences.color) .show(parentFragmentManager, FRAG_TAG_COLOR_PICKER) false } diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 58abe77e3..7a0272edd 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -558,7 +558,5 @@ Más ajustes Tono de llamada, vibraciones y más Nombre de usuario o contraseña inválidos - Colores libres - Paleta de materiales El sistema por defecto \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index e7c31ab58..0a4939f3c 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -554,7 +554,5 @@ est configuré correctement Plus de paramètres Sonnerie, vibrations, et plus encore Nom d\'utilisateur ou mot de passe invalide - Couleurs gratuites - Palette de matériaux Défaut du système \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index c86bf854c..ca3d28ebe 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -561,7 +561,6 @@ File %1$s contained %2$s.\n\n Disable battery optimizations More settings Ringtone, vibrations, and more - Free colors - Material palette Invalid username or password + Color wheel