-using System;
+/*
+ * Copyright(c) 2021 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 Tizen.NUI.BaseComponents;
using Tizen.NUI.Components.Extension;
return true;
}
-
}
}
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
-using Tizen.NUI.Components.Extension;
using Tizen.NUI.Accessibility;
namespace Tizen.NUI.Components
*/
using System;
-using System.Diagnostics;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
[EditorBrowsable(EditorBrowsableState.Never)]
public override ImageView OnCreateIcon(Button button, ImageView icon)
{
+ if (button == null)
+ {
+ throw new ArgumentNullException("button");
+ }
+
LottieView.PositionUsesPivotPoint = true;
LottieView.ParentOrigin = NUI.ParentOrigin.Center;
LottieView.PivotPoint = NUI.PivotPoint.Center;
-using System;
+/*
+ * Copyright(c) 2021 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 Tizen.NUI.BaseComponents;
{
internal class RecycledViewPool
{
- private FlexibleView mFlexibleView;
+ private FlexibleView flexibleView;
- private int mMaxTypeCount = 10;
- private List<FlexibleViewViewHolder>[] mScrap;
+ private int maxTypeCount = 10;
+ private List<FlexibleViewViewHolder>[] scrap;
public RecycledViewPool(FlexibleView flexibleView)
{
- mFlexibleView = flexibleView;
- mScrap = new List<FlexibleViewViewHolder>[mMaxTypeCount];
+ this.flexibleView = flexibleView;
+ scrap = new List<FlexibleViewViewHolder>[maxTypeCount];
}
- //public void SetViewTypeCount(int typeCount)
- //{
- //}
-
public FlexibleViewViewHolder GetRecycledView(int viewType)
{
- if (viewType >= mMaxTypeCount || mScrap[viewType] == null)
+ if (viewType >= maxTypeCount || scrap[viewType] == null)
{
return null;
}
- int index = mScrap[viewType].Count - 1;
+ int index = scrap[viewType].Count - 1;
if (index < 0)
{
return null;
}
- FlexibleViewViewHolder recycledView = mScrap[viewType][index];
- mScrap[viewType].RemoveAt(index);
+ FlexibleViewViewHolder recycledView = scrap[viewType][index];
+ scrap[viewType].RemoveAt(index);
return recycledView;
}
public void PutRecycledView(FlexibleViewViewHolder view)
{
int viewType = view.ItemViewType;
- if (viewType >= mMaxTypeCount)
+ if (viewType >= maxTypeCount)
{
return;
}
- if (mScrap[viewType] == null)
+ if (scrap[viewType] == null)
{
- mScrap[viewType] = new List<FlexibleViewViewHolder>();
+ scrap[viewType] = new List<FlexibleViewViewHolder>();
}
view.IsBound = false;
- mScrap[viewType].Add(view);
+ scrap[viewType].Add(view);
}
public void Clear()
{
- for (int i = 0; i < mMaxTypeCount; i++)
+ for (int i = 0; i < maxTypeCount; i++)
{
- if (mScrap[i] == null)
+ if (scrap[i] == null)
{
continue;
}
- for (int j = 0; j < mScrap[i].Count; j++)
+ for (int j = 0; j < scrap[i].Count; j++)
{
- mFlexibleView.DispatchChildDestroyed(mScrap[i][j]);
+ flexibleView.DispatchChildDestroyed(scrap[i][j]);
}
- mScrap[i].Clear();
+ scrap[i].Clear();
}
}
}
internal class ChildHelper : Disposable
{
- private FlexibleView mFlexibleView;
-
- private List<FlexibleViewViewHolder> mViewList = new List<FlexibleViewViewHolder>();
-
- //private List<FlexibleViewViewHolder> mRemovePendingViews;
-
+ private FlexibleView flexibleView;
+ private List<FlexibleViewViewHolder> viewList = new List<FlexibleViewViewHolder>();
private Dictionary<uint, FlexibleViewViewHolder> itemViewTable = new Dictionary<uint, FlexibleViewViewHolder>();
- private TapGestureDetector mTapGestureDetector;
+ private TapGestureDetector tapGestureDetector;
public ChildHelper(FlexibleView owner)
{
- mFlexibleView = owner;
+ flexibleView = owner;
- mTapGestureDetector = new TapGestureDetector();
- mTapGestureDetector.Detected += OnTapGestureDetected;
+ tapGestureDetector = new TapGestureDetector();
+ tapGestureDetector.Detected += OnTapGestureDetected;
}
public void Clear()
{
- foreach (FlexibleViewViewHolder holder in mViewList)
+ foreach (FlexibleViewViewHolder holder in viewList)
{
- mFlexibleView.Remove(holder.ItemView);
-
- mFlexibleView.DispatchChildDestroyed(holder);
+ flexibleView.Remove(holder.ItemView);
+ flexibleView.DispatchChildDestroyed(holder);
}
- mViewList.Clear();
+ viewList.Clear();
}
public void ScrapViews(FlexibleViewRecycler recycler)
{
recycler.Clear();
- foreach (FlexibleViewViewHolder itemView in mViewList)
+ foreach (FlexibleViewViewHolder itemView in viewList)
{
recycler.ScrapView(itemView);
}
- mViewList.Clear();
+ viewList.Clear();
}
public void AttachView(FlexibleViewViewHolder holder, int index)
{
if (index == -1)
{
- index = mViewList.Count;
+ index = viewList.Count;
}
- mViewList.Insert(index, holder);
+ viewList.Insert(index, holder);
if (!itemViewTable.ContainsKey(holder.ItemView.ID))
{
- mTapGestureDetector.Attach(holder.ItemView);
+ tapGestureDetector.Attach(holder.ItemView);
holder.ItemView.TouchEvent += OnTouchEvent;
}
public void AddView(FlexibleViewViewHolder holder, int index)
{
- mFlexibleView.Add(holder.ItemView);
-
- mFlexibleView.DispatchChildAttached(holder);
-
+ flexibleView.Add(holder.ItemView);
+ flexibleView.DispatchChildAttached(holder);
AttachView(holder, index);
}
public bool RemoveView(FlexibleViewViewHolder holder)
{
- mFlexibleView.Remove(holder.ItemView);
-
- mFlexibleView.DispatchChildDetached(holder);
-
- return mViewList.Remove(holder);
+ flexibleView.Remove(holder.ItemView);
+ flexibleView.DispatchChildDetached(holder);
+ return viewList.Remove(holder);
}
public bool RemoveViewAt(int index)
{
- FlexibleViewViewHolder itemView = mViewList[index];
+ FlexibleViewViewHolder itemView = viewList[index];
return RemoveView(itemView);
}
{
for (int i = index; i < index + count; i++)
{
- FlexibleViewViewHolder holder = mViewList[i];
- mFlexibleView.Remove(holder.ItemView);
+ FlexibleViewViewHolder holder = viewList[i];
+ flexibleView.Remove(holder.ItemView);
}
- mViewList.RemoveRange(index, count);
+ viewList.RemoveRange(index, count);
return false;
}
public int GetChildCount()
{
- return mViewList.Count;
+ return viewList.Count;
}
public FlexibleViewViewHolder GetChildAt(int index)
{
- if (index < 0 || index >= mViewList.Count)
+ if (index < 0 || index >= viewList.Count)
{
return null;
}
- return mViewList[index];
+ return viewList[index];
}
protected override void Dispose(DisposeTypes type)
{
Clear();
- if (mTapGestureDetector != null)
+ if (tapGestureDetector != null)
{
- mTapGestureDetector.Detected -= OnTapGestureDetected;
- mTapGestureDetector.Dispose();
- mTapGestureDetector = null;
+ tapGestureDetector.Detected -= OnTapGestureDetected;
+ tapGestureDetector.Dispose();
+ tapGestureDetector = null;
}
}
base.Dispose(type);
if (itemViewTable.ContainsKey(itemView.ID))
{
FlexibleViewViewHolder holder = itemViewTable[itemView.ID];
- mFlexibleView.FocusedItemIndex = holder.AdapterPosition;
+ flexibleView.FocusedItemIndex = holder.AdapterPosition;
- mFlexibleView.DispatchItemClicked(holder);
+ flexibleView.DispatchItemClicked(holder);
}
}
{
FlexibleViewViewHolder holder = itemViewTable[itemView.ID];
- mFlexibleView.DispatchItemTouched(holder, e.Touch);
+ flexibleView.DispatchItemTouched(holder, e.Touch);
return true;
}
return false;
private class AdapterHelper
{
- private FlexibleView mFlexibleView;
-
- private List<UpdateOp> mPendingUpdates = new List<UpdateOp>();
-
- private int mExistingUpdateTypes = 0;
+ private FlexibleView flexibleView;
+ private List<UpdateOp> pendingUpdates = new List<UpdateOp>();
+ private int existingUpdateTypes = 0;
public AdapterHelper(FlexibleView flexibleView)
{
- mFlexibleView = flexibleView;
+ this.flexibleView = flexibleView;
}
/**
{
return false;
}
- mPendingUpdates.Add(new UpdateOp(UpdateOp.ADD, positionStart, itemCount));
- mExistingUpdateTypes |= UpdateOp.ADD;
- return mPendingUpdates.Count == 1;
+ pendingUpdates.Add(new UpdateOp(UpdateOp.ADD, positionStart, itemCount));
+ existingUpdateTypes |= UpdateOp.ADD;
+ return pendingUpdates.Count == 1;
}
/**
{
return false;
}
- mPendingUpdates.Add(new UpdateOp(UpdateOp.REMOVE, positionStart, itemCount));
- mExistingUpdateTypes |= UpdateOp.REMOVE;
- return mPendingUpdates.Count == 1;
+ pendingUpdates.Add(new UpdateOp(UpdateOp.REMOVE, positionStart, itemCount));
+ existingUpdateTypes |= UpdateOp.REMOVE;
+ return pendingUpdates.Count == 1;
}
public void PreProcess()
{
- int count = mPendingUpdates.Count;
+ int count = pendingUpdates.Count;
for (int i = 0; i < count; i++)
{
- UpdateOp op = mPendingUpdates[i];
+ UpdateOp op = pendingUpdates[i];
switch (op.cmd)
{
case UpdateOp.ADD:
- mFlexibleView.OffsetPositionRecordsForInsert(op.positionStart, op.itemCount);
+ flexibleView.OffsetPositionRecordsForInsert(op.positionStart, op.itemCount);
break;
case UpdateOp.REMOVE:
- mFlexibleView.OffsetPositionRecordsForRemove(op.positionStart, op.itemCount, false);
+ flexibleView.OffsetPositionRecordsForRemove(op.positionStart, op.itemCount, false);
break;
case UpdateOp.UPDATE:
break;
break;
}
}
- mPendingUpdates.Clear();
+ pendingUpdates.Clear();
}
}
{
public const int ADD = 1;
-
public const int REMOVE = 1 << 1;
-
public const int UPDATE = 1 << 2;
-
public const int MOVE = 1 << 3;
-
public const int POOL_SIZE = 30;
public int cmd;
-
public int positionStart;
// holds the target position if this is a MOVE
*/
using System;
using System.ComponentModel;
-using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using Tizen.NUI.BaseComponents;
namespace Tizen.NUI.Components
/// <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)]
+ [SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "<Pending>")]
public static readonly int NO_POSITION = -1;
/// <summary>
/// Constant value: -1.
/// <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)]
+ [SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "<Pending>")]
public static readonly int INVALID_TYPE = -1;
- private FlexibleViewAdapter mAdapter;
- private FlexibleViewLayoutManager mLayout;
- private FlexibleViewRecycler mRecycler;
- private RecycledViewPool mRecyclerPool;
- private ChildHelper mChildHelper;
+ private FlexibleViewAdapter adapter;
+ private FlexibleViewLayoutManager layout;
+ private FlexibleViewRecycler recycler;
+ private RecycledViewPool recyclerPool;
+ private ChildHelper childHelper;
- private PanGestureDetector mPanGestureDetector;
+ private PanGestureDetector panGestureDetector;
- private int mFocusedItemIndex = NO_POSITION;
+ private int focusedItemIndex = NO_POSITION;
- private AdapterHelper mAdapteHelper;
+ private AdapterHelper adapteHelper;
- private ScrollBar mScrollBar = null;
- private Timer mScrollBarShowTimer = null;
+ private ScrollBar scrollBar = null;
+ private Timer scrollBarShowTimer = null;
private EventHandler<FlexibleViewItemClickedEventArgs> clickEventHandlers;
private EventHandler<FlexibleViewItemTouchEventArgs> touchEventHandlers;
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleView()
{
- mRecyclerPool = new RecycledViewPool(this);
+ recyclerPool = new RecycledViewPool(this);
- mRecycler = new FlexibleViewRecycler(this);
- mRecycler.SetRecycledViewPool(mRecyclerPool);
+ recycler = new FlexibleViewRecycler(this);
+ recycler.SetRecycledViewPool(recyclerPool);
- mChildHelper = new ChildHelper(this);
+ childHelper = new ChildHelper(this);
- mPanGestureDetector = new PanGestureDetector();
- mPanGestureDetector.Attach(this);
- mPanGestureDetector.Detected += OnPanGestureDetected;
+ panGestureDetector = new PanGestureDetector();
+ panGestureDetector.Attach(this);
+ panGestureDetector.Detected += OnPanGestureDetected;
- mAdapteHelper = new AdapterHelper(this);
+ adapteHelper = new AdapterHelper(this);
ClippingMode = ClippingModeType.ClipToBoundingBox;
}
{
get
{
- return mFocusedItemIndex;
+ return focusedItemIndex;
}
set
{
- if (value == mFocusedItemIndex)
+ if (value == focusedItemIndex)
{
return;
}
- if (mAdapter == null)
+ if (adapter == null)
{
return;
}
- if (mLayout == null)
+ if (layout == null)
{
return;
}
FlexibleViewViewHolder nextFocusView = FindViewHolderForAdapterPosition(value);
if (nextFocusView == null)
{
- mLayout.ScrollToPosition(value);
+ layout.ScrollToPosition(value);
}
else
{
- mLayout.GetRectOfVisibleChild(this, nextFocusView, mRecycler, true);
+ layout.GetRectOfVisibleChild(this, nextFocusView, recycler, true);
DispatchFocusChanged(value);
}
}
{
return;
}
- mAdapter = adapter;
+ this.adapter = adapter;
- mAdapter.ItemEvent += OnItemEvent;
+ this.adapter.ItemEvent += OnItemEvent;
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewAdapter GetAdapter()
{
- return mAdapter;
+ return adapter;
}
/// <summary>
public void SetLayoutManager(FlexibleViewLayoutManager layoutManager)
{
if (null == layoutManager) return;
- mLayout = layoutManager;
+ layout = layoutManager;
- mLayout.SetRecyclerView(this);
+ layout.SetRecyclerView(this);
- if (mLayout.CanScrollHorizontally())
+ if (layout.CanScrollHorizontally())
{
- mPanGestureDetector.AddDirection(PanGestureDetector.DirectionHorizontal);
+ panGestureDetector.AddDirection(PanGestureDetector.DirectionHorizontal);
}
- else if (mLayout.CanScrollVertically())
+ else if (layout.CanScrollVertically())
{
- mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
+ panGestureDetector.AddDirection(PanGestureDetector.DirectionVertical);
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewLayoutManager GetLayoutManager()
{
- return mLayout;
+ return layout;
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void ScrollToPositionWithOffset(int position, int offset)
{
- mLayout.ScrollToPositionWithOffset(position, offset);
+ layout.ScrollToPositionWithOffset(position, offset);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void MoveFocus(FlexibleViewLayoutManager.Direction direction)
{
- mLayout.MoveFocus(direction, mRecycler);
+ layout.MoveFocus(direction, recycler);
}
/// <summary>
{
return;
}
- mScrollBar = scrollBar;
- Add(mScrollBar);
+ this.scrollBar = scrollBar;
+ base.Add(this.scrollBar);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void DetachScrollBar()
{
- if (mScrollBar == null)
+ if (scrollBar == null)
{
return;
}
- Remove(mScrollBar);
- mScrollBar = null;
+ Remove(scrollBar);
+ scrollBar = null;
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewViewHolder FindViewHolderForLayoutPosition(int position)
{
- int childCount = mChildHelper.GetChildCount();
+ int childCount = childHelper.GetChildCount();
for (int i = 0; i < childCount; i++)
{
- if (mChildHelper.GetChildAt(i) is FlexibleViewViewHolder holder)
+ if (childHelper.GetChildAt(i) is FlexibleViewViewHolder holder)
{
if (holder.LayoutPosition == position)
{
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewViewHolder FindViewHolderForAdapterPosition(int position)
{
- int childCount = mChildHelper.GetChildCount();
+ int childCount = childHelper.GetChildCount();
for (int i = 0; i < childCount; i++)
{
- if (mChildHelper.GetChildAt(i) is FlexibleViewViewHolder holder)
+ if (childHelper.GetChildAt(i) is FlexibleViewViewHolder holder)
{
if (holder.AdapterPosition == position)
{
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewRecycler GetRecycler()
{
- return mRecycler;
+ return recycler;
}
/// <summary>
if (type == DisposeTypes.Explicit)
{
- if (mLayout != null)
+ if (layout != null)
{
- mLayout.StopScroll(false);
- mLayout.ClearRecyclerView();
- mLayout = null;
+ layout.StopScroll(false);
+ layout.ClearRecyclerView();
+ layout = null;
}
- if (mAdapter != null)
+ if (adapter != null)
{
- mAdapter.ItemEvent -= OnItemEvent;
+ adapter.ItemEvent -= OnItemEvent;
}
- if (mPanGestureDetector != null)
+ if (panGestureDetector != null)
{
- mPanGestureDetector.Detected -= OnPanGestureDetected;
- mPanGestureDetector.Dispose();
- mPanGestureDetector = null;
+ panGestureDetector.Detected -= OnPanGestureDetected;
+ panGestureDetector.Dispose();
+ panGestureDetector = null;
}
- if (mScrollBarShowTimer != null)
+ if (scrollBarShowTimer != null)
{
- mScrollBarShowTimer.Tick -= OnShowTimerTick;
- mScrollBarShowTimer.Stop();
- mScrollBarShowTimer.Dispose();
- mScrollBarShowTimer = null;
+ scrollBarShowTimer.Tick -= OnShowTimerTick;
+ scrollBarShowTimer.Stop();
+ scrollBarShowTimer.Dispose();
+ scrollBarShowTimer = null;
}
- if (mRecyclerPool != null)
+ if (recyclerPool != null)
{
- mRecyclerPool.Clear();
- mRecyclerPool = null;
+ recyclerPool.Clear();
+ recyclerPool = null;
}
- if (mChildHelper != null)
+ if (childHelper != null)
{
- mChildHelper.Clear();
- mChildHelper.Dispose();
- mChildHelper = null;
+ childHelper.Clear();
+ childHelper.Dispose();
+ childHelper = null;
}
}
base.Dispose(type);
[EditorBrowsable(EditorBrowsableState.Never)]
public override void OnRelayout(Vector2 size, RelayoutContainer container)
{
- if (mAdapter == null)
+ if (adapter == null)
{
return;
}
- if (mLayout == null)
+ if (layout == null)
{
return;
}
DispatchLayoutStep1();
- mLayout.OnLayoutChildren(mRecycler);
+ layout.OnLayoutChildren(recycler);
RemoveAndRecycleScrapInt();
}
private void ProcessAdapterUpdates()
{
- mAdapteHelper.PreProcess();
+ adapteHelper.PreProcess();
}
private void OffsetPositionRecordsForInsert(int positionStart, int itemCount)
{
- int childCount = mChildHelper.GetChildCount();
+ int childCount = childHelper.GetChildCount();
for (int i = 0; i < childCount; i++)
{
- FlexibleViewViewHolder holder = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder holder = childHelper.GetChildAt(i);
if (holder != null && holder.AdapterPosition >= positionStart)
{
holder.OffsetPosition(itemCount, false);
}
}
- if (positionStart <= mFocusedItemIndex)
+ if (positionStart <= focusedItemIndex)
{
- mFocusedItemIndex += itemCount;
+ focusedItemIndex += itemCount;
}
}
private void OffsetPositionRecordsForRemove(int positionStart, int itemCount, bool applyToPreLayout)
{
int positionEnd = positionStart + itemCount;
- int childCount = mChildHelper.GetChildCount();
+ int childCount = childHelper.GetChildCount();
for (int i = 0; i < childCount; i++)
{
- FlexibleViewViewHolder holder = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder holder = childHelper.GetChildAt(i);
if (holder != null)
{
if (holder.AdapterPosition >= positionEnd)
}
}
- if (positionEnd <= mFocusedItemIndex)
+ if (positionEnd <= focusedItemIndex)
{
- mFocusedItemIndex -= itemCount;
+ focusedItemIndex -= itemCount;
}
- else if (positionStart <= mFocusedItemIndex)
+ else if (positionStart <= focusedItemIndex)
{
- mFocusedItemIndex = positionStart;
- if (mFocusedItemIndex >= mAdapter.GetItemCount())
+ focusedItemIndex = positionStart;
+ if (focusedItemIndex >= adapter.GetItemCount())
{
- mFocusedItemIndex = mAdapter.GetItemCount() - 1;
+ focusedItemIndex = adapter.GetItemCount() - 1;
}
}
}
private void SaveOldPositions()
{
- int childCount = mChildHelper.GetChildCount();
+ int childCount = childHelper.GetChildCount();
for (int i = 0; i < childCount; i++)
{
- FlexibleViewViewHolder holder = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder holder = childHelper.GetChildAt(i);
holder.SaveOldPosition();
}
}
private void ClearOldPositions()
{
- int childCount = mChildHelper.GetChildCount();
+ int childCount = childHelper.GetChildCount();
for (int i = 0; i < childCount; i++)
{
- FlexibleViewViewHolder holder = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder holder = childHelper.GetChildAt(i);
holder.ClearOldPosition();
}
}
private void RemoveAndRecycleScrapInt()
{
- int scrapCount = mRecycler.GetScrapCount();
+ int scrapCount = recycler.GetScrapCount();
for (int i = 0; i < scrapCount; i++)
{
- FlexibleViewViewHolder scrap = mRecycler.GetScrapViewAt(i);
- mChildHelper.RemoveView(scrap);
- mRecycler.RecycleView(scrap);
+ FlexibleViewViewHolder scrap = recycler.GetScrapViewAt(i);
+ childHelper.RemoveView(scrap);
+ recycler.RecycleView(scrap);
}
- mRecycler.Clear();
+ recycler.Clear();
}
private void ShowScrollBar(uint millisecond = 700, bool flagAni = false)
{
- if (mScrollBar == null || mLayout == null)
+ if (scrollBar == null || layout == null)
{
return;
}
- float extent = mLayout.ComputeScrollExtent();
- float range = mLayout.ComputeScrollRange();
+ float extent = layout.ComputeScrollExtent();
+ float range = layout.ComputeScrollRange();
if (range == 0)
{
return;
}
- float offset = mLayout.ComputeScrollOffset();
+ float offset = layout.ComputeScrollOffset();
- float size = mScrollBar.Direction == ScrollBar.DirectionType.Vertical ? mScrollBar.SizeHeight : mScrollBar.SizeWidth;
- float thickness = mScrollBar.Direction == ScrollBar.DirectionType.Vertical ? mScrollBar.SizeWidth : mScrollBar.SizeHeight;
+ float size = scrollBar.Direction == ScrollBar.DirectionType.Vertical ? scrollBar.SizeHeight : scrollBar.SizeWidth;
+ float thickness = scrollBar.Direction == ScrollBar.DirectionType.Vertical ? scrollBar.SizeWidth : scrollBar.SizeHeight;
float length = (float)Math.Round(size * extent / range);
// avoid the tiny thumb
{
offset = 0;
}
- if (mScrollBar.Direction == ScrollBar.DirectionType.Vertical)
+ if (scrollBar.Direction == ScrollBar.DirectionType.Vertical)
{
- mScrollBar.ThumbSize = new Size(thickness, length);
+ scrollBar.ThumbSize = new Size(thickness, length);
}
else
{
- mScrollBar.ThumbSize = new Size(length, thickness);
+ scrollBar.ThumbSize = new Size(length, thickness);
}
- mScrollBar.MinValue = 0;
- mScrollBar.MaxValue = (int)(range - extent);
- mScrollBar.SetCurrentValue((int)offset, flagAni);
- mScrollBar.Show();
- if (mScrollBarShowTimer == null)
+ scrollBar.MinValue = 0;
+ scrollBar.MaxValue = (int)(range - extent);
+ scrollBar.SetCurrentValue((int)offset, flagAni);
+ scrollBar.Show();
+ if (scrollBarShowTimer == null)
{
- mScrollBarShowTimer = new Timer(millisecond);
- mScrollBarShowTimer.Tick += OnShowTimerTick;
+ scrollBarShowTimer = new Timer(millisecond);
+ scrollBarShowTimer.Tick += OnShowTimerTick;
}
else
{
- mScrollBarShowTimer.Interval = millisecond;
+ scrollBarShowTimer.Interval = millisecond;
}
- mScrollBarShowTimer.Start();
+ scrollBarShowTimer.Start();
}
private bool OnShowTimerTick(object source, EventArgs e)
{
- if (mScrollBar != null)
+ if (scrollBar != null)
{
- mScrollBar.Hide();
+ scrollBar.Hide();
}
return false;
internal void DispatchFocusChanged(int nextFocusPosition)
{
- mAdapter.OnFocusChange(this, mFocusedItemIndex, nextFocusPosition);
+ adapter.OnFocusChange(this, focusedItemIndex, nextFocusPosition);
- mFocusedItemIndex = nextFocusPosition;
+ focusedItemIndex = nextFocusPosition;
ShowScrollBar();
}
private void DispatchChildAttached(FlexibleViewViewHolder holder)
{
- if (mAdapter != null && holder != null)
+ if (adapter != null && holder != null)
{
- mAdapter.OnViewAttachedToWindow(holder);
+ adapter.OnViewAttachedToWindow(holder);
}
}
private void DispatchChildDetached(FlexibleViewViewHolder holder)
{
- if (mAdapter != null && holder != null)
+ if (adapter != null && holder != null)
{
- mAdapter.OnViewDetachedFromWindow(holder);
+ adapter.OnViewDetachedFromWindow(holder);
}
}
private void DispatchChildDestroyed(FlexibleViewViewHolder holder)
{
- if (mAdapter != null && holder != null)
+ if (adapter != null && holder != null)
{
- mAdapter.OnDestroyViewHolder(holder);
+ adapter.OnDestroyViewHolder(holder);
}
}
{
if (e.PanGesture.State == Gesture.StateType.Started)
{
- mLayout.StopScroll(true);
+ layout.StopScroll(true);
}
else if (e.PanGesture.State == Gesture.StateType.Continuing)
{
- if (mLayout.CanScrollVertically())
+ if (layout.CanScrollVertically())
{
- mLayout.ScrollVerticallyBy(e.PanGesture.Displacement.Y, mRecycler, true);
+ layout.ScrollVerticallyBy(e.PanGesture.Displacement.Y, recycler, true);
}
- else if (mLayout.CanScrollHorizontally())
+ else if (layout.CanScrollHorizontally())
{
- mLayout.ScrollHorizontallyBy(e.PanGesture.Displacement.X, mRecycler, true);
+ layout.ScrollHorizontallyBy(e.PanGesture.Displacement.X, recycler, true);
}
ShowScrollBar();
}
else if (e.PanGesture.State == Gesture.StateType.Finished)
{
- if (mLayout.CanScrollVertically())
+ if (layout.CanScrollVertically())
{
- mLayout.ScrollVerticallyBy(e.PanGesture.Velocity.Y * 600, mRecycler, false);
+ layout.ScrollVerticallyBy(e.PanGesture.Velocity.Y * 600, recycler, false);
}
- else if (mLayout.CanScrollHorizontally())
+ else if (layout.CanScrollHorizontally())
{
- mLayout.ScrollHorizontallyBy(e.PanGesture.Velocity.X * 600, mRecycler, false);
+ layout.ScrollHorizontallyBy(e.PanGesture.Velocity.X * 600, recycler, false);
}
ShowScrollBar(1200, true);
}
switch (e.EventType)
{
case FlexibleViewAdapter.ItemEventType.Insert:
- mAdapteHelper.OnItemRangeInserted(e.param[0], e.param[1]);
+ adapteHelper.OnItemRangeInserted(e.param[0], e.param[1]);
ShowScrollBar();
break;
case FlexibleViewAdapter.ItemEventType.Remove:
- mAdapteHelper.OnItemRangeRemoved(e.param[0], e.param[1]);
+ adapteHelper.OnItemRangeRemoved(e.param[0], e.param[1]);
ShowScrollBar();
break;
case FlexibleViewAdapter.ItemEventType.Move:
internal ChildHelper GetChildHelper()
{
- return mChildHelper;
+ return childHelper;
}
}
}
-using System;
+/*
+ * Copyright(c) 2021 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;
namespace Tizen.NUI.Components
[EditorBrowsable(EditorBrowsableState.Never)]
public void NotifyItemRangeChanged(int positionStart, int itemCount)
{
+ _ = positionStart;
+ _ = itemCount;
}
/// <summary>
internal class ItemEventArgs : EventArgs
{
-
/// <summary>
/// Data change event parameters.
/// </summary>
-using System;
+/*
+ * Copyright(c) 2021 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;
/// </summary>
Down
}
-
private readonly int SCROLL_ANIMATION_DURATION = 500;
- private FlexibleView mFlexibleView;
- private FlexibleView.ChildHelper mChildHelper;
-
- private List<FlexibleViewViewHolder> mPendingRecycleViews = new List<FlexibleViewViewHolder>();
+ private FlexibleView flexibleView;
+ private FlexibleView.ChildHelper childHelper;
+ private List<FlexibleViewViewHolder> pendingRecycleViews = new List<FlexibleViewViewHolder>();
- private Animation mScrollAni;
+ private Animation scrollAnimation;
/// <summary>
/// Layout all relevant child views from the given adapter.
{
get
{
- return mFlexibleView.FocusedItemIndex;
+ return flexibleView.FocusedItemIndex;
}
}
{
get
{
- FlexibleViewAdapter b = mFlexibleView != null ? mFlexibleView.GetAdapter() : null;
-
+ FlexibleViewAdapter b = flexibleView != null ? flexibleView.GetAdapter() : null;
return b != null ? b.GetItemCount() : 0;
}
}
if (nextFocusChild != null)
{
- GetRectOfVisibleChild(mFlexibleView, nextFocusChild, recycler, false);
+ GetRectOfVisibleChild(flexibleView, nextFocusChild, recycler, false);
ChangeFocus(nextFocusPosition);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void RelayoutRequest()
{
- if (mFlexibleView != null)
+ if (flexibleView != null)
{
- mFlexibleView.LayoutManagerRelayoutRequest();
+ flexibleView.LayoutManagerRelayoutRequest();
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void ChangeFocus(int focusPosition)
{
- if (mFlexibleView != null)
- {
- mFlexibleView.DispatchFocusChanged(focusPosition);
- }
+ flexibleView?.DispatchFocusChanged(focusPosition);
}
/// <summary>
{
get
{
- return mChildHelper != null ? mChildHelper.GetChildCount() : 0;
+ return childHelper != null ? childHelper.GetChildCount() : 0;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewViewHolder GetChildAt(int index)
{
- return mChildHelper != null ? mChildHelper.GetChildAt(index) : null;
+ return childHelper != null ? childHelper.GetChildAt(index) : null;
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewViewHolder FindItemViewByPosition(int position)
{
- return mFlexibleView.FindViewHolderForLayoutPosition(position);
+ return flexibleView.FindViewHolderForLayoutPosition(position);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void OffsetChildrenHorizontal(float dx, bool immediate)
{
- if (mChildHelper == null)
+ if (childHelper == null)
{
return;
}
return;
}
- int childCount = mChildHelper.GetChildCount();
+ int childCount = childHelper.GetChildCount();
if (immediate == true)
{
for (int i = childCount - 1; i >= 0; i--)
{
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(i);
v.ItemView.PositionX += dx;
}
}
else
{
- if (mScrollAni == null)
+ if (scrollAnimation == null)
{
- mScrollAni = new Animation();
- mScrollAni.Duration = SCROLL_ANIMATION_DURATION;
- mScrollAni.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare);
+ scrollAnimation = new Animation();
+ scrollAnimation.Duration = SCROLL_ANIMATION_DURATION;
+ scrollAnimation.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare);
}
// avoid out of boundary of flexibleview. delta value might be used for shadow.
// this must be done before animation clear.
if (childCount > 0)
{
- FlexibleViewViewHolder vh = mChildHelper.GetChildAt(0);
+ FlexibleViewViewHolder vh = childHelper.GetChildAt(0);
if (vh.LayoutPosition == 0)
{
if ((int)(vh.Left + dx) > 0)
}
}
- vh = mChildHelper.GetChildAt(childCount - 1);
+ vh = childHelper.GetChildAt(childCount - 1);
if (vh.LayoutPosition == ItemCount - 1)
{
if ((int)(vh.Right + dx) < (int)Width + PaddingRight)
float[] childrenPosition = new float[childCount];
for (int i = childCount - 1; i >= 0; i--)
{
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(i);
childrenPosition[i] = v.ItemView.PositionX;
}
- mScrollAni.Clear();
- mScrollAni.Finished += OnScrollAnimationFinished;
+ scrollAnimation.Clear();
+ scrollAnimation.Finished += OnScrollAnimationFinished;
for (int i = childCount - 1; i >= 0; i--)
{
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(i);
// set position again because position might be changed after animation clear.
v.ItemView.PositionX = childrenPosition[i];
- mScrollAni.AnimateTo(v.ItemView, "PositionX", v.ItemView.PositionX + dx);
+ scrollAnimation.AnimateTo(v.ItemView, "PositionX", v.ItemView.PositionX + dx);
}
- mScrollAni.Play();
+ scrollAnimation.Play();
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void OffsetChildrenVertical(float dy, bool immediate)
{
- if (mChildHelper == null)
+ if (childHelper == null)
{
return;
}
return;
}
- int childCount = mChildHelper.GetChildCount();
+ int childCount = childHelper.GetChildCount();
if (immediate == true)
{
for (int i = childCount - 1; i >= 0; i--)
{
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(i);
v.ItemView.PositionY += dy;
}
}
else
{
- if (mScrollAni == null)
+ if (scrollAnimation == null)
{
- mScrollAni = new Animation();
- mScrollAni.Duration = SCROLL_ANIMATION_DURATION;
- mScrollAni.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare);
+ scrollAnimation = new Animation();
+ scrollAnimation.Duration = SCROLL_ANIMATION_DURATION;
+ scrollAnimation.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.EaseOutSquare);
}
// avoid out of boundary of flexibleview. delta value might be used for shadow.
// this must be done before animation clear.
if (childCount > 0)
{
- FlexibleViewViewHolder vh = mChildHelper.GetChildAt(0);
+ FlexibleViewViewHolder vh = childHelper.GetChildAt(0);
if (vh.LayoutPosition == 0)
{
if ((int)(vh.Top + dy) > 0)
}
}
- vh = mChildHelper.GetChildAt(childCount - 1);
+ vh = childHelper.GetChildAt(childCount - 1);
if (vh.LayoutPosition == ItemCount - 1)
{
if ((int)(vh.Bottom + dy) < (int)Height + PaddingBottom)
float[] childPosition = new float[childCount];
for (int i = childCount - 1; i >= 0; i--)
{
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(i);
childPosition[i] = v.ItemView.PositionY;
}
- mScrollAni.Clear();
- mScrollAni.Finished += OnScrollAnimationFinished;
+ scrollAnimation.Clear();
+ scrollAnimation.Finished += OnScrollAnimationFinished;
for (int i = childCount - 1; i >= 0; i--)
{
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(i);
// set position again because position might be changed after animation clear.
v.ItemView.PositionY = childPosition[i];
- mScrollAni.AnimateTo(v.ItemView, "PositionY", v.ItemView.PositionY + dy);
+ scrollAnimation.AnimateTo(v.ItemView, "PositionY", v.ItemView.PositionY + dy);
}
- mScrollAni.Play();
+ scrollAnimation.Play();
}
}
{
get
{
- return mFlexibleView != null ? mFlexibleView.SizeWidth : 0;
+ return flexibleView != null ? flexibleView.SizeWidth : 0;
}
}
{
get
{
- return mFlexibleView != null ? mFlexibleView.SizeHeight : 0;
+ return flexibleView != null ? flexibleView.SizeHeight : 0;
}
}
{
get
{
- return mFlexibleView?.Padding?.Start ?? 0;
+ return flexibleView?.Padding?.Start ?? 0;
}
}
{
get
{
- return mFlexibleView?.Padding?.Top ?? 0;
+ return flexibleView?.Padding?.Top ?? 0;
}
}
{
get
{
- return mFlexibleView?.Padding?.End ?? 0;
+ return flexibleView?.Padding?.End ?? 0;
}
}
{
get
{
- return mFlexibleView?.Padding?.Bottom ?? 0;
+ return flexibleView?.Padding?.Bottom ?? 0;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
public void ScrapAttachedViews(FlexibleViewRecycler recycler)
{
- if (null == mChildHelper || null == recycler)
+ if (null == childHelper || null == recycler)
{
return;
}
recycler.Clear();
- mChildHelper.ScrapViews(recycler);
+ childHelper.ScrapViews(recycler);
}
/**
public void RemoveAndRecycleViewAt(int index, FlexibleViewRecycler recycler)
{
if (null == recycler) return;
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(index);
- mChildHelper.RemoveViewAt(index);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(index);
+ childHelper.RemoveViewAt(index);
recycler.RecycleView(v);
}
{
for (int i = startIndex; i < endIndex; i++)
{
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(i);
if (v.PendingRecycle == false)
{
v.PendingRecycle = true;
- mPendingRecycleViews.Add(v);
+ pendingRecycleViews.Add(v);
}
}
}
{
for (int i = startIndex; i > endIndex; i--)
{
- FlexibleViewViewHolder v = mChildHelper.GetChildAt(i);
+ FlexibleViewViewHolder v = childHelper.GetChildAt(i);
if (v.PendingRecycle == false)
{
v.PendingRecycle = true;
- mPendingRecycleViews.Add(v);
+ pendingRecycleViews.Add(v);
}
}
}
if (type == DisposeTypes.Explicit)
{
- mScrollAni?.Dispose();
+ scrollAnimation?.Dispose();
}
base.Dispose(type);
internal void SetRecyclerView(FlexibleView recyclerView)
{
- mFlexibleView = recyclerView;
- mChildHelper = recyclerView.GetChildHelper();
+ flexibleView = recyclerView;
+ childHelper = recyclerView.GetChildHelper();
}
internal void ClearRecyclerView()
{
- mFlexibleView = null;
- mChildHelper = null;
+ flexibleView = null;
+ childHelper = null;
}
internal void StopScroll(bool doSomethingAfterAnimationStopped)
{
- if (mScrollAni != null && mScrollAni.State == Animation.States.Playing)
+ if (scrollAnimation != null && scrollAnimation.State == Animation.States.Playing)
{
- mScrollAni.Finished -= OnScrollAnimationFinished;
- mScrollAni.Stop();
+ scrollAnimation.Finished -= OnScrollAnimationFinished;
+ scrollAnimation.Stop();
if (doSomethingAfterAnimationStopped)
{
- OnScrollAnimationFinished(mScrollAni, null);
+ OnScrollAnimationFinished(scrollAnimation, null);
}
}
}
private void OnScrollAnimationFinished(object sender, EventArgs e)
{
- foreach (FlexibleViewViewHolder holder in mPendingRecycleViews)
+ foreach (FlexibleViewViewHolder holder in pendingRecycleViews)
{
holder.PendingRecycle = false;
}
- mPendingRecycleViews.Clear();
+ pendingRecycleViews.Clear();
int start = FlexibleView.NO_POSITION;
FlexibleViewViewHolder firstItemView = FindFirstVisibleItemView();
{
FlexibleViewViewHolder v = removedViewList[i];
v.PendingRecycle = false;
- mFlexibleView.GetRecycler().RecycleView(v);
- mChildHelper.RemoveView(v);
+ flexibleView.GetRecycler().RecycleView(v);
+ childHelper.RemoveView(v);
}
// relayout
if (holder.IsScrap())
{
holder.Unscrap();
- mChildHelper.AttachView(holder, index);
+ childHelper.AttachView(holder, index);
}
else
{
- mChildHelper.AddView(holder, index);
+ childHelper.AddView(holder, index);
}
}
private void RecycleChildrenInt(FlexibleViewRecycler recycler)
{
if (null == recycler) return;
- foreach (FlexibleViewViewHolder holder in mPendingRecycleViews)
+ foreach (FlexibleViewViewHolder holder in pendingRecycleViews)
{
holder.PendingRecycle = false;
recycler.RecycleView(holder);
- mChildHelper.RemoveView(holder);
+ childHelper.RemoveView(holder);
}
- mPendingRecycleViews.Clear();
+ pendingRecycleViews.Clear();
}
private void ScrapOrRecycleView(FlexibleViewRecycler recycler, FlexibleViewViewHolder itemView)
-using System.Collections.Generic;
+/*
+ * Copyright(c) 2021 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.Collections.Generic;
using System.ComponentModel;
namespace Tizen.NUI.Components
[EditorBrowsable(EditorBrowsableState.Never)]
public class FlexibleViewRecycler
{
- private FlexibleView mFlexibleView;
- private FlexibleView.RecycledViewPool mRecyclerPool;
+ private FlexibleView flexibleView;
+ private FlexibleView.RecycledViewPool recyclerPool;
- private List<FlexibleViewViewHolder> mAttachedScrap = new List<FlexibleViewViewHolder>();
- private List<FlexibleViewViewHolder> mChangedScrap = null;
- //private List<ItemView> mCachedViews = new List<ItemView>();
+ private List<FlexibleViewViewHolder> attachedScrap = new List<FlexibleViewViewHolder>();
+ private List<FlexibleViewViewHolder> changedScrap = null;
- //private List<FlexibleViewViewHolder> mUnmodifiableAttachedScrap;
-
- private int mCacheSizeMax = 2;
+ private int cacheSizeMax = 2;
/// <summary>
/// FlexibleViewRecycler constructor.
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewRecycler(FlexibleView recyclerView)
{
- mFlexibleView = recyclerView;
+ flexibleView = recyclerView;
}
/// 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 SetViewCacheSize(int viewCount)
{
- mCacheSizeMax = viewCount;
+ cacheSizeMax = viewCount;
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewViewHolder GetViewForPosition(int position)
{
- FlexibleViewAdapter b = mFlexibleView != null ? mFlexibleView.GetAdapter() : null;
+ FlexibleViewAdapter b = flexibleView != null ? flexibleView.GetAdapter() : null;
if (b == null)
{
return null;
int type = b.GetItemViewType(position);
FlexibleViewViewHolder itemView = null;
- for (int i = 0; i < mAttachedScrap.Count; i++)
+ for (int i = 0; i < attachedScrap.Count; i++)
{
- if (mAttachedScrap[i].LayoutPosition == position && mAttachedScrap[i].ItemViewType == type)
+ if (attachedScrap[i].LayoutPosition == position && attachedScrap[i].ItemViewType == type)
{
- itemView = mAttachedScrap[i];
+ itemView = attachedScrap[i];
break;
}
}
if (itemView == null)
{
- itemView = mRecyclerPool.GetRecycledView(type);
+ itemView = recyclerPool.GetRecycledView(type);
if (itemView == null)
{
itemView = b.OnCreateViewHolder(type);
{
if (null == itemView) return;
itemView.ScrapContainer = null;
- mRecyclerPool.PutRecycledView(itemView);
+ recyclerPool.PutRecycledView(itemView);
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public int GetScrapCount()
{
- return mAttachedScrap.Count;
+ return attachedScrap.Count;
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public FlexibleViewViewHolder GetScrapViewAt(int index)
{
- return mAttachedScrap[index];
+ return attachedScrap[index];
}
/// <summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void Clear()
{
- mAttachedScrap.Clear();
- if (mChangedScrap != null)
+ attachedScrap.Clear();
+ if (changedScrap != null)
{
- mChangedScrap.Clear();
+ changedScrap.Clear();
}
}
internal void ScrapView(FlexibleViewViewHolder itemView)
{
- mAttachedScrap.Add(itemView);
+ attachedScrap.Add(itemView);
itemView.ScrapContainer = this;
}
internal void UnscrapView(FlexibleViewViewHolder itemView)
{
- mAttachedScrap.Remove(itemView);
+ attachedScrap.Remove(itemView);
itemView.ScrapContainer = null;
}
internal void SetRecycledViewPool(FlexibleView.RecycledViewPool pool)
{
- mRecyclerPool = pool;
+ recyclerPool = pool;
}
}
}
-using System;
+/*
+ * Copyright(c) 2021 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 Tizen.NUI.BaseComponents;
[EditorBrowsable(EditorBrowsableState.Never)]
public class FlexibleViewViewHolder
{
- // This FlexibleViewViewHolder has been bound to a position; AdapterPosition, mItemId and mItemViewType
- // are all valid.
- //static readonly int FLAG_BOUND = 1 << 0;
-
- // The data this FlexibleViewViewHolder's view reflects is stale and needs to be rebound
- // by the adapter. AdapterPosition and mItemId are consistent.
- //static readonly int FLAG_UPDATE = 1 << 1;
-
- // This FlexibleViewViewHolder's data is invalid. The identity implied by AdapterPosition and mItemId
- // are not to be trusted and may no longer match the item view type.
- // This FlexibleViewViewHolder must be fully rebound to different data.
- //static readonly int FLAG_INVALID = 1 << 2;
-
- // This FlexibleViewViewHolder points at data that represents an item previously removed from the
- // data set. Its view may still be used for things like outgoing animations.
- //static readonly int FLAG_REMOVED = 1 << 3;
-
- // This FlexibleViewViewHolder should not be recycled. This flag is set via setIsRecyclable()
- // and is intended to keep views around during animations.
- //static readonly int FLAG_NOT_RECYCLABLE = 1 << 4;
-
- // This FlexibleViewViewHolder is returned from scrap which means we are expecting an addView call
- // for this itemView. When returned from scrap, FlexibleViewViewHolder stays in the scrap list until
- // the end of the layout pass and then recycled by FlexibleViewRecyclerView if it is not added back to
- // the FlexibleViewRecyclerView.
- //static readonly int FLAG_RETURNED_FROM_SCRAP = 1 << 5;
-
- // This FlexibleViewViewHolder is fully managed by the FlexibleViewLayoutManager. We do not scrap, recycle or remove
- // it unless FlexibleViewLayoutManager is replaced.
- // It is still fully visible to the FlexibleViewLayoutManager.
- //static readonly int FLAG_IGNORE = 1 << 7;
-
- private int mFlags;
- private int mPreLayoutPosition = FlexibleView.NO_POSITION;
+ private int flags;
+ private int preLayoutPosition = FlexibleView.NO_POSITION;
/// <summary>
/// FlexibleViewViewHolder constructor.
{
get
{
- return mPreLayoutPosition == FlexibleView.NO_POSITION ? AdapterPosition : mPreLayoutPosition;
+ return preLayoutPosition == FlexibleView.NO_POSITION ? AdapterPosition : preLayoutPosition;
}
}
{
OldPosition = AdapterPosition;
}
- if (mPreLayoutPosition == FlexibleView.NO_POSITION)
+ if (preLayoutPosition == FlexibleView.NO_POSITION)
{
- mPreLayoutPosition = AdapterPosition;
+ preLayoutPosition = AdapterPosition;
}
if (applyToPreLayout)
{
- mPreLayoutPosition += offset;
+ preLayoutPosition += offset;
}
AdapterPosition += offset;
}
internal void ClearOldPosition()
{
OldPosition = FlexibleView.NO_POSITION;
- mPreLayoutPosition = FlexibleView.NO_POSITION;
+ preLayoutPosition = FlexibleView.NO_POSITION;
}
internal void SaveOldPosition()
private void SetFlags(int flags, int mask)
{
- mFlags = (mFlags & ~mask) | (flags & mask);
+ this.flags = (this.flags & ~mask) | (flags & mask);
}
private void AddFlags(int flags)
{
- mFlags |= flags;
+ this.flags |= flags;
}
}
}
/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
{
private const int DEFAULT_SPAN_COUNT = -1;
- private int mSpanCount = DEFAULT_SPAN_COUNT;
+ private int spanCount = DEFAULT_SPAN_COUNT;
/// <summary>
/// Creates a GridLayoutManager with orientation.
[EditorBrowsable(EditorBrowsableState.Never)]
public GridLayoutManager(int spanCount, int orientation) : base(orientation)
{
- mSpanCount = spanCount;
+ this.spanCount = spanCount;
}
internal override void EnsureAnchorReady(FlexibleViewRecycler recycler, AnchorInfo anchorInfo, int itemDirection)
{
bool layingOutInPrimaryDirection = (itemDirection == LayoutState.ITEM_DIRECTION_TAIL);
- int span = anchorInfo.Position % mSpanCount;
+ int span = anchorInfo.Position % spanCount;
if (layingOutInPrimaryDirection)
{
// choose span 0
int bestSpan = span;
while (pos < indexLimit)
{
- int next = (pos + 1) % mSpanCount;
+ int next = (pos + 1) % spanCount;
if (next > bestSpan)
{
pos += 1;
switch (direction)
{
case FlexibleViewLayoutManager.Direction.Left:
- if (position >= mSpanCount)
+ if (position >= spanCount)
{
- return position - mSpanCount;
+ return position - spanCount;
}
break;
case FlexibleViewLayoutManager.Direction.Right:
- if (position < ItemCount - mSpanCount)
+ if (position < ItemCount - spanCount)
{
- return position + mSpanCount;
+ return position + spanCount;
}
break;
case FlexibleViewLayoutManager.Direction.Up:
- if (position % mSpanCount > 0)
+ if (position % spanCount > 0)
{
return position - 1;
}
break;
case FlexibleViewLayoutManager.Direction.Down:
- if (position < ItemCount - 1 && (position % mSpanCount < mSpanCount - 1))
+ if (position < ItemCount - 1 && (position % spanCount < spanCount - 1))
{
return position + 1;
}
switch (direction)
{
case FlexibleViewLayoutManager.Direction.Left:
- if (position % mSpanCount > 0)
+ if (position % spanCount > 0)
{
return position - 1;
}
break;
case FlexibleViewLayoutManager.Direction.Right:
- if (position < ItemCount - 1 && (position % mSpanCount < mSpanCount - 1))
+ if (position < ItemCount - 1 && (position % spanCount < spanCount - 1))
{
return position + 1;
}
break;
case FlexibleViewLayoutManager.Direction.Up:
- if (position >= mSpanCount)
+ if (position >= spanCount)
{
- return position - mSpanCount;
+ return position - spanCount;
}
break;
case FlexibleViewLayoutManager.Direction.Down:
- if (position < ItemCount - mSpanCount)
+ if (position < ItemCount - spanCount)
{
- return position + mSpanCount;
+ return position + spanCount;
}
break;
}
bool layingOutInPrimaryDirection =
layoutState.ItemDirection == LayoutState.ITEM_DIRECTION_TAIL;
- int count = mSpanCount;
+ int count = spanCount;
for (int i = 0; i < count; i++)
{
FlexibleViewViewHolder holder = layoutState.Next(recycler);
else
AddView(holder, 0);
- result.Consumed = mOrientationHelper.GetViewHolderMeasurement(holder);
+ result.Consumed = orientationHelper.GetViewHolderMeasurement(holder);
float left, top, width, height;
if (Orientation == VERTICAL)
}
}
}
-
-
}
}
-using System;
+/*
+ * Copyright(c) 2021 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.Text;
else
AddView(holder, 0);
- result.Consumed = mOrientationHelper.GetViewHolderMeasurement(holder);
+ result.Consumed = orientationHelper.GetViewHolderMeasurement(holder);
float left, top, width, height;
if (Orientation == VERTICAL)
{
return null;
}
- int maxScroll = (int)(MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace());
+ int maxScroll = (int)(MAX_SCROLL_FACTOR * orientationHelper.GetTotalSpace());
UpdateLayout(layoutDir, maxScroll, false);
mLayoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
mLayoutState.Recycle = false;
}
anchorInfo.Position = FocusPosition != NO_POSITION ? FocusPosition : 0;
- anchorInfo.Coordinate = anchorInfo.LayoutFromEnd ? mOrientationHelper.GetEndAfterPadding() : mOrientationHelper.GetStartAfterPadding();
+ anchorInfo.Coordinate = anchorInfo.LayoutFromEnd ? orientationHelper.GetEndAfterPadding() : orientationHelper.GetStartAfterPadding();
}
if (mPendingScrollPositionOffset == INVALID_OFFSET)
{
- anchorInfo.Coordinate = anchorInfo.LayoutFromEnd ? mOrientationHelper.GetEndAfterPadding() : mOrientationHelper.GetStartAfterPadding();
+ anchorInfo.Coordinate = anchorInfo.LayoutFromEnd ? orientationHelper.GetEndAfterPadding() : orientationHelper.GetStartAfterPadding();
}
else
{
if (mShouldReverseLayout)
{
- anchorInfo.Coordinate = mOrientationHelper.GetEndAfterPadding()
+ anchorInfo.Coordinate = orientationHelper.GetEndAfterPadding()
- mPendingScrollPositionOffset;
}
else
{
- anchorInfo.Coordinate = mOrientationHelper.GetStartAfterPadding()
+ anchorInfo.Coordinate = orientationHelper.GetStartAfterPadding()
+ mPendingScrollPositionOffset;
}
}
anchorChild = GetChildAt(0);
}
anchorInfo.Position = anchorChild.LayoutPosition;
- anchorInfo.Coordinate = mOrientationHelper.GetViewHolderStart(anchorChild);
+ anchorInfo.Coordinate = orientationHelper.GetViewHolderStart(anchorChild);
return true;
}
FlexibleViewViewHolder child = GetChildClosestToEnd();
if (child != null)
{
- if (child.ItemView.Focusable == false || mOrientationHelper.GetViewHolderEnd(child) + scrolled < mOrientationHelper.GetEnd())
+ if (child.ItemView.Focusable == false || orientationHelper.GetViewHolderEnd(child) + scrolled < orientationHelper.GetEnd())
{
- layoutState.Available = MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace();
+ layoutState.Available = MAX_SCROLL_FACTOR * orientationHelper.GetTotalSpace();
layoutState.Extra = 0;
layoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
layoutState.Recycle = false;
FlexibleViewViewHolder child = GetChildClosestToStart();
if (child != null)
{
- if (child.ItemView.Focusable == false || mOrientationHelper.GetViewHolderStart(child) + scrolled > 0)
+ if (child.ItemView.Focusable == false || orientationHelper.GetViewHolderStart(child) + scrolled > 0)
{
- layoutState.Available = MAX_SCROLL_FACTOR * mOrientationHelper.GetTotalSpace();
+ layoutState.Available = MAX_SCROLL_FACTOR * orientationHelper.GetTotalSpace();
layoutState.Extra = 0;
layoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
layoutState.Recycle = false;
for (int i = childCount - 1; i >= 0; i--)
{
FlexibleViewViewHolder child = GetChildAt(i);
- if (mOrientationHelper.GetViewHolderEnd(child) > limit)
+ if (orientationHelper.GetViewHolderEnd(child) > limit)
{
// stop here
RecycleChildren(recycler, childCount - 1, i, immediate);
for (int i = 0; i < childCount; i++)
{
FlexibleViewViewHolder child = GetChildAt(i);
- if (mOrientationHelper.GetViewHolderEnd(child) > limit)
+ if (orientationHelper.GetViewHolderEnd(child) > limit)
{
// stop here
RecycleChildren(recycler, 0, i, immediate);
return;
}
int childCount = ChildCount;
- float limit = mOrientationHelper.GetEnd() - dt;
+ float limit = orientationHelper.GetEnd() - dt;
if (mShouldReverseLayout)
{
for (int i = 0; i < childCount; i++)
{
FlexibleViewViewHolder child = GetChildAt(i);
- if (mOrientationHelper.GetViewHolderStart(child) < limit)
+ if (orientationHelper.GetViewHolderStart(child) < limit)
{
// stop here
RecycleChildren(recycler, 0, i, immediate);
for (int i = childCount - 1; i >= 0; i--)
{
FlexibleViewViewHolder child = GetChildAt(i);
- if (mOrientationHelper.GetViewHolderStart(child) < limit)
+ if (orientationHelper.GetViewHolderStart(child) < limit)
{
// stop here
RecycleChildren(recycler, childCount - 1, i, immediate);
float scrolled = absDy > consumed ? -layoutDirection * consumed : dy;
Cache(recycler, mLayoutState, immediate, scrolled);
- mOrientationHelper.OffsetChildren(scrolled, immediate);
+ orientationHelper.OffsetChildren(scrolled, immediate);
return scrolled;
}
private void UpdateLayout(int direction, float space, bool canUseExistingSpace)
{
- mLayoutState.ResetLayout(direction, canUseExistingSpace, space, mOrientationHelper, this);
+ mLayoutState.ResetLayout(direction, canUseExistingSpace, space, orientationHelper, this);
}
// Convenience method to find the child closes to start. Caller should check it has enough
private void UpdateLayoutStateToFillEnd(int itemPosition, float offset)
{
- mLayoutState.Available = mOrientationHelper.GetEndAfterPadding() - offset;
+ mLayoutState.Available = orientationHelper.GetEndAfterPadding() - offset;
mLayoutState.ItemDirection = mShouldReverseLayout ? LayoutState.ITEM_DIRECTION_HEAD :
LayoutState.ITEM_DIRECTION_TAIL;
mLayoutState.CurrentPosition = itemPosition;
mLayoutState.LayoutDirection = LayoutState.LAYOUT_END;
mLayoutState.Offset = offset;
mLayoutState.ScrollingOffset = LayoutState.SCROLLING_OFFSET_NaN;
- mLayoutState.Extra = mOrientationHelper.GetEndPadding();
+ mLayoutState.Extra = orientationHelper.GetEndPadding();
}
private void UpdateLayoutStateToFillStart(int itemPosition, float offset)
{
- mLayoutState.Available = offset - mOrientationHelper.GetStartAfterPadding();
+ mLayoutState.Available = offset - orientationHelper.GetStartAfterPadding();
mLayoutState.CurrentPosition = itemPosition;
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();
+ mLayoutState.Extra = orientationHelper.GetStartAfterPadding();
}
private FlexibleViewViewHolder FindFirstCompleteVisibleItemView()
for (int i = 0; i < childCount; i++)
{
FlexibleViewViewHolder child = GetChildAt(i);
- int start = (int)mOrientationHelper.GetViewHolderStart(child);
- if (start > 0 && start < (int)mOrientationHelper.GetEnd())
+ int start = (int)orientationHelper.GetViewHolderStart(child);
+ if (start > 0 && start < (int)orientationHelper.GetEnd())
{
return child;
}
for (int i = childCount - 1; i >= 0; i--)
{
FlexibleViewViewHolder child = GetChildAt(i);
- int start = (int)mOrientationHelper.GetViewHolderStart(child);
- if (start > 0 && start < (int)mOrientationHelper.GetEnd())
+ int start = (int)orientationHelper.GetViewHolderStart(child);
+ if (start > 0 && start < (int)orientationHelper.GetEnd())
{
return child;
}
for (int i = childCount - 1; i >= 0; i--)
{
FlexibleViewViewHolder child = GetChildAt(i);
- if ((int)mOrientationHelper.GetViewHolderEnd(child) < (int)mOrientationHelper.GetEnd())
+ if ((int)orientationHelper.GetViewHolderEnd(child) < (int)orientationHelper.GetEnd())
{
return child;
}
for (int i = 0; i < childCount; i++)
{
FlexibleViewViewHolder child = GetChildAt(i);
- if ((int)mOrientationHelper.GetViewHolderEnd(child) < (int)mOrientationHelper.GetEnd())
+ if ((int)orientationHelper.GetViewHolderEnd(child) < (int)orientationHelper.GetEnd())
{
return child;
}
/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
*/
using System;
using System.ComponentModel;
+using System.Diagnostics.CodeAnalysis;
namespace Tizen.NUI.Components
{
/// <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)]
+ [SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "<Pending>")]
public static readonly int NO_POSITION = FlexibleView.NO_POSITION;
/// <summary>
/// Constant value: -2^31.
/// <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)]
+ [SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", Justification = "<Pending>")]
public static readonly int INVALID_OFFSET = -2147483648;
private const float MAX_SCROLL_FACTOR = 1 / 3f;
- internal OrientationHelper mOrientationHelper;
+ internal OrientationHelper orientationHelper;
private LayoutState mLayoutState;
private AnchorInfo mAnchorInfo = new AnchorInfo();
public LinearLayoutManager(int orientation)
{
Orientation = orientation;
- mOrientationHelper = OrientationHelper.CreateOrientationHelper(this, Orientation);
+ orientationHelper = OrientationHelper.CreateOrientationHelper(this, Orientation);
mLayoutState = new LayoutState();
- mLayoutState.Offset = mOrientationHelper.GetStartAfterPadding();
+ mLayoutState.Offset = orientationHelper.GetStartAfterPadding();
}
/// <summary>
? Math.Max(0, ItemCount - maxPosition - 1)
: Math.Max(0, minPosition);
- float laidOutArea = Math.Abs(mOrientationHelper.GetViewHolderEnd(endChild)
- - mOrientationHelper.GetViewHolderStart(startChild));
+ float laidOutArea = Math.Abs(orientationHelper.GetViewHolderEnd(endChild)
+ - orientationHelper.GetViewHolderStart(startChild));
int itemRange = Math.Abs(startChild.LayoutPosition - endChild.LayoutPosition) + 1;
float avgSizePerRow = laidOutArea / itemRange;
- return (float)Math.Round(itemsBefore * avgSizePerRow + (mOrientationHelper.GetStartAfterPadding()
- - mOrientationHelper.GetViewHolderStart(startChild)));
+ return (float)Math.Round(itemsBefore * avgSizePerRow + (orientationHelper.GetStartAfterPadding()
+ - orientationHelper.GetViewHolderStart(startChild)));
}
/// <summary>
{
return 0;
}
- float extend = mOrientationHelper.GetViewHolderEnd(endChild)
- - mOrientationHelper.GetViewHolderStart(startChild);
- return Math.Min(mOrientationHelper.GetTotalSpace(), extend);
+ float extend = orientationHelper.GetViewHolderEnd(endChild)
+ - orientationHelper.GetViewHolderStart(startChild);
+ return Math.Min(orientationHelper.GetTotalSpace(), extend);
}
/// <summary>
{
return 0;
}
- float laidOutArea = mOrientationHelper.GetViewHolderEnd(endChild)
- - mOrientationHelper.GetViewHolderStart(startChild);
+ float laidOutArea = orientationHelper.GetViewHolderEnd(endChild)
+ - orientationHelper.GetViewHolderStart(startChild);
int laidOutRange = Math.Abs(startChild.LayoutPosition - endChild.LayoutPosition) + 1;
// estimate a size for full list.
return laidOutArea / laidOutRange * ItemCount;
for (int i = 0; i < childCount; i++)
{
FlexibleViewViewHolder child = GetChildAt(i);
- int end = (int)mOrientationHelper.GetViewHolderEnd(child);
- if (end >= 0 && end < (int)mOrientationHelper.GetEnd())
+ int end = (int)orientationHelper.GetViewHolderEnd(child);
+ if (end >= 0 && end < (int)orientationHelper.GetEnd())
{
return child;
}
for (int i = childCount - 1; i >= 0; i--)
{
FlexibleViewViewHolder child = GetChildAt(i);
- int end = (int)mOrientationHelper.GetViewHolderEnd(child);
- if (end >= 0 && end < (int)mOrientationHelper.GetEnd())
+ int end = (int)orientationHelper.GetViewHolderEnd(child);
+ if (end >= 0 && end < (int)orientationHelper.GetEnd())
{
return child;
}
for (int i = childCount - 1; i >= 0; i--)
{
FlexibleViewViewHolder child = GetChildAt(i);
- int start = (int)mOrientationHelper.GetViewHolderStart(child);
- if (start > 0 && start < (int)mOrientationHelper.GetEnd())
+ int start = (int)orientationHelper.GetViewHolderStart(child);
+ if (start > 0 && start < (int)orientationHelper.GetEnd())
{
return child;
}
for (int i = 0; i < childCount; i++)
{
FlexibleViewViewHolder child = GetChildAt(i);
- int start = (int)mOrientationHelper.GetViewHolderStart(child);
- if (start > 0 && start < (int)mOrientationHelper.GetEnd())
+ int start = (int)orientationHelper.GetViewHolderStart(child);
+ if (start > 0 && start < (int)orientationHelper.GetEnd())
{
return child;
}
/*
- * Copyright(c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
private const int INVALID_SIZE = -1;
- protected FlexibleViewLayoutManager mLayoutManager;
+ protected FlexibleViewLayoutManager layoutManager;
- private float mLastTotalSpace = INVALID_SIZE;
+ private float lastTotalSpace = INVALID_SIZE;
public OrientationHelper(FlexibleViewLayoutManager layoutManager)
{
- mLayoutManager = layoutManager;
+ this.layoutManager = layoutManager;
}
// Call this method after onLayout method is complete if state is NOT pre-layout.
// calculations.
public void OnLayoutComplete()
{
- mLastTotalSpace = GetTotalSpace();
+ lastTotalSpace = GetTotalSpace();
}
// Returns the layout space change between the previous layout pass and current layout pass.
// @see #onLayoutComplete()
public float GetTotalSpaceChange()
{
- return INVALID_SIZE == mLastTotalSpace ? 0 : GetTotalSpace() - mLastTotalSpace;
+ return INVALID_SIZE == lastTotalSpace ? 0 : GetTotalSpace() - lastTotalSpace;
}
// Returns the start of the view including its decoration and margin.
public override float GetEndAfterPadding()
{
- return mLayoutManager.Width - mLayoutManager.PaddingRight;
+ return layoutManager.Width - layoutManager.PaddingRight;
}
public override float GetEnd()
{
- return mLayoutManager.Width;
+ return layoutManager.Width;
}
public override void OffsetChildren(float amount, bool immediate)
{
- mLayoutManager.OffsetChildrenHorizontal(amount, immediate);
+ layoutManager.OffsetChildrenHorizontal(amount, immediate);
}
public override float GetStartAfterPadding()
{
- return mLayoutManager.PaddingLeft;
+ return layoutManager.PaddingLeft;
}
public override float GetViewHolderMeasurement(FlexibleViewViewHolder holder)
public override float GetTotalSpace()
{
- return mLayoutManager.Width - mLayoutManager.PaddingLeft
- - mLayoutManager.PaddingRight;
+ return layoutManager.Width - layoutManager.PaddingLeft - layoutManager.PaddingRight;
}
internal override void OffsetChild(FlexibleViewViewHolder holder, int offset)
public override float GetEndPadding()
{
- return mLayoutManager.PaddingRight;
+ return layoutManager.PaddingRight;
}
}
public override float GetEndAfterPadding()
{
- return mLayoutManager.Height - mLayoutManager.PaddingBottom;
+ return layoutManager.Height - layoutManager.PaddingBottom;
}
public override float GetEnd()
{
- return mLayoutManager.Height;
+ return layoutManager.Height;
}
public override void OffsetChildren(float amount, bool immediate)
{
- mLayoutManager.OffsetChildrenVertical(amount, immediate);
+ layoutManager.OffsetChildrenVertical(amount, immediate);
}
public override float GetStartAfterPadding()
{
- return mLayoutManager.PaddingTop;
+ return layoutManager.PaddingTop;
}
public override float GetViewHolderMeasurement(FlexibleViewViewHolder holder)
public override float GetTotalSpace()
{
- return mLayoutManager.Height - mLayoutManager.PaddingTop
- - mLayoutManager.PaddingBottom;
+ return layoutManager.Height - layoutManager.PaddingTop - layoutManager.PaddingBottom;
}
internal override void OffsetChild(FlexibleViewViewHolder holder, int offset)
public override float GetEndPadding()
{
- return mLayoutManager.PaddingBottom;
+ return layoutManager.PaddingBottom;
}
}
*
*/
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
namespace Tizen.NUI.Components
{
/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
-using System.Threading.Tasks;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
namespace Tizen.NUI.Components
{
public class Navigator : Control
{
//This will be replaced with view transition class instance.
- private Animation _curAnimation = null;
+ private Animation curAnimation = null;
//This will be replaced with view transition class instance.
- private Animation _newAnimation = null;
+ private Animation newAnimation = null;
//TODO: Needs to consider how to remove disposed window from dictionary.
//Two dictionaries are required to remove disposed navigator from dictionary.
curTop.InvokeDisappearing();
//TODO: The following transition codes will be replaced with view transition.
- if (_curAnimation)
+ if (curAnimation)
{
- _curAnimation.Stop();
- _curAnimation.Clear();
+ curAnimation.Stop();
+ curAnimation.Clear();
}
- if (_newAnimation)
+ if (newAnimation)
{
- _newAnimation.Stop();
- _newAnimation.Clear();
+ newAnimation.Stop();
+ newAnimation.Clear();
}
- _curAnimation = new Animation(1000);
+ curAnimation = new Animation(1000);
using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
{
- _curAnimation.AnimateTo(curTop, "Scale", scaleVec, 0, 1000);
+ curAnimation.AnimateTo(curTop, "Scale", scaleVec, 0, 1000);
}
- _curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
- _curAnimation.EndAction = Animation.EndActions.Discard;
- _curAnimation.Play();
+ curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
+ curAnimation.EndAction = Animation.EndActions.Discard;
+ curAnimation.Play();
using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
{
{
Tizen.NUI.Object.SetProperty(page.SwigCPtr, Page.Property.OPACITY, scaleProp);
}
- _newAnimation = new Animation(1000);
+ newAnimation = new Animation(1000);
using (var scaleVec = new Vector3(1.0f, 1.0f, 1.0f))
{
- _newAnimation.AnimateTo(page, "Scale", scaleVec, 0, 1000);
+ newAnimation.AnimateTo(page, "Scale", scaleVec, 0, 1000);
}
- _newAnimation.AnimateTo(page, "Opacity", 1.0f, 0, 1000);
- _newAnimation.Play();
+ newAnimation.AnimateTo(page, "Opacity", 1.0f, 0, 1000);
+ newAnimation.Play();
}
/// <summary>
curTop.InvokeDisappearing();
//TODO: The following transition codes will be replaced with view transition.
- if (_curAnimation)
+ if (curAnimation)
{
- _curAnimation.Stop();
- _curAnimation.Clear();
+ curAnimation.Stop();
+ curAnimation.Clear();
}
- if (_newAnimation)
+ if (newAnimation)
{
- _newAnimation.Stop();
- _newAnimation.Clear();
+ newAnimation.Stop();
+ newAnimation.Clear();
}
- _curAnimation = new Animation(1000);
+ curAnimation = new Animation(1000);
using (var scaleVec = new Vector3(0.0f, 0.0f, 1.0f))
{
- _curAnimation.AnimateTo(curTop, "Scale", scaleVec, 0, 1000);
+ curAnimation.AnimateTo(curTop, "Scale", scaleVec, 0, 1000);
}
- _curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
- _curAnimation.Play();
- _curAnimation.Finished += (object sender, EventArgs e) =>
+ curAnimation.AnimateTo(curTop, "Opacity", 0.0f, 0, 1000);
+ curAnimation.Play();
+ curAnimation.Finished += (object sender, EventArgs e) =>
{
//Removes the current top page after transition is finished.
Remove(curTop);
{
Tizen.NUI.Object.SetProperty(newTop.SwigCPtr, Page.Property.OPACITY, opacityProp);
}
- _newAnimation = new Animation(1000);
+ newAnimation = new Animation(1000);
using (var scaleVec = new Vector3(1.0f, 1.0f, 1.0f))
{
- _newAnimation.AnimateTo(newTop, "Scale", scaleVec, 0, 1000);
+ newAnimation.AnimateTo(newTop, "Scale", scaleVec, 0, 1000);
}
- _newAnimation.AnimateTo(newTop, "Opacity", 1.0f, 0, 1000);
- _newAnimation.Play();
+ newAnimation.AnimateTo(newTop, "Opacity", 1.0f, 0, 1000);
+ newAnimation.Play();
return curTop;
}
/*
- * Copyright(c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright(c) 2021 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.
*
*/
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
-using System.Windows.Input;
namespace Tizen.NUI.Components
{
[EditorBrowsable(EditorBrowsableState.Never)]
public class Page : Control
{
- private AppBar _appBar = null;
- private View _content = null;
+ private AppBar appBar = null;
+ private View content = null;
/// <summary>
/// Creates a new instance of a Page.
if (type == DisposeTypes.Explicit)
{
- if (_appBar != null)
+ if (appBar != null)
{
- Utility.Dispose(_appBar);
+ Utility.Dispose(appBar);
}
- if (_content != null)
+ if (content != null)
{
- Utility.Dispose(_content);
+ Utility.Dispose(content);
}
}
{
get
{
- return _appBar;
+ return appBar;
}
set
{
- if (_appBar == value)
+ if (appBar == value)
{
return;
}
- if (_appBar != null)
+ if (appBar != null)
{
- Remove(_appBar);
+ Remove(appBar);
}
- _appBar = value;
- if (_appBar == null)
+ appBar = value;
+ if (appBar == null)
{
return;
}
- _appBar.Weight = 0.0f;
+ appBar.Weight = 0.0f;
ResetContent();
}
{
get
{
- return _content;
+ return content;
}
set
{
- if (_content == value)
+ if (content == value)
{
return;
}
- if (_content != null)
+ if (content != null)
{
- Remove(_content);
+ Remove(content);
}
- _content = value;
- if (_content == null)
+ content = value;
+ if (content == null)
{
return;
}
- _content.Weight = 1.0f;
+ content.Weight = 1.0f;
ResetContent();
}
{
//To keep the order of AppBar and Content, the existing contents are
//removed and added again.
- if ((_appBar != null) && Children.Contains(_appBar))
+ if ((appBar != null) && Children.Contains(appBar))
{
- Remove(_appBar);
+ Remove(appBar);
}
- if ((_content != null) && Children.Contains(_content))
+ if ((content != null) && Children.Contains(content))
{
- Remove(_content);
+ Remove(content);
}
- if (_appBar != null)
+ if (appBar != null)
{
- Add(_appBar);
+ Add(appBar);
}
- if (_content != null)
+ if (content != null)
{
- Add(_content);
+ Add(content);
}
}
*
*/
using System;
-using System.Collections.Generic;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
using System.ComponentModel;
using System;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
-using Tizen.NUI.Components.Extension;
using Tizen.NUI.Accessibility;
namespace Tizen.NUI.Components
using System;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
-using Tizen.NUI.Components.Extension;
using Tizen.NUI.Accessibility;
namespace Tizen.NUI.Components
using System;
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
-using Tizen.NUI.Components.Extension;
using Tizen.NUI.Accessibility;
namespace Tizen.NUI.Components
+/* Copyright (c) 2021 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 Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components.Extension;
using Tizen.NUI.Accessibility; // To use AccessibilityManager
namespace Tizen.NUI.Components
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
-using Tizen.NUI.Components.Extension;
-using Tizen.NUI.Accessibility;
namespace Tizen.NUI.Components
{
{
sealed class ListSource : IItemSource, IList
{
- IList _itemsSource;
+ IList itemsSource;
public ListSource()
{
public ListSource(IEnumerable<object> enumerable)
{
- _itemsSource = new List<object>(enumerable);
+ itemsSource = new List<object>(enumerable);
}
public ListSource(IEnumerable enumerable)
{
- _itemsSource = new List<object>();
+ itemsSource = new List<object>();
if (enumerable == null)
return;
foreach (object item in enumerable)
{
- _itemsSource.Add(item);
+ itemsSource.Add(item);
}
}
- public int Count => _itemsSource.Count + (HasHeader ? 1 : 0) + (HasFooter ? 1 : 0);
+ public int Count => itemsSource.Count + (HasHeader ? 1 : 0) + (HasFooter ? 1 : 0);
public bool HasHeader { get; set; }
public bool HasFooter { get; set; }
- public bool IsReadOnly => _itemsSource.IsReadOnly;
+ public bool IsReadOnly => itemsSource.IsReadOnly;
- public bool IsFixedSize => _itemsSource.IsFixedSize;
+ public bool IsFixedSize => itemsSource.IsFixedSize;
- public object SyncRoot => _itemsSource.SyncRoot;
+ public object SyncRoot => itemsSource.SyncRoot;
- public bool IsSynchronized => _itemsSource.IsSynchronized;
+ public bool IsSynchronized => itemsSource.IsSynchronized;
- object IList.this[int index] { get => _itemsSource[index]; set => _itemsSource[index] = value; }
+ object IList.this[int index] { get => itemsSource[index]; set => itemsSource[index] = value; }
public void Dispose()
{
public int GetPosition(object item)
{
- for (int n = 0; n < _itemsSource.Count; n++)
+ for (int n = 0; n < itemsSource.Count; n++)
{
- var elementByIndex = _itemsSource[n];
+ var elementByIndex = itemsSource[n];
var isEqual = elementByIndex == item || (elementByIndex != null && item != null && elementByIndex.Equals(item));
if (isEqual)
public object GetItem(int position)
{
- return _itemsSource[AdjustIndexRequest(position)];
+ return itemsSource[AdjustIndexRequest(position)];
}
int AdjustIndexRequest(int index)
}
public int Add(object value)
{
- return _itemsSource.Add(value);
+ return itemsSource.Add(value);
}
public bool Contains(object value)
{
- return _itemsSource.Contains(value);
+ return itemsSource.Contains(value);
}
public void Clear()
{
- _itemsSource.Clear();
+ itemsSource.Clear();
}
public int IndexOf(object value)
{
- return _itemsSource.IndexOf(value);
+ return itemsSource.IndexOf(value);
}
public void Insert(int index, object value)
{
- _itemsSource.Insert(index, value);
+ itemsSource.Insert(index, value);
}
public void Remove(object value)
{
- _itemsSource.Remove(value);
+ itemsSource.Remove(value);
}
public void RemoveAt(int index)
{
- _itemsSource.RemoveAt(index);
+ itemsSource.RemoveAt(index);
}
public void CopyTo(Array array, int index)
{
- _itemsSource.CopyTo(array, index);
+ itemsSource.CopyTo(array, index);
}
public IEnumerator GetEnumerator()
{
- return _itemsSource.GetEnumerator();
+ return itemsSource.GetEnumerator();
}
}
}
using Tizen.NUI.BaseComponents;
using System.Collections.Generic;
using System.ComponentModel;
-using Tizen.NUI.Binding;
namespace Tizen.NUI.Components
{
*
*/
using System;
-using System.Linq;
using Tizen.NUI.BaseComponents;
-using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
-using Tizen.NUI.Binding;
namespace Tizen.NUI.Components
{
-
-
/// <summary>
/// [Draft] This class implements a linear box layout.
/// </summary>
*
*/
using System;
-using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
namespace Tizen.NUI.Components
[EditorBrowsable(EditorBrowsableState.Never)]
public IReadOnlyList<object> CurrentSelection { get; }
-
internal SelectionChangedEventArgs(object previousSelection, object currentSelection)
{
PreviousSelection = previousSelection != null ? new List<object>(1) { previousSelection } : selectEmpty;
-/* Copyright (c) 2020 Samsung Electronics Co., Ltd.
+/* Copyright (c) 2021 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.
*
*/
using System;
-using Tizen.NUI;
using Tizen.NUI.BaseComponents;
using System.Collections.Generic;
using System.ComponentModel;
*
*/
using System.ComponentModel;
-using Tizen.NUI.BaseComponents;
namespace Tizen.NUI.Components
{
-using System;
+/*
+ * Copyright(c) 2021 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 Tizen.NUI.BaseComponents;
// the track thickness value
private uint? trackThickness = null;
// the value of the space between track and indicator object
- private Extents _spaceBetweenTrackAndIndicator = null;
+ private Extents spaceTrackIndicator = null;
// Whether the value indicator is shown or not
private bool isValueShown = false;
// the value indicator text
{
get
{
- if (null == _spaceBetweenTrackAndIndicator)
+ if (null == spaceTrackIndicator)
{
- _spaceBetweenTrackAndIndicator = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
+ spaceTrackIndicator = new Extents((ushort start, ushort end, ushort top, ushort bottom) =>
{
Extents extents = new Extents(start, end, top, bottom);
- _spaceBetweenTrackAndIndicator.CopyFrom(extents);
+ spaceTrackIndicator.CopyFrom(extents);
}, 0, 0, 0, 0);
}
- return _spaceBetweenTrackAndIndicator;
+ return spaceTrackIndicator;
}
}
*/
using System.ComponentModel;
using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Binding;
namespace Tizen.NUI.Components.Extension
{