Example #1
0
        /// <summary>
        /// The method is to apply the properties of bg view
        /// </summary>
        private void ApplyBGImage()
        {
            if (backgroundImage == null)
            {
                return;
            }
            //Set this accroding to the ImageItemStyle(should be "C_ImageItem_WhiteSingleline01" style)
            float  rootWidth   = Size2D.Width;
            float  rootHeight  = Size2D.Height;
            float  left        = 0;
            float  top         = 0;
            float  right       = 0;
            float  bottom      = 0;
            string bgImagePath = "";

            if (isFocused)
            {
                left        = 5.0f;
                top         = 10.0f;
                right       = 5.0f;
                bottom      = 10.0f;
                bgImagePath = CommonResource.GetLocalReosurceURL() + "component/c_imageitem/c_imageitem_white_bg_focus_singleline_9patch.9.png";
            }
            else
            {
                bgImagePath = CommonResource.GetLocalReosurceURL() + "component/c_imageitem/c_imageitem_white_bg_normal_singleline_9patch.9.png";
            }

            backgroundImage.Size2D = new Size2D((int)(rootWidth + left + right), (int)(rootHeight + top + bottom));
            backgroundImage.SetImage(bgImagePath);
        }
Example #2
0
        /// <summary>
        /// Create UpFolder thumbnail
        /// </summary>
        /// <param name="item">object for class ContentModel</param>
        private void CreateUpFolder(ContentModel item)
        {
            StateEditabled = false;
            string folderImage = CommonResource.GetLocalReosurceURL() + "Folder/mc_upper_folder_n.png";

            MainImageURL = folderImage;
            MainText     = item.DisplayName;
            StateEnabled = !editMode;
        }
Example #3
0
        /// <summary>
        /// Set the properties of the list line view
        /// </summary>
        private void ApplyListLineView()
        {
            InitializeListLineView();
            if (listLineView == null)
            {
                return;
            }

            string url = CommonResource.GetLocalReosurceURL() + "component/c_textitem/c_textitem_white_single_line.png";

            listLineView.SetImage(url);
            listLineView.Size2D = new Size2D((int)SizeWidth, 2);
        }
Example #4
0
        /// <summary>
        /// Apply check icon.
        /// </summary>
        private void ApplyCheckIcon()
        {
            InitializeCheckIcon();
            string url = CommonResource.GetLocalReosurceURL() + "icon/r_icon_xs/r_icon_xs_check.png";

            checkIcon.SetImage(url);
            checkIcon.Size2D = new Size2D(26, 26);

            ApplyCheckIconPosition();

            if (isSelected)
            {
                checkIcon.Opacity = 1.0f;
            }
            else
            {
                checkIcon.Opacity = 0;
            }
        }
        /// <summary>
        /// Update.
        /// </summary>
        private void OnUpdate()
        {
            bgImage                    = new ImageView();
            bgImage.Name               = "BackgroundImage";
            bgImage.ParentOrigin       = Tizen.NUI.ParentOrigin.TopLeft;
            bgImage.PivotPoint         = Tizen.NUI.PivotPoint.TopLeft;
            bgImage.WidthResizePolicy  = ResizePolicyType.SizeFixedOffsetFromParent;
            bgImage.HeightResizePolicy = ResizePolicyType.SizeFixedOffsetFromParent;
            bgImage.SizeModeFactor     = new Vector3(8, 12, 0);
            bgImage.Position           = new Position(-4, -6, 0);
            bgImage.ResourceUrl        = CommonResource.GetLocalReosurceURL() + "component/c_listdropdown/c_list_dropdown_bg.9.png";
            this.Add(bgImage);

            coverImage                    = new ImageView();
            coverImage.Name               = "CoverImage";
            coverImage.ParentOrigin       = Tizen.NUI.ParentOrigin.TopLeft;
            coverImage.PivotPoint         = Tizen.NUI.PivotPoint.TopLeft;
            coverImage.WidthResizePolicy  = ResizePolicyType.FillToParent;
            coverImage.HeightResizePolicy = ResizePolicyType.Fixed;
            coverImage.Size2D             = new Size2D(0, 173);
            coverImage.ResourceUrl        = CommonResource.GetLocalReosurceURL() + "component/c_listdropdown/c_list_dropdown_bg_cover.9.png";
            this.Add(coverImage);

            Vector4 listMargin = new Vector4(11, 4, 11, 4);

            // Tizen.Log.Fatal("NUI", " ...listMargin:" + listMargin[0] + ", " + listMargin[1] + ", " + listMargin[2] + ", " + listMargin[3]);
            list.Position = new Position(listMargin[0], listMargin[1], 0);
            list.Size2D   = new Size2D((int)(this.SizeWidth - (listMargin[0] + listMargin[2])), (int)(this.SizeHeight - (listMargin[1] + listMargin[3])));
            list.Margin   = new Vector4(list.SizeWidth * 0.04f + 7, 80 * 0.04f + 12, list.SizeWidth * 0.04f + 7, 80 * 0.04f + 12);

            list.Update();

            if (coverImage != null)
            {
                coverImage.LowerToBottom();
            }

            if (bgImage != null)
            {
                bgImage.LowerToBottom();
            }
        }
