91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.45M
    文件類型: .rar
    金幣: 1
    下載: 0 次
    發布日期: 2023-06-23
  • 語言: Java
  • 標簽: 點擊??

資源簡介

核心代碼:


public class RevealLayout extends LinearLayout implements Runnable{
    private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    
    private float mCenterX,mCenterY;
    
    private int[] mLocation = new int[2];
    
    private int INVALIDATE_DURATION = 40;
    private int mTargetHeight,mTargetWidth;
    private int mRevealRadius = 0,mRevealRadiusGap,mMaxRadius;
    private int mMinBetweenWidthAndHeight,mMaxBetweenWidthAndHeight;
    
    private boolean mIsPressed;
    private boolean mShouldDoAnimation;
    
    private View mTargetView;
    private DispatchUpTouchEventRunnable mDispatchUpTouchEventRunnable = new DispatchUpTouchEventRunnable();
    
    public RevealLayout(Context context) {
        super(context);
        init();
    }
    
    public RevealLayout(Context context, AttributeSet attrs){
        super(context,attrs);
        init();
    }
    
    @TargetApi(Build.VERSION_CODES.HONEYCOMB)
    public RevealLayout(Context context, AttributeSet attrs, int defStyleAttr){
        super(context,attrs,defStyleAttr);
        init();
    }

    public void init(){
        setWillNotDraw(false);
        mPaint.setColor(getResources().getColor(R.color.reveal_color));
    }
    
    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
        super.onLayout(changed, l, t, r, b);
        this.getLocationOnScreen(mLocation);
    }
    
    @Override
    protected void dispatchDraw(Canvas canvas) {
        super.dispatchDraw(canvas);
        
        if(mTargetView == null || !mShouldDoAnimation || mTargetWidth <= 0)
            return;
        
        if(mRevealRadius > mMinBetweenWidthAndHeight / 2)
            mRevealRadius = mRevealRadiusGap * 4;
        else
            mRevealRadius = mRevealRadiusGap;
        
        int[] location = new int[2];
        this.getLocationOnScreen(mLocation);
        mTargetView.getLocationOnScreen(location);

        int top = location[1] - mLocation[1];
        int left = location[0] - mLocation[0];
        int right = left mTargetView.getMeasuredWidth();
        int bottom = top mTargetView.getMeasuredHeight();
        
        canvas.save();
        canvas.clipRect(left, top, right, bottom);
        canvas.drawCircle(mCenterX, mCenterY, mRevealRadius, mPaint);
        canvas.restore();
        
        if(mRevealRadius <= mMaxRadius)
            postInvalidateDelayed(INVALIDATE_DURATION, left, top, right, bottom);
        else if(!mIsPressed){
            mShouldDoAnimation = false;
            postInvalidateDelayed(INVALIDATE_DURATION, left, top, right, bottom);
        }
    }
    
    @Override
    public boolean dispatchTouchEvent(MotionEvent event) {
        int x = (int)event.getRawX();
        int y = (int)event.getRawY();
        int action = event.getAction();
        
        switch(action){
            case MotionEvent.ACTION_DOWN:
                View targetView = getTargetView(this,x,y);
                
                if(targetView != null && targetView.isEnabled()){
                    mTargetView = targetView;
                    initParametersForChild(event,targetView);
                    postInvalidateDelayed(INVALIDATE_DURATION);
                }
                break;
                
            case MotionEvent.ACTION_UP:
                mIsPressed = false;
                postInvalidateDelayed(INVALIDATE_DURATION);
                mDispatchUpTouchEventRunnable.event = event;
                postDelayed(mDispatchUpTouchEventRunnable, 40);
                break;
                
            case MotionEvent.ACTION_CANCEL:
                mIsPressed = false;
                postInvalidateDelayed(INVALIDATE_DURATION);
                break;
        }        
        return super.dispatchTouchEvent(event);
    }
    
    public View getTargetView(View view,int x,int y){
        View target = null;
        ArrayList<View> views = view.getTouchables();
        
        for(View child : views)
            if(isTouchPointInView(child,x,y)){
                target = child;
                break;
            }
        return target;
    }
    
    public boolean isTouchPointInView(View child,int x,int y){
        int[] location = new int[2];
        child.getLocationOnScreen(location);

        int top = location[1];
        int left = location[0];
        int right = left child.getMeasuredWidth();
        int bottom = top child.getMeasuredHeight();
        
        if(child.isClickable() && y>=top && y<= bottom && x >= left && x<= right)
            return true;
        else
            return false;
    }
    
    public void initParametersForChild(MotionEvent event,View view){
        mCenterX = event.getX();
        mCenterY = event.getY();
        mTargetWidth = view.getMeasuredWidth();
        mTargetHeight = view.getMeasuredHeight();
        mMinBetweenWidthAndHeight = Math.min(mTargetWidth, mTargetHeight);
        mMaxBetweenWidthAndHeight = Math.max(mTargetWidth, mTargetHeight);

        mRevealRadius = 0;
        mRevealRadiusGap = mMinBetweenWidthAndHeight / 8;

        mIsPressed = true;
        mShouldDoAnimation = true;
        
        int[] location = new int[2];
        view.getLocationOnScreen(location);
        
        int left = location[0] - mLocation[0];
        int mTransformedCenterX = (int)mCenterX - left;
        mMaxRadius = Math.max(mTransformedCenterX, mTargetWidth - mTransformedCenterX);
    }
    
    @Override
    public void run() {
        super.performClick();
    }

    @Override
    public boolean performClick() {
        postDelayed(this,40);
        return true;
    }
    private class DispatchUpTouchEventRunnable implements Runnable{
        public MotionEvent event;
        
        @Override
        public void run() {
            if(mTargetView.isEnabled() && mTargetView.isClickable())
                return;
            
            if(isTouchPointInView(mTargetView, (int)event.getRawX(), (int)event.getRawX()))
                mTargetView.performClick();
        }
    }
}

