Skip to content

Commit 2aa108a

Browse files
committed
[Downloader]Change screenshots, make contants for dimensions, casing consistant
1 parent 68b11c1 commit 2aa108a

File tree

10 files changed

+66
-62
lines changed

10 files changed

+66
-62
lines changed

Mobile/Downloader/.vscode/launch.json

Lines changed: 0 additions & 26 deletions
This file was deleted.

Mobile/Downloader/Downloader/DownloadInfoPage.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class DownloadInfoPage : ContentPage
1616
private CollectionView downloadInfoListView;
1717
private List<DownloadInfo> downloadInfoList = new List<DownloadInfo>();
1818
private bool isUpdatedInfoList;
19-
private Tizen.NUI.Components.Button goToMainPageButton; // Button to navigate to main page
19+
private Button goToMainPageButton;
2020
private IDownload downloadService;
2121

2222
/// <summary>
@@ -66,18 +66,18 @@ private void InitializeComponent()
6666
{
6767
LinearOrientation = LinearLayout.Orientation.Horizontal,
6868
LinearAlignment = LinearLayout.Alignment.Center,
69-
CellPadding = new Size2D(0, 0)
69+
CellPadding = Resources.ZeroSpacing
7070
},
7171
WidthSpecification = LayoutParamPolicies.WrapContent,
7272
HeightSpecification = LayoutParamPolicies.MatchParent,
73-
Padding = new Extents(40, 40, 8, 8),
74-
BackgroundColor = Color.Transparent
73+
Padding = Resources.AppBarButtonPadding,
74+
BackgroundColor = Resources.TransparentColor
7575
};
7676

7777
var mainButtonText = new TextLabel
7878
{
7979
Text = "Main",
80-
TextColor = Color.White,
80+
TextColor = Resources.WhiteColor,
8181
PointSize = Resources.TextSizeMedium,
8282
WidthSpecification = LayoutParamPolicies.WrapContent,
8383
HeightSpecification = LayoutParamPolicies.WrapContent,
@@ -95,7 +95,7 @@ private void InitializeComponent()
9595
return true;
9696
};
9797

98-
goToMainPageButton = null; // Not using Button anymore
98+
goToMainPageButton = null;
9999
AppBar.Actions = new View[] { mainButtonContainer };
100100

101101
downloadInfoLabel = CreateDownloadInfoLabel();
@@ -247,7 +247,7 @@ private CollectionView CreateCollectionView()
247247
Layout = new LinearLayout
248248
{
249249
LinearOrientation = LinearLayout.Orientation.Horizontal,
250-
CellPadding = new Size2D(16, 0) // Add horizontal spacing between name and value
250+
CellPadding = Resources.ItemLayoutSpacing
251251
},
252252
WidthSpecification = LayoutParamPolicies.MatchParent,
253253
HeightSpecification = LayoutParamPolicies.WrapContent
@@ -256,7 +256,7 @@ private CollectionView CreateCollectionView()
256256
// Name label
257257
var nameLabel = new TextLabel
258258
{
259-
WidthSpecification = 200, // Fixed width for name column
259+
WidthSpecification = Resources.NameLabelWidth,
260260
HeightSpecification = LayoutParamPolicies.WrapContent,
261261
PointSize = Resources.TextSizeMedium,
262262
TextColor = Resources.TextColor

Mobile/Downloader/Downloader/DownloadMainPage.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ namespace Downloader
1212
public class DownloadMainPage : ContentPage
1313
{
1414
private TextField urlTextField;
15-
private Tizen.NUI.Components.Button downloadButton;
16-
private Tizen.NUI.Components.Button goToInfoPageButton; // Button to navigate to info page
15+
private Button downloadButton;
16+
private Button goToInfoPageButton;
1717
private Progress progressBar;
1818
private TextLabel progressLabel;
1919
private string downloadUrl;
@@ -48,18 +48,18 @@ private void InitializeComponent()
4848
{
4949
LinearOrientation = LinearLayout.Orientation.Horizontal,
5050
LinearAlignment = LinearLayout.Alignment.Center,
51-
CellPadding = new Size2D(0, 0)
51+
CellPadding = Resources.ZeroSpacing
5252
},
5353
WidthSpecification = LayoutParamPolicies.WrapContent,
5454
HeightSpecification = LayoutParamPolicies.MatchParent,
55-
Padding = new Extents(40, 40, 8, 8),
56-
BackgroundColor = Color.Transparent
55+
Padding = Resources.AppBarButtonPadding,
56+
BackgroundColor = Resources.TransparentColor
5757
};
5858

5959
var infoButtonText = new TextLabel
6060
{
6161
Text = "Info",
62-
TextColor = Color.White,
62+
TextColor = Resources.WhiteColor,
6363
PointSize = Resources.TextSizeMedium,
6464
WidthSpecification = LayoutParamPolicies.WrapContent,
6565
HeightSpecification = LayoutParamPolicies.WrapContent,
@@ -76,8 +76,8 @@ private void InitializeComponent()
7676
}
7777
return true;
7878
};
79-
80-
goToInfoPageButton = null; // Not using Button anymore
79+
80+
goToInfoPageButton = null;
8181
AppBar.Actions = new View[] { infoButtonContainer };
8282

