Android Open Source - TheFirstMyth02 Irregular Button






From Project

Back to project page TheFirstMyth02.

License

The source code is released under:

MIT License

If you think the Android project TheFirstMyth02 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.game.commen;
// w  w  w .j  av  a2  s.  co  m
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.Button;

public class IrregularButton extends Button  
{  
    public interface TouchChecker  
    {  
        boolean isInTouchArea(int x, int y, int width, int height);  
    }  
      
      
    private TouchChecker touchChecker;  
      
    public IrregularButton(Context context)  
    {  
        super(context);  
          
        init();  
    }  
    public IrregularButton(Context context, AttributeSet attrs)  
    {  
        super(context, attrs);  
          
        init();  
    }  
    public IrregularButton(Context context, AttributeSet attrs, int defStyle)  
    {  
        super(context, attrs, defStyle);  
          
        init();  
    }  
  
    private void init()  
    {  
    }  
      
    public void setTouchChecker(TouchChecker touchChecker)  
    {  
        this.touchChecker = touchChecker;  
    }  
      
    @Override  
    public boolean onTouchEvent(MotionEvent event)  
    {  
        if (touchChecker != null)  
        {  
            if (event.getAction() == MotionEvent.ACTION_DOWN)   
            {  
                if (touchChecker.isInTouchArea((int) event.getX(), (int) event.getY(), getWidth(), getHeight()))  
                {  
                    return super.onTouchEvent(event);  
                }  
                else  
                {  
                    return false;  
                }  
            }  
        }  
          
        return super.onTouchEvent(event);  
    }  
      
      
}




Java Source Code List

.Test.java
com.game.base.BaseInfo.java
com.game.base.GameBackGround.java
com.game.base.GameChapterBaseSet_Shentan.java
com.game.base.GameMap.java
com.game.base.PubSet.java
com.game.commen.AStarMap.java
com.game.commen.AStarNode.java
com.game.commen.AStar.java
com.game.commen.ActionToDo.java
com.game.commen.BitmapTouchChecker.java
com.game.commen.BitmapUtil.java
com.game.commen.Direction.java
com.game.commen.EffectName.java
com.game.commen.GameXmlcommen.java
com.game.commen.GetImgCommen.java
com.game.commen.IrregularButton.java
com.game.commen.MapName.java
com.game.commen.Paintforziti.java
com.game.commen.ToDo.java
com.game.data.BaseInfo.java
com.game.data.RoleData_Main.java
com.game.data.RoleData.java
com.game.data.StroyTipData.java
com.game.effect.SpecialEffect.java
com.game.fengshen.GameActivity.java
com.game.fengshen.GameMainActivity.java
com.game.fengshen.GameView.java
com.game.fengshen.MoveTest.java
com.game.renwu.Objs.java
com.game.renwu.SpiritMain.java
com.game.renwu.Spirit_Main.java
com.game.renwu.Spirit_NPC.java
com.game.renwu.Spirit.java
com.game.renwu.Spiritgirl.java
com.game.stroy.MainStroy.java
com.game.tip.PublicTips.java