資源截圖

代碼片段和文件信息

/*?AUTO-GENERATED?FILE.??DO?NOT?MODIFY.
?*
?*?This?class?was?automatically?generated?by?the
?*?aapt?tool?from?the?resource?data?it?found.??It
?*?should?not?be?modified?by?hand.
?*/
package?android.support.v7.appcompat;

public?final?class?R?{
public?static?final?class?anim?{
public?static?final?int?abc_fade_in?=?0x7f040000;
public?static?final?int?abc_fade_out?=?0x7f040001;
public?static?final?int?abc_slide_in_bottom?=?0x7f040002;
public?static?final?int?abc_slide_in_top?=?0x7f040003;
public?static?final?int?abc_slide_out_bottom?=?0x7f040004;
public?static?final?int?abc_slide_out_top?=?0x7f040005;
}
public?static?final?class?attr?{
public?static?final?int?actionBarDivider?=?0x7f01000f;
public?static?final?int?actionBarItemBackground?=?0x7f010010;
public?static?final?in

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????475??2015-01-17?08:28??MyRevealLayout\.classpath

?????文件????????850??2015-01-17?08:28??MyRevealLayout\.project

?????文件????????177??2015-01-17?08:28??MyRevealLayout\.settings\org.eclipse.jdt.core.prefs

?????文件????????885??2015-01-17?09:56??MyRevealLayout\AndroidManifest.xml

?????文件????????885??2015-01-17?09:56??MyRevealLayout\bin\AndroidManifest.xml

?????文件????????629??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$anim.class

?????文件???????5136??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$attr.class

?????文件????????763??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$bool.class

?????文件????????594??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$color.class

?????文件???????1530??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$dimen.class

?????文件???????5191??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$drawable.class

?????文件???????2556??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$id.class

?????文件????????445??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$integer.class

?????文件???????1629??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$layout.class

?????文件???????1141??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$string.class

?????文件???????9582??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$style.class

?????文件???????6541??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R$styleable.class

?????文件???????1015??2015-01-18?14:35??MyRevealLayout\bin\classes\android\support\v7\appcompat\R.class

?????文件????????515??2015-01-18?14:35??MyRevealLayout\bin\classes\com\android\chaos\MainActivity.class

?????文件???????1267??2015-01-18?14:35??MyRevealLayout\bin\classes\com\android\chaos\RevealLayout$DispatchUpTouchEventRunnable.class

?????文件???????6035??2015-01-18?14:35??MyRevealLayout\bin\classes\com\android\chaos\RevealLayout.class

?????文件????????361??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\BuildConfig.class

?????文件????????623??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\R$anim.class

?????文件???????5130??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\R$attr.class

?????文件????????757??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\R$bool.class

?????文件????????624??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\R$color.class

?????文件???????1622??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\R$dimen.class

?????文件???????5220??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\R$drawable.class

?????文件???????2650??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\R$id.class

?????文件????????439??2015-01-18?14:35??MyRevealLayout\bin\classes\com\example\myreveallayout\R$integer.class

............此處省略87個文件信息

評論

共有 條評論