A highlight lib and also it can be a simple popup window lib for android

Overview

HighlightPro

中文

HighlightPro is a highlight library for android and also it can be a simple popup window library for android.

Features:

  • One or more highlighted views can be displayed at once

  • Custom exact position of the tip view by horizontal constraint and vertical constraint

  • Custom tip view display animation what you want

  • Custom highlight shape and shape's paint

  • Chained code, simple to use

  • Support simple popup window

Sample screenshots:

guide_pro

guide_pro_popup_window

highlight_recycler_view

Basic usage:

Gradle

Add maven repositories of jitpack in your project's build.gradle file:

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

Add dependence in your app's build.gradle file:

dependencies {		
	implementation 'com.github.hyy920109:GuidePro:1.1.0'
}

Code Sample

You can start with one of Activity or Fragment or ViewGroup like the below code:

/**
 * DecorView of [activity] treat as the rootView
 */
fun with(activity: Activity): HighlightPro {
    return HighlightPro(activity)
}

/**
 * DecorView of [fragment]'s [activity] treat as the rootView
 */
fun with(fragment: Fragment): HighlightPro {
    return HighlightPro(fragment)
}


/**
 * the [container] treat as rootView and the container should be a FrameLayout or a viewGroup extends FrameLayout
 * to ensure the UI can display normally
 */
fun with(container: FrameLayout): HighlightPro {
    return HighlightPro(container)
}

A simple complete code:

HighlightPro.with(this)
            .setHighlightParameter {
                HighlightParameter.Builder()
                    .setHighlightViewId(R.id.btn_step_first)
                    .setTipsViewId(R.layout.guide_step_first)
                    .setHighlightShape(RectShape(4f.dp, 4f.dp, 6f))
                    .setHighlightHorizontalPadding(8f.dp)
                    .setConstraints(Constraints.StartToEndOfHighlight + Constraints.TopToTopOfHighlight)
                    .setMarginOffset(MarginOffset(start = 8.dp))
                    .build()
            }
            .setBackgroundColor("#80000000".toColorInt())
            .setOnShowCallback { index ->
                //do something
            }
            .setOnDismissCallback {
                //do something
            }
            .show()

Sometimes you want to show more highlight views at once:

HighlightPro.with(this)
            .setHighlightParameters(
                HighlightParameter.Builder()
                    .setHighlightViewId(R.id.btn_step_first)
                    .setTipsViewId(R.layout.guide_step_first)
                    .setHighlightShape(RectShape(4f.dp, 4f.dp, 6f))
                    .setHighlightHorizontalPadding(8f.dp)
                    .setConstraints(Constraints.StartToEndOfHighlight + Constraints.TopToTopOfHighlight)
                    .setMarginOffset(MarginOffset(start = 8.dp))
                    .build()
                        +
                HighlightParameter.Builder()
                    .setHighlightViewId(R.id.btn_step_second)
                    .setTipsViewId(R.layout.guide_step_second)
                    .setHighlightShape(RectShape(4f.dp, 4f.dp, 6f))
                    .setHighlightHorizontalPadding(8f.dp)
                    .setConstraints(Constraints.StartToEndOfHighlight + Constraints.TopToTopOfHighlight)
                    .setMarginOffset(MarginOffset(start = 8.dp))
                    .build()
            )
            .setBackgroundColor("#80000000".toColorInt())
            .setOnShowCallback { index ->
                //do something
            }
            .setOnDismissCallback {
                //do something
            }
            .show()

Sometimes we want display some steps highlight guide:

HighlightPro.with(this)
    .setHighlightParameter {
        HighlightParameter.Builder()
            .setHighlightViewId(R.id.btn_step_first)
            .setTipsViewId(R.layout.guide_step_first)
            .setHighlightShape(RectShape(4f.dp, 4f.dp, 6f))
            .setHighlightHorizontalPadding(8f.dp)
            .setConstraints(Constraints.StartToEndOfHighlight + Constraints.TopToTopOfHighlight)
            .setMarginOffset(MarginOffset(start = 8.dp))
            .build()
    }
    .setHighlightParameter {
        HighlightParameter.Builder()
            .setHighlightViewId(R.id.btn_step_second)
            .setTipsViewId(R.layout.guide_step_second)
            .setHighlightShape(CircleShape())
            .setHighlightHorizontalPadding(20f.dp)
            .setHighlightVerticalPadding(20f.dp)
            .setConstraints(Constraints.TopToBottomOfHighlight + Constraints.EndToEndOfHighlight)
            .setMarginOffset(MarginOffset(top = 8.dp))
            .build()
    }
    .setHighlightParameter {
        HighlightParameter.Builder()
            .setHighlightViewId(R.id.btn_step_third)
            .setTipsViewId(R.layout.guide_step_third)
            .setHighlightShape(OvalShape())
            .setHighlightHorizontalPadding(12f.dp)
            .setHighlightVerticalPadding(12f.dp)
            .setConstraints(Constraints.BottomToTopOfHighlight + Constraints.EndToEndOfHighlight)
            .setMarginOffset(MarginOffset(bottom = 6.dp))
            .build()
    }
    .setBackgroundColor("#80000000".toColorInt())
    .setOnShowCallback { index ->
        //do something
    }
    .setOnDismissCallback {
        //do something
    }
    .interceptBackPressed(true)
    .show()

