From 677a7959d7b56f8d4d83749c78cd592dfb9acd59 Mon Sep 17 00:00:00 2001 From: chentianyu <18756170827@163.com> Date: Thu, 24 Jun 2021 10:51:22 +0800 Subject: [PATCH 1/2] =?UTF-8?q?tooltips=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7ce1a14..cb4ddde 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ CodeCheck代码测试无异常 CloudTest代码测试无异常 -火绒安全病毒安全检测通过 +安全病毒安全检测通过 当前版本demo功能与原组件基本无差异 ``` -- Gitee From e89031af20b44611dbca047e5267cd2f865e2c36 Mon Sep 17 00:00:00 2001 From: chentianyu <18756170827@163.com> Date: Tue, 6 Jul 2021 16:16:13 +0800 Subject: [PATCH 2/2] =?UTF-8?q?tooltips=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.OPENSOURCE | 4 +- README.md | 6 +-- app/build.gradle | 2 +- app/src/main/config.json | 5 --- .../tooltipsdemo/MainAbilitySlice.java | 6 +-- build.gradle | 6 +-- .../tooltipshm/DefaultToolTipAnimator.java | 10 +++-- .../tooltipshm/ToolTipsManager.java | 38 +++++++------------ 8 files changed, 33 insertions(+), 44 deletions(-) diff --git a/README.OPENSOURCE b/README.OPENSOURCE index 276718a..867f3bc 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 cb4ddde..b2bdea4 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 d2e1bba..71bc1e1 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 d40e960..6e8787a 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 160bb4e..accfbd1 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 8c97e12..8294280 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 a4cf3bf..8dbd76a 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 e9b2c17..2af220d 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