diff --git a/FloatingViewLib/src/main/java/com/ufreedom/floatingview/Floating.java b/FloatingViewLib/src/main/java/com/ufreedom/floatingview/Floating.java index 521f29eabd7ce300652e212de935a3077f1c2589..17152ffea12feec73bd508d5ed4bf6934c6a848c 100644 --- a/FloatingViewLib/src/main/java/com/ufreedom/floatingview/Floating.java +++ b/FloatingViewLib/src/main/java/com/ufreedom/floatingview/Floating.java @@ -38,27 +38,27 @@ import ohos.app.Context; public class Floating { private StackLayout mFloatingDecorView; private SpringSystem mSpringSystem; - private AbilitySlice activity; + private AbilitySlice mAbility; /** * Floating * - * @param activity + * @param ability * @param topComponent 传递顶层View - * @throws NullPointerException Activity should not be null + * @throws NullPointerException Ability should not be null */ - public Floating(AbilitySlice activity, Component topComponent) { - this.activity = activity; - if (activity == null) { - throw new NullPointerException("Activity should not be null"); + public Floating(AbilitySlice ability, Component topComponent) { + this.mAbility = ability; + if (ability == null) { + throw new NullPointerException("Ability should not be null"); } - mFloatingDecorView = new FloatingDecorView(activity); + mFloatingDecorView = new FloatingDecorView(ability); mFloatingDecorView.setLayoutConfig(new StackLayout.LayoutConfig(StackLayout.LayoutConfig.MATCH_PARENT, StackLayout.LayoutConfig.MATCH_PARENT)); - activity.setUIContent(ResourceTable.Layout_floating_fecor_view); - ComponentContainer rootView = (ComponentContainer) activity.findComponentById(ResourceTable.Id_root_view); + ability.setUIContent(ResourceTable.Layout_floating_fecor_view); + ComponentContainer rootView = (ComponentContainer) ability.findComponentById(ResourceTable.Id_root_view); rootView.addComponent(topComponent); rootView.addComponent(mFloatingDecorView); if (mSpringSystem == null) { diff --git a/README.md b/README.md index 1a700a86d6ffcd83d0fdc5368581c725092c57a5..035513da5e17cbdcbd5c3b39ae31a3d294c16950 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ ``` 创建一个 `Floating` 作为 `FloatingElement` 的容器,然后让你的 `Component` 飞起来 ```java - Floating floating = new Floating(AbilitySlice activity, Component topComponent); + Floating floating = new Floating(AbilitySlice ability, Component topComponent); floating.startFloating(builder); ``` 实现漂浮动画很简单,你只需要实现 `FloatingTransition` 接口就可以 diff --git a/entry/build.gradle b/entry/build.gradle index ec23571bfcf8deb9e086a7ca67c98144668bf835..53d155314ae57df456dc8e120506ac0d72004515 100644 --- a/entry/build.gradle +++ b/entry/build.gradle @@ -12,6 +12,7 @@ dependencies { testImplementation 'junit:junit:4.13' ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100' implementation('com.gitee.chinasoft_ohos:FloatingView:0.0.1-SNAPSHOT') +// implementation project(':FloatingViewLib') } decc { supportType = ['html','xml']