diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index e61c078248a84183c7e1b5aa344566656d46c387..0000000000000000000000000000000000000000
--- a/.gitignore
+++ /dev/null
@@ -1,11 +0,0 @@
-*.iml
-.gradle
-/local.properties
-/.idea/workspace.xml
-/.idea/libraries
-.idea
-.DS_Store
-/build
-/captures
-secring.gpg
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000000000000000000000000000000000000..5d6fbdd271282db0b3c58263b0fc268ad6202957
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,3 @@
+## 0.0.1-SNAPSHOT
+* refactor: For module library to openharmony
+
diff --git a/LICENSE .md b/LICENSE .md
new file mode 100644
index 0000000000000000000000000000000000000000..c2c2ce963e745e17bd4c93a80fe88461aab267ca
--- /dev/null
+++ b/LICENSE .md
@@ -0,0 +1,24 @@
+The MIT License (MIT)
+
+Copyright (c) 2016
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+Please let me know if you use the library in your applications.
+I want to collect and publish this list.
\ No newline at end of file
diff --git a/README.OPENSOURCE b/README.OPENSOURCE
new file mode 100644
index 0000000000000000000000000000000000000000..62093a5c73811255d79f63c4673e1f36c85f9e61
--- /dev/null
+++ b/README.OPENSOURCE
@@ -0,0 +1,10 @@
+[
+ {
+ "Name": "tootips",
+ "License": " Apache License ",
+ "License File": " LICENSE ",
+ "Version Number": " 1.1 ",
+ "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 2c9b23f6797f043b7872227fac276bbdc8b76f8e..4af9cde3b6c1cf3cde9646d0066f992452c5d8fa 100644
--- a/README.md
+++ b/README.md
@@ -1,158 +1,129 @@
-# Tooltips
-Simple to use library for android, Enabling to add a tooltip near any view with ease
-
-
-
-## Instructions
-Add a dependency to your app build.gradle
-```groovy
-dependencies {
- implementation 'com.tomergoldst.android:tooltips:1.1.0'
+# tooltips
+
+#### 项目介绍
+- 项目名称:tooltips。
+- 所属系列:openharmony的第三方组件适配移植。
+- 功能:易于使用的ohos库,可轻松在任何视图附近添加工具提示。
+- 项目移植状态:目前openharmony不支持加载.9图拉伸功能。
+- 调用差异:无
+- 基线版本:Release v1.1
+- 开发版本:sdk5,DevEco Studio2.1 beta4
+
+#### 效果演示
+
+
+#### 安装教程
+1、在项目根目录下的build.gradle文件中
+ ```gradle
+allprojects {
+ repositories {
+ maven {
+ url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
+ }
+ }
}
-```
-
-Create a `ToolTipsManager` object
-```java
-public class MainActivity extends Activity {
-
- ToolTipsManager mToolTipsManager;
-
+ ```
+2.在entry模块的build.gradle文件中
+ ```gradle
+ dependencies {
+ implementation('com.gitee.chinasoft_ohos:tooltips:0.0.1-SNAPSHOT')
+ ......
+ }
+ ```
+在sdk5,DevEco Studio2.1 beta4下项目可直接运行,
+
+如无法运行,删除项目.gradle,.idea,build,gradle,build.gradle文件,
+
+并依据自己的版本创建新项目,将新项目的对应文件复制到根目录下
+
+#### 使用说明
+
+1.如何开始
+创建一个ToolTipsManager对象
+ ```
+ ToolTipsManager mToolTipsManager;
@Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- mToolTipsManager = new ToolTipsManager();
-
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ getWindow().addFlags(WindowManager.LayoutConfig.MARK_TRANSLUCENT_STATUS);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+ mToolTipsManager = new ToolTipsManager(MainAbilitySlice.this);
+
+ ```
+2.使用mToolTipsManager 设置子类位置,大小,背景,文字等
+ ```
+ case ResourceTable.Id_button_above:
+ tag = 1;
+ builder = new ToolTip.Builder(this, mTextView);
+ mToolTipsManager.show(tag,builder.build());
+ break;
+
+ ```
+3.位置的实现ToolTipCoordinatesFinder类
+根据点击的不同方向计算出位置
+获取view上部位置
+ ```
+ float leftAbovey = textView.getContentPositionY() - idAboveImageview.getEstimatedHeight();
+ float leftAbovex = textView.getContentPositionX() + textView.getEstimatedWidth() / 2 - idAboveImageview.getEstimatedWidth() / 2;
+ idAboveImageview.setContentPosition(leftAbovex, leftAbovey);
+ ```
+获取view下部位置
+ ```
+ float leftBelowy = mTextView.getContentPositionY() + mTextView.getEstimatedHeight();
+ float leftBelowx = mTextView.getContentPositionX() + mTextView.getEstimatedWidth() / 2 - idBelowimageView.getEstimatedWidth() / 2;
+ idBelowimageView.setContentPosition(leftBelowx, leftBelowy);
+ ```
+4.加载动画DefaultToolTipAnimator类
+动画加载调用方法
+ ```
+ public AnimatorProperty popup(Component view, long duration) {
+ view.setVisibility(Component.VISIBLE);
+ AnimatorProperty abovePopup = new AnimatorProperty();
+ abovePopup.alphaFrom(0).alpha(90).setCurveType(new Animator.CurveType().ANTICIPATE).setDuration(500);
+ abovePopup.setTarget(view);
+ return abovePopup;
}
-
-}
-```
+ ```
+动画消失调用方法
+ ```
+ public AnimatorProperty popout(final Component view, final long duration, final AnimatorProperty animatorListenerAdapter) {
+ AnimatorProperty animatorValue = new AnimatorProperty();
+ animatorValue.alpha(0).scaleX(0).scaleY(0).setDuration(duration).setCurveType(3);......
-Use the `ToolTip.Builder` to construct your tip
-```java
-public class MainActivity extends Activity {
-
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
-
- ToolTip.Builder builder = new ToolTip.Builder(this, mTextView, mRootLayout, "Tip message", ToolTip.POSITION_ABOVE);
- }
-}
-```
-`mTextView` here is the view which near it the tip will be shown and `mRootLayout` is the layout where the tip view will be added to.
-**The root layout must be** of `RelativeLayout`, `FrameLayout` or similar. `LinearLayout` won't work but you can always wrap your `LinearLayout`
-with another layout. Prefer to pass in a layout which is higher in the xml tree as this will give the
-tip view more visible space.
-
-**OPTIONAL**: Customize your tip with background color, text color, alignment, text gravity, type face and more.
-```java
-public class MainActivity extends Activity {
-
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
-
- ToolTip.Builder builder = new ToolTip.Builder(this, mTextView, mRootLayout, "Tip message", ToolTip.POSITION_ABOVE);
- builder.setAlign(ToolTip.ALIGN_LEFT);
- builder.setBackgroundColor(getResources().getColor(R.color.colorOrange));
- builder.setGravity(ToolTip.GRAVITY_RIGHT);
- builder.setTextAppearance(R.style.TooltipTextAppearance); // from `styles.xml`
- builder.setTypeface(mCustomFontTypeface);
- }
-}
-```
-
-Here is an example on how you can define your text appearance in your `styles.xml`
-
-```xml
-
-```
-
-You can also customize the animation used to show and hide the tooltip view by providing `ToolTipAnimator` implementation and setting it in the `ToolTipsManager`.
-```java
-public class MainActivity extends Activity {
- ToolTipsManager mToolTipsManager;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- mToolTipsManager = new ToolTipsManager();
- mToolTipsManager.setToolTipAnimator(MyCustomToolTipAnimator());
+ ```
+5.设置背景类ToolTipBackgroundConstructor
+ ```
+根据点击的不同方向设置加载不同的图片
+ static void setBackground(Text idAboveImageview, int imgResouse) {
+ try {
+ PixelMapElement pixelMapElement = new PixelMapElement(idAboveImageview.getResourceManager().getResource(imgResouse));
+ idAboveImageview.setBackground(pixelMapElement);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
}
+ ```
-}
-```
+#### 测试信息
+ ```
+CodeCheck代码测试无异常
-Use `ToolTipManger` to show the tip
+CloudTest代码测试无异常
-**IMPORTANT**: This must be called after the layout has been drawn
-You can override the `onWindowFocusChanged()` of an Activity and show there, Start a delayed runnable from `onStart()`, react to user action or any other method that works for you
-```java
-public class MainActivity extends Activity {
-
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
-
- ToolTip.Builder builder = new ToolTip.Builder(this, mTextView, mRootLayout, "Tip message", ToolTip.POSITION_ABOVE);
-
- // Rest of builder configurations removed for brevity
-
- mToolTipsManager.show(builder.build());
- }
-}
-```
+火绒安全病毒安全检测通过
-Each tip is dismissable by clicking on it, if you want to dismiss a tip from code there are a few options, the most simple way is to do the following
-```java
-public class MainActivity extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
-
- mDismissBtn.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- mToolTipsManager.findAndDismiss(mTextView);
- }
- });
- }
-
-}
-```
-Where `mTextView` is the same view we asked to position a tip near it
+当前版本demo功能与原组件基本无差异
+ ```
-If you want to react when tip has been dismissed, Implement `ToolTipsManager.TipListener` interface and use appropriate `ToolTipsManager` constructor
-```java
-public class MainActivity extends Activity implements ToolTipsManager.TipListener {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- mToolTipsManager = new ToolTipsManager(this);
- }
-
- @Override
- public void onTipDismissed(View view, int anchorViewId, boolean byUser) {
- Log.d(TAG, "tip near anchor view " + anchorViewId + " dismissed");
-
- if (anchorViewId == R.id.text_view) {
- // Do something when a tip near view with id "R.id.text_view" has been dismissed
- }
- }
-
-}
-```
+#### 版本迭代
-### License
-```
+ ```
+- 0.0.1-SNAPSHOT
+ ```
+#### 版权和许可信息
+ ```
Copyright 2016 Tomer Goldstein
Licensed under the Apache License, Version 2.0 (the "License");
@@ -166,6 +137,4 @@ 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.
-```
-
-
+ ```
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index 5958924f304f0eebe9a380f80334e02cbb55a5ea..9d526d8af2ced369732b3ddc435127256e3d58db 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -1,26 +1,30 @@
-apply plugin: 'com.android.application'
-
-android {
- compileSdkVersion 30
-
+apply plugin: 'com.huawei.ohos.hap'
+apply plugin: 'com.huawei.ohos.decctest'
+ohos {
+ compileSdkVersion 5
defaultConfig {
- applicationId "com.tomergoldst.tooltipsdemo"
- minSdkVersion 14
- targetSdkVersion 30
- versionCode 2
- versionName "1.1"
+ compatibleSdkVersion 5
}
buildTypes {
release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
}
}
+
+
}
dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- testImplementation 'junit:junit:4.13.1'
- implementation 'com.google.android.material:material:1.3.0'
- implementation project(path: ':tooltips')
+ implementation fileTree(dir: 'libs', include: ['*.jar', '*.har'])
+ testImplementation 'junit:junit:4.13'
+ ohosTestImplementation 'com.huawei.ohos.testkit:runner:1.0.0.100'
+ implementation('com.gitee.chinasoft_ohos:RWidgetHelper:0.0.3-SNAPSHOT')
+ implementation project(path : ':tooltips')
+
+}
+decc {
+ supportType = ['html','xml']
}
diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro
index 8c36c8d2fe4c9211533ff78068d91d52aaf50e85..f7666e47561d514b2a76d5a7dfbb43ede86da92a 100644
--- a/app/proguard-rules.pro
+++ b/app/proguard-rules.pro
@@ -1,17 +1 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Users\Tomer\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
+# config module specific ProGuard rules here.
\ No newline at end of file
diff --git a/app/src/androidTest/java/com/tomergoldst/tooltipsdemo/ApplicationTest.java b/app/src/androidTest/java/com/tomergoldst/tooltipsdemo/ApplicationTest.java
deleted file mode 100644
index d28c723d28710fd0bbd9fbf5878630e321b13588..0000000000000000000000000000000000000000
--- a/app/src/androidTest/java/com/tomergoldst/tooltipsdemo/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.tomergoldst.tooltipsdemo;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
deleted file mode 100644
index afd64dcb48409a5df49ffc18cd9675c9f9dd9629..0000000000000000000000000000000000000000
--- a/app/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/assets/OFL.txt b/app/src/main/assets/OFL.txt
deleted file mode 100755
index c43bbb50c7335531962bd8da14aa7f806642733d..0000000000000000000000000000000000000000
--- a/app/src/main/assets/OFL.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-Copyright 2011 The Pacifico Project Authors (https://github.com/Fonthausen/Pacifico)
-
-This Font Software is licensed under the SIL Open Font License, Version 1.1.
-This license is copied below, and is also available with a FAQ at:
-http://scripts.sil.org/OFL
-
-
------------------------------------------------------------
-SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
------------------------------------------------------------
-
-PREAMBLE
-The goals of the Open Font License (OFL) are to stimulate worldwide
-development of collaborative font projects, to support the font creation
-efforts of academic and linguistic communities, and to provide a free and
-open framework in which fonts may be shared and improved in partnership
-with others.
-
-The OFL allows the licensed fonts to be used, studied, modified and
-redistributed freely as long as they are not sold by themselves. The
-fonts, including any derivative works, can be bundled, embedded,
-redistributed and/or sold with any software provided that any reserved
-names are not used by derivative works. The fonts and derivatives,
-however, cannot be released under any other type of license. The
-requirement for fonts to remain under this license does not apply
-to any document created using the fonts or their derivatives.
-
-DEFINITIONS
-"Font Software" refers to the set of files released by the Copyright
-Holder(s) under this license and clearly marked as such. This may
-include source files, build scripts and documentation.
-
-"Reserved Font Name" refers to any names specified as such after the
-copyright statement(s).
-
-"Original Version" refers to the collection of Font Software components as
-distributed by the Copyright Holder(s).
-
-"Modified Version" refers to any derivative made by adding to, deleting,
-or substituting -- in part or in whole -- any of the components of the
-Original Version, by changing formats or by porting the Font Software to a
-new environment.
-
-"Author" refers to any designer, engineer, programmer, technical
-writer or other person who contributed to the Font Software.
-
-PERMISSION & CONDITIONS
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Font Software, to use, study, copy, merge, embed, modify,
-redistribute, and sell modified and unmodified copies of the Font
-Software, subject to the following conditions:
-
-1) Neither the Font Software nor any of its individual components,
-in Original or Modified Versions, may be sold by itself.
-
-2) Original or Modified Versions of the Font Software may be bundled,
-redistributed and/or sold with any software, provided that each copy
-contains the above copyright notice and this license. These can be
-included either as stand-alone text files, human-readable headers or
-in the appropriate machine-readable metadata fields within text or
-binary files as long as those fields can be easily viewed by the user.
-
-3) No Modified Version of the Font Software may use the Reserved Font
-Name(s) unless explicit written permission is granted by the corresponding
-Copyright Holder. This restriction only applies to the primary font name as
-presented to the users.
-
-4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
-Software shall not be used to promote, endorse or advertise any
-Modified Version, except to acknowledge the contribution(s) of the
-Copyright Holder(s) and the Author(s) or with their explicit written
-permission.
-
-5) The Font Software, modified or unmodified, in part or in whole,
-must be distributed entirely under this license, and must not be
-distributed under any other license. The requirement for fonts to
-remain under this license does not apply to any document created
-using the Font Software.
-
-TERMINATION
-This license becomes null and void if any of the above conditions are
-not met.
-
-DISCLAIMER
-THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
-COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
-DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
-OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/app/src/main/assets/Pacifico-Regular.ttf b/app/src/main/assets/Pacifico-Regular.ttf
deleted file mode 100755
index f85aee040c653d292ffde2ea4ebe0cd2d91833d9..0000000000000000000000000000000000000000
Binary files a/app/src/main/assets/Pacifico-Regular.ttf and /dev/null differ
diff --git a/app/src/main/config.json b/app/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..d40e96058ff1d775fb5859d9431c1d1e741821c9
--- /dev/null
+++ b/app/src/main/config.json
@@ -0,0 +1,56 @@
+{
+ "app": {
+ "bundleName": "com.tomergoldst.tooltipsdemo",
+ "vendor": "tomergoldst",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.tomergoldst.tooltipsdemo",
+ "name": ".MyApplication",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "app",
+ "moduleType": "entry"
+ },
+ "abilities": [
+ {
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ],
+ "orientation": "unspecified",
+ "name": "com.tomergoldst.tooltipsdemo.MainAbility",
+ "icon": "$media:icon",
+ "description": "$string:mainability_description",
+ "label": "$string:app_name",
+ "type": "page",
+ "launchType": "standard",
+ "metaData": {
+ "customizeData" : [{
+ "extra" : "",
+ "name" : "hwc-theme",
+ "value" : "androidhwext:style/Theme.Emui.Light.NoTitleBar"
+ }]
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbility.java b/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbility.java
new file mode 100644
index 0000000000000000000000000000000000000000..ea1513dc4b1b9e427247225930cdbd3921476563
--- /dev/null
+++ b/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbility.java
@@ -0,0 +1,15 @@
+package com.tomergoldst.tooltipsdemo;
+
+import ohos.aafwk.ability.Ability;
+import ohos.aafwk.content.Intent;
+import ohos.agp.window.service.WindowManager;
+
+public class MainAbility extends Ability {
+ @Override
+ public void onStart(Intent intent) {
+ // 设置状态栏颜色
+ WindowManager.getInstance().getTopWindow().get().setStatusBarColor(getColor(ResourceTable.Color_status_bar));
+ super.onStart(intent);
+ super.setMainRoute(MainAbilitySlice.class.getName());
+ }
+}
diff --git a/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbilitySlice.java b/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbilitySlice.java
new file mode 100644
index 0000000000000000000000000000000000000000..3ac7d09ff5af78d99290cd80aefd1012dfde7a59
--- /dev/null
+++ b/app/src/main/java/com/tomergoldst/tooltipsdemo/MainAbilitySlice.java
@@ -0,0 +1,218 @@
+/*
+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.
+*/
+
+package com.tomergoldst.tooltipsdemo;
+
+import com.ruffian.library.widget.component.RRadioButton;
+import com.tomergoldst.tooltipshm.ToolTip;
+import com.tomergoldst.tooltipshm.ToolTipsManager;
+import ohos.aafwk.ability.AbilitySlice;
+import ohos.aafwk.content.Intent;
+import ohos.agp.animation.Animator;
+import ohos.agp.animation.AnimatorProperty;
+import ohos.agp.colors.RgbColor;
+import ohos.agp.components.*;
+import ohos.agp.components.element.ShapeElement;
+import ohos.agp.utils.Color;
+import ohos.agp.window.service.WindowManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MainAbilitySlice extends AbilitySlice implements
+ Component.ClickedListener {
+ private DependentLayout dlInitLayout;
+ private TextField mEditText;
+ private Text mTextView;
+ private Text rightImageView;
+ private Text leftImageView;
+ private Text idAboveImageview;
+ private Text idBelowimageView;
+ private Text inputHint;
+ private Button mAboveBtn;
+ private Button mBelowBtn;
+ private Button mLeftToBtn;
+ private Button mRightToBtn;
+ private RRadioButton checkboxLeft;
+ private RRadioButton checkboxCenter;
+ private RRadioButton checkboxRight;
+ private int tag;
+ private List checkboxes;
+ private List buttons;
+ private List texts;
+ private ToolTipsManager mToolTipsManager;
+ private ToolTip.Builder builder;
+
+ @Override
+ public void onStart(Intent intent) {
+ super.onStart(intent);
+ getWindow().addFlags(WindowManager.LayoutConfig.MARK_TRANSLUCENT_STATUS);
+ super.setUIContent(ResourceTable.Layout_ability_main);
+ initView();
+ }
+
+ @Override
+ public void onActive() {
+ super.onActive();
+ }
+
+ @Override
+ public void onForeground(Intent intent) {
+ super.onForeground(intent);
+ }
+
+ @Override
+ public void onClick(Component component) {
+ switch (component.getId()) {
+ case ResourceTable.Id_button_above:
+ tag = 1;
+ builder = new ToolTip.Builder(this, mTextView);
+ mToolTipsManager.show(tag,builder.build());
+ break;
+ case ResourceTable.Id_button_below:
+ tag = 2;
+ builder = new ToolTip.Builder(this, mTextView);
+ mToolTipsManager.show(tag,builder.build());
+ break;
+ case ResourceTable.Id_button_left_to:
+ tag = 3;
+ builder = new ToolTip.Builder(this, mTextView);
+ mToolTipsManager.show(tag,builder.build());
+ break;
+ case ResourceTable.Id_button_right_to:
+ tag = 4;
+ builder = new ToolTip.Builder(this, mTextView);
+ mToolTipsManager.show(tag,builder.build());
+ break;
+ case ResourceTable.Id_text_view:
+ mToolTipsManager.dismissAll();
+ break;
+ case ResourceTable.Id_dl_init_layout:
+ mToolTipsManager.dismissDialog();
+ break;
+ case ResourceTable.Id_above_image_view:
+ break;
+ }
+ }
+
+ //Control initialization
+ private void initView() {
+ mToolTipsManager = new ToolTipsManager();
+ mTextView = (Text) findComponentById(ResourceTable.Id_text_view);
+ mAboveBtn = (Button) findComponentById(ResourceTable.Id_button_above);
+ mBelowBtn = (Button) findComponentById(ResourceTable.Id_button_below);
+ mLeftToBtn = (Button) findComponentById(ResourceTable.Id_button_left_to);
+ mRightToBtn = (Button) findComponentById(ResourceTable.Id_button_right_to);
+ dlInitLayout = (DependentLayout) findComponentById(ResourceTable.Id_dl_init_layout);
+ inputHint = (Text) findComponentById(ResourceTable.Id_text_input_hint);
+ checkboxLeft = (RRadioButton) findComponentById(ResourceTable.Id_check_box_left);
+ checkboxCenter = (RRadioButton) findComponentById(ResourceTable.Id_check_box_center);
+ checkboxRight = (RRadioButton) findComponentById(ResourceTable.Id_check_box_right);
+ dlInitLayout.setClickedListener(this::onClick);
+ mAboveBtn.setClickedListener(this);
+ mBelowBtn.setClickedListener(this);
+ mLeftToBtn.setClickedListener(this);
+ mRightToBtn.setClickedListener(this);
+ mTextView.setClickedListener(this);
+ rightImageView = (Text) findComponentById(ResourceTable.Id_right_image_view);
+ leftImageView = (Text) findComponentById(ResourceTable.Id_left_image_view);
+ idAboveImageview = (Text) findComponentById(ResourceTable.Id_above_image_view);
+ idBelowimageView = (Text) findComponentById(ResourceTable.Id_below_image_view);
+ mEditText = (TextField) findComponentById(ResourceTable.Id_text_input_edit_text);
+
+ rightImageView.setClickedListener(this);
+ leftImageView.setClickedListener(this);
+ idAboveImageview.setClickedListener(this);
+ idBelowimageView.setClickedListener(this);
+ checkboxCenter.setChecked(true);
+ editFocusChange();
+ buttonAbovePositionInit();
+ checkboxes = new ArrayList<>();
+ checkboxes.add(checkboxLeft);
+ checkboxes.add(checkboxCenter);
+ checkboxes.add(checkboxRight);
+
+ buttons = new ArrayList<>();
+ buttons.add(mAboveBtn);
+ buttons.add(mBelowBtn);
+ buttons.add(mLeftToBtn);
+ buttons.add(mRightToBtn);
+
+ texts = new ArrayList<>();
+ texts.add(idAboveImageview);
+ texts.add(idBelowimageView);
+ texts.add(leftImageView);
+ texts.add(rightImageView);
+ texts.add(mTextView);
+
+ mToolTipsManager = new ToolTipsManager(dlInitLayout, mEditText, texts,
+ buttons, checkboxes);
+ }
+
+ //editText focus change
+ private void editFocusChange() {
+ mEditText.setFocusChangedListener(new Component.FocusChangedListener() {
+ @Override
+ public void onFocusChange(Component component, boolean isFocused) {
+ if (isFocused) {
+ ShapeElement shapeElement = new ShapeElement();
+ shapeElement.setRgbColor(new RgbColor(255, 64, 129));
+ setCursorColor(mEditText);
+ mEditText.setBasement(shapeElement);
+ mEditText.setHintColor(new Color(ResourceTable.Color_colorRed));
+ animateDismiss();
+
+ inputHint.setTextColor(new Color(Color.rgb(255, 64, 129)));
+ AnimatorProperty animatorProperty = inputHint.createAnimatorProperty();
+ animatorProperty.moveByY(-60).moveByX(-50).scaleY(0.65f).scaleX(0.65f).setDuration(1000).start();
+ }
+ }
+ });
+ }
+
+ //set cursor color
+ private void setCursorColor(TextField styleEditText) {
+ ShapeElement shapeElement = new ShapeElement();
+ shapeElement.setShape(ShapeElement.LINE);
+ shapeElement.setRgbColor(new RgbColor(255, 64, 129));
+ shapeElement.setGradientOrientation(ShapeElement.Orientation.TOP_TO_BOTTOM);
+ shapeElement.setStroke(styleEditText.getTextSize(), RgbColor.fromArgbInt(Color.rgb(255, 0, 0)));
+ styleEditText.setCursorElement(shapeElement);
+ }
+
+ // 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);
+ AnimatorProperty abovePopup = new AnimatorProperty();
+ abovePopup.alphaFrom(0).alpha(90).setCurveType(new Animator.CurveType().ANTICIPATE).setDuration(2000);
+ abovePopup.setTarget(dlInitLayout);
+ abovePopup.start();
+ }
+
+ //animates dismiss
+ private void animateDismiss() {
+ AnimatorProperty animatorValue = new AnimatorProperty();
+ animatorValue.alphaFrom(0).alpha(0).setCurveType(Animator.CurveType.ANTICIPATE_OVERSHOOT).setDuration(500);
+ dlInitLayout.setVisibility(Component.HIDE);
+ idAboveImageview.setVisibility(Component.HIDE);
+ idBelowimageView.setVisibility(Component.HIDE);
+ rightImageView.setVisibility(Component.HIDE);
+ leftImageView.setVisibility(Component.HIDE);
+ }
+}
diff --git a/app/src/main/java/com/tomergoldst/tooltipsdemo/MainActivity.java b/app/src/main/java/com/tomergoldst/tooltipsdemo/MainActivity.java
deleted file mode 100644
index cc4715e4736232c7e089850053bf728c53edf3f6..0000000000000000000000000000000000000000
--- a/app/src/main/java/com/tomergoldst/tooltipsdemo/MainActivity.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
-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.
-*/
-
-package com.tomergoldst.tooltipsdemo;
-
-import android.app.Activity;
-import android.graphics.Color;
-import android.graphics.Typeface;
-import android.os.Bundle;
-import android.text.Html;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.Menu;
-import android.view.MenuInflater;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.Button;
-import android.widget.RadioButton;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.Toast;
-
-import com.google.android.material.textfield.TextInputEditText;
-import com.tomergoldst.tooltips.ToolTip;
-import com.tomergoldst.tooltips.ToolTipsManager;
-
-public class MainActivity extends Activity implements
- ToolTipsManager.TipListener,
- View.OnClickListener {
-
- private static final String TAG = MainActivity.class.getSimpleName();
- public static final String TIP_TEXT = "Tool Tip";
- public static final String TIP_TEXT_SMALL = "Small Tool Tip";
- public static final String TIP_TEXT_LARGE = "Large Tool Tip";
-
- ToolTipsManager mToolTipsManager;
- RelativeLayout mRootLayout;
- TextInputEditText mEditText;
- TextView mTextView;
-
- Button mAboveBtn;
- Button mBelowBtn;
- Button mLeftToBtn;
- Button mRightToBtn;
-
- RadioButton mAlignRight;
- RadioButton mAlignLeft;
- RadioButton mAlignCenter;
-
- @ToolTip.Align
- int mAlign = ToolTip.ALIGN_CENTER;
-
- Typeface mCustomFont = null;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- mRootLayout = findViewById(R.id.root_layout);
- mTextView = findViewById(R.id.text_view);
-
- mToolTipsManager = new ToolTipsManager(this);
-
- mAboveBtn = findViewById(R.id.button_above);
- mBelowBtn = findViewById(R.id.button_below);
- mLeftToBtn = findViewById(R.id.button_left_to);
- mRightToBtn = findViewById(R.id.button_right_to);
-
- mAboveBtn.setOnClickListener(this);
- mBelowBtn.setOnClickListener(this);
- mLeftToBtn.setOnClickListener(this);
- mRightToBtn.setOnClickListener(this);
- mTextView.setOnClickListener(this);
-
- mAlignCenter = findViewById(R.id.button_align_center);
- mAlignRight = findViewById(R.id.button_align_right);
- mAlignLeft = findViewById(R.id.button_align_left);
-
- mAlignCenter.setOnClickListener(this);
- mAlignLeft.setOnClickListener(this);
- mAlignRight.setOnClickListener(this);
-
- mAlignCenter.setChecked(true);
-
- mEditText = findViewById(R.id.text_input_edit_text);
-
- }
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- MenuInflater inflater = getMenuInflater();
- inflater.inflate(R.menu.main_activity_actions, menu);
- return true;
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle item selection
- switch (item.getItemId()) {
- case R.id.use_custom_font_menu_item:
- mCustomFont = Typeface.createFromAsset(getAssets(), "Pacifico-Regular.ttf");
- Toast toast = Toast.makeText(this, "Custom font set. Re-try demo.", Toast.LENGTH_SHORT);
- toast.setGravity(Gravity.CENTER, 0, 0);
- toast.show();
- return true;
- default:
- return super.onOptionsItemSelected(item);
- }
- }
-
-
- @Override
- public void onWindowFocusChanged(boolean hasFocus) {
- super.onWindowFocusChanged(hasFocus);
-
- // This tip is shows the first time the sample app is loaded. Use a message that gives user
- // guide on how to use the sample app. Also try to showcase the ability of the app.
- CharSequence initialGuideTex = Html.fromHtml("Click on the Buttons " +
- "and the Radio Buttons bellow to test various tool tip configurations." +
- "GOT IT ");
-
- ToolTip.Builder builder = new ToolTip.Builder(this, mTextView, mRootLayout, initialGuideTex, ToolTip.POSITION_ABOVE);
- builder.setAlign(mAlign);
- builder.setBackgroundColor(Color.DKGRAY);
- builder.setTextAppearance(R.style.TooltipTextAppearance);
- mToolTipsManager.show(builder.build());
- }
-
- @Override
- public void onTipDismissed(View view, int anchorViewId, boolean byUser) {
- Log.d(TAG, "tip near anchor view " + anchorViewId + " dismissed");
-
- if (anchorViewId == R.id.text_view) {
- // Do something when a tip near view with id "R.id.text_view" has been dismissed
- }
- }
-
- @Override
- public void onClick(View view) {
- String text = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString();
- ToolTip.Builder builder;
-
- switch (view.getId()) {
- case R.id.button_above:
- mToolTipsManager.findAndDismiss(mTextView);
- builder = new ToolTip.Builder(this, mTextView, mRootLayout, text, ToolTip.POSITION_ABOVE);
- builder.setAlign(mAlign);
- builder.setTypeface(mCustomFont);
- mToolTipsManager.show(builder.build());
- break;
- case R.id.button_below:
- mToolTipsManager.findAndDismiss(mTextView);
- builder = new ToolTip.Builder(this, mTextView, mRootLayout, text, ToolTip.POSITION_BELOW);
- builder.setAlign(mAlign);
- builder.setTextAppearance(R.style.TooltipTextAppearance);
- builder.setTypeface(mCustomFont);
- builder.setBackgroundColor(getResources().getColor(R.color.colorOrange));
- mToolTipsManager.show(builder.build());
- break;
- case R.id.button_left_to:
- mToolTipsManager.findAndDismiss(mTextView);
- builder = new ToolTip.Builder(this, mTextView, mRootLayout, TIP_TEXT.equals(text) ? TIP_TEXT_SMALL : text, ToolTip.POSITION_LEFT_TO);
- builder.setBackgroundColor(getResources().getColor(R.color.colorLightGreen));
- builder.setGravity(ToolTip.GRAVITY_CENTER);
- builder.setTypeface(mCustomFont);
- builder.setTextAppearance(R.style.TooltipTextAppearance_Small_Black);
- mToolTipsManager.show(builder.build());
- break;
- case R.id.button_right_to:
- mToolTipsManager.findAndDismiss(mTextView);
- builder = new ToolTip.Builder(this, mTextView, mRootLayout, TIP_TEXT.equals(text) ? TIP_TEXT_LARGE : text, ToolTip.POSITION_RIGHT_TO);
- builder.setBackgroundColor(getResources().getColor(R.color.colorDarkRed));
- builder.setTextAppearance(R.style.TooltipTextAppearance_Large);
- builder.setTypeface(mCustomFont);
- mToolTipsManager.show(builder.build());
- break;
- case R.id.button_align_center:
- mAlign = ToolTip.ALIGN_CENTER;
- break;
- case R.id.button_align_left:
- mAlign = ToolTip.ALIGN_LEFT;
- break;
- case R.id.button_align_right:
- mAlign = ToolTip.ALIGN_RIGHT;
- break;
- case R.id.text_view:
- mToolTipsManager.dismissAll();
- break;
- }
- }
-}
diff --git a/app/src/main/java/com/tomergoldst/tooltipsdemo/MyApplication.java b/app/src/main/java/com/tomergoldst/tooltipsdemo/MyApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..af859e7ed2abbba3c66accda91070c5a3f6c4d0a
--- /dev/null
+++ b/app/src/main/java/com/tomergoldst/tooltipsdemo/MyApplication.java
@@ -0,0 +1,10 @@
+package com.tomergoldst.tooltipsdemo;
+
+import ohos.aafwk.ability.AbilityPackage;
+
+public class MyApplication extends AbilityPackage {
+ @Override
+ public void onInitialize() {
+ super.onInitialize();
+ }
+}
diff --git a/app/src/main/java/com/tomergoldst/tooltipsdemo/TextUtils.java b/app/src/main/java/com/tomergoldst/tooltipsdemo/TextUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..ae2ee672d7b9e37e38725485209e76a13dc9d585
--- /dev/null
+++ b/app/src/main/java/com/tomergoldst/tooltipsdemo/TextUtils.java
@@ -0,0 +1,7 @@
+package com.tomergoldst.tooltipsdemo;
+
+public class TextUtils {
+ public static boolean isEmpty(CharSequence str) {
+ return str == null || str.length() == 0;
+ }
+}
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
deleted file mode 100644
index d3b71b5e3ad81a17c37fe38576448806589597a9..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/activity_main.xml
+++ /dev/null
@@ -1,141 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/res/menu/main_activity_actions.xml b/app/src/main/res/menu/main_activity_actions.xml
deleted file mode 100644
index 6297b1068b240da7c5301c6b80c3899b297c8b24..0000000000000000000000000000000000000000
--- a/app/src/main/res/menu/main_activity_actions.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/mipmap-hdpi/ic_launcher.png b/app/src/main/res/mipmap-hdpi/ic_launcher.png
deleted file mode 100644
index cde69bcccec65160d92116f20ffce4fce0b5245c..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-mdpi/ic_launcher.png b/app/src/main/res/mipmap-mdpi/ic_launcher.png
deleted file mode 100644
index c133a0cbd379f5af6dbf1a899a0293ca5eccfad0..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/app/src/main/res/mipmap-xhdpi/ic_launcher.png
deleted file mode 100644
index bfa42f0e7b91d006d22352c9ff2f134e504e3c1d..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
deleted file mode 100644
index 324e72cdd7480cb983fa1bcc7ce686e51ef87fe7..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
deleted file mode 100644
index aee44e138434630332d88b1680f33c4b24c70ab3..0000000000000000000000000000000000000000
Binary files a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ
diff --git a/app/src/main/res/values-w820dp/dimens.xml b/app/src/main/res/values-w820dp/dimens.xml
deleted file mode 100644
index 63fc816444614bd64f68a372d1f93211628ee51d..0000000000000000000000000000000000000000
--- a/app/src/main/res/values-w820dp/dimens.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- 64dp
-
diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
deleted file mode 100644
index 6b4cbba445e0836fe85670c53e0af135e2872906..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
- #3F51B5
- #303F9F
- #FF4081
-
- #8b0000
- #ffa500
- #a0db8e
- #FFFFFF
- #000000
-
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
deleted file mode 100644
index 47c82246738c4d056e8030d3a259206f42e8e15d..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 16dp
- 16dp
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
deleted file mode 100644
index 2ffd69e2806cde702ae08d7fa58ba912108e7d5e..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
- Tooltips Demo
-
diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
deleted file mode 100644
index 6485cb1986727580ab7ccdbc4af9a07a92fe30b5..0000000000000000000000000000000000000000
--- a/app/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/resources/base/element/color.json b/app/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..c00051a408386013aa47f18bb3995d28ce14f780
--- /dev/null
+++ b/app/src/main/resources/base/element/color.json
@@ -0,0 +1,39 @@
+{
+ "color": [
+ {
+ "name": "status_bar",
+ "value": "#0097A7"
+ },
+ {
+ "name": "text_color",
+ "value":"#ffffffff"
+ },
+ {
+ "name": "colorDarkRed",
+ "value": "#8b0000"
+ }
+ ,
+ {
+ "name": "colorBlack",
+ "value": "#000000"
+ }
+ ,
+ {
+ "name": "colorOrange",
+ "value": "#ffa500"
+ },
+ {
+ "name": "colorLightGreen",
+ "value": "#a0db8e"
+ },
+ {
+ "name": "colorRed",
+ "value": "#FF4081"
+ },
+ {
+ "name": "colorWhile",
+ "value": "#ffffff"
+ }
+
+ ]
+}
\ No newline at end of file
diff --git a/app/src/main/resources/base/element/string.json b/app/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..bd88465c27396d0c188245c2e0be8f62c693d873
--- /dev/null
+++ b/app/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "tooltips"
+ },
+ {
+ "name": "mainability_description",
+ "value": "Java_Phone_Empty Feature Ability"
+ },
+ {
+ "name": "HelloWorld",
+ "value": "Hello World"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/app/src/main/resources/base/element/style.json b/app/src/main/resources/base/element/style.json
new file mode 100644
index 0000000000000000000000000000000000000000..97dd8b909f94a8f1ce26866fc8d7b1c5ce5c57cf
--- /dev/null
+++ b/app/src/main/resources/base/element/style.json
@@ -0,0 +1,9 @@
+{
+ "string": [
+ {
+ "name": "string_1",
+ "value": "hello"
+ }
+
+ ]
+}
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/background_ability_main.xml b/app/src/main/resources/base/graphic/background_ability_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..47a2d3e00aea59206e521f2e2c2491c629528df9
--- /dev/null
+++ b/app/src/main/resources/base/graphic/background_ability_main.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/background_text_field.xml b/app/src/main/resources/base/graphic/background_text_field.xml
new file mode 100644
index 0000000000000000000000000000000000000000..33d953ae371863ccf0fdfb01b15bf2340e33f8e7
--- /dev/null
+++ b/app/src/main/resources/base/graphic/background_text_field.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/graphic/checkbox_check_element.xml b/app/src/main/resources/base/graphic/checkbox_check_element.xml
new file mode 100644
index 0000000000000000000000000000000000000000..cd8951f6862b9a0e1fac8ed0c2f2e36e80bc3d92
--- /dev/null
+++ b/app/src/main/resources/base/graphic/checkbox_check_element.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/layout/ability_main.xml b/app/src/main/resources/base/layout/ability_main.xml
new file mode 100644
index 0000000000000000000000000000000000000000..72a134ec799252185dbdafdd898b58c419d829f6
--- /dev/null
+++ b/app/src/main/resources/base/layout/ability_main.xml
@@ -0,0 +1,288 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/resources/base/media/icon.png b/app/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/app/src/main/resources/base/media/icon.png differ
diff --git a/app/src/main/resources/base/media/icon_rb_green_default.png b/app/src/main/resources/base/media/icon_rb_green_default.png
new file mode 100644
index 0000000000000000000000000000000000000000..fc38ebce7204ffdb7f5120db11d4d47f79e9c051
Binary files /dev/null and b/app/src/main/resources/base/media/icon_rb_green_default.png differ
diff --git a/app/src/main/resources/base/media/icon_rb_green_selected.png b/app/src/main/resources/base/media/icon_rb_green_selected.png
new file mode 100644
index 0000000000000000000000000000000000000000..a24deca4948a006741da5ae7626a9e56d8ad2f2c
Binary files /dev/null and b/app/src/main/resources/base/media/icon_rb_green_selected.png differ
diff --git a/app/src/main/resources/base/media/tips.png b/app/src/main/resources/base/media/tips.png
new file mode 100644
index 0000000000000000000000000000000000000000..c9b4b97580797aeba4feeb23dc759988be526514
Binary files /dev/null and b/app/src/main/resources/base/media/tips.png differ
diff --git a/app/src/ohosTest/config.json b/app/src/ohosTest/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..9cd10c6474e58b3672bceac8bfe003a08761b7d0
--- /dev/null
+++ b/app/src/ohosTest/config.json
@@ -0,0 +1,41 @@
+{
+ "app": {
+ "bundleName": "com.tomergoldst.tooltipsdemo",
+ "vendor": "tomergoldst",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 4,
+ "target": 5,
+ "releaseType": "Beta1"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.tomergoldst.tooltipsdemo",
+ "name": "testModule",
+ "deviceType": [
+ "tv"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "entry_test",
+ "moduleType": "feature",
+ "installationFree": true
+ },
+ "abilities": [
+ {
+ "name": "decc.testkit.runner.EntryAbility",
+ "description": "Test Entry Ability",
+ "icon": "$media:icon",
+ "label": "$string:app_name",
+ "launchType": "standard",
+ "orientation": "landscape",
+ "visible": true,
+ "type": "page"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/app/src/ohosTest/java/com/tomergoldst/tooltipsdemo/ExampleOhosTest.java b/app/src/ohosTest/java/com/tomergoldst/tooltipsdemo/ExampleOhosTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb6604e9110ad6df544e3cce8e7c620f75fdf03a
--- /dev/null
+++ b/app/src/ohosTest/java/com/tomergoldst/tooltipsdemo/ExampleOhosTest.java
@@ -0,0 +1,14 @@
+package com.tomergoldst.tooltipsdemo;
+
+import ohos.aafwk.ability.delegation.AbilityDelegatorRegistry;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class ExampleOhosTest {
+ @Test
+ public void testBundleName() {
+ final String actualBundleName = AbilityDelegatorRegistry.getArguments().getTestBundleName();
+ assertEquals("com.tomergoldst.tooltipsdemo", actualBundleName);
+ }
+}
\ No newline at end of file
diff --git a/app/src/test/java/com/tomergoldst/tooltipsdemo/ExampleTest.java b/app/src/test/java/com/tomergoldst/tooltipsdemo/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..b389579a4ee879e590560d9fdbe09cdad93198cc
--- /dev/null
+++ b/app/src/test/java/com/tomergoldst/tooltipsdemo/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.tomergoldst.tooltipsdemo;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}
diff --git a/app/src/test/java/com/tomergoldst/tooltipsdemo/ExampleUnitTest.java b/app/src/test/java/com/tomergoldst/tooltipsdemo/ExampleUnitTest.java
deleted file mode 100644
index 8459ecacade910d44dcd93aacce3794f1acaca74..0000000000000000000000000000000000000000
--- a/app/src/test/java/com/tomergoldst/tooltipsdemo/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.tomergoldst.tooltipsdemo;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/build.gradle b/build.gradle
index fdf72f0bb3edbc8f6fe9954cdaa3cc410fc2cb81..52faa50b323d4c44f7b848cff277d0bd32c45b02 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,26 +1,43 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
+apply plugin: 'com.huawei.ohos.app'
+
+ohos {
+ compileSdkVersion 5
+ defaultConfig {
+ compatibleSdkVersion 5
+ }
+}
buildscript {
repositories {
- google()
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ maven { url 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle' }
+
+
jcenter()
}
dependencies {
- classpath 'com.android.tools.build:gradle:4.1.2'
- classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
- classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
- // NOTE: Do not place your application dependencies here; they belong
- // in the individual module build.gradle files
+ classpath 'com.huawei.ohos:hap:2.4.2.7'
+ classpath 'com.huawei.ohos:decctest:1.0.0.6'
}
}
allprojects {
repositories {
- google()
+ maven {
+ url 'https://repo.huaweicloud.com/repository/maven/'
+ }
+ maven {
+ url 'https://developer.huawei.com/repo/'
+ }
+ maven {
+ url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
+ }
jcenter()
}
}
-
-task clean(type: Delete) {
- delete rootProject.buildDir
-}
diff --git a/gradle.properties b/gradle.properties
index 915f0e66f948533c06b756c4ef9e586bb9132793..0daf1830fbdef07e50a44d74210c8c82f1b66278 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,20 +1,10 @@
# Project-wide Gradle settings.
-
-# IDE (e.g. Android Studio) users:
+# IDE (e.g. DevEco Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
-
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
-
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
-# Default value: -Xmx10248m -XX:MaxPermSize=256m
-# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
-
-# When configured, Gradle will run in incubating parallel mode.
-# This option should only be used with decoupled projects. More details, visit
-# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
-# org.gradle.parallel=true
-android.enableJetifier=true
-android.useAndroidX=true
\ No newline at end of file
+# If the Chinese output is garbled, please configure the following parameter.
+# org.gradle.jvmargs=-Dfile.encoding=GBK
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index 13372aef5e24af05341d49695ee84e5f9b594659..490fda8577df6c95960ba7077c43220e5bb2c0d9 100644
Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 1190b9baae68103d1e997e72b7bbcce82e8373d4..f59159e865d4b59feb1b8c44b001f62fc5d58df4 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Mon Feb 15 20:02:18 IST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://repo.huaweicloud.com/gradle/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
diff --git a/gradlew b/gradlew
index 9d82f78915133e1c35a6ea51252590fb38efac2f..2fe81a7d95e4f9ad2c9b2a046707d36ceb3980b3 100644
--- a/gradlew
+++ b/gradlew
@@ -1,4 +1,20 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# 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
+#
+# https://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.
+#
##############################################################################
##
@@ -6,20 +22,38 @@
##
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
+warn () {
echo "$*"
}
-die ( ) {
+die () {
echo
echo "$*"
echo
@@ -30,6 +64,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
+nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,26 +75,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
+ NONSTOP* )
+ nonstop=true
+ ;;
esac
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -85,7 +105,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -105,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
@@ -134,27 +154,30 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
- i=$((i+1))
+ i=`expr $i + 1`
done
case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ 0) set -- ;;
+ 1) set -- "$args0" ;;
+ 2) set -- "$args0" "$args1" ;;
+ 3) set -- "$args0" "$args1" "$args2" ;;
+ 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=`save "$@"`
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
index 8a0b282aa6885fb573c106b3551f7275c5f17e8e..62bd9b9ccefea2b65ae41e5d9a545e2021b90a1d 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,14 +24,17 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +65,9 @@ echo location of your Java installation.
goto fail
:init
-@rem Get command-line arguments, handling Windowz variants
+@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +78,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
diff --git a/img/demo.gif b/img/demo.gif
new file mode 100644
index 0000000000000000000000000000000000000000..d293ce685429a06e51ce301f19294d94e7d19384
Binary files /dev/null and b/img/demo.gif differ
diff --git a/tooltips/build.gradle b/tooltips/build.gradle
index 115b1caf0219e3a15e2dbc70a61edebeff21ef34..f6bde8b1c0182462b3f266a09f0d083da422bed4 100644
--- a/tooltips/build.gradle
+++ b/tooltips/build.gradle
@@ -1,51 +1,22 @@
-apply plugin: 'com.android.library'
-
-ext {
- bintrayRepo = 'maven'
- bintrayName = 'tooltips'
-
- publishedGroupId = 'com.tomergoldst.android'
- libraryName = 'ToolTips'
- artifact = 'tooltips'
-
- libraryDescription = 'Simple to use library for android, enabling to add a tooltip near any view with ease'
-
- siteUrl = 'https://github.com/tomergoldst/tooltips'
- gitUrl = 'https://github.com/tomergoldst/tooltips.git'
-
- libraryVersion = '1.1.0'
-
- developerId = 'tomergoldst'
- developerName = 'Tomer Goldstein'
- developerEmail = 'tomergoldst2@gmail.com'
-
- licenseName = 'The Apache Software License, Version 2.0'
- licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- allLicenses = ["Apache-2.0"]
-}
-
-android {
- compileSdkVersion 30
-
+apply plugin: 'com.huawei.ohos.library'
+ohos {
+ compileSdkVersion 5
defaultConfig {
- minSdkVersion 14
- targetSdkVersion 30
- versionCode 13
- versionName "1.1.0"
+ compatibleSdkVersion 5
}
buildTypes {
release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+ proguardOpt {
+ proguardEnabled false
+ rulesFiles 'proguard-rules.pro'
+ }
}
}
+
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- testImplementation 'junit:junit:4.13.1'
- implementation 'androidx.appcompat:appcompat:1.2.0'
+ implementation('com.gitee.chinasoft_ohos:RWidgetHelper:0.0.3-SNAPSHOT')
+ testImplementation 'junit:junit:4.13'
}
-
-apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
-apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
diff --git a/tooltips/proguard-rules.pro b/tooltips/proguard-rules.pro
index 8c36c8d2fe4c9211533ff78068d91d52aaf50e85..f7666e47561d514b2a76d5a7dfbb43ede86da92a 100644
--- a/tooltips/proguard-rules.pro
+++ b/tooltips/proguard-rules.pro
@@ -1,17 +1 @@
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in C:\Users\Tomer\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the proguardFiles
-# directive in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
+# config module specific ProGuard rules here.
\ No newline at end of file
diff --git a/tooltips/src/androidTest/java/com/tomergoldst/tooltips/ApplicationTest.java b/tooltips/src/androidTest/java/com/tomergoldst/tooltips/ApplicationTest.java
deleted file mode 100644
index 6f14067822e4ad04406a8e664bf68678792ea2ea..0000000000000000000000000000000000000000
--- a/tooltips/src/androidTest/java/com/tomergoldst/tooltips/ApplicationTest.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.tomergoldst.tooltips;
-
-import android.app.Application;
-import android.test.ApplicationTestCase;
-
-/**
- * Testing Fundamentals
- */
-public class ApplicationTest extends ApplicationTestCase {
- public ApplicationTest() {
- super(Application.class);
- }
-}
\ No newline at end of file
diff --git a/tooltips/src/main/AndroidManifest.xml b/tooltips/src/main/AndroidManifest.xml
deleted file mode 100644
index 316b0e2200b56e27a208459ebf0bd2dafc824ba4..0000000000000000000000000000000000000000
--- a/tooltips/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
-
diff --git a/tooltips/src/main/config.json b/tooltips/src/main/config.json
new file mode 100644
index 0000000000000000000000000000000000000000..4a4cce5ac1998fb6e6b641da4e961f6403278be4
--- /dev/null
+++ b/tooltips/src/main/config.json
@@ -0,0 +1,27 @@
+{
+ "app": {
+ "bundleName": "com.tomergoldst.tooltipsdemo",
+ "vendor": "tomergoldst",
+ "version": {
+ "code": 1,
+ "name": "1.0"
+ },
+ "apiVersion": {
+ "compatible": 5,
+ "target": 5,
+ "releaseType": "Release"
+ }
+ },
+ "deviceConfig": {},
+ "module": {
+ "package": "com.tomergoldst.tooltipshm",
+ "deviceType": [
+ "phone"
+ ],
+ "distro": {
+ "deliveryWithInstall": true,
+ "moduleName": "tooltipshm",
+ "moduleType": "har"
+ }
+ }
+}
\ No newline at end of file
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTip.java b/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTip.java
deleted file mode 100644
index 99a0fe30cbd099e742e1f3daf01299d5ee1b95e5..0000000000000000000000000000000000000000
--- a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTip.java
+++ /dev/null
@@ -1,315 +0,0 @@
-
-/*
-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.
-*/
-package com.tomergoldst.tooltips;
-
-import android.content.Context;
-import android.graphics.Typeface;
-import android.view.View;
-import android.view.ViewGroup;
-
-import androidx.annotation.IntDef;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.StyleRes;
-
-import java.lang.annotation.Retention;
-
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-public class ToolTip {
-
- @Retention(SOURCE)
- @IntDef({POSITION_ABOVE, POSITION_BELOW, POSITION_LEFT_TO, POSITION_RIGHT_TO})
- public @interface Position {}
- public static final int POSITION_ABOVE = 0;
- public static final int POSITION_BELOW = 1;
- public static final int POSITION_LEFT_TO = 3;
- public static final int POSITION_RIGHT_TO = 4;
-
- @Retention(SOURCE)
- @IntDef({ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT})
- public @interface Align {}
- public static final int ALIGN_CENTER = 0;
- public static final int ALIGN_LEFT = 1;
- public static final int ALIGN_RIGHT = 2;
-
- @Retention(SOURCE)
- @IntDef({GRAVITY_CENTER, GRAVITY_LEFT, GRAVITY_RIGHT})
- public @interface Gravity {}
- public static final int GRAVITY_CENTER = 0;
- public static final int GRAVITY_LEFT = 1;
- public static final int GRAVITY_RIGHT = 2;
-
- @NonNull private final Context mContext;
- @NonNull private final View mAnchorView;
- @NonNull private final ViewGroup mRootViewGroup;
- @NonNull private final CharSequence mMessage;
- private @Position int mPosition;
- private final @Align int mAlign;
- private final int mOffsetX;
- private final int mOffsetY;
- private final boolean mArrow;
- private final int mBackgroundColor;
- private final float mElevation;
- private final @Gravity int mTextGravity;
- private final @StyleRes int mTextAppearanceStyle;
- @Nullable private final Typeface mTypeface;
-
- public ToolTip(Builder builder){
- mContext = builder.mContext;
- mAnchorView = builder.mAnchorView;
- mRootViewGroup = builder.mRootViewGroup;
- mMessage = builder.mMessage;
- mPosition = builder.mPosition;
- mAlign = builder.mAlign;
- mOffsetX = builder.mOffsetX;
- mOffsetY = builder.mOffsetY;
- mArrow = builder.mArrow;
- mBackgroundColor = builder.mBackgroundColor;
- mElevation = builder.mElevation;
- mTextGravity = builder.mTextGravity;
- mTextAppearanceStyle = builder.mTextAppearanceStyle;
- mTypeface = builder.mTypeface;
- }
-
- @NonNull
- public Context getContext() {
- return mContext;
- }
-
- @NonNull
- public View getAnchorView() {
- return mAnchorView;
- }
-
- @NonNull
- public ViewGroup getRootView() {
- return mRootViewGroup;
- }
-
- @NonNull
- public CharSequence getMessage() {
- return mMessage;
- }
-
- public int getPosition() {
- return mPosition;
- }
-
- public int getAlign() {
- return mAlign;
- }
-
- public int getOffsetX() {
- return mOffsetX;
- }
-
- public int getOffsetY() {
- return mOffsetY;
- }
-
- public boolean hideArrow() {
- return !mArrow;
- }
-
- public int getBackgroundColor() {
- return mBackgroundColor;
- }
-
- public boolean positionedLeftTo(){
- return POSITION_LEFT_TO == mPosition;
- }
-
- public boolean positionedRightTo(){
- return POSITION_RIGHT_TO == mPosition;
- }
-
- public boolean positionedAbove(){
- return POSITION_ABOVE == mPosition;
- }
-
- public boolean positionedBelow(){
- return POSITION_BELOW == mPosition;
- }
-
- public boolean alignedCenter(){
- return ALIGN_CENTER == mAlign;
- }
-
- public boolean alignedLeft(){
- return ALIGN_LEFT == mAlign;
- }
-
- public boolean alignedRight(){
- return ALIGN_RIGHT == mAlign;
- }
-
- public void setPosition(@Position int position){
- mPosition = position;
- }
-
- public float getElevation() {
- return mElevation;
- }
-
- @StyleRes
- public int getTextAppearanceStyle() {
- return mTextAppearanceStyle;
- }
-
- @Nullable
- public Typeface getTypeface() {
- return mTypeface;
- }
-
- @NonNull
- public int getTextGravity(){
- int gravity;
- switch (mTextGravity){
- case GRAVITY_LEFT:
- gravity = android.view.Gravity.START;
- break;
- case GRAVITY_RIGHT:
- gravity = android.view.Gravity.END;
- break;
- case GRAVITY_CENTER:
- default:
- gravity = android.view.Gravity.CENTER;
- }
- return gravity;
- }
-
- public static class Builder {
- private final @NonNull Context mContext;
- private final @NonNull View mAnchorView;
- private final @NonNull ViewGroup mRootViewGroup;
- private final @NonNull CharSequence mMessage;
- private @Position int mPosition;
- private @Align int mAlign;
- private int mOffsetX;
- private int mOffsetY;
- private boolean mArrow;
- private int mBackgroundColor;
- private float mElevation;
- private @Gravity int mTextGravity;
- private @StyleRes int mTextAppearanceStyle;
- private @Nullable Typeface mTypeface;
-
-
- /**
- * Creates the tooltip builder with message and required parameters to show tooltip.
- *
- * @param context context
- * @param anchorView the view which near it we want to put the tip
- * @param root a class extends ViewGroup which the created tip view will be added to
- * @param message message to show. Note: This allows normal text and spannable text with spanned styles.
- * @param position put the tip above / below / left to / right to anchor view.
- */
- public Builder(@NonNull Context context,
- @NonNull View anchorView,
- @NonNull ViewGroup root,
- @NonNull CharSequence message,
- @Position int position) {
- mContext = context;
- mAnchorView = anchorView;
- mRootViewGroup = root;
- mMessage = message;
- mPosition = position;
- mAlign = ALIGN_CENTER;
- mOffsetX = 0;
- mOffsetY = 0;
- mArrow = true;
- mBackgroundColor = context.getResources().getColor(R.color.colorBackground);
- mTextGravity = GRAVITY_LEFT;
- mTextAppearanceStyle = R.style.TooltipDefaultStyle;
- }
-
- @NonNull
- public Builder setPosition(@Position int position){
- mPosition = position;
- return this;
- }
-
- @NonNull
- public Builder setAlign(@Align int align){
- mAlign = align;
- return this;
- }
-
- /**
- * @param offset offset to move the tip on x axis after tip was positioned
- * @return offset
- */
- @NonNull
- public Builder setOffsetX(int offset){
- mOffsetX = offset;
- return this;
- }
-
- /**
- * @param offset offset to move the tip on y axis after tip was positioned
- * @return offset
- */
- @NonNull
- public Builder setOffsetY(int offset){
- mOffsetY = offset;
- return this;
- }
-
- @NonNull
- public Builder withArrow(boolean value){
- mArrow = value;
- return this;
- }
-
- @NonNull
- public Builder setBackgroundColor(int color){
- mBackgroundColor = color;
- return this;
- }
-
- @NonNull
- public Builder setElevation(float elevation){
- mElevation = elevation;
- return this;
- }
-
- @NonNull
- public Builder setGravity(@Gravity int gravity){
- mTextGravity = gravity;
- return this;
- }
-
- @NonNull
- public Builder setTextAppearance(@StyleRes int textAppearance) {
- mTextAppearanceStyle = textAppearance;
- return this;
- }
-
- @NonNull
- public Builder setTypeface(@NonNull Typeface typeface) {
- mTypeface = typeface;
- return this;
- }
-
- @NonNull
- public ToolTip build(){
- return new ToolTip(this);
- }
-
- }
-}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipBackgroundConstructor.java b/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipBackgroundConstructor.java
deleted file mode 100644
index 217dfed1d05ca69a87919e37970b0237cea22cdc..0000000000000000000000000000000000000000
--- a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipBackgroundConstructor.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
-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.
-*/
-
-package com.tomergoldst.tooltips;
-
-import android.content.Context;
-import android.graphics.PorterDuff;
-import android.graphics.drawable.Drawable;
-import android.os.Build;
-import android.view.View;
-
-class ToolTipBackgroundConstructor {
-
- /**
- * Select which background will be assign to the tip view
- */
- static void setBackground(View tipView, ToolTip toolTip) {
-
- // show tool tip without arrow. no need to continue
- if (toolTip.hideArrow()) {
- setToolTipNoArrowBackground(tipView, toolTip.getBackgroundColor());
- return;
- }
-
- // show tool tip according to requested position
- switch (toolTip.getPosition()) {
- case ToolTip.POSITION_ABOVE:
- setToolTipAboveBackground(tipView, toolTip);
- break;
- case ToolTip.POSITION_BELOW:
- setToolTipBelowBackground(tipView, toolTip);
- break;
- case ToolTip.POSITION_LEFT_TO:
- setToolTipLeftToBackground(tipView, toolTip.getBackgroundColor());
- break;
- case ToolTip.POSITION_RIGHT_TO:
- setToolTipRightToBackground(tipView, toolTip.getBackgroundColor());
- break;
- }
-
- }
-
- private static void setToolTipAboveBackground(View tipView, ToolTip toolTip) {
- switch (toolTip.getAlign()) {
- case ToolTip.ALIGN_CENTER:
- setTipBackground(tipView, R.drawable.tooltip_arrow_down, toolTip.getBackgroundColor());
- break;
- case ToolTip.ALIGN_LEFT:
- setTipBackground(tipView,
- !UiUtils.isRtl() ?
- R.drawable.tooltip_arrow_down_left :
- R.drawable.tooltip_arrow_down_right
- , toolTip.getBackgroundColor());
- break;
- case ToolTip.ALIGN_RIGHT:
- setTipBackground(tipView,
- !UiUtils.isRtl() ?
- R.drawable.tooltip_arrow_down_right :
- R.drawable.tooltip_arrow_down_left
- , toolTip.getBackgroundColor());
- break;
- }
- }
-
- private static void setToolTipBelowBackground(View tipView, ToolTip toolTip) {
-
- switch (toolTip.getAlign()) {
- case ToolTip.ALIGN_CENTER:
- setTipBackground(tipView, R.drawable.tooltip_arrow_up, toolTip.getBackgroundColor());
- break;
- case ToolTip.ALIGN_LEFT:
- setTipBackground(tipView,
- !UiUtils.isRtl() ?
- R.drawable.tooltip_arrow_up_left :
- R.drawable.tooltip_arrow_up_right
- , toolTip.getBackgroundColor());
- break;
- case ToolTip.ALIGN_RIGHT:
- setTipBackground(tipView,
- !UiUtils.isRtl() ?
- R.drawable.tooltip_arrow_up_right :
- R.drawable.tooltip_arrow_up_left
- , toolTip.getBackgroundColor());
- break;
- }
-
- }
-
- private static void setToolTipLeftToBackground(View tipView, int color) {
- setTipBackground(tipView, !UiUtils.isRtl() ?
- R.drawable.tooltip_arrow_right : R.drawable.tooltip_arrow_left,
- color);
- }
-
- private static void setToolTipRightToBackground(View tipView, int color) {
- setTipBackground(tipView, !UiUtils.isRtl() ?
- R.drawable.tooltip_arrow_left : R.drawable.tooltip_arrow_right,
- color);
- }
-
- private static void setToolTipNoArrowBackground(View tipView, int color) {
- setTipBackground(tipView, R.drawable.tooltip_no_arrow, color);
- }
-
- private static void setTipBackground(View tipView, int drawableRes, int color){
- Drawable paintedDrawable = getTintedDrawable(tipView.getContext(),
- drawableRes, color);
- setViewBackground(tipView, paintedDrawable);
- }
-
- private static void setViewBackground(View view, Drawable drawable){
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- view.setBackground(drawable);
- } else {
- view.setBackgroundDrawable(drawable);
- }
- }
-
- private static Drawable getTintedDrawable(Context context, int drawableRes, int color){
- Drawable drawable;
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- drawable = context.getResources().getDrawable(drawableRes, null);
- if (drawable != null) {
- drawable.setTint(color);
- }
- } else {
- drawable = context.getResources().getDrawable(drawableRes);
- if (drawable != null) {
- drawable.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
- }
- }
-
- return drawable;
- }
-
-}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipCoordinatesFinder.java b/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipCoordinatesFinder.java
deleted file mode 100644
index 627fbe43422aa5805dd471934ae136b0cf041696..0000000000000000000000000000000000000000
--- a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipCoordinatesFinder.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
-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.
-*/
-
-package com.tomergoldst.tooltips;
-
-import android.graphics.Point;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-class ToolTipCoordinatesFinder {
-
- /**
- * return the top left coordinates for positioning the tip
- *
- * @param tipView - the newly created tip view
- * @param tooltip - tool tip object
- * @return point
- */
- static Point getCoordinates(final TextView tipView, ToolTip tooltip) {
- Point point = new Point();
- final Coordinates anchorViewCoordinates = new Coordinates(tooltip.getAnchorView());
- final Coordinates rootCoordinates = new Coordinates(tooltip.getRootView());
-
- tipView.measure(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
-
- switch (tooltip.getPosition()) {
- case ToolTip.POSITION_ABOVE:
- point = getPositionAbove(tipView, tooltip,
- anchorViewCoordinates, rootCoordinates);
- break;
- case ToolTip.POSITION_BELOW:
- point = getPositionBelow(tipView, tooltip,
- anchorViewCoordinates, rootCoordinates);
- break;
- case ToolTip.POSITION_LEFT_TO:
- point = getPositionLeftTo(tipView, tooltip,
- anchorViewCoordinates, rootCoordinates);
- break;
- case ToolTip.POSITION_RIGHT_TO:
- point = getPositionRightTo(tipView, tooltip,
- anchorViewCoordinates, rootCoordinates);
- break;
- }
-
- // add user defined offset values
- point.x += UiUtils.isRtl() ? -tooltip.getOffsetX() : tooltip.getOffsetX();
- point.y += tooltip.getOffsetY();
-
- // coordinates retrieved are relative to 0,0 of the root layout
- // added view to root is subject to root padding
- // we need to subtract the top and left padding of root from coordinates. to adjust
- // top left tip coordinates
- point.x -= tooltip.getRootView().getPaddingLeft();
- point.y -= tooltip.getRootView().getPaddingTop();
-
- return point;
-
- }
-
- private static Point getPositionRightTo(TextView tipView, ToolTip toolTip, Coordinates anchorViewCoordinates, Coordinates rootLocation) {
- Point point = new Point();
- point.x = anchorViewCoordinates.right;
- AdjustRightToOutOfBounds(tipView, toolTip.getRootView(), point, anchorViewCoordinates, rootLocation);
- point.y = anchorViewCoordinates.top + getYCenteringOffset(tipView, toolTip);
- return point;
- }
-
- private static Point getPositionLeftTo(TextView tipView, ToolTip toolTip, Coordinates anchorViewCoordinates, Coordinates rootLocation) {
- Point point = new Point();
- point.x = anchorViewCoordinates.left - tipView.getMeasuredWidth();
- AdjustLeftToOutOfBounds(tipView, toolTip.getRootView(), point, anchorViewCoordinates, rootLocation);
- point.y = anchorViewCoordinates.top + getYCenteringOffset(tipView, toolTip);
- return point;
- }
-
- private static Point getPositionBelow(TextView tipView, ToolTip toolTip, Coordinates anchorViewCoordinates, Coordinates rootLocation) {
- Point point = new Point();
- point.x = anchorViewCoordinates.left + getXOffset(tipView, toolTip);
- if (toolTip.alignedCenter()) {
- AdjustHorizontalCenteredOutOfBounds(tipView, toolTip.getRootView(), point, rootLocation);
- } else if (toolTip.alignedLeft()){
- AdjustHorizontalLeftAlignmentOutOfBounds(tipView, toolTip.getRootView(), point, anchorViewCoordinates, rootLocation);
- } else if (toolTip.alignedRight()){
- AdjustHorizotalRightAlignmentOutOfBounds(tipView, toolTip.getRootView(), point, anchorViewCoordinates, rootLocation);
- }
- point.y = anchorViewCoordinates.bottom;
- return point;
- }
-
- private static Point getPositionAbove(TextView tipView, ToolTip toolTip,
- Coordinates anchorViewCoordinates, Coordinates rootLocation) {
- Point point = new Point();
- point.x = anchorViewCoordinates.left + getXOffset(tipView, toolTip);
- if (toolTip.alignedCenter()) {
- AdjustHorizontalCenteredOutOfBounds(tipView, toolTip.getRootView(), point, rootLocation);
- } else if (toolTip.alignedLeft()){
- AdjustHorizontalLeftAlignmentOutOfBounds(tipView, toolTip.getRootView(), point, anchorViewCoordinates, rootLocation);
- } else if (toolTip.alignedRight()){
- AdjustHorizotalRightAlignmentOutOfBounds(tipView, toolTip.getRootView(), point, anchorViewCoordinates, rootLocation);
- }
- point.y = anchorViewCoordinates.top - tipView.getMeasuredHeight();
- return point;
- }
-
- private static void AdjustRightToOutOfBounds(TextView tipView, ViewGroup root, Point point, Coordinates anchorViewCoordinates, Coordinates rootLocation) {
- ViewGroup.LayoutParams params = tipView.getLayoutParams();
- int availableSpace = rootLocation.right - root.getPaddingRight() - anchorViewCoordinates.right;
- if (point.x + tipView.getMeasuredWidth() > rootLocation.right - root.getPaddingRight()){
- params.width = availableSpace;
- params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
- tipView.setLayoutParams(params);
- measureViewWithFixedWidth(tipView, params.width);
- }
- }
-
- private static void AdjustLeftToOutOfBounds(TextView tipView, ViewGroup root, Point point, Coordinates anchorViewCoordinates, Coordinates rootLocation) {
- ViewGroup.LayoutParams params = tipView.getLayoutParams();
- int rootLeft = rootLocation.left + root.getPaddingLeft();
- if (point.x < rootLeft){
- int availableSpace = anchorViewCoordinates.left - rootLeft;
- point.x = rootLeft;
- params.width = availableSpace;
- params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
- tipView.setLayoutParams(params);
- measureViewWithFixedWidth(tipView, params.width);
- }
- }
-
- private static void AdjustHorizotalRightAlignmentOutOfBounds(TextView tipView, ViewGroup root,
- Point point, Coordinates anchorViewCoordinates,
- Coordinates rootLocation) {
- ViewGroup.LayoutParams params = tipView.getLayoutParams();
- int rootLeft = rootLocation.left + root.getPaddingLeft();
- if (point.x < rootLeft){
- int availableSpace = anchorViewCoordinates.right - rootLeft;
- point.x = rootLeft;
- params.width = availableSpace;
- params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
- tipView.setLayoutParams(params);
- measureViewWithFixedWidth(tipView, params.width);
- }
- }
-
- private static void AdjustHorizontalLeftAlignmentOutOfBounds(TextView tipView, ViewGroup root,
- Point point, Coordinates anchorViewCoordinates,
- Coordinates rootLocation) {
- ViewGroup.LayoutParams params = tipView.getLayoutParams();
- int rootRight = rootLocation.right - root.getPaddingRight();
- if (point.x + tipView.getMeasuredWidth() > rootRight){
- params.width = rootRight - anchorViewCoordinates.left;
- params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
- tipView.setLayoutParams(params);
- measureViewWithFixedWidth(tipView, params.width);
- }
- }
-
- private static void AdjustHorizontalCenteredOutOfBounds(TextView tipView, ViewGroup root,
- Point point, Coordinates rootLocation) {
- ViewGroup.LayoutParams params = tipView.getLayoutParams();
- int rootWidth = root.getWidth() - root.getPaddingLeft() - root.getPaddingRight();
- if (tipView.getMeasuredWidth() > rootWidth) {
- point.x = rootLocation.left + root.getPaddingLeft();
- params.width = rootWidth;
- params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
- tipView.setLayoutParams(params);
- measureViewWithFixedWidth(tipView, rootWidth);
- }
- }
-
-
- private static void measureViewWithFixedWidth(TextView tipView, int width) {
- tipView.measure(View.MeasureSpec.makeMeasureSpec(width,
- View.MeasureSpec.EXACTLY), ViewGroup.LayoutParams.WRAP_CONTENT);
- }
-
- /**
- * calculate the amount of movement need to be taken inorder to align tip
- * on X axis according to "align" parameter
- * @return int
- */
- private static int getXOffset(View tipView, ToolTip toolTip) {
- int offset;
-
- switch (toolTip.getAlign()) {
- case ToolTip.ALIGN_CENTER:
- offset = ((toolTip.getAnchorView().getWidth() - tipView.getMeasuredWidth()) / 2);
- break;
- case ToolTip.ALIGN_LEFT:
- offset = 0;
- break;
- case ToolTip.ALIGN_RIGHT:
- offset = toolTip.getAnchorView().getWidth() - tipView.getMeasuredWidth();
- break;
- default:
- offset = 0;
- break;
- }
-
- return offset;
- }
-
- /**
- * calculate the amount of movement need to be taken inorder to center tip
- * on Y axis
- * @return int
- */
- private static int getYCenteringOffset(View tipView, ToolTip toolTip) {
- return (toolTip.getAnchorView().getHeight() - tipView.getMeasuredHeight()) / 2;
- }
-
-}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipsManager.java b/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipsManager.java
deleted file mode 100644
index f58f422a798dba2b60b78b1009c9af7a4c2f843b..0000000000000000000000000000000000000000
--- a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipsManager.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
-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.
-*/
-
-package com.tomergoldst.tooltips;
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.annotation.SuppressLint;
-import android.graphics.Outline;
-import android.graphics.Point;
-import android.graphics.Typeface;
-import android.os.Build;
-import android.util.Log;
-import android.view.View;
-import android.view.ViewOutlineProvider;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ToolTipsManager {
-
- private static final String TAG = ToolTipsManager.class.getSimpleName();
-
- private static final int DEFAULT_ANIM_DURATION = 400;
-
- // Parameter for managing tip creation or reuse
- private Map mTipsMap = new HashMap<>();
-
- private int mAnimationDuration;
- @NonNull
- private ToolTipAnimator mToolTipAnimator;
- @Nullable
- private TipListener mListener;
-
- public interface TipListener {
- void onTipDismissed(View view, int anchorViewId, boolean byUser);
- }
-
- public ToolTipsManager(){
- mAnimationDuration = DEFAULT_ANIM_DURATION;
- mToolTipAnimator = new DefaultToolTipAnimator();
- }
-
- public ToolTipsManager(@NonNull TipListener listener){
- this();
- mListener = listener;
- }
-
- public View show(ToolTip toolTip) {
- View tipView = create(toolTip);
- if (tipView == null) {
- return null;
- }
-
- // animate tip visibility
- mToolTipAnimator.popup(tipView, mAnimationDuration).start();
-
- return tipView;
- }
-
- private View create(ToolTip toolTip) {
-
- if (toolTip.getAnchorView() == null) {
- Log.e(TAG, "Unable to create a tip, anchor view is null");
- return null;
- }
-
- if (toolTip.getRootView() == null) {
- Log.e(TAG, "Unable to create a tip, root layout is null");
- return null;
- }
-
- // only one tip is allowed near an anchor view at the same time, thus
- // reuse tip if already exist
- if (mTipsMap.containsKey(toolTip.getAnchorView().getId())) {
- return mTipsMap.get(toolTip.getAnchorView().getId());
- }
-
- // init tip view parameters
- TextView tipView = createTipView(toolTip);
-
- // on RTL languages replace sides
- if (UiUtils.isRtl()) {
- switchToolTipSidePosition(toolTip);
- }
-
- // set tool tip background / shape
- ToolTipBackgroundConstructor.setBackground(tipView, toolTip);
-
- // add tip to root layout
- toolTip.getRootView().addView(tipView);
-
- // find where to position the tool tip
- Point p = ToolTipCoordinatesFinder.getCoordinates(tipView, toolTip);
-
- // move tip view to correct position
- moveTipToCorrectPosition(tipView, p);
-
- // set dismiss on click
- tipView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- dismiss(view, true);
- }
- });
-
- // bind tipView with anchorView id
- int anchorViewId = toolTip.getAnchorView().getId();
- tipView.setTag(anchorViewId);
-
- // enter tip to map by 'anchorView' id
- mTipsMap.put(anchorViewId, tipView);
-
- return tipView;
-
- }
-
- private void moveTipToCorrectPosition(TextView tipView, Point p) {
- Coordinates tipViewCoordinates = new Coordinates(tipView);
- int translationX = p.x - tipViewCoordinates.left;
- int translationY = p.y - tipViewCoordinates.top;
- tipView.setTranslationX(!UiUtils.isRtl() ? translationX : -translationX);
- tipView.setTranslationY(translationY);
- }
-
- @NonNull
- private TextView createTipView(ToolTip toolTip) {
- TextView tipView = new TextView(toolTip.getContext());
- tipView.setText(toolTip.getMessage());
- tipView.setVisibility(View.INVISIBLE);
- tipView.setGravity(toolTip.getTextGravity());
- setTextAppearance(tipView, toolTip);
- setTextTypeFace(tipView, toolTip);
- setTipViewElevation(tipView, toolTip);
- return tipView;
- }
-
- private void setTextAppearance(TextView tipView, ToolTip toolTip) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- tipView.setTextAppearance(toolTip.getTextAppearanceStyle());
- } else {
- tipView.setTextAppearance(toolTip.getContext(), toolTip.getTextAppearanceStyle());
- }
- }
-
- /**
- * Sets the custom typeface on the tipView if it was provided via {@link ToolTip}.
- */
- private void setTextTypeFace(TextView tipView, ToolTip toolTip) {
- if (toolTip.getTypeface() != null) {
- Typeface existingTypeFace = tipView.getTypeface();
- if (existingTypeFace != null) {
- // Preserve the text style defined in the text appearance style if available
- tipView.setTypeface(toolTip.getTypeface(), existingTypeFace.getStyle());
- } else {
- tipView.setTypeface(toolTip.getTypeface());
- }
- }
- }
-
- private void setTipViewElevation(TextView tipView, ToolTip toolTip) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- if (toolTip.getElevation() > 0) {
- ViewOutlineProvider viewOutlineProvider = new ViewOutlineProvider() {
- @SuppressLint("NewApi")
- @Override
- public void getOutline(View view, Outline outline) {
- outline.setEmpty();
- }
- };
- tipView.setOutlineProvider(viewOutlineProvider);
- tipView.setElevation(toolTip.getElevation());
- }
- }
- }
-
- private void switchToolTipSidePosition(ToolTip toolTip) {
- if (toolTip.positionedLeftTo()) {
- toolTip.setPosition(ToolTip.POSITION_RIGHT_TO);
- } else if (toolTip.positionedRightTo()) {
- toolTip.setPosition(ToolTip.POSITION_LEFT_TO);
- }
- }
-
- public void setAnimationDuration(int duration){
- mAnimationDuration = duration;
- }
-
- /**
- * Set a custom tooltip animator to override show and hide animation.
- * @param animator ToolTipAnimator
- */
- public void setToolTipAnimator(@NonNull ToolTipAnimator animator) {
- mToolTipAnimator = animator;
- }
-
- public boolean dismiss(View tipView, boolean byUser) {
- if (tipView != null && isVisible(tipView)) {
- int key = (int) tipView.getTag();
- mTipsMap.remove(key);
- animateDismiss(tipView, byUser);
- return true;
- }
- return false;
- }
-
- public boolean dismiss(Integer key) {
- return mTipsMap.containsKey(key) && dismiss(mTipsMap.get(key), false);
- }
-
- public View find(Integer key) {
- if (mTipsMap.containsKey(key)) {
- return mTipsMap.get(key);
- }
- return null;
- }
-
- public boolean findAndDismiss(final View anchorView) {
- View view = find(anchorView.getId());
- return view != null && dismiss(view, false);
- }
-
- public void dismissAll() {
- if (!mTipsMap.isEmpty()) {
- List> entries = new ArrayList<>(mTipsMap.entrySet());
- for (Map.Entry entry : entries) {
- dismiss(entry.getValue(), false);
- }
- }
- mTipsMap.clear();
- }
-
- private void animateDismiss(final View view, final boolean byUser) {
- mToolTipAnimator.popout(view, mAnimationDuration, new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- if (mListener != null){
- mListener.onTipDismissed(view, (Integer) view.getTag(), byUser);
- }
- }
- }).start();
- }
-
- public boolean isVisible(View tipView) {
- return tipView.getVisibility() == View.VISIBLE;
- }
-
-}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltips/Coordinates.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/Coordinates.java
similarity index 84%
rename from tooltips/src/main/java/com/tomergoldst/tooltips/Coordinates.java
rename to tooltips/src/main/java/com/tomergoldst/tooltipshm/Coordinates.java
index 9b28a94b61b298483b5d0e4f3291cd91fa377924..62ce9a5dc9891dcde6fa915ffd01bb0aadc3bf2b 100644
--- a/tooltips/src/main/java/com/tomergoldst/tooltips/Coordinates.java
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/Coordinates.java
@@ -14,25 +14,22 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.tomergoldst.tooltips;
+package com.tomergoldst.tooltipshm;
-import android.view.View;
+import ohos.agp.components.Component;
class Coordinates {
-
int left;
int top;
int right;
int bottom;
- Coordinates(View view) {
+ Coordinates(Component view) {
int[] location = new int[2];
- view.getLocationOnScreen(location);
+ view.getLocationOnScreen();
left = location[0];
right = left + view.getWidth();;
top = location[1];
bottom = top + view.getHeight();
}
-
-
-}
+}
\ No newline at end of file
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltips/DefaultToolTipAnimator.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/DefaultToolTipAnimator.java
similarity index 31%
rename from tooltips/src/main/java/com/tomergoldst/tooltips/DefaultToolTipAnimator.java
rename to tooltips/src/main/java/com/tomergoldst/tooltipshm/DefaultToolTipAnimator.java
index 7426ae9b196b2d359e4a167832c8dd0e75a2c81f..d0db2ff460aa2189388905a19f41a059e0017390 100644
--- a/tooltips/src/main/java/com/tomergoldst/tooltips/DefaultToolTipAnimator.java
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/DefaultToolTipAnimator.java
@@ -1,10 +1,8 @@
/*
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
@@ -14,52 +12,60 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.tomergoldst.tooltips;
+package com.tomergoldst.tooltipshm;
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.animation.PropertyValuesHolder;
-import android.view.View;
-import android.view.animation.AnticipateOvershootInterpolator;
-import android.view.animation.OvershootInterpolator;
+import ohos.agp.animation.Animator;
+import ohos.agp.animation.AnimatorProperty;
+import ohos.agp.components.Component;
class DefaultToolTipAnimator implements ToolTipAnimator {
+ @Override
+ public AnimatorProperty popup(Component view, long duration) {
+ view.setVisibility(Component.VISIBLE);
+ AnimatorProperty abovePopup = new AnimatorProperty();
+ abovePopup.alphaFrom(0).alpha(90).setCurveType(new Animator.CurveType().ANTICIPATE).setDuration(500);
+ abovePopup.setTarget(view);
+ return abovePopup;
+ }
@Override
- public ObjectAnimator popup(final View view, final long duration) {
- view.setAlpha(0);
- view.setVisibility(View.VISIBLE);
+ public AnimatorProperty popout(final Component view, final long duration, final AnimatorProperty animatorListenerAdapter) {
+ AnimatorProperty animatorValue = new AnimatorProperty();
+ animatorValue.alpha(0).scaleX(0).scaleY(0).setDuration(duration).setCurveType(3);
+ view.setVisibility(Component.INVISIBLE);
+ if (animatorListenerAdapter != null) {
+ animatorListenerAdapter.end();
+ }
+ animatorValue.setStateChangedListener(new AnimatorProperty.StateChangedListener() {
+ @Override
+ public void onStart(Animator animator) {
+ }
- ObjectAnimator popup = ObjectAnimator.ofPropertyValuesHolder(view,
- PropertyValuesHolder.ofFloat("alpha", 0f, 1f),
- PropertyValuesHolder.ofFloat("scaleX", 0f, 1f),
- PropertyValuesHolder.ofFloat("scaleY", 0f, 1f));
- popup.setDuration(duration);
- popup.setInterpolator(new OvershootInterpolator());
+ @Override
+ public void onStop(Animator animator) {
+ }
- return popup;
- }
+ @Override
+ public void onCancel(Animator animator) {
+ }
- @Override
- public ObjectAnimator popout(final View view, final long duration, final AnimatorListenerAdapter animatorListenerAdapter) {
- ObjectAnimator popout = ObjectAnimator.ofPropertyValuesHolder(view,
- PropertyValuesHolder.ofFloat("alpha", 1f, 0f),
- PropertyValuesHolder.ofFloat("scaleX", 1f, 0f),
- PropertyValuesHolder.ofFloat("scaleY", 1f, 0f));
- popout.setDuration(duration);
- popout.addListener(new AnimatorListenerAdapter() {
@Override
- public void onAnimationEnd(Animator animation) {
- super.onAnimationEnd(animation);
- view.setVisibility(View.GONE);
+ public void onEnd(Animator animator) {
+ view.setVisibility(Component.INVISIBLE);
if (animatorListenerAdapter != null) {
- animatorListenerAdapter.onAnimationEnd(animation);
+ animatorListenerAdapter.end();
}
}
+
+ @Override
+ public void onPause(Animator animator) {
+ }
+
+ @Override
+ public void onResume(Animator animator) {
+ }
});
- popout.setInterpolator(new AnticipateOvershootInterpolator());
- return popout;
+ return animatorValue;
}
}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/TextUtils.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/TextUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..7c1b6eae335dffc0b9b3f0481ee1a65a60297175
--- /dev/null
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/TextUtils.java
@@ -0,0 +1,7 @@
+package com.tomergoldst.tooltipshm;
+
+public class TextUtils {
+ public static boolean isEmpty(CharSequence str) {
+ return str == null || str.length() == 0;
+ }
+}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTip.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTip.java
new file mode 100644
index 0000000000000000000000000000000000000000..ff7db7387ed432161217c962f361d7df7de0cc97
--- /dev/null
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTip.java
@@ -0,0 +1,51 @@
+
+/*
+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.
+*/
+
+package com.tomergoldst.tooltipshm;
+
+import ohos.agp.components.Text;
+import ohos.app.Context;
+
+public class ToolTip {
+ private final Context mContext;
+ private final Text mTextView;
+
+ public ToolTip(Builder builder) {
+ mContext = builder.mContext;
+ mTextView = builder.mTextView;
+ }
+
+ public Context getContext() {
+ return mContext;
+ }
+
+ public Text getmTextView() {
+ return mTextView;
+ }
+
+
+ public static class Builder {
+ private final Context mContext;
+ private final Text mTextView;
+
+ public Builder(Context context, Text textView) {
+ mContext = context;
+ mTextView = textView;
+ }
+
+ public ToolTip build() {
+ return new ToolTip(this);
+ }
+ }
+}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipAnimator.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipAnimator.java
similarity index 35%
rename from tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipAnimator.java
rename to tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipAnimator.java
index 9f959172eaefe8a459e591d06c8886ffa9ea5d8e..e56e9c1e46fcaf7a44dcb62ea30ada654c5f0882 100644
--- a/tooltips/src/main/java/com/tomergoldst/tooltips/ToolTipAnimator.java
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipAnimator.java
@@ -1,24 +1,23 @@
-package com.tomergoldst.tooltips;
+package com.tomergoldst.tooltipshm;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.ObjectAnimator;
-import android.view.View;
+import ohos.agp.animation.AnimatorProperty;
+import ohos.agp.components.Component;
public interface ToolTipAnimator {
/**
- * Object animator for the tooltip view to pop-up.
+ * Object animator for the tooltip view to pop-up
* @param view The tooltip view.
* @param duration Duration for the animator.
* @return ObjectAnimator
*/
- ObjectAnimator popup(final View view, final long duration);
+ AnimatorProperty popup(Component view, long duration);
/**
- * Object animator for the tooltip view to pop-out/hide.
+ * Object animator for the tooltip view to pop-out/hide
* @param view The tooltip view.
* @param duration Duration for the animator.
- * @param animatorListenerAdapter The animator listener adapter to listen for animation event.
+ * @param animator animator for the animator
* @return ObjectAnimator
*/
- ObjectAnimator popout(final View view, final long duration, final AnimatorListenerAdapter animatorListenerAdapter);
+ AnimatorProperty popout(Component view, long duration, AnimatorProperty animator);
}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipBackgroundConstructor.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipBackgroundConstructor.java
new file mode 100644
index 0000000000000000000000000000000000000000..d77588a2330df4fa7ce1c0c1bcbfcb98dbd0c98a
--- /dev/null
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipBackgroundConstructor.java
@@ -0,0 +1,39 @@
+/*
+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.
+*/
+
+package com.tomergoldst.tooltipshm;
+
+import ohos.agp.components.Text;
+import ohos.agp.components.element.PixelMapElement;
+import ohos.global.resource.NotExistException;
+
+import java.io.IOException;
+
+class ToolTipBackgroundConstructor {
+ /**
+ * Select which background will be assign to the tip view
+ */
+ static void setBackground(Text idAboveImageview, int imgResouse) {
+ try {
+ PixelMapElement pixelMapElement = new PixelMapElement(idAboveImageview.getResourceManager().getResource(imgResouse));
+ idAboveImageview.setBackground(pixelMapElement);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (NotExistException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipCoordinatesFinder.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipCoordinatesFinder.java
new file mode 100644
index 0000000000000000000000000000000000000000..7dea212881d5c5c883bb176a1b87b2f5503ea2ba
--- /dev/null
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipCoordinatesFinder.java
@@ -0,0 +1,52 @@
+/*
+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.
+*/
+
+package com.tomergoldst.tooltipshm;
+
+import ohos.agp.components.Text;
+import ohos.agp.utils.TextAlignment;
+
+class ToolTipCoordinatesFinder {
+ public static void getPositionRightTo(String textRight, Text textView, Text rightImageView) {
+ float fy = textView.getContentPositionY() + textView.getEstimatedHeight() / 2 - rightImageView.getEstimatedHeight() / 2;
+ float fx = textView.getContentPositionX() + textView.getEstimatedWidth();
+ rightImageView.setContentPosition(fx, fy);
+ rightImageView.setText(textRight);
+ rightImageView.setTextAlignment(TextAlignment.CENTER);
+ }
+
+ public static void getPositionLeftTo(String textLeft, Text mtextView, Text leftImageView) {
+ float lefty = mtextView.getContentPositionY() + mtextView.getEstimatedHeight() / 2 - leftImageView.getEstimatedHeight() / 2;
+ float leftx = mtextView.getContentPositionX() - 6 * mtextView.getEstimatedWidth() / 5;
+ leftImageView.setContentPosition(leftx, lefty);
+ leftImageView.setText(textLeft);
+ leftImageView.setTextAlignment(TextAlignment.CENTER);
+ }
+
+ public static void getPositionBelow(String editText, Text idBelowimageView, Text textView) {
+ idBelowimageView.setText(editText);
+ idBelowimageView.setTextAlignment(TextAlignment.CENTER);
+ float leftBelowy = textView.getContentPositionY() + textView.getEstimatedHeight();
+ float leftBelowx = textView.getContentPositionX() + textView.getEstimatedWidth() / 2 - idBelowimageView.getEstimatedWidth() / 2;
+ idBelowimageView.setContentPosition(leftBelowx, leftBelowy);
+ }
+
+ public static void getPositionAbove(Text idAboveImageview, Text textView) {
+ float leftAbovey = textView.getContentPositionY() - idAboveImageview.getEstimatedHeight();
+ float leftAbovex = textView.getContentPositionX() + textView.getEstimatedWidth() / 2 - idAboveImageview.getEstimatedWidth() / 2;
+ idAboveImageview.setContentPosition(leftAbovex, leftAbovey);
+ }
+}
\ No newline at end of file
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java
new file mode 100644
index 0000000000000000000000000000000000000000..00b95cd22c891f562245008ebae4413e554fd08f
--- /dev/null
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/ToolTipsManager.java
@@ -0,0 +1,382 @@
+/*
+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.
+*/
+
+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 {
+ private static final int DEFAULT_ANIM_DURATION = 400;
+ private static final String TIP_TEXT = "Tool Tip";
+ private static final String TIP_TEXT_LARGE = "Large Tool Tip";
+ private static final String TIP_TEXT_SMALL = "Small tool Tip";
+ private TextField mEditText;
+ private int mAnimationDuration;
+ private ToolTipAnimator mToolTipAnimator;
+ private Text idAboveImageview;
+ private Text idBelowimageView;
+ private Text leftImageView;
+ private Text rightImageView;
+ private Button mAboveBtn;
+ private Button mBelowBtn;
+ private Button mLeftToBtn;
+ private Button mRightToBtn;
+ private RRadioButton checkboxLeft;
+ private RRadioButton checkboxCenter;
+ private RRadioButton checkboxRight;
+ private List checkList;
+ private List buttons;
+ private List texts;
+ private Text textView;
+ private DependentLayout dlInitLayout;
+ private Text showTextView;
+ private static final int ZERO = 0;
+ private static final int FIRST = 1;
+ private static final int TWO = 2;
+ private static final int THREE = 3;
+ private static final int FOUR = 4;
+
+ /**
+ * empty build ToolTipsManager
+ */
+ public ToolTipsManager() {
+ mAnimationDuration = DEFAULT_ANIM_DURATION;
+ mToolTipAnimator = new DefaultToolTipAnimator();
+ }
+
+ /**
+ * ToolTipsManager
+ *
+ * @param dlInitLayout
+ * @param meditText
+ * @param texts
+ * @param buttons
+ * @param checkList
+ */
+ public ToolTipsManager(DependentLayout dlInitLayout,TextField meditText, List texts,
+ List buttons, List checkList) {
+ this();
+ this.dlInitLayout = dlInitLayout;
+ this.mEditText = meditText;
+ this.texts = texts;
+ this.checkList = checkList;
+ this.buttons = buttons;
+ this.texts = texts;
+ this.checkboxLeft = checkList.get(ZERO);
+ checkboxCenter = checkList.get(FIRST);
+ checkboxRight = checkList.get(TWO);
+
+ mAboveBtn = buttons.get(ZERO);
+ mBelowBtn = buttons.get(FIRST);
+ mLeftToBtn = buttons.get(TWO);
+ mRightToBtn = buttons.get(THREE);
+
+ idAboveImageview = texts.get(ZERO);
+ idBelowimageView = texts.get(FIRST);
+ leftImageView = texts.get(TWO);
+ rightImageView = texts.get(THREE);
+ showTextView = texts.get(FOUR);
+
+ initCheckBoxLeft();
+ checkboxCenterClick();
+ checkBoxRightClick();
+ }
+
+ /** tip show
+ * @param tag
+ * @param toolTip
+ */
+ public void show(int tag,ToolTip toolTip) {
+ Text tipView = toolTip.getmTextView();
+ showTextView = tipView;
+ if (tag == FIRST) {
+ showAbove();
+ } else if (tag == TWO) {
+ showBelow();
+ } else if (tag == THREE) {
+ showLeft();
+ } else if (tag == FOUR) {
+ showRight();
+ }
+ }
+
+ private void create(Text idImageview, int resource) {
+ ToolTipBackgroundConstructor.setBackground(idImageview, resource);
+ }
+
+ /**
+ * 展示顶部位置
+ */
+ public void showAbove() {
+ String textAbove = com.tomergoldst.tooltipshm.TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString();
+ idAboveImageview.setText(textAbove);
+ idAboveImageview.setTextAlignment(TextAlignment.CENTER);
+ idAboveImageview.setVisibility(Component.VISIBLE);
+ ToolTipCoordinatesFinder.getPositionAbove(idAboveImageview, showTextView);
+ create(idAboveImageview, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_down);
+ visable(idBelowimageView, leftImageView, rightImageView);
+ mToolTipAnimator.popup(idAboveImageview, mAnimationDuration).start();
+ idAboveImageview.setClickedListener(component -> findAndDismiss(idAboveImageview));
+ }
+
+ /**
+ * 展示底部位置
+ */
+ public void showBelow() {
+ String textBelow = com.tomergoldst.tooltipshm.TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT : mEditText.getText().toString();
+ idBelowimageView.setVisibility(Component.VISIBLE);
+ create(idBelowimageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_up);
+ ToolTipCoordinatesFinder.getPositionBelow(textBelow, idBelowimageView, showTextView);
+ visable(idAboveImageview, leftImageView, rightImageView);
+ mToolTipAnimator.popup(idBelowimageView, mAnimationDuration).start();
+ idBelowimageView.setClickedListener(component -> findAndDismiss(idBelowimageView));
+ }
+
+ /**
+ * 展示左侧位置
+ *
+ * @param
+ */
+ public void showLeft() {
+ String textLeft = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT_SMALL : mEditText.getText().toString();
+ leftImageView.setVisibility(Component.VISIBLE);
+ create(leftImageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_right);
+ ToolTipCoordinatesFinder.getPositionLeftTo(textLeft, showTextView, leftImageView);
+ visable(idAboveImageview, idBelowimageView, rightImageView);
+ mToolTipAnimator.popup(leftImageView, mAnimationDuration).start();
+ leftImageView.setClickedListener(component -> findAndDismiss(leftImageView));
+ }
+
+ /**
+ * 展示右侧位置
+ */
+ public void showRight() {
+ String textRight = TextUtils.isEmpty(mEditText.getText()) ? TIP_TEXT_LARGE : mEditText.getText().toString();
+ rightImageView.setVisibility(Component.VISIBLE);
+ create(rightImageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_left);
+ ToolTipCoordinatesFinder.getPositionRightTo(textRight, showTextView, rightImageView);
+ visable(idAboveImageview, idBelowimageView, leftImageView);
+ mToolTipAnimator.popup(rightImageView, mAnimationDuration).start();
+ rightImageView.setClickedListener(component -> findAndDismiss(rightImageView));
+ }
+
+ /**
+ * 展示是否可见
+ *
+ * @param aboveImageview
+ * @param belowimageView
+ * @param leftView
+ */
+ public void visable(Text aboveImageview, Text belowimageView, Text leftView) {
+ dlInitLayout.setVisibility(Component.HIDE);
+ aboveImageview.setVisibility(Component.HIDE);
+ belowimageView.setVisibility(Component.HIDE);
+ leftView.setVisibility(Component.HIDE);
+ }
+
+ /**
+ * dismiss TipView
+ */
+ public void dismissAll() {
+ AnimatorProperty animatorValue = new AnimatorProperty();
+ animatorValue.alphaFrom(0).alpha(0).setCurveType(new Animator.CurveType().ANTICIPATE_OVERSHOOT).setDuration(500);
+ animatorValue.setTarget(dlInitLayout);
+ animatorValue.start();
+ dlInitLayout.setVisibility(Component.HIDE);
+ idAboveImageview.setVisibility(Component.HIDE);
+ idBelowimageView.setVisibility(Component.HIDE);
+ rightImageView.setVisibility(Component.HIDE);
+ leftImageView.setVisibility(Component.HIDE);
+ }
+
+ /**
+ * dismiss 对话框
+ * =
+ */
+ public void dismissDialog() {
+ dlInitLayout.setVisibility(Component.HIDE);
+ AnimatorProperty abovePopup = new AnimatorProperty();
+ abovePopup.alphaFrom(0).alpha(0).setCurveType(new Animator.CurveType().ANTICIPATE).setDuration(1000);
+ abovePopup.setTarget(dlInitLayout);
+ abovePopup.start();
+ }
+
+ /**
+ * find dismiss
+ *
+ * @param view
+ */
+ public void findAndDismiss(Text view) {
+ view.setVisibility(Component.HIDE);
+ isAnimateDismiss(view);
+ }
+
+ /**
+ * isAnimate Dismiss
+ *
+ * @param view
+ */
+ private void isAnimateDismiss(final Text view) {
+ AnimatorProperty abovePopup = new AnimatorProperty();
+ abovePopup.alphaFrom(0).alpha(0).setCurveType(new Animator.CurveType().ANTICIPATE).setDuration(1000);
+ abovePopup.setTarget(view);
+ abovePopup.start();
+ }
+
+ /**
+ * 左边checkbox点击事件
+ */
+ private void initCheckBoxLeft() {
+ checkboxLeft.setCheckedStateChangedListener(new AbsButton.CheckedStateChangedListener() {
+ @Override
+ public void onCheckedChanged(AbsButton absButton, boolean isSelect) {
+ if (isSelect) {
+ checkboxLeft.setChecked(true);
+ checkboxCenter.setChecked(false);
+ checkboxRight.setChecked(false);
+ mAboveBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showAbove();
+ create(idAboveImageview, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_down_left);
+ }
+ });
+ mBelowBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showBelow();
+ create(idBelowimageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_up_left);
+ }
+ });
+ mLeftToBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showLeft();
+ create(leftImageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_right);
+ }
+ });
+ mRightToBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showRight();
+ create(rightImageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_left);
+ }
+ });
+ }
+ }
+ });
+ }
+
+ /**
+ * 中间checkbox点击事件
+ */
+ private void checkboxCenterClick() {
+ checkboxCenter.setCheckedStateChangedListener(new AbsButton.CheckedStateChangedListener() {
+ @Override
+ public void onCheckedChanged(AbsButton absButton, boolean isSelect) {
+ if (isSelect) {
+ checkboxLeft.setChecked(false);
+ checkboxCenter.setChecked(true);
+ checkboxRight.setChecked(false);
+ mAboveBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showAbove();
+ create(idAboveImageview, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_down);
+ }
+ });
+ mBelowBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showBelow();
+ create(idBelowimageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_up);
+ }
+ });
+
+ mLeftToBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showLeft();
+ leftImageView.setVisibility(Component.VISIBLE);
+ create(leftImageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_right);
+ }
+ });
+
+ mRightToBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showRight();
+ create(rightImageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_left);
+ }
+ });
+ }
+ }
+ });
+ }
+
+ /**
+ * 右边checkbox点击事件
+ */
+ private void checkBoxRightClick() {
+ checkboxRight.setCheckedStateChangedListener(new AbsButton.CheckedStateChangedListener() {
+ @Override
+ public void onCheckedChanged(AbsButton absButton, boolean isSelect) {
+ if (isSelect) {
+ checkboxLeft.setChecked(false);
+ checkboxCenter.setChecked(false);
+ checkboxRight.setChecked(true);
+ mAboveBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showAbove();
+ create(idAboveImageview, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_down_right);
+ }
+ });
+
+ mBelowBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showBelow();
+ create(idBelowimageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_up_right);
+ }
+ });
+
+ mLeftToBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showLeft();
+ create(leftImageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_right);
+ }
+ });
+
+ mRightToBtn.setClickedListener(new Component.ClickedListener() {
+ @Override
+ public void onClick(Component component) {
+ showRight();
+ create(rightImageView, com.tomergoldst.tooltipshm.ResourceTable.Media_tooltip_arrow_left);
+ }
+ });
+ }
+ }
+ });
+ }
+}
diff --git a/tooltips/src/main/java/com/tomergoldst/tooltips/UiUtils.java b/tooltips/src/main/java/com/tomergoldst/tooltipshm/UiUtils.java
similarity index 87%
rename from tooltips/src/main/java/com/tomergoldst/tooltips/UiUtils.java
rename to tooltips/src/main/java/com/tomergoldst/tooltipshm/UiUtils.java
index 752895ae94bc223f77b193f41748d467089b3b8d..06c953a3430cf306dc7cae5500efe982388b7b42 100644
--- a/tooltips/src/main/java/com/tomergoldst/tooltips/UiUtils.java
+++ b/tooltips/src/main/java/com/tomergoldst/tooltipshm/UiUtils.java
@@ -14,12 +14,11 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
-package com.tomergoldst.tooltips;
+package com.tomergoldst.tooltipshm;
import java.util.Locale;
class UiUtils {
-
public static boolean isRtl() {
return isRtl(Locale.getDefault());
}
@@ -29,4 +28,8 @@ class UiUtils {
return directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT ||
directionality == Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC;
}
+
+ public static boolean isEmpty(CharSequence str) {
+ return str == null || str.length() == 0;
+ }
}
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down.9.png b/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down.9.png
deleted file mode 100644
index 2b68a40386524816ef9a5e035a7c7f851c89e256..0000000000000000000000000000000000000000
Binary files a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down.9.png and /dev/null differ
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down_left.9.png b/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down_left.9.png
deleted file mode 100644
index 28e3a7fb94ae25c38b39bd7ce7f36adf82c3bdbb..0000000000000000000000000000000000000000
Binary files a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down_left.9.png and /dev/null differ
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down_right.9.png b/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down_right.9.png
deleted file mode 100644
index 6b8cd364c0199d8831be3f7d98df344b8e82cf24..0000000000000000000000000000000000000000
Binary files a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_down_right.9.png and /dev/null differ
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_left.9.png b/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_left.9.png
deleted file mode 100644
index 6f63e5d2ca865aaaf41f226ab2fa66b3faad0178..0000000000000000000000000000000000000000
Binary files a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_left.9.png and /dev/null differ
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_right.9.png b/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_right.9.png
deleted file mode 100644
index 8777f1cdc87bd012666504c48e292f6eef5175c3..0000000000000000000000000000000000000000
Binary files a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_right.9.png and /dev/null differ
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up.9.png b/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up.9.png
deleted file mode 100644
index 63f266b127c64c7d9580b28efd01d493d7475561..0000000000000000000000000000000000000000
Binary files a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up.9.png and /dev/null differ
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up_left.9.png b/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up_left.9.png
deleted file mode 100644
index 268157b5cb29e4b373099b63238fc3647fac0c8f..0000000000000000000000000000000000000000
Binary files a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up_left.9.png and /dev/null differ
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up_right.9.png b/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up_right.9.png
deleted file mode 100644
index 1f03bd1ac28334d5d93048a30adc62474ccdd106..0000000000000000000000000000000000000000
Binary files a/tooltips/src/main/res/drawable-xxhdpi/tooltip_arrow_up_right.9.png and /dev/null differ
diff --git a/tooltips/src/main/res/values/colors.xml b/tooltips/src/main/res/values/colors.xml
deleted file mode 100644
index 07a1caab8558a33e3e4fefcf979d6866004e8fd8..0000000000000000000000000000000000000000
--- a/tooltips/src/main/res/values/colors.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- #FF4081
-
\ No newline at end of file
diff --git a/tooltips/src/main/res/values/strings.xml b/tooltips/src/main/res/values/strings.xml
deleted file mode 100644
index 8542005550c7c87f5b6679a433515d5f43cd921a..0000000000000000000000000000000000000000
--- a/tooltips/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/tooltips/src/main/res/values/styles.xml b/tooltips/src/main/res/values/styles.xml
deleted file mode 100644
index ae36e623018aad30b35221b80c8a67449d72f527..0000000000000000000000000000000000000000
--- a/tooltips/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/tooltips/src/main/resources/base/element/string.json b/tooltips/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..6b5df853eb705fa4bd21b141123d5c55003689d3
--- /dev/null
+++ b/tooltips/src/main/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "tooltipshm"
+ }
+ ]
+}
diff --git a/tooltips/src/main/resources/base/media/icon.png b/tooltips/src/main/resources/base/media/icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c
Binary files /dev/null and b/tooltips/src/main/resources/base/media/icon.png differ
diff --git a/tooltips/src/main/resources/base/media/tips.png b/tooltips/src/main/resources/base/media/tips.png
new file mode 100644
index 0000000000000000000000000000000000000000..c9b4b97580797aeba4feeb23dc759988be526514
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tips.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_arrow_down.png b/tooltips/src/main/resources/base/media/tooltip_arrow_down.png
new file mode 100644
index 0000000000000000000000000000000000000000..ebac7eb72ea6d0d7c37de675a8195751f3dad0bb
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_arrow_down.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_arrow_down_left.png b/tooltips/src/main/resources/base/media/tooltip_arrow_down_left.png
new file mode 100644
index 0000000000000000000000000000000000000000..b646be8b90b09e52154f7c38e9896430a6f8daeb
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_arrow_down_left.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_arrow_down_right.png b/tooltips/src/main/resources/base/media/tooltip_arrow_down_right.png
new file mode 100644
index 0000000000000000000000000000000000000000..d1cd2d460aa7cf42ea9cb159e7600bd9554159a2
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_arrow_down_right.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_arrow_left.png b/tooltips/src/main/resources/base/media/tooltip_arrow_left.png
new file mode 100644
index 0000000000000000000000000000000000000000..15759ebce4a3df8f8d2073112419711a46a4d65e
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_arrow_left.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_arrow_right.png b/tooltips/src/main/resources/base/media/tooltip_arrow_right.png
new file mode 100644
index 0000000000000000000000000000000000000000..0c786c5369dc85530d856794cdec1b53c0d2a197
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_arrow_right.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_arrow_up.png b/tooltips/src/main/resources/base/media/tooltip_arrow_up.png
new file mode 100644
index 0000000000000000000000000000000000000000..82292ec4080074200f8c1da22476d4c719248b09
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_arrow_up.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_arrow_up_left.png b/tooltips/src/main/resources/base/media/tooltip_arrow_up_left.png
new file mode 100644
index 0000000000000000000000000000000000000000..d1d017f915b1862945c707d282fd6ece48bfaacb
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_arrow_up_left.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_arrow_up_right.png b/tooltips/src/main/resources/base/media/tooltip_arrow_up_right.png
new file mode 100644
index 0000000000000000000000000000000000000000..b4b9f09148e81cc0541deb734561925a9e5a172a
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_arrow_up_right.png differ
diff --git a/tooltips/src/main/resources/base/media/tooltip_down.png b/tooltips/src/main/resources/base/media/tooltip_down.png
new file mode 100644
index 0000000000000000000000000000000000000000..3e3deb49e67d5e188fca08be26389faf04a025e4
Binary files /dev/null and b/tooltips/src/main/resources/base/media/tooltip_down.png differ
diff --git a/tooltips/src/main/res/drawable-xxhdpi/tooltip_no_arrow.9.png b/tooltips/src/main/resources/base/media/tooltip_no_arrow.9.png
similarity index 100%
rename from tooltips/src/main/res/drawable-xxhdpi/tooltip_no_arrow.9.png
rename to tooltips/src/main/resources/base/media/tooltip_no_arrow.9.png
diff --git a/tooltips/src/test/java/com/tomergoldst/tooltips/ExampleUnitTest.java b/tooltips/src/test/java/com/tomergoldst/tooltips/ExampleUnitTest.java
deleted file mode 100644
index aa143d25eb6e551f6d3dbcef473c9df424e97ef4..0000000000000000000000000000000000000000
--- a/tooltips/src/test/java/com/tomergoldst/tooltips/ExampleUnitTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.tomergoldst.tooltips;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * To work on unit tests, switch the Test Artifact in the Build Variants view.
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() throws Exception {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/tooltips/src/test/java/com/tomergoldst/tooltipshm/ExampleTest.java b/tooltips/src/test/java/com/tomergoldst/tooltipshm/ExampleTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..2ed611664f408a698485c81e60e5d157b91633dd
--- /dev/null
+++ b/tooltips/src/test/java/com/tomergoldst/tooltipshm/ExampleTest.java
@@ -0,0 +1,9 @@
+package com.tomergoldst.tooltipshm;
+
+import org.junit.Test;
+
+public class ExampleTest {
+ @Test
+ public void onStart() {
+ }
+}