ControlStates sourceState = ControlState;
ControlStates targetState;
- if(isEnabled)
+ if (isEnabled)
{
- targetState = isPressed ? ControlStates.Pressed : (IsFocused ? (IsSelected ? ControlStates.SelectedFocused : ControlStates.Focused) : (IsSelected ? ControlStates.Selected : ControlStates.Normal));
+ // Normal
+ targetState = ControlStates.Normal;
+
+ // Selected
+ targetState |= (IsSelected ? ControlStates.Selected : 0);
+
+ // Pressed, PressedSelected, Focused, SelectedFocused
+ targetState |= (isPressed ? ControlStates.Pressed : (IsFocused ? ControlStates.Focused : 0));
}
else
{
- targetState = IsSelected ? ControlStates.DisabledSelected : (IsFocused ? ControlStates.DisabledFocused : ControlStates.Disabled);
+ // Disabled
+ targetState = ControlStates.Disabled;
+
+ // DisabledSelected, DisabledFocused
+ targetState |= (IsSelected ? ControlStates.Selected : (IsFocused ? ControlStates.Focused : 0));
}
if (SetControlState(targetState, touchInfo))
}
/// <summary>
- /// A Selector class that describes Buttons state by actions.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class ActionSelector<T>
- {
- /// <summary>
- /// Value used when the Button is created.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public T OnCreate { get; set; }
-
- /// <summary>
- /// Value used when the Button is selected.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public T OnSelect { get; set; }
-
- /// <summary>
- /// Value used when the Button is unselected.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public T OnUnselect { get; set; }
-
- /// <summary>
- /// Value used when the Button is disabled.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public T OnDisable { get; set; }
-
- /// <summary>
- /// Value used when the Button is disabled in selected state.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public T OnDisableSelected { get; set; }
-
- /// <summary>
- /// Value used when the Button is pressed.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public T OnPress { get; set; }
-
- /// <summary>
- /// Value used when the Button is pressed in selected state.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public T OnPressSelected { get; set; }
- }
-
- /// <summary>
/// Get current text part to the attached ButtonExtension.
/// </summary>
/// <remarks>
{
case PointStateType.Down:
ControlState = ControlStates.Pressed;
- return true;
+ break;
case PointStateType.Interrupted:
case PointStateType.Up:
if (ControlState == ControlStates.Pressed)
{
ControlState = ControlStates.Normal;
}
- return true;
+ break;
default:
break;
}
if (null != buttonText)
{
buttonText.Text = Style.Button.Text.Text.All;
- buttonText.PointSize = Style.Button.Text.PointSize?.GetValue(ControlState) ?? DefaultStyle.PointSizeNormal;
+ buttonText.PointSize = Style.Button.Text.PointSize?.GetValue(ControlState) ?? StyleManager.PointSizeNormal;
buttonTextWidth = buttonText.NaturalSize.Width;
}
float fitWidth = (Style.Button.Icon.Size?.Width ?? 48) + Style.SpaceBetweenButtonTextAndIcon + buttonTextWidth;
var lottieStyle = (ILottieButtonStyle)button.Style;
lottieView.URL = lottieStyle.LottieUrl;
lottieView.StopBehavior = LottieAnimationView.StopBehaviorType.MaximumFrame;
- lottieStyle.LottieFrameInfo.OnCreate?.Show(lottieView, true);
+ lottieStyle.PlayRange?.GetValue(ControlStates.Normal)?.Show(lottieView, true);
}
internal static void UpdateLottieView(Button button, ControlStates previousState, Touch touchInfo, LottieAnimationView lottieView)
{
- var lottieStyle = (ILottieButtonStyle)button.Style;
-
- switch (button.ControlState)
- {
- case ControlStates.Normal:
- lottieStyle.LottieFrameInfo?.OnUnselect?.Show(lottieView, previousState == ControlStates.Disabled);
- break;
-
- case ControlStates.Focused:
- lottieStyle.LottieFrameInfo?.OnUnselect?.Show(lottieView, previousState == ControlStates.DisabledFocused);
- break;
-
- case ControlStates.Selected:
- case ControlStates.SelectedFocused:
- lottieStyle.LottieFrameInfo?.OnSelect?.Show(lottieView);
- break;
-
- case ControlStates.Disabled:
- case ControlStates.DisabledFocused:
- lottieStyle.LottieFrameInfo?.OnDisable?.Show(lottieView);
- break;
-
- case ControlStates.DisabledSelected:
- lottieStyle.LottieFrameInfo?.OnDisableSelected?.Show(lottieView);
- break;
-
- case ControlStates.Pressed:
- if (button.IsSelected)
- {
- lottieStyle.LottieFrameInfo?.OnPressSelected?.Show(lottieView);
- }
- else
- {
- lottieStyle.LottieFrameInfo?.OnPress?.Show(lottieView);
- }
- break;
- }
+ ((ILottieButtonStyle)button.Style).PlayRange?.GetValue(button.ControlState)?.Show(lottieView, ((int)previousState & (int)ControlStates.Pressed) == 0);
}
}
}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default Button style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultButtonStyle : StyleBase
- {
- /// <summary>
- /// Return default Button style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- ButtonStyle style = new ButtonStyle
- {
- Size = new Size(100, 45),
- BackgroundColor = new Selector<Color>
- {
- Normal = new Color(0.88f, 0.88f, 0.88f, 1),
- Pressed = new Color(0.77f, 0.77f, 0.77f, 1),
- Disabled = new Color(0.88f, 0.88f, 0.88f, 1)
- },
- Text = new TextLabelStyle
- {
- PointSize = new Selector<float?> { All = DefaultStyle.PointSizeNormal },
- WidthResizePolicy = ResizePolicyType.FillToParent,
- HeightResizePolicy = ResizePolicyType.FillToParent,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center,
- TextColor = new Selector<Color>
- {
- Normal = new Color(0.22f, 0.22f, 0.22f, 1),
- Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
- Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
- },
- Text = "Button",
- }
- };
- return style;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default CheckBox style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultCheckBoxStyle : StyleBase
- {
- /// <summary>
- /// Return default CheckBox style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- ButtonStyle style = new ButtonStyle
- {
- Size = new Size(30, 30),
- Icon = new ImageViewStyle
- {
- WidthResizePolicy = ResizePolicyType.DimensionDependency,
- HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
- SizeModeFactor = new Vector3(1, 1, 1),
- Opacity = new Selector<float?>
- {
- Normal = 1.0f,
- Selected = 1.0f,
- Disabled = 0.4f,
- DisabledSelected = 0.4f
- },
- BackgroundImage = new Selector<string>
- {
- Normal = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_n.png"),
- Pressed = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png"),
- Selected = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png"),
- Disabled = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_n.png"),
- DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png"),
- },
- ResourceUrl = new Selector<string>
- {
- Normal = "",
- Pressed = "",
- Selected = DefaultStyle.GetResourcePath("nui_component_default_checkbox_s.png"),
- Disabled = "",
- DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_checkbox_s.png"),
- }
- },
- Text = new TextLabelStyle
- {
- PointSize = new Selector<float?> { All = DefaultStyle.PointSizeNormal },
- WidthResizePolicy = ResizePolicyType.FillToParent,
- HeightResizePolicy = ResizePolicyType.FillToParent,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center,
- TextColor = new Selector<Color>
- {
- Normal = new Color(0.22f, 0.22f, 0.22f, 1),
- Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
- Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
- }
- }
- };
- return style;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default DropDown style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultDropDownStyle : StyleBase
- {
- /// <summary>
- /// Return default DropDown style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- DropDownStyle style = new DropDownStyle
- {
- Position = new Position(50, 50),
- // WidthResizePolicy = ResizePolicyType.FitToChildren,
- // HeightResizePolicy = ResizePolicyType.FitToChildren,
- // HeaderText = new TextLabelStyle
- // {
- // Text = new Selector<string> { All = "TitleArea" },
- // PointSize = new Selector<float?> { All = 28 },
- // TextColor = new Selector<Color> { All = new Color(0, 0, 0, 1) },
- // FontFamily = "SamsungOneUI 500C",
- // },
- // BackgroundColor = new Selector<Color> { All = new Color(1, 1, 1, 1) },
-
- Button = new ButtonStyle
- {
- ParentOrigin = ParentOrigin.TopLeft,
- PivotPoint = PivotPoint.TopLeft,
- BackgroundImage = new Selector<string>
- {
- Normal = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_n.png"),
- Pressed = DefaultStyle.GetResourcePath("nui_component_default_checkbox_bg_p.png")
- },
- BackgroundImageBorder = (Rectangle)6,
- Text = new TextLabelStyle
- {
- Text = "Select an item",
- PointSize = DefaultStyle.PointSizeNormal,
- TextColor = Color.Black,
- },
- Icon = new ImageViewStyle
- {
- Size = new Size(28, 28),
- ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_dropdown_button_icon.png"),
- },
- IconRelativeOrientation = Button.IconOrientation.Right,
- IconPadding = 6,
- },
- ListBackgroundImage = new ImageViewStyle
- {
- ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_dropdown_list_bg.png"),
- Border = (Rectangle)6,
- Size = new Size(280, 360),
- },
- SpaceBetweenButtonTextAndIcon = 10,
- ListPadding = 5,
- };
- return style;
- }
- }
-
- /// <summary>
- /// The default DropDownItem style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultDropDownItemStyle : StyleBase
- {
- /// <summary>
- /// Return default DropDownItem style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- DropDownItemStyle style = new DropDownItemStyle
- {
- Size = new Size(360, 50),
- BackgroundColor = new Selector<Color>
- {
- Pressed = new Color(0.05f, 0.63f, 0.9f, 1),
- Selected = new Color(0.8f, 0.8f, 0.8f, 1),
- Normal = new Color(1, 1, 1, 1),
- },
- Text = new TextLabelStyle
- {
- PointSize = DefaultStyle.PointSizeNormal,
- Position = new Position(28, 0),
- Text = "List item",
- },
- };
- return style;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default Popup style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultPopupStyle : StyleBase
- {
- /// <summary>
- /// Return default Popup style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- PopupStyle style = new PopupStyle
- {
- Size = new Size(500, 280),
- BackgroundColor = new Color(0.9f, 0.9f, 0.9f, 1),
- ImageShadow = new ImageShadow
- {
- Url = DefaultStyle.GetResourcePath("nui_component_default_popup_shadow.png"),
- Border = new Rectangle(24, 24, 24, 24),
- Offset = new Vector2(-24, -24),
- Extents = new Vector2(48, 48),
- },
- Title = new TextLabelStyle
- {
- PointSize = 16,
- TextColor = Color.Black,
- PositionUsesPivotPoint = true,
- ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
- PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
- HorizontalAlignment = HorizontalAlignment.Begin,
- VerticalAlignment = VerticalAlignment.Bottom,
- Padding = 20,
- Text = "Title",
- },
- Buttons = new ButtonStyle
- {
- Size = new Size(0, 80),
- PositionUsesPivotPoint = true,
- ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
- PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
- BackgroundColor = new Selector<Color>
- {
- Normal = new Color(1, 1, 1, 1),
- Pressed = new Color(1, 1, 1, 0.5f),
- },
- Overlay = new ImageViewStyle
- {
- PositionUsesPivotPoint = true,
- ParentOrigin = Tizen.NUI.ParentOrigin.Center,
- PivotPoint = Tizen.NUI.PivotPoint.Center,
- WidthResizePolicy = ResizePolicyType.FillToParent,
- HeightResizePolicy = ResizePolicyType.FillToParent,
- BackgroundColor = new Selector<Color>
- {
- Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f),
- Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f),
- Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
- }
- },
- Text = new TextLabelStyle
- {
- PositionUsesPivotPoint = true,
- ParentOrigin = Tizen.NUI.ParentOrigin.Center,
- PivotPoint = Tizen.NUI.PivotPoint.Center,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center,
- TextColor = new Color(0.05f, 0.63f, 0.9f, 1)
- },
- },
- };
- return style;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default Progress style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultProgressStyle : StyleBase
- {
- /// <summary>
- /// Return default Progress style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- ProgressStyle style = new ProgressStyle
- {
- Size = new Size(200, 5),
- Track = new ImageViewStyle
- {
- BackgroundColor = new Color(0, 0, 0, 0.1f),
- },
- Buffer = new ImageViewStyle
- {
- BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 0.3f)
- },
- Progress = new ImageViewStyle
- {
- BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1)
- },
-
- };
- return style;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default RadioButton style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultRadioButtonStyle : StyleBase
- {
- /// <summary>
- /// Return default RadioButton style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- ButtonStyle style = new ButtonStyle
- {
- Size = new Size(30, 30),
- Icon = new ImageViewStyle
- {
- WidthResizePolicy = ResizePolicyType.DimensionDependency,
- HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
- SizeModeFactor = new Vector3(1, 1, 1),
- Opacity = new Selector<float?>
- {
- Normal = 1.0f,
- Selected = 1.0f,
- Disabled = 0.4f,
- DisabledSelected = 0.4f
- },
- BackgroundImage = new Selector<string>
- {
- Normal = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_n.png"),
- Pressed = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_p.png"),
- Selected = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_s.png"),
- Disabled = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_n.png"),
- DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_radiobutton_s.png"),
- }
- },
- Text = new TextLabelStyle
- {
- PointSize = new Selector<float?> { All = DefaultStyle.PointSizeNormal },
- WidthResizePolicy = ResizePolicyType.FillToParent,
- HeightResizePolicy = ResizePolicyType.FillToParent,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center,
- TextColor = new Selector<Color>
- {
- Normal = new Color(0.22f, 0.22f, 0.22f, 1),
- Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
- Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
- }
- }
- };
- return style;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default Slider style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultSliderStyle : StyleBase
- {
- /// <summary>
- /// Return default Slider style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- SliderStyle style = new SliderStyle
- {
- Size = new Size(200, 50),
- TrackThickness = 5,
- Track = new ImageViewStyle
- {
- BackgroundColor = new Color(0, 0, 0, 0.1f),
- },
-
- Progress = new ImageViewStyle
- {
- BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
- },
-
- Thumb = new ImageViewStyle
- {
- Size = new Size(50, 50),
- ResourceUrl = DefaultStyle.GetResourcePath("nui_component_default_slider_thumb_n.png"),
- BackgroundImage = new Selector<string>
- {
- Normal = "",
- Pressed = DefaultStyle.GetResourcePath("nui_component_default_slider_thumb_bg_p.png"),
- }
- },
-
- };
- return style;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-
-using System.ComponentModel;
-
-namespace Tizen.NUI.Components
-{
- internal static class DefaultStyle
- {
- internal const float PointSizeNormal = 12;
-
- internal const float PointSizeTitle = 16;
-
- static internal string GetResourcePath(string filename)
- {
- return "/usr/share/dotnet.tizen/framework/res/" + filename;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default Switch style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultSwitchStyle : StyleBase
- {
- /// <summary>
- /// Return default Switch style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- SwitchStyle style = new SwitchStyle
- {
- Size = new Size(96, 60),
- Track = new ImageViewStyle
- {
- Size = new Size(96, 60),
- ResourceUrl = new Selector<string>
- {
- Normal = DefaultStyle.GetResourcePath("nui_component_default_switch_track_n.png"),
- Selected = DefaultStyle.GetResourcePath("nui_component_default_switch_track_s.png"),
- Disabled = DefaultStyle.GetResourcePath("nui_component_default_switch_track_d.png"),
- DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_switch_track_ds.png"),
- },
- Border = new Rectangle(30, 30, 30, 30),
- },
- Thumb = new ImageViewStyle
- {
- Size = new Size(60, 60),
- ResourceUrl = new Selector<string>
- {
- Normal = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_n.png"),
- Selected = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_n.png"),
- Disabled = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_d.png"),
- DisabledSelected = DefaultStyle.GetResourcePath("nui_component_default_switch_thumb_d.png"),
- },
- },
- Text = new TextLabelStyle
- {
- PointSize = new Selector<float?> { All = DefaultStyle.PointSizeNormal },
- WidthResizePolicy = ResizePolicyType.FillToParent,
- HeightResizePolicy = ResizePolicyType.FillToParent,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center,
- TextColor = new Selector<Color>
- {
- Normal = new Color(0.22f, 0.22f, 0.22f, 1),
- Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
- Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
- }
- },
- };
- return style;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default Tab style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultTabStyle : StyleBase
- {
- /// <summary>
- /// Return default Tab style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- TabStyle style = new TabStyle
- {
- BackgroundColor = Color.Yellow,
- Size = new Size(480, 80),
- UnderLine = new ViewStyle
- {
- Size = new Size(0, 6),
- PositionUsesPivotPoint = true,
- ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
- PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
- BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
- },
- Text = new TextLabelStyle
- {
- PointSize = DefaultStyle.PointSizeTitle,
- TextColor = new Selector<Color>
- {
- Normal = Color.Black,
- Selected = new Color(0.05f, 0.63f, 0.9f, 1),
- },
- },
- };
- return style;
- }
- }
-}
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// Interface that includes styles for all components for a default theme
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal class DefaultTheme : Theme
+ {
+ internal static Theme Instance { get; } = new DefaultTheme();
+
+ protected DefaultTheme() : base()
+ {
+ }
+
+ protected override ButtonStyle GetButtonStyle()
+ {
+ return new ButtonStyle
+ {
+ Size = new Size(100, 45),
+ BackgroundColor = new Selector<Color>
+ {
+ Normal = new Color(0.88f, 0.88f, 0.88f, 1),
+ Pressed = new Color(0.77f, 0.77f, 0.77f, 1),
+ Disabled = new Color(0.88f, 0.88f, 0.88f, 1)
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0.22f, 0.22f, 0.22f, 1),
+ Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
+ Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
+ },
+ Text = "Button",
+ }
+ };
+ }
+
+ protected override ButtonStyle GetCheckBoxStyle()
+ {
+ return new ButtonStyle
+ {
+ Size = new Size(30, 30),
+ Icon = new ImageViewStyle
+ {
+ WidthResizePolicy = ResizePolicyType.DimensionDependency,
+ HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
+ SizeModeFactor = new Vector3(1, 1, 1),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ BackgroundImage = new Selector<string>
+ {
+ Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_n.png"),
+ Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_p.png"),
+ Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_p.png"),
+ Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_n.png"),
+ DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_p.png"),
+ },
+ ResourceUrl = new Selector<string>
+ {
+ Normal = "",
+ Pressed = "",
+ Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_s.png"),
+ Disabled = "",
+ DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_s.png"),
+ }
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0.22f, 0.22f, 0.22f, 1),
+ Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
+ Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
+ }
+ }
+ };
+ }
+
+ protected override DropDownStyle GetDropDownStyle()
+ {
+ return new DropDownStyle
+ {
+ Position = new Position(50, 50),
+ Button = new ButtonStyle
+ {
+ ParentOrigin = ParentOrigin.TopLeft,
+ PivotPoint = PivotPoint.TopLeft,
+ BackgroundImage = new Selector<string>
+ {
+ Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_n.png"),
+ Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_checkbox_bg_p.png")
+ },
+ BackgroundImageBorder = (Rectangle)6,
+ Text = new TextLabelStyle
+ {
+ Text = "Select an item",
+ PointSize = StyleManager.PointSizeNormal,
+ TextColor = Color.Black,
+ },
+ Icon = new ImageViewStyle
+ {
+ Size = new Size(28, 28),
+ ResourceUrl = StyleManager.GetFrameworkResourcePath("nui_component_default_dropdown_button_icon.png"),
+ },
+ IconRelativeOrientation = Button.IconOrientation.Right,
+ IconPadding = 6,
+ },
+ ListBackgroundImage = new ImageViewStyle
+ {
+ ResourceUrl = StyleManager.GetFrameworkResourcePath("nui_component_default_dropdown_list_bg.png"),
+ Border = (Rectangle)6,
+ Size = new Size(280, 360),
+ },
+ SpaceBetweenButtonTextAndIcon = 10,
+ ListPadding = 5,
+ };
+ }
+
+ protected override PopupStyle GetPopupStyle()
+ {
+ return new PopupStyle
+ {
+ Size = new Size(500, 280),
+ BackgroundColor = new Color(0.9f, 0.9f, 0.9f, 1),
+ ImageShadow = new ImageShadow
+ {
+ Url = StyleManager.GetFrameworkResourcePath("nui_component_default_popup_shadow.png"),
+ Border = new Rectangle(24, 24, 24, 24),
+ Offset = new Vector2(-24, -24),
+ Extents = new Vector2(48, 48),
+ },
+ Title = new TextLabelStyle
+ {
+ PointSize = 16,
+ TextColor = Color.Black,
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.TopLeft,
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ VerticalAlignment = VerticalAlignment.Bottom,
+ Padding = 20,
+ Text = "Title",
+ },
+ Buttons = new ButtonStyle
+ {
+ Size = new Size(0, 80),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+ BackgroundColor = new Selector<Color>
+ {
+ Normal = new Color(1, 1, 1, 1),
+ Pressed = new Color(1, 1, 1, 0.5f),
+ },
+ Overlay = new ImageViewStyle
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ BackgroundColor = new Selector<Color>
+ {
+ Normal = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+ Pressed = new Color(0.0f, 0.0f, 0.0f, 0.1f),
+ Selected = new Color(1.0f, 1.0f, 1.0f, 1.0f),
+ }
+ },
+ Text = new TextLabelStyle
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Color(0.05f, 0.63f, 0.9f, 1)
+ },
+ },
+ };
+ }
+
+ protected override ProgressStyle GetProgressStyle()
+ {
+ return new ProgressStyle
+ {
+ Size = new Size(200, 5),
+ Track = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0, 0, 0, 0.1f),
+ },
+ Buffer = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 0.3f)
+ },
+ Progress = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1)
+ },
+ };
+ }
+
+ protected override ButtonStyle GetRadioButtonStyle()
+ {
+ return new ButtonStyle
+ {
+ Size = new Size(30, 30),
+ Icon = new ImageViewStyle
+ {
+ WidthResizePolicy = ResizePolicyType.DimensionDependency,
+ HeightResizePolicy = ResizePolicyType.SizeRelativeToParent,
+ SizeModeFactor = new Vector3(1, 1, 1),
+ Opacity = new Selector<float?>
+ {
+ Normal = 1.0f,
+ Selected = 1.0f,
+ Disabled = 0.4f,
+ DisabledSelected = 0.4f
+ },
+ BackgroundImage = new Selector<string>
+ {
+ Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_n.png"),
+ Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_p.png"),
+ Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_s.png"),
+ Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_n.png"),
+ DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_radiobutton_s.png"),
+ }
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0.22f, 0.22f, 0.22f, 1),
+ Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
+ Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
+ }
+ }
+ };
+ }
+
+ protected override SliderStyle GetSliderStyle()
+ {
+ return new SliderStyle
+ {
+ Size = new Size(200, 50),
+ TrackThickness = 5,
+ Track = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0, 0, 0, 0.1f),
+ },
+
+ Progress = new ImageViewStyle
+ {
+ BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
+ },
+
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(50, 50),
+ ResourceUrl = StyleManager.GetFrameworkResourcePath("nui_component_default_slider_thumb_n.png"),
+ BackgroundImage = new Selector<string>
+ {
+ Normal = "",
+ Pressed = StyleManager.GetFrameworkResourcePath("nui_component_default_slider_thumb_bg_p.png"),
+ }
+ },
+
+ };
+ }
+
+ protected override SwitchStyle GetSwitchStyle()
+ {
+ return new SwitchStyle
+ {
+ Size = new Size(96, 60),
+ Track = new ImageViewStyle
+ {
+ Size = new Size(96, 60),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_n.png"),
+ Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_s.png"),
+ Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_d.png"),
+ DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_track_ds.png"),
+ },
+ Border = new Rectangle(30, 30, 30, 30),
+ },
+ Thumb = new ImageViewStyle
+ {
+ Size = new Size(60, 60),
+ ResourceUrl = new Selector<string>
+ {
+ Normal = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_n.png"),
+ Selected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_n.png"),
+ Disabled = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_d.png"),
+ DisabledSelected = StyleManager.GetFrameworkResourcePath("nui_component_default_switch_thumb_d.png"),
+ },
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = new Selector<float?> { All = StyleManager.PointSizeNormal },
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(0.22f, 0.22f, 0.22f, 1),
+ Pressed = new Color(0.11f, 0.11f, 0.11f, 1),
+ Disabled = new Color(0.66f, 0.66f, 0.66f, 1)
+ }
+ },
+ };
+ }
+
+ protected override TabStyle GetTabStyle()
+ {
+ return new TabStyle
+ {
+ BackgroundColor = Color.Yellow,
+ Size = new Size(480, 80),
+ UnderLine = new ViewStyle
+ {
+ Size = new Size(0, 6),
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
+ PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
+ BackgroundColor = new Color(0.05f, 0.63f, 0.9f, 1),
+ },
+ Text = new TextLabelStyle
+ {
+ PointSize = StyleManager.PointSizeTitle,
+ TextColor = new Selector<Color>
+ {
+ Normal = Color.Black,
+ Selected = new Color(0.05f, 0.63f, 0.9f, 1),
+ },
+ },
+ };
+ }
+
+ protected override ToastStyle GetToastStyle()
+ {
+ return new ToastStyle
+ {
+ WidthResizePolicy = ResizePolicyType.FitToChildren,
+ HeightResizePolicy = ResizePolicyType.FitToChildren,
+ BackgroundColor = new Color(0, 0, 0, 0.8f),
+ Text = new TextLabelStyle()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.UseNaturalSize,
+ HeightResizePolicy = ResizePolicyType.UseNaturalSize,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ TextColor = Color.White,
+ Padding = new Extents(12, 12, 8, 8),
+ }
+ };
+ }
+ }
+}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-
-namespace Tizen.NUI.Components
-{
- /// <summary>
- /// The default Toast style
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class DefaultToastStyle : StyleBase
- {
- /// <summary>
- /// Return default Toast style
- /// </summary>
- internal protected override ViewStyle GetViewStyle()
- {
- ToastStyle style = new ToastStyle
- {
- WidthResizePolicy = ResizePolicyType.FitToChildren,
- HeightResizePolicy = ResizePolicyType.FitToChildren,
- BackgroundColor = new Color(0, 0, 0, 0.8f),
- Text = new TextLabelStyle()
- {
- PositionUsesPivotPoint = true,
- ParentOrigin = Tizen.NUI.ParentOrigin.Center,
- PivotPoint = Tizen.NUI.PivotPoint.Center,
- WidthResizePolicy = ResizePolicyType.UseNaturalSize,
- HeightResizePolicy = ResizePolicyType.UseNaturalSize,
- HorizontalAlignment = HorizontalAlignment.Center,
- VerticalAlignment = VerticalAlignment.Center,
- TextColor = Color.White,
- Padding = new Extents(12, 12, 8, 8),
- }
- };
- return style;
- }
- }
-}
using Tizen.NUI.Components;
using Tizen.NUI.Components.Extension;
-namespace Tizen.NUI.Wearable
+namespace Tizen.NUI.Components
{
/// <summary>
/// Describes Button Animation used in OneUI_Watch2.X
/// OverlayAnimationButtonExtension class is a extended ButtonExtension class that make the overlay image blinking on a Button pressed.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public class OverlayAnimationButtonExtension : ButtonExtension
+ internal class OverlayAnimationButtonExtension : ButtonExtension
{
private Animation PressAnimation { get; set; }
keyFrames.Add(0.25f, 1.0f, new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
keyFrames.Add(1.0f, 0.0f, new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut));
- PressAnimation = new Animation(400);
+ PressAnimation = new Animation(600);
PressAnimation.EndAction = Animation.EndActions.StopFinal;
PressAnimation.AnimateBetween(overlayImage, "Opacity", keyFrames);
- PressAnimation.AnimateTo(overlayImage, "Scale", new Vector3(1, 1, 1), 0, 300, new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut));
+ PressAnimation.AnimateTo(overlayImage, "Scale", new Vector3(1, 1, 1), 0, 600, new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOut));
}
if (PressAnimation.State == Animation.States.Playing)
overlayImage.CornerRadius = button.CornerRadius;
overlayImage.Background = button.Background;
overlayImage.Size = button.Size;
- overlayImage.Scale = new Vector3(0.86f, 0.86f, 1);
+ overlayImage.Scale = new Vector3(0.80f, 0.80f, 1);
overlayImage.Show();
PressAnimation.Play();
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ */
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components.Extension;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// Interface that includes styles for all components for a wearable theme
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal class WearableTheme : DefaultTheme
+ {
+ internal static new Theme Instance { get; } = new WearableTheme();
+
+ private WearableTheme() : base()
+ {
+ }
+
+ protected override ButtonStyle GetButtonStyle()
+ {
+ return new ButtonStyle
+ {
+ Size = new Size(210, 72),
+ CornerRadius = 36,
+ BackgroundColor = new Selector<Color>
+ {
+ Normal = new Color(0, 42f/255f, 77f/255f, 0.85f),
+ Pressed = new Color(0, 70f/255f, 128f/255f, 0.70f),
+ Disabled = new Color(61f/255f, 61f/255f, 61f/255f, 0.85f),
+ },
+ Text = new TextLabelStyle
+ {
+ FontFamily = "SamsungOne 700",
+ PixelSize = 28,
+ TextColor = new Selector<Color>
+ {
+ Normal = new Color(56f/255f, 164f/255f, 252f/255f, 1),
+ Pressed = new Color(56f/255f, 164f/255f, 252f/255f, 1),
+ Disabled = new Color(1, 1, 1, 0.35f),
+ },
+ Padding = new Extents(20, 20, 0, 0),
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ },
+ Opacity = new Selector<float?>
+ {
+ Other = 1.0f,
+ Pressed = 0.6f,
+ Disabled = 0.3f,
+ }
+ };
+ }
+
+ protected override ButtonStyle GetCheckBoxStyle()
+ {
+ return new LottieButtonStyle
+ {
+ LottieUrl = StyleManager.GetFrameworkResourcePath("nui_wearable_checkbox_icon.json"),
+ PlayRange = new Selector<LottieFrameInfo>
+ {
+ Selected = (0, 18),
+ Normal = (19, 36)
+ },
+ Opacity = new Selector<float?>
+ {
+ Other = 1.0f,
+ Pressed = 0.6f,
+ Disabled = 0.3f,
+ },
+ };
+ }
+
+ protected override ButtonStyle GetRadioButtonStyle()
+ {
+ return new LottieButtonStyle
+ {
+ LottieUrl = StyleManager.GetFrameworkResourcePath("nui_wearable_radiobutton_icon.json"),
+ PlayRange = new Selector<LottieFrameInfo>
+ {
+ Selected = (0, 12),
+ Normal = (13, 25)
+ },
+ Opacity = new Selector<float?>
+ {
+ Other = 1.0f,
+ Pressed = 0.6f,
+ Disabled = 0.3f,
+ },
+ };
+ }
+
+ protected override SwitchStyle GetSwitchStyle()
+ {
+ return new LottieSwitchStyle
+ {
+ LottieUrl = StyleManager.GetFrameworkResourcePath("nui_wearable_switch_icon.json"),
+ PlayRange = new Selector<LottieFrameInfo>
+ {
+ Selected = (0, 18),
+ Normal = (19, 36)
+ },
+ Opacity = new Selector<float?>
+ {
+ Other = 1.0f,
+ Pressed = 0.6f,
+ Disabled = 0.3f,
+ },
+ };
+ }
+ }
+}
public static readonly BindableProperty IsSelectedProperty = BindableProperty.Create(nameof(IsSelected), typeof(bool?), typeof(ButtonStyle), null, propertyChanged: (bindable, oldValue, newValue) =>
{
var buttonStyle = (ButtonStyle)bindable;
- buttonStyle.isSelected = (bool?)newValue;
+ if (buttonStyle.IsSelectable != null && buttonStyle.IsSelectable == true)
+ {
+ buttonStyle.isSelected = (bool?)newValue;
+ }
},
defaultValueCreator: (bindable) =>
{
/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
string LottieUrl { get; set; }
/// <summary>
- /// Get/Set LottieFrameInfo on various action states of attached Button.
+ /// Get/Set LottieFrameInfo for playing on various states of attached Button.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- Button.ActionSelector<LottieFrameInfo> LottieFrameInfo { get; set; }
+ Selector<LottieFrameInfo> PlayRange { get; set; }
}
}
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Button.ActionSelector<LottieFrameInfo> LottieFrameInfo { get; set; }
+ public Selector<LottieFrameInfo> PlayRange { get; set; }
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
}
LottieUrl = style.LottieUrl;
- LottieFrameInfo = style.LottieFrameInfo;
+ PlayRange = style.PlayRange;
}
/// <inheritdoc/>
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Button.ActionSelector<LottieFrameInfo> LottieFrameInfo { get; set; }
+ public Selector<LottieFrameInfo> PlayRange { get; set; }
/// <inheritdoc/>
[EditorBrowsable(EditorBrowsableState.Never)]
}
LottieUrl = style.LottieUrl;
- LottieFrameInfo = style.LottieFrameInfo;
+ PlayRange = style.PlayRange;
}
/// <inheritdoc/>
--- /dev/null
+/*
+ * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ *
+ */
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// Interface that includes styles for all components for a theme
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ internal abstract class Theme
+ {
+ private Dictionary<Type, ComponentStyleGetter> styleMap;
+
+ protected Theme()
+ {
+ styleMap = new Dictionary<Type, ComponentStyleGetter>();
+ styleMap.Add(typeof(Button), GetButtonStyle);
+ styleMap.Add(typeof(CheckBox), GetCheckBoxStyle);
+ styleMap.Add(typeof(DropDown), GetDropDownStyle);
+ styleMap.Add(typeof(Popup), GetPopupStyle);
+ styleMap.Add(typeof(Progress), GetProgressStyle);
+ styleMap.Add(typeof(RadioButton), GetRadioButtonStyle);
+ styleMap.Add(typeof(Slider), GetSliderStyle);
+ styleMap.Add(typeof(Switch), GetSwitchStyle);
+ styleMap.Add(typeof(Tab), GetTabStyle);
+ styleMap.Add(typeof(Toast), GetToastStyle);
+ }
+
+ internal delegate ViewStyle ComponentStyleGetter();
+
+ internal ViewStyle GetComponentStyle(Type type)
+ {
+ return styleMap.ContainsKey(type) ? styleMap[type]() : null;
+ }
+
+ internal void OverwriteComponentStyle(Type type, ComponentStyleGetter styleGetter)
+ {
+ styleMap.Add(typeof(Toast), GetToastStyle);
+ }
+
+ protected abstract ButtonStyle GetButtonStyle();
+
+ protected abstract ButtonStyle GetCheckBoxStyle();
+
+ protected abstract DropDownStyle GetDropDownStyle();
+
+ protected abstract PopupStyle GetPopupStyle();
+
+ protected abstract ProgressStyle GetProgressStyle();
+
+ protected abstract ButtonStyle GetRadioButtonStyle();
+
+ protected abstract SliderStyle GetSliderStyle();
+
+ protected abstract SwitchStyle GetSwitchStyle();
+
+ protected abstract TabStyle GetTabStyle();
+
+ protected abstract ToastStyle GetToastStyle();
+ }
+}
<ItemGroup>
<ProjectReference Include="..\Tizen.Log\Tizen.Log.csproj" />
<ProjectReference Include="..\Tizen.NUI\Tizen.NUI.csproj" />
+ <ProjectReference Include="..\Tizen.System.Information\Tizen.System.Information.csproj" />
</ItemGroup>
<ItemGroup>
/// <since_tizen> 8 </since_tizen>
public sealed class StyleManager
{
- private static readonly string defaultThemeName = "default";
- private string theme = defaultThemeName;
+ internal const float PointSizeNormal = 12;
+ internal const float PointSizeTitle = 16;
+
+ private const string defaultThemeName = "default";
+ private const string wearableThemeName = "wearable";
+
+ private string currentThemeName = defaultThemeName;
private Dictionary<string, Dictionary<string, StyleBase>> themeStyleSet = new Dictionary<string, Dictionary<string, StyleBase>>();
private Dictionary<string, StyleBase> defaultStyleSet = new Dictionary<string, StyleBase>();
+
+ /// <summary>
+ /// (Theme name, Theme instance)
+ /// </summary>
private Dictionary<string, Dictionary<Type, StyleBase>> componentStyleByTheme = new Dictionary<string, Dictionary<Type, StyleBase>>();
+
+ /// <summary>
+ /// (Theme name, Theme instance)
+ /// </summary>
+ private Dictionary<string, Theme> themeMap = new Dictionary<string, Theme>();
+
private EventHandler<ThemeChangeEventArgs> themeChangeHander;
+ private Theme currentTheme;
+
/// <summary>
/// StyleManager construct.
/// </summary>
private StyleManager()
{
+ SetInitialThemeByDeviceProfile();
}
/// <summary>
/// StyleManager static instance.
/// </summary>
/// <since_tizen> 8 </since_tizen>
- public static StyleManager Instance { get; internal set; } = new StyleManager();
+ public static StyleManager Instance { get; } = new StyleManager();
/// <summary>
/// Style theme.
{
get
{
- return theme;
+ return currentThemeName;
}
set
{
- if (theme != value)
+ if (currentThemeName != value)
{
- theme = value;
- themeChangeHander?.Invoke(null, new ThemeChangeEventArgs { CurrentTheme = theme });
+ currentThemeName = value.ToLower();
+ themeChangeHander?.Invoke(null, new ThemeChangeEventArgs { CurrentTheme = currentThemeName });
+
+ UpdateTheme();
}
}
}
/// <summary>
/// Register a style for a component to theme.
/// </summary>
- /// <param name="targetTheme">Theme</param>
+ /// <param name="targetTheme">The target theme name to register a component style. It theme should be a known one.</param>
/// <param name="component">The type of ComponentStyle</param>
- /// <param name="style">The type of style</param>
+ /// <param name="style">The derived class of StyleBase</param>
/// <since_tizen> 8 </since_tizen>
public void RegisterComponentStyle(string targetTheme, Type component, Type style)
{
throw new ArgumentException("The argument targetTheme must be specified");
}
- if (defaultThemeName.Equals(targetTheme))
+ if (!themeMap.ContainsKey(targetTheme))
{
- // Ensure default component styles have loaded before override custom default style
- LoadDefaultComponentStyle();
+ Tizen.Log.Error("NUI", "The theme name should be a known one.");
+ return;
}
if (!componentStyleByTheme.ContainsKey(targetTheme))
/// <since_tizen> 8 </since_tizen>
public ViewStyle GetComponentStyle(Type component)
{
- var currentTheme = theme;
-
- if (!componentStyleByTheme.ContainsKey(theme))
- {
- currentTheme = defaultThemeName;
- }
-
- if (defaultThemeName.Equals(currentTheme))
+ if (componentStyleByTheme.ContainsKey(currentThemeName) && componentStyleByTheme[currentThemeName].ContainsKey(component))
{
- LoadDefaultComponentStyle();
- }
-
- if (!componentStyleByTheme[currentTheme].ContainsKey(component))
- {
- return null;
+ return componentStyleByTheme[currentThemeName][component].GetViewStyle();
}
- return (componentStyleByTheme[currentTheme][component])?.GetViewStyle();
+ return currentTheme.GetComponentStyle(component);
}
/// <summary>
public string CurrentTheme;
}
- private void LoadDefaultComponentStyle()
+ internal static string GetFrameworkResourcePath(string resourceFileName)
{
- if (componentStyleByTheme.ContainsKey(defaultThemeName))
+ return "/usr/share/dotnet.tizen/framework/res/" + resourceFileName;
+ }
+
+ private void SetInitialThemeByDeviceProfile()
+ {
+ themeMap.Add(wearableThemeName, WearableTheme.Instance);
+ themeMap.Add(defaultThemeName, DefaultTheme.Instance);
+
+ currentThemeName = defaultThemeName;
+ currentTheme = DefaultTheme.Instance;
+
+ string currentProfile;
+
+ try
+ {
+ System.Information.TryGetValue<string>("tizen.org/feature/profile", out currentProfile);
+ Tizen.Log.Info("NUI", "Profile for initial theme found : " + currentProfile);
+ }
+ catch
{
+ Tizen.Log.Error("NUI", "Unknown device profile");
return;
}
- componentStyleByTheme.Add(defaultThemeName, new Dictionary<Type, StyleBase>());
-
- var defaultComponentsStyle = componentStyleByTheme[defaultThemeName];
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Button), new DefaultButtonStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.CheckBox), new DefaultCheckBoxStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.RadioButton), new DefaultRadioButtonStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Switch), new DefaultSwitchStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Progress), new DefaultProgressStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Slider), new DefaultSliderStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Toast), new DefaultToastStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Popup), new DefaultPopupStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.DropDown), new DefaultDropDownStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.DropDown.DropDownDataItem), new DefaultDropDownItemStyle());
- defaultComponentsStyle.Add(typeof(Tizen.NUI.Components.Tab), new DefaultTabStyle());
+ if (string.Equals(currentProfile, wearableThemeName))
+ {
+ currentThemeName = wearableThemeName;
+ currentTheme = WearableTheme.Instance;
+ }
+ }
+
+ private void UpdateTheme()
+ {
+ if (themeMap.ContainsKey(currentThemeName))
+ {
+ currentTheme = themeMap[currentThemeName];
+ }
+ else
+ {
+ currentTheme = DefaultTheme.Instance;
+ }
}
}
}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-
-namespace Tizen.NUI.Wearable
-{
- /// <summary>
- /// A predefined style class for Wearable buttons.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class WearableButtonStyle : ButtonStyle
- {
- /// <summary>
- /// Creates a new class instance.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public WearableButtonStyle() : base()
- {
- Size = new Size(210, 72);
- CornerRadius = 36;
- BackgroundColor = new Selector<Color>
- {
- Normal = new Color(0, 42f/255f, 77f/255f, 0.85f),
- Pressed = new Color(0, 70f/255f, 128f/255f, 0.70f),
- Disabled = new Color(61f/255f, 61f/255f, 61f/255f, 0.85f),
- };
- Text = new TextLabelStyle
- {
- FontFamily = "SamsungOne 700",
- PixelSize = 28,
- TextColor = new Selector<Color>
- {
- Normal = new Color(56f/255f, 164f/255f, 252f/255f, 1),
- Pressed = new Color(56f/255f, 164f/255f, 252f/255f, 1),
- Disabled = new Color(1, 1, 1, 0.35f),
- },
- Padding = new Extents(20, 20, 0, 0),
- VerticalAlignment = VerticalAlignment.Center,
- HorizontalAlignment = HorizontalAlignment.Center,
- };
- Opacity = new Selector<float?>
- {
- Other = 1.0f,
- Pressed = 0.6f,
- Disabled = 0.3f,
- };
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-using Tizen.NUI.Components.Extension;
-
-namespace Tizen.NUI.Wearable
-{
- /// <summary>
- /// A predefined style class for Wearable check boxes.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class WearableCheckBoxStyle : LottieButtonStyle
- {
- /// <summary>
- /// Creates a new class instance.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public WearableCheckBoxStyle() : base()
- {
- LottieUrl = WearableStyle.GetResourcePath("nui_wearable_checkbox_icon.json");
- LottieFrameInfo = new Button.ActionSelector<LottieFrameInfo>
- {
- OnSelect = (0, 18),
- OnUnselect = (19, 36)
- };
- Opacity = new Selector<float?>
- {
- Other = 1.0f,
- Pressed = 0.6f,
- Disabled = 0.3f,
- };
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-using Tizen.NUI.Components.Extension;
-
-namespace Tizen.NUI.Wearable
-{
- /// <summary>
- /// A predefined style class for Wearable radio buttons.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class WearableRadioButtonStyle : LottieButtonStyle
- {
- /// <summary>
- /// Creates a new class instance.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public WearableRadioButtonStyle() : base()
- {
- LottieUrl = WearableStyle.GetResourcePath("nui_wearable_radiobutton_icon.json");
- LottieFrameInfo = new Button.ActionSelector<LottieFrameInfo>
- {
- OnSelect = (0, 12),
- OnUnselect = (13, 25)
- };
- Opacity = new Selector<float?>
- {
- Other = 1.0f,
- Pressed = 0.6f,
- Disabled = 0.3f,
- };
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-
-namespace Tizen.NUI.Wearable
-{
- /// <summary>
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class WearableStyle
- {
- static internal string GetResourcePath(string filename)
- {
- return "/usr/share/dotnet.tizen/framework/res/" + filename;
- }
- }
-}
+++ /dev/null
-/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
- *
- * 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.
- *
- */
-using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-using Tizen.NUI.Components.Extension;
-
-namespace Tizen.NUI.Wearable
-{
- /// <summary>
- /// A predefined style class for Wearable switches.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class WearableSwitchStyle : LottieSwitchStyle
- {
- /// <summary>
- /// Creates a new class instance.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public WearableSwitchStyle() : base()
- {
- LottieUrl = WearableStyle.GetResourcePath("nui_wearable_switch_icon.json");
- LottieFrameInfo = new Button.ActionSelector<LottieFrameInfo>
- {
- OnSelect = (0, 18),
- OnUnselect = (19, 36)
- };
- Opacity = new Selector<float?>
- {
- Other = 1.0f,
- Pressed = 0.6f,
- Disabled = 0.3f,
- };
- }
- }
-}
}
lottieView.SetMinMaxFrame(StartFrame, Math.Min(EndFrame, lottieView.TotalFrame - 1));
- lottieView.CurrentFrame = StartFrame;
- if (!noPlay && !IsStillImage())
+ if (IsStillImage() || noPlay)
{
+ lottieView.CurrentFrame = EndFrame;
+ }
+ else
+ {
+ lottieView.CurrentFrame = StartFrame;
lottieView.Play();
}
}
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- Normal,
+ Normal = 0,
/// <summary>
/// The focused state.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- Focused,
+ Focused = 1,
/// <summary>
/// The disabled state.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- Disabled,
+ Disabled = 2,
/// <summary>
/// The Selected state.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- Selected,
+ Selected = 4,
/// <summary>
/// The Pressed state.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- Pressed,
+ Pressed = 8,
/// <summary>
/// The DisabledFocused state.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- DisabledFocused,
+ DisabledFocused = Disabled | Focused,
/// <summary>
/// The SelectedFocused state.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- SelectedFocused,
+ SelectedFocused = Focused | Selected,
/// <summary>
/// The DisabledSelected state.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- DisabledSelected,
+ DisabledSelected = Disabled | Selected,
/// <summary>
- /// Max all.
+ /// The SelectedPressed state.
/// </summary>
/// <since_tizen> 6 </since_tizen>
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
- Max
+ PressedSelected = Pressed | Selected,
}
}
get;
set;
}
+
+ /// <summary>
+ /// PressedSelected State.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public T PressedSelected
+ {
+ get;
+ set;
+ }
+
/// <summary>
/// Other State.
/// </summary>
case ControlStates.Selected:
return Selected != null? Selected : Other;
case ControlStates.DisabledFocused:
- return DisabledFocused != null? DisabledFocused : Other;
+ return DisabledFocused != null? DisabledFocused : (Disabled != null ? Disabled : Other);
case ControlStates.DisabledSelected:
return DisabledSelected != null ? DisabledSelected : (Disabled != null ? Disabled : Other);
case ControlStates.SelectedFocused:
return SelectedFocused != null ? SelectedFocused : (Selected != null ? Selected : Other);
+ case ControlStates.PressedSelected:
+ return PressedSelected != null ? PressedSelected : (Selected != null ? Selected : Other);
default:
return Other;
}
DisabledSelected = selector.DisabledSelected;
DisabledFocused = selector.DisabledFocused;
SelectedFocused = selector.SelectedFocused;
+ PressedSelected = selector.PressedSelected;
Other = selector.Other;
}
DisabledSelected = (T)(other.DisabledSelected)?.Clone();
DisabledFocused = (T)(other.DisabledFocused)?.Clone();
SelectedFocused = (T)(other.SelectedFocused)?.Clone();
+ PressedSelected = (T)(other.PressedSelected)?.Clone();
Other = (T)(other.Other)?.Clone();
}
}
static View() {}
- private ViewStyle viewStyle;
+ /// <summary>
+ /// The Style instance binded with this View.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ protected ViewStyle viewStyle;
+
/// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public ViewStyle ViewStyle