+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
+using System.Threading.Tasks;
using Tizen.NUI;
using Tizen.NUI.BaseComponents;
using Tizen.NUI.Components;
{
private ObservableCollection<View> items;
private ScrollableBase scrollableBase = null;
+ private View footer = null;
private int width;
private int height;
this.height = height;
}
+ public View Footer
+ {
+ get => footer;
+ set
+ {
+ if (footer != null)
+ {
+ LayoutView.Remove(footer);
+ }
+ footer = value;
+ if (footer != null)
+ {
+ LayoutView.Add(footer);
+ (LayoutView.Layout as SequenceLinearLayout)?.KeepAsLast(footer.Layout);
+ }
+ }
+ }
+
public ScrollableBase View
{
get
{
View.Add(new View()
{
- Layout = new LinearLayout()
+ Layout = new SequenceLinearLayout()
{
LinearOrientation = LinearLayout.Orientation.Vertical,
LinearAlignment = LinearLayout.Alignment.Center,
if (items != null)
{
items.CollectionChanged -= OnCollectionChanged;
- foreach (var child in LayoutView.Children.ToList())
- {
- LayoutView.Remove(child);
- }
+ RemoveItems();
LayoutView.HeightResizePolicy = ResizePolicyType.FitToChildren;
}
}
}
else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
{
- foreach (var child in LayoutView.Children.ToList())
- {
- LayoutView.Remove(child);
- }
+ RemoveItems();
}
LayoutView.HeightResizePolicy = ResizePolicyType.FitToChildren;
}
+
+ private void RemoveItems()
+ {
+ foreach (var child in LayoutView.Children.Where(x => x != Footer).ToList())
+ {
+ LayoutView.Remove(child);
+ }
+ }
}
}
--- /dev/null
+using System.Linq;
+using Tizen.NUI;
+
+namespace Oobe.Wifi.Controls
+{
+ public class SequenceLinearLayout : LinearLayout
+ {
+ private LayoutItem lastItem = null;
+
+ public void KeepAsLast(LayoutItem item)
+ {
+ lastItem = item;
+ if (item != null && item != LayoutChildren.Last())
+ {
+ if (LayoutChildren.Remove(item))
+ {
+ LayoutChildren.Add(item);
+ RequestLayout();
+ }
+ }
+ }
+
+ protected override void OnChildAdd(LayoutItem child)
+ {
+ base.OnChildAdd(child);
+ if (lastItem != null)
+ {
+ if (LayoutChildren.Remove(lastItem))//remove by position, or find from the end
+ {
+ LayoutChildren.Add(lastItem);
+ }
+ }
+ }
+ }
+}
scan.IsEnabled = false;
ApManager.Views.Clear();
ApManager.UpdateTo(await State.Scan());
- ApManager.Views.Add(CreateManualWifiView()); //should be built in listView
scan.IsEnabled = State.IsTurnedOn;
};
scan.IsEnabled = State.IsTurnedOn;
var view = new View();
var listView = new ListView(480, 328)//480, 335
{
+ Footer = CreateManualWifiView(),
Items = ApManager.Views
}.View;
view.Add(listView);