Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed May 10, 2016
0 parents commit 58f9792
Show file tree
Hide file tree
Showing 45 changed files with 7,407 additions and 0 deletions.
176 changes: 176 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.suo
*.user
*.sln.docstates
*.userprefs

# Xamarin Components
Components/

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
x64/
build/
bld/
[Bb]in/
[Oo]bj/
[Pp]ackages/
[Cc]omponents/
data/
.nuget/
.vs/
*.csproj.bak

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*

#NUNIT
*.VisualState.xml
TestResult.xml

# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c

*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc

# Chutzpah Test files
_Chutzpah*

# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile

# Visual Studio profiler
*.psess
*.vsp
*.vspx

# TFS 2012 Local Workspace
$tf/

# Guidance Automation Toolkit
*.gpState

# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding addin-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

# DotCover is a Code Coverage Tool
*.dotCover

# NCrunch
*.ncrunch*
_NCrunch_*
.*crunch*.local.xml

# MightyMoose
*.mm.*
AutoTest.Net/

# Web workbench (sass)
.sass-cache/

# Installshield output folder
[Ee]xpress/

# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html

# Click-Once directory
publish/

# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml

# Windows Azure Build Output
csx/
*.build.csdef

# Windows Store app package directory
AppPackages/

# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
.DS_Store

# RIA/Silverlight projects
Generated_Code/

# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm

# SQL Server files
*.mdf
*.ldf

# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings

# Microsoft Fakes
FakesAssemblies/
19 changes: 19 additions & 0 deletions Droid/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 your 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");
105 changes: 105 additions & 0 deletions Droid/CheckableFab.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
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.Util;
using Android.Views;
using Android.Widget;
using Android.Support.Design.Widget;
using Android.Graphics.Drawables;
using Android.Content.Res;
using Android.Animation;
using Android.Views.Animations;
using DrawableCompat = Android.Support.V4.Graphics.Drawable.DrawableCompat;

namespace NativeTest.Droid
{
public class CheckableFab : FloatingActionButton, ICheckable
{
static readonly int[] CheckedStateSet = {
Android.Resource.Attribute.StateChecked
};
bool chked;
Drawable.ConstantState imgState;

public CheckableFab(Context context) :
base(context)
{
Initialize(context, null);

}

public CheckableFab(Context context, IAttributeSet attrs) :
base(context, attrs)
{
Initialize(context, attrs);
}

public CheckableFab(Context context, IAttributeSet attrs, int defStyle) :
base(context, attrs, defStyle)
{
Initialize(context, attrs);
}

public CheckableFab(IntPtr handle, JniHandleOwnership own)
: base(handle, own)
{
}

void Initialize(Context context, IAttributeSet attrs)
{
//imgState = Drawable.GetConstantState();
}

public override void SetImageResource(int resId)
{
base.SetImageResource(resId);
imgState = Drawable.GetConstantState();
}

public override bool PerformClick()
{
Toggle();
return base.PerformClick();
}

public void Toggle()
{
JumpDrawablesToCurrentState();
/* AnimatedVectorDrawable unfortunately keep its VectorDrawable child in
* the same state everytime it re-runs animations instead of reset-ing.
* This means the animation is screwed up, so we simply reset the drawable
* everytime with a new copy
*/
SetImageDrawable(imgState.NewDrawable(Resources));
Checked = !Checked;
}

public bool Checked
{
get {
return chked;
}
set {
if (chked == value)
return;
chked = value;
RefreshDrawableState();
}
}

public override int[] OnCreateDrawableState(int extraSpace)
{
var space = extraSpace + (Checked ? CheckedStateSet.Length : 0);
var drawableState = base.OnCreateDrawableState(space);
if (Checked)
MergeDrawableStates(drawableState, CheckedStateSet);
return drawableState;
}
}
}
29 changes: 29 additions & 0 deletions Droid/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using System;

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

namespace NativeTest.Droid
{
[Activity(Label = "NativeTest.Droid", Icon = "@drawable/icon", Theme = "@style/MyTheme", 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());
}
}
}

Loading

0 comments on commit 58f9792

Please sign in to comment.