Skip to content

Commit 3d24797

Browse files
committed
Make custom color picker responsive
Add wide layout for 600dp width.
1 parent edd1442 commit 3d24797

File tree

4 files changed

+569
-262
lines changed

4 files changed

+569
-262
lines changed
Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
Copyright 2018-2022 Pranav Pandey
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
15+
limitations under the License.
16+
-->
17+
18+
<LinearLayout
19+
xmlns:android="http://schemas.android.com/apk/res/android"
20+
xmlns:app="http://schemas.android.com/apk/res-auto"
21+
xmlns:tools="http://schemas.android.com/tools"
22+
android:id="@+id/ads_color_picker_custom"
23+
android:layout_width="match_parent"
24+
android:layout_height="wrap_content"
25+
android:layout_marginTop="@dimen/ads_dialog_margin_top"
26+
android:orientation="horizontal"
27+
android:baselineAligned="false">
28+
29+
<LinearLayout
30+
style="?attr/ads_widgetContentRowHorizontal"
31+
android:paddingLeft="@dimen/ads_dialog_margin_horizontal"
32+
android:paddingStart="@dimen/ads_dialog_margin_horizontal"
33+
android:paddingRight="@dimen/ads_dialog_margin_horizontal"
34+
android:paddingEnd="@dimen/ads_dialog_margin_horizontal"
35+
android:baselineAligned="false">
36+
37+
<LinearLayout
38+
android:layout_width="0dp"
39+
android:layout_height="match_parent"
40+
android:layout_weight="0.3"
41+
android:layout_marginRight="@dimen/ads_margin_small"
42+
android:layout_marginEnd="@dimen/ads_margin_small"
43+
android:layout_marginBottom="@dimen/ads_margin_small"
44+
android:layout_gravity="center_horizontal"
45+
android:gravity="center_horizontal"
46+
android:orientation="vertical">
47+
48+
<LinearLayout
49+
android:layout_width="wrap_content"
50+
android:layout_height="wrap_content"
51+
android:layoutDirection="ltr"
52+
android:orientation="horizontal"
53+
tools:targetApi="jelly_bean_mr1">
54+
55+
<com.pranavpandey.android.dynamic.support.widget.DynamicTextView
56+
style="?attr/ads_textAppearanceSubtitle2Caps"
57+
android:layout_width="wrap_content"
58+
android:layout_height="wrap_content"
59+
android:textSize="@dimen/ads_picker_font_size_medium"
60+
android:text="#"
61+
tools:ignore="HardcodedText,TextViewEdits" />
62+
63+
<com.pranavpandey.android.dynamic.support.widget.DynamicEditText
64+
android:id="@+id/ads_color_picker_edit"
65+
android:layout_width="wrap_content"
66+
android:layout_height="wrap_content"
67+
android:maxWidth="@dimen/ads_icon_big"
68+
android:nextFocusUp="@id/ads_color_picker_edit"
69+
android:nextFocusLeft="@id/ads_color_picker_edit"
70+
android:textSize="@dimen/ads_picker_font_size_medium"
71+
android:inputType="text|textCapCharacters|textNoSuggestions"
72+
android:digits="0123456789abcdefABCDEF"
73+
android:maxLines="@integer/ads_text_single_line" />
74+
75+
</LinearLayout>
76+
77+
<LinearLayout
78+
android:layout_width="match_parent"
79+
android:layout_height="match_parent"
80+
android:layout_marginTop="@dimen/ads_margin_small"
81+
android:orientation="horizontal">
82+
83+
<com.pranavpandey.android.dynamic.support.picker.color.view.DynamicColorView
84+
style="?attr/ads_widgetColorView"
85+
android:id="@+id/ads_color_picker_color_previous"
86+
android:layout_width="0dp"
87+
android:layout_height="match_parent"
88+
android:layout_weight="1.0"
89+
android:layout_marginRight="@dimen/ads_margin_extra_tiny"
90+
android:layout_marginEnd="@dimen/ads_margin_extra_tiny"
91+
app:ads_shape="rectangle"
92+
app:adt_color="@color/ads_color_default" />
93+
94+
<com.pranavpandey.android.dynamic.support.picker.color.view.DynamicColorView
95+
style="?attr/ads_widgetColorView"
96+
android:id="@+id/ads_color_picker_color"
97+
android:layout_width="0dp"
98+
android:layout_height="match_parent"
99+
android:layout_weight="1.0"
100+
android:layout_marginLeft="@dimen/ads_margin_extra_tiny"
101+
android:layout_marginStart="@dimen/ads_margin_extra_tiny"
102+
app:ads_shape="rectangle"
103+
app:adt_color="@color/ads_color_default" />
104+
105+
</LinearLayout>
106+
107+
</LinearLayout>
108+
109+
<LinearLayout
110+
style="?attr/ads_widgetContentRowVertical"
111+
android:layout_width="0dp"
112+
android:layout_weight="0.7"
113+
android:layout_marginLeft="@dimen/ads_margin_small"
114+
android:layout_marginStart="@dimen/ads_margin_small">
115+
116+
<com.pranavpandey.android.dynamic.support.widget.DynamicHorizontalScrollView
117+
style="?attr/ads_widgetScrollerNestedHorizontal">
118+
119+
<LinearLayout
120+
android:layout_width="wrap_content"
121+
android:layout_height="wrap_content"
122+
android:orientation="horizontal">
123+
124+
<com.pranavpandey.android.dynamic.support.widget.DynamicButton
125+
style="?attr/ads_widgetButtonTextSmall"
126+
android:id="@+id/ads_color_picker_button_all"
127+
android:layout_width="wrap_content"
128+
android:layout_height="wrap_content"
129+
android:text="@string/ads_picker_all"
130+
app:adt_colorType="primary" />
131+
132+
<com.pranavpandey.android.dynamic.support.widget.DynamicButton
133+
style="?attr/ads_widgetButtonTextSmall"
134+
android:id="@+id/ads_color_picker_button_hsv"
135+
android:layout_width="wrap_content"
136+
android:layout_height="wrap_content"
137+
android:text="@string/ads_picker_hsv"
138+
app:adt_colorType="primary" />
139+
140+
<com.pranavpandey.android.dynamic.support.widget.DynamicButton
141+
style="?attr/ads_widgetButtonTextSmall"
142+
android:id="@+id/ads_color_picker_button_rgb"
143+
android:layout_width="wrap_content"
144+
android:layout_height="wrap_content"
145+
android:text="@string/ads_picker_rgb"
146+
app:adt_colorType="primary" />
147+
148+
<com.pranavpandey.android.dynamic.support.widget.DynamicButton
149+
style="?attr/ads_widgetButtonTextSmall"
150+
android:id="@+id/ads_color_picker_button_cmyk"
151+
android:layout_width="wrap_content"
152+
android:layout_height="wrap_content"
153+
android:text="@string/ads_picker_cmyk"
154+
app:adt_colorType="primary" />
155+
156+
</LinearLayout>
157+
158+
</com.pranavpandey.android.dynamic.support.widget.DynamicHorizontalScrollView>
159+
160+
<com.pranavpandey.android.dynamic.support.widget.DynamicDivider
161+
style="?attr/ads_widgetDividerLarge" />
162+
163+
<LinearLayout
164+
style="?attr/ads_widgetContentRowVertical"
165+
android:id="@+id/ads_color_picker_view_hsv">
166+
167+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderHue
168+
android:id="@+id/ads_color_picker_slider_hue"
169+
android:layout_width="match_parent"
170+
android:layout_height="wrap_content"
171+
app:ads_title="H"
172+
app:ads_min="0"
173+
app:ads_max="360"
174+
app:ads_interval="1" />
175+
176+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
177+
android:id="@+id/ads_color_picker_slider_saturation"
178+
android:layout_width="match_parent"
179+
android:layout_height="wrap_content"
180+
app:ads_title="S"
181+
app:ads_min="0"
182+
app:ads_max="100"
183+
app:ads_interval="1" />
184+
185+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
186+
android:id="@+id/ads_color_picker_slider_value"
187+
android:layout_width="match_parent"
188+
android:layout_height="wrap_content"
189+
app:ads_title="V"
190+
app:ads_min="0"
191+
app:ads_max="100"
192+
app:ads_interval="1" />
193+
194+
</LinearLayout>
195+
196+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
197+
android:id="@+id/ads_color_picker_slider_alpha"
198+
android:layout_width="match_parent"
199+
android:layout_height="wrap_content"
200+
app:ads_title="A"
201+
app:ads_min="0"
202+
app:ads_max="255"
203+
app:ads_interval="1" />
204+
205+
<LinearLayout
206+
style="?attr/ads_widgetContentRowVertical"
207+
android:id="@+id/ads_color_picker_view_rgb">
208+
209+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
210+
android:id="@+id/ads_color_picker_slider_red"
211+
android:layout_width="match_parent"
212+
android:layout_height="wrap_content"
213+
app:ads_title="R"
214+
app:ads_min="0"
215+
app:ads_max="255"
216+
app:ads_interval="1" />
217+
218+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
219+
android:id="@+id/ads_color_picker_slider_green"
220+
android:layout_width="match_parent"
221+
android:layout_height="wrap_content"
222+
app:ads_title="G"
223+
app:ads_min="0"
224+
app:ads_max="255"
225+
app:ads_interval="1" />
226+
227+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
228+
android:id="@+id/ads_color_picker_slider_blue"
229+
android:layout_width="match_parent"
230+
android:layout_height="wrap_content"
231+
app:ads_title="B"
232+
app:ads_min="0"
233+
app:ads_max="255"
234+
app:ads_interval="1" />
235+
236+
</LinearLayout>
237+
238+
<LinearLayout
239+
style="?attr/ads_widgetContentRowVertical"
240+
android:id="@+id/ads_color_picker_view_cmyk">
241+
242+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
243+
android:id="@+id/ads_color_picker_slider_cyan"
244+
android:layout_width="match_parent"
245+
android:layout_height="wrap_content"
246+
app:ads_title="C"
247+
app:ads_min="0"
248+
app:ads_max="100"
249+
app:ads_interval="1" />
250+
251+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
252+
android:id="@+id/ads_color_picker_slider_magenta"
253+
android:layout_width="match_parent"
254+
android:layout_height="wrap_content"
255+
app:ads_title="M"
256+
app:ads_min="0"
257+
app:ads_max="100"
258+
app:ads_interval="1" />
259+
260+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
261+
android:id="@+id/ads_color_picker_slider_yellow"
262+
android:layout_width="match_parent"
263+
android:layout_height="wrap_content"
264+
app:ads_title="Y"
265+
app:ads_min="0"
266+
app:ads_max="100"
267+
app:ads_interval="1" />
268+
269+
<com.pranavpandey.android.dynamic.support.setting.DynamicSliderCompact
270+
android:id="@+id/ads_color_picker_slider_black"
271+
android:layout_width="match_parent"
272+
android:layout_height="wrap_content"
273+
app:ads_title="K"
274+
app:ads_min="0"
275+
app:ads_max="100"
276+
app:ads_interval="1" />
277+
278+
</LinearLayout>
279+
280+
</LinearLayout>
281+
282+
</LinearLayout>
283+
284+
</LinearLayout>

0 commit comments

Comments
 (0)