Android Tooltips


Source link: https://github.com/ViHtarb/Tooltip

Android Tooltips

Simple to use customizable Android Tooltips library based on PopupWindow. This Tooltips does not require any custom layout. It works as PopupWindow.

Getting started

Gradle

dependencies {

  compile 'com.github.vihtarb:tooltip:0.1.9' 
}

Maven

<dependency>
  <groupId>com.github.vihtarb</groupId>
  <artifactId>tooltip</artifactId>
  <version>0.1.9</version> </dependency>

Usage

Tooltip tooltip = new Tooltip.Builder(anchorView)

.setText("Hello tooltip")

.show();

Useful methods

Builder:

  • Builder(MenuItem anchorMenuItem)
  • Builder(MenuItem anchorMenuItem, @StyleRes int resId)
  • Builder(View anchorView)
  • Builder(View anchorView, @StyleRes int resId)
  • setCancelable(boolean cancelable) - dismiss on outside touch. Default is false
  • setDismissOnClick(boolean isDissmissOnClick) - dismiss on inside touch. Default is false
  • setArrowEnabled(boolean isArrowEnabled)
  • setBackgroundColor(@ColorInt int color) - background color. Default is Color.GRAY
  • setCornerRadius(@DimenRes int resId) - background drawable corner radius from resources
  • setCornerRadius(float radius) - background drawable corner radius
  • setArrowHeight(@DimenRes int resId)
  • setArrowHeight(float height)
  • setArrowWidth(@DimenRes int resId)
  • setArrowWidth(float width)
  • setArrow(@DrawableRes int resId) - custom arrow drawable from resources
  • setArrow(Drawable arrowDrawable) - custom arrow drawable
  • setMargin(@DimenRes int resId) - margin between arrow and anchor view from resources
  • setMargin(float margin) - margin between arrow and anchor view
  • setPadding(int padding) - content padding
  • setPadding(float padding) - deprecated, use setPadding(int padding) instead
  • setGravity(int gravity) - Tooltip gravity. Default is Gravity.BOTTOM
  • setMaxWidth(int gravity)
  • setDrawablePadding(int gravity)
  • setDrawableBottom(@DrawableRes int resId)
  • setDrawableBottom(Drawable drawable)
  • setDrawableEnd(@DrawableRes int resId)
  • setDrawableEnd(Drawable drawable)
  • setDrawableStart(@DrawableRes int resId)
  • setDrawableStart(Drawable drawable)
  • setDrawableTop(@DrawableRes int resId)
  • setDrawableTop(Drawable drawable)
  • setTextAppearance(@StyleRes int resId)
  • setText(@StringRes int resId)
  • setText(String text)
  • setTextSize(@DimenRes int resId)
  • setTextSize(float size)
  • setTextColor(@ColorInt int color)
  • setTextStyle(int style)
  • setLineSpacing(@DimenRes int addResId, float mult)
  • setLineSpacing(float add, float mult)
  • setTypeface(Typeface typeface)
  • setOnClickListener(OnClickListener listener)
  • setOnLongClickListener(OnLongClickListener listener)
  • setOnDismissListener(OnDismissListener listener)
  • build() - creates and returns new Tooltip
  • show() - creates, shows and returns new Tooltip

Tooltip:

  • isShowing() - retruns is Tooltip showing
  • show() - show Tooltip if not showing
  • dismiss() - dismissing Tooltip
  • setOnClickListener(OnClickListener listener)
  • setOnLongClickListener(OnLongClickListener listener)
  • setOnDismissListener(OnDismissListener listener)

Styleable

You can create Tooltip with custom style

Tooltip tooltip = new Tooltip.Builder(anchorView, R.style.tooltip)

.setText("Hello tooltip")

.show();

Attributes

  • <attr name="cancelable" format="boolean"/> - dismiss on outside touch. Default is false
  • <attr name="dismissOnClick" format="boolean"/> - dismiss on inside touch. Default is false
  • <attr name="arrowEnabled" format="boolean"/>
  • <attr name="backgroundColor" format="color"/> - background color. Default is Color.GRAY
  • <attr name="cornerRadius" format="dimension"/> - background drawable corner radius
  • <attr name="arrowHeight" format="dimension"/>
  • <attr name="arrowWidth" format="dimension"/>
  • <attr name="arrowDrawable" format="reference"/>
  • <attr name="margin" format="dimension"/> - margin between arrow and anchor view
  • <attr name="textAppearance" format="reference"/>
  • <attr name="android:padding"/> - content padding
  • <attr name="android:gravity"/> - Tooltip gravity
  • <attr name="android:maxWidth"/>
  • <attr name="android:drawablePadding"/>
  • <attr name="android:drawableBottom"/>
  • <attr name="android:drawableEnd"/>
  • <attr name="android:drawableStart"/>
  • <attr name="android:drawableTop"/>
  • <attr name="android:text"/>
  • <attr name="android:textSize"/>
  • <attr name="android:textColor"/>
  • <attr name="android:textStyle"/>
  • <attr name="android:fontFamily"/>
  • <attr name="android:typeface"/>
  • <attr name="android:lineSpacingExtra"/>
  • <attr name="android:lineSpacingMultiplier"/>

