[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- ButtonStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as ButtonStyle;
+ ButtonStyle tempAttributes = StyleManager.Instance.GetViewStyle(style) as ButtonStyle;
if (tempAttributes != null)
{
Style.CopyFrom(tempAttributes);
--- /dev/null
+/*
+* Copyright(c) 2019 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.ComponentModel;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+using Tizen.NUI.BaseComponents;
+
+namespace Tizen.NUI.Components
+{
+ /// <summary>
+ /// ButtonGroup is a group of buttons which can be set common property<br />
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public class ButtonGroup : BindableObject, global::System.IDisposable
+ {
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemheightProperty = BindableProperty.Create(nameof(Itemheight), typeof(float), typeof(ButtonGroup), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.SizeHeight = (float)newValue;
+ }
+ btGroup.itemheight = (float)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemheight;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemPointSizeProperty = BindableProperty.Create(nameof(ItemPointSize), typeof(float), typeof(ButtonGroup), 0.0f, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Text.PointSize = (float)newValue;
+ }
+ btGroup.itemPointSize = (float)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemPointSize;
+ });
+
+ /// 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 static readonly BindableProperty ItemFontFamilyProperty = BindableProperty.Create(nameof(ItemFontFamily), typeof(string), typeof(ButtonGroup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Text.FontFamily = (string)newValue;
+ }
+ btGroup.itemFontFamily = (string)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemFontFamily;
+ });
+
+ /// 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 static readonly BindableProperty ItemTextColorProperty = BindableProperty.Create(nameof(ItemTextColor), typeof(Color), typeof(ButtonGroup), Color.Black, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Text.TextColor = (Color)newValue;
+ }
+ btGroup.itemTextColor = (Color)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemTextColor;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemTextAlignmentProperty = BindableProperty.Create(nameof(ItemTextAlignment), typeof(HorizontalAlignment), typeof(ButtonGroup), new HorizontalAlignment(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
+ }
+ btGroup.itemTextAlignment = (HorizontalAlignment)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemTextAlignment;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty OverLayBackgroundColorSelectorProperty = BindableProperty.Create(nameof(OverLayBackgroundColorSelector), typeof(Selector<Color>), typeof(ButtonGroup), new Selector<Color>(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Overlay.BackgroundColor = (Selector<Color>)newValue;
+ }
+ btGroup.overLayBackgroundColorSelector = (Selector<Color>)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.overLayBackgroundColorSelector;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemBackgroundImageUrlProperty = BindableProperty.Create(nameof(ItemBackgroundImageUrl), typeof(string), typeof(ButtonGroup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ if (btn.Style.BackgroundImage == null)
+ {
+ btn.Style.BackgroundImage = new Selector<string>();
+ }
+ btn.Style.BackgroundImage = (string)newValue;
+ }
+ btGroup.itemBackgroundImageUrl = (string)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemBackgroundImageUrl;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemBackgroundBorderProperty = BindableProperty.Create(nameof(ItemBackgroundBorder), typeof(Rectangle), typeof(ButtonGroup), new Rectangle(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.BackgroundImageBorder = (Rectangle)newValue;
+ }
+ btGroup.itemBackgroundBorder = (Rectangle)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemBackgroundBorder;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemShadowUrlProperty = BindableProperty.Create(nameof(ItemShadowUrl), typeof(string), typeof(ButtonGroup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ if (btn.Style.Shadow.ResourceUrl == null)
+ {
+ btn.Style.Shadow.ResourceUrl = new Selector<string>();
+ }
+ btn.Style.Shadow.ResourceUrl = (string)newValue;
+ }
+ btGroup.itemShadowUrl = (string)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemShadowUrl;
+ });
+
+ /// This will be public opened in tizen_5.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public static readonly BindableProperty ItemShadowBorderProperty = BindableProperty.Create(nameof(ItemShadowBorder), typeof(Rectangle), typeof(ButtonGroup), new Rectangle(), propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ if (btGroup.itemGroup != null && newValue != null)
+ {
+ foreach (Button btn in btGroup.itemGroup)
+ {
+ btn.Style.Shadow.Border = (Rectangle)newValue;
+ }
+ btGroup.itemShadowBorder = (Rectangle)newValue;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ ButtonGroup btGroup = (ButtonGroup)bindable;
+ return btGroup.itemShadowBorder;
+ });
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public ButtonGroup(View view) : base()
+ {
+ itemGroup = new List<Button>();
+ if ((root = view) == null)
+ {
+ throw new Exception("Root view is null.");
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Count
+ {
+ get
+ {
+ return itemGroup.Count;
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public bool Contains(Button bt)
+ {
+ return itemGroup.Contains(bt);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int GetIndex(Button bt)
+ {
+ return itemGroup.IndexOf(bt);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Button GetItem(int index)
+ {
+ if (index >= Count || index < 0)
+ {
+ throw new Exception("button index error");
+ }
+ return itemGroup[index];
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AddItem(Button bt)
+ {
+ if (itemGroup.Contains(bt))
+ {
+ return;
+ }
+ itemGroup.Add(bt);
+ root.Add(bt);
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveItem(Button bt)
+ {
+ if (!itemGroup.Contains(bt))
+ {
+ return;
+ }
+ itemGroup.Remove(bt);
+ root.Remove(bt);
+ bt.Dispose();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveItem(int index)
+ {
+ if (index >= Count || index < 0)
+ {
+ throw new Exception("button index error");
+ }
+ Button bt = itemGroup[index];
+ itemGroup.Remove(bt);
+ root.Remove(bt);
+ bt.Dispose();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveAll()
+ {
+ foreach (Button bt in itemGroup)
+ {
+ root.Remove(bt);
+ bt.Dispose();
+ }
+ itemGroup.Clear();
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void UpdateButton(ButtonStyle btStyle)
+ {
+ if (Count == 0) return;
+
+ int buttonWidth = (int)root.Size.Width / Count;
+ int buttonHeight = (int)itemheight;
+ foreach (Button btnTemp in itemGroup)
+ {
+ btnTemp.Size = new Size(buttonWidth, buttonHeight);
+ }
+
+ int pos = 0;
+ if (root.LayoutDirection == ViewLayoutDirectionType.RTL)
+ {
+ for (int i = Count - 1; i >= 0; i--)
+ {
+ itemGroup[i].Style.PositionX = pos;
+ pos += (int)(itemGroup[i].Size.Width);
+ }
+ }
+ else
+ {
+ for (int i = 0; i < Count; i++)
+ {
+ itemGroup[i].Style.PositionX = pos;
+ pos += (int)(itemGroup[i].Size.Width);
+ }
+ }
+
+ if (btStyle == null || btStyle.Text == null || btStyle.Text.TextColor == null) return;
+ ItemTextColor = btStyle.Text.TextColor.All;
+ }
+
+ /// <summary>
+ /// Common height for all of the Items
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float Itemheight
+ {
+ get
+ {
+ return (float)GetValue(ItemheightProperty);
+ }
+ set
+ {
+ SetValue(ItemheightProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public float ItemPointSize
+ {
+ get
+ {
+ return (float)GetValue(ItemPointSizeProperty);
+ }
+ set
+ {
+ SetValue(ItemPointSizeProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ItemFontFamily
+ {
+ get
+ {
+ return (string)GetValue(ItemFontFamilyProperty);
+ }
+ set
+ {
+ SetValue(ItemFontFamilyProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Color ItemTextColor
+ {
+ get
+ {
+ return (Color)GetValue(ItemTextColorProperty);
+ }
+ set
+ {
+ SetValue(ItemTextColorProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public HorizontalAlignment ItemTextAlignment
+ {
+ get
+ {
+ return (HorizontalAlignment)GetValue(ItemTextAlignmentProperty);
+ }
+ set
+ {
+ SetValue(ItemTextAlignmentProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Selector<Color> OverLayBackgroundColorSelector
+ {
+ get
+ {
+ return (Selector<Color>)GetValue(OverLayBackgroundColorSelectorProperty);
+ }
+ set
+ {
+ SetValue(OverLayBackgroundColorSelectorProperty, value);
+ }
+ }
+
+ /// <summary>
+ /// The mutually exclusive with "backgroundColor" and "background" type Map.
+ /// </summary>
+ /// <since_tizen> 3 </since_tizen>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ItemBackgroundImageUrl
+ {
+ get
+ {
+ return (string)GetValue(ItemBackgroundImageUrlProperty);
+ }
+ set
+ {
+ SetValue(ItemBackgroundImageUrlProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle ItemBackgroundBorder
+ {
+ get
+ {
+ return (Rectangle)GetValue(ItemBackgroundBorderProperty);
+ }
+ set
+ {
+ SetValue(ItemBackgroundBorderProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public string ItemShadowUrl
+ {
+ get
+ {
+ return (string)GetValue(ItemShadowUrlProperty);
+ }
+ set
+ {
+ SetValue(ItemShadowUrlProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle ItemShadowBorder
+ {
+ get
+ {
+ return (Rectangle)GetValue(ItemShadowBorderProperty);
+ }
+ set
+ {
+ SetValue(ItemShadowBorderProperty, value);
+ }
+ }
+
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Dispose()
+ {
+ if (disposed) return;
+ if (itemGroup != null)
+ {
+ RemoveAll();
+ itemGroup = null;
+ }
+ disposed = true;
+ }
+
+ private List<Button> itemGroup;
+ private View root = null;
+ private bool disposed = false;
+ private float itemheight;
+ private float itemPointSize;
+ private string itemFontFamily;
+ private Color itemTextColor = new Color();
+ private HorizontalAlignment itemTextAlignment;
+ private Selector<Color> overLayBackgroundColorSelector = new Selector<Color>();
+ private string itemBackgroundImageUrl;
+ private Rectangle itemBackgroundBorder = new Rectangle();
+ private string itemShadowUrl;
+ private Rectangle itemShadowBorder = new Rectangle();
+ }
+}
[EditorBrowsable(EditorBrowsableState.Never)]
public Control(string styleSheet) : base()
{
- ViewStyle viewStyle = StyleManager.Instance.GetAttributes(styleSheet);
+ ViewStyle viewStyle = StyleManager.Instance.GetViewStyle(styleSheet);
if (viewStyle == null)
{
throw new InvalidOperationException($"There is no style {styleSheet}");
StyleManager.Instance.ThemeChangedEvent += OnThemeChangedEvent;
}
-
- private ViewStyle GetAttributes(string style)
- {
- ViewStyle attributes = StyleManager.Instance.GetAttributes(style);
- if(attributes == null)
- {
- throw new InvalidOperationException($"There is no style {style}");
- }
- this.style = style;
- return attributes;
- }
}
}
{
if(style != null)
{
- ViewStyle attributes = StyleManager.Instance.GetAttributes(style);
+ ViewStyle attributes = StyleManager.Instance.GetViewStyle(style);
if(attributes == null)
{
throw new InvalidOperationException($"There is no style {style}");
}
}
+ /**
+ * Requests that the given child of the RecyclerView be positioned onto the screen. This
+ * method can be called for both unfocusable and focusable child views. For unfocusable
+ * child views, focusedChildVisible is typically true in which case, layout manager
+ * makes the child view visible only if the currently focused child stays in-bounds of RV.
+ * @param parent The parent RecyclerView.
+ * @param child The direct child making the request.
+ * @param rect The rectangle in the child's coordinates the child
+ * wishes to be on the screen.
+ * @param immediate True to forbid animated or delayed scrolling,
+ * false otherwise
+ * @param focusedChildVisible Whether the currently focused view must stay visible.
+ * @return Whether the group scrolled to handle the operation
+ */
internal bool RequestChildRectangleOnScreen(FlexibleView parent, FlexibleView.ViewHolder child, Recycler recycler, bool immediate)
{
Vector2 scrollAmount = GetChildRectangleOnScreenScrollAmount(parent, child);
/// <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)]
- public GridLayoutManager(int spanCount, Orientation orientation) : base(orientation)
+ public GridLayoutManager(int spanCount, int orientation) : base(orientation)
{
mSpanCount = spanCount;
}
- internal override void EnsureAnchorReady(FlexibleView.Recycler recycler, AnchorInfo anchorInfo, LayoutState.ItemDirectionType itemDirection)
+ internal override void EnsureAnchorReady(FlexibleView.Recycler recycler, AnchorInfo anchorInfo, int itemDirection)
{
- bool layingOutInPrimaryDirection = (itemDirection == LayoutState.ItemDirectionType.TAIL);
+ bool layingOutInPrimaryDirection = (itemDirection == LayoutState.ITEM_DIRECTION_TAIL);
int span = anchorInfo.Position % mSpanCount;
if (layingOutInPrimaryDirection)
{
[EditorBrowsable(EditorBrowsableState.Never)]
protected override int GetNextPosition(int position, FlexibleView.LayoutManager.Direction direction)
{
- if (mOrientation == Orientation.HORIZONTAL)
+ if (mOrientation == HORIZONTAL)
{
switch (direction)
{
LayoutState layoutState, LayoutChunkResult result)
{
bool layingOutInPrimaryDirection =
- layoutState.ItemDirection == LayoutState.ItemDirectionType.TAIL;
+ layoutState.ItemDirection == LayoutState.ITEM_DIRECTION_TAIL;
int count = mSpanCount;
for (int i = 0; i < count; i++)
result.Consumed = mOrientationHelper.GetViewHolderMeasurement(holder);
float left, top, width, height;
- if (mOrientation == Orientation.VERTICAL)
+ if (mOrientation == VERTICAL)
{
width = (Width - PaddingLeft - PaddingRight) / count;
height = result.Consumed;
- if (layoutState.LayoutDirection == LayoutState.Direction.END)
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
{
left = PaddingLeft + width * i;
- top = layoutState.PixOffset;
+ top = layoutState.Offset;
}
else
{
left = PaddingLeft + width * (count - 1 - i);
- top = layoutState.PixOffset - height;
+ top = layoutState.Offset - height;
}
LayoutChild(holder, left, top, width, height);
}
{
width = result.Consumed;
height = (Height - PaddingTop - PaddingBottom) / count;
- if (layoutState.LayoutDirection == LayoutState.Direction.END)
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
{
top = PaddingTop + height * i;
- left = layoutState.PixOffset;
+ left = layoutState.Offset;
}
else
{
top = PaddingTop + height * (count - 1 - i);
- left = layoutState.PixOffset - width;
+ left = layoutState.Offset - width;
}
LayoutChild(holder, left, top, width, height);
}
/// <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)]
- public enum Orientation
- {
- HORIZONTAL = 0,
- VERTICAL,
- MAX
- }
+ public static readonly int HORIZONTAL = OrientationHelper.HORIZONTAL;
+ /// <summary>
+ /// Constant value: 1.
+ /// </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)]
+ public static readonly int VERTICAL = OrientationHelper.VERTICAL;
/// <summary>
/// Constant value: -1.
/// </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)]
- protected Orientation mOrientation;
+ protected int mOrientation;
internal OrientationHelper mOrientationHelper;
/// <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)]
- public LinearLayoutManager(Orientation orientation)
+ public LinearLayoutManager(int orientation)
{
mOrientation = orientation;
-
- if (Orientation.HORIZONTAL == mOrientation)
- {
- mOrientationHelper = OrientationHelper.CreateOrientationHelper(this, OrientationHelper.Direction.HORIZONTAL);
- }
- else if (Orientation.VERTICAL == mOrientation)
- {
- mOrientationHelper = OrientationHelper.CreateOrientationHelper(this, OrientationHelper.Direction.VERTICAL);
- }
+ mOrientationHelper = OrientationHelper.CreateOrientationHelper(this, mOrientation);
mLayoutState = new LayoutState();
- mLayoutState.PixOffset = mOrientationHelper.GetStartAfterPadding();
+ mLayoutState.Offset = mOrientationHelper.GetStartAfterPadding();
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool CanScrollHorizontally()
{
- return mOrientation == Orientation.HORIZONTAL;
+ return mOrientation == HORIZONTAL;
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool CanScrollVertically()
{
- return mOrientation == Orientation.VERTICAL;
+ return mOrientation == VERTICAL;
}
/// <summary>
mAnchorInfo.Valid = true;
}
- LayoutState.ItemDirectionType firstLayoutDirection;
+ int firstLayoutDirection;
if (mAnchorInfo.LayoutFromEnd)
{
- firstLayoutDirection = mShouldReverseLayout ? LayoutState.ItemDirectionType.TAIL : LayoutState.ItemDirectionType.HEAD;
+ firstLayoutDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_TAIL
+ : LayoutState.ITEM_DIRECTION_HEAD;
}
else
{
- firstLayoutDirection = mShouldReverseLayout ? LayoutState.ItemDirectionType.HEAD : LayoutState.ItemDirectionType.TAIL;
+ firstLayoutDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD
+ : LayoutState.ITEM_DIRECTION_TAIL;
}
EnsureAnchorReady(recycler, mAnchorInfo, firstLayoutDirection);
ScrapAttachedViews(recycler);
Cache(recycler, mLayoutState, true);
UpdateLayoutStateToFillEnd(mAnchorInfo.Position, mAnchorInfo.Coordinate);
+ mLayoutState.CurrentPosition += mLayoutState.ItemDirection;
Fill(recycler, mLayoutState, false, true);
Cache(recycler, mLayoutState, true);
}
Cache(recycler, mLayoutState, true);
UpdateLayoutStateToFillStart(mAnchorInfo.Position, mAnchorInfo.Coordinate);
+ mLayoutState.CurrentPosition += mLayoutState.ItemDirection;
Fill(recycler, mLayoutState, false, true);
Cache(recycler, mLayoutState, true);
}
- switch (mLayoutState.ItemDirection)
- {
- case LayoutState.ItemDirectionType.HEAD:
- mLayoutState.CurrentPosition--;
- break;
-
- case LayoutState.ItemDirectionType.TAIL:
- mLayoutState.CurrentPosition++;
- break;
-
- default:
- mLayoutState.CurrentPosition -= 1000;
- break;
- }
-
OnLayoutCompleted();
}
[EditorBrowsable(EditorBrowsableState.Never)]
public override float ScrollHorizontallyBy(float dx, FlexibleView.Recycler recycler, bool immediate)
{
- if (mOrientation == Orientation.VERTICAL)
+ if (mOrientation == VERTICAL)
{
return 0;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public override float ScrollVerticallyBy(float dy, FlexibleView.Recycler recycler, bool immediate)
{
- if (mOrientation == Orientation.HORIZONTAL)
+ if (mOrientation == HORIZONTAL)
{
return 0;
}
mAnchorInfo.Reset();
}
- internal virtual void EnsureAnchorReady(FlexibleView.Recycler recycler, AnchorInfo anchorInfo, LayoutState.ItemDirectionType itemDirection)
+ internal virtual void EnsureAnchorReady(FlexibleView.Recycler recycler, AnchorInfo anchorInfo, int itemDirection)
{
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected override int GetNextPosition(int position, FlexibleView.LayoutManager.Direction direction)
{
- if (mOrientation == Orientation.HORIZONTAL)
+ if (mOrientation == HORIZONTAL)
{
switch (direction)
{
return;
}
- if (mShouldReverseLayout == (layoutState.LayoutDirection == LayoutState.Direction.START))
+ if (mShouldReverseLayout == (layoutState.LayoutDirection == LayoutState.LAYOUT_START))
AddView(holder);
else
AddView(holder, 0);
result.Consumed = mOrientationHelper.GetViewHolderMeasurement(holder);
float left, top, width, height;
- if (mOrientation == Orientation.VERTICAL)
+ if (mOrientation == VERTICAL)
{
width = Width - PaddingLeft - PaddingRight;
height = result.Consumed;
left = PaddingLeft;
- if (layoutState.LayoutDirection == LayoutState.Direction.END)
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
{
- top = layoutState.PixOffset;
+ top = layoutState.Offset;
}
else
{
- top = layoutState.PixOffset - height;
+ top = layoutState.Offset - height;
}
LayoutChild(holder, left, top, width, height);
}
width = result.Consumed;
height = Height - PaddingTop - PaddingBottom;
top = PaddingTop;
- if (layoutState.LayoutDirection == LayoutState.Direction.END)
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
{
- left = layoutState.PixOffset;
+ left = layoutState.Offset;
}
else
{
- left = layoutState.PixOffset - width;
+ left = layoutState.Offset - width;
}
LayoutChild(holder, left, top, width, height);
}
{
return null;
}
-
- LayoutState.Direction layoutDir = ConvertFocusDirectionToLayoutDirection(direction);
-
- if (layoutDir == LayoutState.Direction.MAX)
+ int layoutDir = ConvertFocusDirectionToLayoutDirection(direction);
+ if (layoutDir == LayoutState.INVALID_LAYOUT)
{
return null;
}
int maxScroll = (int)(MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace());
-
- FlexibleView.ViewHolder child;
- if (layoutDir == LayoutState.Direction.END)
- {
- child = GetChildClosestToEnd();
- }
- else
- {
- child = GetChildClosestToStart();
- }
-
- mLayoutState.UpdateState(layoutDir, mOrientationHelper, child, mShouldReverseLayout, maxScroll, false);
-
+ UpdateLayoutState(layoutDir, maxScroll, false);
mLayoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
-
mLayoutState.Recycle = false;
-
Fill(recycler, mLayoutState, true, true);
FlexibleView.ViewHolder nextFocus;
- if (layoutDir == LayoutState.Direction.START)
+ if (layoutDir == LayoutState.LAYOUT_START)
{
nextFocus = GetChildAt(0);
}
// or 0 for not applicable
// @return {@link LayoutState#LAYOUT_START} or {@link LayoutState#LAYOUT_END} if focus direction
// is applicable to current state, {@link LayoutState#INVALID_LAYOUT} otherwise.
- private LayoutState.Direction ConvertFocusDirectionToLayoutDirection(FlexibleView.LayoutManager.Direction focusDirection)
+ private int ConvertFocusDirectionToLayoutDirection(FlexibleView.LayoutManager.Direction focusDirection)
{
switch (focusDirection)
{
case FlexibleView.LayoutManager.Direction.Up:
- return mOrientation == Orientation.VERTICAL ? LayoutState.Direction.START
- : LayoutState.Direction.MAX;
+ return mOrientation == VERTICAL ? LayoutState.LAYOUT_START
+ : LayoutState.INVALID_LAYOUT;
case FlexibleView.LayoutManager.Direction.Down:
- return mOrientation == Orientation.VERTICAL ? LayoutState.Direction.END
- : LayoutState.Direction.MAX;
+ return mOrientation == VERTICAL ? LayoutState.LAYOUT_END
+ : LayoutState.INVALID_LAYOUT;
case FlexibleView.LayoutManager.Direction.Left:
- return mOrientation == Orientation.HORIZONTAL ? LayoutState.Direction.START
- : LayoutState.Direction.MAX;
+ return mOrientation == HORIZONTAL ? LayoutState.LAYOUT_START
+ : LayoutState.INVALID_LAYOUT;
case FlexibleView.LayoutManager.Direction.Right:
- return mOrientation == Orientation.HORIZONTAL ? LayoutState.Direction.END
- : LayoutState.Direction.MAX;
+ return mOrientation == HORIZONTAL ? LayoutState.LAYOUT_END
+ : LayoutState.INVALID_LAYOUT;
default:
- return LayoutState.Direction.MAX;
+ return LayoutState.INVALID_LAYOUT;
}
}
{
break;
}
-
- switch (mLayoutState.LayoutDirection)
- {
- case LayoutState.Direction.START:
- layoutState.PixOffset -= layoutChunkResult.Consumed;
- break;
-
- case LayoutState.Direction.END:
- layoutState.PixOffset += layoutChunkResult.Consumed;
- break;
-
- default:
- layoutState.PixOffset += layoutChunkResult.Consumed * -1000;
- break;
- }
+ layoutState.Offset += layoutChunkResult.Consumed * layoutState.LayoutDirection;
// Consume the available space if:
// layoutChunk did not request to be ignored
private void Cache(FlexibleView.Recycler recycler, LayoutState layoutState, bool immediate, float scrolled = 0)
{
- if (layoutState.LayoutDirection == LayoutState.Direction.END)
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_END)
{
// get the first child in the direction we are going
FlexibleView.ViewHolder child = GetChildClosestToEnd();
{
return;
}
- if (layoutState.LayoutDirection == LayoutState.Direction.START)
+ if (layoutState.LayoutDirection == LayoutState.LAYOUT_START)
{
RecycleViewsFromEnd(recycler, layoutState.ScrollingOffset, immediate);
}
return 0;
}
mLayoutState.Recycle = true;
- LayoutState.Direction layoutDirection = dy < 0 ? LayoutState.Direction.END : LayoutState.Direction.START;
+ int layoutDirection = dy < 0 ? LayoutState.LAYOUT_END : LayoutState.LAYOUT_START;
float absDy = Math.Abs(dy);
- FlexibleView.ViewHolder child;
- if (layoutDirection == LayoutState.Direction.END)
- {
- child = GetChildClosestToEnd();
- }
- else
- {
- child = GetChildClosestToStart();
- }
-
- mLayoutState.UpdateState(layoutDirection, mOrientationHelper, child, mShouldReverseLayout, absDy, true);
+ UpdateLayoutState(layoutDirection, absDy, true);
float consumed = mLayoutState.ScrollingOffset
+ Fill(recycler, mLayoutState, false, immediate);
return 0;
}
- int layoutDirectionOffset;
- switch (layoutDirection)
- {
- case LayoutState.Direction.START:
- layoutDirectionOffset = -1;
- break;
-
- case LayoutState.Direction.END:
- layoutDirectionOffset = 1;
- break;
-
- default:
- layoutDirectionOffset = -1000;
- break;
- }
-
- float scrolled = absDy > consumed ? -layoutDirectionOffset * consumed : dy;
+ float scrolled = absDy > consumed ? -layoutDirection * consumed : dy;
Cache(recycler, mLayoutState, immediate, scrolled);
mOrientationHelper.OffsetChildren(scrolled, immediate);
return scrolled;
}
+ private void UpdateLayoutState(int layoutDirection, float requiredSpace, bool canUseExistingSpace)
+ {
+ mLayoutState.Extra = 0;
+ mLayoutState.LayoutDirection = layoutDirection;
+ float scrollingOffset = 0.0f;
+ if (layoutDirection == LayoutState.LAYOUT_END)
+ {
+ mLayoutState.Extra += mOrientationHelper.GetEndPadding();
+ // get the first child in the direction we are going
+ FlexibleView.ViewHolder child = GetChildClosestToEnd();
+ if (child != null)
+ {
+ // the direction in which we are traversing children
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD
+ : LayoutState.ITEM_DIRECTION_TAIL;
+ mLayoutState.CurrentPosition = child.LayoutPosition + mLayoutState.ItemDirection;
+ mLayoutState.Offset = mOrientationHelper.GetViewHolderEnd(child);
+ // calculate how much we can scroll without adding new children (independent of layout)
+ scrollingOffset = mOrientationHelper.GetViewHolderEnd(child)
+ - mOrientationHelper.GetEndAfterPadding();
+ }
+
+ }
+ else
+ {
+ mLayoutState.Extra += mOrientationHelper.GetStartAfterPadding();
+ FlexibleView.ViewHolder child = GetChildClosestToStart();
+ if (child != null)
+ {
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_TAIL
+ : LayoutState.ITEM_DIRECTION_HEAD;
+ mLayoutState.CurrentPosition = child.LayoutPosition + mLayoutState.ItemDirection;
+ mLayoutState.Offset = mOrientationHelper.GetViewHolderStart(child);
+ scrollingOffset = -mOrientationHelper.GetViewHolderStart(child)
+ + mOrientationHelper.GetStartAfterPadding();
+ }
+ }
+ mLayoutState.Available = requiredSpace;
+ if (canUseExistingSpace)
+ {
+ mLayoutState.Available -= scrollingOffset;
+ }
+ mLayoutState.ScrollingOffset = scrollingOffset;
+ }
+
// Convenience method to find the child closes to start. Caller should check it has enough
// children.
//
private void UpdateLayoutStateToFillEnd(int itemPosition, float offset)
{
mLayoutState.Available = mOrientationHelper.GetEndAfterPadding() - offset;
- mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ItemDirectionType.HEAD : LayoutState.ItemDirectionType.TAIL;
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD :
+ LayoutState.ITEM_DIRECTION_TAIL;
mLayoutState.CurrentPosition = itemPosition;
- mLayoutState.LayoutDirection = LayoutState.Direction.END;
- mLayoutState.PixOffset = offset;
+ mLayoutState.LayoutDirection = LayoutState.LAYOUT_END;
+ mLayoutState.Offset = offset;
mLayoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
- mLayoutState.Extra = mOrientationHelper.EndPadding;
+ mLayoutState.Extra = mOrientationHelper.GetEndPadding();
+
}
private void UpdateLayoutStateToFillStart(int itemPosition, float offset)
{
mLayoutState.Available = offset - mOrientationHelper.GetStartAfterPadding();
mLayoutState.CurrentPosition = itemPosition;
- mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ItemDirectionType.TAIL : LayoutState.ItemDirectionType.HEAD;
- mLayoutState.LayoutDirection = LayoutState.Direction.START;
- mLayoutState.PixOffset = offset;
+ mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_TAIL :
+ LayoutState.ITEM_DIRECTION_HEAD;
+ mLayoutState.LayoutDirection = LayoutState.LAYOUT_START;
+ mLayoutState.Offset = offset;
mLayoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
mLayoutState.Extra = mOrientationHelper.GetStartAfterPadding();
}
// Helper class that keeps temporary state while {LayoutManager} is filling out the empty space.
internal class LayoutState
{
- public enum Direction
- {
- START = 0,
- END,
- MAX
- }
+ public static readonly int LAYOUT_START = -1;
- public enum ItemDirectionType
- {
- HEAD = 0,
- TAIL,
- MAX
- }
+ public static readonly int LAYOUT_END = 1;
+
+ public static readonly int INVALID_LAYOUT = -1000;
- public static int SCROLLING_OFFSET_NaN = -1000;
+ public static readonly int ITEM_DIRECTION_HEAD = -1;
+
+ public static readonly int ITEM_DIRECTION_TAIL = 1;
+
+ public static readonly int SCROLLING_OFFSET_NaN = -10000;
// We may not want to recycle children in some cases (e.g. layout)
public bool Recycle = true;
// Pixel offset where layout should start
- public float PixOffset;
+ public float Offset;
// Number of pixels that we should fill, in the layout direction.
public float Available;
// Defines the direction in which the data adapter is traversed.
// Should be {@link #ITEM_DIRECTION_HEAD} or {@link #ITEM_DIRECTION_TAIL}
- public ItemDirectionType ItemDirection;
+ public int ItemDirection;
// Defines the direction in which the layout is filled.
// Should be {@link #LAYOUT_START} or {@link #LAYOUT_END}
- public LayoutState.Direction LayoutDirection;
+ public int LayoutDirection;
// Used when LayoutState is constructed in a scrolling state.
// It should be set the amount of scrolling we can make without creating a new view.
// {@link #mExtra} is not considered to avoid recycling visible children.
public float Extra = 0;
- public void UpdateState(Direction layoutDirection, OrientationHelper helper, FlexibleView.ViewHolder child, bool canReverse, float space, bool useExistGap)
- {
- Extra = 0;
-
- float scrollingOffset = 0.0f;
-
- if (layoutDirection == LayoutState.Direction.END)
- {
- Extra += helper.EndPadding;
-
- if (child != null)
- {
- ItemDirection = canReverse ? LayoutState.ItemDirectionType.HEAD : LayoutState.ItemDirectionType.TAIL;
-
- PixOffset = helper.GetViewHolderEnd(child);
-
- scrollingOffset = helper.GetViewHolderEnd(child) - helper.GetEndAfterPadding();
- }
- }
- else
- {
- Extra += helper.GetStartAfterPadding();
-
- if (child != null)
- {
- ItemDirection = canReverse ? LayoutState.ItemDirectionType.TAIL : LayoutState.ItemDirectionType.HEAD;
-
- PixOffset = helper.GetViewHolderStart(child);
-
- scrollingOffset = -helper.GetViewHolderStart(child) + helper.GetStartAfterPadding();
- }
- }
-
- if (layoutDirection != LayoutState.Direction.MAX && null != child)
- {
- switch (ItemDirection)
- {
- case ItemDirectionType.HEAD:
- CurrentPosition = child.LayoutPosition - 1;
- break;
-
- case ItemDirectionType.TAIL:
- CurrentPosition = child.LayoutPosition + 1;
- break;
-
- default:
- break;
- }
- }
-
- Available = space;
-
- if (useExistGap)
- {
- Available -= scrollingOffset;
- }
-
- ScrollingOffset = scrollingOffset;
- }
-
// @return true if there are more items in the data adapter
public bool HasMore(int itemCount)
{
public FlexibleView.ViewHolder Next(FlexibleView.Recycler recycler)
{
FlexibleView.ViewHolder itemView = recycler.GetViewForPosition(CurrentPosition);
+ CurrentPosition += ItemDirection;
- switch (ItemDirection)
- {
- case ItemDirectionType.HEAD:
- CurrentPosition -= 1;
- break;
-
- case ItemDirectionType.TAIL:
- CurrentPosition += 1;
- break;
-
- default:
- break;
- }
return itemView;
}
}
// @see #createVerticalHelper(RecyclerView.LayoutManager)
internal abstract class OrientationHelper
{
- public enum Direction
- {
- HORIZONTAL = 0,
- VERTICAL
- }
+ public static readonly int HORIZONTAL = 0;
+ public static readonly int VERTICAL = 1;
private static readonly int INVALID_SIZE = -1;
// whether the layout is RTL or not.
//
// @return The padding at the end of the layout.
- public abstract float EndPadding
- {
- get;
- }
+ public abstract float GetEndPadding();
// Creates an OrientationHelper for the given LayoutManager and orientation.
//
// @param orientation Desired orientation. Should be {@link #HORIZONTAL} or {@link #VERTICAL}
// @return A new OrientationHelper
public static OrientationHelper CreateOrientationHelper(
- FlexibleView.LayoutManager layoutManager, Direction orientation)
+ FlexibleView.LayoutManager layoutManager, int orientation)
{
- if (orientation == Direction.HORIZONTAL)
+ if (orientation == HORIZONTAL)
{
return CreateHorizontalHelper(layoutManager);
}
- else if (orientation == Direction.VERTICAL)
+ else if (orientation == VERTICAL)
{
return CreateVerticalHelper(layoutManager);
}
//holder.offsetLeftAndRight(offset);
}
- public override float EndPadding
+ public override float GetEndPadding()
{
- get
- {
- return mLayoutManager.PaddingRight;
- }
+ return mLayoutManager.PaddingRight;
}
}
//holder.offsetTopAndBottom(offset);
}
- public override float EndPadding
+ public override float GetEndPadding()
{
- get
- {
- return mLayoutManager.PaddingBottom;
- }
+ return mLayoutManager.PaddingBottom;
}
+
}
+
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- InputFieldStyle tempStyle = StyleManager.Instance.GetAttributes(style) as InputFieldStyle;
+ InputFieldStyle tempStyle = StyleManager.Instance.GetViewStyle(style) as InputFieldStyle;
if (tempStyle != null)
{
Style.CopyFrom(tempStyle);
{
/// 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 static readonly BindableProperty ButtonCountProperty = BindableProperty.Create("ButtonCount", typeof(int), typeof(Popup), 0, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonHeightProperty = BindableProperty.Create("ButtonHeight", typeof(int), typeof(Popup), default(int), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
- if ((int)newValue != instance.buttonCount)
+ if (newValue != null)
{
- instance.buttonCount = (int)newValue;
- instance.UpdateButton();
+ instance.Style.Buttons.Size.Height = (int)newValue;
+ instance.btGroup.Itemheight = (int)newValue;
+ instance.UpdateView();
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.buttonCount;
+ return (int)(instance.Style?.Buttons?.Size?.Height ?? 0);
});
/// 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 static readonly BindableProperty ShadowOffsetProperty = BindableProperty.Create("ShadowOffset", typeof(Vector4), typeof(Popup), new Vector4(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonTextPointSizeProperty = BindableProperty.Create("ButtonTextPointSize", typeof(float), typeof(Popup), default(float), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style)
+ if (instance.Style.Buttons.Text.PointSize == null)
{
- instance.Style.ShadowOffset = (Vector4)newValue;
- instance.UpdateShadow();
+ instance.Style.Buttons.Text.PointSize = new Selector<float?>();
}
+ instance.Style.Buttons.Text.PointSize.All = (float)newValue;
+ instance.btGroup.ItemPointSize = (float)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.ShadowOffset;
+ return instance.Style?.Buttons?.Text?.PointSize?.All ?? 0;
});
/// 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 static readonly BindableProperty ButtonHeightProperty = BindableProperty.Create("ButtonHeight", typeof(int), typeof(Popup), default(int), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonFontFamilyProperty = BindableProperty.Create("ButtonFontFamily", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.Size)
- {
- instance.Style.Buttons.Size.Height = (int)newValue;
- instance.UpdateButton();
- }
+ instance.Style.Buttons.Text.FontFamily = (string)newValue;
+ instance.btGroup.ItemFontFamily = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return (int)(instance.Style?.Buttons?.Size?.Height ?? 0);
+ return instance.Style?.Buttons?.Text?.FontFamily.All;
});
/// 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 static readonly BindableProperty ButtonTextPointSizeProperty = BindableProperty.Create("ButtonTextPointSize", typeof(float), typeof(Popup), default(float), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonTextColorProperty = BindableProperty.Create("ButtonTextColor", typeof(Color), typeof(Popup), Color.Transparent, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
- {
- if (null != instance.Style?.Buttons?.Text)
+ {
+ if (instance.Style.Buttons.Text.TextColor == null)
{
- instance.Style.Buttons.Text.PointSize = (float)newValue;
- instance.UpdateButton();
+ instance.Style.Buttons.Text.TextColor = new Selector<Color>();
}
+ instance.Style.Buttons.Text.TextColor.All = (Color)newValue;
+ instance.btGroup.ItemTextColor = (Color)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Text?.PointSize?.All ?? 0;
+ return instance.Style?.Buttons?.Text?.TextColor?.All;
});
/// 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 static readonly BindableProperty ButtonFontFamilyProperty = BindableProperty.Create("ButtonFontFamily", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonOverLayBackgroundColorSelectorProperty = BindableProperty.Create("ButtonOverLayBackgroundColorSelector", typeof(Selector<Color>), typeof(Popup), new Selector<Color>(), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.Text)
- {
- instance.Style.Buttons.Text.FontFamily = (string)newValue;
- instance.UpdateButton();
- }
+ instance.Style.Buttons.Overlay.BackgroundColor = (Selector<Color>)newValue;
+ instance.btGroup.OverLayBackgroundColorSelector = (Selector<Color>)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style?.Buttons?.Text?.FontFamily.All;
+ return instance.Style?.Buttons?.Overlay?.BackgroundColor;
});
/// 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 static readonly BindableProperty ButtonTextColorProperty = BindableProperty.Create("ButtonTextColor", typeof(Color), typeof(Popup), Color.Transparent, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonTextAlignmentProperty = BindableProperty.Create("ButtonTextAlignment", typeof(HorizontalAlignment), typeof(Popup), new HorizontalAlignment(), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.Text)
- {
- instance.Style.Buttons.Text.TextColor = (Color)newValue;
- }
+ instance.Style.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
+ instance.btGroup.ItemTextAlignment = (HorizontalAlignment)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Text?.TextColor?.All;
+ return instance.Style?.Buttons?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
});
/// 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 static readonly BindableProperty ButtonOverLayBackgroundColorSelectorProperty = BindableProperty.Create("ButtonOverLayBackgroundColorSelector", typeof(Selector<Color>), typeof(Popup), new Selector<Color>(), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonBackgroundProperty = BindableProperty.Create("ButtonBackground", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.Overlay)
+ if (instance.Style.Buttons.BackgroundImage == null)
{
- Selector<Color> color = (Selector<Color>)newValue;
- if (null == instance.Style.Buttons.Overlay.BackgroundColor)
- {
- instance.Style.Buttons.Overlay.BackgroundColor = new Selector<Color>();
- }
- instance.Style.Buttons.Overlay.BackgroundColor.Clone(color);
- instance.UpdateButton();
+ instance.Style.Buttons.BackgroundImage = new Selector<string>();
}
+ instance.btGroup.ItemBackgroundImageUrl = (string)newValue;
+ instance.Style.Buttons.BackgroundImage = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Overlay?.BackgroundColor;
+ return instance.Style?.Buttons?.BackgroundImage?.All;
});
/// 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 static readonly BindableProperty ButtonTextAlignmentProperty = BindableProperty.Create("ButtonTextAlignment", typeof(HorizontalAlignment), typeof(Popup), new HorizontalAlignment(), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonBackgroundBorderProperty = BindableProperty.Create("ButtonBackgroundBorder", typeof(Rectangle), typeof(Popup), new Rectangle(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.Text)
+ if (instance.Style.Buttons.BackgroundImageBorder == null)
{
- instance.Style.Buttons.Text.HorizontalAlignment = (HorizontalAlignment)newValue;
- instance.UpdateButton();
+ instance.Style.Buttons.BackgroundImageBorder = new Selector<Rectangle>();
}
+ instance.Style.Buttons.BackgroundImageBorder = (Rectangle)newValue;
+ instance.btGroup.ItemBackgroundBorder = (Rectangle)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.Text?.HorizontalAlignment ?? HorizontalAlignment.Center;
+ return instance.Style?.Buttons?.BackgroundImageBorder?.All;
});
/// 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 static readonly BindableProperty ButtonBackgroundProperty = BindableProperty.Create("ButtonBackground", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonShadowProperty = BindableProperty.Create("ButtonShadow", typeof(string), typeof(Popup), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.BackgroundImage)
+ if (instance.Style.Buttons.Shadow.ResourceUrl == null)
{
- instance.Style.Buttons.BackgroundImage = (string)newValue;
- instance.UpdateButton();
+ instance.Style.Buttons.Shadow.ResourceUrl = new Selector<string>();
}
+ instance.btGroup.ItemShadowUrl = (string)newValue;
+ instance.Style.Buttons.Shadow.ResourceUrl = (string)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.BackgroundImage?.All;
+ return instance.Style?.Buttons?.Shadow?.ResourceUrl?.All;
});
/// 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 static readonly BindableProperty ButtonBackgroundBorderProperty = BindableProperty.Create("ButtonBackgroundBorder", typeof(Rectangle), typeof(Popup), new Rectangle(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
+ public static readonly BindableProperty ButtonShadowBorderProperty = BindableProperty.Create("ButtonShadowBorder", typeof(Rectangle), typeof(Popup), new Rectangle(0, 0, 0, 0), propertyChanged: (bindable, oldValue, newValue) =>
{
var instance = (Popup)bindable;
if (newValue != null)
{
- if (null != instance.Style?.Buttons?.BackgroundImageBorder)
+ if (instance.Style.Buttons.Shadow.Border == null)
{
- instance.Style.Buttons.BackgroundImageBorder = (Rectangle)newValue;
- instance.UpdateButton();
+ instance.Style.Buttons.Shadow.Border = new Selector<Rectangle>();
}
+ instance.btGroup.ItemShadowBorder = (Rectangle)newValue;
+ instance.Style.Buttons.Shadow.Border = (Rectangle)newValue;
}
},
defaultValueCreator: (bindable) =>
{
var instance = (Popup)bindable;
- return instance.Style.Buttons?.BackgroundImageBorder?.All;
+ return instance.Style?.Buttons?.Shadow?.Border?.All;
});
private TextLabel titleText;
- private List<Button> buttonList;
- private List<string> buttonTextList = new List<string>();
-
- private int buttonCount = 0;
+ private ButtonGroup btGroup = null;
+ private Window window = null;
/// <summary>
/// Creates a new instance of a Popup.
Initialize();
}
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Post(Window win)
+ {
+ window = win;
+ window.Add(this);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AddButton(string buttonText)
+ {
+ if (Style.Buttons != null)
+ {
+ Button btn = new Button(Style.Buttons);
+ btn.Style.Text.Text = buttonText;
+ btn.ClickEvent += ButtonClickEvent;
+ btGroup.AddItem(btn);
+ UpdateView();
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AddButton(string buttonText, string style)
+ {
+ AddButton(buttonText);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AddButton(string buttonText, ButtonStyle style)
+ {
+ if (Style.Buttons != null && style != null)
+ {
+ Style.Buttons.CopyFrom(style);
+ AddButton(buttonText);
+ }
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Button GetButton(int index)
+ {
+ return btGroup.GetItem(index);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void RemoveButton(int index)
+ {
+ btGroup.RemoveItem(index);
+ }
+
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void AddContentText(View childView)
+ {
+ if (null != ContentView)
+ {
+ ContentView.Add(childView);
+ }
+ UpdateView();
+ }
+
/// <summary>
/// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.<br />
/// </summary>
}
set
{
- if (null != Style?.Title)
+ if (value != null)
{
- Style.Title.Text = value;
+ if (Style.Title.Text == null)
+ {
+ Style.Title.Text = new Selector<string>();
+ }
+ Style.Title.Text.All = value;
}
}
}
}
set
{
- if (null != Style?.Title)
+ if (Style.Title.PointSize == null)
{
- Style.Title.PointSize = value;
+ Style.Title.PointSize = new Selector<float?>();
}
+ Style.Title.PointSize.All = value;
}
}
}
set
{
- if (null != Style?.Title)
+ if (Style.Title.TextColor == null)
{
- Style.Title.TextColor = value;
+ Style.Title.TextColor = new Selector<Color>();
}
+ Style.Title.TextColor.All = value;
}
}
/// <since_tizen> 6 </since_tizen>
public int ButtonCount
{
- get
- {
- return (int)GetValue(ButtonCountProperty);
- }
- set
- {
- SetValue(ButtonCountProperty, value);
- }
+ get;
+ set;
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public Vector4 ShadowOffset
{
- get
- {
- return (Vector4)GetValue(ShadowOffsetProperty);
- }
- set
- {
- SetValue(ShadowOffsetProperty, value);
- }
+ get;
+ set;
}
/// <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)]
- public string ButtonBackgroundImageURL
+ public string ButtonBackground
{
get
{
/// <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)]
- public Rectangle ButtonBackgroundImageBorder
+ public Rectangle ButtonBackgroundBorder
{
get
{
}
}
- /// This will be public opened in tizen_6.0 after ACR done. Before ACR, need to be hidden as inhouse API.
+ /// <summary>
+ /// Button shadow's resource url in Popup.
+ /// </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)]
- public new Size2D Size2D
+ public string ButtonShadow
{
get
{
- return base.Size2D;
+ return (string)GetValue(ButtonShadowProperty);
}
set
{
- base.Size2D = value;
- UpdateShadow();
+ SetValue(ButtonShadowProperty, value);
}
}
/// <summary>
- /// Set button text by index.
+ /// Button shadow's border in Popup.
/// </summary>
- /// <param name="index">Button index.</param>
- /// <param name="text">Button text string.</param>
/// <since_tizen> 6 </since_tizen>
- public void SetButtonText(int index, string text)
+ /// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Rectangle ButtonShadowBorder
{
- if(index < 0 && index >= buttonCount)
+ get
{
- return;
+
+ return (Rectangle)GetValue(ButtonShadowBorderProperty);
}
- if(buttonTextList.Count < index + 1)
+ set
{
- for (int i = buttonTextList.Count; i < index + 1; i++)
- {
- buttonTextList.Add("");
- }
+ SetValue(ButtonShadowBorderProperty, value);
}
- buttonTextList[index] = text;
- UpdateButton();
}
/// <summary>
+ /// Set button text by index.
+ /// </summary>
+ /// <param name="index">Button index.</param>
+ /// <param name="text">Button text string.</param>
+ /// <since_tizen> 6 </since_tizen>
+ public void SetButtonText(int index, string text)
+ {}
+
+ /// <summary>
/// Dispose Popup and all children on it.
/// </summary>
/// <param name="type">Dispose type.</param>
ContentView.Dispose();
ContentView = null;
}
- if (buttonList != null)
+
+ if (btGroup != null)
{
- foreach(Button btn in buttonList)
- {
- Remove(btn);
- btn.Dispose();
- }
+ btGroup.Dispose();
+ btGroup = null;
}
}
public override void ApplyStyle(ViewStyle viewStyle)
{
base.ApplyStyle(viewStyle);
-
- PopupStyle popupStyle = viewStyle as PopupStyle;
-
- if (null != popupStyle)
+ PopupStyle ppStyle = viewStyle as PopupStyle;
+ if (null != ppStyle)
{
if (null == titleText)
{
titleText = new TextLabel();
Add(titleText);
}
-
- titleText.ApplyStyle(Style.Title);
+ titleText.RaiseToTop();
+ titleText.ApplyStyle(ppStyle.Title);
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- PopupStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as PopupStyle;
+ PopupStyle tempAttributes = StyleManager.Instance.GetViewStyle(style) as PopupStyle;
if (tempAttributes != null)
{
+ string strSaveTitleText = TitleText;
Style.CopyFrom(tempAttributes);
- RelayoutRequest();
+ Style.Title.Text = strSaveTitleText;
+ UpdateView();
}
}
private void Initialize()
{
LeaveRequired = true;
+ PropertyChanged += PopupAttributesPropertyChanged;
// ContentView
ContentView = new View()
if (null == titleText)
{
titleText = new TextLabel();
+ titleText.RaiseToTop();
Add(titleText);
}
- buttonList = new List<Button>();
+ // Button
+ btGroup = new ButtonGroup(this);
}
- private void UpdateButton()
+ private void UpdateView()
{
- if (buttonCount <= 0) return;
- if (null == buttonTextList || buttonTextList.Count != buttonCount) return;
-
- if (null != buttonList)
- {
- foreach (Button btn in buttonList)
- {
- if (null != btn)
- {
- btn.ClickEvent -= ButtonClickEvent;
- this.Remove(btn);
- btn.Dispose();
- }
- }
- buttonList.Clear();
- }
-
- int sizeWidth = Size2D?.Width ?? 0;
- int buttonWidth = sizeWidth / buttonCount;
- int buttonHeight = (int)(Style?.Buttons?.Size?.Height ?? 0);
- for (int i = 0; i < buttonCount; i++)
- {
- Button btn = new Button(Style?.Buttons);
- btn.Size2D = new Size2D(buttonWidth, buttonHeight);
- btn.Style.Text.Text = buttonTextList[i];
- btn.ClickEvent += ButtonClickEvent;
-
- this.Add(btn);
- buttonList.Add(btn);
- }
-
- int pos = 0;
- if (null != buttonList && buttonList.Count > 0)
- {
- if (LayoutDirection == ViewLayoutDirectionType.RTL)
- {
- for (int i = buttonList.Count - 1; i >= 0; i--)
- {
- buttonList[i].PositionX = pos;
- pos += buttonList[i].Size2D.Width;
- }
- }
- else
- {
- for (int i = 0; i < buttonList.Count; i++)
- {
- buttonList[i].PositionX = pos;
- pos += buttonList[i].Size2D.Width;
- }
- }
- }
-
+ UpdateShadowExtens();
+ btGroup.UpdateButton(Style.Buttons);
UpdateContentView();
+ UpdateTitle();
}
private void ButtonClickEvent(object sender, Button.ClickEventArgs e)
{
- if (PopupButtonClickEvent != null && buttonList != null)
+ if (PopupButtonClickEvent != null && btGroup.Count > 0)
{
Button button = sender as Button;
- for (int i = 0; i < buttonList.Count; i++)
+ for (int i = 0; i < btGroup.Count; i++)
{
- if(button == buttonList[i])
+ if (button == GetButton(i))
{
ButtonClickEventArgs args = new ButtonClickEventArgs();
args.ButtonIndex = i;
}
}
}
- private void UpdateShadow()
+
+ private void PopupAttributesPropertyChanged(object sender, PropertyChangedEventArgs e)
{
- if (Style.ShadowOffset == null) return;
- int w = 0;
- int h = 0;
- if (Style.Shadow != null)
+ if (e.PropertyName.Equals("LayoutDirection"))
{
- w = (int)(Size2D.Width + Style.ShadowOffset.W + Style.ShadowOffset.X);
- h = (int)(Size2D.Height + Style.ShadowOffset.Y + Style.ShadowOffset.Z);
-
- shadowImage.Size2D = new Size2D(w, h);
+ btGroup.UpdateButton(Style.Buttons);
}
}
- private void UpdateTitle()
+ private void UpdateContentView()
{
- int w = 0;
- int h = 0;
int titleX = 0;
int titleY = 0;
int titleH = 0;
int buttonH = 0;
-
- if (Style.Title != null)
+ string strText = Style.Title.Text.All;
+ if ((strText != null && strText != "") && Style.Title.Size != null)
{
- if (titleText.Text != null && titleText.Text != "")
- {
- Style.Title.Text = new Selector<string> { All = titleText.Text };
- w = (int)(Size2D.Width - titleText.PositionX * 2);
-
- if (Style.Title.Size != null)
- {
- titleH = (int)titleText.Size.Height;
- }
- titleText.Size2D = new Size2D(w, titleH);
- }
- else
- {
- titleText.Size2D = new Size2D(0, 0);
- }
+ titleH = (int)titleText.Size.Height;
}
- if (titleText != null)
+ if ((strText != null && strText != "") && Style.Title.Position != null)
{
- if (LayoutDirection == ViewLayoutDirectionType.RTL)
- {
- if (Style.Title != null)
- {
- Style.Title.HorizontalAlignment = HorizontalAlignment.End;
- }
- titleText.HorizontalAlignment = HorizontalAlignment.End;
- }
- else if (LayoutDirection == ViewLayoutDirectionType.LTR)
- {
- if (Style.Title != null)
- {
- Style.Title.HorizontalAlignment = HorizontalAlignment.Begin;
- }
- titleText.HorizontalAlignment = HorizontalAlignment.Begin;
- }
+ titleX = (int)Style.Title.Position.X;
+ titleY = (int)Style.Title.Position.Y;
}
- UpdateContentView();
+ if (btGroup.Count != 0)
+ {
+ buttonH = (int)Style.Buttons.Size.Height;
+ }
+ ContentView.Size = new Size(Size.Width - titleX * 2, Size.Height - titleY - titleH - buttonH);
+ ContentView.Position = new Position(titleX, titleY + titleH);
+ ContentView.RaiseToTop();
}
- private void UpdateContentView()
+ private void UpdateShadowExtens()
{
- int titleX = 0;
- int titleY = 0;
- int titleH = 0;
- if (Style.Title.Size != null)
+ if (Style.ShadowExtents != null)
{
- titleH = (int)titleText.Size.Height;
+ Style.Shadow.Size = new Size(Size.Width + Style.ShadowExtents.Start + Style.ShadowExtents.End, Size.Height + Style.ShadowExtents.Top + Style.ShadowExtents.Bottom);
}
- if (Style.Title.Position != null)
+ }
+
+ private void UpdateTitle()
+ {
+ if (titleText != null && Style.Title.Text.All != "" && Style.Title.Size != null)
{
- titleX = (int)Style.Title.Position.X;
- titleY = (int)Style.Title.Position.Y;
+ titleText.RaiseToTop();
}
- int buttonH = (int)Style.Buttons.Size.Height;
-
- ContentView.Size2D = new Size2D(Size2D.Width - titleX * 2, Size2D.Height - titleY - titleH - buttonH);
- ContentView.Position2D = new Position2D(titleX, titleY + titleH);
- ContentView.RaiseToTop();
}
-
/// <summary>
/// ButtonClickEventArgs is a class to record button click event arguments which will sent to user.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- ProgressStyle tempStyle = StyleManager.Instance.GetAttributes(style) as ProgressStyle;
+ ProgressStyle tempStyle = StyleManager.Instance.GetViewStyle(style) as ProgressStyle;
if (null != tempStyle)
{
Style.CopyFrom(tempStyle);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- ScrollBarStyle tempStyle = StyleManager.Instance.GetAttributes(style) as ScrollBarStyle;
+ ScrollBarStyle tempStyle = StyleManager.Instance.GetViewStyle(style) as ScrollBarStyle;
if (tempStyle != null)
{
Style.CopyFrom(tempStyle);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- SliderStyle sliderStyle = StyleManager.Instance.GetAttributes(style) as SliderStyle;
+ SliderStyle sliderStyle = StyleManager.Instance.GetViewStyle(style) as SliderStyle;
if (sliderStyle != null)
{
Style?.CopyFrom(sliderStyle);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- SwitchStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as SwitchStyle;
+ SwitchStyle tempAttributes = StyleManager.Instance.GetViewStyle(style) as SwitchStyle;
if (null != tempAttributes)
{
Style.CopyFrom(tempAttributes);
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void OnThemeChangedEvent(object sender, StyleManager.ThemeChangeEventArgs e)
{
- TabStyle tempAttributes = StyleManager.Instance.GetAttributes(style) as TabStyle;
+ TabStyle tempAttributes = StyleManager.Instance.GetViewStyle(style) as TabStyle;
if (tempAttributes != null)
{
Style.CopyFrom(tempAttributes);
/// <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)]
- public Vector4 ShadowOffset
+ public Extents ShadowExtents
{
get;
set;
PopupStyle popupAttributes = bindableObject as PopupStyle;
if (popupAttributes != null)
{
- if (popupAttributes.Shadow != null)
- {
- Shadow.CopyFrom(popupAttributes.Shadow);
- }
-
if (popupAttributes.Title != null)
{
Title.CopyFrom(popupAttributes.Title);
Buttons.CopyFrom(popupAttributes.Buttons);
}
- if (popupAttributes.ShadowOffset != null)
+ if (popupAttributes.ShadowExtents != null)
{
- ShadowOffset = new Vector4(popupAttributes.ShadowOffset.W, popupAttributes.ShadowOffset.X, popupAttributes.ShadowOffset.Y, popupAttributes.ShadowOffset.Z);
+ ShadowExtents = new Extents(popupAttributes.ShadowExtents.Start, popupAttributes.ShadowExtents.End, popupAttributes.ShadowExtents.Top, popupAttributes.ShadowExtents.Bottom);
}
}
}
private void InitSubStyle()
{
- Shadow = new ImageViewStyle()
- {
- PositionUsesPivotPoint = true,
- ParentOrigin = Tizen.NUI.ParentOrigin.Center,
- PivotPoint = Tizen.NUI.PivotPoint.Center
- };
-
+ ShadowExtents = new Extents(24, 24, 24, 24);
Title = new TextLabelStyle()
{
Size = new Size(0, 0),
PositionUsesPivotPoint = true,
ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft,
PivotPoint = Tizen.NUI.PivotPoint.BottomLeft,
- Text = new TextLabelStyle
+ Overlay = new ImageViewStyle()
+ {
+ PositionUsesPivotPoint = true,
+ ParentOrigin = Tizen.NUI.ParentOrigin.Center,
+ PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent
+ },
+
+ Text = new TextLabelStyle()
{
PositionUsesPivotPoint = true,
ParentOrigin = Tizen.NUI.ParentOrigin.Center,
PivotPoint = Tizen.NUI.PivotPoint.Center,
+ WidthResizePolicy = ResizePolicyType.FillToParent,
+ HeightResizePolicy = ResizePolicyType.FillToParent,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
}
/// <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)]
- public ViewStyle GetAttributes(string style)
+ public ViewStyle GetViewStyle(string style)
{
if (style == null)
{
private void DirectorOnSetResizePolicy(int policy, int dimension)
{
- OnSetResizePolicy((ResizePolicyType)policy, (DimensionType)dimension);
+ if (null != OnSetResizePolicy)
+ {
+ OnSetResizePolicy((ResizePolicyType)policy, (DimensionType)dimension);
+ }
}
private global::System.IntPtr DirectorGetNaturalSize()
/// <summary>
/// Retrieves and sets the view's opacity.<br />
/// </summary>
- /// <remarks>
- /// <para>
- /// Animatable - This property can be animated using <c>Animation</c> class.
- /// </para>
- /// </remarks>
/// <since_tizen> 3 </since_tizen>
public float Opacity
{
/// If the view is not visible, then the view and its children will not be rendered.
/// This is regardless of the individual visibility values of the children, i.e., the view will only be rendered if all of its parents have visibility set to true.
/// </para>
+ /// <para>
+ /// Animatable - This property can be animated using <c>Animation</c> class.
+ /// </para>
/// </remarks>
/// <since_tizen> 3 </since_tizen>
public bool Visibility
{
nameToBindableProperty[propertyName] = this;
}
-
- if (!baseTypePropertyHasBeenAdded.Contains(declaringType))
- {
- AddParentTypeProperty(declaringType.BaseType, nameToBindableProperty);
- baseTypePropertyHasBeenAdded.Add(declaringType);
- }
}
- private void AddParentTypeProperty(Type type, Dictionary<string, BindableProperty> propertyDict)
+ private static bool AddParentTypeProperty(Type type, Dictionary<string, BindableProperty> propertyDict)
{
+ bool ret = false;
+
if (null != type)
{
Dictionary<string, BindableProperty> nameToBindableProperty;
if (null != nameToBindableProperty)
{
+ ret = true;
+
foreach (KeyValuePair<string, BindableProperty> keyValuePair in nameToBindableProperty)
{
if (!propertyDict.ContainsKey(keyValuePair.Key))
}
}
- AddParentTypeProperty(type.BaseType, propertyDict);
+ if (true == AddParentTypeProperty(type.BaseType, propertyDict))
+ {
+ ret = true;
+ }
}
+
+ return ret;
}
static internal Dictionary<Type, Dictionary<string, BindableProperty>> bindablePropertyOfType = new Dictionary<Type, Dictionary<string, BindableProperty>>();
{
dictionary = null;
- while (null != type && null == dictionary)
+ bindablePropertyOfType.TryGetValue(type, out dictionary);
+
+ if (!baseTypePropertyHasBeenAdded.Contains(type))
{
- bindablePropertyOfType.TryGetValue(type, out dictionary);
- type = type.BaseType;
+ bool isCurDictNull = false;
+
+ if (null == dictionary)
+ {
+ isCurDictNull = true;
+ dictionary = new Dictionary<string, BindableProperty>();
+ }
+
+ if (true == AddParentTypeProperty(type.BaseType, dictionary) && true == isCurDictNull)
+ {
+ bindablePropertyOfType.Add(type, dictionary);
+ }
+
+ baseTypePropertyHasBeenAdded.Add(type);
}
}