8383
var mainLayout = new View
@@ -154,14 +154,14 @@ private View CreateUrlSection()
154154
{
155155
PlaceholderText = "Enter URL to download...",
156156
WidthSpecification = LayoutParamPolicies.MatchParent,
157-
HeightSpecification = 56,
157+
HeightSpecification = Resources.TextFieldHeight,
158158
MaxLength = int.MaxValue,
159159
BackgroundColor = Resources.SurfaceColor,
160160
TextColor = Resources.TextColor,
161161
PlaceholderTextColor = Resources.TextColorSecondary,
162162
PointSize = Resources.TextSizeMedium,
163163
CornerRadius = Resources.CornerRadiusSmall,
164-
Padding = new Extents(16, 16, 12, 12)
164+
Padding = Resources.TextFieldPadding
165165
};
166166
section.Add(urlTextField);
167167

@@ -172,15 +172,15 @@ private View CreateUrlSection()
172172
/// Create a new Button to start download.
173173
/// </summary>
174174
/// <returns>Button</returns>
175-
private Tizen.NUI.Components.Button CreateDownloadButton()
175+
private Button CreateDownloadButton()
176176
{
177-
var button = new Tizen.NUI.Components.Button(Resources.PrimaryButtonStyle)
177+
var button = new Button(Resources.PrimaryButtonStyle)
178178
{
179179
Text = "Start Download",
180180
WidthSpecification = LayoutParamPolicies.MatchParent,
181-
HeightSpecification = 56,
181+
HeightSpecification = Resources.ButtonHeight,
182182
BackgroundColor = Resources.PrimaryColor,
183-
TextColor = Color.White,
183+
TextColor = Resources.WhiteColor,
184184
PointSize = Resources.TextSizeMedium,
185185
CornerRadius = Resources.CornerRadiusMedium
186186
};
@@ -235,8 +235,8 @@ private View CreateProgressSection()
235235
MaxValue = 100.0f,
236236
MinValue = 0.0f,
237237
WidthSpecification = LayoutParamPolicies.MatchParent,
238-
HeightSpecification = 8,
239-
TrackColor = new Tizen.NUI.Color(0.9f, 0.9f, 0.9f, 1.0f),
238+
HeightSpecification = Resources.ProgressBarHeight,
239+
TrackColor = Resources.TrackColor,
240240
ProgressColor = Resources.PrimaryColor,
241241
CornerRadius = Resources.CornerRadiusSmall
242242
};

Mobile/Downloader/Downloader/DownlodImplementation.cs

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class DownloadImplementation : IDownload
3131
private Request req;
3232

3333
// Flag to check download is started or not
34-
private bool is_started = false;
34+
private bool isStarted = false;
3535

