update checkbox resources; support fixed layoutWidth, layoutHeight
|
@ -1,65 +1,38 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Copyright (C) 2011 The Android Open Source Project
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
<!-- Enabled states -->
|
<!-- Enabled states -->
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_window_focused="false"
|
|
||||||
android:state_enabled="true"
|
|
||||||
android:drawable="@drawable/btn_check_on_holo_light" />
|
|
||||||
<item android:state_checked="false" android:state_window_focused="false"
|
|
||||||
android:state_enabled="true"
|
|
||||||
android:drawable="@drawable/btn_check_off_holo_light" />
|
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_pressed="true"
|
<item android:state_checked="true" android:state_pressed="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_on_pressed_holo_light" />
|
android:drawable="@drawable/btn_check_on_pressed" />
|
||||||
<item android:state_checked="false" android:state_pressed="true"
|
<item android:state_checked="false" android:state_pressed="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_off_pressed_holo_light" />
|
android:drawable="@drawable/btn_check_off_pressed" />
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_focused="true"
|
<item android:state_checked="true" android:state_focused="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_on_focused_holo_light" />
|
android:drawable="@drawable/btn_check_on_focused" />
|
||||||
<item android:state_checked="false" android:state_focused="true"
|
<item android:state_checked="false" android:state_focused="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_off_focused_holo_light" />
|
android:drawable="@drawable/btn_check_off_focused" />
|
||||||
|
|
||||||
<item android:state_checked="false"
|
<item android:state_checked="false"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_off_holo_light" />
|
android:drawable="@drawable/btn_check_off" />
|
||||||
<item android:state_checked="true"
|
<item android:state_checked="true"
|
||||||
android:state_enabled="true"
|
android:state_enabled="true"
|
||||||
android:drawable="@drawable/btn_check_on_holo_light" />
|
android:drawable="@drawable/btn_check_on" />
|
||||||
|
|
||||||
|
|
||||||
<!-- Disabled states -->
|
<!-- Disabled states -->
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_window_focused="false"
|
<item android:state_checked="true"
|
||||||
android:drawable="@drawable/btn_check_on_disabled_holo_light" />
|
android:drawable="@drawable/btn_check_on_disabled" />
|
||||||
<item android:state_checked="false" android:state_window_focused="false"
|
<item android:state_checked="false"
|
||||||
android:drawable="@drawable/btn_check_off_disabled_holo_light" />
|
android:drawable="@drawable/btn_check_off_disabled" />
|
||||||
|
|
||||||
<item android:state_checked="true" android:state_focused="true"
|
<item android:state_checked="false" android:drawable="@drawable/btn_check_off" />
|
||||||
android:drawable="@drawable/btn_check_on_disabled_focused_holo_light" />
|
<item android:state_checked="true" android:drawable="@drawable/btn_check_on" />
|
||||||
<item android:state_checked="false" android:state_focused="true"
|
|
||||||
android:drawable="@drawable/btn_check_off_disabled_focused_holo_light" />
|
|
||||||
|
|
||||||
<item android:state_checked="false" android:drawable="@drawable/btn_check_off_disabled_holo_light" />
|
|
||||||
<item android:state_checked="true" android:drawable="@drawable/btn_check_on_disabled_holo_light" />
|
|
||||||
|
|
||||||
</selector>
|
</selector>
|
||||||
|
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!-- Copyright (C) 2011 The Android Open Source Project
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<!-- Enabled states -->
|
||||||
|
|
||||||
|
<item android:state_checked="true" android:state_window_focused="false"
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:drawable="@drawable/btn_check_on_holo_light" />
|
||||||
|
<item android:state_checked="false" android:state_window_focused="false"
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:drawable="@drawable/btn_check_off_holo_light" />
|
||||||
|
|
||||||
|
<item android:state_checked="true" android:state_pressed="true"
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:drawable="@drawable/btn_check_on_pressed_holo_light" />
|
||||||
|
<item android:state_checked="false" android:state_pressed="true"
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:drawable="@drawable/btn_check_off_pressed_holo_light" />
|
||||||
|
|
||||||
|
<item android:state_checked="true" android:state_focused="true"
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:drawable="@drawable/btn_check_on_focused_holo_light" />
|
||||||
|
<item android:state_checked="false" android:state_focused="true"
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:drawable="@drawable/btn_check_off_focused_holo_light" />
|
||||||
|
|
||||||
|
<item android:state_checked="false"
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:drawable="@drawable/btn_check_off_holo_light" />
|
||||||
|
<item android:state_checked="true"
|
||||||
|
android:state_enabled="true"
|
||||||
|
android:drawable="@drawable/btn_check_on_holo_light" />
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Disabled states -->
|
||||||
|
|
||||||
|
<item android:state_checked="true" android:state_window_focused="false"
|
||||||
|
android:drawable="@drawable/btn_check_on_disabled_holo_light" />
|
||||||
|
<item android:state_checked="false" android:state_window_focused="false"
|
||||||
|
android:drawable="@drawable/btn_check_off_disabled_holo_light" />
|
||||||
|
|
||||||
|
<item android:state_checked="true" android:state_focused="true"
|
||||||
|
android:drawable="@drawable/btn_check_on_disabled_focused_holo_light" />
|
||||||
|
<item android:state_checked="false" android:state_focused="true"
|
||||||
|
android:drawable="@drawable/btn_check_off_disabled_focused_holo_light" />
|
||||||
|
|
||||||
|
<item android:state_checked="false" android:drawable="@drawable/btn_check_off_disabled_holo_light" />
|
||||||
|
<item android:state_checked="true" android:drawable="@drawable/btn_check_on_disabled_holo_light" />
|
||||||
|
|
||||||
|
</selector>
|
After Width: | Height: | Size: 360 B |
After Width: | Height: | Size: 241 B |
After Width: | Height: | Size: 353 B |
After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 514 B |
After Width: | Height: | Size: 376 B |
After Width: | Height: | Size: 516 B |
After Width: | Height: | Size: 528 B |
|
@ -49,7 +49,6 @@ immutable int SIZE_UNSPECIFIED = int.max;
|
||||||
immutable uint TEXT_FLAGS_UNSPECIFIED = uint.max;
|
immutable uint TEXT_FLAGS_UNSPECIFIED = uint.max;
|
||||||
/// use text flags from parent widget
|
/// use text flags from parent widget
|
||||||
immutable uint TEXT_FLAGS_USE_PARENT = uint.max - 1;
|
immutable uint TEXT_FLAGS_USE_PARENT = uint.max - 1;
|
||||||
|
|
||||||
/// layout option, to occupy all available place
|
/// layout option, to occupy all available place
|
||||||
immutable int FILL_PARENT = int.max - 1;
|
immutable int FILL_PARENT = int.max - 1;
|
||||||
/// layout option, for size based on content
|
/// layout option, for size based on content
|
||||||
|
@ -57,6 +56,11 @@ immutable int WRAP_CONTENT = int.max - 2;
|
||||||
/// to take layout weight from parent
|
/// to take layout weight from parent
|
||||||
immutable int WEIGHT_UNSPECIFIED = -1;
|
immutable int WEIGHT_UNSPECIFIED = -1;
|
||||||
|
|
||||||
|
/// returns true for WRAP_CONTENT, WRAP_CONTENT, SIZE_UNSPECIFIED
|
||||||
|
bool isSpecialSize(int sz) {
|
||||||
|
return sz >= WRAP_CONTENT;
|
||||||
|
}
|
||||||
|
|
||||||
/// Align option bit constants
|
/// Align option bit constants
|
||||||
enum Align : ubyte {
|
enum Align : ubyte {
|
||||||
/// alignment is not specified
|
/// alignment is not specified
|
||||||
|
|
|
@ -1056,6 +1056,13 @@ class Widget {
|
||||||
// summarize margins, padding, and content size
|
// summarize margins, padding, and content size
|
||||||
int dx = m.left + m.right + p.left + p.right + contentWidth;
|
int dx = m.left + m.right + p.left + p.right + contentWidth;
|
||||||
int dy = m.top + m.bottom + p.top + p.bottom + contentHeight;
|
int dy = m.top + m.bottom + p.top + p.bottom + contentHeight;
|
||||||
|
// check for fixed size set in layoutWidth, layoutHeight
|
||||||
|
int lh = layoutHeight;
|
||||||
|
int lw = layoutWidth;
|
||||||
|
if (!isSpecialSize(lh))
|
||||||
|
dy = lh;
|
||||||
|
if (!isSpecialSize(lw))
|
||||||
|
dx = lw;
|
||||||
// apply min/max width and height constraints
|
// apply min/max width and height constraints
|
||||||
int minw = minWidth;
|
int minw = minWidth;
|
||||||
int maxw = maxWidth;
|
int maxw = maxWidth;
|
||||||
|
|