Example #6
0
        /// <summary>
        /// Create thumbnail for music file
        /// </summary>
        /// <param name="item">object for class ContentModel</param>
        private void CreateMusic(ContentModel item)
        {
            StateEditabled = true;
            string thumb = CommonResource.GetLocalReosurceURL() + "DefaultThumb/mc_f_default_music.png";

            inforIconURLArray[0] = CommonResource.GetLocalReosurceURL() + "Contents_icon/mc_icon_contents_music.png";
            if (!item.Available)
            {
                inforIconURLArray[0] = CommonResource.GetLocalReosurceURL() + "Contents_icon/mc_icon_unsupported_music.png";
            }

            if (item.ThumbDone)
            {
                thumb = item.ThumbnailPath;
            }

            MainImageURL            = thumb;
            MainText                = item.DisplayName;
            InformationIconURLArray = inforIconURLArray;
        }
Example #7
0
        /// <summary>
        /// Create folder thumbnail
        /// </summary>
        /// <param name="item">object for class ContentModel</param>
        private void CreateFolder(ContentModel item)
        {
            StateEditabled = false;
            string defaultIcon = CommonResource.GetLocalReosurceURL() + "Folder/mc_folder.png";

            MainImageURL = "";
            MainText     = item.DisplayName;
            StateEnabled = !editMode;

            if (item.FolderType == 0)
            {
                // exit file thumbnail
                defaultIcon = CommonResource.GetLocalReosurceURL() + "Folder/mc_folder_preview.png";
                TopLayerImage.SetImage(defaultIcon);
                FolderThumbnailImage.SetImage(item.ThumbnailPath);
                Add(FolderThumbnailImage);
            }
            else if (item.FolderType == 1)
            {
                // folder in folder
                defaultIcon = CommonResource.GetLocalReosurceURL() + "Folder/mc_folder_folder.png";
                TopLayerImage.SetImage(defaultIcon);
            }
            else if (item.FolderType == 2)
            {
                // no contents folder
                defaultIcon = CommonResource.GetLocalReosurceURL() + "Folder/mc_folder_nocont.png";
                TopLayerImage.SetImage(defaultIcon);
            }
            else
            {   //request failed
                TopLayerImage.SetImage(defaultIcon);
            }

            Add(TopLayerImage);
            Tizen.Log.Fatal("NUI", "allcontent thumbnail createFolder Addimage -1 TopLayerImage =  end");
            TopLayerImage.RaiseToTop();

            InformationIconURLArray = null;
        }
