Search in sources :

Example 1 with HightLightView

use of zhy.com.highlight.view.HightLightView in project Highlight by hongyangAndroid.

the class HighLight method show.

@Override
public void show() {
    if (isShowing() && getHightLightView() != null) {
        mHightLightView = getHightLightView();
        return;
    } else {
        //如果View rect 容器为空 直接返回 added by isanwenyu 2016/10/26.
        if (mViewRects.isEmpty())
            return;
        HightLightView hightLightView = new HightLightView(mContext, this, maskColor, mViewRects, next);
        //add high light view unique id by isanwenyu@163.com  on 2016/9/28.
        hightLightView.setId(R.id.high_light_view);
        //compatible with AutoFrameLayout ect.
        if (mAnchor instanceof FrameLayout) {
            ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            ((ViewGroup) mAnchor).addView(hightLightView, ((ViewGroup) mAnchor).getChildCount(), lp);
        } else {
            FrameLayout frameLayout = new FrameLayout(mContext);
            ViewGroup parent = (ViewGroup) mAnchor.getParent();
            parent.removeView(mAnchor);
            parent.addView(frameLayout, mAnchor.getLayoutParams());
            ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
            frameLayout.addView(mAnchor, lp);
            frameLayout.addView(hightLightView);
        }
        if (intercept) {
            hightLightView.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {
                    //added autoRemove by isanwenyu@163.com
                    if (autoRemove)
                        remove();
                    sendClickMessage();
                }
            });
            //如果拦截才响应显示回调
            sendShowMessage();
        }
        mHightLightView = hightLightView;
        mShowing = true;
    }
}
Also used : HightLightView(zhy.com.highlight.view.HightLightView) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) HightLightView(zhy.com.highlight.view.HightLightView) View(android.view.View)

Aggregations

View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 FrameLayout (android.widget.FrameLayout)1 HightLightView (zhy.com.highlight.view.HightLightView)1