diff --git a/.gitignore b/.gitignore
index e565550..5f78768 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,76 +1,11 @@
-# built application files
-*bin\.apk
-*.ap_
-
-# files for the dex VM
-*.dex
-
-# Java class files
-*.class
-
-# generated files
-bin/
-gen/
-
-# Local configuration file (sdk path, etc)
-local.properties
-
-assets/
-
-.settings
-eclipsebin
-
-bin
-gen
-build
-out
-lib
-local.properties
-
-target
-pom.xml.*
-release.properties
-
-.idea
-*.iml
-classes
-
-obj
-
+**/bin/*
+**/target/*
+**/gen/*
+**/build/*
+**/.idea/*
+**/*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
.DS_Store
-
-#ignore thumbnails created by windows
-Thumbs.db
-#Ignore files build by Visual Studio
-*.obj
-*.exe
-*.pdb
-*.user
-*.aps
-*.pch
-*.vspscc
-*_i.c
-*_p.c
-*.ncb
-*.suo
-*.tlb
-*.tlh
-*.bak
-*.cache
-*.ilk
-*.log
-[Bb]in
-[Dd]ebug*/
-*.lib
-*.sbr
-obj/
-[Rr]elease*/
-_ReSharper*/
-[Tt]est[Rr]esult*
-example/.classpath
-example/.project
-example/proguard-project.txt
-*/.classpath
-*.project
-*proguard-project.txt
-library/build.gradle
+.metadata/*
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..18940c4
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,40 @@
+language: java
+jdk: oraclejdk7
+
+env:
+ matrix:
+ - ANDROID_SDKS=sysimg-19 ANDROID_TARGET=android-19 ANDROID_ABI=armeabi-v7a SKIN=WXGA800 LINT=true
+ global:
+ - TERM=dumb
+ - secure: A5Bq4mDhsHqKK8PlxNlxVGJuSBi1L2uBg817821AOXyPjSSXS5GQK+4bIp+io8R/bPzxCNuC8nqJUvupa0GrEgKhzfA0JF5nhMjLyZ5cfpbNOYWCJHlbiZCDkW4MFhtWTCGedu3sQ8WifyJ25ceh+1nxxAn/hIhJUfYssNw1+8Q=
+
+before_install:
+ # Install base Android SDK
+ - sudo apt-get update -qq
+ - sudo apt-get install -qq libstdc++6:i386 lib32z1 expect
+ - export COMPONENTS=extra-android-m2repository,build-tools-19.0.3,android-19,$ANDROID_SDKS
+ - curl -3L https://raw.github.com/embarkmobile/android-sdk-installer/version-2/android-sdk-installer | bash /dev/stdin --install=$COMPONENTS
+ - source ~/.android-sdk-installer/env
+
+ # Create and start emulator
+ #- echo no | android create avd --force -n test -t $ANDROID_TARGET --abi $ANDROID_ABI --skin $SKIN
+ #- emulator -avd test -no-audio -no-window &
+
+before_script:
+ # Make sure the emulator has started before running tests
+ #- wait_for_emulator
+
+install:
+ - true
+
+script:
+ - sudo chmod +x gradlew
+ #- ./gradlew connectedCheck
+
+ - if [[ $LINT == 'true' ]]; then ./gradlew lint ; fi
+
+after_success:
+ - ./gradlew uploadArchives -PnexusUsername="${nexusUsername}" -PnexusPassword="${nexusPassword}"
+
+notifications:
+ email: false
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index d645695..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
diff --git a/README.md b/README.md
index 10ef1a4..f225875 100644
--- a/README.md
+++ b/README.md
@@ -1,38 +1,43 @@
-SuperToolTips ([Play Store Demo][1])
+SuperToolTips ([Play Store Demo][1]) [![Build Status](https://travis-ci.org/nhaarman/supertooltips.svg?branch=master)](https://travis-ci.org/nhaarman/supertooltips)
===========
-SuperToolTips is an Open Source Android library that allows developers to easily create Tool Tips for views, from API 8 and on.
+SuperToolTips is an Open Source Android library that allows developers to easily create Tool Tips for views.
Feel free to use it all you want in your Android apps provided that you cite this project and include the license in your app.
-Note
------
-Version 2.0 brought some changes with it. The package name has changed to `com.haarman.supertooltips`, and the `ToolTipFrameLayout` has been renamed to `ToolTipRelativeLayout`. Please modify your own code to suit these changes.
-
Setup
-----
-* In Eclipse, just import the library as an Android library project.
-* Project > Clean to generate the binaries you need, like R.java, etc.
-* Then, just add SuperToolTips as a dependency to your existing project and you're good to go!
+*Note: SuperToolTips now uses the gradle build structure. If you want to use this project in Eclipse, you should make the necessary changes.*
+
+Add the following to your `build.gradle`:
+
+```groovy
+dependencies {
+ compile 'com.nhaarman.supertooltips:library:3.0.+'
+}
+
+```
Usage
-----
-* In your layout xml file, add the `ToolTipRelativeLayout` (`com.haarman.supertooltips.ToolTipRelativeLayout`) with height and width of `match_parent`. Make sure this view is on top!
+* In your layout xml file, add the `ToolTipRelativeLayout` (`com.nhaarman.supertooltips.ToolTipRelativeLayout`) with height and width of `match_parent`. Make sure this view is on top!
* Find the `ToolTipRelativeLayout` in your code, and start adding `ToolTips`!
Example:
-----
-```Java
+```java
+ android:layout_height="match_parent">
-
+
-
@@ -45,13 +50,12 @@ protected void onCreate(Bundle savedInstanceState) {
ToolTipRelativeLayout toolTipRelativeLayout = (ToolTipRelativeLayout) findViewById(R.id.activity_main_tooltipRelativeLayout);
- myToolTipView = toolTipRelativeLayout.showToolTipForView(
- new ToolTip()
- .withText("A beautiful View")
- .withColor(Color.RED)
- .withShadow(true)
- .withAnimationType(ToolTip.ANIMATIONTYPE_FROMTOP),
- findViewById(R.id.activity_main_redtv));
+ ToolTip toolTip = new ToolTip()
+ .withText("A beautiful View")
+ .withColor(Color.RED)
+ .withShadow(true)
+ .withAnimationType(ToolTip.ANIMATIONTYPE_FROMTOP);
+ myToolTipView = toolTipRelativeLayout.showToolTipForView(toolTip, findViewById(R.id.activity_main_redtv));
myToolTipView.setOnToolTipViewClickedListener(MainActivity.this);
}
```
@@ -69,10 +73,6 @@ You can customize the `ToolTip` in several ways:
See the examples.
-ActionBar
------
-Currently, the [dev branch][2] contains methods for showing `ToolTipView`s for ActionBar items. Please note that this is entirely experimental and may only work for the original ActionBar.
-
Developed By
-----
* Niek Haarman
@@ -95,4 +95,3 @@ License
limitations under the License.
[1]: https://play.google.com/store/apps/details?id=com.haarman.supertooltips
- [2]: https://github.com/nhaarman/supertooltips/tree/dev
diff --git a/app/build.gradle b/app/build.gradle
new file mode 100644
index 0000000..cf5dcb2
--- /dev/null
+++ b/app/build.gradle
@@ -0,0 +1,22 @@
+apply plugin: 'android'
+
+android {
+ compileSdkVersion 19
+ buildToolsVersion "19.0.3"
+
+ defaultConfig {
+ minSdkVersion 8
+ targetSdkVersion 19
+ versionCode Integer.parseInt(new Date().format('yyyyMMddHH'))
+ versionName VERSION_NAME
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ compile project(':lib')
+}
diff --git a/app/pom.xml b/app/pom.xml
new file mode 100644
index 0000000..9222ea5
--- /dev/null
+++ b/app/pom.xml
@@ -0,0 +1,88 @@
+
+
+
+ 4.0.0
+
+ example
+ SuperToolTips Example
+ apk
+
+
+ com.haarman.supertooltips
+ parent
+ 2.0
+ ../pom.xml
+
+
+
+
+ com.google.android
+ android
+ provided
+
+
+
+ com.google.android
+ support-v4
+
+
+
+ com.nhaarman.supertooltips
+ library
+ ${project.version}
+ apklib
+
+
+
+
+
+ src
+ ${project.artifactId}-unaligned
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+ true
+
+
+
+
+
+
+ release
+
+
+ performRelease
+ true
+
+
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+ ${android-maven.version}
+ true
+
+
+ ${project.build.directory}/${project.build.finalName}.apk
+ ${project.build.directory}/${project.artifactId}.apk
+
+
+
+
+ alignApk
+ package
+
+ zipalign
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
similarity index 63%
rename from example/AndroidManifest.xml
rename to app/src/main/AndroidManifest.xml
index 5282c47..ca72823 100644
--- a/example/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,21 +1,16 @@
-
-
-
+ xmlns:android="http://schemas.android.com/apk/res/android">
+ android:theme="@style/AppTheme">
+ android:label="@string/app_name">
diff --git a/app/src/main/java/com/haarman/supertooltips/MainActivity.java b/app/src/main/java/com/haarman/supertooltips/MainActivity.java
new file mode 100644
index 0000000..def97ac
--- /dev/null
+++ b/app/src/main/java/com/haarman/supertooltips/MainActivity.java
@@ -0,0 +1,181 @@
+package com.haarman.supertooltips;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.os.Handler;
+import android.view.LayoutInflater;
+import android.view.View;
+
+import com.nhaarman.supertooltips.ToolTip;
+import com.nhaarman.supertooltips.ToolTipRelativeLayout;
+import com.nhaarman.supertooltips.ToolTipView;
+
+public class MainActivity extends Activity implements View.OnClickListener, ToolTipView.OnToolTipViewClickedListener {
+
+ private ToolTipView mRedToolTipView;
+ private ToolTipView mGreenToolTipView;
+ private ToolTipView mBlueToolTipView;
+ private ToolTipView mPurpleToolTipView;
+ private ToolTipView mOrangeToolTipView;
+ private ToolTipRelativeLayout mToolTipFrameLayout;
+
+ @Override
+ protected void onCreate(final Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+
+ mToolTipFrameLayout = (ToolTipRelativeLayout) findViewById(R.id.activity_main_tooltipframelayout);
+ findViewById(R.id.activity_main_redtv).setOnClickListener(this);
+ findViewById(R.id.activity_main_greentv).setOnClickListener(this);
+ findViewById(R.id.activity_main_bluetv).setOnClickListener(this);
+ findViewById(R.id.activity_main_purpletv).setOnClickListener(this);
+ findViewById(R.id.activity_main_orangetv).setOnClickListener(this);
+
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ addRedToolTipView();
+ }
+ }, 500);
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ addGreenToolTipView();
+ }
+ }, 700);
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ addOrangeToolTipView();
+ }
+ }, 900);
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ addBlueToolTipView();
+ }
+ }, 1100);
+
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ addPurpleToolTipView();
+ }
+ }, 1300);
+
+ }
+
+ private void addRedToolTipView() {
+ ToolTip toolTip = new ToolTip()
+ .withText("A beautiful Button")
+ .withColor(getResources().getColor(R.color.holo_red))
+ .withShadow(true);
+
+ mRedToolTipView = mToolTipFrameLayout.showToolTipForView(toolTip, findViewById(R.id.activity_main_redtv));
+ mRedToolTipView.setOnToolTipViewClickedListener(this);
+ }
+
+ private void addGreenToolTipView() {
+ ToolTip toolTip = new ToolTip()
+ .withText("Another beautiful Button!")
+ .withColor(getResources().getColor(R.color.holo_green));
+
+ mGreenToolTipView = mToolTipFrameLayout.showToolTipForView(toolTip, findViewById(R.id.activity_main_greentv));
+ mGreenToolTipView.setOnToolTipViewClickedListener(this);
+ }
+
+ private void addBlueToolTipView() {
+ ToolTip toolTip = new ToolTip()
+ .withText("Moarrrr buttons!")
+ .withColor(getResources().getColor(R.color.holo_blue))
+ .withAnimationType(ToolTip.AnimationType.FROM_TOP);
+
+ mBlueToolTipView = mToolTipFrameLayout.showToolTipForView(toolTip, findViewById(R.id.activity_main_bluetv));
+ mBlueToolTipView.setOnToolTipViewClickedListener(this);
+ }
+
+ private void addPurpleToolTipView() {
+ ToolTip toolTip = new ToolTip()
+ .withContentView(LayoutInflater.from(this).inflate(R.layout.custom_tooltip, null))
+ .withColor(getResources().getColor(R.color.holo_purple))
+ .withAnimationType(ToolTip.AnimationType.NONE);
+
+ mPurpleToolTipView = mToolTipFrameLayout.showToolTipForView(toolTip, findViewById(R.id.activity_main_purpletv));
+ mPurpleToolTipView.setOnToolTipViewClickedListener(this);
+ }
+
+ private void addOrangeToolTipView() {
+ ToolTip toolTip = new ToolTip()
+ .withText("Tap me!")
+ .withColor(getResources().getColor(R.color.holo_orange));
+
+ mOrangeToolTipView = mToolTipFrameLayout.showToolTipForView(toolTip, findViewById(R.id.activity_main_orangetv));
+ mOrangeToolTipView.setOnToolTipViewClickedListener(this);
+ }
+
+ @Override
+ public void onClick(final View view) {
+ int id = view.getId();
+ if (id == R.id.activity_main_redtv) {
+ if (mRedToolTipView == null) {
+ addRedToolTipView();
+ } else {
+ mRedToolTipView.remove();
+ mRedToolTipView = null;
+ }
+
+ } else if (id == R.id.activity_main_greentv) {
+ if (mGreenToolTipView == null) {
+ addGreenToolTipView();
+ } else {
+ mGreenToolTipView.remove();
+ mGreenToolTipView = null;
+ }
+
+ } else if (id == R.id.activity_main_bluetv) {
+ if (mBlueToolTipView == null) {
+ addBlueToolTipView();
+ } else {
+ mBlueToolTipView.remove();
+ mBlueToolTipView = null;
+ }
+
+ } else if (id == R.id.activity_main_purpletv) {
+ if (mPurpleToolTipView == null) {
+ addPurpleToolTipView();
+ } else {
+ mPurpleToolTipView.remove();
+ mPurpleToolTipView = null;
+ }
+
+ } else if (id == R.id.activity_main_orangetv) {
+ if (mOrangeToolTipView == null) {
+ addOrangeToolTipView();
+ } else {
+ mOrangeToolTipView.remove();
+ mOrangeToolTipView = null;
+ }
+
+ }
+ }
+
+ @Override
+ public void onToolTipViewClicked(final ToolTipView toolTipView) {
+ if (mRedToolTipView == toolTipView) {
+ mRedToolTipView = null;
+ } else if (mGreenToolTipView == toolTipView) {
+ mGreenToolTipView = null;
+ } else if (mBlueToolTipView == toolTipView) {
+ mBlueToolTipView = null;
+ } else if (mPurpleToolTipView == toolTipView) {
+ mPurpleToolTipView = null;
+ } else if (mOrangeToolTipView == toolTipView) {
+ mOrangeToolTipView = null;
+ }
+ }
+}
+
diff --git a/example/res/drawable-hdpi/ic_android.png b/app/src/main/res/drawable-hdpi/ic_android.png
similarity index 100%
rename from example/res/drawable-hdpi/ic_android.png
rename to app/src/main/res/drawable-hdpi/ic_android.png
diff --git a/example/res/drawable-hdpi/ic_launcher.png b/app/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from example/res/drawable-hdpi/ic_launcher.png
rename to app/src/main/res/drawable-hdpi/ic_launcher.png
diff --git a/example/res/drawable-mdpi/ic_android.png b/app/src/main/res/drawable-mdpi/ic_android.png
similarity index 100%
rename from example/res/drawable-mdpi/ic_android.png
rename to app/src/main/res/drawable-mdpi/ic_android.png
diff --git a/example/res/drawable-mdpi/ic_launcher.png b/app/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from example/res/drawable-mdpi/ic_launcher.png
rename to app/src/main/res/drawable-mdpi/ic_launcher.png
diff --git a/example/res/drawable-xhdpi/ic_android.png b/app/src/main/res/drawable-xhdpi/ic_android.png
similarity index 100%
rename from example/res/drawable-xhdpi/ic_android.png
rename to app/src/main/res/drawable-xhdpi/ic_android.png
diff --git a/example/res/drawable-xhdpi/ic_launcher.png b/app/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from example/res/drawable-xhdpi/ic_launcher.png
rename to app/src/main/res/drawable-xhdpi/ic_launcher.png
diff --git a/example/res/drawable-xxhdpi/ic_launcher.png b/app/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from example/res/drawable-xxhdpi/ic_launcher.png
rename to app/src/main/res/drawable-xxhdpi/ic_launcher.png
diff --git a/example/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
similarity index 96%
rename from example/res/layout/activity_main.xml
rename to app/src/main/res/layout/activity_main.xml
index dcb57ed..9a2ece1 100644
--- a/example/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -40,7 +40,7 @@
android:layout_centerInParent="true"
android:text="@string/orange" />
-
diff --git a/example/res/layout/custom_tooltip.xml b/app/src/main/res/layout/custom_tooltip.xml
similarity index 100%
rename from example/res/layout/custom_tooltip.xml
rename to app/src/main/res/layout/custom_tooltip.xml
diff --git a/example/res/values-v11/styles.xml b/app/src/main/res/values-v11/styles.xml
similarity index 100%
rename from example/res/values-v11/styles.xml
rename to app/src/main/res/values-v11/styles.xml
diff --git a/example/res/values-v14/styles.xml b/app/src/main/res/values-v14/styles.xml
similarity index 100%
rename from example/res/values-v14/styles.xml
rename to app/src/main/res/values-v14/styles.xml
diff --git a/example/res/values/colors.xml b/app/src/main/res/values/colors.xml
similarity index 67%
rename from example/res/values/colors.xml
rename to app/src/main/res/values/colors.xml
index 98b14df..220d4cd 100644
--- a/example/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -1,19 +1,9 @@
#ffffff
-
-
#33b5e5
-
-
#aa66cc
-
-
#99cc00
-
-
#ffbb33
-
-
#ff4444
\ No newline at end of file
diff --git a/example/res/values/strings.xml b/app/src/main/res/values/strings.xml
similarity index 100%
rename from example/res/values/strings.xml
rename to app/src/main/res/values/strings.xml
diff --git a/example/res/values/styles.xml b/app/src/main/res/values/styles.xml
similarity index 100%
rename from example/res/values/styles.xml
rename to app/src/main/res/values/styles.xml
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..08ca1f2
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,19 @@
+// Top-level build file where you can add configuration options common to all sub-projects/modules.
+
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.9.+'
+ }
+}
+
+allprojects {
+ repositories {
+ mavenCentral()
+ }
+
+ group=GROUP
+ version=VERSION_NAME
+}
diff --git a/example/libs/android-support-v4.jar b/example/libs/android-support-v4.jar
deleted file mode 100644
index 428bdbc..0000000
Binary files a/example/libs/android-support-v4.jar and /dev/null differ
diff --git a/example/project.properties b/example/project.properties
deleted file mode 100644
index 1561d7a..0000000
--- a/example/project.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-17
-android.library.reference.1=../library
diff --git a/example/res/menu/main.xml b/example/res/menu/main.xml
deleted file mode 100644
index c002028..0000000
--- a/example/res/menu/main.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/example/src/com/haarman/supertooltips/MainActivity.java b/example/src/com/haarman/supertooltips/MainActivity.java
deleted file mode 100644
index d43df04..0000000
--- a/example/src/com/haarman/supertooltips/MainActivity.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package com.haarman.supertooltips;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.LayoutInflater;
-import android.view.View;
-
-public class MainActivity extends Activity implements View.OnClickListener, ToolTipView.OnToolTipViewClickedListener {
-
- private ToolTipView mRedToolTipView;
- private ToolTipView mGreenToolTipView;
- private ToolTipView mBlueToolTipView;
- private ToolTipView mPurpleToolTipView;
- private ToolTipView mOrangeToolTipView;
- private ToolTipRelativeLayout mToolTipFrameLayout;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
-
- mToolTipFrameLayout = (ToolTipRelativeLayout) findViewById(R.id.activity_main_tooltipframelayout);
- findViewById(R.id.activity_main_redtv).setOnClickListener(MainActivity.this);
- findViewById(R.id.activity_main_greentv).setOnClickListener(MainActivity.this);
- findViewById(R.id.activity_main_bluetv).setOnClickListener(MainActivity.this);
- findViewById(R.id.activity_main_purpletv).setOnClickListener(MainActivity.this);
- findViewById(R.id.activity_main_orangetv).setOnClickListener(MainActivity.this);
-
-
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- addRedToolTipView();
- }
- }, 500);
-
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- addGreenToolTipView();
- }
- }, 700);
-
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- addOrangeToolTipView();
- }
- }, 900);
-
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- addBlueToolTipView();
- }
- }, 1100);
-
- new Handler().postDelayed(new Runnable() {
- @Override
- public void run() {
- addPurpleToolTipView();
- }
- }, 1300);
-
- }
-
- private void addRedToolTipView() {
- mRedToolTipView = mToolTipFrameLayout.showToolTipForView(
- new ToolTip()
- .withText("A beautiful Button")
- .withColor(getResources().getColor(R.color.holo_red))
- .withShadow(true),
- findViewById(R.id.activity_main_redtv));
- mRedToolTipView.setOnToolTipViewClickedListener(MainActivity.this);
- }
-
- private void addGreenToolTipView() {
- mGreenToolTipView = mToolTipFrameLayout.showToolTipForView(
- new ToolTip()
- .withText("Another beautiful Button!")
- .withColor(getResources().getColor(R.color.holo_green)),
- findViewById(R.id.activity_main_greentv));
- mGreenToolTipView.setOnToolTipViewClickedListener(MainActivity.this);
- }
-
- private void addBlueToolTipView() {
- mBlueToolTipView = mToolTipFrameLayout.showToolTipForView(
- new ToolTip()
- .withText("Moarrrr buttons!")
- .withColor(getResources().getColor(R.color.holo_blue))
- .withAnimationType(ToolTip.ANIMATIONTYPE_FROMTOP),
- findViewById(R.id.activity_main_bluetv));
- mBlueToolTipView.setOnToolTipViewClickedListener(MainActivity.this);
- }
-
- private void addPurpleToolTipView() {
- mPurpleToolTipView = mToolTipFrameLayout.showToolTipForView(
- new ToolTip()
- .withContentView(LayoutInflater.from(this).inflate(R.layout.custom_tooltip, null))
- .withColor(getResources().getColor(R.color.holo_purple)),
- findViewById(R.id.activity_main_purpletv));
- mPurpleToolTipView.setOnToolTipViewClickedListener(MainActivity.this);
- }
-
- private void addOrangeToolTipView() {
- mOrangeToolTipView = mToolTipFrameLayout.showToolTipForView(
- new ToolTip()
- .withText("Tap me!")
- .withColor(getResources().getColor(R.color.holo_orange)),
- findViewById(R.id.activity_main_orangetv));
- mOrangeToolTipView.setOnToolTipViewClickedListener(MainActivity.this);
- }
-
- @Override
- public void onClick(View view) {
- switch (view.getId()) {
- case R.id.activity_main_redtv:
- if (mRedToolTipView == null) {
- addRedToolTipView();
- } else {
- mRedToolTipView.remove();
- mRedToolTipView = null;
- }
- break;
- case R.id.activity_main_greentv:
- if (mGreenToolTipView == null) {
- addGreenToolTipView();
- } else {
- mGreenToolTipView.remove();
- mGreenToolTipView = null;
- }
- break;
- case R.id.activity_main_bluetv:
- if (mBlueToolTipView == null) {
- addBlueToolTipView();
- } else {
- mBlueToolTipView.remove();
- mBlueToolTipView = null;
- }
- break;
- case R.id.activity_main_purpletv:
- if (mPurpleToolTipView == null) {
- addPurpleToolTipView();
- } else {
- mPurpleToolTipView.remove();
- mPurpleToolTipView = null;
- }
- break;
- case R.id.activity_main_orangetv:
- if (mOrangeToolTipView == null) {
- addOrangeToolTipView();
- } else {
- mOrangeToolTipView.remove();
- mOrangeToolTipView = null;
- }
- break;
- }
- }
-
- @Override
- public void onToolTipViewClicked(ToolTipView toolTipView) {
- if (mRedToolTipView == toolTipView) {
- mRedToolTipView = null;
- } else if (mGreenToolTipView == toolTipView) {
- mGreenToolTipView = null;
- } else if (mBlueToolTipView == toolTipView) {
- mBlueToolTipView = null;
- } else if (mPurpleToolTipView == toolTipView) {
- mPurpleToolTipView = null;
- } else if (mOrangeToolTipView == toolTipView) {
- mOrangeToolTipView = null;
- }
- }
-}
-
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..d89b58d
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,17 @@
+nexusUsername=DUMMY
+nexusPassword=DUMMY
+isRelease=false
+
+GROUP=com.nhaarman.supertooltips
+VERSION_NAME=3.0.0
+
+POM_DESCRIPTION=SuperToolTips
+POM_URL=https://github.com/nhaarman/supertooltips
+POM_SCM_URL=https://github.com/nhaarman/supertooltips
+POM_SCM_CONNECTION=scm:git@github.com:nhaarman/supertooltips.git
+POM_SCM_DEV_CONNECTION=scm:git@github.com:nhaarman/supertooltips.git
+POM_LICENCE_NAME=The Apache Software License, Version 2.0
+POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
+POM_LICENCE_DIST=repo
+POM_DEVELOPER_ID=nhaarman
+POM_DEVELOPER_NAME=Niek Haarman
\ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..8c0fb64
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..5de946b
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Wed Apr 10 15:27:10 PDT 2013
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
diff --git a/gradlew b/gradlew
new file mode 100644
index 0000000..91a7e26
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,164 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# 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\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+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
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((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" ;;
+ 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=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..8a0b282
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,90 @@
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem Gradle startup script for Windows
+@rem
+@rem ##########################################################################
+
+@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 Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto init
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto init
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:init
+@rem Get command-line arguments, handling Windowz 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.
+set CMD_LINE_ARGS=
+set _SKIP=2
+
+:win9xME_args_slurp
+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
+
+set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
+
+@rem Execute Gradle
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/lib/build.gradle b/lib/build.gradle
new file mode 100644
index 0000000..f569536
--- /dev/null
+++ b/lib/build.gradle
@@ -0,0 +1,24 @@
+apply plugin: 'android-library'
+
+apply from: 'pushMaven.gradle'
+
+android {
+ compileSdkVersion 19
+ buildToolsVersion "19.0.3"
+
+ defaultConfig {
+ minSdkVersion 8
+ targetSdkVersion 19
+ versionCode Integer.parseInt(new Date().format('yyyyMMddHH'))
+ versionName VERSION_NAME
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ compile 'com.nineoldandroids:library:2.4.0'
+}
diff --git a/lib/gradle.properties b/lib/gradle.properties
new file mode 100644
index 0000000..63f021d
--- /dev/null
+++ b/lib/gradle.properties
@@ -0,0 +1,3 @@
+POM_NAME=SuperToolTips
+POM_ARTIFACT_ID=library
+POM_PACKAGING=aar
\ No newline at end of file
diff --git a/lib/pom.xml b/lib/pom.xml
new file mode 100644
index 0000000..66fd153
--- /dev/null
+++ b/lib/pom.xml
@@ -0,0 +1,48 @@
+
+
+
+ 4.0.0
+
+ library
+ SuperToolTips
+ apklib
+
+
+ com.nhaarman.supertooltips
+ parent
+ 2.0
+ ../pom.xml
+
+
+
+
+ com.google.android
+ android
+ provided
+
+
+
+ com.google.android
+ support-v4
+
+
+
+ com.nineoldandroids
+ library
+ 2.4.0
+
+
+
+
+ src
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+ true
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/pushMaven.gradle b/lib/pushMaven.gradle
new file mode 100644
index 0000000..6e50b1c
--- /dev/null
+++ b/lib/pushMaven.gradle
@@ -0,0 +1,80 @@
+apply plugin: 'maven'
+apply plugin: 'signing'
+
+def sonatypeRepositoryUrl
+if (isRelease == 'true') {
+ sonatypeRepositoryUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
+ println 'RELEASE BUILD ' + version
+} else {
+ sonatypeRepositoryUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
+ version = VERSION_NAME + '-SNAPSHOT'
+ println 'DEBUG BUILD ' + version
+}
+
+afterEvaluate { project ->
+ uploadArchives {
+ repositories {
+ mavenDeployer {
+ beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
+
+ pom.artifactId = POM_ARTIFACT_ID
+
+ repository(url: sonatypeRepositoryUrl) {
+ authentication(userName: nexusUsername, password: nexusPassword)
+ }
+
+ pom.project {
+ name POM_NAME
+ packaging POM_PACKAGING
+ description POM_DESCRIPTION
+ url POM_URL
+
+ scm {
+ url POM_SCM_URL
+ connection POM_SCM_CONNECTION
+ developerConnection POM_SCM_DEV_CONNECTION
+ }
+
+ licenses {
+ license {
+ name POM_LICENCE_NAME
+ url POM_LICENCE_URL
+ distribution POM_LICENCE_DIST
+ }
+ }
+
+ developers {
+ developer {
+ id POM_DEVELOPER_ID
+ name POM_DEVELOPER_NAME
+ }
+ }
+ }
+ }
+ }
+ }
+
+ signing {
+ required { isRelease == 'true' && gradle.taskGraph.hasTask("uploadArchives") }
+ sign configurations.archives
+ }
+
+ task androidJavadocs(type: Javadoc) {
+ source = android.sourceSets.main.allJava
+ }
+
+ task androidJavadocsJar(type: Jar) {
+ classifier = 'javadoc'
+ from androidJavadocs.destinationDir
+ }
+
+ task androidSourcesJar(type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.allSource
+ }
+
+ artifacts {
+ archives androidSourcesJar
+ archives androidJavadocsJar
+ }
+}
\ No newline at end of file
diff --git a/lib/src/main/AndroidManifest.xml b/lib/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..86943ad
--- /dev/null
+++ b/lib/src/main/AndroidManifest.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/lib/src/main/java/com/nhaarman/supertooltips/ToolTip.java b/lib/src/main/java/com/nhaarman/supertooltips/ToolTip.java
new file mode 100644
index 0000000..fa1a6f8
--- /dev/null
+++ b/lib/src/main/java/com/nhaarman/supertooltips/ToolTip.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright 2013 Niek Haarman
+ *
+ * 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.nhaarman.supertooltips;
+
+import android.graphics.Typeface;
+import android.view.View;
+
+public class ToolTip {
+
+ public enum AnimationType {
+ FROM_MASTER_VIEW,
+ FROM_TOP,
+ NONE
+ }
+
+ private CharSequence mText;
+ private int mTextResId;
+ private int mColor;
+ private int mTextColor;
+ private View mContentView;
+ private AnimationType mAnimationType;
+ private boolean mShouldShowShadow;
+ private Typeface mTypeface;
+
+ /**
+ * Creates a new ToolTip without any values.
+ */
+ public ToolTip() {
+ mText = null;
+ mTypeface = null;
+ mTextResId = 0;
+ mColor = 0;
+ mContentView = null;
+ mAnimationType = AnimationType.FROM_MASTER_VIEW;
+ }
+
+ /**
+ * Set the text to show. Has no effect when a content View is set using setContentView().
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withText(final CharSequence text) {
+ mText = text;
+ mTextResId = 0;
+ return this;
+ }
+
+ /**
+ * Set the text resource id to show. Has no effect when a content View is set using setContentView().
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withText(final int resId) {
+ mTextResId = resId;
+ mText = null;
+ return this;
+ }
+
+ /**
+ * Set the text resource id to show and the custom typeface for that view. Has no effect when a content View is set using setContentView().
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withText(final int resId, final Typeface tf) {
+ mTextResId = resId;
+ mText = null;
+ withTypeface(tf);
+ return this;
+ }
+
+ /**
+ * Set the color of the ToolTip. Default is white.
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withColor(final int color) {
+ mColor = color;
+ return this;
+ }
+
+ /**
+ * Set the text color of the ToolTip. Default is white.
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withTextColor(final int color) {
+ mTextColor = color;
+ return this;
+ }
+
+ /**
+ * Set a custom content View for the ToolTip. This will cause any text that has been set to be ignored.
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withContentView(final View view) {
+ mContentView = view;
+ return this;
+ }
+
+ /**
+ * Set the animation type for the ToolTip. Defaults to {@link AnimationType#FROM_MASTER_VIEW}.
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withAnimationType(final AnimationType animationType) {
+ mAnimationType = animationType;
+ return this;
+ }
+
+ /**
+ * Set to show a shadow below the ToolTip.
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withShadow() {
+ mShouldShowShadow = true;
+ return this;
+ }
+
+ /**
+ * Set to NOT show a shadow below the ToolTip.
+ *
+ * @return this ToolTip to build upon.
+ */
+ public ToolTip withoutShadow() {
+ mShouldShowShadow = false;
+ return this;
+ }
+
+ /**
+ * @param typeface the typeface to set
+ */
+ public void withTypeface(final Typeface typeface) {
+ mTypeface = typeface;
+ }
+
+ public CharSequence getText() {
+ return mText;
+ }
+
+ public int getTextResId() {
+ return mTextResId;
+ }
+
+ public int getColor() {
+ return mColor;
+ }
+
+ public int getTextColor() {
+ return mTextColor;
+ }
+
+ public View getContentView() {
+ return mContentView;
+ }
+
+ public AnimationType getAnimationType() {
+ return mAnimationType;
+ }
+
+ public boolean shouldShowShadow() {
+ return mShouldShowShadow;
+ }
+
+ /**
+ * @return the typeface
+ */
+ public Typeface getTypeface() {
+ return mTypeface;
+ }
+}
diff --git a/lib/src/main/java/com/nhaarman/supertooltips/ToolTipRelativeLayout.java b/lib/src/main/java/com/nhaarman/supertooltips/ToolTipRelativeLayout.java
new file mode 100644
index 0000000..a386e83
--- /dev/null
+++ b/lib/src/main/java/com/nhaarman/supertooltips/ToolTipRelativeLayout.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright 2013 Niek Haarman
+ * 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.nhaarman.supertooltips;
+
+import android.annotation.TargetApi;
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.Context;
+import android.content.res.Resources;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.RelativeLayout;
+
+import com.nhaarman.supertooltips.exception.NoOverflowMenuRuntimeException;
+import com.nhaarman.supertooltips.exception.NoTitleViewRuntimeException;
+import com.nhaarman.supertooltips.exception.ViewNotFoundRuntimeException;
+
+public class ToolTipRelativeLayout extends RelativeLayout {
+
+ public static final String ACTION_BAR_TITLE = "action_bar_title";
+ public static final String ID = "id";
+ public static final String ANDROID = "android";
+ public static final String ACTION_BAR = "action_bar";
+ public static final String ACTION_MENU_VIEW = "ActionMenuView";
+ public static final String OVERFLOW_MENU_BUTTON = "OverflowMenuButton";
+
+ public ToolTipRelativeLayout(final Context context) {
+ super(context);
+ }
+
+ public ToolTipRelativeLayout(final Context context, final AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public ToolTipRelativeLayout(final Context context, final AttributeSet attrs, final int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ /**
+ * Shows a {@link ToolTipView} based on given {@link ToolTip} at the proper
+ * location relative to given {@link View}.
+ *
+ * @param toolTip
+ * the ToolTip to show.
+ * @param view
+ * the View to position the ToolTipView relative to.
+ *
+ * @return the ToolTipView that was created.
+ */
+ public ToolTipView showToolTipForView(final ToolTip toolTip, final View view) {
+ final ToolTipView toolTipView = new ToolTipView(getContext());
+ toolTipView.setToolTip(toolTip, view);
+ addView(toolTipView);
+ return toolTipView;
+ }
+
+ /**
+ * **EXPERIMENTAL**
Shows a {@link ToolTipView} based on given
+ * {@link ToolTip} at the proper location relative to the {@link View} with
+ * given resource id.NOTE: This method will throw a
+ * {@link ViewNotFoundRuntimeException} if the View is not found. You can
+ * choose to ignore this by catching the ViewNotFoundRuntimeException.
+ *
+ * @param activity
+ * the Activity which holds the ActionBar.
+ * @param toolTip
+ * the ToolTip to show.
+ * @param resId
+ * the resource id of the View to position the ToolTipView
+ * relative to.
+ * @return the ToolTipView that was created.
+ */
+ public ToolTipView showToolTipForViewResId(final Activity activity, final ToolTip toolTip, final int resId) {
+ final ToolTipView toolTipView = new ToolTipView(getContext());
+ final View decorView = activity.getWindow().getDecorView();
+ final View view = decorView.findViewById(resId);
+
+ if (view == null) {
+ throw new ViewNotFoundRuntimeException();
+ }
+
+ toolTipView.setToolTip(toolTip, view);
+ addView(toolTipView);
+ return toolTipView;
+ }
+
+ /**
+ * **EXPERIMENTAL** Shows a {@link ToolTipView} based on given
+ * {@link ToolTip} at the proper location relative to the {@link ActionBar}
+ * home {@link View}.
+ *
+ * @param activity
+ * the Activity which holds the ActionBar.
+ * @param toolTip
+ * the ToolTip to show.
+ * @return the ToolTipView that was created.
+ */
+ @TargetApi(11)
+ public ToolTipView showToolTipForActionBarHome(final Activity activity, final ToolTip toolTip) {
+ final int homeResId = android.R.id.home;
+ return showToolTipForViewResId(activity, toolTip, homeResId);
+ }
+
+ /**
+ * **EXPERIMENTAL**
+ *
+ * Shows a {@link ToolTipView} based on given {@link ToolTip} at the proper
+ * location relative to the {@link ActionBar} title {@link View}.NOTE:
+ * This method will throw a {@link NoTitleViewRuntimeException} if the title
+ * View is not found. You can choose to ignore this by catching the
+ * NoTitleViewRuntimeException.NOTE: This method uses an internal API to
+ * find the View. It MAY cause your application to crash in future Android
+ * versions.
+ *
+ * @param activity
+ * the Activity which holds the ActionBar.
+ * @param toolTip
+ * the ToolTip to show.
+ * @return the ToolTipView that was created.
+ */
+ @TargetApi(11)
+ public ToolTipView showToolTipForActionBarTitle(final Activity activity, final ToolTip toolTip) {
+ final int titleResId = Resources.getSystem().getIdentifier(ACTION_BAR_TITLE, ID, ANDROID);
+ if (titleResId == 0) {
+ throw new NoTitleViewRuntimeException();
+ }
+ return showToolTipForViewResId(activity, toolTip, titleResId);
+ }
+
+ /**
+ * **EXPERIMENTAL** Shows a {@link ToolTipView} based on given
+ * {@link ToolTip} at the proper location relative to the overflow menu
+ * button.NOTE: This method will throw a
+ * {@link NoOverflowMenuRuntimeException} if the overflow menu is not found.
+ * This happens when there simply is no overflow menu button, or the menu
+ * isn't initialised yet. You can choose to ignore this by catching the
+ * NoOverflowMenuRuntimeException.NOTE: This method uses an internal API
+ * to find the View. It MAY cause your application to crash in future
+ * Android versions.
+ *
+ * @param activity
+ * the Activity which holds the ActionBar.
+ * @param toolTip
+ * the ToolTip to show.
+ * @return the ToolTipView that was created.
+ */
+ @TargetApi(11)
+ public ToolTipView showToolTipForActionBarOverflowMenu(final Activity activity, final ToolTip toolTip) {
+ return showToolTipForView(toolTip, findActionBarOverflowMenuView(activity));
+ }
+
+ @TargetApi(11)
+ private static View findActionBarOverflowMenuView(final Activity activity) {
+ final ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
+
+ final int actionBarViewResId = Resources.getSystem().getIdentifier(ACTION_BAR, ID, ANDROID);
+ final ViewGroup actionBarView = (ViewGroup) decorView.findViewById(actionBarViewResId);
+
+ ViewGroup actionMenuView = null;
+ int actionBarViewChildCount = actionBarView.getChildCount();
+ for (int i = 0; i < actionBarViewChildCount; ++i) {
+ if (actionBarView.getChildAt(i).getClass().getSimpleName().equals(ACTION_MENU_VIEW)) {
+ actionMenuView = (ViewGroup) actionBarView.getChildAt(i);
+ }
+ }
+
+ if (actionMenuView == null) {
+ throw new NoOverflowMenuRuntimeException();
+ }
+
+ int actionMenuChildCount = actionMenuView.getChildCount();
+ View overflowMenuButton = null;
+ for (int i = 0; i < actionMenuChildCount; ++i) {
+ if (actionMenuView.getChildAt(i).getClass().getSimpleName().equals(OVERFLOW_MENU_BUTTON)) {
+ overflowMenuButton = actionMenuView.getChildAt(i);
+ }
+ }
+
+ if (overflowMenuButton == null) {
+ throw new NoOverflowMenuRuntimeException();
+ }
+
+ return overflowMenuButton;
+ }
+}
diff --git a/library/src/com/haarman/supertooltips/ToolTipView.java b/lib/src/main/java/com/nhaarman/supertooltips/ToolTipView.java
similarity index 50%
rename from library/src/com/haarman/supertooltips/ToolTipView.java
rename to lib/src/main/java/com/nhaarman/supertooltips/ToolTipView.java
index 6dd4bec..eb6e3cd 100644
--- a/library/src/com/haarman/supertooltips/ToolTipView.java
+++ b/lib/src/main/java/com/nhaarman/supertooltips/ToolTipView.java
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-package com.haarman.supertooltips;
+package com.nhaarman.supertooltips;
+import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.PorterDuff;
import android.graphics.Rect;
@@ -22,24 +23,34 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.view.ViewManager;
import android.view.ViewTreeObserver;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
+
import com.nineoldandroids.animation.Animator;
+import com.nineoldandroids.animation.AnimatorListenerAdapter;
import com.nineoldandroids.animation.AnimatorSet;
import com.nineoldandroids.animation.ObjectAnimator;
import com.nineoldandroids.view.ViewHelper;
import java.util.ArrayList;
-import java.util.List;
+import java.util.Collection;
/**
- * A ViewGroup to visualize ToolTips. Use ToolTipRelativeLayout.showToolTipForView() to show ToolTips.
+ * A ViewGroup to visualize ToolTips. Use
+ * ToolTipRelativeLayout.showToolTipForView() to show ToolTips.
*/
public class ToolTipView extends LinearLayout implements ViewTreeObserver.OnPreDrawListener, View.OnClickListener {
+ public static final String TRANSLATION_Y_COMPAT = "translationY";
+ public static final String TRANSLATION_X_COMPAT = "translationX";
+ public static final String SCALE_X_COMPAT = "scaleX";
+ public static final String SCALE_Y_COMPAT = "scaleY";
+ public static final String ALPHA_COMPAT = "alpha";
+
private ImageView mTopPointerView;
private View mTopFrame;
private ViewGroup mContentHolder;
@@ -47,25 +58,25 @@ public class ToolTipView extends LinearLayout implements ViewTreeObserver.OnPreD
private View mBottomFrame;
private ImageView mBottomPointerView;
private View mShadowView;
- //
+
private ToolTip mToolTip;
private View mView;
- //
+
private boolean mDimensionsKnown;
private int mRelativeMasterViewY;
- //
+
private int mRelativeMasterViewX;
private int mWidth;
- //
+
private OnToolTipViewClickedListener mListener;
- public ToolTipView(Context context) {
+ public ToolTipView(final Context context) {
super(context);
init();
}
private void init() {
- setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
+ setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
setOrientation(VERTICAL);
LayoutInflater.from(getContext()).inflate(R.layout.tooltip, this, true);
@@ -98,7 +109,7 @@ public boolean onPreDraw() {
return true;
}
- public void setToolTip(ToolTip toolTip, View view) {
+ public void setToolTip(final ToolTip toolTip, final View view) {
mToolTip = toolTip;
mView = view;
@@ -108,6 +119,14 @@ public void setToolTip(ToolTip toolTip, View view) {
mToolTipTV.setText(mToolTip.getTextResId());
}
+ if (mToolTip.getTypeface() != null) {
+ mToolTipTV.setTypeface(mToolTip.getTypeface());
+ }
+
+ if (mToolTip.getTextColor() != 0) {
+ mToolTipTV.setTextColor(mToolTip.getTextColor());
+ }
+
if (mToolTip.getColor() != 0) {
setColor(mToolTip.getColor());
}
@@ -116,7 +135,7 @@ public void setToolTip(ToolTip toolTip, View view) {
setContentView(mToolTip.getContentView());
}
- if (!mToolTip.getShadow()) {
+ if (!mToolTip.shouldShowShadow()) {
mShadowView.setVisibility(View.GONE);
}
@@ -127,11 +146,12 @@ public void setToolTip(ToolTip toolTip, View view) {
private void applyToolTipPosition() {
final int[] masterViewScreenPosition = new int[2];
- final int[] parentViewScreenPosition = new int[2];
-
- final Rect viewDisplayFrame = new Rect(); // includes decorations (e.g. status bar)
mView.getLocationOnScreen(masterViewScreenPosition);
+
+ final Rect viewDisplayFrame = new Rect();
mView.getWindowVisibleDisplayFrame(viewDisplayFrame);
+
+ final int[] parentViewScreenPosition = new int[2];
((View) getParent()).getLocationOnScreen(parentViewScreenPosition);
final int masterViewWidth = mView.getWidth();
@@ -141,11 +161,10 @@ private void applyToolTipPosition() {
mRelativeMasterViewY = masterViewScreenPosition[1] - parentViewScreenPosition[1];
final int relativeMasterViewCenterX = mRelativeMasterViewX + masterViewWidth / 2;
- float toolTipViewAboveY = mRelativeMasterViewY - getHeight();
- float toolTipViewBelowY = mRelativeMasterViewY + masterViewHeight;
- float toolTipViewY;
+ int toolTipViewAboveY = mRelativeMasterViewY - getHeight();
+ int toolTipViewBelowY = Math.max(0, mRelativeMasterViewY + masterViewHeight);
- float toolTipViewX = Math.max(0, relativeMasterViewCenterX - mWidth / 2);
+ int toolTipViewX = Math.max(0, relativeMasterViewCenterX - mWidth / 2);
if (toolTipViewX + mWidth > viewDisplayFrame.right) {
toolTipViewX = viewDisplayFrame.right - mWidth;
}
@@ -155,7 +174,7 @@ private void applyToolTipPosition() {
final boolean showBelow = toolTipViewAboveY < 0;
- if (Build.VERSION.SDK_INT < 11) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
ViewHelper.setAlpha(mTopPointerView, showBelow ? 1 : 0);
ViewHelper.setAlpha(mBottomPointerView, showBelow ? 0 : 1);
} else {
@@ -163,73 +182,54 @@ private void applyToolTipPosition() {
mBottomPointerView.setVisibility(showBelow ? GONE : VISIBLE);
}
+ int toolTipViewY;
if (showBelow) {
toolTipViewY = toolTipViewBelowY;
} else {
toolTipViewY = toolTipViewAboveY;
}
- List animators = new ArrayList();
+ if (mToolTip.getAnimationType() == ToolTip.AnimationType.NONE) {
+ ViewHelper.setTranslationY(this, toolTipViewY);
+ ViewHelper.setTranslationX(this, toolTipViewX);
+ } else {
+ Collection animators = new ArrayList<>(5);
- if (mToolTip.getAnimationType() == ToolTip.ANIMATIONTYPE_FROMMASTERVIEW) {
- animators.add(ObjectAnimator.ofFloat(this, "translationY", mRelativeMasterViewY + mView.getHeight() / 2 - getHeight() / 2, toolTipViewY));
- animators.add(ObjectAnimator.ofFloat(this, "translationX", mRelativeMasterViewX + mView.getWidth() / 2 - mWidth / 2, toolTipViewX));
- } else if (mToolTip.getAnimationType() == ToolTip.ANIMATIONTYPE_FROMTOP) {
- animators.add(ObjectAnimator.ofFloat(this, "translationY", 0, toolTipViewY));
- }
+ if (mToolTip.getAnimationType() == ToolTip.AnimationType.FROM_MASTER_VIEW) {
+ animators.add(ObjectAnimator.ofInt(this, TRANSLATION_Y_COMPAT, mRelativeMasterViewY + mView.getHeight() / 2 - getHeight() / 2, toolTipViewY));
+ animators.add(ObjectAnimator.ofInt(this, TRANSLATION_X_COMPAT, mRelativeMasterViewX + mView.getWidth() / 2 - mWidth / 2, toolTipViewX));
+ } else if (mToolTip.getAnimationType() == ToolTip.AnimationType.FROM_TOP) {
+ animators.add(ObjectAnimator.ofFloat(this, TRANSLATION_Y_COMPAT, 0, toolTipViewY));
+ }
- animators.add(ObjectAnimator.ofFloat(this, "scaleX", 0, 1));
- animators.add(ObjectAnimator.ofFloat(this, "scaleY", 0, 1));
-
- animators.add(ObjectAnimator.ofFloat(this, "alpha", 0, 1));
-
- AnimatorSet animatorSet = new AnimatorSet();
- animatorSet.playTogether(animators);
-
- if (Build.VERSION.SDK_INT < 11) {
- final float fToolTipViewX = toolTipViewX;
- final float fToolTipViewY = toolTipViewY;
- animatorSet.addListener(new Animator.AnimatorListener() {
-
- @Override
- public void onAnimationStart(Animator animator) {
- }
-
- @Override
- public void onAnimationEnd(Animator animator) {
- RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
- params.leftMargin = (int) fToolTipViewX;
- params.topMargin = (int) fToolTipViewY;
- setX(0);
- setY(0);
- setLayoutParams(params);
- }
-
- @Override
- public void onAnimationCancel(Animator animator) {
- }
-
- @Override
- public void onAnimationRepeat(Animator animator) {
- }
- });
- }
+ animators.add(ObjectAnimator.ofFloat(this, SCALE_X_COMPAT, 0, 1));
+ animators.add(ObjectAnimator.ofFloat(this, SCALE_Y_COMPAT, 0, 1));
+
+ animators.add(ObjectAnimator.ofFloat(this, ALPHA_COMPAT, 0, 1));
+
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.playTogether(animators);
+
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
+ animatorSet.addListener(new AppearanceAnimatorListener(toolTipViewX, toolTipViewY));
+ }
- animatorSet.start();
+ animatorSet.start();
+ }
}
- public void setPointerCenterX(int pointerCenterX) {
+ public void setPointerCenterX(final int pointerCenterX) {
int pointerWidth = Math.max(mTopPointerView.getMeasuredWidth(), mBottomPointerView.getMeasuredWidth());
- ViewHelper.setX(mTopPointerView, pointerCenterX - pointerWidth / 2 - getX());
- ViewHelper.setX(mBottomPointerView, pointerCenterX - pointerWidth / 2 - getX());
+ ViewHelper.setX(mTopPointerView, pointerCenterX - pointerWidth / 2 - (int) getX());
+ ViewHelper.setX(mBottomPointerView, pointerCenterX - pointerWidth / 2 - (int) getX());
}
- public void setOnToolTipViewClickedListener(OnToolTipViewClickedListener listener) {
+ public void setOnToolTipViewClickedListener(final OnToolTipViewClickedListener listener) {
mListener = listener;
}
- public void setColor(int color) {
+ public void setColor(final int color) {
mTopPointerView.setColorFilter(color, PorterDuff.Mode.MULTIPLY);
mTopFrame.getBackground().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
mBottomPointerView.setColorFilter(color, PorterDuff.Mode.MULTIPLY);
@@ -237,13 +237,13 @@ public void setColor(int color) {
mContentHolder.setBackgroundColor(color);
}
- private void setContentView(View view) {
+ private void setContentView(final View view) {
mContentHolder.removeAllViews();
mContentHolder.addView(view);
}
public void remove() {
- if (Build.VERSION.SDK_INT < 11) {
+ if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
setX(params.leftMargin);
setY(params.topMargin);
@@ -252,46 +252,33 @@ public void remove() {
setLayoutParams(params);
}
- List animators = new ArrayList();
- if (mToolTip.getAnimationType() == ToolTip.ANIMATIONTYPE_FROMMASTERVIEW) {
- animators.add(ObjectAnimator.ofFloat(this, "translationY", getY(), mRelativeMasterViewY + mView.getHeight() / 2 - getHeight() / 2));
- animators.add(ObjectAnimator.ofFloat(this, "translationX", getX(), mRelativeMasterViewX + mView.getWidth() / 2 - mWidth / 2));
+ if (mToolTip.getAnimationType() == ToolTip.AnimationType.NONE) {
+ if (getParent() != null) {
+ ((ViewManager) getParent()).removeView(this);
+ }
} else {
- animators.add(ObjectAnimator.ofFloat(this, "translationY", getY(), 0));
- }
-
- animators.add(ObjectAnimator.ofFloat(this, "scaleX", 1, 0));
- animators.add(ObjectAnimator.ofFloat(this, "scaleY", 1, 0));
-
- animators.add(ObjectAnimator.ofFloat(this, "alpha", 1, 0));
-
- AnimatorSet animatorSet = new AnimatorSet();
- animatorSet.playTogether(animators);
- animatorSet.addListener(new Animator.AnimatorListener() {
- @Override
- public void onAnimationStart(Animator animator) {
+ Collection animators = new ArrayList<>(5);
+ if (mToolTip.getAnimationType() == ToolTip.AnimationType.FROM_MASTER_VIEW) {
+ animators.add(ObjectAnimator.ofInt(this, TRANSLATION_Y_COMPAT, (int) getY(), mRelativeMasterViewY + mView.getHeight() / 2 - getHeight() / 2));
+ animators.add(ObjectAnimator.ofInt(this, TRANSLATION_X_COMPAT, (int) getX(), mRelativeMasterViewX + mView.getWidth() / 2 - mWidth / 2));
+ } else {
+ animators.add(ObjectAnimator.ofFloat(this, TRANSLATION_Y_COMPAT, getY(), 0));
}
- @Override
- public void onAnimationEnd(Animator animator) {
- if (getParent() != null) {
- ((ViewGroup) getParent()).removeView(ToolTipView.this);
- }
- }
+ animators.add(ObjectAnimator.ofFloat(this, SCALE_X_COMPAT, 1, 0));
+ animators.add(ObjectAnimator.ofFloat(this, SCALE_Y_COMPAT, 1, 0));
- @Override
- public void onAnimationCancel(Animator animator) {
- }
+ animators.add(ObjectAnimator.ofFloat(this, ALPHA_COMPAT, 1, 0));
- @Override
- public void onAnimationRepeat(Animator animator) {
- }
- });
- animatorSet.start();
+ AnimatorSet animatorSet = new AnimatorSet();
+ animatorSet.playTogether(animators);
+ animatorSet.addListener(new DisappearanceAnimatorListener());
+ animatorSet.start();
+ }
}
@Override
- public void onClick(View view) {
+ public void onClick(final View view) {
remove();
if (mListener != null) {
@@ -302,21 +289,25 @@ public void onClick(View view) {
/**
* Convenience method for getting X.
*/
+ @SuppressLint("NewApi")
@Override
public float getX() {
- if (Build.VERSION.SDK_INT >= 11) {
- return super.getX();
+ float result;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ result = super.getX();
} else {
- return ViewHelper.getX(this);
+ result = ViewHelper.getX(this);
}
+ return result;
}
/**
* Convenience method for setting X.
*/
+ @SuppressLint("NewApi")
@Override
- public void setX(float x) {
- if (Build.VERSION.SDK_INT >= 11) {
+ public void setX(final float x) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
super.setX(x);
} else {
ViewHelper.setX(this, x);
@@ -326,21 +317,25 @@ public void setX(float x) {
/**
* Convenience method for getting Y.
*/
+ @SuppressLint("NewApi")
@Override
public float getY() {
- if (Build.VERSION.SDK_INT >= 11) {
- return super.getY();
+ float result;
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+ result = super.getY();
} else {
- return ViewHelper.getY(this);
+ result = ViewHelper.getY(this);
}
+ return result;
}
/**
* Convenience method for setting Y.
*/
+ @SuppressLint("NewApi")
@Override
- public void setY(float y) {
- if (Build.VERSION.SDK_INT >= 11) {
+ public void setY(final float y) {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
super.setY(y);
} else {
ViewHelper.setY(this, y);
@@ -348,6 +343,62 @@ public void setY(float y) {
}
public interface OnToolTipViewClickedListener {
- public void onToolTipViewClicked(ToolTipView toolTipView);
+ void onToolTipViewClicked(ToolTipView toolTipView);
+ }
+
+ private class AppearanceAnimatorListener extends AnimatorListenerAdapter {
+
+ private final float mToolTipViewX;
+ private final float mToolTipViewY;
+
+ AppearanceAnimatorListener(final float fToolTipViewX, final float fToolTipViewY) {
+ mToolTipViewX = fToolTipViewX;
+ mToolTipViewY = fToolTipViewY;
+ }
+
+ @Override
+ public void onAnimationStart(final Animator animation) {
+ }
+
+ @Override
+ @SuppressLint("NewApi")
+ public void onAnimationEnd(final Animator animation) {
+ RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
+ params.leftMargin = (int) mToolTipViewX;
+ params.topMargin = (int) mToolTipViewY;
+ setX(0);
+ setY(0);
+ setLayoutParams(params);
+ }
+
+ @Override
+ public void onAnimationCancel(final Animator animation) {
+ }
+
+ @Override
+ public void onAnimationRepeat(final Animator animation) {
+ }
+ }
+
+ private class DisappearanceAnimatorListener extends AnimatorListenerAdapter {
+
+ @Override
+ public void onAnimationStart(final Animator animation) {
+ }
+
+ @Override
+ public void onAnimationEnd(final Animator animation) {
+ if (getParent() != null) {
+ ((ViewManager) getParent()).removeView(ToolTipView.this);
+ }
+ }
+
+ @Override
+ public void onAnimationCancel(final Animator animation) {
+ }
+
+ @Override
+ public void onAnimationRepeat(final Animator animation) {
+ }
}
}
diff --git a/lib/src/main/java/com/nhaarman/supertooltips/exception/NoOverflowMenuRuntimeException.java b/lib/src/main/java/com/nhaarman/supertooltips/exception/NoOverflowMenuRuntimeException.java
new file mode 100644
index 0000000..8f6852a
--- /dev/null
+++ b/lib/src/main/java/com/nhaarman/supertooltips/exception/NoOverflowMenuRuntimeException.java
@@ -0,0 +1,14 @@
+package com.nhaarman.supertooltips.exception;
+
+/**
+ * A {@link RuntimeException} that is thrown if the overflow menu is not
+ * found. This happens when there simply is no overflow menu button, or the
+ * menu isn't initialised yet. You can choose to ignore this by catching the
+ * NoOverflowMenuRuntimeException.
+ */
+public class NoOverflowMenuRuntimeException extends RuntimeException {
+
+ public NoOverflowMenuRuntimeException() {
+ super("No overflow menu found. Are you sure the overflow menu button is visible? Check the docs for showToolTipForActionBarOverflowMenu(Activity, ToolTip) again!");
+ }
+}
\ No newline at end of file
diff --git a/lib/src/main/java/com/nhaarman/supertooltips/exception/NoTitleViewRuntimeException.java b/lib/src/main/java/com/nhaarman/supertooltips/exception/NoTitleViewRuntimeException.java
new file mode 100644
index 0000000..267428d
--- /dev/null
+++ b/lib/src/main/java/com/nhaarman/supertooltips/exception/NoTitleViewRuntimeException.java
@@ -0,0 +1,13 @@
+package com.nhaarman.supertooltips.exception;
+
+/**
+ * A {@link RuntimeException} that is thrown if the title view in the
+ * {@link android.app.ActionBar} is not found. You can choose to ignore this by catching
+ * the NoTitleViewRuntimeException.
+ */
+public class NoTitleViewRuntimeException extends RuntimeException {
+
+ public NoTitleViewRuntimeException() {
+ super("No title View found. Are you sure it exists?");
+ }
+}
diff --git a/lib/src/main/java/com/nhaarman/supertooltips/exception/ViewNotFoundRuntimeException.java b/lib/src/main/java/com/nhaarman/supertooltips/exception/ViewNotFoundRuntimeException.java
new file mode 100644
index 0000000..040ef7e
--- /dev/null
+++ b/lib/src/main/java/com/nhaarman/supertooltips/exception/ViewNotFoundRuntimeException.java
@@ -0,0 +1,13 @@
+package com.nhaarman.supertooltips.exception;
+
+/**
+ * A {@link RuntimeException} that is thrown if there is no {@link android.view.View}
+ * found with given resource id. You can choose to ignore this by catching
+ * the ViewNotFoundRuntimeException.
+ */
+public class ViewNotFoundRuntimeException extends RuntimeException {
+
+ public ViewNotFoundRuntimeException() {
+ super("View not found for this resource id. Are you sure it exists?");
+ }
+}
diff --git a/library/res/drawable-hdpi/quickcontact_drop_shadow.9.png b/lib/src/main/res/drawable-hdpi/quickcontact_drop_shadow.9.png
similarity index 100%
rename from library/res/drawable-hdpi/quickcontact_drop_shadow.9.png
rename to lib/src/main/res/drawable-hdpi/quickcontact_drop_shadow.9.png
diff --git a/library/res/drawable-hdpi/tooltip_arrow_down.png b/lib/src/main/res/drawable-hdpi/tooltip_arrow_down.png
similarity index 100%
rename from library/res/drawable-hdpi/tooltip_arrow_down.png
rename to lib/src/main/res/drawable-hdpi/tooltip_arrow_down.png
diff --git a/library/res/drawable-hdpi/tooltip_arrow_up.png b/lib/src/main/res/drawable-hdpi/tooltip_arrow_up.png
similarity index 100%
rename from library/res/drawable-hdpi/tooltip_arrow_up.png
rename to lib/src/main/res/drawable-hdpi/tooltip_arrow_up.png
diff --git a/library/res/drawable-hdpi/tooltip_bottom_frame.9.png b/lib/src/main/res/drawable-hdpi/tooltip_bottom_frame.9.png
similarity index 100%
rename from library/res/drawable-hdpi/tooltip_bottom_frame.9.png
rename to lib/src/main/res/drawable-hdpi/tooltip_bottom_frame.9.png
diff --git a/library/res/drawable-hdpi/tooltip_top_frame.9.png b/lib/src/main/res/drawable-hdpi/tooltip_top_frame.9.png
similarity index 100%
rename from library/res/drawable-hdpi/tooltip_top_frame.9.png
rename to lib/src/main/res/drawable-hdpi/tooltip_top_frame.9.png
diff --git a/library/res/layout/tooltip.xml b/lib/src/main/res/layout/tooltip.xml
similarity index 100%
rename from library/res/layout/tooltip.xml
rename to lib/src/main/res/layout/tooltip.xml
diff --git a/library/res/values/dimens.xml b/lib/src/main/res/values/dimens.xml
similarity index 100%
rename from library/res/values/dimens.xml
rename to lib/src/main/res/values/dimens.xml
diff --git a/library/AndroidManifest.xml b/library/AndroidManifest.xml
deleted file mode 100644
index 627efd2..0000000
--- a/library/AndroidManifest.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/library/libs/android-support-v4.jar b/library/libs/android-support-v4.jar
deleted file mode 100644
index 428bdbc..0000000
Binary files a/library/libs/android-support-v4.jar and /dev/null differ
diff --git a/library/libs/nineoldandroids-2.4.0.jar b/library/libs/nineoldandroids-2.4.0.jar
deleted file mode 100644
index 43ee45f..0000000
Binary files a/library/libs/nineoldandroids-2.4.0.jar and /dev/null differ
diff --git a/library/project.properties b/library/project.properties
deleted file mode 100644
index 96219ce..0000000
--- a/library/project.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-17
-android.library=true
-sdk.dir=C:\\Program Files (x86)\\Android\\android-studio\\sdk
\ No newline at end of file
diff --git a/library/res/drawable-hdpi/ic_launcher.png b/library/res/drawable-hdpi/ic_launcher.png
deleted file mode 100644
index c1b44cc..0000000
Binary files a/library/res/drawable-hdpi/ic_launcher.png and /dev/null differ
diff --git a/library/res/drawable-mdpi/ic_launcher.png b/library/res/drawable-mdpi/ic_launcher.png
deleted file mode 100644
index a1bf709..0000000
Binary files a/library/res/drawable-mdpi/ic_launcher.png and /dev/null differ
diff --git a/library/res/drawable-xhdpi/ic_launcher.png b/library/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100644
index 3b5ae5b..0000000
Binary files a/library/res/drawable-xhdpi/ic_launcher.png and /dev/null differ
diff --git a/library/res/drawable-xxhdpi/ic_launcher.png b/library/res/drawable-xxhdpi/ic_launcher.png
deleted file mode 100644
index b7df51b..0000000
Binary files a/library/res/drawable-xxhdpi/ic_launcher.png and /dev/null differ
diff --git a/library/res/menu/main.xml b/library/res/menu/main.xml
deleted file mode 100644
index f3b10b6..0000000
--- a/library/res/menu/main.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
diff --git a/library/res/values-sw600dp/dimens.xml b/library/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 886b05f..0000000
--- a/library/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
diff --git a/library/res/values-sw720dp-land/dimens.xml b/library/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 00059fc..0000000
--- a/library/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- 128dp
-
diff --git a/library/res/values-v11/styles.xml b/library/res/values-v11/styles.xml
deleted file mode 100644
index 3c02242..0000000
--- a/library/res/values-v11/styles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
diff --git a/library/res/values-v14/styles.xml b/library/res/values-v14/styles.xml
deleted file mode 100644
index a91fd03..0000000
--- a/library/res/values-v14/styles.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
diff --git a/library/res/values/strings.xml b/library/res/values/strings.xml
deleted file mode 100644
index c11a1b7..0000000
--- a/library/res/values/strings.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
- ToolTips
- Settings
- Hello world!
-
-
diff --git a/library/res/values/styles.xml b/library/res/values/styles.xml
deleted file mode 100644
index 6ce89c7..0000000
--- a/library/res/values/styles.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/library/src/com/haarman/supertooltips/ToolTip.java b/library/src/com/haarman/supertooltips/ToolTip.java
deleted file mode 100644
index 8a9d91d..0000000
--- a/library/src/com/haarman/supertooltips/ToolTip.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright 2013 Niek Haarman
- *
- * 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.haarman.supertooltips;
-
-import android.view.View;
-
-public class ToolTip {
-
- public static final int ANIMATIONTYPE_FROMMASTERVIEW = 101;
- public static final int ANIMATIONTYPE_FROMTOP = 102;
- //
- private CharSequence text;
- private int textResId;
- private int color;
- private View contentView;
- private int animationType;
- private boolean shadow;
-
- /**
- * Creates a new ToolTip without any values.
- */
- public ToolTip() {
- text = null;
- textResId = 0;
- color = 0;
- contentView = null;
- animationType = ANIMATIONTYPE_FROMMASTERVIEW;
- }
-
- /**
- * Set the text to show. Has no effect when a content View is set using setContentView().
- *
- * @return this ToolTip to build upon.
- */
- public ToolTip withText(CharSequence text) {
- this.text = text;
- this.textResId = 0;
- return this;
- }
-
- /**
- * Set the text resource id to show. Has no effect when a content View is set using setContentView().
- *
- * @return this ToolTip to build upon.
- */
- public ToolTip withText(int resId) {
- this.textResId = resId;
- this.text = null;
- return this;
- }
-
- /**
- * Set the color of the ToolTop. Default is white.
- *
- * @return this ToolTip to build upon.
- */
- public ToolTip withColor(int color) {
- this.color = color;
- return this;
- }
-
- /**
- * Set a custom content View for the ToolTip. This will cause any text that has been set to be ignored.
- *
- * @return this ToolTip to build upon.
- */
- public ToolTip withContentView(View view) {
- this.contentView = view;
- return this;
- }
-
- /**
- * Set the animation type for the ToolTip. One of ANIMATIONTYPE_FROMMASTERVIEW and ANIMATIONTYPE_FROMTOP. Default ANIMATIONTYPE_FROMMASTERVIEW.
- *
- * @return this ToolTip to build upon.
- */
- public ToolTip withAnimationType(int animationType) {
- this.animationType = animationType;
- return this;
- }
-
- /**
- * Set whether to show a shadow below the ToolTip.
- *
- * @return this ToolTip to build upon.
- */
- public ToolTip withShadow(boolean shadow) {
- this.shadow = shadow;
- return this;
- }
-
- public CharSequence getText() {
- return text;
- }
-
- public int getTextResId() {
- return textResId;
- }
-
- public int getColor() {
- return color;
- }
-
- public View getContentView() {
- return contentView;
- }
-
- public int getAnimationType() {
- return animationType;
- }
-
- public boolean getShadow() {
- return shadow;
- }
-}
\ No newline at end of file
diff --git a/library/src/com/haarman/supertooltips/ToolTipRelativeLayout.java b/library/src/com/haarman/supertooltips/ToolTipRelativeLayout.java
deleted file mode 100644
index dfbfdfb..0000000
--- a/library/src/com/haarman/supertooltips/ToolTipRelativeLayout.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2013 Niek Haarman
- * 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.haarman.supertooltips;
-
-import android.content.Context;
-import android.util.AttributeSet;
-import android.view.View;
-import android.widget.RelativeLayout;
-
-public class ToolTipRelativeLayout extends RelativeLayout {
-
- public ToolTipRelativeLayout(Context context) {
- super(context);
- }
-
- public ToolTipRelativeLayout(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public ToolTipRelativeLayout(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- /**
- * Shows a ToolTipView based on gived ToolTip at the proper location relative to given View.
- *
- * @return the ToolTipView that was created.
- */
- public ToolTipView showToolTipForView(ToolTip toolTip, final View view) {
- final ToolTipView toolTipView = new ToolTipView(getContext());
- toolTipView.setToolTip(toolTip, view);
- addView(toolTipView);
- return toolTipView;
- }
-
-}
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..97a5ad9
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,118 @@
+
+
+
+ 4.0.0
+
+ com.nhaarman.supertooltips
+ parent
+ pom
+ 2.0
+ SuperToolTips (Parent)
+
+
+ library
+ example
+
+
+
+ 1.6
+ 4.1.1.4
+ 16
+ r7
+ 3.6.1
+
+
+
+
+
+ com.google.android
+ android
+ ${android.version}
+
+
+
+ com.google.android
+ support-v4
+ ${android.support.version}
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 2.3.2
+
+
+ ${java.version}
+
+
+
+
+ com.jayway.maven.plugins.android.generation2
+ android-maven-plugin
+ ${android-maven.version}
+
+
+ ${android.platform}
+
+ true
+
+ true
+
+
+
+ org.apache.maven.plugins
+ maven-checkstyle-plugin
+ 2.6
+
+ true
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ 2.1
+
+ true
+
+
+
+
+ org.apache.maven.plugins
+ maven-eclipse-plugin
+ 2.9
+
+
+ android:android
+ com.google.android.maps:maps
+
+ bin
+
+ com.android.ide.eclipse.adt.ANDROID_FRAMEWORK
+
+
+ com.android.ide.eclipse.adt.AndroidNature
+ org.eclipse.ajdt.ui.ajnature
+
+
+ com.android.ide.eclipse.adt.ResourceManagerBuilder
+ com.android.ide.eclipse.adt.PreCompilerBuilder
+ org.eclipse.jdt.core.javabuilder
+ com.android.ide.eclipse.adt.ApkBuilder
+
+ false
+
+
+
+
+
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..3a5a919
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1 @@
+include ':lib', ':app'