Search in sources :

Example 1 with BaseLightShape

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();
}
Also used : HighLight(zhy.com.highlight.HighLight) OnLeftPosCallback(zhy.com.highlight.position.OnLeftPosCallback) Canvas(android.graphics.Canvas) CircleLightShape(zhy.com.highlight.shape.CircleLightShape) HighLightInterface(zhy.com.highlight.interfaces.HighLightInterface) RectLightShape(zhy.com.highlight.shape.RectLightShape) Paint(android.graphics.Paint) BaseLightShape(zhy.com.highlight.shape.BaseLightShape) OnRightPosCallback(zhy.com.highlight.position.OnRightPosCallback) RectF(android.graphics.RectF) Bitmap(android.graphics.Bitmap) BlurMaskFilter(android.graphics.BlurMaskFilter) OnTopPosCallback(zhy.com.highlight.position.OnTopPosCallback) OnBottomPosCallback(zhy.com.highlight.position.OnBottomPosCallback)

Aggregations

Bitmap (android.graphics.Bitmap)1 BlurMaskFilter (android.graphics.BlurMaskFilter)1 Canvas (android.graphics.Canvas)1 Paint (android.graphics.Paint)1 RectF (android.graphics.RectF)1 HighLight (zhy.com.highlight.HighLight)1 HighLightInterface (zhy.com.highlight.interfaces.HighLightInterface)1 OnBottomPosCallback (zhy.com.highlight.position.OnBottomPosCallback)1 OnLeftPosCallback (zhy.com.highlight.position.OnLeftPosCallback)1 OnRightPosCallback (zhy.com.highlight.position.OnRightPosCallback)1 OnTopPosCallback (zhy.com.highlight.position.OnTopPosCallback)1 BaseLightShape (zhy.com.highlight.shape.BaseLightShape)1 CircleLightShape (zhy.com.highlight.shape.CircleLightShape)1 RectLightShape (zhy.com.highlight.shape.RectLightShape)1