--- /dev/null
+Settings/.vs/
+Settings/SettingView/bin/
+Settings/SettingView/obj/
+Settings/SettingView/SettingView.csproj.user
+Settings/SettingWallpaper/bin/
+Settings/SettingWallpaper/obj/
+Settings/SettingWallpaper/SettingWallpaper.csproj.user
--- /dev/null
+Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
--- /dev/null
+Copyright (c) 2022 Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
\ No newline at end of file
--- /dev/null
+using Tizen.Applications;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+
+namespace SettingView
+{
+ public class Program : NUIApplication
+ {
+ private WidgetView widgetView;
+ public Program() : base(ThemeOptions.PlatformThemeEnabled)
+ {
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+ Window window = Window.Instance;
+ window.KeyEvent += OnKeyEvent;
+
+ Bundle bundle = new Bundle();
+ bundle.AddItem("COUNT", "1");
+ string encodedBundle = bundle.Encode();
+
+ widgetView = WidgetViewManager.Instance.AddWidget("wallpaper@org.tizen.cssetting-wallpaper", encodedBundle, window.Size.Width, window.Size.Height, 0.0f);
+ widgetView.Position = new Position(0, 0);
+ widgetView.WidgetContentUpdated += OnWidgetContentUpdated;
+ window.GetDefaultLayer().Add(widgetView);
+ }
+
+ private void OnWidgetContentUpdated(object sender, WidgetView.WidgetViewEventArgs e)
+ {
+ string encodedBundle = e.WidgetView.ContentInfo;
+ Bundle bundle = Bundle.Decode(encodedBundle);
+ if(bundle.TryGetItem("WIDGET_ACTION", out string widgetAction))
+ {
+ if(widgetAction.Equals("POP"))
+ {
+ GetDefaultWindow().GetDefaultNavigator().Pop();
+ Exit();
+ }
+ }
+ }
+
+ public void OnKeyEvent(object sender, Window.KeyEventArgs e)
+ {
+ if (e.Key.State == Key.StateType.Down && (e.Key.KeyPressedName == "XF86Back" || e.Key.KeyPressedName == "Escape"))
+ {
+ Exit();
+ }
+ }
+ static void Main(string[] args)
+ {
+ var app = new Program();
+ app.Run(args);
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen10.0</TargetFramework>
+ <LangVersion>8.0</LangVersion>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <EmbeddedResource Include="*.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="10.0.0.17432" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.1.8" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Folder Include="res\theme\" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="7" package="org.tizen.SettingView" version="1.0.0">
+ <profile name="common" />
+ <ui-application appid="org.tizen.SettingView" exec="SettingView.dll" type="dotnet" multiple="false" taskmanage="true" nodisplay="false" launch_mode="single">
+ <icon>SettingView.png</icon>
+ <label>SettingView</label>
+ <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
+ </ui-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/datasharing</privilege>
+ <privilege>http://tizen.org/privilege/widget.viewer</privilege>
+ </privileges>
+</manifest>
--- /dev/null
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.32228.343
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingView", "SettingView\SettingView.csproj", "{899E27F2-5344-47F1-9547-8868E5B997BD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SettingWallpaper", "SettingWallpaper\SettingWallpaper.csproj", "{8F70E0B5-87EA-4FD1-B714-6E41F123F5FD}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {899E27F2-5344-47F1-9547-8868E5B997BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {899E27F2-5344-47F1-9547-8868E5B997BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {899E27F2-5344-47F1-9547-8868E5B997BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {899E27F2-5344-47F1-9547-8868E5B997BD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8F70E0B5-87EA-4FD1-B714-6E41F123F5FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8F70E0B5-87EA-4FD1-B714-6E41F123F5FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8F70E0B5-87EA-4FD1-B714-6E41F123F5FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8F70E0B5-87EA-4FD1-B714-6E41F123F5FD}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {008F24DB-DAFE-4CF0-B19D-62C667BEB247}
+ EndGlobalSection
+EndGlobal
--- /dev/null
+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;
+ }
+}
--- /dev/null
+using Tizen.NUI;
+
+namespace SettingWallpaper.Common
+{
+ class Resources
+ {
+ 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 GetThemePath()
+ {
+ return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "themes/";
+ }
+ public static string GetImagePath()
+ {
+ return Tizen.Applications.Application.Current.DirectoryInfo.Resource + "images/";
+ }
+
+ public static string GetLightImagePath()
+ {
+ return GetImagePath() + "light/";
+ }
+
+ public static string GetDarkImagePath()
+ {
+ return GetImagePath() + "dark/";
+ }
+
+ public static string GetCurrentThemePath()
+ {
+ return (ThemeManager.PlatformThemeId == LightPlatformThemeId) ? GetLightImagePath() : GetDarkImagePath();
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI;
+
+namespace SettingWallpaper
+{
+ public class Program : NUIWidgetApplication
+ {
+ public Program(Dictionary<Type, string> widgetSet) : base(widgetSet)
+ {
+
+ }
+
+ protected override void OnCreate()
+ {
+ base.OnCreate();
+ }
+
+ static void Main(string[] args)
+ {
+ Dictionary<Type, string> widgetSet = new Dictionary<Type, string>();
+ widgetSet.Add(typeof(SettingWidgetWallpaper), "wallpaper@org.tizen.cssetting-wallpaper");
+ var app = new Program(widgetSet);
+ app.Run(args);
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>tizen10.0</TargetFramework>
+ <LangVersion>8.0</LangVersion>
+ <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+ </PropertyGroup>
+
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugType>portable</DebugType>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>None</DebugType>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <EmbeddedResource Include="*.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+
+ <ItemGroup>
+ <None Remove="res\themes\dark.xaml" />
+ <None Remove="res\themes\light.xaml" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <EmbeddedResource Include="res\themes\dark.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="res\themes\light.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ </ItemGroup>
+
+ <ItemGroup>
+ <PackageReference Include="Tizen.NET" Version="10.0.0.17432" />
+ <PackageReference Include="Tizen.NET.Sdk" Version="1.1.8" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <Folder Include="res\images\light\" />
+ <Folder Include="res\images\dark\" />
+ </ItemGroup>
+
+</Project>
--- /dev/null
+using Tizen.Applications;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+
+namespace SettingWallpaper
+{
+ class SettingWidgetWallpaper : Widget
+ {
+ private static Navigator navigator;
+ protected override void OnCreate(string contentInfo, Window window)
+ {
+ Bundle bundle = Bundle.Decode(contentInfo);
+ navigator = window.GetDefaultNavigator();
+
+ ViewManager.Instance.Initialize();
+ ViewManager.ApplicationClosed += (object sender, System.EventArgs e) =>
+ {
+ Bundle nextBundle = new Bundle();
+ nextBundle.AddItem("WIDGET_ACTION", "POP");
+ string encodedBundle = nextBundle.Encode();
+ SetContentInfo(encodedBundle);
+ };
+ navigator.Push(ViewManager.Instance.GetContentPage());
+ }
+
+ protected override void OnPause()
+ {
+ base.OnPause();
+ }
+
+ protected override void OnResume()
+ {
+ base.OnResume();
+ }
+
+ protected override void OnResize(Window window)
+ {
+ base.OnResize(window);
+ }
+
+ protected override void OnUpdate(string contentInfo, int force)
+ {
+ base.OnUpdate(contentInfo, force);
+ }
+
+ protected override void OnTerminate(string contentInfo, TerminationType type)
+ {
+ base.OnTerminate(contentInfo, type);
+ }
+ }
+}
--- /dev/null
+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 void Initialize()
+ {
+ 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;
+ }
+
+ public void CleanUp()
+ {
+ ThemeManager.ThemeChanged -= OnThemeChanged;
+ appBar?.Dispose();
+ wallpaperView?.Dispose();
+ contentPage?.Dispose();
+ }
+
+ public ContentPage GetContentPage()
+ {
+ return contentPage;
+ }
+
+ public void SetCurrentWallpaper()
+ {
+ wallpaperView.SetCurrentWallpaper();
+ }
+
+ private void CreateAppBar()
+ {
+ appBar = new AppBar()
+ {
+ AutoNavigationContent = false,
+ BackgroundColor = Color.Transparent,
+ };
+
+ AppBarStyle appBarStyle = (AppBarStyle)ThemeManager.GetStyle("Tizen.NUI.Components.AppBar");
+ Button navigationContent = new Button(appBarStyle.BackButton);
+ navigationContent.Clicked += (object source, ClickedEventArgs e) =>
+ {
+ CloseSettingWallpaper();
+ };
+ appBar.NavigationContent = navigationContent;
+
+ Button actionContent = new Button()
+ {
+ Text = "Save",
+ Size2D = new Size2D(110, 48).SpToPx(),
+ ThemeChangeSensitive = true,
+ };
+ actionContent.Clicked += (object sender, ClickedEventArgs e) =>
+ {
+ SetCurrentWallpaper();
+ CloseSettingWallpaper();
+ };
+ appBar.ActionContent = actionContent;
+
+ TextLabel titleContent = new TextLabel("Wallpaper")
+ {
+ StyleName = "PageLabel",
+ WidthSpecification = Window.Instance.Size.Width - 238.SpToPx(),
+ PixelSize = 24.SpToPx(),
+ FontFamily = "BreezeSans",
+ FontStyle = Resources.FontStyleAllNormal,
+ };
+ appBar.TitleContent = titleContent;
+ }
+
+ 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");
+ }
+ }
+ }
+}
--- /dev/null
+using System;
+using System.Collections.Generic;
+using System.IO;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
+using Tizen.System;
+using SettingWallpaper.Common;
+
+namespace SettingWallpaper.Views
+{
+ class WallpaperView : View
+ {
+ public event EventHandler<EventArgs> WallpaperChanged;
+
+ private TextLabel centerText;
+ private View bottomView;
+ private View wallpaperListView;
+ 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()
+ {
+ if (previewMode == false)
+ {
+ HideItems();
+ }
+ else
+ {
+ ShowItems();
+ }
+ previewMode = !previewMode;
+ }
+
+ private void HideItems()
+ {
+ centerText.Hide();
+ bottomView.Hide();
+ }
+
+ private void ShowItems()
+ {
+ centerText.Show();
+ bottomView.Show();
+ }
+
+ private void AddTextLabel()
+ {
+ centerText = new TextLabel()
+ {
+ HeightSpecification = 32.SpToPx(),
+ HorizontalAlignment = HorizontalAlignment.Center,
+ VerticalAlignment = VerticalAlignment.Center,
+ Text = "Tap to preview",
+ TextColor = Color.White,
+ PixelSize = 24.SpToPx(),
+ FontFamily = "BreezeSans",
+ };
+ previewMode = false;
+ Add(centerText);
+ RelativeLayout.SetVerticalAlignment(centerText, RelativeLayout.Alignment.Center);
+ RelativeLayout.SetHorizontalAlignment(centerText, RelativeLayout.Alignment.Center);
+ }
+
+ private void AddBottomView()
+ {
+ bottomView = new View()
+ {
+ WidthSpecification = (int)((DeviceInfo.IsPortrait ? DeviceInfo.DisplayHeight : DeviceInfo.DisplayWidth) * 0.55f),
+ HeightSpecification = 144.SpToPx(),
+ Margin = new Extents(0, 0, 0, 80).SpToPx(),
+ CornerRadius = new Vector4(12, 12, 12, 12),
+ BackgroundColor = Color.White,
+ Layout = new LinearLayout()
+ {
+ CellPadding = new Size2D(16, 0).SpToPx(),
+ LinearOrientation = LinearLayout.Orientation.Horizontal,
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ }
+ };
+ bottomView.TouchEvent += (object source, TouchEventArgs e) =>
+ {
+ return true;
+ };
+ Add(bottomView);
+ RelativeLayout.SetHorizontalAlignment(bottomView, RelativeLayout.Alignment.Center);
+ RelativeLayout.SetVerticalAlignment(bottomView, RelativeLayout.Alignment.End);
+
+ AddPreviousButton();
+ AddAlbumsFolder();
+ startingIndex = 0;
+ AddWallpaperListView();
+ AddNextButton();
+ UpdateWallpapers();
+ }
+
+ 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,
+ };
+ previousButton.Clicked += OnPreviousButtonClicked;
+ 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",
+ };
+ albumFolder.Clicked += OnAlbumFolderClicked;
+ 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();
+ Tizen.Log.Info(Resources.LogTag, "maxWallapers: " + maxWallpapers);
+ wallpaperListView = new View()
+ {
+ SizeWidth = wallpaperListViewWidth,
+ SizeHeight = 114.SpToPx(),
+ Layout = new LinearLayout()
+ {
+ CellPadding = new Size2D(16, 0).SpToPx(),
+ LinearOrientation = LinearLayout.Orientation.Horizontal,
+ VerticalAlignment = VerticalAlignment.Center,
+ HorizontalAlignment = HorizontalAlignment.Begin,
+ }
+ };
+ AddWallpaperButtons();
+ bottomView.Add(wallpaperListView);
+ }
+
+ private void AddWallpaperButtons()
+ {
+ wallpaperIcons = new List<Button>();
+ totalWallpapers = 0;
+ DirectoryInfo wallPaperDirectory = new DirectoryInfo(WallpaperPath);
+ foreach (FileInfo fi in wallPaperDirectory.GetFiles())
+ {
+ Tizen.Log.Info(Resources.LogTag, "Image: " + fi.Name);
+ Button wallpaper = new Button()
+ {
+ 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) =>
+ {
+ CurrentWallpaper = wallpaper.BackgroundImage;
+ WallpaperChanged.Invoke(this, new EventArgs());
+ };
+ totalWallpapers++;
+ wallpaper.Hide();
+ wallpaperIcons.Add(wallpaper);
+ }
+ }
+
+ private void UpdateWallpapers()
+ {
+ while (wallpaperListView.ChildCount != 0)
+ {
+ Button wallpaper = (Button)wallpaperListView.GetChildAt(0);
+ wallpaper.Hide();
+ wallpaperListView.Remove(wallpaper);
+ }
+ 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()
+ {
+ StringSelector iconUrlSelector = new StringSelector()
+ {
+ Normal = Resources.GetLightImagePath() + "next.png",
+ Pressed = Resources.GetLightImagePath() + "next_pressed.png",
+ Disabled = Resources.GetLightImagePath() + "next_disabled.png",
+ };
+ nextButton = new Button()
+ {
+ Size2D = new Size2D(48, 48).SpToPx(),
+ BackgroundColor = Color.Transparent,
+ IconURLSelector = iconUrlSelector,
+ };
+ if (startingIndex + maxWallpapers >= totalWallpapers)
+ {
+ nextButton.IsEnabled = false;
+ }
+ nextButton.Clicked += OnNextButtonClicked;
+ bottomView.Add(nextButton);
+ }
+
+ private void OnNextButtonClicked(object sender, ClickedEventArgs e)
+ {
+ if (nextButton.IsEnabled == true)
+ {
+ startingIndex++;
+ UpdateWallpapers();
+ }
+ }
+
+ protected override void Dispose(DisposeTypes type)
+ {
+ if (Disposed)
+ {
+ return;
+ }
+ if (type == DisposeTypes.Explicit)
+ {
+
+ }
+ Tizen.Log.Info(Resources.LogTag, "WallpaperView Dispose");
+ base.Dispose(type);
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?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="Background" ThemeChangeSensitive="true" BackgroundColor="#16131A" />
+
+ <c:DefaultTitleItemStyle x:Key="Header" ThemeChangeSensitive="true" >
+ <c:DefaultTitleItemStyle.Label>
+ <TextLabelStyle PixelSize ="24sp" TextColor ="#FDFDFD" />
+ </c:DefaultTitleItemStyle.Label>
+ </c:DefaultTitleItemStyle>
+
+ <TextLabelStyle x:Key="PageLabel" ThemeChangeSensitive="true" TextColor="#FAFAFA" FontFamily="BreezeSans"/>
+
+ <TextLabelStyle x:Key="AlbumLabel" ThemeChangeSensitive="true" TextColor="#FAFAFA" FontFamily="BreezeSans"/>
+
+ <c:ButtonStyle x:Key="ReturnButton" Size="48sp, 48sp" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle Size="48sp, 48sp">
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/return.png" Pressed="*Resource*/images/dark/return.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="BackButton" Size="48sp, 48sp" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle Size="48sp, 48sp">
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/back.png" Pressed="*Resource*/images/dark/back.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="FolderIcon" Size="48sp, 48sp" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundImage="*Resource*/images/dark/background.png">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle Size="78sp, 65sp">
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/folder.png" Pressed="*Resource*/images/dark/folder.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="ForwardButton" Size="48sp, 48sp" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle Size="48sp, 48sp">
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/dark/forward.png" Pressed="*Resource*/images/dark/forward.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+</Theme>
\ No newline at end of file
--- /dev/null
+<?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="Background" ThemeChangeSensitive="true" BackgroundColor="#FAFAFA" />
+
+ <c:DefaultTitleItemStyle x:Key="Header" ThemeChangeSensitive="true">
+ <c:DefaultTitleItemStyle.Label>
+ <TextLabelStyle PixelSize ="24sp" TextColor ="#090E21" />
+ </c:DefaultTitleItemStyle.Label>
+ </c:DefaultTitleItemStyle>
+
+ <TextLabelStyle x:Key="PageLabel" ThemeChangeSensitive="true" TextColor="#090E21" FontFamily="BreezeSans"/>
+
+ <TextLabelStyle x:Key="AlbumLabel" ThemeChangeSensitive="true" TextColor="#090E21" FontFamily="BreezeSans"/>
+
+ <c:ButtonStyle x:Key="ReturnButton" Size="48sp, 48sp" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle Size="48sp, 48sp">
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/return.png" Pressed="*Resource*/images/light/return.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="BackButton" Size="48sp, 48sp" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle Size="48sp, 48sp">
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/back.png" Pressed="*Resource*/images/light/back.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="FolderIcon" Size="48sp, 48sp" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundImage="*Resource*/images/light/background.png">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle Size="78sp, 65sp">
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/folder.png" Pressed="*Resource*/images/light/folder.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+ <c:ButtonStyle x:Key="ForwardButton" Size="48sp, 48sp" ThemeChangeSensitive="true" IsSelectable="false" IsEnabled="true" BackgroundColor="Transparent">
+ <c:ButtonStyle.Icon>
+ <ImageViewStyle Size="48sp, 48sp">
+ <ImageViewStyle.ResourceUrl>
+ <Selector x:TypeArguments="x:String" Normal="*Resource*/images/light/forward.png" Pressed="*Resource*/images/light/forward.png" />
+ </ImageViewStyle.ResourceUrl>
+ </ImageViewStyle>
+ </c:ButtonStyle.Icon>
+ </c:ButtonStyle>
+
+</Theme>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" api-version="7" package="org.tizen.cssetting-wallpaper" version="1.0.0">
+ <profile name="common" />
+ <widget-application appid="org.tizen.cssetting-wallpaper" exec="SettingWallpaper.dll" type="dotnet" multiple="false" taskmanage="true" nodisplay="false" launch_mode="single">
+ <icon>SettingWallpaper.png</icon>
+ <label>SettingWallpaper</label>
+ <metadata key="http://tizen.org/metadata/prefer_dotnet_aot" value="true" />
+ <widget-class classid="wallpaper" update-period="0">
+ <support-size preview="SettingWallpaper.png">4x4</support-size>
+ </widget-class>
+ </widget-application>
+ <privileges>
+ <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+ <privilege>http://tizen.org/privilege/packagemanager.info</privilege>
+ <privilege>http://tizen.org/privilege/systemsettings.admin</privilege>
+ <privilege>http://tizen.org/privilege/datasharing</privilege>
+ <privilege>http://tizen.org/privilege/widget.viewer</privilege>
+ </privileges>
+</manifest>
--- /dev/null
+Name: org.tizen.cssetting-wallpaper
+Summary: org.tizen.cssetting-wallpaper
+Version: 1.0.0
+Release: 1
+Group: N/A
+License: Apache-2.0
+Source0: %{name}-%{version}.tar.gz
+
+ExclusiveArch: %{ix86} x86_64 %{arm} aarch64
+
+BuildRequires: pkgconfig(libtzplatform-config)
+Requires(post): /usr/bin/tpk-backend
+
+%define internal_name org.tizen.cssetting-wallpaper
+%define preload_tpk_path %{TZ_SYS_RO_APP}/.preload-tpk
+
+%description
+This application is used for setting wallpaper for the system.
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf %{buildroot}
+mkdir -p %{buildroot}/%{preload_tpk_path}
+install packaging/%{internal_name}-%{version}.tpk %{buildroot}/%{preload_tpk_path}/
+
+%post
+
+%files
+%defattr(-,root,root,-)
+%{preload_tpk_path}/*
\ No newline at end of file