sTooltip


Source link: https://github.com/jesualex/sTooltip

sTooltip is a simple Tooltip flexible and self-adjusting kotlin Library for Android.

sTooltip

sTooltip is a simple Tooltip flexible and self-adjusting kotlin Library for Android.

Download

Easy Use:


Tooltip.on(exampleTextView)

  .text(R.string.example)

  .icon(android.R.drawable.ic_dialog_info)

  .iconSize(30, 30)

  .color(resources.getColor(R.color.colorPrimary))

  .overlay(resources.getColor(R.color.overlay))

  .border(Color.BLACK, 1f)

  .clickToHide(true)

  .corner(5)

  .position(Position.TOP)

  .show(3000)

First Steps

In your Project build.gradle you must have the following

buildscript {

  ...
  repositories {

...

jcenter()
  
}

  ...
  dependencies {

...

classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  
}

  ... 
}

In your App build.gradle you must have the following

... apply plugin:  kotlin-android  apply plugin:  kotlin-android-extensions  ... dependencies {

  ...
  implementation  cl.jesualex.android:stooltip:1.0  
}

Options

Initialization of Builder

For your convenience, you can initialize the constructor only using the view to which you want the tooltip to refer, in that case the tooltip will be attached to the decorView(OVER ALL VIEWS)

Tooltip.on(View)

or if you wish you can add a root view and the tooltip will be ubicate inside of this view

Tooltip.on(View, View)

Builder options

Once the builder has been initialized, you can configure your tooltip, below you can briefly see the different methods you can use for that config

  • To set text builder.text(text)

  • To set text color builder.textColor(colorInt)

  • To set text typeface builder.textTypeFace(typeface)

  • To set text size builder.textSize(textSize) builder.textSize(unit, textSize)

  • To set text gravity builder.textGravity(TextViewGravity)

  • To enable a left icon(by default disabled) builder.icon(icon)

  • To set the icon margin in px builder.iconMargin(left, top, right, bottom)

  • To set the icon size in px builder.iconSize(h, w)

  • To set the tooltip bubble color builder.color(color)

  • To set the tooltip content padding in px builder.padding(top, right, bottom, left)

  • To set the position of the tooltip in relation to the view to which it points(by deafult Bottom) builder.position(position)

  • To set the corner radius in px of the tooltip bubble builder.corner(radius)

  • To enable autohide on tap(by default is enabled) builder.clickToHide(bool)

  • To set the distance in px between the tooltip and the view to which it points builder.distanceWithView(distance)

  • To set the the border color and width in px builder.border(color, width)

  • To set the the border margin in px builder.border(margin)

  • To enable and set a bubble shadow(by default bubble shadow radius is 0, it means shadow disabled) builder.shadow(radius) builder.shadow(radius, color)

  • To set shadow padding builder.shadow(padding)

  • To set the arrow size builder.arrowSize(h, w)

  • To set a tooltip minWidth in px if the space in parent isn t enough the tooltip will be relocated to the opposite position builder.minWidth(w)

  • To set a tooltip minHeight in px if the space in parent isn t enough the tooltip will be relocated to the opposite position builder.minHeight(w)

  • To set a tooltip show/hide animation builder.animation(anim) builder.animation(animIn, animOut)

  • To set a lifecycle listener to know when the tooltip has showed or hidden builder.displayListener(listener)

  • To set a click listener to catch when the user click the tooltip builder.tooltipClickListener(listener)

  • To set a click listener to catch when the user click the view to which the tooltip points builder.refViewClickListener(listener)

  • To enable overlay function and set a listener to catch when the user click the overlay(by default the overlay click has disabled, it means that if the user clicks in the overlay, that click will be send to the view under the overlay) builder.overlay(color) builder.overlay(color, listener)

Show options

After configure your tooltip just left show it, if you want set a duration in millis and the tooltip will be autohide after that time(by default autohide is disabled)

builder.show()
builder.show(duration)

This show method return a Tooltip instance, with which you can close, closeNow(without animation) and show it again

tooltip.close()
tooltip.closeNow()
tooltip.show()
tooltip.show(duration)
tooltip.show(text)
tooltip.show(duration, text)

Example

To get a small example, please download this repo and execute it

License

Copyright 2019 Jesualex. All rights reserved.  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. 

Resources

Renderers is an Android library created to avoid all the Adapter/ListView boilerplate needed to create a new adapter and all the spaghetti code that developers used to create following the ViewHolder classic implementation.

This Android library offers you two main classes to extend and create your own rendering algorithms out of your adapter implementation.

Renderers is an easy way to work with android ListView and Adapter classes. With this library you only have to create your renderers and declare the mapping between the object to render and the renderer.

Futuroid is an Android library that allows running asynchronous tasks and attaching callbacks thanks to a convenient syntax. It offers an alternative to the Android AsyncTask class.

Features:

  • Future-based API (similar to Guava's ListenableFutures, Scala/Akka Futures, Javascript promises...)
  • Allows registering callbacks to be run on the Android UI/main thread
  • Provides a default ExecutorService (fixed thread pool with 5 threads) that can be replaced by a custom one
  • Each task can be run on the default ExecutorService or on a custom one
  • Allows task chaining (monad-style)

Custom shape ImageView using PorterDuffXfermode with paint shapes and SVGs.

You can use it to quickly turn a String into a Spannable and apply different types of spans to it.

new Makeup( name + ", " + age).boldify(0, name.length()).apply()

This would show a name and age of a person, and make the name part bold.

Battery Historian is a tool to analyze battery consumers using Android "bugreport" files.

A Java library for the Forecast.io API. It is quite functional at this point. The API is fully implemented except for callbacks. Further development will continue. A jar file with the dependencies is available under the jar/ folder for convenience.

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