package com.mcxtzhang.github.view; import android.content.Context; import android.content.Intent; import android.graphics.Canvas; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; /** * Created by zhangxutong . * Date: 16/08/27 */ public class CstView extends View { private static final String TAG = "CstView"; public CstView(Context context) { super(context); } public CstView(Context context, AttributeSet attrs) { super(context, attrs); } public CstView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); Intent intent = new Intent(); intent.setFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES); } @Override public void draw(Canvas canvas) { super.draw(canvas); Log.e(TAG, "draw() called with: canvas = [" + canvas + "]"); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); Log.d(TAG, "onMeasure() called with: widthMeasureSpec = [" + widthMeasureSpec + "], heightMeasureSpec = [" + heightMeasureSpec + "]"); } @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); Log.d(TAG, "onLayout() called with: changed = [" + changed + "], left = [" + left + "], top = [" + top + "], right = [" + right + "], bottom = [" + bottom + "]"); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Log.d(TAG, "onDraw() called with: canvas = [" + canvas + "]"); } @Override public boolean onTouchEvent(MotionEvent event) { requestLayout(); return super.onTouchEvent(event); } }