Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Manish Kungwani committed Jun 4, 2017
0 parents commit 6e3456f
Show file tree
Hide file tree
Showing 58 changed files with 7,487 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
NT-ContactsApp/NT_ContactsApp.Android/bin/*
NT-ContactsApp/NT_ContactsApp.Android/obj/*
NT-ContactsApp/NT_ContactsApp.iOS/obj/*
NT-ContactsApp/NT_ContactsApp.iOS/bin/*
NT-ContactsApp/NT_ContactsApp/bin/*
NT-ContactsApp/NT_ContactsApp/obj/*
packages/*
112 changes: 112 additions & 0 deletions NT-ContactsApp.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NT_ContactsApp.Android", "NT-ContactsApp\NT_ContactsApp.Android\NT_ContactsApp.Android.csproj", "{C738566B-2913-4805-8EA4-502ECB13A401}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NT_ContactsApp", "NT-ContactsApp\NT_ContactsApp\NT_ContactsApp.csproj", "{E5A894A6-821C-425E-89D2-9A4AE7526DD2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NT_ContactsApp.iOS", "NT-ContactsApp\NT_ContactsApp.iOS\NT_ContactsApp.iOS.csproj", "{1F8A1156-BCE0-42F8-9E44-04C478E73A62}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
Ad-Hoc|iPhone = Ad-Hoc|iPhone
Ad-Hoc|iPhoneSimulator = Ad-Hoc|iPhoneSimulator
AppStore|Any CPU = AppStore|Any CPU
AppStore|iPhone = AppStore|iPhone
AppStore|iPhoneSimulator = AppStore|iPhoneSimulator
Debug|Any CPU = Debug|Any CPU
Debug|iPhone = Debug|iPhone
Debug|iPhoneSimulator = Debug|iPhoneSimulator
Release|Any CPU = Release|Any CPU
Release|iPhone = Release|iPhone
Release|iPhoneSimulator = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|Any CPU.Deploy.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|iPhone.Deploy.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Ad-Hoc|iPhoneSimulator.Deploy.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|Any CPU.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|Any CPU.Deploy.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|iPhone.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|iPhone.Deploy.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.AppStore|iPhoneSimulator.Deploy.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|iPhone.Build.0 = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|iPhone.Deploy.0 = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Debug|iPhoneSimulator.Deploy.0 = Debug|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|Any CPU.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|Any CPU.Deploy.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|iPhone.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|iPhone.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|iPhone.Deploy.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{C738566B-2913-4805-8EA4-502ECB13A401}.Release|iPhoneSimulator.Deploy.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.AppStore|Any CPU.Build.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.AppStore|iPhone.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.AppStore|iPhone.Build.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Debug|iPhone.Build.0 = Debug|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Release|Any CPU.Build.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Release|iPhone.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Release|iPhone.Build.0 = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E5A894A6-821C-425E-89D2-9A4AE7526DD2}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Ad-Hoc|Any CPU.ActiveCfg = Ad-Hoc|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Ad-Hoc|iPhone.ActiveCfg = Ad-Hoc|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Ad-Hoc|iPhone.Build.0 = Ad-Hoc|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Ad-Hoc|iPhoneSimulator
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Ad-Hoc|iPhoneSimulator.Build.0 = Ad-Hoc|iPhoneSimulator
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.AppStore|Any CPU.ActiveCfg = AppStore|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.AppStore|iPhone.ActiveCfg = AppStore|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.AppStore|iPhone.Build.0 = AppStore|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.AppStore|iPhoneSimulator.ActiveCfg = AppStore|iPhoneSimulator
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.AppStore|iPhoneSimulator.Build.0 = AppStore|iPhoneSimulator
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Debug|Any CPU.ActiveCfg = Debug|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Debug|iPhone.ActiveCfg = Debug|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Debug|iPhone.Build.0 = Debug|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Release|Any CPU.ActiveCfg = Release|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Release|iPhone.ActiveCfg = Release|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Release|iPhone.Build.0 = Release|iPhone
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
{1F8A1156-BCE0-42F8-9E44-04C478E73A62}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
19 changes: 19 additions & 0 deletions NT-ContactsApp/NT_ContactsApp.Android/Assets/AboutAssets.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Any raw assets you want to be deployed with your application can be placed in
this directory (and child directories) and given a Build Action of "AndroidAsset".

These files will be deployed with you package and will be accessible using Android's
AssetManager, like this:

public class ReadAsset : Activity
{
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);

InputStream input = Assets.Open ("my_asset.txt");
}
}

Additionally, some Android functions will automatically load asset files:

Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
31 changes: 31 additions & 0 deletions NT-ContactsApp/NT_ContactsApp.Android/Data/SQLite_Android.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
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;
using SQLite.Net.Async;
using SQLite.Net;
using SQLite.Net.Platform.XamarinAndroid;
using NT_ContactsApp.Data;

namespace NT_ContactsApp.Droid.Data
{
public class SQLite_Android : ISQLite
{
public SQLiteAsyncConnection GetConnection()
{
var sqliteFilename = "test.db";
string documentsPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
string path = System.IO.Path.Combine(documentsPath, sqliteFilename);

return new SQLiteAsyncConnection(
() => new SQLiteConnectionWithLock(new SQLitePlatformAndroid(), new SQLiteConnectionString(path, true)));
}
}
}
32 changes: 32 additions & 0 deletions NT-ContactsApp/NT_ContactsApp.Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;

using Android.App;
using Android.Content.PM;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using Plugin.Permissions;

namespace NT_ContactsApp.Droid
{
[Activity(Label = "NT_ContactsApp", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

base.OnCreate(bundle);

global::Xamarin.Forms.Forms.Init(this, bundle);
LoadApplication(new App());
}
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, Permission[] grantResults)
{
PermissionsImplementation.Current.OnRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
}

78 changes: 78 additions & 0 deletions NT-ContactsApp/NT_ContactsApp.Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
using System;

using Android.App;
using Android.OS;
using Android.Runtime;
using Plugin.CurrentActivity;
using NT_ContactsApp.Modules;
using NT_ContactsApp.Droid.Module;
using NT_ContactsApp.Data;
using System.Threading.Tasks;

namespace NT_ContactsApp.Droid
{
//You can specify additional application information in this attribute
[Application]
public class MainApplication : Application, Application.IActivityLifecycleCallbacks
{
public MainApplication(IntPtr handle, JniHandleOwnership transer)
:base(handle, transer)
{
}

public override void OnCreate()
{
base.OnCreate();
RegisterActivityLifecycleCallbacks(this);
InitDI();
//A great place to initialize Xamarin.Insights and Dependency Services!
}

private async void InitDI()
{
IoC.CreateContainer();
IoC.RegisterModule(new AndroidModule());
IoC.RegisterModule(new PCLModule());
IoC.StartContainer();
var db = IoC.Resolve<ContactDatabase>();
await db.InitDatabase();
}

public override void OnTerminate()
{
base.OnTerminate();
UnregisterActivityLifecycleCallbacks(this);
}

public void OnActivityCreated(Activity activity, Bundle savedInstanceState)
{
CrossCurrentActivity.Current.Activity = activity;
}

public void OnActivityDestroyed(Activity activity)
{
}

public void OnActivityPaused(Activity activity)
{
}

public void OnActivityResumed(Activity activity)
{
CrossCurrentActivity.Current.Activity = activity;
}

public void OnActivitySaveInstanceState(Activity activity, Bundle outState)
{
}

public void OnActivityStarted(Activity activity)
{
CrossCurrentActivity.Current.Activity = activity;
}

public void OnActivityStopped(Activity activity)
{
}
}
}
25 changes: 25 additions & 0 deletions NT-ContactsApp/NT_ContactsApp.Android/Module/AndroidModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
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;
using Autofac;
using NT_ContactsApp.Data;
using NT_ContactsApp.Droid.Data;

namespace NT_ContactsApp.Droid.Module
{
public class AndroidModule : NT_ContactsApp.Modules.IModule
{
public void Register(ContainerBuilder builder)
{
builder.RegisterType<SQLite_Android>().As<ISQLite>();
}
}
}
Loading

0 comments on commit 6e3456f

Please sign in to comment.