Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
286 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 16 additions & 7 deletions
23
CryptoNews/CryptoNews.Android/Resources/Resource.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
using Android.App; | ||
using Android.Content; | ||
using Android.OS; | ||
using Android.Runtime; | ||
using Android.Views; | ||
using Android.Widget; | ||
|
||
namespace CryptoNews.Droid | ||
{ | ||
[Activity(Theme = "@style/Theme.Splash", | ||
Label = "CRYPTO NEWS", | ||
MainLauncher = true, | ||
NoHistory = true)] | ||
public class SplashActivity : Activity | ||
{ | ||
protected override void OnCreate(Bundle savedInstanceState) | ||
{ | ||
base.OnCreate(savedInstanceState); | ||
|
||
// Create your application here | ||
StartActivity(typeof(MainActivity)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace CryptoNews.Services | ||
{ | ||
public class PrettyDate | ||
{ | ||
public static string GetPrettyDate(DateTime d) | ||
{ | ||
// 1. | ||
// Get time span elapsed since the date. | ||
TimeSpan s = DateTime.Now.Subtract(d); | ||
|
||
// 2. | ||
// Get total number of days elapsed. | ||
int dayDiff = (int)s.TotalDays; | ||
|
||
// 3. | ||
// Get total number of seconds elapsed. | ||
int secDiff = (int)s.TotalSeconds; | ||
|
||
// 4. | ||
// Don't allow out of range values. | ||
if (dayDiff < 0 || dayDiff >= 31) | ||
{ | ||
return d.ToString("MM/dd/yyyy"); | ||
} | ||
|
||
// 5. | ||
// Handle same-day times. | ||
if (dayDiff == 0) | ||
{ | ||
// A. | ||
// Less than one minute ago. | ||
if (secDiff < 60) | ||
{ | ||
return "just now"; | ||
} | ||
// B. | ||
// Less than 2 minutes ago. | ||
if (secDiff < 120) | ||
{ | ||
return "1 minute ago"; | ||
} | ||
// C. | ||
// Less than one hour ago. | ||
if (secDiff < 3600) | ||
{ | ||
return string.Format("{0} minutes ago", | ||
Math.Floor((double)secDiff / 60)); | ||
} | ||
// D. | ||
// Less than 2 hours ago. | ||
if (secDiff < 7200) | ||
{ | ||
return "1 hour ago"; | ||
} | ||
// E. | ||
// Less than one day ago. | ||
if (secDiff < 86400) | ||
{ | ||
return string.Format("{0} hours ago", | ||
Math.Floor((double)secDiff / 3600)); | ||
} | ||
} | ||
// 6. | ||
// Handle previous days. | ||
if (dayDiff == 1) | ||
{ | ||
return "yesterday"; | ||
} | ||
if (dayDiff < 7) | ||
{ | ||
return string.Format("{0} days ago", | ||
dayDiff); | ||
} | ||
if (dayDiff < 31) | ||
{ | ||
return string.Format("{0} weeks ago", | ||
Math.Ceiling((double)dayDiff / 7)); | ||
} | ||
return null; | ||
} | ||
} | ||
} |
Oops, something went wrong.