├── _config.yml ├── TenDaysOfXamarin.iOS ├── Resources │ ├── Default.png │ ├── Default@2x.png │ ├── Default-568h@2x.png │ ├── Default-Portrait.png │ ├── Default-Portrait@2x.png │ └── LaunchScreen.storyboard ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Icon120.png │ │ ├── Icon152.png │ │ ├── Icon167.png │ │ ├── Icon180.png │ │ ├── Icon20.png │ │ ├── Icon29.png │ │ ├── Icon40.png │ │ ├── Icon58.png │ │ ├── Icon60.png │ │ ├── Icon76.png │ │ ├── Icon80.png │ │ ├── Icon87.png │ │ ├── Icon1024.png │ │ └── Contents.json ├── Entitlements.plist ├── Main.cs ├── AppDelegate.cs ├── Properties │ └── AssemblyInfo.cs ├── Info.plist └── TenDaysOfXamarin.iOS.csproj ├── TenDaysOfXamarin.Android ├── Resources │ ├── mipmap-hdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-mdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-xxxhdpi │ │ ├── icon.png │ │ └── launcher_foreground.png │ ├── mipmap-anydpi-v26 │ │ ├── icon.xml │ │ └── icon_round.xml │ ├── values │ │ ├── colors.xml │ │ └── styles.xml │ ├── layout │ │ ├── Toolbar.axml │ │ └── Tabbar.axml │ └── AboutResources.txt ├── Properties │ ├── AndroidManifest.xml │ └── AssemblyInfo.cs ├── Assets │ └── AboutAssets.txt ├── MainActivity.cs └── TenDaysOfXamarin.Android.csproj ├── TenDaysOfXamarin ├── Helpers │ └── Constants.cs ├── Views │ ├── ExperiencesPage.xaml.cs │ ├── ExperiencesPage.xaml │ ├── MainPage.xaml.cs │ └── MainPage.xaml ├── ViewModels │ ├── Commands │ │ └── NewExperienceCommand.cs │ ├── Helpers │ │ ├── PermissionsHelper.cs │ │ └── LocationHelper.cs │ ├── ExperiencesVM.cs │ └── MainVM.cs ├── App.xaml.cs ├── TenDaysOfXamarin.csproj ├── Model │ ├── Experience.cs │ └── Search.cs └── App.xaml ├── .gitignore ├── .github └── ISSUE_TEMPLATE │ └── bug_report.md ├── azure-pipelines.yml ├── README.md └── TenDaysOfXamarin.sln /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Resources/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Resources/Default.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Resources/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Resources/Default@2x.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Resources/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Resources/Default-568h@2x.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Resources/Default-Portrait.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Resources/Default-Portrait.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-hdpi/icon.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Resources/Default-Portrait@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Resources/Default-Portrait@2x.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-xhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-xhdpi/icon.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-xxxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-xxxhdpi/icon.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon120.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon152.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon167.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon180.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon20.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon29.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon40.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon58.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon60.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon76.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon80.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon87.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-hdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-mdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.iOS/Assets.xcassets/AppIcon.appiconset/Icon1024.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-xhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-xxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LaloCo/10DaysOfXamarin/HEAD/TenDaysOfXamarin.Android/Resources/mipmap-xxxhdpi/launcher_foreground.png -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Entitlements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-anydpi-v26/icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #FFFFFF 4 | #3F51B5 5 | #303F9F 6 | #FF4081 7 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/mipmap-anydpi-v26/icon_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/Helpers/Constants.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | namespace TenDaysOfXamarin.Helpers 3 | { 4 | public class Constants 5 | { 6 | public const string FOURSQR_CLIENT_ID = "N0CTIEHVIA24DMNXOTF0MT33Z1KH1PPJKLOPZMW1MSZWVTPJ"; 7 | public const string FOURSQR_CLIENT_SECRET = "LOYLLSTG5UEUXMQIQ0DSC0VUMBDFNGNBH3MXAASZE0VPLWHE"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/layout/Toolbar.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/layout/Tabbar.axml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Main.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | 5 | using Foundation; 6 | using UIKit; 7 | 8 | namespace TenDaysOfXamarin.iOS 9 | { 10 | public class Application 11 | { 12 | // This is the main entry point of the application. 13 | static void Main(string[] args) 14 | { 15 | // if you want to use a different Application Delegate class from "AppDelegate" 16 | // you can specify it here. 17 | UIApplication.Main(args, null, "AppDelegate"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Autosave files 2 | *~ 3 | 4 | # build 5 | [Oo]bj/ 6 | [Bb]in/ 7 | packages/ 8 | TestResults/ 9 | 10 | # globs 11 | Makefile.in 12 | *.DS_Store 13 | *.sln.cache 14 | *.suo 15 | *.cache 16 | *.pidb 17 | *.userprefs 18 | *.usertasks 19 | config.log 20 | config.make 21 | config.status 22 | aclocal.m4 23 | install-sh 24 | autom4te.cache/ 25 | *.user 26 | *.tar.gz 27 | tarballs/ 28 | test-results/ 29 | Thumbs.db 30 | .vs/ 31 | 32 | # Mac bundle stuff 33 | *.dmg 34 | *.app 35 | 36 | # resharper 37 | *_Resharper.* 38 | *.Resharper 39 | 40 | # dotCover 41 | *.dotCover 42 | 43 | # Private key files 44 | Constants.cs 45 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/Views/ExperiencesPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SQLite; 4 | using TenDaysOfXamarin.Model; 5 | using TenDaysOfXamarin.ViewModels; 6 | using Xamarin.Forms; 7 | 8 | namespace TenDaysOfXamarin.Views 9 | { 10 | public partial class ExperiencesPage : ContentPage 11 | { 12 | ExperiencesVM viewModel; 13 | public ExperiencesPage() 14 | { 15 | InitializeComponent(); 16 | 17 | viewModel = Resources["vm"] as ExperiencesVM; 18 | } 19 | 20 | protected override void OnAppearing() 21 | { 22 | base.OnAppearing(); 23 | 24 | viewModel.ReadExperiences(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Assets/AboutAssets.txt: -------------------------------------------------------------------------------- 1 | Any raw assets you want to be deployed with your application can be placed in 2 | this directory (and child directories) and given a Build Action of "AndroidAsset". 3 | 4 | These files will be deployed with you package and will be accessible using Android's 5 | AssetManager, like this: 6 | 7 | public class ReadAsset : Activity 8 | { 9 | protected override void OnCreate (Bundle bundle) 10 | { 11 | base.OnCreate (bundle); 12 | 13 | InputStream input = Assets.Open ("my_asset.txt"); 14 | } 15 | } 16 | 17 | Additionally, some Android functions will automatically load asset files: 18 | 19 | Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf"); 20 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/ViewModels/Commands/NewExperienceCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | 4 | namespace TenDaysOfXamarin.ViewModels.Commands 5 | { 6 | // added using System.Windows.Input; 7 | public class NewExperienceCommand : ICommand 8 | { 9 | private ExperiencesVM viewModel; 10 | public NewExperienceCommand(ExperiencesVM viewModel) 11 | { 12 | this.viewModel = viewModel; 13 | } 14 | 15 | public event EventHandler CanExecuteChanged; 16 | 17 | public bool CanExecute(object parameter) 18 | { 19 | return true; 20 | } 21 | 22 | public void Execute(object parameter) 23 | { 24 | viewModel.NewExperience(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | name: Bug report 4 | about: Create a report to help us improve 5 | title: '' 6 | labels: '' 7 | assignees: LaloCo 8 | 9 | --- 10 | 11 | - **Day:** [e.g. 1] 12 | 13 | **Describe the bug** 14 | A clear and concise description of what the bug is. 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior: 18 | 19 | 1. Go to '...' 20 | 2. Click on '....' 21 | 3. Scroll down to '....' 22 | 4. See error 23 | 24 | **Expected behavior** 25 | A clear and concise description of what you expected to happen. 26 | 27 | **Screenshots** 28 | If applicable, add screenshots to help explain your problem. 29 | 30 | **Desktop (please complete the following information):** 31 | 32 | - OS: [e.g. macOS] 33 | - Visual Studio [e.g. 7.8.2] 34 | - Xamarin Forms Version [e.g. 3.5] 35 | 36 | **Smartphone (please complete the following information):** 37 | 38 | - Device: [e.g. iPhone6] 39 | - OS: [e.g. iOS8.1] 40 | 41 | **Additional context** 42 | Add any other context about the problem here. 43 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # Xamarin.iOS 2 | # Build a Xamarin.iOS project. 3 | # Add steps that install certificates, test, sign, and distribute an app, save build artifacts, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/languages/xamarin 5 | 6 | trigger: 7 | - master 8 | 9 | pool: 10 | vmImage: 'macOS-10.13' 11 | 12 | steps: 13 | # To manually select a Xamarin SDK version on the Microsoft-hosted macOS agent, 14 | # configure this task with the *Mono* version that is associated with the 15 | # Xamarin SDK version that you need, and set the "enabled" property to true. 16 | # See https://go.microsoft.com/fwlink/?linkid=871629 17 | - script: sudo $AGENT_HOMEDIRECTORY/scripts/select-xamarin-sdk.sh 5_12_0 18 | displayName: 'Select the Xamarin SDK version' 19 | enabled: false 20 | 21 | - task: NuGetToolInstaller@0 22 | 23 | - task: NuGetCommand@2 24 | inputs: 25 | restoreSolution: '**/*.sln' 26 | 27 | - task: XamariniOS@2 28 | inputs: 29 | solutionFile: '**/*.sln' 30 | configuration: 'Release' 31 | buildForSimulator: true 32 | packageApp: false 33 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/ViewModels/Helpers/PermissionsHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Plugin.Permissions; 4 | using Plugin.Permissions.Abstractions; 5 | 6 | namespace TenDaysOfXamarin.ViewModels.Helpers 7 | { 8 | public class PermissionsHelper 9 | { 10 | // added using Plugin.Permissions.Abstractions; 11 | // added using System.Threading.Tasks; 12 | public static async Task GetPermission(Permission permissionType) 13 | { 14 | // added using Plugin.Permissions; 15 | var status = await CrossPermissions.Current.CheckPermissionStatusAsync(permissionType); 16 | if (status != PermissionStatus.Granted) 17 | { 18 | // This is the actual permission request 19 | var results = await CrossPermissions.Current.RequestPermissionsAsync(permissionType); 20 | if (results.ContainsKey(permissionType)) 21 | status = results[permissionType]; 22 | } 23 | 24 | return status; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using TenDaysOfXamarin.Views; 3 | using Xamarin.Forms; 4 | using Xamarin.Forms.Xaml; 5 | 6 | [assembly: XamlCompilation(XamlCompilationOptions.Compile)] 7 | namespace TenDaysOfXamarin 8 | { 9 | public partial class App : Application 10 | { 11 | public static string DatabasePath; 12 | 13 | public App(string databasePath) 14 | { 15 | InitializeComponent(); 16 | 17 | DatabasePath = databasePath; 18 | 19 | MainPage = new NavigationPage(new ExperiencesPage()); // added using TenDaysOfXamarin.Views; 20 | } 21 | 22 | public App() 23 | { 24 | InitializeComponent(); 25 | 26 | MainPage = new NavigationPage(new ExperiencesPage()); 27 | } 28 | 29 | protected override void OnStart() 30 | { 31 | // Handle when your app starts 32 | } 33 | 34 | protected override void OnSleep() 35 | { 36 | // Handle when your app sleeps 37 | } 38 | 39 | protected override void OnResume() 40 | { 41 | // Handle when your app resumes 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/Views/ExperiencesPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/ViewModels/Helpers/LocationHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using Plugin.Geolocator; 4 | using Plugin.Geolocator.Abstractions; 5 | 6 | namespace TenDaysOfXamarin.ViewModels.Helpers 7 | { 8 | public class LocationHelper 9 | { 10 | // added using Plugin.Geolocator; 11 | // added using Plugin.Geolocator.Abstractions; 12 | public IGeolocator locator = CrossGeolocator.Current; 13 | public Position position; 14 | 15 | public LocationHelper() 16 | { 17 | locator.PositionChanged += Locator_PositionChanged; 18 | } 19 | 20 | void Locator_PositionChanged(object sender, PositionEventArgs e) 21 | { 22 | position = e.Position; 23 | } 24 | 25 | // added using System.Threading.Tasks; 26 | public async Task GetLocation(TimeSpan minimumTime, int minimumMeters) 27 | { 28 | position = await locator.GetPositionAsync(); 29 | await locator.StartListeningAsync(minimumTime, minimumMeters); 30 | return position; 31 | } 32 | 33 | public async void StopListening() 34 | { 35 | await locator.StopListeningAsync(); 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/Views/MainPage.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using Plugin.Geolocator; 7 | using Plugin.Geolocator.Abstractions; 8 | using Plugin.Permissions; 9 | using Plugin.Permissions.Abstractions; 10 | using SQLite; 11 | using TenDaysOfXamarin.Model; 12 | using Xamarin.Forms; 13 | using System.Net.Http; 14 | using Newtonsoft.Json; 15 | using TenDaysOfXamarin.ViewModels; 16 | using TenDaysOfXamarin.ViewModels.Helpers; 17 | 18 | namespace TenDaysOfXamarin 19 | { 20 | public partial class MainPage : ContentPage 21 | { 22 | // added using TenDaysOfXamarin.ViewModels; 23 | MainVM viewModel; 24 | 25 | public MainPage() 26 | { 27 | InitializeComponent(); 28 | 29 | viewModel = new MainVM(); 30 | BindingContext = viewModel; 31 | } 32 | 33 | protected override void OnAppearing() 34 | { 35 | base.OnAppearing(); 36 | 37 | viewModel.GetLocationPermission(); 38 | } 39 | 40 | protected override void OnDisappearing() 41 | { 42 | base.OnDisappearing(); 43 | viewModel.StopListeningLocationUpdates(); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/TenDaysOfXamarin.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | netstandard2.0 5 | 6 | 7 | 8 | pdbonly 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | MainPage.xaml 30 | Code 31 | 32 | 33 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("TenDaysOfXamarin.Android")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("TenDaysOfXamarin.Android")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | 32 | // Add some common permissions, these can be removed if not needed 33 | [assembly: UsesPermission(Android.Manifest.Permission.Internet)] 34 | [assembly: UsesPermission(Android.Manifest.Permission.WriteExternalStorage)] 35 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/AppDelegate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Linq; 5 | 6 | using Foundation; 7 | using UIKit; 8 | 9 | namespace TenDaysOfXamarin.iOS 10 | { 11 | // The UIApplicationDelegate for the application. This class is responsible for launching the 12 | // User Interface of the application, as well as listening (and optionally responding) to 13 | // application events from iOS. 14 | [Register("AppDelegate")] 15 | public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate 16 | { 17 | // 18 | // This method is invoked when the application has loaded and is ready to run. In this 19 | // method you should instantiate the window, load the UI into it and then make the window 20 | // visible. 21 | // 22 | // You have 17 seconds to return from this method, or iOS will terminate your application. 23 | // 24 | public override bool FinishedLaunching(UIApplication app, NSDictionary options) 25 | { 26 | global::Xamarin.Forms.Forms.Init(); 27 | 28 | string fileName = "database.db3"; 29 | string folderPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "..", "Library"); 30 | string fullPath = Path.Combine(folderPath, fileName); //Added using System.IO; 31 | 32 | LoadApplication(new App(fullPath)); 33 | 34 | return base.FinishedLaunching(app, options); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("TenDaysOfXamarin.iOS")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("TenDaysOfXamarin.iOS")] 13 | [assembly: AssemblyCopyright("Copyright © 2014")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("72bdc44f-c588-44f3-b6df-9aace7daafdd")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 24 | 27 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/ViewModels/ExperiencesVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.ObjectModel; 3 | using System.ComponentModel; 4 | using TenDaysOfXamarin.Model; 5 | using TenDaysOfXamarin.ViewModels.Commands; 6 | 7 | namespace TenDaysOfXamarin.ViewModels 8 | { 9 | public class ExperiencesVM : INotifyPropertyChanged 10 | { 11 | // added using TenDaysOfXamarin.ViewModels.Commands; 12 | public NewExperienceCommand NewExperienceCommand { get; set; } 13 | 14 | public ObservableCollection Experiences { get; set; } 15 | 16 | public ExperiencesVM() 17 | { 18 | NewExperienceCommand = new NewExperienceCommand(this); 19 | Experiences = new ObservableCollection(); 20 | ReadExperiences(); 21 | } 22 | 23 | public event PropertyChangedEventHandler PropertyChanged; 24 | 25 | public void NewExperience() 26 | { 27 | App.Current.MainPage.Navigation.PushAsync(new MainPage()); 28 | } 29 | 30 | public void ReadExperiences() 31 | { 32 | // added using TenDaysOfXamarin.Model; 33 | var experiences = Experience.GetExperiences(); 34 | 35 | Experiences.Clear(); 36 | foreach(var experience in experiences) 37 | { 38 | Experiences.Add(experience); 39 | } 40 | } 41 | 42 | private void OnPropertyChanged(string propertyName) 43 | { 44 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/Model/Experience.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using SQLite; 4 | 5 | namespace TenDaysOfXamarin.Model 6 | { 7 | public class Experience 8 | { 9 | [PrimaryKey, AutoIncrement] // added using SQLite; 10 | public int Id { get; set; } 11 | 12 | [MaxLength(50)] 13 | public string Title { get; set; } 14 | 15 | public string Content { get; set; } 16 | 17 | public DateTime CreatedAt { get; set; } 18 | 19 | public DateTime UpdatedAt { get; set; } 20 | 21 | public string VenueName { get; set; } 22 | 23 | public string VenueCategory { get; set; } 24 | 25 | public float VenueLat { get; set; } 26 | 27 | public float VenueLng { get; set; } 28 | 29 | public bool InsertExperience() 30 | { 31 | int insertedItems = 0; 32 | using (SQLiteConnection conn = new SQLiteConnection(App.DatabasePath)) 33 | { 34 | conn.CreateTable(); 35 | insertedItems = conn.Insert(this); 36 | } 37 | 38 | return insertedItems > 0; 39 | } 40 | 41 | public static List GetExperiences() 42 | { 43 | // added using System.Collections.Generic; 44 | using (SQLiteConnection conn = new SQLiteConnection(App.DatabasePath)) 45 | { 46 | conn.CreateTable(); 47 | return conn.Table().ToList(); 48 | } 49 | } 50 | 51 | public override string ToString() 52 | { 53 | return Title; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/MainActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Content.PM; 3 | using Android.Runtime; 4 | using Android.Views; 5 | using Android.Widget; 6 | using Android.OS; 7 | using System.IO; 8 | using Plugin.Permissions; 9 | 10 | namespace TenDaysOfXamarin.Droid 11 | { 12 | [Activity(Label = "TenDaysOfXamarin", Icon = "@mipmap/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] 13 | public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity 14 | { 15 | protected override void OnCreate(Bundle savedInstanceState) 16 | { 17 | TabLayoutResource = Resource.Layout.Tabbar; 18 | ToolbarResource = Resource.Layout.Toolbar; 19 | 20 | base.OnCreate(savedInstanceState); 21 | global::Xamarin.Forms.Forms.Init(this, savedInstanceState); 22 | Plugin.CurrentActivity.CrossCurrentActivity.Current.Init(this, savedInstanceState); 23 | 24 | string fileName = "database.db3"; 25 | string folderPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); 26 | string fullPath = Path.Combine(folderPath, fileName); //Added using System.IO; 27 | 28 | LoadApplication(new App(fullPath)); 29 | } 30 | 31 | public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults) 32 | { 33 | // added using Plugin.Permissions; 34 | PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults); 35 | base.OnRequestPermissionsResult(requestCode, permissions, grantResults); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /TenDaysOfXamarin.iOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | UIDeviceFamily 6 | 7 | 1 8 | 2 9 | 10 | UISupportedInterfaceOrientations 11 | 12 | UIInterfaceOrientationPortrait 13 | UIInterfaceOrientationLandscapeLeft 14 | UIInterfaceOrientationLandscapeRight 15 | 16 | UISupportedInterfaceOrientations~ipad 17 | 18 | UIInterfaceOrientationPortrait 19 | UIInterfaceOrientationPortraitUpsideDown 20 | UIInterfaceOrientationLandscapeLeft 21 | UIInterfaceOrientationLandscapeRight 22 | 23 | MinimumOSVersion 24 | 8.0 25 | CFBundleDisplayName 26 | TenDaysOfXamarin 27 | CFBundleIdentifier 28 | com.lalorosas.TenDaysOfXamarin 29 | CFBundleVersion 30 | 1.0 31 | UILaunchStoryboardName 32 | LaunchScreen 33 | CFBundleName 34 | TenDaysOfXamarin 35 | XSAppIconAssets 36 | Assets.xcassets/AppIcon.appiconset 37 | NSLocationWhenInUseUsageDescription 38 | We will use your device's location to get nearby venues for the experiences to be pinned to the place where you had them. 39 | NSBluetoothPeripheralUsageDescription 40 | We may use Bluetooth Peripherals to understand what devices you use while saving an experience 41 | NSCalendarsUsageDescription 42 | We may use your calendar to create experiences based on current events 43 | 44 | 45 | -------------------------------------------------------------------------------- /TenDaysOfXamarin.Android/Resources/AboutResources.txt: -------------------------------------------------------------------------------- 1 | Images, layout descriptions, binary blobs and string dictionaries can be included 2 | in your application as resource files. Various Android APIs are designed to 3 | operate on the resource IDs instead of dealing with images, strings or binary blobs 4 | directly. 5 | 6 | For example, a sample Android app that contains a user interface layout (main.xml), 7 | an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) 8 | would keep its resources in the "Resources" directory of the application: 9 | 10 | Resources/ 11 | drawable-hdpi/ 12 | icon.png 13 | 14 | drawable-ldpi/ 15 | icon.png 16 | 17 | drawable-mdpi/ 18 | icon.png 19 | 20 | layout/ 21 | main.xml 22 | 23 | values/ 24 | strings.xml 25 | 26 | In order to get the build system to recognize Android resources, set the build action to 27 | "AndroidResource". The native Android APIs do not operate directly with filenames, but 28 | instead operate on resource IDs. When you compile an Android application that uses resources, 29 | the build system will package the resources for distribution and generate a class called 30 | "Resource" that contains the tokens for each one of the resources included. For example, 31 | for the above Resources layout, this is what the Resource class would expose: 32 | 33 | public class Resource { 34 | public class drawable { 35 | public const int icon = 0x123; 36 | } 37 | 38 | public class layout { 39 | public const int main = 0x456; 40 | } 41 | 42 | public class strings { 43 | public const int first_string = 0xabc; 44 | public const int second_string = 0xbcd; 45 | } 46 | } 47 | 48 | You would then use R.drawable.icon to reference the drawable/icon.png file, or Resource.layout.main 49 | to reference the layout/main.xml file, or Resource.strings.first_string to reference the first 50 | string in the dictionary file values/strings.xml. 51 | -------------------------------------------------------------------------------- /TenDaysOfXamarin/Views/MainPage.xaml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 8 | 11 | 12 | 15 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 36 | 37 | 41 |