Changelog

0.1.9

  • Min SDK changed from 11 to 14
  • Implemented OnClickListener and OnLongClickListener listeners
  • Implemented setOnClickListener and setOnLongClickListener methods in Builder and Tooltip
  • Implemented setOnDismissListener in Tooltip
  • Implemented customizing arrow drawable by Builder method setArrow(Drawable) and styleable attribute arrowDrawable
  • Reimplemented TooltipActionView class
  • Removed Context context argument in Builder constructors with second argument MenuItem anchorMenuItem
  • Fixed Activity has leaked window

0.1.8

  • Implemented OnDismissListener
  • Removed Context context argument in Builder constructors with second argument View anchorView
  • Renamed styleable attribute from colorBackground to backgroundColor

0.1.6

This version is supported Android API 7 and large. If you want use Tooltips in projects with Min SDK 7 then use this in dependencies:

Gradle

dependencies {

  compile 'com.github.vihtarb:tooltip:0.1.6' 
}

Maven

<dependency>
  <groupId>com.github.vihtarb</groupId>
  <artifactId>tooltip</artifactId>
  <version>0.1.6</version> </dependency>

SNAPSHOTS

For using snapshots of development versions you need include the snapshots repo by adding the snapshot build to a dependent project. To do this add the following to your build.gradle project(not module) file

maven {

  url "https://oss.sonatype.org/content/repositories/snapshots" 
}

Gradle

dependencies {

  compile 'com.github.vihtarb:tooltip:0.1.9.4-SNAPSHOT' 
}

Maven

<dependency>
  <groupId>com.github.vihtarb</groupId>
  <artifactId>tooltip</artifactId>
  <version>0.1.9.4-SNAPSHOT</version> </dependency>

Changelog-SNAPSHOTS

0.1.9.4-SNAPSHOT

  • Implemented setting compound drawables(and drawables padding) by Builder methods setDrawableStart, setDrawableEnd, setDrawableBottom, setDrawableTop and for padding setDrawablePadding(int) or styleable attributes android:drawableStart, android:drawableEnd, android:drawableBottom, android:drawableTop and for padding android:drawablePadding (@antoninovitale)
  • Implemented setting max Tooltip width by Builder method setMaxWidth(int) or styleable attribute android:maxWidth (@CapnSpellcheck)
  • Implemented RTL layout direction supporting
  • Implemented use Gravity.LEFT and Gravity.RIGHT as Tooltip gravity, but it strongly not recommended
  • Implemented smooth Tooltip arrow
  • Fixed Tooltip content view padding
  • Builder method setPadding(float) marked as deprecated use setPadding(int) instead
  • Builder method setPadding(int) now sets padding from argument not from resources

0.1.9.3-SNAPSHOT

  • Implemented arrow disabling by Builder method setArrowEnabled(boolean) or styleable attribute arrowEnabled
  • #26 Fixed issue with Exception android.view.WindowManager$BadTokenException:...

0.1.9.2-SNAPSHOT

  • #19 Fixed issue with Tooltip moving on scrolling/updating list views

0.1.9.1-SNAPSHOT

  • #13 Implemented supporting CharSequence for text instead of String (@gkravas)

Future Work

  • Animations
  • Elevation(Shadow)

Known issues

  • #17 As temporary fix use it: compile ('com.github.vihtarb:tooltip:version') { exclude module: "support-compat" }

License( MIT License)

The MIT License (MIT)  Copyright (c) 2016. Vi?t@r?  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. 

Resources

Great sound quality, audio cleanliness and very smooth interface. Playing the folder structure, artist or album or create your own playlists with local or online tracks.

  • 10-band equalizer
  • Themes
  • mp3, flac, aac, ogg, oga, m4a, m4b, m4p, wma and other audio formats

Shape Ripple is a library that emulates a ripple like animations with cool tweaks on the go. It runs on API level 11 and upwards.

As addition you can even create your own shape renderer through the canvas to create a custom shape ripple.

An unofficial Unsplash API library.

MapDrawingTools is an android library to Drawing manually polygon, polyline and points in the Google Map and return coordinates from library to your App. this library useful for application that pick multiple point or drawing border of land to get data from users.

Aesthetic is an easy to use, fast, Rx-powered theme engine for Android applications.

Android developers should collect the following utils.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes