All Projects → tomergoldst → Tooltips

tomergoldst / Tooltips

Simple to use library for android, enabling to add a tooltip near any view with ease

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Tooltips

SpikeTip
Create effortless tooltips that breathe CSS! No Javascript. Just the good old CSS.
Stars: ✭ 26 (-96.4%)
Mutual labels:  tooltips, tooltip
Cooltipz.css
A modern, highly customisable, minimal, pure CSS tooltip library
Stars: ✭ 81 (-88.8%)
Mutual labels:  tooltip, tooltips
Html5tooltipsjs
Tooltips with smooth 3D animation
Stars: ✭ 892 (+23.37%)
Mutual labels:  tooltip, tooltips
React Popper
🍿⚛Official React library to use Popper, the positioning library
Stars: ✭ 2,173 (+200.55%)
Mutual labels:  tooltip, tooltips
react-popper
🍿⚛Official React library to use Popper, the positioning library
Stars: ✭ 2,415 (+234.02%)
Mutual labels:  tooltips, tooltip
Ngx Popper
An angular wrapper for popper.js, great for tooltips and positioning popping elements
Stars: ✭ 183 (-74.69%)
Mutual labels:  tooltip, tooltips
Balloon
🎈 Modernized and sophisticated tooltips, fully customizable with an arrow and animations on Android.
Stars: ✭ 2,242 (+210.1%)
Mutual labels:  tooltip, tooltips
Zebra Tooltips
A lightweight, accessible, and highly configurable jQuery plugin for creating beautiful tooltips
Stars: ✭ 52 (-92.81%)
Mutual labels:  tooltips, tooltip
Easy Toggle State
A tiny JavaScript library to easily toggle the state of any HTML element in any contexts, and create UI components in no time.
Stars: ✭ 261 (-63.9%)
Mutual labels:  tooltip, tooltips
Protip
A new generation jQuery Tooltip plugin
Stars: ✭ 357 (-50.62%)
Mutual labels:  tooltip
Jquery Popup Overlay
jQuery plugin for responsive and accessible modal windows and tooltips
Stars: ✭ 511 (-29.32%)
Mutual labels:  tooltip
React Hint
Tooltip component for React, Preact, Inferno
Stars: ✭ 338 (-53.25%)
Mutual labels:  tooltip
Angular Tooltips
Angularjs tooltips module, add tooltips to your elements - https://720kb.github.io/angular-tooltips
Stars: ✭ 357 (-50.62%)
Mutual labels:  tooltips
Balloon.css
Simple tooltips made of pure CSS
Stars: ✭ 4,851 (+570.95%)
Mutual labels:  tooltip
Mahou
Mahou(魔法) - The magic layout switcher.
Stars: ✭ 335 (-53.67%)
Mutual labels:  tooltip
Android Simple Tooltip
A simple library based on PopupWindow to create Tooltips on Android. 💚
Stars: ✭ 622 (-13.97%)
Mutual labels:  tooltip
Quantum Nox Firefox Dark Full Theme
These usercontent and userchrome files will give a full themed dark color to Firefox Quantum, menus and dialogs included, as well as the scrollbars. You can also use the JS files to enable multirow tabs and other functions.
Stars: ✭ 328 (-54.63%)
Mutual labels:  tooltip
Popper Core
🍿 JavaScript positioning library for tooltips, popovers, dropdowns, and more
Stars: ✭ 18,903 (+2514.52%)
Mutual labels:  tooltip
Wenk
😉 Lightweight pure CSS tooltip for the greater good
Stars: ✭ 694 (-4.01%)
Mutual labels:  tooltip
Css Components
☕️ A set of common UI Components using the power of CSS and without Javascript.
Stars: ✭ 592 (-18.12%)
Mutual labels:  tooltip

Tooltips

Simple to use library for android, Enabling to add a tooltip near any view with ease

Instructions

Add a dependency to your app build.gradle

dependencies {
    implementation 'com.tomergoldst.android:tooltips:1.1.0'
}

Create a ToolTipsManager object

public class MainActivity extends Activity {
    
    ToolTipsManager mToolTipsManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        mToolTipsManager = new ToolTipsManager();
        
    }

}

Use the ToolTip.Builder to construct your tip

public class MainActivity extends Activity {
    
     @Override
     public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
        
        ToolTip.Builder builder = new ToolTip.Builder(this, mTextView, mRootLayout, "Tip message", ToolTip.POSITION_ABOVE);
    }
}

mTextView here is the view which near it the tip will be shown and mRootLayout is the layout where the tip view will be added to. The root layout must be of RelativeLayout, FrameLayout or similar. LinearLayout won't work but you can always wrap your LinearLayout with another layout. Prefer to pass in a layout which is higher in the xml tree as this will give the tip view more visible space.

OPTIONAL: Customize your tip with background color, text color, alignment, text gravity, type face and more.

public class MainActivity extends Activity {
    
     @Override
     public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
         
        ToolTip.Builder builder = new ToolTip.Builder(this, mTextView, mRootLayout, "Tip message", ToolTip.POSITION_ABOVE);
        builder.setAlign(ToolTip.ALIGN_LEFT);
        builder.setBackgroundColor(getResources().getColor(R.color.colorOrange));
        builder.setGravity(ToolTip.GRAVITY_RIGHT);
        builder.setTextAppearance(R.style.TooltipTextAppearance); // from `styles.xml`
        builder.setTypeface(mCustomFontTypeface);
    }
}

Here is an example on how you can define your text appearance in your styles.xml

<style name="TooltipTextAppearance">
    <item name="android:textColor">@color/your_custom_color</item>
    <item name="android:textSize">16sp</item>
    <item name="android:textStyle">bold</item>
</style>

You can also customize the animation used to show and hide the tooltip view by providing ToolTipAnimator implementation and setting it in the ToolTipsManager.

public class MainActivity extends Activity {
    ToolTipsManager mToolTipsManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        
        mToolTipsManager = new ToolTipsManager();
        mToolTipsManager.setToolTipAnimator(MyCustomToolTipAnimator());
    }

}

Use ToolTipManger to show the tip

IMPORTANT: This must be called after the layout has been drawn You can override the onWindowFocusChanged() of an Activity and show there, Start a delayed runnable from onStart(), react to user action or any other method that works for you

public class MainActivity extends Activity {
    
    @Override
     public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
         
        ToolTip.Builder builder = new ToolTip.Builder(this, mTextView, mRootLayout, "Tip message", ToolTip.POSITION_ABOVE);
        
        // Rest of builder configurations removed for brevity
      
        mToolTipsManager.show(builder.build());
    }
}

Each tip is dismissable by clicking on it, if you want to dismiss a tip from code there are a few options, the most simple way is to do the following

public class MainActivity extends Activity {
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        
        mDismissBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mToolTipsManager.findAndDismiss(mTextView);
            }
        });
    }
    
}

Where mTextView is the same view we asked to position a tip near it

If you want to react when tip has been dismissed, Implement ToolTipsManager.TipListener interface and use appropriate ToolTipsManager constructor

public class MainActivity extends Activity implements ToolTipsManager.TipListener {
    
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        mToolTipsManager = new ToolTipsManager(this);
    }

    @Override
    public void onTipDismissed(View view, int anchorViewId, boolean byUser) {
        Log.d(TAG, "tip near anchor view " + anchorViewId + " dismissed");
    
        if (anchorViewId == R.id.text_view) {
            // Do something when a tip near view with id "R.id.text_view" has been dismissed
        }
    }
    
}

License

Copyright 2016 Tomer Goldstein

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].