Sometimes we want disable highlight, it can also be a popup window:

HighlightPro.with(this)
    .setHighlightParameter {
        HighlightParameter.Builder()
            .setHighlightViewId(R.id.btn_tips_bottom)
            .setTipsViewId(R.layout.pop_tips_layout_bottom)
            .setConstraints(Constraints.TopToBottomOfHighlight + Constraints.EndToEndOfHighlight)
            .setMarginOffset(MarginOffset(end = (-2).dp))
            .build()
    }
    .enableHighlight(false)//no highlight now is a popup window
    .interceptBackPressed(true)//BackPressed will dismiss the HighligthPro default not intercepted
    .show()

API doc

About HighlightParameter.Builder
Method Description
setHighlightViewId Set id of highlight view
setHighlightView Set the highlight view
setTipsViewId Set id of tips view
setTipsView Set tips view
setHighlightShape Set shape of highlight
setHighlightVerticalPadding Set v-padding of highlight rectangle
setHighlightHorizontalPadding Set h-padding of highlight rectangle
setConstraints Set constraints of tips view
setMarginOffset Set tips view's margin relative highlight rectangle
build To create a HighlightParameter object

Note

  • setHighlightViewId & setHighlightView
  • setTipsViewId & setTipsView

For the above two methods, you only need one. If you don't use any one, this lib will display UI unexpected.

About HighlightShape
HighlightShape Description
RectShape A rectangle highlight shape
CircleShape A circle highlight shape
OvalShape An oval highlight shape

Note

Any shape base on highlight view's rect on screen, we can setHighlightVerticalPadding or setHighlightHorizontalPadding to expand highlight area.

About Constraints

It is the core class which determine the position of tips view. Like Android's ConstraintLayout our all constriants depend on highlight view.

Vertical Constraints Description
TopToTopOfHighlight Align tips view top to top of highlight rect.
TopToBottomOfHighlight Align tips view top to bottom of highlight rect.
BottomToBottomOfHighlight Align tips view bottom to bottom of highlight rect.
BottomToTopOfHighlight Align tips view bottom to top of highlight rect.
Horizontal Constraint Description
StartToStartOfHighlight Align tips view start to start of highlight rect.
StartToEndOfHighlight Align tips view start to end of highlight rect.
EndToEndOfHighlight Align tips view end to end of highlight rect.
EndToStartOfHighlight Align tips view end to start of highlight rect.

Note

Usually we should set a list of constraints that contains one v-constraint and one h-constraint. And we can use plus operator to create a list of constraints:

Constraints.TopToBottomOfHighlight + Constraints.EndToEndOfHighlight

Of course, we can set margin offsets to adjust position by :

setMarginOffset(MarginOffset(start = 8.dp))

End

Above we introduce all usages of HighlightPro , if it helps you , thanks for your star. Or if you have some good advices, welcome commit a pull request. If HighlightPro has some bug in use, you can commit an issue to me, I will reply as soon as.

You might also like...
AlertDialog for Android, a beautiful and material alert dialog to use in your android app.
AlertDialog for Android, a beautiful and material alert dialog to use in your android app.

AlertDialog for Android, a beautiful and material alert dialog to use in your android app. Older verion of this library has been removed

SweetAlert for Android, a beautiful and clever alert dialog
SweetAlert for Android, a beautiful and clever alert dialog

Sweet Alert Dialog SweetAlert for Android, a beautiful and clever alert dialog 中文版 Inspired by JavaScript SweetAlert Demo Download ScreenShot Setup Th

😍 A beautiful, fluid, and extensible dialogs API for Kotlin & Android.
😍 A beautiful, fluid, and extensible dialogs API for Kotlin & Android.

Material Dialogs View Releases and Changelogs Modules The core module is the fundamental module that you need in order to use this library. The others

An easy-to-use Android library that will help you to take screenshots of specif views of your app and save them to external storage (Including API 29 Q+ with Scope Storage)

🇺🇸 English | 🇧🇷 Português (pt-br) 🇺🇸 English: An easy to use Library that will help you to take screenshots 📸 of the views in your app Step 1.

An beautiful and easy to use dialog library for Android
An beautiful and easy to use dialog library for Android

An beautiful and easy to use dialog library for Android

🗣 An overlay that gets your user’s voice permission and input as text in a customizable UI
🗣 An overlay that gets your user’s voice permission and input as text in a customizable UI

