• Stars
    star
    298
  • Rank 139,663 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

💡A highlight & guide library for android.

Lighter

Download Api reqeust Apache License 2.0 Blog 996.icu

中文

Support use in:

  • Android native layout(Such as RelativeLayout, FragmentLayout)
  • RecyclerView & ListView & GridView & ScrollView
  • ViewPager
  • Dialog
  • Fragment

Features:

  • One or more highlighted views can be displayed at one time
  • Customizing the paint for highlighting the view
  • Customize the shape of the highlighted view and the size of the shape
  • Customized tip view display animation
  • Custom relative position of the tip view
  • Chained display code, simple to use

Screenshots

Lighter


Lighter


Lighter


Lighter


Lighter


Usage

Gradle

Add it in your app build.gradle at the end of repositories:

dependencies {
    implementation 'me.samlss:lighter:1.0.3'
}

Maven

<dependency>
  <groupId>me.samlss</groupId>
  <artifactId>lighter</artifactId>
  <version>1.0.3</version>
  <type>pom</type>
</dependency>

Code

You can specify that the highlighted root view is attached to the activity or viewgroup,

you can use the below code to specify:

Lighter with(Activity activity) //will use activity.getWindow().getDecorView as the root view, so it will display in full screen 
    
Lighter with(ViewGroup rootView) //will use the 'rootView' as the root view

Complete call:

 Lighter.with(activity)
                .addHighlight(new LighterParameter.Builder()
                                .setHighlightedViewId(R.id.vp_btn_1)
                                .setTipLayoutId(R.layout.layout_tip_1)
                                .setLighterShape(new RectShape(5, 5, 30))
                                .setTipViewRelativeDirection(Direction.BOTTOM)
                                .setTipViewRelativeOffset(new MarginOffset(150, 0, 30, 0))
                                .build())
                .addHighlight(new LighterParameter.Builder()
                        .setHighlightedViewId(R.id.vp_btn_2)
                        .setTipLayoutId(R.layout.layout_tip_2)
                        .setLighterShape(new RectShape(5, 5, 30))
                        .setTipViewRelativeDirection(Direction.TOP)
                        .setTipViewRelativeOffset(new MarginOffset(-400, 0, 0, 30))
                        .build())
                .show();

When you need to display multiple highlight views at once, call addHighlight(LighterParameter...lighterParameters)

Lighter.with(activity)
                .addHighlight(
                        //Show two at a time
                        new LighterParameter.Builder()
                                .setHighlightedViewId(R.id.vp_btn_1)
                                .setTipLayoutId(R.layout.layout_tip_1)
                                .setLighterShape(new RectShape(5, 5, 30))
                                .setTipViewRelativeDirection(Direction.BOTTOM)
                                .setTipViewRelativeOffset(new MarginOffset(150, 0, 30, 0))
                                .build(),

                        new LighterParameter.Builder()
                                .setHighlightedViewId(R.id.vp_btn_2)
                                .setTipLayoutId(R.layout.layout_tip_2)
                                .setLighterShape(new RectShape(5, 5, 30))
                                .setTipViewRelativeDirection(Direction.TOP)
                                .setTipViewRelativeOffset(new MarginOffset(-400, 0, 0, 30))
                                .build())
                .show();

About LighterParameter.Builder

Method Description
setHighlightedViewId Set id the highlighted view
setHighlightedView Set the highlighted view
setTipLayoutId Set the layout id of the tip layout
setTipView Set the tip view
setLighterShape Set the shape of the wrapped highlight view
setShapeXOffset Set the x-axis offset of the shape rect
setShapeYOffset Set the y-axis offset of the shape rect
setTipViewRelativeDirection Set the direction of the tip view relative to the highlighted view
setTipViewRelativeOffset Set the offset of the tip view's margin relative to the highlighted view
setTipViewDisplayAnimation Set animation of the tip view when display
build To create a LighterParameter object
Note:
  • setHighlightedViewId & setHighlightedView
  • setTipLayoutId & setTipView

For the above two methods, you only need to use one. If you don't use it, an exception will be throwing.

About Shape

Shape Description
Rect A rectangular shape with rounded corners and blur radius
Circle A circle shape with blur radius
Oval A oval shape with blur radius
ShapeXOffset & ShapeYOffset

Refer to the below picture :

Lighter

About parameter of TipView

Direction

