diff --git a/AiForms.Effects.Droid/AiForms.Effects.Droid.csproj b/AiForms.Effects.Droid/AiForms.Effects.Droid.csproj index 03d5edc..2c1b9a3 100644 --- a/AiForms.Effects.Droid/AiForms.Effects.Droid.csproj +++ b/AiForms.Effects.Droid/AiForms.Effects.Droid.csproj @@ -206,6 +206,7 @@ + diff --git a/AiForms.Effects.Droid/Initialize.cs b/AiForms.Effects.Droid/Initialize.cs new file mode 100644 index 0000000..dc6e51c --- /dev/null +++ b/AiForms.Effects.Droid/Initialize.cs @@ -0,0 +1,10 @@ +using System; +using Android.Runtime; +namespace AiForms.Effects.Droid +{ + [Preserve(AllMembers = true)] + public static class Effects + { + public static void Init() { } + } +} diff --git a/README-ja.md b/README-ja.md index 9c8b7ba..6f647d1 100644 --- a/README-ja.md +++ b/README-ja.md @@ -83,16 +83,29 @@ iOSで使用するために、AppDelegate.csに以下のようなコードの追 ```csharp public override bool FinishedLaunching(UIApplication app, NSDictionary options) { + global::Xamarin.Forms.Forms.Init(); - AiForms.Effects.iOS.Effects.Init(); //need to write here - LoadApplication(new App(new iOSInitializer())); - return base.FinishedLaunching(app, options); } ``` +### Android プロジェクト + +MainActivity.cs に以下のようなコードを追記します。 + +```csharp +protected override void OnCreate(Bundle bundle) { + + base.OnCreate(bundle); + + global::Xamarin.Forms.Forms.Init(this, bundle); + AiForms.Effects.Droid.Effects.Init(); //need to write here + ... +} +``` + ## Floating ページの上の任意の場所に複数のフローティングView (Floating Action Buttonなど) を配置するEffectです。 diff --git a/README.md b/README.md index e999f1f..d38eebc 100644 --- a/README.md +++ b/README.md @@ -85,20 +85,34 @@ You need to install this nuget package to .NETStandard project and each platform ### for iOS project -To use by iOS, you need to write the following code in AppDelegate.cs. +You need to write the following code in AppDelegate.cs: ```csharp public override bool FinishedLaunching(UIApplication app, NSDictionary options) { + global::Xamarin.Forms.Forms.Init(); - AiForms.Effects.iOS.Effects.Init(); //need to write here - LoadApplication(new App(new iOSInitializer())); - + ... return base.FinishedLaunching(app, options); } ``` +### for Android project + +You need to write the following code in MainActivity.cs: + +```csharp +protected override void OnCreate(Bundle bundle) { + + base.OnCreate(bundle); + + global::Xamarin.Forms.Forms.Init(this, bundle); + AiForms.Effects.Droid.Effects.Init(); //need to write here + ... +} +``` + ## Floating This is the effect that arranges some floating views (e.g. FAB) at any place on a page. diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/MainActivity.cs b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/MainActivity.cs index 85eac71..f9c9750 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/MainActivity.cs +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/MainActivity.cs @@ -18,6 +18,7 @@ protected override void OnCreate(Bundle bundle) { global::Xamarin.Forms.Forms.SetFlags("FastRenderers_Experimental"); global::Xamarin.Forms.Forms.Init(this, bundle); + AiForms.Effects.Droid.Effects.Init(); Xamarin.Forms.Forms.ViewInitialized += (object sender, Xamarin.Forms.ViewInitializedEventArgs e) => { if (!string.IsNullOrWhiteSpace(e.View.AutomationId)) { diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ViewCellPageViewModel.cs b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ViewCellPageViewModel.cs index 0817db5..ca77173 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ViewCellPageViewModel.cs +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ViewCellPageViewModel.cs @@ -12,7 +12,7 @@ public class ViewCellPageViewModel public ViewCellPageViewModel(INavigationService navigationService, IPageDialogService pageDlg) { - for (var i = 0; i < 20;i++){ + for (var i = 0; i < 40;i++){ ItemsSource.Add("Name"); } diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ViewCellPage.xaml b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ViewCellPage.xaml index e931687..5b5ab52 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ViewCellPage.xaml +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ViewCellPage.xaml @@ -3,6 +3,7 @@ xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:ef="clr-namespace:AiForms.Effects;assembly=AiForms.Effects" + xmlns:sv="clr-namespace:AiForms.Renderers;assembly=SettingsView" x:Class="AiEffects.TestApp.Views.ViewCellPage"> diff --git a/nuget/AzurePipelines.nuspec b/nuget/AzurePipelines.nuspec index fe7982c..ce9ee7a 100644 --- a/nuget/AzurePipelines.nuspec +++ b/nuget/AzurePipelines.nuspec @@ -12,7 +12,11 @@ false Xamarin.Forms Effects(add Border / add placeholder / add Text / add Command / add NumberPicker, TimePicker and DatePicker / alter color for switch and slider / alter LineHeight of Label and Editor / Button to flat / Size to fit for Label / add touch events / Floating / Feedback) for iOS / Android - + +## Changes + +* Add the Android platform init method. + ## Bug fixes * AlterColor – Slider thumb color isn't changed.