use of zhy.com.highlight.shape.BaseLightShape in project Highlight by hongyangAndroid.
the class MainActivity method showNextKnownTipView.
/**
* 显示 next模式 我知道了提示高亮布局
* @param view id为R.id.iv_known的控件
* @author isanwenyu@163.com
*/
public void showNextKnownTipView(View view) {
mHightLight = //
new HighLight(MainActivity.this).autoRemove(//设置背景点击高亮布局自动移除为false 默认为true
false).intercept(//拦截属性默认为true 使下方callback生效
true).enableNext().anchor(//如果是Activity上增加引导层,不需要设置anchor
findViewById(R.id.id_container)).addHighLight(R.id.btn_rightLight, R.layout.info_known, new OnLeftPosCallback(45), new RectLightShape()).addHighLight(R.id.btn_light, R.layout.info_known, new OnRightPosCallback(5), new BaseLightShape(5, 5) {
@Override
protected void resetRectF4Shape(RectF viewPosInfoRectF, float dx, float dy) {
//缩小高亮控件范围
viewPosInfoRectF.inset(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dx, getResources().getDisplayMetrics()), TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dy, getResources().getDisplayMetrics()));
}
@Override
protected void drawShape(Bitmap bitmap, HighLight.ViewPosInfo viewPosInfo) {
//custom your hight light shape 自定义高亮形状
Canvas canvas = new Canvas(bitmap);
Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
paint.setDither(true);
paint.setAntiAlias(true);
paint.setMaskFilter(new BlurMaskFilter(15, BlurMaskFilter.Blur.SOLID));
RectF rectF = viewPosInfo.rectF;
canvas.drawOval(rectF, paint);
}
}).addHighLight(R.id.btn_bottomLight, R.layout.info_known, new OnTopPosCallback(), new CircleLightShape()).addHighLight(view, R.layout.info_known, new OnBottomPosCallback(10), new RectLightShape()).setOnRemoveCallback(new //监听移除回调 intercept为true时生效
HighLightInterface.OnRemoveCallback() {
@Override
public void onRemove() {
Toast.makeText(MainActivity.this, "The HightLight view has been removed", Toast.LENGTH_SHORT).show();
}
}).setOnShowCallback(new //监听显示回调 intercept为true时生效
HighLightInterface.OnShowCallback() {
@Override
public void onShow() {
Toast.makeText(MainActivity.this, "The HightLight view has been shown", Toast.LENGTH_SHORT).show();
}
});
mHightLight.show();
}
Aggregations