private void CreateSelectListView() { Tizen.Log.Fatal("NUI.ChannelList", "CreateSelectListView..."); // Create favorite list. selectListView = new List(); selectListView.BackgroundColor = new Vector4(8.0f / 255.0f, 12.0f / 255.0f, 15.0f / 255.0f, 0.95f); selectListView.Name = "Favorite"; selectListView.SizeWidth = windowSize.Width * 0.344270f; selectListView.SizeHeight = windowSize.Height * 0.887962f; selectListView.PreloadFrontItemSize = 1; selectListView.PreloadBackItemSize = 1; // Initial favorite list date set. List <object> dataList = new List <object>(); int num = (new FavoriteListData(0)).Num; for (int i = 0; i < num; i++) { FavoriteListData data = new FavoriteListData(i); dataList.Add(data); } // Create favorite list adapter. SelectListAdapter mAdapter = new SelectListAdapter(dataList); selectListView.SetAdapter(mAdapter); selectListView.Focusable = true; selectListView.KeyEvent += OnKeyPressed; //Add key event handler. selectContentLayout.AddChild(selectListView, new TableView.CellPosition(1, 0)); }
/// <summary> /// Get a View that displays the data at the specified index in the favorite list. /// </summary> /// <param name="index">The index of the favorite list.</param> /// <returns>A View corresponding to the favorite list at the specified index.</returns> public override View GetItemView(int index) { Tizen.Log.Fatal("NUI.ChannelList", "GetItemView ... " + index); object data = GetData(index); FavoriteListData itemData = data as FavoriteListData; SelectListItem itemView = new SelectListItem(); itemView.FavoriteText = itemData.Name; itemView.FavoriteNum = itemData.FavoriteNum; return(itemView); }
/// <summary> /// Update View that displays the data at the specified index in the favorite list when focus change. /// </summary> /// <param name="index">The index of the favorite list.</param> /// <param name="view">A View that displays the data at the specified index in the favorite list.</param> /// <param name="flagFocused">True means the item state change to focus, false means the item state change to unfocus.</param> public override void FocusChange(int index, View view, bool flagFocused) { Tizen.Log.Fatal("NUI.ChannelList", "FocusChange. index:" + index); object data = GetData(index); FavoriteListData itemData = data as FavoriteListData; SelectListItem itemView = view as SelectListItem; if (itemView != null) { itemView.Focus(flagFocused); } }
/// <summary> /// Update View that displays the data at the specified index in the favorite list when data change. /// </summary> /// <param name="index">The index of the favorite list.</param> /// <param name="view">A View that displays the data at the specified index in the favorite list.</param> public override void UpdateItem(int index, View view) { Tizen.Log.Fatal("NUI.ChannelList", "UpdateItem... "); object data = GetData(index); FavoriteListData itemData = data as FavoriteListData; SelectListItem itemView = view as SelectListItem; if (itemView != null) { itemView.FavoriteText = itemData.Name; itemView.FavoriteNum = itemData.FavoriteNum; } }