return (textLabel.LineCount - 1) * textLabel.SizeHeight / textLabel.LineCount;
}
}
-
- public static float GetScaleFactor()
- {
- var size = IsPortrait ? Window.Instance.Size.Width : Window.Instance.Size.Height;
- switch (size)
- {
- case 720:
- return 0.6f;
- case 1080:
- return 0.9f;
- default:
- {
- if (size > 1080)
- {
- return 0.9f;
- }
- else if (size < 1080 && size > 720)
- {
- return 0.6f;
- }
- else
- {
- return 0.4f;
- }
- }
- }
- }
}
}
{
public static class SpUtils
{
- public static float DefaultFactor = 1.48125f;
+ private const float DefaultFactor = 1.48125f;
public static int ToPixels(int sp)
{
private void SetBackground()
{
var visualMap = new NPatchVisual();
- visualMap.URL = NUIApplication.Current.DirectoryInfo.Resource + $"page/{fhdBackgroundFile}";
+ visualMap.URL = GetBackgroundUrl();
ViewBackground = visualMap.OutputVisualMap;
}
+ private string GetBackgroundUrl()
+ {
+ string filename = hdBackgroundFile;
+ int biggerEdge = Math.Max(Window.Instance.WindowSize.Width, Window.Instance.WindowSize.Height);
+ if (biggerEdge > 3000)
+ {
+ filename = fhdBackgroundFile;
+ }
+ else if (biggerEdge < 1500)
+ {
+ filename = uhdBackgroundFile;
+ }
+
+ string bgUrl = NUIApplication.Current.DirectoryInfo.Resource + $"page/{filename}";
+ return bgUrl;
+ }
+
private void SetTheme(string name)
{
ThemeManager.ApplyTheme(new Theme(NUIApplication.Current.DirectoryInfo.Resource + $"theme/{name}Theme.xaml"));
private void ConfigureSize()
{
var userScale = TextUtils.GetFontSizeScale(SystemSettings.FontSize);
+ float h2 = (48 * userScale) + (ScreenSizeUtils.IsPortrait ? 72 : 63);
+ float h1 = (48 * userScale) + 55;
+ int bounding_height = (int)((ScreenSizeUtils.IsPortrait ? 1616 : 760) - h2 - h1);
+
+ Bounding.Size = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? new Size2D(824, bounding_height) : new Size2D(1664, bounding_height));
Footnote.SizeWidth = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? 680 : 1520);
Linear.CellPadding = SpUtils.ToPixels(new Size2D(20, 20));
AgreeCheckBox.Size2D = SpUtils.ToPixels(new Size2D((int)(userScale * 24), (int)(userScale * 24)));
using Oobe.Common.Services;
using Oobe.Common.Utils;
using Oobe.Managers;
-using Tizen.Applications;
using Tizen.NUI;
namespace Oobe
Reset();
}
- if (e.ReceivedAppControl.ExtraData.TryGet("scale", out string scale))
- {
- if (!string.IsNullOrEmpty(scale))
- {
- Preference.Set("scale", scale);
- Tizen.Log.Debug("oobe", $"Set scale: {scale}");
- }
- }
-
Start();
}
Window.Instance.Type = WindowType.Notification;
Window.Instance.SetNotificationLevel(NotificationLevel.High);
- SetupScaleFactor();
-
ProcessManager.Instance.Start();
}
- private void SetupScaleFactor()
- {
- SpUtils.DefaultFactor = (float)SpTypeConverter.Instance.ConvertToPixel(1) / ScreenSizeUtils.GetScaleFactor();
-
- if (Preference.Contains("scale"))
- {
- try
- {
- SpUtils.DefaultFactor = float.Parse(Preference.Get<string>("scale"));
- }
- catch (Exception ex)
- {
- Tizen.Log.Debug("oobe", $"Wrong scale format: {ex.Message}");
- }
- }
-
- Tizen.Log.Debug("oobe", $"DefaultScaleFactor: {SpUtils.DefaultFactor}");
- }
-
private void Start()
{
if (ProcessManager.Instance.IsDone())
public OrientationalView()
{
+ Size2D = Window.Instance.Size;
PositionUsesPivotPoint = true;
ParentOrigin = Tizen.NUI.ParentOrigin.Center;
PivotPoint = Tizen.NUI.PivotPoint.Center;
public MainView(Window win)
: base()
{
- WidthSpecification = LayoutParamPolicies.MatchParent;
- HeightSpecification = LayoutParamPolicies.MatchParent;
+ Size = Window.Instance.Size;
+
PositionUsesPivotPoint = true;
ParentOrigin = Tizen.NUI.ParentOrigin.Center;
PivotPoint = Tizen.NUI.PivotPoint.Center;
- Layout = new LinearLayout
- {
- LinearOrientation = LinearLayout.Orientation.Vertical,
- };
-
- var marginSize = (ScreenSizeUtils.IsPortrait ? win.WindowSize.Height : win.WindowSize.Width) * 0.08f;
+ Tizen.Log.Debug("oobe", $"this.Size: {this.Size.Width} {this.Size.Height}");
orientational = new ScalableUI.OrientationalView
{
- WidthSpecification = LayoutParamPolicies.MatchParent,
- HeightSpecification = LayoutParamPolicies.MatchParent,
+ Size = SpUtils.ToPixels(ScreenSizeUtils.IsPortrait ? new Size2D(952, 1792) : new Size2D(1792, 952)),
Position2D = new Position2D(0, 0),
ScrollDuration = TransitionTime,
- Margin = SpUtils.ToPixels(new Extents(0, (ushort)marginSize, 0, (ushort)marginSize)),
};
Add(orientational);