Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(804)

Unified Diff: ui/android/java/src/org/chromium/ui/ColorPickerSimple.java

Issue 2398543003: Move Android view based ColorPicker from ui/ to components/ (Closed)
Patch Set: add owners Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
diff --git a/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java b/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
deleted file mode 100644
index 69b880ea33b199ccb57a145cab46483592354bfe..0000000000000000000000000000000000000000
--- a/ui/android/java/src/org/chromium/ui/ColorPickerSimple.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.ui;
-
-import android.content.Context;
-import android.graphics.Color;
-import android.util.AttributeSet;
-import android.widget.ListView;
-
-import org.chromium.ui.ColorSuggestionListAdapter.OnColorSuggestionClickListener;
-
-/**
- * Draws a grid of (predefined) colors and allows the user to choose one of
- * those colors.
- */
-public class ColorPickerSimple extends ListView implements OnColorSuggestionClickListener {
-
- private OnColorChangedListener mOnColorChangedListener;
-
- private static final int[] DEFAULT_COLORS = {
- Color.RED,
- Color.CYAN,
- Color.BLUE,
- Color.GREEN,
- Color.MAGENTA,
- Color.YELLOW,
- Color.BLACK,
- Color.WHITE
- };
-
- private static final int[] DEFAULT_COLOR_LABEL_IDS = {
- R.string.color_picker_button_red,
- R.string.color_picker_button_cyan,
- R.string.color_picker_button_blue,
- R.string.color_picker_button_green,
- R.string.color_picker_button_magenta,
- R.string.color_picker_button_yellow,
- R.string.color_picker_button_black,
- R.string.color_picker_button_white
- };
-
- public ColorPickerSimple(Context context) {
- super(context);
- }
-
- public ColorPickerSimple(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public ColorPickerSimple(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- /**
- * Initializes the listener and sets the adapter for the given list of suggestions. If the
- * suggestions is null a default set of colors will be used.
- *
- * @param suggestions The list of suggestions that should be displayed.
- * @param onColorChangedListener The listener that gets notified when the user touches
- * a color.
- */
- public void init(ColorSuggestion[] suggestions,
- OnColorChangedListener onColorChangedListener) {
- mOnColorChangedListener = onColorChangedListener;
-
- if (suggestions == null) {
- suggestions = new ColorSuggestion[DEFAULT_COLORS.length];
- for (int i = 0; i < suggestions.length; ++i) {
- suggestions[i] = new ColorSuggestion(DEFAULT_COLORS[i],
- getContext().getString(DEFAULT_COLOR_LABEL_IDS[i]));
- }
- }
-
- ColorSuggestionListAdapter adapter = new ColorSuggestionListAdapter(
- getContext(), suggestions);
- adapter.setOnColorSuggestionClickListener(this);
- setAdapter(adapter);
- }
-
- @Override
- public void onColorSuggestionClick(ColorSuggestion suggestion) {
- mOnColorChangedListener.onColorChanged(suggestion.mColor);
- }
-}

Powered by Google App Engine
This is Rietveld 408576698