Skip to content

Commit 0a4c1f2

Browse files
committed
Merge pull request #20 from InsanityOnABun/master
Add hex color display and entry support
2 parents a6ffb91 + ecca999 commit 0a4c1f2

File tree

5 files changed

+287
-153
lines changed

5 files changed

+287
-153
lines changed

res/layout-land/dialog_color_picker.xml

Lines changed: 78 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,79 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- Copyright (C) 2010 Daniel Nilsson
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
-->
16-
17-
<LinearLayout
18-
xmlns:android="http://schemas.android.com/apk/res/android"
19-
android:layout_width="wrap_content"
20-
android:layout_height="wrap_content"
21-
android:paddingLeft="5dp"
22-
android:paddingRight="5dp"
23-
android:orientation="horizontal">
24-
25-
<net.margaritov.preference.colorpicker.ColorPickerView
26-
android:id="@+id/color_picker_view"
27-
android:layout_width="wrap_content"
28-
android:layout_height="wrap_content"
29-
android:tag="landscape"
30-
android:layerType="software"
31-
/>
32-
33-
<LinearLayout
34-
android:layout_width="wrap_content"
35-
android:layout_height="wrap_content"
36-
android:orientation="vertical"
37-
android:layout_marginBottom="10dp">
38-
39-
<TextView
40-
android:layout_width="wrap_content"
41-
android:layout_height="wrap_content"
42-
android:text="@string/press_color_to_apply"
43-
android:gravity="center"
44-
android:layout_marginTop="6dp"
45-
android:layout_marginLeft="6dp"
46-
android:layout_marginRight="6dp"
47-
android:layout_marginBottom="5dp"
48-
android:textAppearance="?android:attr/textAppearanceSmall"
49-
/>
50-
51-
<net.margaritov.preference.colorpicker.ColorPickerPanelView
52-
android:id="@+id/old_color_panel"
53-
android:layout_width="fill_parent"
54-
android:layout_height="40dp"
55-
android:layout_weight="0.5"
56-
/>
57-
58-
<TextView
59-
android:layout_width="fill_parent"
60-
android:layout_height="wrap_content"
61-
android:text=""
62-
android:textSize="20sp"
63-
android:gravity="center"
64-
android:layout_marginTop="10dp"
65-
android:layout_marginBottom="10dp"
66-
/>
67-
68-
<net.margaritov.preference.colorpicker.ColorPickerPanelView
69-
android:id="@+id/new_color_panel"
70-
android:layout_width="fill_parent"
71-
android:layout_height="40dp"
72-
android:layout_weight="0.5"
73-
/>
74-
75-
</LinearLayout>
76-
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2010 Daniel Nilsson
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and limitations under the License.
15+
-->
16+
17+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:layout_width="wrap_content"
19+
android:layout_height="wrap_content"
20+
android:orientation="horizontal"
21+
android:paddingLeft="5dp"
22+
android:paddingRight="5dp" >
23+
24+
<net.margaritov.preference.colorpicker.ColorPickerView
25+
android:id="@+id/color_picker_view"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:layerType="software"
29+
android:tag="landscape" />
30+
31+
<LinearLayout
32+
android:layout_width="wrap_content"
33+
android:layout_height="wrap_content"
34+
android:layout_marginBottom="10dp"
35+
android:orientation="vertical" >
36+
37+
<EditText
38+
android:id="@+id/hex_val"
39+
android:layout_width="fill_parent"
40+
android:layout_height="wrap_content"
41+
android:hint="HEX"
42+
android:maxLength="7"
43+
android:visibility="gone" >
44+
</EditText>
45+
46+
<TextView
47+
android:layout_width="wrap_content"
48+
android:layout_height="wrap_content"
49+
android:layout_marginBottom="5dp"
50+
android:layout_marginLeft="6dp"
51+
android:layout_marginRight="6dp"
52+
android:layout_marginTop="6dp"
53+
android:gravity="center"
54+
android:text="@string/press_color_to_apply"
55+
android:textAppearance="?android:attr/textAppearanceSmall" />
56+
57+
<net.margaritov.preference.colorpicker.ColorPickerPanelView
58+
android:id="@+id/old_color_panel"
59+
android:layout_width="fill_parent"
60+
android:layout_height="40dp"
61+
android:layout_weight="0.5" />
62+
63+
<TextView
64+
android:layout_width="fill_parent"
65+
android:layout_height="wrap_content"
66+
android:layout_marginBottom="10dp"
67+
android:layout_marginTop="10dp"
68+
android:gravity="center"
69+
android:text=""
70+
android:textSize="20sp" />
71+
72+
<net.margaritov.preference.colorpicker.ColorPickerPanelView
73+
android:id="@+id/new_color_panel"
74+
android:layout_width="fill_parent"
75+
android:layout_height="40dp"
76+
android:layout_weight="0.5" />
77+
</LinearLayout>
78+
7779
</LinearLayout>