3636
/// <summary>
3737
/// Register event handler and call Request.Start() to start download
@@ -45,7 +45,7 @@ public void StartDownload(string url)
4545
req.StateChanged += StateChanged;
4646
// Register progress changed event handler
4747
req.ProgressChanged += ProgressChanged;
48-
is_started = true;
48+
isStarted = true;
4949
// Start download content
5050
req.Start();
5151
}
@@ -56,7 +56,7 @@ public void StartDownload(string url)
5656
/// <returns>The URL</returns>
5757
public string GetUrl()
5858
{
59-
if (!is_started)
59+
if (!isStarted)
6060
{
6161
return "";
6262
}
@@ -70,7 +70,7 @@ public string GetUrl()
7070
/// <returns>The content name</returns>
7171
public string GetContentName()
7272
{
73-
if (!is_started)
73+
if (!isStarted)
7474
{
7575
return "";
7676
}
@@ -84,7 +84,7 @@ public string GetContentName()
8484
/// <returns>The content size</returns>
8585
public ulong GetContentSize()
8686
{
87-
if (!is_started)
87+
if (!isStarted)
8888
{
8989
return 0;
9090
}
@@ -98,7 +98,7 @@ public ulong GetContentSize()
9898
/// <returns>The downloaded path</returns>
9999
public string GetDownloadedPath()
100100
{
101-
if (!is_started)
101+
if (!isStarted)
102102
{
103103
return "";
104104
}
@@ -112,7 +112,7 @@ public string GetDownloadedPath()
112112
/// <returns>The MIME type</returns>
113113
public string GetMimeType()
114114
{
115-
if (!is_started)
115+
if (!isStarted)
116116
{
117117
return "";
118118
}
@@ -126,7 +126,7 @@ public string GetMimeType()
126126
/// <returns>The download state</returns>
127127
public int GetDownloadState()
128128
{
129-
if (!is_started)
129+
if (!isStarted)
130130
{
131131
return 0;
132132
}
@@ -139,10 +139,10 @@ public int GetDownloadState()
139139
/// </summary>
140140
public void Dispose()
141141
{
142-
if (is_started)
142+
if (isStarted)
143143
{
144144
req.Dispose();
145-
is_started = false;
145+
isStarted = false;
146146
}
147147
}
148148

@@ -183,6 +183,18 @@ private void StateChanged(object sender, StateChangedEventArgs e)
183183
case DownloadState.Failed:
184184
stateMsg = "Failed";
185185
break;
186+
/// Download is Paused.
187+
case DownloadState.Paused:
188+
stateMsg = "Paused";
189+
break;
190+
/// Download is Queued.
191+
case DownloadState.Queued:
192+
stateMsg = "Queued";
193+
break;
194+
/// Download is Canceled.
195+
case DownloadState.Canceled:
196+
stateMsg = "Canceled";
197+
break;
186198
default:
187199
stateMsg = "";
188200
break;

Mobile/Downloader/Downloader/Resources.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ internal static class Resources
2626
public static readonly Color WarningColor = new Color(1.0f, 0.6f, 0.0f, 1.0f); // #FF9800
2727
public static readonly Color BorderColor = new Color(0.88f, 0.88f, 0.88f, 1.0f); // #E0E0E0
2828
public static readonly Color ShadowColor = new Color(0.0f, 0.0f, 0.0f, 0.1f); // Subtle shadow
29+
public static readonly Color WhiteColor = Color.White;
30+
public static readonly Color TrackColor = new Color(0.9f, 0.9f, 0.9f, 1.0f);
31+
public static readonly Color TransparentColor = Color.Transparent;
2932

3033
// Common Sizes
3134
public const float TextSizeTitle = 28.0f;
@@ -41,6 +44,19 @@ internal static class Resources
4144
public const int SpacingLarge = 24;
4245
public const int SpacingExtraLarge = 32;
4346

47+
// Component Heights
48+
public const int ButtonHeight = 56;
49+
public const int TextFieldHeight = 56;
50+
public const int ProgressBarHeight = 8;
51+
public const int TableHeight = 200;
52+
53+
// Component Widths
54+
public const int NameLabelWidth = 200;
55+
56+
// Layout Spacing for specific components
57+
public static readonly Size2D ItemLayoutSpacing = new Size2D(16, 0);
58+
public static readonly Size2D ZeroSpacing = new Size2D(0, 0);
59+
4460
// Border Radius
4561
public static readonly Vector4 CornerRadiusSmall = new Vector4(4, 4, 4, 4);
4662
public static readonly Vector4 CornerRadiusMedium = new Vector4(8, 8, 8, 8);
@@ -76,5 +92,7 @@ internal static class Resources
7692
public static readonly Extents FormPadding = new Extents(SpacingLarge, SpacingLarge, SpacingMedium, SpacingMedium);
7793
public static readonly Extents CardPadding = new Extents(SpacingMedium, SpacingMedium, SpacingMedium, SpacingMedium);
7894
public static readonly Extents SectionPadding = new Extents(SpacingSmall, SpacingSmall, SpacingSmall, SpacingSmall);
95+
public static readonly Extents TextFieldPadding = new Extents(16, 16, 12, 12);
96+
public static readonly Extents AppBarButtonPadding = new Extents(40, 40, 8, 8);
7997
}
8098
}

Mobile/Downloader/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Downloader
22
The Downloader application demonstrates how user can download contents and get the download information.
33

4-
![MainPage](./Screenshots/Tizen/DownloadMainPage.jpg)
5-
![DownloadInfoPage](./Screenshots/Tizen/DownloadInfoPage.jpg)
4+
![MainPage](./Screenshots/Tizen/DownloadMainPage.png)
5+
![DownloadInfoPage](./Screenshots/Tizen/DownloadInfoPage.png)
66

77

88
### Verified Version
-1.5 MB
Binary file not shown.
34.8 KB
Loading
-1.57 MB
Binary file not shown.
34.8 KB
Loading

0 commit comments

Comments
 (0)