From c7f6548346c38022540ef9e5244417e09db69e4a Mon Sep 17 00:00:00 2001 From: Satoshi Nakamura Date: Sat, 24 Aug 2019 21:00:46 +0900 Subject: [PATCH] Fix init method name / readme --- AiForms.Effects.Droid/Initialize.cs | 2 +- README-ja.md | 19 +++++++++++++--- README.md | 22 +++++++++++++++---- .../AiEffects.TestApp.Droid/MainActivity.cs | 1 + 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/AiForms.Effects.Droid/Initialize.cs b/AiForms.Effects.Droid/Initialize.cs index b300930..dc6e51c 100644 --- a/AiForms.Effects.Droid/Initialize.cs +++ b/AiForms.Effects.Droid/Initialize.cs @@ -3,7 +3,7 @@ namespace AiForms.Effects.Droid { [Preserve(AllMembers = true)] - public static class Initialize + 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)) {