Overview Voice overlay helps you turn your user's voice into text, providing a polished UX while handling for you the necessary permission. Demo You c

Sleek dialogs and bottom-sheets for quick use in your app
Sleek dialogs and bottom-sheets for quick use in your app

⭐ ‎‎‎‏‏‎ ‎Offers a range of beautiful sheets (dialogs & bottom sheets) for quick use in your project. Includes many ways to customize sheets.

Advanced dialog solution for android
Advanced dialog solution for android

DialogPlus Simple and advanced dialog solution. Uses normal view as dialog Provides expandable option Multiple positioning Built-in options for easy i

Android AlertDialog with moving dots progress indicator

Spots progress dialog Android AlertDialog with moving spots progress indicator packed as android library. =========== Usage The library available in m

Comments
  • Jcenter is Forbidden

    Jcenter is Forbidden

    Could not resolve com.github.hyy920109:GuidePro:1.1.3. > Could not get resource 'https://dl.bintray.com/umsdk/release/com/github/hyy920109/GuidePro/1.1.3/GuidePro-1.1.3.pom'. > Could not HEAD 'https://dl.bintray.com/umsdk/release/com/github/hyy920109/GuidePro/1.1.3/GuidePro-1.1.3.pom'. Received status code 403 from server: Forbidden

    opened by captain-miao 1
  • 使用NestedScrollView时HighLight位置错误

    使用NestedScrollView时HighLight位置错误

    HighLightPro 开发者您好: 请允许我使用母语来表述这个问题 问题内容: 我刚刚在使用HighLightPro,我为一个在NestedScrollView内的控件设置HighLigh,但是这个控件可能是被遮挡的,因此,我在设置前尝试让NestedScrollView滚动到这个需要设置HighLigh的View底部,接下来我对其设置HighLigh,发现HighLigh在NestedScrollView之前的位置展示了HighLigh,但这不是我想要的。 需要解决的问题: 因为我需要它可以跟随滚动,然后在正确的位置展示这个HighLigh

    opened by 1250422131 0
  • License requirements?

    License requirements?

    Hello, Thanks for publishing the library. I am curious about licensing of this library.

    Is this library free to use under Apache or MIT license agreement? I was unable to find any Licensing.

    Look forward for your reply.

    Thanks

    opened by rr-akshay-dave 1
Releases(v1.2.0)
Owner
heyangyang
heyangyang
[Deprecated] This project can make it easy to theme and custom Android's dialog. Also provides Holo and Material themes for old devices.

Deprecated Please use android.support.v7.app.AlertDialog of support-v7. AlertDialogPro Why AlertDialogPro? Theming Android's AlertDialog is not an eas

Feng Dai 468 Nov 10, 2022
Make a Popup appear long pressing on a view and handle drag-release events on its elements

LongPressPopup You can try the demo app on google play store. https://play.google.com/store/apps/details?id=rm.com.longpresspopupsample Or see the ful

Riccardo Moro 253 Dec 29, 2022
Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Abdullah Alhazmy 73 Nov 29, 2022
An Android Dialog Lib simplify customization.

FlycoDialog-Master 中文版 An Android Dialog Lib simplify customization. Supprot 2.2+. Features [Built-in Dialog, convenient to use](#Built-in Dialog) [Ab

Flyco 2.3k Dec 8, 2022
Alert Dialog - You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment.

We show a warning message (Alert Dialog) to the user in many parts of our applications. You can use this extension instead of creating a separate Alert Dialog for each Activity or Fragment. Thanks to this extension, you can create a Dialog and call it in the Activity or Fragment you want and customize the component you want.

Gökmen Bayram 0 Jan 9, 2022
A simple library for creating animated warnings/dialogs/alerts for Android.

Noty A simple library for creating animated warnings/notifications for Android. Examples Show me code Show me code Show me code Show me code Show me c

Emre 144 Nov 29, 2022
A simple file/ directory picker dialog for android

FileListerDialog FileListerDialog helps you to list and pick file/directory. Library is built for Android Getting Started Installing To use this libra

Yogesh S 446 Jan 7, 2023
An Android library that provides a simple implementation of a DialogFragment

SimpleDialogFragment An Android library that provides a simple implementation of a DialogFragment. Are you tired of creating a new DialogFragment for

Julien Arzul 32 Oct 2, 2020
A simple library to show custom dialog with animation in android

SmartDialog A simple library to show custom dialog in android Step 1. Add the JitPack repository to your build file allprojects { repositories {

claudysoft 9 Aug 18, 2022
Make your native android Dialog Fancy and Gify. A library that takes the standard Android Dialog to the next level with a variety of styling options and Gif's. Style your dialog from code.

FancyGifDialog-Android Prerequisites Add this in your root build.gradle file (not your module build.gradle file): allprojects { repositories { ...

Shashank Singhal 522 Jan 2, 2023