Refer to the below picture :

Lighter

Offset

When you specify a direction(the default is left), the offset distance will be based on the direction you specify.

E.g:

Left: The values of topMargin & rightMargin will take effect

Right: The values of topMargin & leftMargin will take effect

Top: If the highlighted view is on the left side of the screen, the values of leftMargin & bottomMargin will take effect. Otherwise, the values of rightMargin & bottomMargin will take effect.

Bottom: If the highlighted view is on the left side of the screen, the values of leftMargin & topMargin will take effect. Otherwise, the values of rightMargin & topMargin will take effect.

Animation

You can set any animation for the tip view.

License

Copyright 2018 samlss

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.

More Repositories

1

Broccoli

📟An Android library that shows the placeholder of the view.
Java
1,757
star
2

FunnyViews

💘A lot of funny & custom views for android, will continue to update.
296
star
3

ClockView

⏰A lovely clock view.
Java
264
star
4

TimoMenu

📋A pop-up menu for android that supports multi-row scrollable submenus.
Java
254
star
5

Bloom

🎉An android library that display bloom effect for view.
Java
134
star
6

RainyView

☔A rainy rainy rainy view.
Java
109
star
7

DiceLoadingView

🎲A dice 3D rotation loading view.
Java
97
star
8

LovelyView

🔗A view that combines pictures and texts.(一个组合图片和文本的view).
Java
68
star
9

XAnimator

🐣An animation framework(一个动画框架).
Java
54
star
10

Oops

😥A library for android that help to show the layout of loading, error, empty etc.
Java
49
star
11

ActivityManager

两种方法管理应用内Activity
Java
22
star
12

CubeLoadingView

📦A cube 3D rotation loading view.
Java
18
star
13

Summary

✍Personal summary.
17
star
14

Bling

🐧A shapes fall effect library for android
Java
17
star
15

ChargingView

🔋A simple charging view.
Java
14
star
16

KeyStore

Android 密钥库系统 keystore 操作demo
Java
13
star
17

SearchPage

模仿今日头条搜索页
Java
13
star
18

PowerView

🔋A pretty charging view.
Java
12
star
19

CoffeeView

🍵A cup of coffee loading view.
Java
11
star
20

CircleProgressView

⭕A circle progress view.
Java
11
star
21

DayNightLoadingView

🌜☀🌝A loading view that switches between day and night.
Java
10
star
22

BallsLoadingView

⚽A loading view that includes four balls for animating.
Java
9
star
23

CrashLog

安卓Crash日志收集器
Java
8
star
24

Security

Android加密算法归纳
Java
8
star
25

Bubble

🎈To display a pretty bubble when touch in android.
Java
8
star
26

ClockLoadingView

🕞A clock loading view.
Java
7
star
27

BarChartLoadingView

📊A bar chart loading view that you can specify the number of bars.
Java
6
star
28

JumboLoadingView

🐥A loading(progress) view that you can select different shapes.
Java
6
star
29

IntertwineLoadingView

➰A two intertwined balls loading view.
Java
6
star
30

FlaskView

🍼A flask loading view.
Java
5
star
31

SignalLoadingView

📶A signal rotation loading view.
Java
5
star
32

PathMeasure

Android Path系列之PathMeasure+Loading效果+小车跑道移动效果
Java
5
star
33

PeasLoadingView

⭕A peas rotation loading view.
Java
5
star
34

PacmanLoadingView

👄A pacman loading view.
Java
4
star
35

Bezier

Android 自定义View系列之贝塞尔曲线+QQ未读消息拖拽效果实现+水波浪充电效果
Java
4
star
36

Paint

Android Paint 实现滤镜效果
Java
4
star
37

PinBallLoadingView

🎈A pin ball loading view.
Java
3
star
38

PaintShader

Android Paint系列基础+着色器渲染器(实现霓虹灯文字+实现圆形头像+放大镜+倒影+雷达扫描效果)
Java
3
star
39

DonutProgressView

⭕A progress view that you can use it when you are loading picture.
Java
3
star
40

FanLoadingView

🌀A fan rotation loading view(一个风扇旋转的loading view).
Java
2
star
41

PaintXfermode

Android Paint系列之Xfermode + 刮刮卡效果实现
Java
1
star
42

WhirlLoadingView

🍩A loading view that includes two rotating arcs.
Java
1
star