Example #8
0
        /// <summary>
        /// Set the properties of the background view
        /// </summary>
        private void ApplyBgView()
        {
            Tizen.Log.Fatal("NUI", "Apply BGView");

            if (isFocused)
            {
                string url = CommonResource.GetLocalReosurceURL() + "highlight/r_highlight_bg_focus.9.png";
                backgroundView.SetImage(url);
            }
            else
            {
                string url = CommonResource.GetLocalReosurceURL() + "component/c_textitem/c_textitem_normal_transparentbg.png";
                backgroundView.SetImage(url);
            }

            float rootWidth  = Size2D.Width;
            float rootHeight = Size2D.Height;
            float newWidth   = rootWidth;
            float newHeight  = rootHeight;

            float left = 0, right = 0, top = 0, bottom = 0;

            if (isFocused)
            {
                left   = 7.0f;
                right  = 7.0f;
                top    = 12.0f;
                bottom = 12.0f;
            }

            newWidth  = rootWidth + left + right;
            newHeight = rootHeight + top + bottom;

            Tizen.Log.Fatal("NUI", "width = " + rootWidth + ", height = " + rootHeight + ", newWidth = " + newWidth + ", newHeight = " + newHeight);
            backgroundView.Size2D = new Size2D((int)newWidth, (int)newHeight);
        }
        /// <summary>
        /// The method to create the data
        /// </summary>
        private void Initialize()
        {
            int size  = (int)myRandom.Next(0, 100);
            int year  = (int)myRandom.Next(2015, 2017);
            int month = (int)myRandom.Next(0, 12);
            int day   = (int)myRandom.Next(0, 28);

            for (int index = 0; index < 60; index++)
            {
                if (index == 0)
                {
                    //Create some items for music
                    ContentModel contentModel = new ContentModel(index, index.ToString(), index.ToString(), ContentItemType.eItemMusic, index.ToString(), "", "", 10);
                    contentModel.Format = "MP3";
                    contentModel.Size   = (size * (index + 1)).ToString();
                    contentModel.Data   = day + "/" + month + "/" + year;
                    dataList.Add(contentModel);
                    sortedDataList.Add(contentModel);
                    musicDataList.Add(contentModel);
                    sortedMusicList.Add(contentModel);
                }
                else if (index > 10 && index <= 20)
                {
                    //Create some items for movies
                    string       path         = CommonResource.GetLocalReosurceURL() + "Movies/" + (index - 10).ToString() + ".jpg";
                    ContentModel contentModel = new ContentModel(index, index.ToString(), "NO." + index.ToString(), ContentItemType.eItemVideo, index.ToString(), path, "", 10);
                    contentModel.ThumbnailPath = path;
                    contentModel.ThumbDone     = true;
                    contentModel.Format        = "MP4";
                    contentModel.Data          = day + "/" + month + "/" + year;
                    contentModel.Size          = (size * (index + 1)).ToString();
                    dataList.Add(contentModel);
                    sortedDataList.Add(contentModel);
                    videoDataList.Add(contentModel);
                    sortedVideoList.Add(contentModel);
                }
                else if (index > 53)
                {
                    if (index % 2 == 0)
                    {
                        //Create some items for music
                        string       path         = CommonResource.GetLocalReosurceURL() + "Musics/" + ((index - 50) / 2).ToString() + ".jpg";
                        ContentModel contentModel = new ContentModel(index, index.ToString(), "NO." + index.ToString(), ContentItemType.eItemMusic, index.ToString(), path, "", 10);
                        contentModel.ThumbnailPath = path;
                        contentModel.ThumbDone     = true;
                        contentModel.Format        = "MP3";
                        contentModel.Data          = day + "/" + month + "/" + year;
                        contentModel.Size          = (size * (index + 1)).ToString();
                        dataList.Add(contentModel);
                        sortedDataList.Add(contentModel);
                        musicDataList.Add(contentModel);
                        sortedMusicList.Add(contentModel);
                    }
                    else
                    {
                        //Create some items for music
                        ContentModel contentModel = new ContentModel(index, index.ToString(), "NO." + index.ToString(), ContentItemType.eItemMusic, index.ToString(), "", "", 10);
                        contentModel.Format = "MP3";
                        contentModel.Data   = day + "/" + month + "/" + year;
                        contentModel.Size   = (size * (index + 1)).ToString();
                        dataList.Add(contentModel);
                        sortedDataList.Add(contentModel);
                        musicDataList.Add(contentModel);
                        sortedMusicList.Add(contentModel);
                    }
                }
                else if (index % 4 == 0 && index % 3 == 0)
                {
                    //Create some items for upFolder
                    ContentModel contentModel = new ContentModel(index, index.ToString(), "NO." + index.ToString(), ContentItemType.eItemUpFolder, index.ToString(), "", "", 1);
                    dataList.Add(contentModel);
                    sortedDataList.Add(contentModel);
                }
                else if (index % 7 == 0)
                {
                    //Create some items for upFolder
                    ContentModel contentModel = new ContentModel(index, index.ToString(), "NO." + index.ToString(), ContentItemType.eItemUpFolder, index.ToString(), "", "", 2);
                    dataList.Add(contentModel);
                    sortedDataList.Add(contentModel);
                }
                else
                {
                    //Create some items for photo
                    string       path         = CommonResource.GetLocalReosurceURL() + "Photos/gallery-medium-" + index.ToString() + ".jpg";
                    ContentModel contentModel = new ContentModel(index, index.ToString(), "NO." + index.ToString(), ContentItemType.eItemPhoto, index.ToString(), "", "", 10);
                    contentModel.Format        = "JPEG";
                    contentModel.Data          = day + "/" + month + "/" + year;
                    contentModel.ThumbnailPath = path;
                    contentModel.Size          = (size * (index + 1)).ToString();
                    contentModel.ThumbDone     = true;
                    dataList.Add(contentModel);
                    sortedDataList.Add(contentModel);
                    photoDataList.Add(contentModel);
                    sortedPhotoList.Add(contentModel);
                }
            }
            //sort the data
            sortedDataList.Sort();
            sortedPhotoList.Sort();
            sortedVideoList.Sort();
            sortedMusicList.Sort();
            CommonResource.SortedList.Clear();
            CommonResource.SortedPhotoList.Clear();
            CommonResource.SortedVideoList.Clear();
            CommonResource.SortedMusicList.Clear();

            for (int index = 0; index < sortedDataList.Count; index++)
            {
                CommonResource.SortedList.Add(sortedDataList[index]);
            }

            for (int index = 0; index < sortedPhotoList.Count; index++)
            {
                CommonResource.SortedPhotoList.Add(sortedPhotoList[index]);
            }

            for (int index = 0; index < sortedVideoList.Count; index++)
            {
                CommonResource.SortedVideoList.Add(sortedVideoList[index]);
            }

            for (int index = 0; index < sortedMusicList.Count; index++)
            {
                CommonResource.SortedMusicList.Add(sortedMusicList[index]);
            }

            CommonResource.DataList      = dataList;
            CommonResource.MusicDataList = musicDataList;
            CommonResource.PhotoDataList = photoDataList;
            CommonResource.VideoDataList = videoDataList;
        }
