diff --git a/README.OPENSOURCE b/README.OPENSOURCE index 276718a30b105db808b6932eae4c077a83c607d0..867f3bc081c1e8353f2282eb2ae41c15e9528605 100644 --- a/README.OPENSOURCE +++ b/README.OPENSOURCE @@ -1,8 +1,8 @@ [ { "Name": "tootips", - "License": " 无 ", - "License File": " 无 ", + "License": " APACHE LICENSE ", + "License File": " LICENSE ", "Version Number": " 1.1.0 ", "Upstream URL": " https://github.com/tomergoldst/tooltips", "Description": " Simple to use library for ohos, Enabling to add a tooltip near any view with ease " diff --git a/README.md b/README.md index 7ce1a14fec85c26adbb7190e76b82b5867929908..b2bdea48bc9f1b6b75feb1d5fd278f0dcab30124 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ - 功能:易于使用的ohos库,可轻松在任何视图附近添加工具提示 - 项目移植状态:主功能完成 - 调用差异:无 -- 开发版本:sdk5,DevEco Studio 2.1 Release +- 开发版本:sdk6,DevEco Studio 2.2 Beta1 - 基线版本:Release v1.1.0 @@ -31,7 +31,7 @@ allprojects { ...... } ``` -在sdk5,DevEco Studio 2.1 Release下项目可直接运行, +在sdk6,DevEco Studio 2.2 Beta1下项目可直接运行, 如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件, @@ -113,7 +113,7 @@ CodeCheck代码测试无异常 CloudTest代码测试无异常 -火绒安全病毒安全检测通过 +病毒安全检测通过 当前版本demo功能与原组件基本无差异 ``` diff --git a/app/build.gradle b/app/build.gradle index d2e1bbaf027e949819df698b740e2773e7979712..71bc1e1de47f2ebcbdbe22d113795745474d89b3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,7 +1,7 @@ apply plugin: 'com.huawei.ohos.hap' apply plugin: 'com.huawei.ohos.decctest' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } diff --git a/app/src/main/config.json b/app/src/main/config.json index d40e96058ff1d775fb5859d9431c1d1e741821c9..6e8787aaa9b3801e348dd57f5d64eea878580cbf 100644 --- a/app/src/main/config.json +++ b/app/src/main/config.json @@ -5,11 +5,6 @@ "version": { "code": 1, "name": "1.0" - }, - "apiVersion": { - "compatible": 5, - "target": 5, - "releaseType": "Release" } }, "deviceConfig": {}, diff --git a/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbilitySlice.java b/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbilitySlice.java index 160bb4e3b9320437953e52c379ccb5bf0558feac..accfbd19a47da7b2988759de83da29f3f4623eb4 100644 --- a/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbilitySlice.java +++ b/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbilitySlice.java @@ -270,9 +270,9 @@ public class MainAbilitySlice extends AbilitySlice implements // button above position private void buttonAbovePositionInit() { dlInitLayout.setVisibility(Component.VISIBLE); - float leftAbovey = mTextView.getContentPositionY() - idAboveImageview.getEstimatedHeight(); - float leftAbovex = mTextView.getContentPositionX() + mTextView.getEstimatedWidth() / 2 - idAboveImageview.getEstimatedWidth() / 2; - idAboveImageview.setContentPosition(leftAbovex, leftAbovey); + double leftAbovey = (double) mTextView.getContentPositionY() - (double)idAboveImageview.getEstimatedHeight(); + double leftAbovex =(double) mTextView.getContentPositionX() + (double)mTextView.getEstimatedWidth() / 2 - (double)idAboveImageview.getEstimatedWidth() / 2; + idAboveImageview.setContentPosition((float) leftAbovex, (float)leftAbovey); AnimatorProperty abovePopup = new AnimatorProperty(); abovePopup.alphaFrom(0).alpha(90).setCurveType(new Animator.CurveType().ANTICIPATE).setDuration(2000); abovePopup.setTarget(dlInitLayout); diff --git a/build.gradle b/build.gradle index 8c97e12ad914d0129b0c5b776521f96505c27cd5..8294280c1da0e4c00eff78d99336b5caedfe0896 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.huawei.ohos.app' ohos { - compileSdkVersion 5 + compileSdkVersion 6 defaultConfig { compatibleSdkVersion 5 } @@ -22,8 +22,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.huawei.ohos:hap:2.4.4.2' - classpath 'com.huawei.ohos:decctest:1.0.0.6' + classpath 'com.huawei.ohos:hap:2.4.5.0' + classpath 'com.huawei.ohos:decctest:1.2.4.1' } } diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/DefaultToolTipAnimator.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/DefaultToolTipAnimator.java index a4cf3bfb3df3c0cf381346e47dc7aa3dee086ab8..8dbd76a0620a01e1a2400b07813bbf768538afdf 100644 --- a/tooltips/src/main/java/com/tomergoldst/tooltipshm/DefaultToolTipAnimator.java +++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/DefaultToolTipAnimator.java @@ -21,6 +21,7 @@ import ohos.agp.components.DependentLayout; import ohos.agp.components.Text; class DefaultToolTipAnimator implements ToolTipAnimator { + private AnimatorProperty animatorValue; @Override public AnimatorProperty popup(Text view, DependentLayout image, long duration) { view.setVisibility(Component.VISIBLE); @@ -33,12 +34,17 @@ class DefaultToolTipAnimator implements ToolTipAnimator { @Override public AnimatorProperty popout(final Component view, final long duration, final AnimatorProperty animaAdapter) { - AnimatorProperty animatorValue = new AnimatorProperty(); + animatorValue = new AnimatorProperty(); animatorValue.alpha(0).scaleX(0).scaleY(0).setDuration(duration).setCurveType(3); view.setVisibility(Component.INVISIBLE); if (animaAdapter != null) { animaAdapter.end(); } + animator(view,animatorValue,animaAdapter); + return animatorValue; + } + + private void animator(Component view,AnimatorProperty animatorValue,AnimatorProperty animaAdapter){ animatorValue.setStateChangedListener(new AnimatorProperty.StateChangedListener() { @Override public void onStart(Animator animator) { @@ -68,7 +74,5 @@ class DefaultToolTipAnimator implements ToolTipAnimator { public void onResume(Animator animator) { } }); - - return animatorValue; } } diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java index e9b2c176eb07ac3d3946f455297d389332ec57b0..2af220dfe00b6f218644e85f64f4e1903e776203 100644 --- a/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java +++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java @@ -1,28 +1,24 @@ /* -Copyright 2016 Tomer Goldstein - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - -http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ + * Copyright (C) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.tomergoldst.tooltipshm; - import com.ruffian.library.widget.component.RRadioButton; - import ohos.agp.animation.Animator; import ohos.agp.animation.AnimatorProperty; import ohos.agp.components.*; import ohos.agp.utils.TextAlignment; - import java.util.List; public class ToolTipsManager { @@ -55,10 +51,7 @@ public class ToolTipsManager { private RRadioButton checkboxRight; private List checkList; private List