diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 13:02:25 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 16:13:41 -0700 |
commit | 17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch) | |
tree | b5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.ControlGallery.Android | |
download | xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2 xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip |
Initial import
Diffstat (limited to 'Xamarin.Forms.ControlGallery.Android')
38 files changed, 1384 insertions, 0 deletions
diff --git a/Xamarin.Forms.ControlGallery.Android/Activity1.cs b/Xamarin.Forms.ControlGallery.Android/Activity1.cs new file mode 100644 index 00000000..3426ce21 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Activity1.cs @@ -0,0 +1,412 @@ +using System; +using System.ComponentModel; +using System.Diagnostics; +using System.Reflection; + +using Android.App; +using Android.Content; +using Android.Content.PM; +using Android.Runtime; +using Android.Views; +using Android.Widget; +using Android.OS; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.Android; +using Xamarin.Forms.Controls; +using Xamarin.Forms.Maps.Android; +using Xamarin.Forms.Platform.Android; +using System.IO; +using System.IO.IsolatedStorage; + +using Droid = Android; + + +[assembly: Dependency (typeof (CacheService))] +[assembly: Dependency (typeof (TestCloudService))] +[assembly: Dependency (typeof (StringProvider))] +[assembly: ExportRenderer (typeof (DisposePage), typeof (DisposePageRenderer))] +[assembly: ExportRenderer (typeof (DisposeLabel), typeof (DisposeLabelRenderer))] +[assembly: ExportRenderer (typeof (CustomButton), typeof (CustomButtonRenderer))] +[assembly: ExportEffect (typeof (BorderEffect), "BorderEffect")] + +namespace Xamarin.Forms.ControlGallery.Android +{ + public class BorderEffect : PlatformEffect + { + protected override void OnAttached () + { + Control.SetBackgroundColor (global::Android.Graphics.Color.Aqua); + } + + protected override void OnDetached () + { + } + + protected override void OnElementPropertyChanged (PropertyChangedEventArgs args) + { + base.OnElementPropertyChanged (args); + } + } + + public class CacheService : ICacheService + { + public void ClearImageCache () + { + DeleteFilesInDirectory ("ImageLoaderCache"); + } + + static void DeleteFilesInDirectory (string directory) + { + using (IsolatedStorageFile isolatedStorage = IsolatedStorageFile.GetUserStoreForApplication ()) { + if (isolatedStorage.DirectoryExists (directory)) { + var files = isolatedStorage.GetFileNames (Path.Combine (directory, "*")); + foreach (string file in files) { + isolatedStorage.DeleteFile (Path.Combine (directory, file)); + } + } + } + } + } + + public class DisposePageRenderer : PageRenderer + { + protected override void Dispose (bool disposing) + { + if (disposing) { + ((DisposePage) Element).SendRendererDisposed (); + } + base.Dispose (disposing); + + } + } + + public class DisposeLabelRenderer : LabelRenderer + { + protected override void Dispose (bool disposing) + { + + if (disposing) { + ((DisposeLabel) Element).SendRendererDisposed (); + } + base.Dispose (disposing); + } + } + + public class StringProvider : IStringProvider + { + public string CoreGalleryTitle + { + get + { + return "Android CoreGallery"; + } + } + } + + public class TestCloudService : ITestCloudService + { + public bool IsOnTestCloud () + { + var isInTestCloud = System.Environment.GetEnvironmentVariable ("XAMARIN_TEST_CLOUD"); + + return isInTestCloud != null && isInTestCloud.Equals ("1"); + } + + public string GetTestCloudDeviceName () + { + return System.Environment.GetEnvironmentVariable ("XTC_DEVICE_NAME"); + } + + public string GetTestCloudDevice () + { + return System.Environment.GetEnvironmentVariable ("XTC_DEVICE"); + } + } + +#if PRE_APPLICATION_CLASS + [Activity (Label = "Control Gallery", + Icon = "@drawable/icon", + MainLauncher = true, + HardwareAccelerated = true, + ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + public class Activity1 : AndroidActivity + { + + + protected override void OnCreate (Bundle bundle) + { + base.OnCreate (bundle); + + Forms.Init (this, bundle); + FormsMaps.Init (this, bundle); + + SetPage (FormsApp.GetFormsApp ()); + + MessagingCenter.Subscribe<RootPagesGallery, Type> (this, Messages.ChangeRoot, (sender, pageType) => { + var page = ((Page)Activator.CreateInstance (pageType)); + SetPage (page); + }); + + MessagingCenter.Subscribe<RootPagesGallery, Type> (this, Messages.ChangeRoot, (sender, pageType) => { + var page = ((Page)Activator.CreateInstance (pageType)); + SetPage (page); + }); + + MessagingCenter.Subscribe<HomeButton> (this, Messages.GoHome, (sender) => { + var screen = FormsApp.GetFormsApp (); + SetPage (screen); + }); + } + + public override void OnConfigurationChanged (global::Android.Content.Res.Configuration newConfig) + { + // we're good + base.OnConfigurationChanged (newConfig); + } + + protected override void OnDestroy () + { + base.OnDestroy (); + } + } + +#elif FORMS_APPLICATION_ACTIVITY + [Activity(Label = "Control Gallery", + Icon = "@drawable/icon", + // Theme="@style/TestStyle", + MainLauncher = true, + HardwareAccelerated = true, + ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + + public class Activity1 : FormsApplicationActivity + { + protected override void OnCreate(Bundle bundle) + { + //ToolbarResource = Resource.Layout.Toolbar; + //TabLayoutResource = Resource.Layout.Tabbar; + + base.OnCreate(bundle); + + if (!Debugger.IsAttached) + Insights.Initialize(App.InsightsApiKey, this.ApplicationContext); + + Forms.Init(this, bundle); + FormsMaps.Init(this, bundle); + Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => { + if (!string.IsNullOrWhiteSpace(e.View.StyleId)) + { + e.NativeView.ContentDescription = e.View.StyleId; + } + }; + // uncomment to verify turning off title bar works. This is not intended to be dynamic really. + //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never); + + var app = new App (); + + var mdp = app.MainPage as MasterDetailPage; + var detail = mdp?.Detail as NavigationPage; + if (detail != null) { + detail.Pushed += (sender, args) => { + var nncgPage = args.Page as NestedNativeControlGalleryPage; + + if (nncgPage != null) { + AddNativeControls (nncgPage); + } + }; + } + + LoadApplication (app); + } + + private void AddNativeControls (NestedNativeControlGalleryPage page) + { + if (page.NativeControlsAdded) { + return; + } + + StackLayout sl = page.Layout; + + // Create and add a native TextView + var textView = new TextView (this) { Text = "I am a native TextView", TextSize = 14 }; + sl?.Children.Add (textView); + + // Create and add a native Button + var button = new global::Android.Widget.Button (this) { Text = "Click to change TextView font size" }; + float originalSize = textView.TextSize; + button.Click += (sender, args) => { textView.TextSize = textView.TextSize == originalSize ? 24 : 14; }; + + sl?.Children.Add (button.ToView ()); + + // Create a control which we know doesn't behave correctly with regard to measurement + var difficultControl0 = new BrokenNativeControl (this) { + Text = "This native control doesn't play nice with sizing, which is why it's all squished to one side." + }; + var difficultControl1 = new BrokenNativeControl (this) { + Text = "Same control, but with a custom GetDesiredSize delegate to accomodate it's sizing problems." + }; + + // Add a misbehaving control + sl?.Children.Add (difficultControl0); + + // Add a misbehaving control with a custom delegate for GetDesiredSize + sl?.Children.Add (difficultControl1, SizeBrokenControl); + + page.NativeControlsAdded = true; + } + + private static SizeRequest? SizeBrokenControl (NativeViewWrapperRenderer renderer, + int widthConstraint, int heightConstraint) + { + global::Android.Views.View nativeView = renderer.Control; + + if ((widthConstraint == 0 && heightConstraint == 0) || nativeView == null) { + return null; + } + + int width = global::Android.Views.View.MeasureSpec.GetSize (widthConstraint); + int widthSpec = global::Android.Views.View.MeasureSpec.MakeMeasureSpec (width * 2, + global::Android.Views.View.MeasureSpec.GetMode (widthConstraint)); + nativeView.Measure (widthSpec, heightConstraint); + var size = new Size (nativeView.MeasuredWidth, nativeView.MeasuredHeight); + return new SizeRequest (size); + } + + public override void OnConfigurationChanged(global::Android.Content.Res.Configuration newConfig) + { + // we're good + base.OnConfigurationChanged(newConfig); + } + + protected override void OnDestroy() + { + base.OnDestroy(); + } + } +#else + + [Activity (Label = "Control Gallery", + Icon = "@drawable/icon", + Theme = "@style/MyTheme", + MainLauncher = true, + HardwareAccelerated = true, + ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)] + [IntentFilter (new[] { Intent.ActionView }, + Categories = new[] + { + Intent.ActionView, + Intent.CategoryDefault, + Intent.CategoryBrowsable + }, + DataScheme = "http", + DataHost = App.AppName, + DataPathPrefix = "/gallery/" + ) + ] + public class Activity1 : FormsAppCompatActivity + { + protected override void OnCreate (Bundle bundle) + { + ToolbarResource = Resource.Layout.Toolbar; + TabLayoutResource = Resource.Layout.Tabbar; + + base.OnCreate (bundle); + + if (!Debugger.IsAttached) + Insights.Initialize (App.Secrets["InsightsApiKey"], ApplicationContext); + + Forms.Init (this, bundle); + FormsMaps.Init (this, bundle); + Forms.ViewInitialized += (sender, e) => { +// if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { +// e.NativeView.ContentDescription = e.View.StyleId; +// } + }; + // uncomment to verify turning off title bar works. This is not intended to be dynamic really. + //Forms.SetTitleBarVisibility (AndroidTitleBarVisibility.Never); + + var app = new App (); + + var mdp = app.MainPage as MasterDetailPage; + var detail = mdp?.Detail as NavigationPage; + if (detail != null) { + detail.Pushed += (sender, args) => { + var nncgPage = args.Page as NestedNativeControlGalleryPage; + + if (nncgPage != null) { + AddNativeControls (nncgPage); + } + }; + } + + LoadApplication (app); + } + + public override void OnConfigurationChanged (global::Android.Content.Res.Configuration newConfig) + { + // we're good + base.OnConfigurationChanged (newConfig); + } + + protected override void OnDestroy () + { + base.OnDestroy (); + } + + void AddNativeControls (NestedNativeControlGalleryPage page) + { + if (page.NativeControlsAdded) { + return; + } + + StackLayout sl = page.Layout; + + // Create and add a native TextView + var textView = new TextView (this) { Text = "I am a native TextView", TextSize = 14 }; + sl?.Children.Add (textView); + + // Create and add a native Button + var button = new global::Android.Widget.Button (this) { Text = "Click to change TextView font size" }; + float originalSize = textView.TextSize; + button.Click += (sender, args) => { + textView.TextSize = textView.TextSize == originalSize ? 24 : 14; + }; + + sl?.Children.Add (button.ToView ()); + + // Create a control which we know doesn't behave correctly with regard to measurement + var difficultControl0 = new BrokenNativeControl (this) { + Text = "This native control doesn't play nice with sizing, which is why it's all squished to one side." + }; + var difficultControl1 = new BrokenNativeControl (this) { + Text = "Same control, but with a custom GetDesiredSize delegate to accomodate it's sizing problems." + }; + + // Add a misbehaving control + sl?.Children.Add (difficultControl0); + + // Add a misbehaving control with a custom delegate for GetDesiredSize + sl?.Children.Add (difficultControl1, SizeBrokenControl); + + page.NativeControlsAdded = true; + } + + static SizeRequest? SizeBrokenControl (NativeViewWrapperRenderer renderer, + int widthConstraint, int heightConstraint) + { + global::Android.Views.View nativeView = renderer.Control; + + if ((widthConstraint == 0 && heightConstraint == 0) || nativeView == null) { + return null; + } + + int width = global::Android.Views.View.MeasureSpec.GetSize (widthConstraint); + int widthSpec = global::Android.Views.View.MeasureSpec.MakeMeasureSpec (width * 2, + global::Android.Views.View.MeasureSpec.GetMode (widthConstraint)); + nativeView.Measure (widthSpec, heightConstraint); + var size = new Size (nativeView.MeasuredWidth, nativeView.MeasuredHeight); + return new SizeRequest (size); + } + } +#endif +} + diff --git a/Xamarin.Forms.ControlGallery.Android/Assets/WebImages/XamarinLogo.png b/Xamarin.Forms.ControlGallery.Android/Assets/WebImages/XamarinLogo.png Binary files differnew file mode 100644 index 00000000..361e2782 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Assets/WebImages/XamarinLogo.png diff --git a/Xamarin.Forms.ControlGallery.Android/Assets/default.css b/Xamarin.Forms.ControlGallery.Android/Assets/default.css new file mode 100644 index 00000000..9e32b419 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Assets/default.css @@ -0,0 +1,2 @@ +html,body{margin:0;padding:10} +body,p,h1{font-family:Chalkduster;font-style: italic;}
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Assets/local.html b/Xamarin.Forms.ControlGallery.Android/Assets/local.html new file mode 100644 index 00000000..ccc9bec3 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Assets/local.html @@ -0,0 +1,10 @@ +<html> +<head> +<link rel="stylesheet" href="default.css"> +</head> +<body> +<h1 id="#LocalHtmlPage">Xamarin.Forms</h1> +<p>This is a local iOS Html page</p> +<a href="https://www.google.com">Go to Google</a> +</body> +</html>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/BrokenNativeControl.cs b/Xamarin.Forms.ControlGallery.Android/BrokenNativeControl.cs new file mode 100644 index 00000000..c75e7ca9 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/BrokenNativeControl.cs @@ -0,0 +1,60 @@ +using System; +using Android.Content; +using Android.Graphics; +using Android.Runtime; +using Android.Util; +using Android.Views; +using Android.Widget; + +namespace Xamarin.Forms.ControlGallery.Android +{ + /// <summary> + /// This is a custom Android control which deliberately does some incorrect measuring + /// </summary> + internal class BrokenNativeControl : TextView + { + bool _on; + + public BrokenNativeControl (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) + { + } + + public BrokenNativeControl (Context context) : base (context) + { + } + + public BrokenNativeControl (Context context, IAttributeSet attrs) : base (context, attrs) + { + } + + public BrokenNativeControl (Context context, IAttributeSet attrs, int defStyleAttr) + : base (context, attrs, defStyleAttr) + { + } + + public BrokenNativeControl (Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) + : base (context, attrs, defStyleAttr, defStyleRes) + { + } + + public override bool OnTouchEvent (MotionEvent e) + { + _on = !_on; + + SetTypeface (null, _on ? TypefaceStyle.Bold : TypefaceStyle.Normal); + + return base.OnTouchEvent (e); + } + + protected override void OnMeasure (int widthMeasureSpec, int heightMeasureSpec) + { + int width = MeasureSpec.GetSize (widthMeasureSpec); + + // Force the width to 1/2 of what's being requested. This is deliberately wrong so we can demo + // giving the LayoutExtensions an override to fix it with + int widthSpec = MeasureSpec.MakeMeasureSpec (width / 2, MeasureSpec.GetMode (widthMeasureSpec)); + + base.OnMeasure (widthSpec, heightMeasureSpec); + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs new file mode 100644 index 00000000..c8bfa1a4 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/CustomRenderers.cs @@ -0,0 +1,344 @@ +using System; +using Android.Widget; +using Android.App; +using System.Collections.Generic; +using Android.Views; +using System.Collections; +using System.Linq; +using Xamarin.Forms.Controls; +using Xamarin.Forms.Platform.Android; +using Xamarin.Forms; +using Xamarin.Forms.ControlGallery.Android; +using Android.Graphics.Drawables; +using System.Threading.Tasks; +using Android.Content; +using Android.Runtime; +using Android.Util; +using AButton = Android.Widget.Button; + +[assembly: ExportRenderer (typeof (Bugzilla31395.CustomContentView), typeof (CustomContentRenderer))] +[assembly: ExportRenderer (typeof (NativeListView), typeof (NativeListViewRenderer))] +[assembly: ExportRenderer (typeof (NativeListView2), typeof (NativeAndroidListViewRenderer))] +[assembly: ExportRenderer (typeof (NativeCell), typeof (NativeAndroidCellRenderer))] + +namespace Xamarin.Forms.ControlGallery.Android +{ + public class NativeListViewRenderer : ViewRenderer<NativeListView, global::Android.Widget.ListView> + { + public NativeListViewRenderer () + { + } + + protected override void OnElementChanged (ElementChangedEventArgs<NativeListView> e) + { + base.OnElementChanged (e); + + if (Control == null) { + SetNativeControl (new global::Android.Widget.ListView (Forms.Context)); + } + + if (e.OldElement != null) { + // unsubscribe + Control.ItemClick -= Clicked; + } + + if (e.NewElement != null) { + // subscribe + + Control.Adapter = new NativeListViewAdapter (Forms.Context as Activity, e.NewElement); + Control.ItemClick += Clicked; + } + } + + void Clicked (object sender, AdapterView.ItemClickEventArgs e) { + Element.NotifyItemSelected (Element.Items.ToList()[e.Position]); + } + + protected override void OnElementPropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + base.OnElementPropertyChanged (sender, e); + if (e.PropertyName == NativeListView.ItemsProperty.PropertyName) { + // update the Items list in the UITableViewSource + + Control.Adapter = new NativeListViewAdapter (Forms.Context as Activity, Element); + } + } + } + + public class NativeListViewAdapter: BaseAdapter<string> { + readonly Activity _context; + IList<string> _tableItems = new List<string>(); + + public IEnumerable<string> Items { + set { + _tableItems = value.ToList(); + } + } + + public NativeListViewAdapter(Activity context, NativeListView view) + { + _context = context; + _tableItems = view.Items.ToList(); + } + + public override string this[int position] + { + get + { + return _tableItems[position]; + } + } + + public override long GetItemId(int position) + { + return position; + } + + public override int Count + { + get { return _tableItems.Count; } + } + + public override global::Android.Views.View GetView(int position, global::Android.Views.View convertView, ViewGroup parent) + { + // Get our object for this position + var item = _tableItems[position]; + + var view = convertView; + if (view == null) { // no view to re-use, create new + view = _context.LayoutInflater.Inflate(global::Android.Resource.Layout.SimpleListItem1, null); + } + + view.FindViewById<TextView> (global::Android.Resource.Id.Text1).Text = item; + + return view; + } + } + + /// <summary> + /// This renderer uses a view defined in /Resources/Layout/NativeAndroidCell.axml + /// as the cell layout + /// </summary> + public class NativeAndroidCellRenderer : ViewCellRenderer + { + public NativeAndroidCellRenderer () + { + } + + protected override global::Android.Views.View GetCellCore (Cell item, global::Android.Views.View convertView, ViewGroup parent, Context context) + { + var x = (NativeCell)item; + + var view = convertView; + + if (view == null) {// no view to re-use, create new + view = (context as Activity).LayoutInflater.Inflate (Resource.Layout.NativeAndroidCell, null); + } else { // re-use, clear image + // doesn't seem to help + //view.FindViewById<ImageView> (Resource.Id.Image).Drawable.Dispose (); + } + + view.FindViewById<TextView>(Resource.Id.Text1).Text = x.Name; + view.FindViewById<TextView>(Resource.Id.Text2).Text = x.Category; + + // grab the old image and dispose of it + // TODO: optimize if the image is the *same* and we want to just keep it + if (view.FindViewById<ImageView> (Resource.Id.Image).Drawable != null) { + using (var image = view.FindViewById<ImageView> (Resource.Id.Image).Drawable as BitmapDrawable) { + if (image != null) { + if (image.Bitmap != null) { + //image.Bitmap.Recycle (); + image.Bitmap.Dispose (); + } + } + } + } + + // If a new image is required, display it + if (!string.IsNullOrWhiteSpace (x.ImageFilename)) { + context.Resources.GetBitmapAsync (x.ImageFilename).ContinueWith ((t) => { + var bitmap = t.Result; + if (bitmap != null) { + view.FindViewById<ImageView> (Resource.Id.Image).SetImageBitmap (bitmap); + bitmap.Dispose (); + } + }, TaskScheduler.FromCurrentSynchronizationContext() ); + + } else { + // clear the image + view.FindViewById<ImageView> (Resource.Id.Image).SetImageBitmap (null); + } + + return view; + } + } + + public class NativeAndroidListViewRenderer : ViewRenderer<NativeListView2, global::Android.Widget.ListView> + { + public NativeAndroidListViewRenderer () + { + } + + protected override void OnElementChanged (ElementChangedEventArgs<NativeListView2> e) + { + base.OnElementChanged (e); + + if (Control == null) { + SetNativeControl (new global::Android.Widget.ListView (Forms.Context)); + } + + if (e.OldElement != null) { + // unsubscribe + Control.ItemClick -= Clicked; + } + + if (e.NewElement != null) { + // subscribe + Control.Adapter = new NativeAndroidListViewAdapter (Forms.Context as Activity, e.NewElement); + Control.ItemClick += Clicked; + } + } + + // public override void Layout (int l, int t, int r, int b) + // { + // base.Layout (l, t, r, b); + // } + + void Clicked (object sender, AdapterView.ItemClickEventArgs e) { + Element.NotifyItemSelected (Element.Items.ToList()[e.Position]); + } + + protected override void OnElementPropertyChanged (object sender, System.ComponentModel.PropertyChangedEventArgs e) + { + base.OnElementPropertyChanged (sender, e); + if (e.PropertyName == NativeListView.ItemsProperty.PropertyName) { + // update the Items list in the UITableViewSource + + Control.Adapter = new NativeAndroidListViewAdapter (Forms.Context as Activity, Element); + } + } + } + + /// <summary> + /// This adapter uses a view defined in /Resources/Layout/NativeAndroidListViewCell.axml + /// as the cell layout + /// </summary> + public class NativeAndroidListViewAdapter : BaseAdapter<DataSource> { + readonly Activity _context; + IList<DataSource> _tableItems = new List<DataSource>(); + + public IEnumerable<DataSource> Items { + set { + _tableItems = value.ToList(); + } + } + + public NativeAndroidListViewAdapter(Activity context, NativeListView2 view) + { + _context = context; + _tableItems = view.Items.ToList(); + } + + public override DataSource this[int position] + { + get + { + return _tableItems[position]; + } + } + + public override long GetItemId(int position) + { + return position; + } + + public override int Count + { + get { return _tableItems.Count; } + } + + public override global::Android.Views.View GetView(int position, global::Android.Views.View convertView, ViewGroup parent) + { + var item = _tableItems[position]; + + var view = convertView; + if (view == null) {// no view to re-use, create new + view = _context.LayoutInflater.Inflate (Resource.Layout.NativeAndroidListViewCell, null); + } else { // re-use, clear image + // doesn't seem to help + //view.FindViewById<ImageView> (Resource.Id.Image).Drawable.Dispose (); + } + view.FindViewById<TextView>(Resource.Id.Text1).Text = item.Name; + view.FindViewById<TextView>(Resource.Id.Text2).Text = item.Category; + + // grab the old image and dispose of it + // TODO: optimize if the image is the *same* and we want to just keep it + if (view.FindViewById<ImageView> (Resource.Id.Image).Drawable != null) { + using (var image = view.FindViewById<ImageView> (Resource.Id.Image).Drawable as BitmapDrawable) { + if (image != null) { + if (image.Bitmap != null) { + //image.Bitmap.Recycle (); + image.Bitmap.Dispose (); + } + } + } + } + + // If a new image is required, display it + if (!string.IsNullOrWhiteSpace (item.ImageFilename)) { + _context.Resources.GetBitmapAsync (item.ImageFilename).ContinueWith ((t) => { + var bitmap = t.Result; + if (bitmap != null) { + view.FindViewById<ImageView> (Resource.Id.Image).SetImageBitmap (bitmap); + bitmap.Dispose (); + } + }, TaskScheduler.FromCurrentSynchronizationContext()); + } else { + // clear the image + view.FindViewById<ImageView> (Resource.Id.Image).SetImageBitmap (null); + } + + return view; + } + } + public class CustomContentRenderer : ViewRenderer + { + } + + public class CustomNativeButton : AButton + { + public CustomNativeButton (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) + { + } + + public CustomNativeButton (Context context) : base (context) + { + } + + public CustomNativeButton (Context context, IAttributeSet attrs) : base (context, attrs) + { + } + + public CustomNativeButton (Context context, IAttributeSet attrs, int defStyleAttr) : base (context, attrs, defStyleAttr) + { + } + + public CustomNativeButton (Context context, IAttributeSet attrs, int defStyleAttr, int defStyleRes) : base (context, attrs, defStyleAttr, defStyleRes) + { + } + } + + public class CustomButtonRenderer : ButtonRenderer + { + protected override void OnElementChanged (ElementChangedEventArgs<Button> e) + { + if(Control == null) { + CustomNativeButton b = new CustomNativeButton (Context); + SetNativeControl (b); + } + + base.OnElementChanged (e); + } + } +} + diff --git a/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml b/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml new file mode 100644 index 00000000..9bbcafdf --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Properties/AndroidManifest.xml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="AndroidControlGallery.AndroidControlGallery" android:installLocation="auto"> + <uses-sdk android:minSdkVersion="15" /> + <uses-permission android:name="android.permission.INTERNET" /> + <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> + <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" /> + <!-- The following two permissions are not required to use + Google Maps Android API v2, but are recommended. --> + <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> + <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> + <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> + <uses-permission android:name="android.permission.BATTERY_STATS" /> + <uses-permission android:name="android.permission.READ_PHONE_STATE" /> + <uses-permission android:name="android.permission.READ_LOGS" /> + <uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" /> + <uses-feature android:glEsVersion="0x00020000" android:required="true" /> + <application android:label="AndroidControlGallery"> + <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> + </application> +</manifest>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Properties/AssemblyInfo.cs b/Xamarin.Forms.ControlGallery.Android/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..61a74f21 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using Android.App; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle ("Xamarin.Forms.ControlGallery.Android")] +[assembly: AssemblyDescription ("")] +[assembly: AssemblyConfiguration ("")] +[assembly: AssemblyCompany ("")] +[assembly: AssemblyProduct ("Xamarin.Forms.ControlGallery.Android")] +[assembly: AssemblyCopyright ("Copyright © 2013")] +[assembly: AssemblyTrademark ("")] +[assembly: AssemblyCulture ("")] +[assembly: ComVisible (false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion ("1.0.0.0")] +[assembly: AssemblyFileVersion ("1.0.0.0")] + +// Add some common permissions, these can be removed if not needed +[assembly: UsesPermission (Android.Manifest.Permission.Internet)] +[assembly: UsesPermission (Android.Manifest.Permission.WriteExternalStorage)] + +[assembly: Android.App.MetaData("com.google.android.maps.v2.API_KEY", Value = "AIzaSyAdstcJQswxEjzX5YjLaMcu2aRVEBJw39Y")] +[assembly: Xamarin.Forms.ResolutionGroupName ("XamControl")] diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/AboutResources.txt b/Xamarin.Forms.ControlGallery.Android/Resources/AboutResources.txt new file mode 100644 index 00000000..10f52d46 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/AboutResources.txt @@ -0,0 +1,44 @@ +Images, layout descriptions, binary blobs and string dictionaries can be included +in your application as resource files. Various Android APIs are designed to +operate on the resource IDs instead of dealing with images, strings or binary blobs +directly. + +For example, a sample Android app that contains a user interface layout (main.axml), +an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png) +would keep its resources in the "Resources" directory of the application: + +Resources/ + drawable/ + icon.png + + layout/ + main.axml + + values/ + strings.xml + +In order to get the build system to recognize Android resources, set the build action to +"AndroidResource". The native Android APIs do not operate directly with filenames, but +instead operate on resource IDs. When you compile an Android application that uses resources, +the build system will package the resources for distribution and generate a class called "R" +(this is an Android convention) that contains the tokens for each one of the resources +included. For example, for the above Resources layout, this is what the R class would expose: + +public class R { + public class drawable { + public const int icon = 0x123; + } + + public class layout { + public const int main = 0x456; + } + + public class strings { + public const int first_string = 0xabc; + public const int second_string = 0xbcd; + } +} + +You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main +to reference the layout/main.axml file, or R.strings.first_string to reference the first +string in the dictionary file values/strings.xml. diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/CustomSelector.xml b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/CustomSelector.xml new file mode 100644 index 00000000..973f9480 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/CustomSelector.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="false" + android:state_selected="false" + android:drawable="@color/cellback" /> + <item android:state_pressed="true" > + <shape> + <gradient + android:startColor="#E77A26" + android:endColor="#E77A26" + android:angle="270" /> + </shape> + </item> + + <item android:state_selected="true" + android:state_pressed="false" + android:drawable="@color/cellback" /> +</selector>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/CustomSelector2.xml b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/CustomSelector2.xml new file mode 100644 index 00000000..efe02fa8 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/CustomSelector2.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_pressed="false" + android:state_selected="false" + android:drawable="@color/cellback2" /> + <item android:state_pressed="true" > + <shape> + <gradient + android:startColor="#E77A26" + android:endColor="#E77A26" + android:angle="270" /> + </shape> + </item> + + <item android:state_selected="true" + android:state_pressed="false" + android:drawable="@color/cellback2" /> +</selector>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/FlowerBuds.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/FlowerBuds.jpg Binary files differnew file mode 100644 index 00000000..023797cc --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/FlowerBuds.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Fruits.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Fruits.jpg Binary files differnew file mode 100644 index 00000000..6c4ea3d9 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Fruits.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Icon.png b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Icon.png Binary files differnew file mode 100644 index 00000000..a07c69fa --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Icon.png diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Legumes.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Legumes.jpg Binary files differnew file mode 100644 index 00000000..5f299b41 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Legumes.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Vegetables.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Vegetables.jpg Binary files differnew file mode 100644 index 00000000..297964d7 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/Vegetables.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/bank.png b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/bank.png Binary files differnew file mode 100644 index 00000000..fbf2947e --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/bank.png diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/calculator.png b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/calculator.png Binary files differnew file mode 100644 index 00000000..339cab59 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/calculator.png diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/coffee.png b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/coffee.png Binary files differnew file mode 100644 index 00000000..350257c0 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/coffee.png diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/cover1.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/cover1.jpg Binary files differnew file mode 100644 index 00000000..f2cea334 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/cover1.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/cover1small.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/cover1small.jpg Binary files differnew file mode 100644 index 00000000..c820c471 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/cover1small.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/crimson.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/crimson.jpg Binary files differnew file mode 100644 index 00000000..3db7bb21 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/crimson.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/crimsonsmall.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/crimsonsmall.jpg Binary files differnew file mode 100644 index 00000000..426c5e07 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/crimsonsmall.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/menuIcon.png b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/menuIcon.png Binary files differnew file mode 100644 index 00000000..0793dc7b --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/menuIcon.png diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/oasis.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/oasis.jpg Binary files differnew file mode 100644 index 00000000..078a6e09 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/oasis.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/oasissmall.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/oasissmall.jpg Binary files differnew file mode 100644 index 00000000..f8d43821 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/oasissmall.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/photo.jpg b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/photo.jpg Binary files differnew file mode 100644 index 00000000..07fd4b0a --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/photo.jpg diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/seth.png b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/seth.png Binary files differnew file mode 100644 index 00000000..568360e8 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/seth.png diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/drawable/toolbar_close.png b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/toolbar_close.png Binary files differnew file mode 100644 index 00000000..12f82abb --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/drawable/toolbar_close.png diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/layout/NativeAndroidCell.axml b/Xamarin.Forms.ControlGallery.Android/Resources/layout/NativeAndroidCell.axml new file mode 100644 index 00000000..541dc07b --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/layout/NativeAndroidCell.axml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:padding="8dp" + android:background="@drawable/CustomSelector"> + <LinearLayout + android:id="@+id/Text" + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingLeft="10dip"> + <TextView + android:id="@+id/Text1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="#FF7F3300" + android:textSize="20dip" + android:textStyle="italic" /> + <TextView + android:id="@+id/Text2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="14dip" + android:textColor="#FF267F00" + android:paddingLeft="100dip" /> + </LinearLayout> + <ImageView + android:id="@+id/Image" + android:layout_width="48dp" + android:layout_height="48dp" + android:padding="5dp" + android:src="@drawable/icon" + android:layout_alignParentRight="true" /> +</RelativeLayout>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/layout/NativeAndroidListViewCell.axml b/Xamarin.Forms.ControlGallery.Android/Resources/layout/NativeAndroidListViewCell.axml new file mode 100644 index 00000000..4c79bea8 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/layout/NativeAndroidListViewCell.axml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:padding="8dp" + android:background="@drawable/CustomSelector2"> + <LinearLayout + android:id="@+id/Text" + android:orientation="vertical" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:paddingLeft="10dip"> + <TextView + android:id="@+id/Text1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textColor="#FF7F3300" + android:textSize="20dip" + android:textStyle="italic" /> + <TextView + android:id="@+id/Text2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:textSize="14dip" + android:textColor="#FF267F00" + android:paddingLeft="100dip" /> + </LinearLayout> + <ImageView + android:id="@+id/Image" + android:layout_width="48dp" + android:layout_height="48dp" + android:padding="5dp" + android:src="@drawable/icon" + android:layout_alignParentRight="true" /> +</RelativeLayout>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/layout/Tabbar.axml b/Xamarin.Forms.ControlGallery.Android/Resources/layout/Tabbar.axml new file mode 100644 index 00000000..97cb27ad --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/layout/Tabbar.axml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<android.support.design.widget.TabLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/sliding_tabs" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/colorPrimary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:tabIndicatorColor="@android:color/white" + app:tabGravity="fill" + app:tabMode="fixed" />
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/layout/Toolbar.axml b/Xamarin.Forms.ControlGallery.Android/Resources/layout/Toolbar.axml new file mode 100644 index 00000000..3a1989a8 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/layout/Toolbar.axml @@ -0,0 +1,8 @@ +<android.support.v7.widget.Toolbar + xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/toolbar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="?attr/colorPrimary" + android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + android:popupTheme="@style/ThemeOverlay.AppCompat.Light" /> diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/values/Colors.xml b/Xamarin.Forms.ControlGallery.Android/Resources/values/Colors.xml new file mode 100644 index 00000000..8b96fc81 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/values/Colors.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <color name="cellback">#FFFFFFE0</color> + <color name="cellback2">#FFDAFF7F</color> +</resources>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Resources/values/styles.xml b/Xamarin.Forms.ControlGallery.Android/Resources/values/styles.xml new file mode 100644 index 00000000..971153df --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Resources/values/styles.xml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<resources> + <color name="custom_theme_color">#FF0000</color> + <style name="FormsTheme" parent="android:Theme.Holo.Light"> + <item name="android:windowActionBar">true</item> + <item name="android:windowBackground">@color/custom_theme_color</item> + </style> + + <style name="MyTheme" parent="MyTheme.Base"> + </style> + <!-- Base theme applied no matter what API --> + <style name="MyTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar"> + <!--If you are using revision 22.1 please use just windowNoTitle. Without android:--> + <item name="windowNoTitle">true</item> + <!--We will be using the toolbar so no need to show ActionBar--> + <item name="windowActionBar">false</item> + <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette--> + <!-- colorPrimary is used for the default action bar background --> + <item name="colorPrimary">#2196F3</item> + <!-- colorPrimaryDark is used for the status bar --> + <item name="colorPrimaryDark">#1976D2</item> + <!-- colorAccent is used as the default value for colorControlActivated + which is used to tint widgets --> + <item name="colorAccent">#FF4081</item> + <!-- You can also set colorControlNormal, colorControlActivated + colorControlHighlight and colorSwitchThumbNormal. --> + <item name="windowActionModeOverlay">true</item> + + <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item> + </style> + + <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog"> + <item name="colorAccent">#FF4081</item> + </style> + + <style name="TestStyle" parent="@android:style/Theme.Holo.Light.DarkActionBar"> + </style> +</resources>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj new file mode 100644 index 00000000..ff23e911 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj @@ -0,0 +1,260 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>8.0.30703</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{1346A7F1-4457-4BB4-A371-2C8E28BBD53E}</ProjectGuid> + <ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>Xamarin.Forms.ControlGallery.Android</RootNamespace> + <AssemblyName>Xamarin.Forms.ControlGallery.Android</AssemblyName> + <FileAlignment>512</FileAlignment> + <AndroidApplication>true</AndroidApplication> + <AndroidResgenFile>Resources\Resource.Designer.cs</AndroidResgenFile> + <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> + <TargetFrameworkVersion>v6.0</TargetFrameworkVersion> + <AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest> + <AndroidSupportedAbis>armeabi-v7a,x86</AndroidSupportedAbis> + <AndroidStoreUncompressedFileExtensions /> + <MandroidI18n /> + <JavaOptions /> + <AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk> + <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir> + <RestorePackages>true</RestorePackages> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)' == 'Debug'"> + <AndroidKeyStore>True</AndroidKeyStore> + <AndroidSigningKeyStore>$(SolutionDir)debug.keystore</AndroidSigningKeyStore> + <AndroidSigningStorePass>android</AndroidSigningStorePass> + <AndroidSigningKeyAlias>androiddebugkey</AndroidSigningKeyAlias> + <AndroidSigningKeyPass>android</AndroidSigningKeyPass> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>True</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>TRACE;DEBUG</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime> + <AndroidLinkMode>Full</AndroidLinkMode> + <JavaMaximumHeapSize>1G</JavaMaximumHeapSize> + <AndroidLinkSkip /> + <EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk> + <BundleAssemblies>False</BundleAssemblies> + <CustomCommands> + <CustomCommands> + <Command type="AfterBuild" command="xbuild /t:SignAndroidPackage Xamarin.Forms.ControlGallery.Android/Xamarin.Forms.ControlGallery.Android.csproj" workingdir="${SolutionDir}" /> + </CustomCommands> + </CustomCommands> + <AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi> + <AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis> + <AndroidStoreUncompressedFileExtensions /> + <MandroidI18n /> + <Debugger>Xamarin</Debugger> + <AndroidEnableMultiDex>False</AndroidEnableMultiDex> + <DevInstrumentationEnabled>True</DevInstrumentationEnabled> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + <AndroidUseSharedRuntime>False</AndroidUseSharedRuntime> + <AndroidLinkMode>SdkOnly</AndroidLinkMode> + <JavaMaximumHeapSize>1G</JavaMaximumHeapSize> + <AndroidLinkSkip /> + <EmbedAssembliesIntoApk>True</EmbedAssembliesIntoApk> + <BundleAssemblies>False</BundleAssemblies> + <AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi> + <AndroidSupportedAbis>armeabi-v7a,x86</AndroidSupportedAbis> + <AndroidStoreUncompressedFileExtensions /> + <MandroidI18n /> + <JavaOptions /> + <MonoDroidExtraArgs /> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Turkey|AnyCPU'"> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\Turkey\</OutputPath> + <DefineConstants>TRACE;DEBUG</DefineConstants> + <DebugType>full</DebugType> + <PlatformTarget>AnyCPU</PlatformTarget> + <GenerateSerializationAssemblies>Off</GenerateSerializationAssemblies> + <ErrorReport>prompt</ErrorReport> + <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet> + <AndroidUseSharedRuntime>True</AndroidUseSharedRuntime> + <AndroidLinkSkip /> + <AndroidLinkMode>SdkOnly</AndroidLinkMode> + <EmbedAssembliesIntoApk>False</EmbedAssembliesIntoApk> + <BundleAssemblies>False</BundleAssemblies> + <AndroidCreatePackagePerAbi>False</AndroidCreatePackagePerAbi> + <AndroidSupportedAbis>armeabi,armeabi-v7a,x86</AndroidSupportedAbis> + <AndroidStoreUncompressedFileExtensions /> + <MandroidI18n /> + <JavaMaximumHeapSize>1G</JavaMaximumHeapSize> + <Debugger>Xamarin</Debugger> + <AndroidEnableMultiDex>False</AndroidEnableMultiDex> + <DevInstrumentationEnabled>True</DevInstrumentationEnabled> + </PropertyGroup> + <ItemGroup> + <Reference Include="Mono.Android" /> + <Reference Include="mscorlib" /> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Xml" /> + <Reference Include="Xamarin.Android.Support.Design, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.Android.Support.Design.23.1.1.1\lib\MonoAndroid403\Xamarin.Android.Support.Design.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.Android.Support.v4.23.1.1.1\lib\MonoAndroid403\Xamarin.Android.Support.v4.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.Android.Support.v7.AppCompat.23.1.1.1\lib\MonoAndroid403\Xamarin.Android.Support.v7.AppCompat.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v7.CardView, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.Android.Support.v7.CardView.23.1.1.1\lib\MonoAndroid403\Xamarin.Android.Support.v7.CardView.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v7.MediaRouter, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.Android.Support.v7.MediaRouter.23.1.1.1\lib\MonoAndroid403\Xamarin.Android.Support.v7.MediaRouter.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Android.Support.v7.RecyclerView, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.Android.Support.v7.RecyclerView.23.1.1.1\lib\MonoAndroid403\Xamarin.Android.Support.v7.RecyclerView.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.GooglePlayServices.AppIndexing, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.GooglePlayServices.AppIndexing.29.0.0.1\lib\MonoAndroid41\Xamarin.GooglePlayServices.AppIndexing.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.GooglePlayServices.Base, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.GooglePlayServices.Base.29.0.0.1\lib\MonoAndroid41\Xamarin.GooglePlayServices.Base.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.GooglePlayServices.Basement, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.GooglePlayServices.Basement.29.0.0.1\lib\MonoAndroid41\Xamarin.GooglePlayServices.Basement.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.GooglePlayServices.Maps, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.GooglePlayServices.Maps.29.0.0.1\lib\MonoAndroid41\Xamarin.GooglePlayServices.Maps.dll</HintPath> + <Private>True</Private> + </Reference> + <Reference Include="Xamarin.Insights, Version=1.11.0.0, Culture=neutral, processorArchitecture=MSIL"> + <HintPath>..\packages\Xamarin.Insights.1.11.4\lib\MonoAndroid10\Xamarin.Insights.dll</HintPath> + <Private>True</Private> + </Reference> + </ItemGroup> + <ItemGroup> + <Compile Include="Activity1.cs" /> + <Compile Include="BrokenNativeControl.cs" /> + <Compile Include="Properties\MapsKey.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="Resources\Resource.Designer.cs" /> + <Compile Include="CustomRenderers.cs" /> + </ItemGroup> + <ItemGroup> + <AndroidAsset Include="Assets\default.css" /> + <AndroidResource Include="Resources\drawable\bank.png" /> + <AndroidResource Include="Resources\drawable\crimson.jpg" /> + <AndroidResource Include="Resources\drawable\oasis.jpg" /> + <AndroidResource Include="Resources\drawable\cover1small.jpg" /> + <AndroidResource Include="Resources\drawable\crimsonsmall.jpg" /> + <AndroidResource Include="Resources\drawable\oasissmall.jpg" /> + <AndroidResource Include="Resources\drawable\calculator.png" /> + <AndroidResource Include="Resources\drawable\seth.png" /> + <AndroidResource Include="Resources\drawable\menuIcon.png" /> + <AndroidResource Include="Resources\drawable\photo.jpg" /> + <AndroidAsset Include="Assets\WebImages\XamarinLogo.png" /> + <AndroidAsset Include="Assets\local.html" /> + <AndroidResource Include="Resources\values\Colors.xml" /> + <AndroidResource Include="Resources\layout\NativeAndroidCell.axml" /> + <AndroidResource Include="Resources\layout\NativeAndroidListViewCell.axml" /> + <AndroidResource Include="Resources\drawable\CustomSelector.xml" /> + <AndroidResource Include="Resources\drawable\CustomSelector2.xml" /> + <AndroidResource Include="Resources\drawable\FlowerBuds.jpg" /> + <AndroidResource Include="Resources\drawable\Fruits.jpg" /> + <AndroidResource Include="Resources\drawable\Legumes.jpg" /> + <AndroidResource Include="Resources\drawable\Vegetables.jpg" /> + <AndroidResource Include="Resources\values\styles.xml" /> + <AndroidResource Include="Resources\drawable\coffee.png" /> + <AndroidResource Include="Resources\drawable\toolbar_close.png" /> + </ItemGroup> + <ItemGroup> + <AndroidResource Include="Resources\drawable\Icon.png" /> + <AndroidResource Include="Resources\drawable\cover1.jpg" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Stubs\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android %28Forwarders%29.csproj"> + <Project>{6e53feb1-1100-46ae-8013-17bba35cc197}</Project> + <Name>Xamarin.Forms.Platform.Android %28Forwarders%29</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Controls\Xamarin.Forms.Controls.csproj"> + <Project>{cb9c96ce-125c-4a68-b6a1-c3ff1fbf93e1}</Project> + <Name>Xamarin.Forms.Controls</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.CustomAttributes\Xamarin.Forms.CustomAttributes.csproj"> + <Project>{4dcd0420-1168-4b77-86db-6196ee4bd491}</Project> + <Name>Xamarin.Forms.CustomAttributes</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Maps.Android\Xamarin.Forms.Maps.Android.csproj"> + <Project>{bd50b39a-ebc5-408f-9c5e-923a8ebae473}</Project> + <Name>Xamarin.Forms.Maps.Android</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Maps\Xamarin.Forms.Maps.csproj"> + <Project>{7d13bac2-c6a4-416a-b07e-c169b199e52b}</Project> + <Name>Xamarin.Forms.Maps</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Platform.Android.FormsViewGroup\Xamarin.Forms.Platform.Android.FormsViewGroup.csproj"> + <Project>{3b72465b-acae-43ae-9327-10f372fe5f80}</Project> + <Name>Xamarin.Forms.Platform.Android.FormsViewGroup</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Platform.Android\Xamarin.Forms.Platform.Android.csproj"> + <Project>{0e16e70a-d6dd-4323-ad5d-363abff42d6a}</Project> + <Name>Xamarin.Forms.Platform.Android</Name> + </ProjectReference> + <ProjectReference Include="..\Xamarin.Forms.Core\Xamarin.Forms.Core.csproj"> + <Project>{57B8B73D-C3B5-4C42-869E-7B2F17D354AC}</Project> + <Name>Xamarin.Forms.Core</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <None Include="app.config" /> + <None Include="packages.config" /> + <AndroidResource Include="Resources\layout\Toolbar.axml"> + <SubType>Designer</SubType> + </AndroidResource> + <AndroidResource Include="Resources\layout\Tabbar.axml"> + <SubType>Designer</SubType> + </AndroidResource> + </ItemGroup> + <ItemGroup> + <TransformFile Include="Properties\AndroidManifest.xml" /> + </ItemGroup> + <Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" /> + <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> + <Import Project="..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets')" /> + <!-- To modify your build process, add your task inside one of the targets below and uncomment it. + Other similar extension points exist, see Microsoft.Common.targets. + <Target Name="BeforeBuild"> + </Target> + <Target Name="AfterBuild"> + </Target> + --> + <Import Project="..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets" Condition="Exists('..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets')" /> + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> + <PropertyGroup> + <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> + </PropertyGroup> + <Error Condition="!Exists('..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Xamarin.Insights.1.11.4\build\MonoAndroid10\Xamarin.Insights.targets'))" /> + </Target> +</Project>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/app.config b/Xamarin.Forms.ControlGallery.Android/app.config new file mode 100644 index 00000000..b1d2a5a3 --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/app.config @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<configuration> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Mono.Cecil" publicKeyToken="0738eb9f132ed756" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-0.9.6.0" newVersion="0.9.6.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration>
\ No newline at end of file diff --git a/Xamarin.Forms.ControlGallery.Android/packages.config b/Xamarin.Forms.ControlGallery.Android/packages.config new file mode 100644 index 00000000..f900edac --- /dev/null +++ b/Xamarin.Forms.ControlGallery.Android/packages.config @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8"?> +<packages> + <package id="Xamarin.Android.Support.Design" version="23.1.1.1" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v4" version="23.1.1.1" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v7.AppCompat" version="23.1.1.1" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v7.CardView" version="23.1.1.1" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v7.MediaRouter" version="23.1.1.1" targetFramework="monoandroid60" /> + <package id="Xamarin.Android.Support.v7.RecyclerView" version="23.1.1.1" targetFramework="monoandroid60" /> + <package id="Xamarin.GooglePlayServices.AppIndexing" version="29.0.0.1" targetFramework="monoandroid60" /> + <package id="Xamarin.GooglePlayServices.Base" version="29.0.0.1" targetFramework="monoandroid60" /> + <package id="Xamarin.GooglePlayServices.Basement" version="29.0.0.1" targetFramework="monoandroid60" /> + <package id="Xamarin.GooglePlayServices.Maps" version="29.0.0.1" targetFramework="monoandroid60" /> + <package id="Xamarin.Insights" version="1.11.4" targetFramework="MonoAndroid60" /> +</packages>
\ No newline at end of file |