Adding support for wallpaper creation with local image. 54/293854/4 accepted/tizen/unified/20230615.060054
authortarun.mahay <tarun.mahay@samsung.com>
Wed, 7 Jun 2023 06:37:32 +0000 (12:07 +0530)
committertarun.mahay <tarun.mahay@samsung.com>
Fri, 9 Jun 2023 11:25:21 +0000 (16:55 +0530)
Change-Id: Ied6c26d0ab247245caddd2b4dbef510982694df5
Signed-off-by: tarun.mahay <tarun.mahay@samsung.com>
62 files changed:
SettingWallpaper/SettingWallpaper/Common/AppCommon.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Common/DeviceInfo.cs [deleted file]
SettingWallpaper/SettingWallpaper/Common/ImageSelectedEventArgs.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Common/PropertyNotifier.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Common/Resources.cs
SettingWallpaper/SettingWallpaper/Core/ViewManager.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/CustomBorder.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/MediaContent/AlbumContent.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/MenuProvider.cs
SettingWallpaper/SettingWallpaper/Models/AlbumDataModel.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Models/AlbumDataProvider.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Models/ImageDataModel.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/SettingWallpaper.csproj
SettingWallpaper/SettingWallpaper/ViewModels/AlbumDetailInfoViewModel.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/ViewModels/AlbumDetailViewModel.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/ViewModels/AlbumInfoViewModel.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/ViewModels/AlbumViewModel.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/ViewModels/WallpaperViewModel.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Views/AlbumDetailView.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Views/AlbumItemLayout.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Views/AlbumView.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Views/CustomAlbumTitle.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Views/CustomTitleItem.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Views/ImageItemLayout.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Views/MainPage.cs
SettingWallpaper/SettingWallpaper/Views/NoAlbumsView.cs [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/Views/ViewManager.cs [deleted file]
SettingWallpaper/SettingWallpaper/Views/WallpaperView.cs
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/GalleryIcon.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/close.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/Folder_normal_dark.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_disabled.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_focus.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_pressed.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_selected.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_disabled.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_focus.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_pressed.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_selected.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/save.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/leftCorner.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/Folder_normal_light.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/next_focus.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/next_selected.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_disabled.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_focus.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_pressed.png
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_selected.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/save.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/maximalize.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/minimalize.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/rightCorner.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/smallwindow.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/tizen.png [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/themes/dark.xaml [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/themes/light.xaml [new file with mode: 0644]
SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/wallpaper-icon.svg
SettingWallpaper/SettingWallpaper/tizen-manifest.xml
packaging/org.tizen.cssetting-wallpaper-1.0.0.rpk

diff --git a/SettingWallpaper/SettingWallpaper/Common/AppCommon.cs b/SettingWallpaper/SettingWallpaper/Common/AppCommon.cs
new file mode 100644 (file)
index 0000000..a784a68
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI;
+
+namespace SettingWallpaper.Common
+{
+    static class AppCommon
+    {
+        public static Vector4 viewCornerRadius = new Vector4(24.0f, 24.0f, 24.0f, 24.0f);
+
+        public static Vector4 itemCornerRadius = new Vector4(12.0f, 12.0f, 12.0f, 12.0f);
+
+        public static int albumLayoutWidth = 154.SpToPx();
+        public static int albumLayoutHeight = 154.SpToPx();
+        public static int albumBaseViewWidth = 138.SpToPx();
+        public static int albumBaseViewHeight = 138.SpToPx();
+        public static int albumBackgroundWidth = 122.SpToPx();
+        public static int albumBackgroundHeight = 102.SpToPx();
+        public static Extents customAlbumTitlePadding = new Extents(16, 16, 24, 0).SpToPx();
+
+        public static Extents itemPadding = new Extents(8, 8, 8, 8).SpToPx();
+        public static Extents albumLayoutBaseViewPadding = new Extents(0, 0, 8, 0).SpToPx();
+
+        public static Shadow itemLightBoxShadow = new Shadow(4.0f, new Color(0, 0, 0, 0.10f), new Vector2(2, 2));
+        public static Shadow itemDarkBoxShadow = new Shadow(4.0f, new Color(1.0f, 1.0f, 1.0f, 0.20f), new Vector2(2, 2));
+
+        public static int albumIconTextHeight = 24.SpToPx();
+
+        public static int imageItemWidth = 130.SpToPx();
+        public static int imageItemHeight = 130.SpToPx();
+        public static Size2D thumbnailSize = new Size2D(114, 114).SpToPx();
+        public static int customItemHeight = 64.SpToPx();
+        public static int albumTitleHeight = 32.SpToPx();
+        public static Extents backButtonMargin = new Extents(16, 8, 8, 8).SpToPx();
+        public static Extents albumTitleMargin = new Extents(0, 16, 16, 16).SpToPx();
+
+        public static int centerTextHeight = 32.SpToPx();
+        public static int centerTextPixelSize = 24.SpToPx();
+
+        public static int bottomViewHeight = 144.SpToPx();
+        public static float bottomViewWidthRatio = 0.55f;
+        public static Size2D bottomViewItemsCellPadding = new Size2D(16, 0);
+        public static Extents bottomViewMargin = new Extents(0, 0, 0, 80).SpToPx();
+        public static int wallpaperListViewHeight = 114.SpToPx();
+        public static int wallpaperListViewIconWidth = 130.SpToPx();
+        public static int bottomViewPadding = 64.SpToPx();
+
+        public static int noAlbumsLabelWidth = 115.SpToPx();
+        public static int noAlbumsLabelHeight = 32.SpToPx();
+
+        public static Extents viewPadding = new Extents(16, 16, 24, 0).SpToPx();
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Common/DeviceInfo.cs b/SettingWallpaper/SettingWallpaper/Common/DeviceInfo.cs
deleted file mode 100644 (file)
index c71d8aa..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- *  Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  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 Tizen.System;
-
-namespace SettingWallpaper.Common
-{
-    public static class DeviceInfo
-    {
-        private static int width;
-        private static int height;
-        private const string WidthKey = "tizen.org/feature/screen.width";
-        private const string HeightKey = "tizen.org/feature/screen.height";
-
-        static DeviceInfo()
-        {
-            bool isWidthAvailable = Information.TryGetValue(WidthKey, out width);
-            bool isHeightAvailable = Information.TryGetValue(HeightKey, out height);
-            if (isHeightAvailable == false || isWidthAvailable == false)
-            {
-                width = 1280;
-                height = 1080;
-                Tizen.Log.Debug(Resources.LogTag, "Width and height are not available , setting default size as 1280 x 720");
-            }
-            IsPortrait = width < height;
-        }
-
-        public static bool IsPortrait { get; private set; }
-
-        public static int DisplayWidth => width;
-
-        public static int DisplayHeight => height;
-    }
-}
diff --git a/SettingWallpaper/SettingWallpaper/Common/ImageSelectedEventArgs.cs b/SettingWallpaper/SettingWallpaper/Common/ImageSelectedEventArgs.cs
new file mode 100644 (file)
index 0000000..79de3cf
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2023 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;
+
+namespace SettingWallpaper.Common
+{
+    class ImageSelectedEventArgs : EventArgs
+    {
+        public ImageSelectedEventArgs(string path, string id, string thumbnailPath, bool isCustomImage)
+        {
+            Path = path;
+            Id = id;
+            ThumbnailPath = thumbnailPath;
+            IsCustomImage = isCustomImage;
+        }
+        public string Path { get; private set; }
+
+        public string Id { get; private set; }
+
+        public string ThumbnailPath { get; private set; }
+
+        public bool IsCustomImage { get; private set; }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Common/PropertyNotifier.cs b/SettingWallpaper/SettingWallpaper/Common/PropertyNotifier.cs
new file mode 100644 (file)
index 0000000..b060d42
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2023 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.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace SettingWallpaper.Common
+{
+    class PropertyNotifier : INotifyPropertyChanged
+    {
+        public event PropertyChangedEventHandler PropertyChanged;
+
+        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
+        {
+            if (Equals(storage, value))
+            {
+                return false;
+            }
+
+            storage = value;
+            OnPropertyChanged(propertyName);
+            return true;
+        }
+
+        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+        {
+            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+        }
+    }
+}
index 0634b19ceb01b7b81798eb17370b30f12b0ab648..fea9a5b57e9af55f66f2542989b09713a2c524cb 100644 (file)
@@ -1,64 +1,71 @@
-/*
- *  Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+/*
+ * Copyright (c) 2023 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
+ * 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
+ * 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
+ * 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;
-using SettingCore;
+using Tizen.System;
 
 namespace SettingWallpaper.Common
 {
     class Resources
     {
-        public static readonly string LogTag = "SettingWallpaper";
-
+        public const string LogTag = "SettingWallpaper";
         public const string LightPlatformThemeId = "org.tizen.default-light-theme";
         public const string DarkPlatformThemeId = "org.tizen.default-dark-theme";
 
-        public static readonly PropertyMap FontStyleNormalLight = new PropertyMap().
-                                                    Add("width", new PropertyValue("normal")).
-                                                    Add("weight", new PropertyValue("light"));
-
-        public static readonly PropertyMap FontStyleAllNormal = new PropertyMap().
-                                                           Add("width", new PropertyValue("normal")).
-                                                           Add("weight", new PropertyValue("normal")).
-                                                           Add("slant", new PropertyValue("normal"));
+        public static string ResourcePath { get; set; }
 
-        static private string mResourcePath = "";
-
-        static public void SetPath(string path)
+        public static string GetImageDirectory()
         {
-            mResourcePath = path;
+            IEnumerable<Storage> storages = StorageManager.Storages;
+            string imageDirPath = string.Empty;
+            foreach (var storage in storages)
+            {
+                try
+                {
+                    imageDirPath = storage.GetAbsolutePath(DirectoryType.Images);
+                    Tizen.Log.Debug(Resources.LogTag, "imageDirPath:  " + imageDirPath);
+                }
+                catch (Exception ex)
+                {
+                    Tizen.Log.Debug(Resources.LogTag, "Exception : " + ex.Message);
+                }
+            }
+            return imageDirPath;
         }
 
         public static string GetThemePath()
         {
-            return mResourcePath + "/themes/";
+            return ResourcePath + "/themes/";
         }
+
         public static string GetImagePath()
         {
-            return mResourcePath + "/images/";
+            return ResourcePath + "/images/";
         }
 
         public static string GetLightImagePath()
         {
-            return GetImagePath() + "/light/";
+            return GetImagePath() + "light/";
         }
 
         public static string GetDarkImagePath()
         {
-            return GetImagePath() + "/dark/";
+            return GetImagePath() + "dark/";
         }
 
         public static string GetCurrentThemePath()
diff --git a/SettingWallpaper/SettingWallpaper/Core/ViewManager.cs b/SettingWallpaper/SettingWallpaper/Core/ViewManager.cs
new file mode 100644 (file)
index 0000000..59c4bdd
--- /dev/null
@@ -0,0 +1,467 @@
+/*
+ * Copyright (c) 2023 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.Collections.ObjectModel;
+using System.IO;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using Tizen.NUI.Xaml;
+using Tizen.System;
+using SettingWallpaper.Common;
+using SettingWallpaper.MediaContent;
+using SettingWallpaper.Models;
+using SettingWallpaper.Views;
+using SettingWallpaper.ViewModels;
+
+namespace SettingWallpaper.Core
+{
+    class ViewManager : IDisposable
+    {
+        private WallpaperView wallpaperView;
+        private AlbumView albumView;
+        private NoAlbumsView noAlbumsView;
+        private AlbumDetailView albumDetailView;
+        private AlbumViewModel albumViewModel;
+        private AlbumDetailViewModel albumDetailViewModel;
+        private WallpaperViewModel wallpaperViewModel;
+
+        private Button saveButton;
+
+        private Window customWindow;
+        private IBorderInterface appCustomBorder;
+
+        private bool isAlbumDetailView = false;
+
+        public ViewManager()
+        {
+            UpdateTheme(ThemeManager.PlatformThemeId);
+
+            wallpaperViewModel = new WallpaperViewModel();
+            wallpaperViewModel.FolderClicked += OnFolderClicked;
+            wallpaperViewModel.WallpaperChanged += OnWallpaperChanged;
+
+            wallpaperView = new WallpaperView();
+            wallpaperView.BindingContext = wallpaperViewModel;
+            wallpaperView.SetBinding(WallpaperView.WallpaperListProperty, "WallpaperListSource");
+            wallpaperView.TouchEvent += (object source, View.TouchEventArgs e) =>
+            {
+                if (e.Touch.GetState(0) == PointStateType.Down)
+                {
+                    wallpaperView.TogglePreview();
+                }
+                return true;
+            };
+
+            AlbumContent.Instance.AlbumContentUpdated += OnAlbumContentUpdated;
+
+            ThemeManager.ThemeChanged += OnThemeChanged;
+            Window.Instance.VisibilityChanged += OnWindowVisibilityChanged;
+        }
+
+        public void UpdateWallpaperView()
+        {
+            wallpaperView?.UpdateView();
+            wallpaperViewModel.UpdateMaxWallpapers();
+        }
+
+        public View GetWallpaperView()
+        {
+            return wallpaperView;
+        }
+
+        public Button GetSaveButton()
+        {
+            if (saveButton == null)
+            {
+                saveButton = new Button()
+                {
+                    Text = "Save",
+                    IsEnabled = true,
+                };
+                saveButton.BindingContext = wallpaperViewModel;
+                saveButton.SetBinding(Control.CommandProperty, "SetWallpaperCommand");
+            }
+            saveButton.Hide();
+            return saveButton;
+        }
+
+        private void OnFolderClicked()
+        {
+            CreateCustomWindow();
+            CreateAlbumViewModel();
+            UpdateCustomWindow();
+            UpdateViews();
+        }
+
+        private void CreateCustomWindow()
+        {
+            Size2D winSize = GetCustomWindowSize();
+            Tizen.Log.Debug(Resources.LogTag, "window size :" + winSize.Width + " ," + winSize.Height);
+
+            Position2D winPos = GetCustomWindowPosition(winSize.Width, winSize.Height);
+            Tizen.Log.Debug(Resources.LogTag, "window position :" + winPos.X + " , " + winPos.Y);
+
+            if (customWindow == null)
+            {
+                appCustomBorder = new CustomBorder();
+                customWindow = new Window("FolderWindow", appCustomBorder, new Rectangle(winPos.X, winPos.Y, winSize.Width, winSize.Height));
+                customWindow.SetTransparency(true);
+                customWindow.BackgroundColor = Color.Transparent;
+
+                List<Window.WindowOrientation> list = new List<Window.WindowOrientation>
+                {
+                    Window.WindowOrientation.Landscape,
+                    Window.WindowOrientation.LandscapeInverse,
+                    Window.WindowOrientation.NoOrientationPreference,
+                    Window.WindowOrientation.Portrait,
+                    Window.WindowOrientation.PortraitInverse,
+                };
+                customWindow.SetAvailableOrientations(list);
+                customWindow.OrientationChanged += OnCustomWindowOrientationChanged;
+
+                customWindow.Resized += OnCustomWindowResized;
+                customWindow.SetParent(Window.Instance);
+            }
+            customWindow.WindowPositionSize = new Rectangle(winPos.X, winPos.Y, winSize.Width, winSize.Height);
+            customWindow.Raise();
+        }
+
+        private Size2D GetCustomWindowSize()
+        {
+            int width = Window.Instance.WindowSize.Width / 2;
+            int height = Window.Instance.WindowSize.Height / 2;
+            return width < height ? new Size2D(height, width) : new Size2D(width, height);
+        }
+
+        private Position2D GetCustomWindowPosition(int width, int height)
+        {
+            int currWinPosX = Window.Instance.WindowPosition.X;
+            int currWinPosY = Window.Instance.WindowPosition.Y;
+            Tizen.Log.Debug(Resources.LogTag, "current X offset :" + currWinPosX + " , Y offset" + currWinPosY);
+
+            int positionX, positionY;
+            if (width < height)
+            {
+                positionX = (Window.Instance.WindowSize.Width - width) / 2 + currWinPosX;
+                positionY = (Window.Instance.WindowSize.Height - height) / 2 + currWinPosY;
+            }
+            else
+            {
+                positionX = (Window.Instance.WindowSize.Width - width) / 2 + currWinPosX;
+                positionY = Window.Instance.WindowSize.Height - height - (int)(0.4f * Window.Instance.WindowSize.Height) + currWinPosY;
+                if (positionY < 0)
+                {
+                    Tizen.Log.Debug(Resources.LogTag, "Setting position Y: " + positionY + " as 0");
+                    positionY = 0;
+                }
+            }
+            return new Position2D(positionX, positionY);
+        }
+
+        private void OnCustomWindowOrientationChanged(object sender, WindowOrientationChangedEventArgs e)
+        {
+            customWindow.WindowSize = GetCustomWindowSize();
+            customWindow.WindowPosition = GetCustomWindowPosition(customWindow.WindowSize.Width, customWindow.WindowSize.Height);
+            UpdateViews();
+        }
+
+        private void OnCustomWindowResized(object sender, Window.ResizedEventArgs e)
+        {
+            Tizen.Log.Debug(Resources.LogTag, "Resized Event");
+            UpdateViews();
+        }
+
+        private void CreateAlbumViewModel()
+        {
+            if (albumViewModel == null)
+            {
+                albumViewModel = new AlbumViewModel();
+            }
+        }
+
+        private void UpdateCustomWindow()
+        {
+            if (customWindow == null)
+            {
+                return;
+            }
+
+            ClearCustomWindowContent();
+
+            if (isAlbumDetailView == true)
+            {
+                albumDetailView = CreateAlbumDetailView();
+                customWindow.Add(albumDetailView);
+            }
+            else if (albumViewModel?.IsAlbumPresent == true)
+            {
+                albumView = CreateAlbumView();
+                customWindow.Add(albumView);
+            }
+            else
+            {
+                if (noAlbumsView == null)
+                {
+                    noAlbumsView = new NoAlbumsView(customWindow);
+                }
+                customWindow.Add(noAlbumsView);
+            }
+        }
+
+        private void ClearCustomWindowContent()
+        {
+            if (customWindow == null)
+            {
+                return;
+            }
+            if (noAlbumsView != null)
+            {
+                customWindow.Remove(noAlbumsView);
+            }
+            if (albumView != null)
+            {
+                customWindow.Remove(albumView);
+            }
+            if (albumDetailView != null)
+            {
+                customWindow.Remove(albumDetailView);
+            }
+        }
+
+        private AlbumView CreateAlbumView()
+        {
+            if (albumView == null)
+            {
+                albumView = new AlbumView(customWindow);
+                albumView.BindingContext = albumViewModel;
+                albumViewModel.AlbumSelected += OnAlbumSelected;
+                albumView.SetBinding(CollectionView.SelectionChangedCommandProperty, "SelectionChangedCommand");
+            }
+            return albumView;
+        }
+
+        private AlbumDetailView CreateAlbumDetailView()
+        {
+            if (albumDetailView == null)
+            {
+                albumDetailView = new AlbumDetailView(customWindow);
+                albumDetailView.SetBinding(CollectionView.SelectionChangedCommandProperty, "SelectionChangedCommand");
+            }
+            albumDetailView.BindingContext = albumDetailViewModel;
+
+            return albumDetailView;
+        }
+
+        private void OnWallpaperChanged(string url)
+        {
+            if (url != SystemSettings.WallpaperHomeScreen)
+            {
+                saveButton.Show();
+            }
+            else
+            {
+                saveButton.Hide();
+            }
+            wallpaperView.ResourceUrl = url;
+        }
+
+        private void OnAlbumContentUpdated()
+        {
+            albumViewModel?.UpdateAlbumList();
+            albumDetailViewModel?.UpdateImageList();
+            wallpaperViewModel?.UpdateWallpapers();
+            UpdateCustomWindow();
+        }
+
+        private void OnWindowVisibilityChanged(object sender, Window.VisibilityChangedEventArgs e)
+        {
+            Tizen.Log.Debug(Resources.LogTag, "Visibility changed: " + e.Visibility);
+            if (e.Visibility == false)
+            {
+                customWindow?.Lower();
+            }
+            else
+            {
+                customWindow?.Raise();
+            }
+        }
+
+        private void OnThemeChanged(object sender, ThemeChangedEventArgs e)
+        {
+            if (e.IsPlatformThemeChanged)
+            {
+                Tizen.Log.Info(Resources.LogTag, "Theme Changed: " + e.ThemeId);
+                UpdateTheme(e.PlatformThemeId);
+            }
+        }
+
+        private void OnAlbumSelected(object sender, string albumId)
+        {
+            Tizen.Log.Debug(Resources.LogTag, "Selected album's id : " + albumId);
+            isAlbumDetailView = true;
+            albumView.SelectedItem = null;
+
+            albumDetailViewModel = new AlbumDetailViewModel(albumId);
+            albumDetailViewModel.ImageSelected += OnImageSelected;
+            albumDetailViewModel.BackButtonClicked += OnAlbumDetailViewBackClicked;
+
+            UpdateCustomWindow();
+        }
+
+        private void OnImageSelected(object sender, ImageSelectedEventArgs e)
+        {
+            wallpaperViewModel.AddSelectedImage(e.Path, e.ThumbnailPath, e.Id, e.IsCustomImage);
+        }
+
+        private void OnAlbumDetailViewBackClicked()
+        {
+            albumDetailView.SelectedItem = null;
+            isAlbumDetailView = false;
+            albumDetailView?.Dispose();
+            albumDetailViewModel = null;
+            albumDetailView = null;
+            UpdateCustomWindow();
+        }
+
+        private void UpdateViews()
+        {
+            if (albumView != null)
+            {
+                albumView.Size2D = new Size2D(customWindow.WindowSize.Width, customWindow.WindowSize.Height);
+            }
+            if (noAlbumsView != null)
+            {
+                noAlbumsView.Size2D = new Size2D(customWindow.WindowSize.Width, customWindow.WindowSize.Height);
+            }
+            if (albumDetailView != null)
+            {
+                albumDetailView.Size2D = new Size2D(customWindow.WindowSize.Width, customWindow.WindowSize.Height);
+            }
+        }
+
+        private void SetTheme(string path)
+        {
+            try
+            {
+                Theme theme = new Theme(path);
+                ThemeManager.ApplyTheme(theme);
+            }
+            catch (ArgumentNullException e)
+            {
+                Tizen.Log.Error(Resources.LogTag, "ArgumentNullException: " + e.ParamName);
+            }
+            catch (IOException e)
+            {
+                Tizen.Log.Error(Resources.LogTag, "IOException: " + e.Message);
+            }
+            catch (XamlParseException e)
+            {
+                Tizen.Log.Error(Resources.LogTag, "XamlParseException: " + e.Message);
+                if (e.XmlInfo != null)
+                {
+                    Tizen.Log.Error(Resources.LogTag, "XamlParseException, LineNo." + e.XmlInfo.LineNumber + " Pos: " + e.XmlInfo.LinePosition + " HasInfo: " + e.XmlInfo.HasLineInfo().ToString());
+                }
+            }
+        }
+
+        private void UpdateTheme(string platformThemeId)
+        {
+            if (platformThemeId == null)
+            {
+                Tizen.Log.Error(Resources.LogTag, "Platform theme id is null");
+                return;
+            }
+            if (platformThemeId.Equals(Resources.LightPlatformThemeId))
+            {
+                SetTheme(Resources.GetThemePath() + "light.xaml");
+            }
+            else if (platformThemeId.Equals(Resources.DarkPlatformThemeId))
+            {
+                SetTheme(Resources.GetThemePath() + "dark.xaml");
+            }
+        }
+
+        public void Dispose()
+        {
+            Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                wallpaperView?.Dispose();
+                wallpaperView = null;
+                albumView?.Dispose();
+                albumView = null;
+                noAlbumsView?.Dispose();
+                noAlbumsView = null;
+                albumDetailView?.Dispose();
+                albumDetailView = null;
+                if(customWindow != null)
+                {
+                    customWindow.Unparent();
+                    customWindow.Dispose();
+                    customWindow = null;
+                }
+                appCustomBorder?.Dispose();
+                appCustomBorder = null;
+                if (saveButton != null)
+                {
+                    saveButton.BindingContext = null;
+                    saveButton.Dispose();
+                    saveButton = null;
+                }
+                ThemeManager.ThemeChanged -= OnThemeChanged;
+                if(wallpaperViewModel != null)
+                {
+                    wallpaperViewModel.FolderClicked -= OnFolderClicked;
+                    wallpaperViewModel.WallpaperChanged -= OnWallpaperChanged;
+                    wallpaperViewModel = null;
+                }
+                AlbumContent.Instance.AlbumContentUpdated -= OnAlbumContentUpdated;
+
+                if (albumDetailViewModel != null)
+                {
+                    albumDetailViewModel.BackButtonClicked -= OnAlbumDetailViewBackClicked;
+                    albumDetailViewModel.ImageSelected -= OnImageSelected;
+                    albumDetailViewModel = null;
+                }
+
+                if(albumViewModel != null)
+                {
+                    (albumViewModel.AlbumListSource as ObservableCollection<AlbumDataModel>).Clear();
+                    albumViewModel.AlbumListSource = null;
+                    albumViewModel.SelectionChangedCommand = null;
+                    albumViewModel.AlbumSelected -= OnAlbumSelected;
+                    albumViewModel = null;
+                }
+                AlbumContent.Instance.Disconnect();
+            }
+            Tizen.Log.Debug(Resources.LogTag, "view Manager disposed");
+        }
+
+        ~ViewManager()
+        {
+            Dispose(false);
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/CustomBorder.cs b/SettingWallpaper/SettingWallpaper/CustomBorder.cs
new file mode 100644 (file)
index 0000000..75f8494
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI.BaseComponents;
+using Tizen.NUI;
+using SettingCore;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper
+{
+    class CustomBorder : DefaultBorder
+    {
+        private static readonly Color borderBackgroundColor = (ThemeManager.PlatformThemeId == Resources.LightPlatformThemeId) ? Color.White.WithAlpha(0.35f) : new Color("#161319").WithAlpha(0.5f);
+        private static readonly Color resizedBorderBackgroundColor = Color.Green.WithAlpha(0.3f);
+        private static readonly string ResourcePath = Resources.GetImagePath();
+
+        private static readonly string MaximalizeIcon = ResourcePath + "maximalize.png";
+        private static readonly string RestoreIcon = ResourcePath + "smallwindow.png";
+        private static readonly string CloseIcon = ResourcePath + "close.png";
+        private static readonly string LeftCornerIcon = ResourcePath + "leftCorner.png";
+        private static readonly string MinimalizeIcon = ResourcePath + "minimalize.png";
+
+        private View borderView;
+        private View bottomView;
+
+        private bool disposed = false;
+        private ImageView minimalizeIcon;
+        private ImageView maximalizeIcon;
+        private ImageView closeIcon;
+        private ImageView leftCornerIcon;
+
+        public CustomBorder() : base()
+        {
+            BorderLineThickness = 0;
+            ResizePolicy = Window.BorderResizePolicyType.Free;
+            MinSize = new Size2D(250, 150).SpToPx();
+        }
+
+        public override bool CreateTopBorderView(View topView)
+        {
+            return false;
+        }
+
+        public override bool CreateBottomBorderView(View bottomView)
+        {
+            if (bottomView == null)
+            {
+                return false;
+            }
+            this.bottomView = bottomView;
+            bottomView.Layout = new RelativeLayout();
+
+            minimalizeIcon = new ImageView()
+            {
+                ResourceUrl = MinimalizeIcon,
+                AccessibilityHighlightable = true,
+            };
+
+            maximalizeIcon = new ImageView()
+            {
+                ResourceUrl = MaximalizeIcon,
+                AccessibilityHighlightable = true,
+            };
+
+            closeIcon = new ImageView()
+            {
+                ResourceUrl = CloseIcon,
+                AccessibilityHighlightable = true,
+            };
+
+            leftCornerIcon = new ImageView()
+            {
+                ResourceUrl = LeftCornerIcon,
+                AccessibilityHighlightable = true,
+            };
+
+            RelativeLayout.SetRightTarget(minimalizeIcon, maximalizeIcon);
+            RelativeLayout.SetRightRelativeOffset(minimalizeIcon, 0.0f);
+            RelativeLayout.SetHorizontalAlignment(minimalizeIcon, RelativeLayout.Alignment.End);
+            RelativeLayout.SetRightTarget(maximalizeIcon, closeIcon);
+            RelativeLayout.SetRightRelativeOffset(maximalizeIcon, 0.0f);
+            RelativeLayout.SetHorizontalAlignment(maximalizeIcon, RelativeLayout.Alignment.End);
+            RelativeLayout.SetRightRelativeOffset(closeIcon, 1.0f);
+            RelativeLayout.SetHorizontalAlignment(closeIcon, RelativeLayout.Alignment.End);
+            bottomView.Add(leftCornerIcon);
+
+            bottomView.Add(minimalizeIcon);
+            bottomView.Add(maximalizeIcon);
+            bottomView.Add(closeIcon);
+
+            minimalizeIcon.TouchEvent += OnMinimizeIconTouched;
+            maximalizeIcon.TouchEvent += OnMaximizeIconTouched;
+            closeIcon.TouchEvent += OnCloseIconTouched;
+            leftCornerIcon.TouchEvent += OnLeftBottomCornerIconTouched;
+
+            minimalizeIcon.AccessibilityActivated += (s, e) =>
+            {
+                MinimizeBorderWindow();
+            };
+            maximalizeIcon.AccessibilityActivated += (s, e) =>
+            {
+                MaximizeBorderWindow();
+            };
+            closeIcon.AccessibilityActivated += (s, e) =>
+            {
+                CloseBorderWindow();
+            };
+
+            minimalizeIcon.AccessibilityNameRequested += (s, e) =>
+            {
+                e.Name = "Minimize";
+            };
+            maximalizeIcon.AccessibilityNameRequested += (s, e) =>
+            {
+                e.Name = "Maximize";
+            };
+            closeIcon.AccessibilityNameRequested += (s, e) =>
+            {
+                e.Name = "Close";
+            };
+            leftCornerIcon.AccessibilityNameRequested += (s, e) =>
+            {
+                e.Name = "Resize";
+            };
+
+            minimalizeIcon.SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes.Name);
+            maximalizeIcon.SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes.Name);
+            closeIcon.SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes.Name);
+            leftCornerIcon.SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes.Name);
+
+            return true;
+        }
+
+        public override void CreateBorderView(View borderView)
+        {
+            this.borderView = borderView;
+            borderView.CornerRadius = new Vector4(0.03f, 0.03f, 0.03f, 0.03f);
+            borderView.CornerRadiusPolicy = VisualTransformPolicyType.Relative;
+            borderView.BackgroundColor = borderBackgroundColor;
+        }
+
+        public override void OnCreated(View borderView)
+        {
+            base.OnCreated(borderView);
+            UpdateIcons();
+        }
+
+        public override bool OnCloseIconTouched(object sender, View.TouchEventArgs e)
+        {
+
+            Tizen.Log.Debug(Resources.LogTag, $"Item Name : {ResourcePath}");
+            BorderWindow?.Unparent();
+            base.OnCloseIconTouched(sender, e);
+            return true;
+        }
+
+        public override void OnRequestResize()
+        {
+            if (borderView != null)
+            {
+                borderView.BackgroundColor = resizedBorderBackgroundColor;
+            }
+        }
+
+        public override void OnResized(int width, int height)
+        {
+            if (borderView != null)
+            {
+                borderView.BackgroundColor = borderBackgroundColor;
+                base.OnResized(width, height);
+                UpdateIcons();
+            }
+        }
+
+        private void UpdateIcons()
+        {
+            if (BorderWindow != null && borderView != null)
+            {
+                if (BorderWindow.IsMaximized() == true)
+                {
+                    if (maximalizeIcon != null)
+                    {
+                        maximalizeIcon.ResourceUrl = RestoreIcon;
+                    }
+                }
+                else
+                {
+                    if (maximalizeIcon != null)
+                    {
+                        maximalizeIcon.ResourceUrl = MaximalizeIcon;
+                    }
+                }
+            }
+        }
+
+        protected override void Dispose(bool disposing)
+        {
+            Tizen.Log.Info(Resources.LogTag, "Custom Window disposed :"+ disposed);
+            if (disposed)
+            {
+                return;
+            }
+            if (disposing == true)
+            {
+                maximalizeIcon.TouchEvent -= OnMaximizeIconTouched;
+                closeIcon.TouchEvent -= OnCloseIconTouched;
+                leftCornerIcon.TouchEvent -= OnLeftBottomCornerIconTouched;
+
+                bottomView.Remove(maximalizeIcon);
+                maximalizeIcon?.Dispose();
+                maximalizeIcon = null;
+
+                bottomView.Remove(closeIcon);
+                closeIcon?.Dispose();
+                closeIcon = null;
+
+                bottomView.Remove(leftCornerIcon);
+                leftCornerIcon?.Dispose();
+                leftCornerIcon = null;
+            }
+            disposed = true;
+            base.Dispose();
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/MediaContent/AlbumContent.cs b/SettingWallpaper/SettingWallpaper/MediaContent/AlbumContent.cs
new file mode 100644 (file)
index 0000000..7d6b170
--- /dev/null
@@ -0,0 +1,121 @@
+using System;
+using System.Collections.Generic;
+using Tizen.Content.MediaContent;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.MediaContent
+{
+    class AlbumContent
+    {
+        private readonly string MEDIA_TYPE_QUERY = $"{MediaInfoColumns.MediaType}={(int)Media​Type.Image}";
+        private const string MEDIA_STORAGE_TYPE_QUERY = " (( MEDIA_STORAGE_TYPE IS NOT 101 ) AND (MEDIA_TYPE = 0)) ";
+        private const string MEDIA_SORT_ORDER_ASC = " COLLATE NOCASE ASC ";
+
+        private MediaDatabase database;
+        private FolderCommand folderCommand;
+        public event Action AlbumContentUpdated;
+
+        private static AlbumContent instance;
+        public static AlbumContent Instance
+        {
+            get
+            {
+                if (instance == null)
+                {
+                    instance = new AlbumContent();
+                }
+                return instance;
+            }
+        }
+
+        public List<Folder> GetAlbumList()
+        {
+            List<Folder> folderList = new List<Folder>();
+
+            SelectArguments albumSelectArguments = CreateSelectArgument(MEDIA_STORAGE_TYPE_QUERY, FolderColumns.Name + MEDIA_SORT_ORDER_ASC);
+            MediaDataReader<Folder> dataReader = folderCommand.Select(albumSelectArguments);
+
+            while (dataReader.Read())
+            {
+                Folder folder = dataReader.Current;
+                Tizen.Log.Debug(Resources.LogTag, "Folder name: " + folder.Name);
+                folderList.Add(folder);
+            }
+
+            Tizen.Log.Debug(Resources.LogTag, "Total albums retrieved from database: " + folderList.Count);
+            dataReader.Dispose();
+            return folderList;
+        }
+
+        public string GetAlbumName(string selectedAlbumId)
+        {
+            Folder folder = folderCommand.Select(selectedAlbumId);
+            return folder != null ? folder.Name : string.Empty;
+        }
+
+        public List<MediaInfo> GetAlbumMemberList(string albumId)
+        {
+            List<MediaInfo> mediaList = new List<MediaInfo>();
+            SelectArguments albumMediaSelectArguments = CreateSelectArgument(MEDIA_TYPE_QUERY, MediaInfoColumns.Title + MEDIA_SORT_ORDER_ASC);
+            MediaDataReader<MediaInfo> dataReader = folderCommand.SelectMedia(albumId, albumMediaSelectArguments);
+
+            while (dataReader.Read())
+            {
+                mediaList.Add(dataReader.Current);
+            }
+            Tizen.Log.Debug(Resources.LogTag, "Total images retrieved from currentAlbum: " + mediaList.Count);
+            dataReader.Dispose();
+            return mediaList;
+        }
+
+        public void Disconnect()
+        {
+            Tizen.Log.Debug(Resources.LogTag, "Disconnect called.");
+            MediaDatabase.FolderUpdated -= OnFolderUpdated;
+            MediaDatabase.MediaInfoUpdated -= OnMediaInfoUpdated;
+
+            try
+            {
+                database?.Disconnect();
+                database?.Dispose();
+            }
+            catch (Exception ex)
+            {
+                Tizen.Log.Debug(Resources.LogTag, " Disconnect exception: " + ex.Message);
+            }
+            instance = null;
+        }
+
+        private AlbumContent()
+        {
+            database = new MediaDatabase();
+            database.Connect();
+            folderCommand = new FolderCommand(database);
+            MediaDatabase.FolderUpdated += OnFolderUpdated;
+            MediaDatabase.MediaInfoUpdated += OnMediaInfoUpdated;
+        }
+
+        private void OnMediaInfoUpdated(object sender, MediaInfoUpdatedEventArgs e)
+        {
+            Tizen.Log.Debug(Resources.LogTag, "Media info updated");
+            if(e.MediaType == MediaType.Image)
+            {
+                AlbumContentUpdated?.Invoke();
+            }
+        }
+
+        private void OnFolderUpdated(object sender, FolderUpdatedEventArgs e)
+        {
+            Tizen.Log.Debug(Resources.LogTag, "Folder updated");
+            AlbumContentUpdated?.Invoke();
+        }
+
+        private static SelectArguments CreateSelectArgument(string filterExpression, string sortOrder)
+        {
+            SelectArguments arguments = new SelectArguments();
+            arguments.FilterExpression = filterExpression;
+            arguments.SortOrder = sortOrder;
+            return arguments;
+        }
+    }
+}
index 76f5e6b314c62abe2af02603cd496cea62796a4f..5a7c9f0f5f51599747a1dd9a9c1091e030f1727a 100644 (file)
@@ -1,4 +1,20 @@
-using SettingCore;
+/*
+ * Copyright (c) 2023 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 SettingCore;
 
 namespace SettingWallpaper
 {
diff --git a/SettingWallpaper/SettingWallpaper/Models/AlbumDataModel.cs b/SettingWallpaper/SettingWallpaper/Models/AlbumDataModel.cs
new file mode 100644 (file)
index 0000000..8461900
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2023 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 SettingWallpaper.Common;
+
+namespace SettingWallpaper.Models
+{
+    class AlbumDataModel : PropertyNotifier
+    {
+        public AlbumDataModel(string albumName,string albumId)
+        {
+            AlbumName = albumName;
+            AlbumId = albumId;
+        }
+
+        public string AlbumName { get; internal set;}
+        public string AlbumId { get; internal set;}
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Models/AlbumDataProvider.cs b/SettingWallpaper/SettingWallpaper/Models/AlbumDataProvider.cs
new file mode 100644 (file)
index 0000000..49c6fa6
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2023 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 Tizen.Content.MediaContent;
+using SettingWallpaper.MediaContent;
+
+namespace SettingWallpaper.Models
+{
+    static class AlbumDataProvider
+    {
+        public static string GetAlbumName(string albumId)
+        {
+            return AlbumContent.Instance.GetAlbumName(albumId);
+        }
+
+        public static List<MediaInfo> GetAlbumItemsList(string albumId)
+        {
+            for (int i = 0; i < AlbumList.Count; i++)
+            {
+                if (AlbumList[i].Id == albumId)
+                {
+                    return AlbumContent.Instance.GetAlbumMemberList(AlbumList[i].Id);
+                }
+            }
+            return null;
+        }
+
+        public static List<Folder> AlbumList => AlbumContent.Instance.GetAlbumList();
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Models/ImageDataModel.cs b/SettingWallpaper/SettingWallpaper/Models/ImageDataModel.cs
new file mode 100644 (file)
index 0000000..49d4787
--- /dev/null
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2023 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.IO;
+using System.Windows.Input;
+using Tizen.Multimedia.Util;
+using Tizen.NUI.Binding;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Models
+{
+    class ImageDataModel : PropertyNotifier
+    {
+        public event EventHandler<ImageSelectedEventArgs> ImageSelected;
+        public ImageDataModel(string imageUrl, string id, string thumbnailUrl, bool isCustomImage)
+        {
+            Id = id;
+            ImageUrl = imageUrl;
+            if (thumbnailUrl != null && File.Exists(thumbnailUrl) == true)
+            {
+                ThumbnailUrl = thumbnailUrl;
+            }
+            else
+            {
+                string thumbPath = Tizen.System.PlatformConfig.GetEnv("TZ_SYS_HOME") + "/owner/share/media/.thumb/.jpg-" + id + ".jpg";
+                try
+                {
+                    ThumbnailExtractor.Extract(imageUrl, thumbPath);
+                    if (File.Exists(thumbPath) == true)
+                    {
+                        ThumbnailUrl = thumbPath;
+                    }
+                    else
+                    {
+                        ThumbnailUrl = Resources.GetImagePath() + "GalleryIcon.png";
+                    }
+                }
+                catch (Exception ex)
+                {
+                    Tizen.Log.Debug(Resources.LogTag, "Exception: " + ex.Message);
+                    ThumbnailUrl = Resources.GetImagePath() + "GalleryIcon.png";
+                }
+            }
+            IsCustomImage = isCustomImage;
+            wallpaperSelectCommand = new Command(OnWallpaperClicked);
+            Tizen.Log.Debug(Resources.LogTag, "Thumbnail path: " + ThumbnailUrl);
+            Tizen.Log.Debug(Resources.LogTag, "Image id: " + Id);
+            Tizen.Log.Debug(Resources.LogTag, "Image path: " + ImageUrl);
+        }
+
+        private string thumbnailUrl;
+        public string ThumbnailUrl
+        {
+            get => thumbnailUrl;
+            set => SetProperty(ref thumbnailUrl, value);
+        }
+
+        private string imageUrl;
+        public string ImageUrl
+        {
+            get => imageUrl;
+            set => SetProperty(ref imageUrl, value);
+        }
+
+        public string Id { get; internal set;}
+
+        private ICommand wallpaperSelectCommand;
+        public ICommand WallpaperSelectCommand
+        {
+            get => wallpaperSelectCommand;
+            set => SetProperty(ref wallpaperSelectCommand, value);
+        }
+
+        private bool isCustomImage;
+        public bool IsCustomImage
+        {
+            get => isCustomImage;
+            set => SetProperty(ref isCustomImage, value);
+        }
+
+        private void OnWallpaperClicked()
+        {
+            ImageSelected?.Invoke(this, new ImageSelectedEventArgs(ImageUrl, Id, ThumbnailUrl, IsCustomImage));
+        }
+    }
+}
index a7a092b1f51510d4f1dddaf87f135f0a1e53d223..7d255b363941aedf5b5974871ce3df39038fb732 100644 (file)
     <DebugType>None</DebugType>
   </PropertyGroup>
   <ItemGroup>
-    <PackageReference Include="Tizen.NET" Version="10.0.0.17712" />
+    <PackageReference Include="Tizen.NET" Version="11.0.0.17848" />
   </ItemGroup>
-
   <ItemGroup>
     <Reference Include="SettingCore">
-      <HintPath>..\..\..\..\..\..\settings-56543f0.tar\settings-56543f0\settings-56543f0\SettingCore\bin\Debug\netcoreapp3.1\SettingCore.dll</HintPath>
+      <HintPath>..\..\..\..\Setting_29May\settings\SettingCore\bin\Debug\netcoreapp3.1\SettingCore.dll</HintPath>
     </Reference>
   </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Core\" />
+    <Folder Include="Models\" />
+    <Folder Include="MediaContent\" />
+    <Folder Include="ViewModels\" />
+  </ItemGroup>
 
 </Project>
diff --git a/SettingWallpaper/SettingWallpaper/ViewModels/AlbumDetailInfoViewModel.cs b/SettingWallpaper/SettingWallpaper/ViewModels/AlbumDetailInfoViewModel.cs
new file mode 100644 (file)
index 0000000..861bd00
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2023 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.Collections.ObjectModel;
+using Tizen.Content.MediaContent;
+using SettingWallpaper.Common;
+using SettingWallpaper.Models;
+
+namespace SettingWallpaper.ViewModels
+{
+    class AlbumDetailInfoViewModel : ObservableCollection<ImageDataModel>
+    {
+        public AlbumDetailInfoViewModel(string albumId)
+        {
+            CreateData(albumId);
+        }
+
+        private void CreateData(string albumId)
+        {
+            List<MediaInfo> imageList = AlbumDataProvider.GetAlbumItemsList(albumId);
+            if(imageList != null)
+            {
+                foreach (MediaInfo image in imageList)
+                {
+                    if(image.Path == Resources.GetImageDirectory() + "/custom_wallpaper.jpg")
+                    {
+                        continue;
+                    }
+                    ImageDataModel imageDataModel = new ImageDataModel(image.Path, image.Id, image.ThumbnailPath, true);
+                    Add(imageDataModel);
+                }
+            }
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/ViewModels/AlbumDetailViewModel.cs b/SettingWallpaper/SettingWallpaper/ViewModels/AlbumDetailViewModel.cs
new file mode 100644 (file)
index 0000000..c498ad2
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2023 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;
+using System.Windows.Input;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using SettingWallpaper.Common;
+using SettingWallpaper.Models;
+
+namespace SettingWallpaper.ViewModels
+{
+    class AlbumDetailViewModel : PropertyNotifier
+    {
+        public event EventHandler<ImageSelectedEventArgs> ImageSelected;
+        public event Action BackButtonClicked;
+        private string albumId;
+
+        public AlbumDetailViewModel(string albumId)
+        {
+            this.albumId = albumId;
+            UpdateImageList();
+            SelectionChangedCommand = new Command(OnImageSelect);
+            backButtonCommand = new Command(OnBackClicked);
+        }
+
+        public void UpdateImageList()
+        {
+            (ImageListSource as AlbumDetailInfoViewModel)?.Clear();
+            ImageListSource = new AlbumDetailInfoViewModel(albumId);
+            AlbumName = AlbumDataProvider.GetAlbumName(albumId);
+        }
+
+        private string albumName;
+        public string AlbumName
+        {
+            get => albumName;
+            set => SetProperty(ref albumName, value);
+        }
+
+        private IEnumerable imageListSource;
+        public IEnumerable ImageListSource
+        {
+            get => imageListSource;
+            set => SetProperty(ref imageListSource, value);
+        }
+
+        private ICommand selectionChangedCommand;
+        public ICommand SelectionChangedCommand
+        {
+            get => selectionChangedCommand;
+            set => SetProperty(ref selectionChangedCommand, value);
+        }
+
+        private ICommand backButtonCommand;
+        public ICommand BackButtonCommand
+        {
+            get => backButtonCommand;
+            set => SetProperty(ref backButtonCommand, value);
+        }
+
+        private void OnImageSelect(object parameter)
+        {
+            if (parameter is SelectionChangedEventArgs e)
+            {
+                if (e.CurrentSelection.Count != 0 && e.CurrentSelection[0] is ImageDataModel imageDataModel)
+                {
+                    string thumbnailPath = imageDataModel.ThumbnailUrl;
+                    string imageId = imageDataModel.Id;
+                    string imagePath = imageDataModel.ImageUrl;
+                    bool isCustomImage = imageDataModel.IsCustomImage;
+                    ImageSelected?.Invoke(this, new ImageSelectedEventArgs(imagePath, imageId, thumbnailPath, isCustomImage));
+                }
+            }
+        }
+
+        private void OnBackClicked()
+        {
+            BackButtonClicked?.Invoke();
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/ViewModels/AlbumInfoViewModel.cs b/SettingWallpaper/SettingWallpaper/ViewModels/AlbumInfoViewModel.cs
new file mode 100644 (file)
index 0000000..6949782
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2023 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.Collections.ObjectModel;
+using Tizen.Content.MediaContent;
+using SettingWallpaper.Models;
+
+namespace SettingWallpaper.ViewModels
+{
+    class AlbumInfoViewModel : ObservableCollection<AlbumDataModel>
+    {
+        public AlbumInfoViewModel()
+        {
+            CreateData();
+        }
+
+        private void CreateData()
+        {
+            List<Folder> albumList = AlbumDataProvider.AlbumList;
+            foreach(Folder album in albumList)
+            {
+                AlbumDataModel albumDataModel = new AlbumDataModel(album.Name, album.Id);
+                Add(albumDataModel);
+            }
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/ViewModels/AlbumViewModel.cs b/SettingWallpaper/SettingWallpaper/ViewModels/AlbumViewModel.cs
new file mode 100644 (file)
index 0000000..95c0114
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2023 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;
+using System.Windows.Input;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using SettingWallpaper.Common;
+using SettingWallpaper.Models;
+
+namespace SettingWallpaper.ViewModels
+{
+    class AlbumViewModel : PropertyNotifier
+    {
+        public event EventHandler<string> AlbumSelected;
+        public bool IsAlbumPresent;
+
+        public AlbumViewModel()
+        {
+            UpdateAlbumList();
+            SelectionChangedCommand = new Command(OnFolderSelect);
+        }
+
+        private IEnumerable albumListSource;
+        public IEnumerable AlbumListSource
+        {
+            get => albumListSource;
+            set => SetProperty(ref albumListSource, value);
+        }
+
+        private ICommand selectionChangedCommand;
+        public ICommand SelectionChangedCommand
+        {
+            get => selectionChangedCommand;
+            set => SetProperty(ref selectionChangedCommand, value);
+        }
+
+        public void OnFolderSelect(object parameter)
+        {
+            if(parameter is SelectionChangedEventArgs e)
+            {
+                if (e.CurrentSelection.Count != 0 && e.CurrentSelection[0] is AlbumDataModel albumDataModel)
+                {
+                    AlbumSelected?.Invoke(this, albumDataModel.AlbumId);
+                }
+            }
+        }
+
+        public void UpdateAlbumList()
+        {
+            (AlbumListSource as AlbumInfoViewModel)?.Clear();
+            AlbumListSource = new AlbumInfoViewModel();
+            int albumCount = ((AlbumInfoViewModel)AlbumListSource).Count;
+            Tizen.Log.Debug(Resources.LogTag, "album count: " + albumCount);
+            if (albumCount == 0)
+            {
+                IsAlbumPresent = false;
+            }
+            else
+            {
+                IsAlbumPresent = true;
+            }
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/ViewModels/WallpaperViewModel.cs b/SettingWallpaper/SettingWallpaper/ViewModels/WallpaperViewModel.cs
new file mode 100644 (file)
index 0000000..2f10307
--- /dev/null
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2023 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;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.IO;
+using System.Windows.Input;
+using Tizen.NUI;
+using Tizen.NUI.Binding;
+using Tizen.System;
+using SettingWallpaper.Common;
+using SettingWallpaper.Models;
+
+namespace SettingWallpaper.ViewModels
+{
+    class WallpaperViewModel : PropertyNotifier
+    {
+        private string WallpaperPath = PlatformConfig.GetEnv("TZ_SYS_GLOBALUSER_DATA") + "/settings/Wallpapers/";
+        private string customWallpaperPath = Resources.GetImageDirectory() + "/custom_wallpaper.jpg";
+
+        ObservableCollection<ImageDataModel> wallpapers;
+        public event Action FolderClicked;
+        public event Action<string> WallpaperChanged;
+
+        private int startingIndex;
+        private int maxWallpapers;
+        private int totalWallpapers;
+        private bool CustomImage;
+        public string CurrentWallpaper { get; set; }
+
+        public WallpaperViewModel()
+        {
+            WallpaperListSource = new List<object>();
+            startingIndex = 0;
+            CurrentWallpaper = SystemSettings.WallpaperHomeScreen;
+            CreateData();
+            UpdateMaxWallpapers();
+            setWallpaperCommand = new Command(OnSaveClicked);
+            previousButtonCommand = new Command(OnPreviousClicked);
+            nextButtonCommand = new Command(OnNextClicked);
+            albumFolderCommand = new Command(OnAlbumSelect);
+        }
+
+        public void UpdateMaxWallpapers()
+        {
+            float wallpaperListViewWidth = (int)(Window.Instance.Size.Width * AppCommon.bottomViewWidthRatio) - 274.SpToPx();
+            maxWallpapers = ((int)wallpaperListViewWidth) / AppCommon.wallpaperListViewIconWidth;
+            Tizen.Log.Info(Resources.LogTag, "maxWallapers: " + maxWallpapers);
+            UpdateWallpaperList();
+        }
+
+        public void UpdateWallpapers()
+        {
+            if (File.Exists(CurrentWallpaper) == false)
+            {
+                CurrentWallpaper = SystemSettings.WallpaperHomeScreen;
+                WallpaperChanged?.Invoke(CurrentWallpaper);
+            }
+
+            int i = 0;
+            while (i < wallpapers.Count)
+            {
+                if (File.Exists(wallpapers[i].ImageUrl) == false)
+                {
+                    wallpapers.Remove(wallpapers[i]);
+                    totalWallpapers--;
+                    if (startingIndex > i)
+                    {
+                        startingIndex--;
+                    }
+                }
+                else
+                {
+                    i++;
+                }
+            }
+            UpdateWallpaperList();
+        }
+
+        public void AddSelectedImage(string imagePath, string thumbnailPath, string imageId, bool isCustomImage)
+        {
+            CurrentWallpaper = imagePath;
+            CustomImage = isCustomImage;
+            bool isWallpaperPresent = false;
+            for (int i = 0; i < wallpapers.Count; i++)
+            {
+                if (wallpapers[i].Id == imageId)
+                {
+                    isWallpaperPresent = true;
+                    ImageDataModel imageDataModel = wallpapers[i];
+                    wallpapers.RemoveAt(i);
+                    wallpapers.Insert(startingIndex, imageDataModel);
+                    break;
+                }
+            }
+            if (isWallpaperPresent == false)
+            {
+                totalWallpapers++;
+                ImageDataModel imageDataModel = new ImageDataModel(imagePath, imageId, thumbnailPath, isCustomImage);
+                imageDataModel.ImageSelected += WallpaperSelected;
+                wallpapers.Insert(startingIndex, imageDataModel);
+            }
+            UpdateWallpaperList();
+            WallpaperChanged?.Invoke(imagePath);
+        }
+
+        private void CreateData()
+        {
+            ((List<object>)WallpaperListSource).Clear();
+            totalWallpapers = 0;
+            wallpapers = new ObservableCollection<ImageDataModel>();
+            string filePath = customWallpaperPath;
+            if (File.Exists(filePath) == true)
+            {
+                ImageDataModel imageDataModel = new ImageDataModel(filePath, "0", filePath, true);
+                imageDataModel.ImageSelected += WallpaperSelected;
+                wallpapers.Add(imageDataModel);
+                totalWallpapers++;
+            }
+
+            DirectoryInfo wallPaperDirectory = new DirectoryInfo(WallpaperPath);
+            foreach (FileInfo fi in wallPaperDirectory.GetFiles())
+            {
+                ImageDataModel wallpaperDataModel = new ImageDataModel(fi.FullName, "0", fi.FullName, false);
+                wallpaperDataModel.ImageSelected += WallpaperSelected;
+                wallpapers.Add(wallpaperDataModel);
+                totalWallpapers++;
+            }
+        }
+
+        private void WallpaperSelected(object sender, ImageSelectedEventArgs e)
+        {
+            CurrentWallpaper = e.Path;
+            CustomImage = e.IsCustomImage;
+            WallpaperChanged?.Invoke(e.Path);
+        }
+
+        private void UpdateWallpaperList()
+        {
+            List<object> updatedList = new List<object>();
+            for (int i = startingIndex; i < startingIndex + maxWallpapers; i++)
+            {
+                if (i == totalWallpapers)
+                {
+                    break;
+                }
+                updatedList.Add(wallpapers[i]);
+            }
+            WallpaperListSource = updatedList;
+            IsPreviousImageAvailable = startingIndex != 0;
+            IsNextImageAvailable = startingIndex + maxWallpapers < totalWallpapers;
+        }
+
+        private void OnSaveClicked()
+        {
+            Tizen.Log.Debug(Resources.LogTag, "Current wallpaper path: " + CurrentWallpaper + "  " + customWallpaperPath);
+            if(CustomImage == true)
+            {
+                try
+                {
+                    string newPath = customWallpaperPath;
+                    File.Copy(CurrentWallpaper, newPath, true);
+                    CurrentWallpaper = newPath;
+                    SystemSettings.WallpaperHomeScreen = CurrentWallpaper;
+                }
+                catch (Exception ex)
+                {
+                    Tizen.Log.Debug(Resources.LogTag, "Exception: " + ex.Message);
+                }
+            }
+            else
+            {
+                SystemSettings.WallpaperHomeScreen = CurrentWallpaper;
+            }
+            NUIApplication.Current.Exit();
+        }
+
+        private void OnPreviousClicked()
+        {
+            if(startingIndex > 0)
+            {
+                startingIndex--;
+                UpdateWallpaperList();
+            }
+        }
+
+        private void OnNextClicked()
+        {
+            if(startingIndex < totalWallpapers)
+            {
+                startingIndex++;
+                UpdateWallpaperList();
+            }
+        }
+
+        private void OnAlbumSelect()
+        {
+            FolderClicked?.Invoke();
+        }
+
+        private ICommand returnCommand;
+        public ICommand ReturnCommand
+        {
+            get => returnCommand;
+            set => SetProperty(ref returnCommand, value);
+        }
+
+        private ICommand setWallpaperCommand;
+        public ICommand SetWallpaperCommand
+        {
+            get => setWallpaperCommand;
+            set => SetProperty(ref setWallpaperCommand, value);
+        }
+
+        private ICommand albumFolderCommand;
+        public ICommand AlbumFolderCommand
+        {
+            get => albumFolderCommand;
+            set => SetProperty(ref albumFolderCommand, value);
+        }
+
+        private ICommand previousButtonCommand;
+        public ICommand PreviousButtonCommand
+        {
+            get => previousButtonCommand;
+            set => SetProperty(ref previousButtonCommand, value);
+        }
+
+        private ICommand nextButtonCommand;
+        public ICommand NextButtonCommand
+        {
+            get => nextButtonCommand;
+            set => SetProperty(ref nextButtonCommand, value);
+        }
+
+        private bool isPreviousImageAvailable;
+        public bool IsPreviousImageAvailable
+        {
+            get => isPreviousImageAvailable;
+            set => SetProperty(ref isPreviousImageAvailable, value);
+        }
+
+        private bool isNextImageAvailable;
+        public bool IsNextImageAvailable
+        {
+            get => isNextImageAvailable;
+            set => SetProperty(ref isNextImageAvailable, value);
+        }
+
+        private IEnumerable wallpaperListSource;
+        public IEnumerable WallpaperListSource
+        {
+            get => wallpaperListSource;
+            set => SetProperty(ref wallpaperListSource, value);
+        }
+    }
+}
\ No newline at end of file
diff --git a/SettingWallpaper/SettingWallpaper/Views/AlbumDetailView.cs b/SettingWallpaper/SettingWallpaper/Views/AlbumDetailView.cs
new file mode 100644 (file)
index 0000000..2d08e27
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Views
+{
+    class AlbumDetailView : CollectionView
+    {
+        private CustomTitleItem customTitleItem;
+
+        public AlbumDetailView(Window customWindow) : base()
+        {
+            Name = "ImageView";
+            StyleName = "AlbumBackground";
+            CornerRadius = AppCommon.viewCornerRadius;
+            Size2D = new Size2D(customWindow.WindowSize.Width, customWindow.WindowSize.Height);
+            Padding = AppCommon.viewPadding;
+            ItemsLayouter = new GridLayouter();
+            ScrollingDirection = Direction.Vertical;
+            SelectionMode = ItemSelectionMode.Single;
+            customTitleItem = new CustomTitleItem();
+            Header = customTitleItem;
+            UpdateItemTemplate();
+            this.SetBinding(ItemsSourceProperty, "ImageListSource");
+        }
+
+        public void UpdateItemTemplate()
+        {
+            ItemTemplate = new DataTemplate(() =>
+            {
+                ImageItemLayout item = new ImageItemLayout();
+                item.Thumbnail.SetBinding(ImageView.ResourceUrlProperty, "ThumbnailUrl");
+                return item;
+            });
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            Tizen.Log.Debug(Resources.LogTag, "Album detail view disposed: " + Disposed);
+            if (Disposed)
+            {
+                return;
+            }
+            if(type == DisposeTypes.Explicit)
+            {
+                customTitleItem?.Dispose();
+                customTitleItem = null;
+                BindingContext = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Views/AlbumItemLayout.cs b/SettingWallpaper/SettingWallpaper/Views/AlbumItemLayout.cs
new file mode 100644 (file)
index 0000000..2b819c3
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Views
+{
+    class AlbumItemLayout : RecyclerViewItem
+    {
+        private View baseView;
+
+        public AlbumItemLayout()
+        {
+            BackgroundColor = Color.Transparent;
+            WidthSpecification = AppCommon.albumLayoutWidth;
+            HeightSpecification = AppCommon.albumLayoutHeight;
+            Layout = new LinearLayout()
+            {
+                Padding = AppCommon.itemPadding,
+                HorizontalAlignment = HorizontalAlignment.Center,
+                VerticalAlignment = VerticalAlignment.Center,
+                LinearOrientation = LinearLayout.Orientation.Horizontal,
+            };
+            baseView = new View()
+            {
+                StyleName = "AlbumBackground",
+                WidthSpecification = AppCommon.albumBaseViewWidth,
+                HeightSpecification = AppCommon.albumBaseViewHeight,
+                CornerRadius = AppCommon.itemCornerRadius,
+                Layout = new RelativeLayout()
+                {
+                    Padding = AppCommon.albumLayoutBaseViewPadding,
+                }
+            };
+            base.Add(baseView);
+
+            AlbumBackgroundView = new View()
+            {
+                WidthSpecification = AppCommon.albumBackgroundWidth,
+                HeightSpecification = AppCommon.albumBackgroundHeight,
+                Layout = new LinearLayout()
+                {
+                    VerticalAlignment = VerticalAlignment.Top,
+                    HorizontalAlignment = HorizontalAlignment.Center,
+                },
+            };
+            baseView.Add(AlbumBackgroundView);
+            RelativeLayout.SetHorizontalAlignment(AlbumBackgroundView, RelativeLayout.Alignment.Center);
+            RelativeLayout.SetVerticalAlignment(AlbumBackgroundView, RelativeLayout.Alignment.End);
+
+            AlbumIcon = new ImageView()
+            {
+                StyleName = "AlbumIcon",
+            };
+            AlbumBackgroundView.Add(AlbumIcon);
+
+            AlbumLabel = new TextLabel()
+            {
+                StyleName = "ItemText",
+                PixelSize = 16.SpToPx(),
+                HeightSpecification = AppCommon.albumIconTextHeight,
+                WidthSpecification = LayoutParamPolicies.MatchParent,
+                HorizontalAlignment = HorizontalAlignment.Center,
+                VerticalAlignment = VerticalAlignment.Center,
+            };
+
+            baseView.Add(AlbumLabel);
+            RelativeLayout.SetHorizontalAlignment(AlbumLabel, RelativeLayout.Alignment.Center);
+            RelativeLayout.SetVerticalAlignment(AlbumLabel, RelativeLayout.Alignment.End);
+
+            UpdateTheme(ThemeManager.PlatformThemeId);
+            ThemeManager.ThemeChanged += OnThemeUpdated;
+        }
+
+        private void OnThemeUpdated(object sender, ThemeChangedEventArgs e)
+        {
+            if (e.IsPlatformThemeChanged)
+            {
+                UpdateTheme(e.PlatformThemeId);
+            }
+        }
+
+        private void UpdateTheme(string currentPlatformThemeId)
+        {
+            if (currentPlatformThemeId.Equals(Resources.LightPlatformThemeId))
+            {
+                baseView.BoxShadow = AppCommon.itemLightBoxShadow;
+            }
+            else if (currentPlatformThemeId.Equals(Resources.DarkPlatformThemeId))
+            {
+                baseView.BoxShadow = AppCommon.itemDarkBoxShadow;
+            }
+        }
+
+        public TextLabel AlbumLabel { get; internal set; }
+
+        public ImageView AlbumIcon { get; internal set; }
+
+        public View AlbumBackgroundView { get; internal set; }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            Tizen.Log.Info(Resources.LogTag, "AlbumItemLayout disposed: " + Disposed);
+            if (Disposed)
+            {
+                return;
+            }
+            if(type == DisposeTypes.Explicit)
+            {
+                ThemeManager.ThemeChanged -= OnThemeUpdated;
+
+                baseView.Remove(AlbumLabel);
+                AlbumLabel?.Dispose();
+                AlbumLabel = null;
+
+                AlbumBackgroundView.Remove(AlbumIcon);
+                AlbumIcon?.Dispose();
+                AlbumIcon = null;
+
+                baseView.Remove(AlbumBackgroundView);
+                AlbumBackgroundView?.Dispose();
+                AlbumBackgroundView = null;
+
+                Remove(baseView);
+                baseView?.Dispose();
+                baseView = null;
+
+                BindingContext = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Views/AlbumView.cs b/SettingWallpaper/SettingWallpaper/Views/AlbumView.cs
new file mode 100644 (file)
index 0000000..3691513
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Views
+{
+    class AlbumView : CollectionView
+    {
+        private CustomAlbumTitle albumTitleItem;
+
+        public AlbumView(Window customWindow) : base()
+        {
+            Name = "AlbumView";
+            StyleName = "AlbumBackground";
+            ThemeChangeSensitive = true;
+            CornerRadius = AppCommon.viewCornerRadius;
+            Padding = AppCommon.viewPadding;
+            Size2D = new Size2D(customWindow.WindowSize.Width, customWindow.WindowSize.Height);
+            ItemsLayouter = new GridLayouter();
+            ScrollingDirection = Direction.Vertical;
+            SelectionMode = ItemSelectionMode.Single;
+            albumTitleItem = new CustomAlbumTitle();
+            Header = albumTitleItem;
+            UpdateItemTemplate();
+            this.SetBinding(ItemsSourceProperty, "AlbumListSource");
+        }
+
+        public void UpdateItemTemplate()
+        {
+            ItemTemplate = new DataTemplate(() =>
+            {
+                AlbumItemLayout item = new AlbumItemLayout();
+                item.AlbumLabel.SetBinding(TextLabel.TextProperty, "AlbumName");
+                return item;
+            });
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            Tizen.Log.Info(Resources.LogTag, "Album View disposed: " + Disposed);
+            if (Disposed)
+            {
+                return;
+            }
+            if(type == DisposeTypes.Explicit)
+            {
+                albumTitleItem?.Dispose();
+                albumTitleItem = null;
+                BindingContext = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Views/CustomAlbumTitle.cs b/SettingWallpaper/SettingWallpaper/Views/CustomAlbumTitle.cs
new file mode 100644 (file)
index 0000000..5d531fb
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Views
+{
+    class CustomAlbumTitle : RecyclerViewItem
+    {
+        private TextLabel albumTitle;
+
+        public CustomAlbumTitle()
+        {
+            WidthSpecification = LayoutParamPolicies.MatchParent;
+            HeightSpecification = AppCommon.customItemHeight;
+            BackgroundColor = Color.Transparent;
+            Padding = AppCommon.customAlbumTitlePadding;
+            ThemeChangeSensitive = true;
+            Layout = new RelativeLayout()
+            {
+            };
+            albumTitle = new TextLabel()
+            {
+                StyleName = "ItemText",
+                Text = "Albums",
+                PixelSize = 24.SpToPx(),
+                HeightSpecification = AppCommon.albumTitleHeight,
+                BackgroundColor = Color.Transparent,
+            };
+            Add(albumTitle);
+            RelativeLayout.SetFillHorizontal(albumTitle, true);
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            Tizen.Log.Info(Resources.LogTag, "customAlbumTitle disposed: " + Disposed);
+            if (Disposed)
+            {
+                return;
+            }
+            if(type == DisposeTypes.Explicit)
+            {
+                albumTitle?.Dispose();
+                albumTitle = null;
+
+                BindingContext = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Views/CustomTitleItem.cs b/SettingWallpaper/SettingWallpaper/Views/CustomTitleItem.cs
new file mode 100644 (file)
index 0000000..c7ffb7d
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Views
+{
+    class CustomTitleItem : RecyclerViewItem
+    {
+        private TextLabel albumTitle;
+        private Button backButton;
+
+        public CustomTitleItem()
+        {
+            WidthSpecification = LayoutParamPolicies.MatchParent;
+            HeightSpecification = AppCommon.customItemHeight;
+            BackgroundColor = Color.Transparent;
+            ThemeChangeSensitive = true;
+            Layout = new RelativeLayout();
+            backButton = new Button()
+            {
+                StyleName = "BackButton",
+                CornerRadius = AppCommon.itemCornerRadius,
+                Margin = AppCommon.backButtonMargin,
+            };
+            backButton.SetBinding(Control.CommandProperty, "BackButtonCommand");
+
+            albumTitle = new TextLabel()
+            {
+                StyleName = "ItemText",
+                PixelSize = 24.SpToPx(),
+                HeightSpecification = AppCommon.albumTitleHeight,
+                HorizontalAlignment = HorizontalAlignment.Begin,
+                Margin = AppCommon.albumTitleMargin,
+                BackgroundColor = Color.Transparent,
+            };
+            albumTitle.SetBinding(TextLabel.TextProperty, "AlbumName");
+            RelativeLayout.SetLeftTarget(albumTitle, backButton);
+            RelativeLayout.SetLeftRelativeOffset(albumTitle, 1.0f);
+            Add(backButton);
+            Add(albumTitle);
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            Tizen.Log.Info(Resources.LogTag, "customTitleItem disposed :  "+ Disposed);
+            if (Disposed)
+            {
+                return;
+            }
+            if(type == DisposeTypes.Explicit)
+            {
+                BindingContext = null;
+                backButton?.Dispose();
+                backButton = null;
+
+                albumTitle?.Dispose();
+                albumTitle = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
+
diff --git a/SettingWallpaper/SettingWallpaper/Views/ImageItemLayout.cs b/SettingWallpaper/SettingWallpaper/Views/ImageItemLayout.cs
new file mode 100644 (file)
index 0000000..5bebff8
--- /dev/null
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Views
+{
+    class ImageItemLayout : RecyclerViewItem
+    {
+        public ImageItemLayout() : base()
+        {
+            StyleName = "AlbumBackground";
+            WidthSpecification = AppCommon.imageItemWidth;
+            HeightSpecification = AppCommon.imageItemHeight;
+            Padding = AppCommon.itemPadding;
+            Thumbnail = new ImageView()
+            {
+                Size2D = AppCommon.thumbnailSize,
+                CornerRadius = AppCommon.itemCornerRadius,
+            };
+            Add(Thumbnail);
+            UpdateTheme(ThemeManager.PlatformThemeId);
+            ThemeManager.ThemeChanged += OnThemeUpdated;
+        }
+
+        public ImageView Thumbnail { get; internal set; }
+
+        private void OnThemeUpdated(object sender, ThemeChangedEventArgs e)
+        {
+            if (e.IsPlatformThemeChanged)
+            {
+                UpdateTheme(e.PlatformThemeId);
+            }
+        }
+
+        private void UpdateTheme(string currentPlatformThemeId)
+        {
+            if (currentPlatformThemeId.Equals(Resources.LightPlatformThemeId))
+            {
+                Thumbnail.BoxShadow = AppCommon.itemLightBoxShadow;
+            }
+            else if (currentPlatformThemeId.Equals(Resources.DarkPlatformThemeId))
+            {
+                Thumbnail.BoxShadow = AppCommon.itemDarkBoxShadow;
+            }
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            Tizen.Log.Info(Resources.LogTag, "ImageItemLayout disposed: " + Disposed);
+            if (Disposed)
+            {
+                return;
+            }
+            if (type == DisposeTypes.Explicit)
+            {
+                ThemeManager.ThemeChanged -= OnThemeUpdated;
+
+                Thumbnail?.Dispose();
+                Thumbnail = null;
+                BindingContext = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
index 6d93e1a7a6baa319c0cd8c45b03826b3d4060ecf..c83b372da46627aac7d47f76ce1e8477a7017092 100644 (file)
@@ -1,16 +1,33 @@
-using SettingCore;
+/*
+ * Copyright (c) 2023 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;
 using Tizen.Applications;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
 using SettingWallpaper.Common;
+using SettingWallpaper.Core;
 
 namespace SettingWallpaper
 {
     public class MainPage : SettingCore.MainMenuGadget
     {
+        private ViewManager viewManager;
 
         public override Color ProvideIconColor() => new Color(ThemeManager.PlatformThemeId == "org.tizen.default-light-theme" ? "#0075FF" : "#1A85FF");
 
@@ -20,52 +37,38 @@ namespace SettingWallpaper
 
         public MainPage() : base(NUIGadgetType.Normal)
         {
-           Resources.SetPath(GetResourcePath(""));
+           Resources.ResourcePath = GetResourcePath("");
         }
 
-        protected override View OnCreate()
+        public override IEnumerable<View> ProvideMoreActions()
         {
+            var saveButton = viewManager?.GetSaveButton();
+            return new View[] { saveButton };
+        }
 
-            Log.Info(Resources.LogTag, "OnCreate");
+        protected override View OnCreate()
+        {
+            Tizen.Log.Info(Resources.LogTag, "OnCreate");
             base.OnCreate();
-
-            Window.Instance.SetTransparency(true);
-            Window.Instance.BackgroundColor = Color.Transparent;
-
+            Window.Instance.Resized += OnWindowResized;
             View mainView = new View()
             {
-                Layout = new LinearLayout()
-                {
-                    LinearOrientation = LinearLayout.Orientation.Vertical,
-                    HorizontalAlignment = HorizontalAlignment.Center,
-                },
                 WidthSpecification = LayoutParamPolicies.MatchParent,
                 HeightSpecification = LayoutParamPolicies.MatchParent,
             };
-
-            View contentPage = ViewManager.Instance.Initialize();
+            viewManager = new ViewManager();
+            View contentPage = viewManager?.GetWallpaperView();
 
             mainView.Add(contentPage);
             return mainView;
         }
 
-        public override IEnumerable<View> ProvideMoreActions()
+        private void OnWindowResized(object sender, Window.ResizedEventArgs e)
         {
-            var saveButton = new Button()
-            {
-                Text = "Save",
-                IsEnabled = true,
-            };
-            saveButton.Clicked += OnSaveButtonClick;
-
-            return new View[] { saveButton };
+            MainView.Size2D = new Size2D(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height);
+            viewManager?.UpdateWallpaperView();
         }
 
-        private void OnSaveButtonClick(object sender, ClickedEventArgs e)
-        {
-            ViewManager.Instance.SetCurrentWallpaper();
-            NavigateBack();
-        }
         protected override void OnAppControlReceived(AppControlReceivedEventArgs e)
         {
             Log.Info(Resources.LogTag, "OnAppControlReceived");
@@ -89,6 +92,8 @@ namespace SettingWallpaper
         protected override void OnDestroy()
         {
             Log.Info(Resources.LogTag, "OnDestroy");
+            Window.Instance.Resized -= OnWindowResized;
+            viewManager?.Dispose();
             base.OnDestroy();
         }
 
diff --git a/SettingWallpaper/SettingWallpaper/Views/NoAlbumsView.cs b/SettingWallpaper/SettingWallpaper/Views/NoAlbumsView.cs
new file mode 100644 (file)
index 0000000..0098f8e
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2023 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 Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Views
+{
+    class NoAlbumsView : View
+    {
+        private TextLabel albumTitle;
+        private TextLabel noAlbums;
+
+        public NoAlbumsView(Window customWindow)
+        {
+            Name = "NoAlbums view";
+            StyleName = "AlbumBackground";
+            CornerRadius = AppCommon.viewCornerRadius;
+            Padding = AppCommon.viewPadding;
+            Size2D = new Size2D(customWindow.WindowSize.Width, customWindow.WindowSize.Height);
+
+            Layout = new RelativeLayout()
+            {
+            };
+            albumTitle = new TextLabel()
+            {
+                StyleName = "ItemText",
+                Text = "Albums",
+                PixelSize = 24.SpToPx(),
+                HeightSpecification = AppCommon.albumTitleHeight,
+                BackgroundColor = Color.Transparent,
+            };
+            Add(albumTitle);
+            RelativeLayout.SetHorizontalAlignment(albumTitle, RelativeLayout.Alignment.Start);
+            RelativeLayout.SetVerticalAlignment(albumTitle, RelativeLayout.Alignment.Start);
+
+            noAlbums = new TextLabel()
+            {
+                StyleName = "ItemText",
+                Text = "No albums",
+                PixelSize = 24.SpToPx(),
+                HorizontalAlignment = HorizontalAlignment.Center,
+                WidthSpecification = AppCommon.noAlbumsLabelWidth,
+                HeightSpecification = AppCommon.noAlbumsLabelHeight,
+            };
+            Add(noAlbums);
+            RelativeLayout.SetVerticalAlignment(noAlbums, RelativeLayout.Alignment.Center);
+            RelativeLayout.SetHorizontalAlignment(noAlbums, RelativeLayout.Alignment.Center);
+        }
+
+        protected override void Dispose(DisposeTypes type)
+        {
+            Tizen.Log.Info(Resources.LogTag, "NoAlbumsView disposed: " + Disposed);
+            if (Disposed)
+            {
+                return;
+            }
+            if(type == DisposeTypes.Explicit)
+            {
+                albumTitle?.Dispose();
+                albumTitle = null;
+
+                noAlbums?.Dispose();
+                noAlbums = null;
+            }
+            base.Dispose(type);
+        }
+    }
+}
diff --git a/SettingWallpaper/SettingWallpaper/Views/ViewManager.cs b/SettingWallpaper/SettingWallpaper/Views/ViewManager.cs
deleted file mode 100644 (file)
index 6d7a62c..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- *  Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  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.IO;
-using Tizen.NUI;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;
-using Tizen.NUI.Xaml;
-using SettingWallpaper.Common;
-using SettingWallpaper.Views;
-
-namespace SettingWallpaper
-{
-    class ViewManager
-    {
-        public static event EventHandler<EventArgs> ApplicationClosed;
-
-        private static ViewManager instance = null;
-
-        private AppBar appBar;
-        private WallpaperView wallpaperView;
-        private ContentPage contentPage;
-
-        private ViewManager()
-        {
-        }
-
-        public static ViewManager Instance
-        {
-            get
-            {
-                if (instance == null)
-                {
-                    instance = new ViewManager();
-                }
-                return instance;
-            }
-        }
-
-        public View Initialize()
-        {
-            Tizen.Log.Info(Resources.LogTag, "Initializing ViewManager");
-
-            UpdateTheme(ThemeManager.PlatformThemeId);
-            //CreateAppBar();
-            wallpaperView = new WallpaperView();
-            wallpaperView.TouchEvent += (object source, View.TouchEventArgs e) =>
-            {
-                if (e.Touch.GetState(0) == PointStateType.Down)
-                {
-                    wallpaperView.TogglePreview();
-                   // ToggleAppBar();
-                }
-                return true;
-            };
-            wallpaperView.WallpaperChanged += (object source, EventArgs e) =>
-            {
-                contentPage.BackgroundImage = wallpaperView.CurrentWallpaper;
-            };
-            CreateContentPage();
-            ThemeManager.ThemeChanged += OnThemeChanged;
-            Tizen.Log.Info(Resources.LogTag, "Initialization Done");
-
-            return contentPage;
-        }
-
-        public void CleanUp()
-        {
-            Tizen.Log.Error(Resources.LogTag, "Cleaning Resources");
-            ThemeManager.ThemeChanged -= OnThemeChanged;
-            //appBar?.Dispose();
-            wallpaperView?.Dispose();
-            contentPage?.Dispose();
-        }
-
-        public void UpdateViews()
-        {
-            wallpaperView.UpdateView();
-        }
-
-        public ContentPage GetContentPage()
-        {
-            return contentPage;
-        }
-
-        public void SetCurrentWallpaper()
-        {
-            wallpaperView.SetCurrentWallpaper();
-        }
-
-        //private void CreateAppBar()
-        //{
-        //    appBar = new AppBar()
-        //    {
-        //        AutoNavigationContent = false,
-        //        BackgroundColor = Color.Transparent,
-        //        Layout = new RelativeLayout()
-        //        {
-        //            Padding = new Extents(0, 16, 0, 0).SpToPx(),
-        //        },
-        //    };
-
-        //    StringSelector iconUrlSelector = new StringSelector()
-        //    {
-        //        Normal = Resources.GetLightImagePath() + "back.png",
-        //        Pressed = Resources.GetLightImagePath() + "back_pressed.png",
-        //    };
-        //    Button navigationContent = new Button()
-        //    {
-        //        Size2D = new Size2D(48, 48).SpToPx(),
-        //        IconURLSelector = iconUrlSelector,
-        //        BackgroundColor = Color.Transparent,
-        //    };
-        //    navigationContent.Icon.Size2D = new Size2D(48, 48).SpToPx();
-        //    navigationContent.Clicked += (object source, ClickedEventArgs e) =>
-        //    {
-        //        CloseSettingWallpaper();
-        //    };
-        //    appBar.NavigationContent = navigationContent;
-        //    RelativeLayout.SetVerticalAlignment(appBar.NavigationContent, RelativeLayout.Alignment.Center);
-
-        //    TextLabel titleContent = new TextLabel("Wallpaper"/*res.resx.LanguageResources.Title*/)
-        //    {
-        //        StyleName = "PageLabel",
-        //        PixelSize = 24.SpToPx(),
-        //        FontFamily = "BreezeSans",
-        //        VerticalAlignment = VerticalAlignment.Center,
-        //        FontStyle = Resources.FontStyleAllNormal,
-        //        Margin = new Extents(16, 0, 0, 0).SpToPx(),
-        //    };
-        //    appBar.TitleContent = titleContent;
-        //    RelativeLayout.SetLeftTarget(appBar.TitleContent, appBar.NavigationContent);
-        //    RelativeLayout.SetLeftRelativeOffset(appBar.TitleContent, 1.0f);
-        //    RelativeLayout.SetVerticalAlignment(appBar.TitleContent, RelativeLayout.Alignment.Center);
-        //    RelativeLayout.SetFillHorizontal(appBar.TitleContent, true);
-
-        //    Button actionContent = new Button()
-        //    {
-        //        Text = "Save", /*res.resx.LanguageResources.Save,*/
-        //        Size2D = new Size2D(110, 48).SpToPx(),
-        //        PointSize = 12.SpToPx(),
-        //        ThemeChangeSensitive = true,
-        //    };
-        //    actionContent.Clicked += (object sender, ClickedEventArgs e) =>
-        //    {
-        //        SetCurrentWallpaper();
-        //        CloseSettingWallpaper();
-        //    };
-        //    appBar.ActionContent = actionContent;
-        //    RelativeLayout.SetHorizontalAlignment(appBar.ActionContent, RelativeLayout.Alignment.End);
-        //    RelativeLayout.SetVerticalAlignment(appBar.ActionContent, RelativeLayout.Alignment.Center);
-        //}
-
-        //private void ToggleAppBar()
-        //{
-        //    if (appBar.Visibility == false)
-        //    {
-        //        appBar.Show();
-        //    }
-        //    else
-        //    {
-        //        appBar.Hide();
-        //    }
-        //}
-
-        private void CloseSettingWallpaper()
-        {
-           // CleanUp();
-           // ApplicationClosed.Invoke(this, new EventArgs());
-        }
-
-        private void CreateContentPage()
-        {
-            contentPage = new ContentPage()
-            {
-               // AppBar = appBar,
-                Content = wallpaperView,
-                BackgroundImage = wallpaperView.CurrentWallpaper,
-                ThemeChangeSensitive = true,
-            };
-        }
-
-        private void OnThemeChanged(object sender, ThemeChangedEventArgs e)
-        {
-            if (e.IsPlatformThemeChanged)
-            {
-                Tizen.Log.Info(Resources.LogTag, "Theme Changed: " + e.ThemeId);
-                UpdateTheme(e.PlatformThemeId);
-            }
-        }
-
-        private void SetTheme(string path)
-        {
-            try
-            {
-                Theme theme = new Theme(path);
-                ThemeManager.ApplyTheme(theme);
-            }
-            catch (ArgumentNullException e)
-            {
-                Tizen.Log.Error(Resources.LogTag, "ArgumentNullException: " + e.ParamName);
-            }
-            catch (IOException e)
-            {
-                Tizen.Log.Error(Resources.LogTag, "IOException: " + e.Message);
-            }
-            catch (XamlParseException e)
-            {
-                Tizen.Log.Error(Resources.LogTag, "XamlParseException: " + e.Message);
-                if (e.XmlInfo != null)
-                {
-                    Tizen.Log.Error(Resources.LogTag, "XamlParseException, LineNo." + e.XmlInfo.LineNumber + " Pos: " + e.XmlInfo.LinePosition + " HasInfo: " + e.XmlInfo.HasLineInfo().ToString());
-                }
-            }
-        }
-        private void UpdateTheme(string platformThemeId)
-        {
-            if (platformThemeId == null)
-            {
-                Tizen.Log.Error(Resources.LogTag, "Platform theme id is null");
-                return;
-            }
-            if (platformThemeId.Equals(Resources.LightPlatformThemeId))
-            {
-                SetTheme(Resources.GetThemePath() + "light.xaml");
-            }
-            else if (platformThemeId.Equals(Resources.DarkPlatformThemeId))
-            {
-                SetTheme(Resources.GetThemePath() + "dark.xaml");
-            }
-        }
-    }
-}
index 44fb89ced8ef6eaf98cf193e92b9ffcaa6e9de40..5d2e004b1c3516e08320c3451146b602a25f09e2 100644 (file)
-/*
- *  Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
+/*
+ * Copyright (c) 2023 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
+ * 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
+ * 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
+ * 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;
 using System.Collections.Generic;
-using System.IO;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
 using Tizen.NUI.Components;
 using Tizen.System;
 using SettingWallpaper.Common;
 
 namespace SettingWallpaper.Views
 {
-    class WallpaperView : View
+    class WallpaperView : ImageView
     {
-        public event EventHandler<EventArgs> WallpaperChanged;
-
-        private TextLabel centerText;
         private View bottomView;
         private View wallpaperListView;
+
+        private TextLabel centerText;
+
+        private Button albumFolder;
         private Button previousButton;
         private Button nextButton;
-        private Button albumFolder;
-        private List<Button> wallpaperIcons;
-        private int startingIndex;
+
         private int maxWallpapers;
-        private int totalWallpapers;
         private bool previewMode;
-        private const string WallpaperPath = "/opt/usr/data/settings/Wallpapers/";
-
-        public WallpaperView()
-        {
-            WidthSpecification = LayoutParamPolicies.MatchParent;
-            HeightSpecification = LayoutParamPolicies.MatchParent;
-            CurrentWallpaper = SystemSettings.WallpaperHomeScreen;
-            Layout = new RelativeLayout();
-            AddTextLabel();
-            AddBottomView();
-            Tizen.Log.Info(Resources.LogTag, "WallpaperView Created");
-        }
-
-        public string CurrentWallpaper { get; set; }
-
-        public void SetCurrentWallpaper()
-        {
-            Tizen.Log.Info(Resources.LogTag, "SaveButton Clicked.");
-            try
-            {
-                SystemSettings.WallpaperHomeScreen = CurrentWallpaper;
-            }
-            catch (ArgumentException ex)
-            {
-                Tizen.Log.Error(Resources.LogTag, "ArgumentException: " + ex.Message);
-            }
-            catch (NotSupportedException ex)
-            {
-                Tizen.Log.Error(Resources.LogTag, "NotSupportedException: " + ex.Message);
-            }
-            catch (InvalidOperationException ex)
-            {
-                Tizen.Log.Error(Resources.LogTag, "InvalidOperationException: " + ex.Message);
-            }
-            catch (UnauthorizedAccessException ex)
-            {
-                Tizen.Log.Error(Resources.LogTag, "UnauthorizedAccessException Exception: " + ex.Message);
-            }
-            catch
-            {
-                Tizen.Log.Error(Resources.LogTag, "Catch Unknown Exception: ");
-            }
-        }
 
-        public void TogglePreview()
+        public static readonly BindableProperty WallpaperListProperty = BindableProperty.Create(nameof(WallpaperList), typeof(IEnumerable), typeof(WallpaperView), null, propertyChanged: (bindable, oldValue, newValue) =>
         {
-            if (previewMode == false)
+            WallpaperView instance = (WallpaperView)bindable;
+            if(instance == null)
             {
-                HideItems();
+                return;
             }
-            else
+            if (oldValue != newValue)
             {
-                ShowItems();
+                if (oldValue != null)
+                {
+                    ((List<object>)oldValue).Clear();
+                }
+                if (newValue != null)
+                {
+                    instance.wallpaperList = (IEnumerable)newValue;
+                }
+                instance.UpdateWallpaperIcons();
             }
-            previewMode = !previewMode;
-        }
-
-        public void UpdateView()
-        {
-            bottomView.WidthSpecification = (int)(Window.Instance.Size.Width * 0.55f);
-            float wallpaperListViewWidth = bottomView.SizeWidth - (2 * previousButton.SizeWidth) - albumFolder.SizeWidth - 64.SpToPx();
-            maxWallpapers = (int)wallpaperListViewWidth / 130.SpToPx();
-            wallpaperListView.SizeWidth = wallpaperListViewWidth;
-            UpdateWallpapers();
-        }
+        },
+        defaultValueCreator: (bindable) => ((WallpaperView)bindable).wallpaperList);
 
-        private void HideItems()
-        {
-            centerText.Hide();
-            bottomView.Hide();
-        }
-
-        private void ShowItems()
+        public WallpaperView()
         {
-            centerText.Show();
-            bottomView.Show();
+            WidthSpecification = LayoutParamPolicies.MatchParent;
+            HeightSpecification = LayoutParamPolicies.MatchParent;
+            FittingMode = FittingModeType.ScaleToFill;
+            ResourceUrl = SystemSettings.WallpaperHomeScreen;
+            Layout = new RelativeLayout();
+            wallpaperList = new List<object>();
+            AddTextLabel();
+            AddBottomView();
+            ThemeChangeSensitive = true;
         }
 
         private void AddTextLabel()
         {
             centerText = new TextLabel()
             {
-                HeightSpecification = 32.SpToPx(),
+                HeightSpecification = AppCommon.centerTextHeight,
                 HorizontalAlignment = HorizontalAlignment.Center,
                 VerticalAlignment = VerticalAlignment.Center,
-                Text = "Preview", /*res.resx.LanguageResources.Preview,*/
+                Text = "Tap To Preview",
                 TextColor = Color.White,
-                PixelSize = 24.SpToPx(),
+                PixelSize = AppCommon.centerTextPixelSize,
                 FontFamily = "BreezeSans",
             };
             previewMode = false;
@@ -140,14 +96,14 @@ namespace SettingWallpaper.Views
         {
             bottomView = new View()
             {
-                WidthSpecification = (int)(Window.Instance.Size.Width * 0.55f),
-                HeightSpecification = 144.SpToPx(),
-                Margin = new Extents(0, 0, 0, 80).SpToPx(),
-                CornerRadius = new Vector4(12, 12, 12, 12),
-                BackgroundColor = Color.White,
+                StyleName = "AlbumBackground",
+                WidthSpecification = (int)(Window.Instance.Size.Width * AppCommon.bottomViewWidthRatio),
+                HeightSpecification = AppCommon.bottomViewHeight,
+                Margin = AppCommon.bottomViewMargin,
+                CornerRadius = AppCommon.itemCornerRadius,
                 Layout = new LinearLayout()
                 {
-                    CellPadding = new Size2D(16, 0).SpToPx(),
+                    CellPadding = AppCommon.bottomViewItemsCellPadding,
                     LinearOrientation = LinearLayout.Orientation.Horizontal,
                     VerticalAlignment = VerticalAlignment.Center,
                     HorizontalAlignment = HorizontalAlignment.Center,
@@ -163,175 +119,199 @@ namespace SettingWallpaper.Views
 
             AddPreviousButton();
             AddAlbumsFolder();
-            startingIndex = 0;
             AddWallpaperListView();
             AddNextButton();
-            UpdateWallpapers();
+            UpdateWallpaperIcons();
         }
 
         private void AddPreviousButton()
         {
-            StringSelector iconUrlSelector = new StringSelector()
-            {
-                Normal = Resources.GetLightImagePath() + "previous.png",
-                Pressed = Resources.GetLightImagePath() + "previous_pressed.png",
-                Disabled = Resources.GetLightImagePath() + "previous_disabled.png",
-            };
             previousButton = new Button()
             {
-                Size2D = new Size2D(48, 48).SpToPx(),
-                IconURLSelector = iconUrlSelector,
-                BackgroundColor = Color.Transparent,
-                IsEnabled = false,
+                StyleName = "PreviousButton",
             };
-            previousButton.Clicked += OnPreviousButtonClicked;
+            previousButton.SetBinding(IsEnabledProperty, "IsPreviousImageAvailable");
+            previousButton.SetBinding(Control.CommandProperty, "PreviousButtonCommand");
             bottomView.Add(previousButton);
         }
 
-        private void OnPreviousButtonClicked(object sender, ClickedEventArgs e)
-        {
-            if (previousButton.IsEnabled == true)
-            {
-                startingIndex--;
-                UpdateWallpapers();
-            }
-        }
-
         private void AddAlbumsFolder()
         {
             albumFolder = new Button()
             {
-                Size2D = new Size2D(114, 114).SpToPx(),
-                BackgroundImage = Resources.GetLightImagePath() + "background.png",
-                IconURL = Resources.GetLightImagePath() + "folder.png",
+                StyleName = "AlbumFolder",
             };
-
-            albumFolder.Icon.Size2D = new Size2D(114, 114).SpToPx();
-            albumFolder.Clicked += OnAlbumFolderClicked;
+            albumFolder.SetBinding(Control.CommandProperty, "AlbumFolderCommand");
             bottomView.Add(albumFolder);
         }
 
-        private void OnAlbumFolderClicked(object sender, ClickedEventArgs e)
-        {
-            //throw new NotImplementedException();
-        }
-
         private void AddWallpaperListView()
         {
-            float wallpaperListViewWidth = bottomView.SizeWidth - (2 * previousButton.SizeWidth) - albumFolder.SizeWidth - 64.SpToPx();
-            maxWallpapers = (int)wallpaperListViewWidth / 130.SpToPx();
+            float wallpaperListViewWidth = bottomView.SizeWidth - (2 * previousButton.SizeWidth) - albumFolder.SizeWidth - AppCommon.bottomViewPadding;
+            maxWallpapers = (int)wallpaperListViewWidth / AppCommon.wallpaperListViewIconWidth;
             Tizen.Log.Info(Resources.LogTag, "maxWallapers: " + maxWallpapers);
             wallpaperListView = new View()
             {
                 SizeWidth = wallpaperListViewWidth,
-                SizeHeight = 114.SpToPx(),
+                SizeHeight = AppCommon.wallpaperListViewHeight,
                 Layout = new LinearLayout()
                 {
-                    CellPadding = new Size2D(16, 0).SpToPx(),
+                    CellPadding = AppCommon.bottomViewItemsCellPadding,
                     LinearOrientation = LinearLayout.Orientation.Horizontal,
                     VerticalAlignment = VerticalAlignment.Center,
                     HorizontalAlignment = HorizontalAlignment.Begin,
                 }
             };
-            AddWallpaperButtons();
             bottomView.Add(wallpaperListView);
         }
 
-        private void AddWallpaperButtons()
+        private void UpdateWallpaperIcons()
         {
-            wallpaperIcons = new List<Button>();
-            totalWallpapers = 0;
-            DirectoryInfo wallPaperDirectory = new DirectoryInfo(WallpaperPath);
-            foreach (FileInfo fi in wallPaperDirectory.GetFiles())
+            if(wallpaperListView == null)
+            {
+                return;
+            }
+            uint wallpaperCount = wallpaperListView.ChildCount;
+            Tizen.Log.Info(Resources.LogTag, "wallpaper count: "+ wallpaperCount);
+
+            uint index = 0;
+            foreach (var item in wallpaperList)
             {
-                Tizen.Log.Info(Resources.LogTag, "Image: " + fi.Name);
-                Button wallpaper = new Button()
+                if(index < wallpaperCount)
                 {
-                    ThemeChangeSensitive = true,
-                    WidthSpecification = 114.SpToPx(),
-                    HeightSpecification = 114.SpToPx(),
-                    CornerRadius = new Vector4(12, 12, 12, 12),
-                    BackgroundColor = Color.Transparent,
-                    BackgroundImage = WallpaperPath + fi.Name
-                };
-                wallpaper.Clicked += (object sender, ClickedEventArgs e) =>
+                    View wallpaper = wallpaperListView.GetChildAt(index);
+                    wallpaper.BindingContext = item;
+                }
+                else
                 {
-                    CurrentWallpaper = wallpaper.BackgroundImage;
-                    WallpaperChanged.Invoke(this, new EventArgs());
-                };
-                totalWallpapers++;
-                wallpaper.Hide();
-                wallpaperIcons.Add(wallpaper);
+                    Button wallpaper = CreateNewButton();
+                    wallpaperListView.Add(wallpaper);
+                    Tizen.Log.Info(Resources.LogTag, "Buttons Added");
+
+                    wallpaper.BindingContext = item;
+                    wallpaper.SetBinding(BackgroundImageProperty, "ThumbnailUrl");
+                    wallpaper.SetBinding(Control.CommandProperty, "WallpaperSelectCommand");
+                }
+                index++;
             }
-        }
 
-        private void UpdateWallpapers()
-        {
-            while (wallpaperListView.ChildCount != 0)
+            uint newCount = index;
+            while(index < wallpaperCount)
             {
-                Button wallpaper = (Button)wallpaperListView.GetChildAt(0);
-                wallpaper.Hide();
+                View wallpaper = wallpaperListView.GetChildAt(newCount);
                 wallpaperListView.Remove(wallpaper);
+                wallpaper?.Dispose();
+                index++;
             }
-            Tizen.Log.Info(Resources.LogTag, "wallpapers count " + wallpaperIcons.Count);
-            for (int i = 0; i < maxWallpapers; i++)
-            {
-                if (i + startingIndex >= totalWallpapers)
-                {
-                    break;
-                }
-                Button wallpaper = wallpaperIcons[i + startingIndex];
-                wallpaperListView.Add(wallpaper);
-                wallpaper.Show();
-            }
-            Tizen.Log.Info(Resources.LogTag, "new wallpapers Added ");
-            previousButton.IsEnabled = startingIndex != 0;
-            nextButton.IsEnabled = startingIndex + maxWallpapers < totalWallpapers;
         }
 
-        private void AddNextButton()
+        public Button CreateNewButton()
         {
-            StringSelector iconUrlSelector = new StringSelector()
+            Button wallpaper = new Button()
             {
-                Normal = Resources.GetLightImagePath() + "next.png",
-                Pressed = Resources.GetLightImagePath() + "next_pressed.png",
-                Disabled = Resources.GetLightImagePath() + "next_disabled.png",
+                ThemeChangeSensitive = true,
+                Size2D = AppCommon.thumbnailSize,
+                CornerRadius = AppCommon.itemCornerRadius,
+                BackgroundColor = Color.Transparent,
             };
+            return wallpaper;
+        }
+
+        private void AddNextButton()
+        {
             nextButton = new Button()
             {
-                Size2D = new Size2D(48, 48).SpToPx(),
-                BackgroundColor = Color.Transparent,
-                IconURLSelector = iconUrlSelector,
+                StyleName = "NextButton",
             };
-            if (startingIndex + maxWallpapers >= totalWallpapers)
-            {
-                nextButton.IsEnabled = false;
-            }
-            nextButton.Clicked += OnNextButtonClicked;
+            nextButton.SetBinding(IsEnabledProperty, "IsNextImageAvailable");
+            nextButton.SetBinding(Control.CommandProperty, "NextButtonCommand");
             bottomView.Add(nextButton);
         }
 
-        private void OnNextButtonClicked(object sender, ClickedEventArgs e)
+        public void UpdateView()
+        {
+            bottomView.SizeWidth = (int)(Window.Instance.Size.Width * AppCommon.bottomViewWidthRatio);
+            Tizen.Log.Debug(Resources.LogTag, "bottom view width: " + bottomView.WidthSpecification);
+            wallpaperListView.SizeWidth = bottomView.SizeWidth - (2 * previousButton.SizeWidth) - albumFolder.SizeWidth - AppCommon.bottomViewPadding;
+        }
+
+        public void TogglePreview()
         {
-            if (nextButton.IsEnabled == true)
+            if (previewMode == false)
             {
-                startingIndex++;
-                UpdateWallpapers();
+                HideItems();
             }
+            else
+            {
+                ShowItems();
+            }
+            previewMode = !previewMode;
+        }
+
+        private void HideItems()
+        {
+            centerText.Hide();
+            bottomView.Hide();
+        }
+
+        private void ShowItems()
+        {
+            centerText.Show();
+            bottomView.Show();
+        }
+
+        private IEnumerable wallpaperList;
+        public IEnumerable WallpaperList
+        {
+            get => (IEnumerable)GetValue(WallpaperListProperty);
+            set => SetValue(WallpaperListProperty, value);
         }
 
         protected override void Dispose(DisposeTypes type)
         {
+            Tizen.Log.Info(Resources.LogTag, "Disposing Wallpaper view");
             if (Disposed)
             {
                 return;
             }
-            if (type == DisposeTypes.Explicit)
+            if(type == DisposeTypes.Explicit)
             {
+                Remove(centerText);
+                centerText?.Dispose();
+                centerText = null;
+
+                bottomView?.Remove(previousButton);
+                previousButton?.Dispose();
+                previousButton = null;
+
+                bottomView?.Remove(nextButton);
+                nextButton?.Dispose();
+                nextButton = null;
+
+                bottomView?.Remove(albumFolder);
+                albumFolder?.Dispose();
+                albumFolder = null;
+
+                if (wallpaperListView != null)
+                {
+                    while (wallpaperListView.ChildCount != 0)
+                    {
+                        View wallpaper = wallpaperListView.GetChildAt(0);
+                        wallpaperListView?.Remove(wallpaper);
+                        wallpaper?.Dispose();
+                    }
+                }
+
+                bottomView?.Remove(wallpaperListView);
+                wallpaperListView?.Dispose();
+                wallpaperListView = null;
 
+                Remove(bottomView);
+                bottomView?.Dispose();
+                bottomView = null;
+                BindingContext = null;
             }
-            Tizen.Log.Info(Resources.LogTag, "WallpaperView Dispose");
             base.Dispose(type);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/GalleryIcon.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/GalleryIcon.png
new file mode 100644 (file)
index 0000000..50316e5
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/GalleryIcon.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/close.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/close.png
new file mode 100644 (file)
index 0000000..c49e480
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/close.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/Folder_normal_dark.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/Folder_normal_dark.png
new file mode 100644 (file)
index 0000000..585820b
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/Folder_normal_dark.png differ
index 27008bed22dcc5fe8b655504120556168ca3ba68..545644e8c971fcb1770d977d4a98d7955d578e6d 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next.png differ
index c7b02213fd665fd8a783490a1f1086f5efebecc8..7d1f84964713cecbd7a04c97f2c363779c9129a5 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_disabled.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_disabled.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_focus.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_focus.png
new file mode 100644 (file)
index 0000000..faf8483
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_focus.png differ
index 07531afd18cab4b914039e3e187172311ee84e7a..24cd3e89989b4d3e7afc902645e20501e0cca515 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_pressed.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_pressed.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_selected.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_selected.png
new file mode 100644 (file)
index 0000000..fd48fc4
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/next_selected.png differ
index 5cfd9e3a6382b07ed8d0faafa76ddda81c0ef188..394fbe5de9325d9b531714b49424f803e72b52d2 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous.png differ
index 177d0bf180dcbb645f480ddcd226567bb3e61e6f..4677bf2c6cbd6539cf7fd2935e4973c60f0552a4 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_disabled.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_disabled.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_focus.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_focus.png
new file mode 100644 (file)
index 0000000..6959def
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_focus.png differ
index f4e516e7d762b6e5578498d1338032393c5c6ba9..3a7f130b7b3a4a690ec230fe54c1df3c0b05d061 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_pressed.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_pressed.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_selected.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_selected.png
new file mode 100644 (file)
index 0000000..2bf6f97
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/previous_selected.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/save.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/save.png
new file mode 100644 (file)
index 0000000..346efb3
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/dark/save.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/leftCorner.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/leftCorner.png
new file mode 100644 (file)
index 0000000..6f82440
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/leftCorner.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/Folder_normal_light.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/Folder_normal_light.png
new file mode 100644 (file)
index 0000000..9006e0a
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/Folder_normal_light.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/next_focus.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/next_focus.png
new file mode 100644 (file)
index 0000000..7687695
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/next_focus.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/next_selected.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/next_selected.png
new file mode 100644 (file)
index 0000000..6207f31
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/next_selected.png differ
index ea9d973f7ec125b00efaee3118ea702eb9feab14..4313e607357b00d4e48b938f469f61de3caebeef 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous.png differ
index d08e3173374cdafa109cfda13776e43bebe9b3dd..69b31b3b1fa5c35bf89a447585abbc8c1935243c 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_disabled.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_disabled.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_focus.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_focus.png
new file mode 100644 (file)
index 0000000..f0134f2
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_focus.png differ
index 5d9a7de2318fbf9572ceffa09c24fdb03e30871c..76876953406a9f629ef56af762820d2ed19ba750 100644 (file)
Binary files a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_pressed.png and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_pressed.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_selected.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_selected.png
new file mode 100644 (file)
index 0000000..661a4d0
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/previous_selected.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/save.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/save.png
new file mode 100644 (file)
index 0000000..6200f13
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/light/save.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/maximalize.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/maximalize.png
new file mode 100644 (file)
index 0000000..c5cbbaf
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/maximalize.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/minimalize.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/minimalize.png
new file mode 100644 (file)
index 0000000..6b116b2
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/minimalize.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/rightCorner.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/rightCorner.png
new file mode 100644 (file)
index 0000000..68d837f
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/rightCorner.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/smallwindow.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/smallwindow.png
new file mode 100644 (file)
index 0000000..8f4263b
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/smallwindow.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/tizen.png b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/tizen.png
new file mode 100644 (file)
index 0000000..9765b1b
Binary files /dev/null and b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/images/tizen.png differ
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/themes/dark.xaml b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/themes/dark.xaml
new file mode 100644 (file)
index 0000000..a5b42e0
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Theme
+xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+Id="DarkTheme">
+
+    <ViewStyle x:Key="AlbumBackground" BackgroundColor="#16131A" ThemeChangeSensitive="True"/>
+
+    <c:DefaultTitleItemStyle x:Key="Header" ThemeChangeSensitive="True" >
+        <c:DefaultTitleItemStyle.Label>
+            <TextLabelStyle PixelSize ="24sp" TextColor ="#FDFDFD" />
+        </c:DefaultTitleItemStyle.Label>
+    </c:DefaultTitleItemStyle>
+    <TextLabelStyle x:Key="ItemText" TextColor="#FDFDFD" FontFamily="BreezeSans" VerticalAlignment="Center" ThemeChangeSensitive="True"/>
+
+    <c:ButtonStyle x:Key="BackButton" Size="48sp, 48sp" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent" ThemeChangeSensitive="True">
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="48sp, 48sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/dark/back.png" Pressed="*Resource*/mount/allowed/SettingWallpaper/images/dark/back_pressed.png" />
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="PreviousButton" Size="48sp, 48sp" BackgroundColor="Transparent" ThemeChangeSensitive="True">
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="48sp, 48sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/dark/previous.png" Pressed="*Resource*/mount/allowed/SettingWallpaper/images/dark/previous_pressed.png" Disabled="*Resource*/mount/allowed/SettingWallpaper/images/dark/previous_disabled.png"/>
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="NextButton" Size="48sp, 48sp" BackgroundColor="Transparent" ThemeChangeSensitive="True">
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="48sp, 48sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/dark/next.png" Pressed="*Resource*/mount/allowed/SettingWallpaper/images/dark/next_pressed.png" Disabled="*Resource*/mount/allowed/SettingWallpaper/images/dark/next_disabled.png"/>
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <ImageViewStyle x:Key="AlbumIcon" Size="80sp, 80sp">
+        <ImageViewStyle.ResourceUrl>
+            <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/dark/Folder_normal_dark.png"/>
+        </ImageViewStyle.ResourceUrl>
+    </ImageViewStyle>
+
+    <c:ButtonStyle x:Key="AlbumFolder" Size="114sp, 114sp" IsSelectable="false" IsEnabled="true" ThemeChangeSensitive="True" BackgroundImage="*Resource*/mount/allowed/SettingWallpaper/images/dark/background.png">
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="80sp, 80sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/dark/Folder_normal_dark.png"/>
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+</Theme>
\ No newline at end of file
diff --git a/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/themes/light.xaml b/SettingWallpaper/SettingWallpaper/res/allowed/SettingWallpaper/themes/light.xaml
new file mode 100644 (file)
index 0000000..3fc172b
--- /dev/null
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Theme
+xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+xmlns:c="clr-namespace:Tizen.NUI.Components;assembly=Tizen.NUI.Components"
+Id="LightTheme">
+
+    <ViewStyle x:Key="AlbumBackground" BackgroundColor="#FAFAFA" ThemeChangeSensitive="True"/>
+
+    <c:DefaultTitleItemStyle x:Key="Header" ThemeChangeSensitive="True">
+        <c:DefaultTitleItemStyle.Label>
+            <TextLabelStyle PixelSize ="24sp" TextColor ="#090E21" />
+        </c:DefaultTitleItemStyle.Label>
+    </c:DefaultTitleItemStyle>
+
+    <TextLabelStyle x:Key="ItemText" TextColor="#090E21" FontFamily="BreezeSans"  VerticalAlignment="Center" ThemeChangeSensitive="True"/>
+
+    <c:ButtonStyle x:Key="BackButton" Size="48sp, 48sp" BackgroundColor="Transparent" ThemeChangeSensitive="True">
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="48sp, 48sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/light/back.png" Pressed="*Resource*/mount/allowed/SettingWallpaper/images/light/back_pressed.png" />
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="PreviousButton" Size="48sp, 48sp" BackgroundColor="Transparent" ThemeChangeSensitive="True">
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="48sp, 48sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/light/previous.png" Pressed="*Resource*/mount/allowed/SettingWallpaper/images/light/previous_pressed.png" Disabled="*Resource*/mount/allowed/SettingWallpaper/images/light/previous_disabled.png"/>
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <c:ButtonStyle x:Key="NextButton" Size="48sp, 48sp" BackgroundColor="Transparent" ThemeChangeSensitive="True">
+        <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="48sp, 48sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/light/next.png" Pressed="*Resource*/mount/allowed/SettingWallpaper/images/light/next_pressed.png" Disabled="*Resource*/mount/allowed/SettingWallpaper/images/light/next_disabled.png"/>
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+
+    <ImageViewStyle x:Key="AlbumIcon" Size="80sp, 80sp">
+        <ImageViewStyle.ResourceUrl>
+            <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/light/Folder_normal_light.png"/>
+        </ImageViewStyle.ResourceUrl>
+    </ImageViewStyle>
+
+    <c:ButtonStyle x:Key="AlbumFolder" Size="114sp, 114sp" IsSelectable="false" IsEnabled="true" ThemeChangeSensitive="True" BackgroundImage="*Resource*/mount/allowed/SettingWallpaper/images/light/background.png">
+       <c:ButtonStyle.Icon>
+            <ImageViewStyle Size="80sp, 80sp">
+                <ImageViewStyle.ResourceUrl>
+                    <Selector x:TypeArguments="x:String" Normal="*Resource*/mount/allowed/SettingWallpaper/images/light/Folder_normal_light.png"/>
+                </ImageViewStyle.ResourceUrl>
+            </ImageViewStyle>
+        </c:ButtonStyle.Icon>
+    </c:ButtonStyle>
+</Theme>
\ No newline at end of file
index c30f3d8e0eece1c1da3d327dc9e469eeff787a22..7332f70d2327c5c98c08948e288aea2b92389362 100644 (file)
@@ -1,3 +1,3 @@
 <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
-<path d="M22.536 10.6779H22.028V10.5629C22.0272 10.1495 21.8626 9.75329 21.5702 9.46106C21.2777 9.16883 20.8814 9.00443 20.468 9.00391H9.56C9.1466 9.00443 8.75027 9.16883 8.45786 9.46106C8.16544 9.75329 8.00079 10.1495 8 10.5629V11.9499C8.00079 12.3633 8.16544 12.7595 8.45786 13.0518C8.75027 13.344 9.1466 13.5084 9.56 13.5089H20.468C20.8814 13.5084 21.2777 13.344 21.5702 13.0518C21.8626 12.7595 22.0272 12.3633 22.028 11.9499V11.8339H22.536C22.6238 11.8401 22.7055 11.8806 22.7635 11.9467C22.8216 12.0128 22.8512 12.0991 22.846 12.1869V13.6999C22.8481 13.7731 22.8274 13.8452 22.7867 13.9061C22.7461 13.967 22.6875 14.0138 22.619 14.0399L16.253 16.0809C15.9515 16.1809 15.6894 16.374 15.5047 16.6324C15.32 16.8908 15.222 17.2012 15.225 17.5189V18.1279C15.1701 18.1381 15.1204 18.1668 15.084 18.2092C15.0476 18.2516 15.0268 18.3051 15.025 18.3609V18.5539C14.9298 18.6061 14.8503 18.6828 14.7946 18.7759C14.7389 18.8691 14.709 18.9754 14.708 19.0839V21.9069C14.7285 22.1838 14.853 22.4428 15.0565 22.6317C15.2599 22.8207 15.5273 22.9257 15.805 22.9257C16.0827 22.9257 16.3501 22.8207 16.5536 22.6317C16.757 22.4428 16.8815 22.1838 16.902 21.9069V19.0989C16.9016 18.977 16.8662 18.8577 16.7999 18.7554C16.7335 18.6531 16.6392 18.572 16.528 18.5219V18.3629C16.526 18.3177 16.5111 18.2739 16.4851 18.2369C16.459 18.1999 16.4229 18.1711 16.381 18.1539V17.5209C16.3787 17.4478 16.3992 17.3757 16.4397 17.3148C16.4802 17.2539 16.5387 17.2071 16.607 17.1809L22.973 15.1409C23.2749 15.0411 23.5373 14.8479 23.7222 14.5892C23.9072 14.3306 24.0052 14.0199 24.002 13.7019V12.1889C24.0051 11.9934 23.9695 11.7992 23.8975 11.6175C23.8254 11.4357 23.7183 11.2699 23.5822 11.1296C23.446 10.9893 23.2835 10.8772 23.104 10.7997C22.9245 10.7221 22.7315 10.6808 22.536 10.6779ZM20.874 11.9479C20.8738 12.0555 20.8309 12.1586 20.7548 12.2347C20.6787 12.3108 20.5756 12.3536 20.468 12.3539H9.56C9.4524 12.3536 9.34931 12.3108 9.27322 12.2347C9.19714 12.1586 9.15429 12.0555 9.15402 11.9479V10.5629C9.15455 10.4554 9.19747 10.3524 9.2735 10.2764C9.34952 10.2004 9.45248 10.1574 9.56 10.1569H20.468C20.5755 10.1574 20.6785 10.2004 20.7545 10.2764C20.8305 10.3524 20.8735 10.4554 20.874 10.5629V11.9479Z" fill="#16131A"/>
+<path d="M22.536 10.6834H22.028V10.5678C22.0272 10.152 21.8626 9.75359 21.5702 9.45972C21.2777 9.16585 20.8814 9.00053 20.468 9H9.56C9.1466 9.00053 8.75027 9.16585 8.45786 9.45972C8.16544 9.75359 8.00079 10.152 8 10.5678V11.9625C8.00079 12.3783 8.16544 12.7767 8.45786 13.0706C8.75027 13.3645 9.1466 13.5298 9.56 13.5303H20.468C20.8814 13.5298 21.2777 13.3645 21.5702 13.0706C21.8626 12.7767 22.0272 12.3783 22.028 11.9625V11.8459H22.536C22.6238 11.8521 22.7055 11.8929 22.7635 11.9593C22.8216 12.0258 22.8512 12.1126 22.846 12.2009V13.7224C22.8481 13.796 22.8274 13.8685 22.7867 13.9297C22.7461 13.991 22.6875 14.038 22.619 14.0643L16.253 16.1168C15.9515 16.2173 15.6894 16.4115 15.5047 16.6713C15.32 16.9312 15.222 17.2434 15.225 17.5628V18.1752C15.1701 18.1855 15.1204 18.2144 15.084 18.257C15.0476 18.2996 15.0268 18.3534 15.025 18.4096V18.6036C14.9298 18.6562 14.8503 18.7332 14.7946 18.8269C14.7389 18.9206 14.709 19.0275 14.708 19.1366V21.9755C14.7285 22.2539 14.853 22.5143 15.0565 22.7044C15.2599 22.8944 15.5273 23 15.805 23C16.0827 23 16.3501 22.8944 16.5536 22.7044C16.757 22.5143 16.8815 22.2539 16.902 21.9755V19.1517C16.9016 19.0291 16.8662 18.9092 16.7999 18.8063C16.7335 18.7034 16.6392 18.6219 16.528 18.5715V18.4116C16.526 18.3661 16.5111 18.3221 16.4851 18.2849C16.459 18.2476 16.4229 18.2186 16.381 18.2014V17.5648C16.3787 17.4913 16.3992 17.4188 16.4397 17.3576C16.4802 17.2963 16.5387 17.2492 16.607 17.2229L22.973 15.1715C23.2749 15.0711 23.5373 14.8768 23.7222 14.6167C23.9072 14.3566 24.0052 14.0441 24.002 13.7244V12.2029C24.0051 12.0063 23.9695 11.811 23.8975 11.6282C23.8254 11.4455 23.7183 11.2787 23.5822 11.1376C23.446 10.9965 23.2835 10.8838 23.104 10.8058C22.9245 10.7279 22.7315 10.6863 22.536 10.6834ZM20.874 11.9605C20.8738 12.0687 20.8309 12.1724 20.7548 12.2489C20.6787 12.3255 20.5756 12.3686 20.468 12.3688H9.56C9.4524 12.3686 9.34931 12.3255 9.27322 12.2489C9.19714 12.1724 9.15429 12.0687 9.15402 11.9605V10.5678C9.15455 10.4596 9.19747 10.3561 9.2735 10.2797C9.34952 10.2032 9.45248 10.16 9.56 10.1595H20.468C20.5755 10.16 20.6785 10.2032 20.7545 10.2797C20.8305 10.3561 20.8735 10.4596 20.874 10.5678V11.9605Z" fill="#FAFAFA"/>
 </svg>
index cf77946b3ec1afd7e02d67c62dc2a148b97f651a..3541fcbb03865a6f1ce115d3d197ec01c5ef0683 100644 (file)
@@ -2,10 +2,10 @@
 <manifest xmlns="http://tizen.org/ns/packages" api-version="7.0"
   package="org.tizen.cssetting-wallpaper" version="1.0.0"
   res-type="org.tizen.appfw.gadget.setting-wallpaper" res-version="1.5.0">
-  <allowed-package id="org.tizen.*">
-    <required-privileges>
-     <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
-    </required-privileges>
-  </allowed-package>/>
-  <metadata key="http://tizen.org/metadata/ui-gadget/dll" value="SettingWallpaper.dll" />
-</manifest>
+    <allowed-package id="org.tizen.*">
+        <required-privileges>
+            <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
+        </required-privileges>
+    </allowed-package>/>
+    <metadata key="http://tizen.org/metadata/ui-gadget/dll" value="SettingWallpaper.dll" />
+</manifest>
\ No newline at end of file
index e9dd6d13548717af9e1d5fe4a37e6a2be82c9462..54a0df86d91b5edc96d493c0a416c97a5282c9a1 100644 (file)
Binary files a/packaging/org.tizen.cssetting-wallpaper-1.0.0.rpk and b/packaging/org.tizen.cssetting-wallpaper-1.0.0.rpk differ