res/layout/dialog_color_picker.xml

Lines changed: 84 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,85 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<!-- Copyright (C) 2010 Daniel Nilsson
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
http://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
15-
-->
16-
17-
<LinearLayout
18-
xmlns:android="http://schemas.android.com/apk/res/android"
19-
android:layout_width="wrap_content"
20-
android:layout_height="wrap_content"
21-
android:paddingLeft="5dp"
22-
android:paddingRight="5dp"
23-
android:orientation="vertical">
24-
25-
<net.margaritov.preference.colorpicker.ColorPickerView
26-
android:id="@+id/color_picker_view"
27-
android:layout_width="wrap_content"
28-
android:layout_height="wrap_content"
29-
android:layout_centerHorizontal="true"
30-
android:tag="portrait"
31-
android:layerType="software"
32-
/>
33-
34-
<TextView
35-
android:layout_width="wrap_content"
36-
android:layout_height="wrap_content"
37-
android:text="@string/press_color_to_apply"
38-
android:gravity="left"
39-
android:layout_marginLeft="6dp"
40-
android:layout_marginRight="6dp"
41-
android:layout_marginBottom="5dp"
42-
android:textAppearance="?android:attr/textAppearanceSmall"
43-
/>
44-
45-
<LinearLayout
46-
android:layout_width="wrap_content"
47-
android:layout_height="40dp"
48-
android:orientation="horizontal"
49-
android:layout_below="@id/color_picker_view"
50-
android:layout_marginBottom="10dp">
51-
52-
<net.margaritov.preference.colorpicker.ColorPickerPanelView
53-
android:id="@+id/old_color_panel"
54-
android:layout_width="0px"
55-
android:layout_height="fill_parent"
56-
android:layout_weight="0.5"
57-
/>
58-
59-
<TextView
60-
android:layout_width="wrap_content"
61-
android:layout_height="fill_parent"
62-
android:text=""
63-
android:textSize="20sp"
64-
android:gravity="center"
65-
android:layout_marginLeft="10dp"
66-
android:layout_marginRight="10dp"
67-
/>
68-
69-
<net.margaritov.preference.colorpicker.ColorPickerPanelView
70-
android:id="@+id/new_color_panel"
71-
android:layout_width="0px"
72-
android:layout_height="wrap_content"
73-
android:layout_weight="0.5"
74-
/>
75-
76-
</LinearLayout>
77-
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright (C) 2010 Daniel Nilsson
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and limitations under the License.
15+
-->
16+
17+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
18+
android:layout_width="wrap_content"
19+
android:layout_height="wrap_content"
20+
android:orientation="vertical"
21+
android:paddingLeft="5dp"
22+
android:paddingRight="5dp" >
23+
24+
<net.margaritov.preference.colorpicker.ColorPickerView
25+
android:id="@+id/color_picker_view"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:layerType="software"
29+
android:tag="portrait" />
30+
31+
<LinearLayout
32+
android:id="@+id/text_hex_wrapper"
33+
android:layout_width="fill_parent"
34+
android:layout_height="wrap_content"
35+
android:layout_marginBottom="5dp"
36+
android:layout_marginLeft="6dp"
37+
android:layout_marginRight="6dp" >
38+
39+
<TextView
40+
android:layout_width="wrap_content"
41+
android:layout_height="wrap_content"
42+
android:gravity="left"
43+
android:text="@string/press_color_to_apply"
44+
android:textAppearance="?android:attr/textAppearanceSmall" />
45+
46+
<EditText
47+
android:id="@+id/hex_val"
48+
android:layout_width="0dp"
49+
android:layout_height="wrap_content"
50+
android:layout_weight="1"
51+
android:hint="HEX"
52+
android:maxLength="7"
53+
android:visibility="gone" >
54+
</EditText>
55+
</LinearLayout>
56+
57+
<LinearLayout
58+
android:layout_width="wrap_content"
59+
android:layout_height="40dp"
60+
android:layout_marginBottom="10dp"
61+
android:orientation="horizontal" >
62+
63+
<net.margaritov.preference.colorpicker.ColorPickerPanelView
64+
android:id="@+id/old_color_panel"
65+
android:layout_width="0px"
66+
android:layout_height="fill_parent"
67+
android:layout_weight="0.5" />
68+
69+
<TextView
70+
android:layout_width="wrap_content"
71+
android:layout_height="fill_parent"
72+
android:layout_marginLeft="10dp"
73+
android:layout_marginRight="10dp"
74+
android:gravity="center"
75+
android:text=""
76+
android:textSize="20sp" />
77+
78+
<net.margaritov.preference.colorpicker.ColorPickerPanelView
79+
android:id="@+id/new_color_panel"
80+
android:layout_width="0px"
81+
android:layout_height="wrap_content"
82+
android:layout_weight="0.5" />
83+
</LinearLayout>
84+
7885
</LinearLayout>

0 commit comments

Comments
 (0)