Example #10
0
        /// <summary>
        /// Update view that display all the content thumbnail in the device
        /// </summary>
        /// <param name="bridge">grid view bridge</param>
        /// <param name="groupIndex">index for group</param>
        /// <param name="itemIndex">index for item</param>
        /// <param name="editMode">the edit mode: true / false </param>
        public override void UpdateItem(GridBridge bridge, int groupIndex, int itemIndex, bool editMode = false)
        {
            // return;
            string Folderpath = null;

            if (bridge == null)
            {
                return;
            }

            ContentModel itemData = bridge.GetData(itemIndex, groupIndex) as ContentModel;

            if (itemData == null)
            {
                return;
            }

            int itemType = itemData.MediaItemType;

            try
            {
                switch (itemType)
                {
                case ContentItemType.eItemFolder:
                    //MainImageURL = (CommonReosurce.GetLocalReosurceURL() + "Folder/mc_folder.png");
                    MainImageURL = "";
                    MainText     = itemData.DisplayName;
                    Folderpath   = itemData.FolderThumbPath;
                    string defaultIcon = CommonResource.GetLocalReosurceURL() + "Folder/mc_folder.png";
                    if (itemData.FolderType == 0)
                    {     // exit file thumbnail
                        defaultIcon = CommonResource.GetLocalReosurceURL() + "Folder/mc_folder_preview.png";

                        FolderThumbnailImage.SetImage(itemData.FolderThumbPath);
                        FolderThumbnailImage.Size2D   = new Size2D(109, 79);
                        FolderThumbnailImage.Position = new Position(55, 95, 0);
                        Add(FolderThumbnailImage);

                        TopLayerImage.SetImage(defaultIcon);
                    }
                    else if (itemData.FolderType == 1)
                    {    // folder in folder
                        defaultIcon = CommonResource.GetLocalReosurceURL() + "Folder/mc_folder_folder.png";
                        TopLayerImage.SetImage(defaultIcon);
                        Remove(FolderThumbnailImage);
                    }
                    else if (itemData.FolderType == 2)
                    {    // no contents folder
                        defaultIcon = CommonResource.GetLocalReosurceURL() + "Folder/mc_folder_nocont.png";
                        TopLayerImage.SetImage(defaultIcon);
                        Remove(FolderThumbnailImage);
                    }
                    else
                    {       //request failed
                        FolderThumbnailImage.SetImage(itemData.FolderThumbPath);
                        FolderThumbnailImage.Size2D   = new Size2D(109, 79);
                        FolderThumbnailImage.Position = new Position(55, 95, 0);
                        Add(FolderThumbnailImage);
                        TopLayerImage.SetImage(defaultIcon);
                        Remove(FolderThumbnailImage);
                    }

                    Add(TopLayerImage);
                    TopLayerImage.RaiseToTop();
                    StateEnabled = !editMode;
                    // inforIconURLArray[0] = "";
                    InformationIconURLArray = null;

                    break;

                case ContentItemType.eItemUpFolder:
                    this.Remove(TopLayerImage);
                    this.Remove(FolderThumbnailImage);

                    MainImageURL = (CommonResource.GetLocalReosurceURL() + "Folder/mc_upper_folder_n.png");
                    MainText     = itemData.DisplayName;

                    StateEnabled = !editMode;
                    // inforIconURLArray[0] = "";
                    InformationIconURLArray = null;
                    break;

                case ContentItemType.eItemPhoto:
                    this.Remove(TopLayerImage);
                    this.Remove(FolderThumbnailImage);

                    inforIconURLArray[0] = CommonResource.GetLocalReosurceURL() + "Contents_icon/mc_icon_contents_camera.png";
                    StateEnabled         = true;

                    if (itemData.ThumbDone)
                    {
                        MainImageURL = (itemData.ThumbnailPath);
                    }
                    else
                    {
                        MainImageURL = (CommonResource.GetLocalReosurceURL() + "DefaultThumb/mc_f_default_photo.png");
                    }

                    this.MainText           = itemData.DisplayName;
                    InformationIconURLArray = inforIconURLArray;
                    break;

                case ContentItemType.eItemVideo:
                    this.Remove(TopLayerImage);
                    this.Remove(FolderThumbnailImage);
                    inforIconURLArray[0] = CommonResource.GetLocalReosurceURL() + "Contents_icon/mc_icon_contents_play.png";

                    StateEnabled = true;
                    if (itemData.ThumbDone)
                    {
                        MainImageURL = (itemData.ThumbnailPath);
                    }
                    else
                    {
                        MainImageURL = (CommonResource.GetLocalReosurceURL() + "DefaultThumb/mc_f_default_video.png");
                    }

                    MainText = itemData.DisplayName;
                    InformationIconURLArray = inforIconURLArray;
                    break;

                case ContentItemType.eItemMusic:
                    this.Remove(TopLayerImage);
                    this.Remove(FolderThumbnailImage);
                    inforIconURLArray[0] = CommonResource.GetLocalReosurceURL() + "Contents_icon/mc_icon_contents_music.png";
                    if (!itemData.Available)
                    {
                        inforIconURLArray[0] = CommonResource.GetLocalReosurceURL() + "Contents_icon/mc_icon_unsupported_music.png";
                    }

                    StateEnabled = true;
                    if (itemData.ThumbDone)
                    {
                        MainImageURL = (itemData.ThumbnailPath);
                    }
                    else
                    {
                        MainImageURL = (CommonResource.GetLocalReosurceURL() + "DefaultThumb/mc_f_default_music.png");
                    }

                    MainText = itemData.DisplayName;
                    InformationIconURLArray = inforIconURLArray;
                    break;
                }

                ShowCheckBox(editMode, itemData.IsSelected);
            }
            catch (Exception e)
            {
                Tizen.Log.Fatal("NUI", " Thumbnail UpdateItem  error: " + e.Message);
            }
        }