Skip to content

Commit

Permalink
Move Android view based ColorPicker from ui/ to components/
Browse files Browse the repository at this point in the history
BUG=651988

Review-Url: https://codereview.chromium.org/2398543003
Cr-Commit-Position: refs/heads/master@{#431088}
  • Loading branch information
wychen authored and Commit bot committed Nov 10, 2016
1 parent 111790e commit b387f65
Show file tree
Hide file tree
Showing 27 changed files with 102 additions and 79 deletions.
1 change: 1 addition & 0 deletions components/OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ per-file supervised_user_error_page_strings.grdp=file://components/supervised_us
per-file sync_ui_strings.grdp=file://components/sync/OWNERS
per-file translate_strings.grdp=file://components/translate/OWNERS
per-file undo_strings.grdp=file://components/undo/OWNERS
per-file web_contents_delegate_android_strings.grdp=file://components/web_contents_delegate_android/OWNERS
per-file *.isolate=maruel@chromium.org
per-file *.isolate=tandrii@chromium.org
per-file *.isolate=vadimsh@chromium.org
Expand Down
1 change: 1 addition & 0 deletions components/components_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@
<part file="translate_strings.grdp" />
<part file="undo_strings.grdp" />
<part file="version_ui_strings.grdp" />
<part file="web_contents_delegate_android_strings.grdp" />

<!-- Generic terms -->
<message name="IDS_CANCEL" desc="Used for Cancel on buttons">
Expand Down
11 changes: 11 additions & 0 deletions components/web_contents_delegate_android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ static_library("web_contents_delegate_android") {
android_resources("web_contents_delegate_android_java_resources") {
custom_package = "org.chromium.components.web_contents_delegate_android"
resource_dirs = [ "android/java/res" ]
deps = [
"//components/strings:components_strings_grd",
]
}

android_library("web_contents_delegate_android_java") {
Expand All @@ -44,8 +47,16 @@ android_library("web_contents_delegate_android_java") {
]
java_files = [
"android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/ColorPickerAdvanced.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/ColorPickerAdvancedComponent.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/ColorPickerDialog.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/ColorPickerMoreButton.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/ColorPickerSimple.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/ColorSuggestion.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/ColorSuggestionListAdapter.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/ValidationMessageBubble.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java",
"android/java/src/org/chromium/components/web_contents_delegate_android/OnColorChangedListener.java",
]
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">

<org.chromium.ui.ColorPickerAdvanced
<org.chromium.components.web_contents_delegate_android.ColorPickerAdvanced
android:id="@+id/color_picker_advanced"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>

<org.chromium.ui.ColorPickerSimple
<org.chromium.components.web_contents_delegate_android.ColorPickerSimple
android:id="@+id/color_picker_simple"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand All @@ -39,7 +39,7 @@
android:background="@drawable/color_picker_border"
android:padding="1px">

<org.chromium.ui.ColorPickerMoreButton
<org.chromium.components.web_contents_delegate_android.ColorPickerMoreButton
android:id="@+id/more_colors_button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 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.
-->
<resources>
<color name="color_picker_border_color">#B0B0B0</color>
<color name="color_picker_background_color">#FFFFFF</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2016 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.
-->

<resources>
<!--
14.5 = Seekbar thumb width - border width, but it depends on the width
of the seek bar icon.
-->
<dimen name="color_picker_gradient_margin">14.5dp</dimen>
<dimen name="color_button_height">60dp</dimen>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.content.browser.ContentViewCore;
import org.chromium.ui.ColorPickerDialog;
import org.chromium.ui.ColorSuggestion;
import org.chromium.ui.OnColorChangedListener;
import org.chromium.ui.base.WindowAndroid;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.ui;
package org.chromium.components.web_contents_delegate_android;

import android.content.Context;
import android.graphics.Color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.ui;
package org.chromium.components.web_contents_delegate_android;

import android.content.Context;
import android.graphics.drawable.GradientDrawable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.ui;
package org.chromium.components.web_contents_delegate_android;

import android.app.AlertDialog;
import android.app.Dialog;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.ui;
package org.chromium.components.web_contents_delegate_android;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.ui;
package org.chromium.components.web_contents_delegate_android;

import android.content.Context;
import android.graphics.Color;
import android.util.AttributeSet;
import android.widget.ListView;

import org.chromium.ui.ColorSuggestionListAdapter.OnColorSuggestionClickListener;
import org.chromium.components.web_contents_delegate_android.ColorSuggestionListAdapter.OnColorSuggestionClickListener;

/**
* Draws a grid of (predefined) colors and allows the user to choose one of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.ui;
package org.chromium.components.web_contents_delegate_android;

/**
* Color suggestion container used to store information for each color button that will be shown in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.ui;
package org.chromium.components.web_contents_delegate_android;

import android.content.Context;
import android.graphics.Color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package org.chromium.ui;
package org.chromium.components.web_contents_delegate_android;

/**
* The callback used to indicate the user changed the color.
Expand Down
51 changes: 51 additions & 0 deletions components/web_contents_delegate_android_strings.grdp
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<grit-part>

<!-- Color picker -->
<message name="IDS_COLOR_PICKER_BUTTON_MORE" desc="Text for ColorPicker button to go to advanced view. [CHAR-LIMIT=20]" formatter_data="android_java">
More
</message>
<message name="IDS_COLOR_PICKER_HUE" desc="Label for hue slider in ColorPicker." formatter_data="android_java">
Hue
</message>
<message name="IDS_COLOR_PICKER_SATURATION" desc="Label for saturation slider in ColorPicker." formatter_data="android_java">
Saturation
</message>
<message name="IDS_COLOR_PICKER_VALUE" desc="Label for value slider in ColorPicker." formatter_data="android_java">
Value
</message>
<message name="IDS_COLOR_PICKER_BUTTON_SET" desc="Label for button in ColorPicker dialog for user to accept the currently chosen color. [CHAR-LIMIT=20]" formatter_data="android_java">
Set
</message>
<message name="IDS_COLOR_PICKER_BUTTON_CANCEL" desc="Label for button in ColorPicker dialog for user to cancel picking a color. [CHAR-LIMIT=20]" formatter_data="android_java">
Cancel
</message>
<message name="IDS_COLOR_PICKER_DIALOG_TITLE" desc="Title of ColorPicker dialog. [CHAR-LIMIT=20]" formatter_data="android_java">
Select color
</message>
<message name="IDS_COLOR_PICKER_BUTTON_RED" desc="Accessibility label for button to select the red color." formatter_data="android_java">
Red
</message>
<message name="IDS_COLOR_PICKER_BUTTON_CYAN" desc="Accessibility label for button to select the cyan color." formatter_data="android_java">
Cyan
</message>
<message name="IDS_COLOR_PICKER_BUTTON_BLUE" desc="Accessibility label for button to select the blue color." formatter_data="android_java">
Blue
</message>
<message name="IDS_COLOR_PICKER_BUTTON_GREEN" desc="Accessibility label for button to select the green color." formatter_data="android_java">
Green
</message>
<message name="IDS_COLOR_PICKER_BUTTON_MAGENTA" desc="Accessibility label for button to select the magenta color." formatter_data="android_java">
Magenta
</message>
<message name="IDS_COLOR_PICKER_BUTTON_YELLOW" desc="Accessibility label for button to select the yellow color." formatter_data="android_java">
Yellow
</message>
<message name="IDS_COLOR_PICKER_BUTTON_BLACK" desc="Accessibility label for button to select the black color." formatter_data="android_java">
Black
</message>
<message name="IDS_COLOR_PICKER_BUTTON_WHITE" desc="Accessibility label for button to select the white color." formatter_data="android_java">
White
</message>

</grit-part>
8 changes: 0 additions & 8 deletions ui/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,10 @@ android_resources("ui_java_resources") {

android_library("ui_java") {
java_files = [
"java/src/org/chromium/ui/ColorPickerAdvanced.java",
"java/src/org/chromium/ui/ColorPickerAdvancedComponent.java",
"java/src/org/chromium/ui/ColorPickerDialog.java",
"java/src/org/chromium/ui/ColorPickerMoreButton.java",
"java/src/org/chromium/ui/ColorPickerSimple.java",
"java/src/org/chromium/ui/ColorSuggestion.java",
"java/src/org/chromium/ui/ColorSuggestionListAdapter.java",
"java/src/org/chromium/ui/DropdownAdapter.java",
"java/src/org/chromium/ui/DropdownDividerDrawable.java",
"java/src/org/chromium/ui/DropdownItem.java",
"java/src/org/chromium/ui/DropdownPopupWindow.java",
"java/src/org/chromium/ui/OnColorChangedListener.java",
"java/src/org/chromium/ui/UiUtils.java",
"java/src/org/chromium/ui/VSyncMonitor.java",
"java/src/org/chromium/ui/base/ActivityWindowAndroid.java",
Expand Down
2 changes: 0 additions & 2 deletions ui/android/java/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
found in the LICENSE file.
-->
<resources>
<color name="color_picker_border_color">#B0B0B0</color>
<color name="color_picker_background_color">#FFFFFF</color>
<color name="dropdown_divider_color">#E5E5E5</color>
<color name="dropdown_dark_divider_color">#C0C0C0</color>
</resources>
Expand Down
7 changes: 0 additions & 7 deletions ui/android/java/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
found in the LICENSE file.
-->
<resources>

<!--
14.5 = Seekbar thumb width - border width, but it depends on the width
of the seek bar icon.
-->
<dimen name="color_picker_gradient_margin">14.5dp</dimen>
<dimen name="color_button_height">60dp</dimen>
<dimen name="dropdown_item_height">50dp</dimen>
<dimen name="dropdown_item_divider_height">1px</dimen>

Expand Down
47 changes: 0 additions & 47 deletions ui/android/java/strings/android_ui_strings.grd
Original file line number Diff line number Diff line change
Expand Up @@ -101,53 +101,6 @@
Failed to open selected file
</message>

<!-- Color picker -->
<message name="IDS_COLOR_PICKER_BUTTON_MORE" desc="Text for ColorPicker button to go to advanced view. [CHAR-LIMIT=20]">
More
</message>
<message name="IDS_COLOR_PICKER_HUE" desc="Label for hue slider in ColorPicker.">
Hue
</message>
<message name="IDS_COLOR_PICKER_SATURATION" desc="Label for saturation slider in ColorPicker.">
Saturation
</message>
<message name="IDS_COLOR_PICKER_VALUE" desc="Label for value slider in ColorPicker.">
Value
</message>
<message name="IDS_COLOR_PICKER_BUTTON_SET" desc="Label for button in ColorPicker dialog for user to accept the currently chosen color. [CHAR-LIMIT=20]">
Set
</message>
<message name="IDS_COLOR_PICKER_BUTTON_CANCEL" desc="Label for button in ColorPicker dialog for user to cancel picking a color. [CHAR-LIMIT=20]">
Cancel
</message>
<message name="IDS_COLOR_PICKER_DIALOG_TITLE" desc="Title of ColorPicker dialog. [CHAR-LIMIT=20]">
Select color
</message>
<message name="IDS_COLOR_PICKER_BUTTON_RED" desc="Accessibility label for button to select the red color.">
Red
</message>
<message name="IDS_COLOR_PICKER_BUTTON_CYAN" desc="Accessibility label for button to select the cyan color.">
Cyan
</message>
<message name="IDS_COLOR_PICKER_BUTTON_BLUE" desc="Accessibility label for button to select the blue color.">
Blue
</message>
<message name="IDS_COLOR_PICKER_BUTTON_GREEN" desc="Accessibility label for button to select the green color.">
Green
</message>
<message name="IDS_COLOR_PICKER_BUTTON_MAGENTA" desc="Accessibility label for button to select the magenta color.">
Magenta
</message>
<message name="IDS_COLOR_PICKER_BUTTON_YELLOW" desc="Accessibility label for button to select the yellow color.">
Yellow
</message>
<message name="IDS_COLOR_PICKER_BUTTON_BLACK" desc="Accessibility label for button to select the black color.">
Black
</message>
<message name="IDS_COLOR_PICKER_BUTTON_WHITE" desc="Accessibility label for button to select the white color.">
White
</message>

<!-- Clipboard -->
<message name="IDS_COPY_TO_CLIPBOARD_FAILURE_MESSAGE" desc="Notification for when copying to the clipboard fails. [CHAR-LIMIT=64]">
Failed to copy to the clipboard
Expand Down

0 comments on commit b387f65

Please sign in to comment.