private void CreatelistView() { Tizen.Log.Fatal("NUI.ChannelList", "CreatelistView..."); // Create main list. listView = new List(); listView.BackgroundColor = new Vector4(0, 8.0f / 255.0f, 12.0f / 255.0f, 0.95f); listView.Name = "All_Channel"; listView.SizeWidth = windowSize.Width * 0.323437f; listView.SizeHeight = windowSize.Height * 0.887962f; listView.PreloadFrontItemSize = 1; listView.PreloadBackItemSize = 1; // Initial main list data set. List <object> dataList = new List <object>(); int num = (new ListItemData(listView.Name, 0)).Num; for (int i = 0; i < num; i++) { ListItemData data = new ListItemData(listView.Name, i); dataList.Add(data); } // Create main list adapter. SampleListAdapter mAdapter = new SampleListAdapter(dataList); listView.SetAdapter(mAdapter); listView.Focusable = true; listView.KeyEvent += OnKeyPressed; // Add key event handler. listContentLayout.AddChild(listView, new TableView.CellPosition(0, 0)); }
/// <summary> /// Get a View that displays the data at the specified index in the data set. /// </summary> /// <param name="index">The index of the all channel list.</param> /// <returns>A View corresponding to the all channel list at the specified index.</returns> public override View GetItemView(int index) { Tizen.Log.Fatal("NUI.ChannelList", "GetItemView ... " + index); object data = GetData(index); ListItemData itemData = data as ListItemData; ListItem itemView = new ListItem(); itemView.ProgramIndex = itemData.ProgramIndex; itemView.ProgramText = itemData.Program; itemView.ChannelText = itemData.Channel; if (itemData.ProgramIndex == playProgramIndex) { itemView.Play(true); } else { itemView.Play(false); } if (itemData.Favorite == true) { itemView.ShowIcon(3); } return(itemView); }
/// <summary> /// Update View that displays the data at the specified index in the all channel list when data change. /// </summary> /// <param name="index">The index of the all channel list.</param> /// <param name="view">A View that displays the data at the specified index in the all channel list.</param> public override void UpdateItem(int index, View view) { Tizen.Log.Fatal("NUI.ChannelList", "UpdateItem... "); object data = GetData(index); ListItemData itemData = data as ListItemData; ListItem itemView = view as ListItem; if (itemView != null) { itemView.ProgramIndex = itemData.ProgramIndex; itemView.ProgramText = itemData.Program; itemView.ChannelText = itemData.Channel; if (itemData.ProgramIndex == playProgramIndex) { itemView.Play(true); } else { itemView.Play(false); } if (itemData.Favorite == true) { itemView.ShowIcon(3); } } }
/// <summary> /// Update View that displays the data at the specified index in the all channel list when focus change. /// </summary> /// <param name="index">The index of the all channel list.</param> /// <param name="view">A View that displays the data at the specified index in the all channel 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); ListItemData itemData = data as ListItemData; ListItem itemView = view as ListItem; if (itemView != null) { itemView.Focus(flagFocused); } }
/// <summary> /// Unload view at the specified index when item scroll out or deleted. /// </summary> /// <param name="index">The index of the all channel list.</param> /// <param name="view">A View that displays the data at the specified index in the all channel list.</param> public override void UnloadItem(int index, View view) { Tizen.Log.Fatal("NUI.ChannelList", "UnloadItem... "); object data = GetData(index); ListItemData itemData = data as ListItemData; ListItem itemView = view as ListItem; if (itemView != null) { itemView.ProgramIndex = itemData.ProgramIndex; itemView.ProgramText = itemData.Program; itemView.ChannelText = itemData.Channel; } view?.Dispose(); }
private void GenreSelect() { Tizen.Log.Fatal("NUI.ChannelList", "GenreSelect..."); string selectGenre = (genreListView.GetLoadedItemView(genreListView.FocusItemIndex) as GenreListItem).Text; Animation animation = new Animation(); animation.AnimateTo(contentLayout, "colorAlpha", 1.0f, 0, 334); animation.AnimateTo(selectContentLayout, "PositionX", windowSize.Width * 0.344270f, 0, 500); animation.Finished += (obj, ee) => { FocusManager.Instance.SetCurrentFocusView(listView); }; if (titleText.Text == selectGenre) { animation.Play(); return; } if (genreListView.GetLoadedItemView(genreSelectIndex) != null) { (genreListView.GetLoadedItemView(genreSelectIndex) as GenreListItem).Select(false); } if (genreListView.GetLoadedItemView(genreListView.FocusItemIndex) != null) { (genreListView.GetLoadedItemView(genreListView.FocusItemIndex) as GenreListItem).Select(true); } if (selectListView.GetLoadedItemView(selectViewIndex) != null) { (selectListView.GetLoadedItemView(selectViewIndex) as SelectListItem).Select(false); } selectViewIndex = -1; genreSelectIndex = genreListView.FocusItemIndex; preSubSelectIndex = subSelectedIndex; playIndex = -1; listView.Name = selectGenre; List <object> dataList = new List <object>(); int num = (new ListItemData(listView.Name, 0)).Num; for (int i = 0; i < num; i++) { ListItemData data = new ListItemData(listView.Name, i); dataList.Add(data); if (data.ProgramIndex == playProgramIndex) { playIndex = i; } } SampleListAdapter mAdapter = new SampleListAdapter(dataList); mAdapter.PlayProgramIndex = playProgramIndex; listView.SetAdapter(mAdapter); titleIcon.ResourceUrl = titleIconGenre; titleText.Text = selectGenre; animation.Play(); }