Android Open Source - ArchPad C Editable Target View






From Project

Back to project page ArchPad.

License

The source code is released under:

GNU General Public License

If you think the Android project ArchPad 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.Andryyo.ArchPad.target;
//  w ww .ja  v a2 s.co  m
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import com.Andryyo.ArchPad.CShot;
import com.Andryyo.ArchPad.archeryFragment.CArcheryFragment;
import com.Andryyo.ArchPad.archeryFragment.CDistance;
import com.Andryyo.ArchPad.archeryFragment.IOnShotAddListener;

/**
 * Created with IntelliJ IDEA.
 * User: ???????
 * Date: 10.06.13
 * Time: 16:12
 * To change this template use File | Settings | File Templates.
 */

public class CEditableTargetView extends CZoomableTargetView {

    private IOnShotAddListener listener;

    public CEditableTargetView(Context context, CDistance distance) {
        super(context, distance);
    }

    public CEditableTargetView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CEditableTargetView(Context context) {
        super(context);
    }

    public void setOnShotAddListener(IOnShotAddListener listener)   {
        this.listener = listener;
    }

    @Override
    public boolean onTouchEvent(MotionEvent me) {
        super.onTouchEvent(me);
        if (me.getAction()==MotionEvent.ACTION_UP)
        {
            CShot shot = new CShot(getTarget().rings, me.getX() / getCenter() - 1, me.getY() / getCenter() - 1,
                    getArrowRadius());
            getTarget().calcPoints(shot, getArrowRadius());
            listener.addShot(shot);
            cancelDrawSightMark();
            CArcheryFragment.vibrator.vibrate(50);
        }
        if (me.getAction()==MotionEvent.ACTION_MOVE)
        {
            beginDrawSightMark(me.getX(), me.getY());
        }
        return true;
    }

}




Java Source Code List

com.Andryyo.ArchPad.CArrow.java
com.Andryyo.ArchPad.CShot.java
com.Andryyo.ArchPad.MainActivity.java
com.Andryyo.ArchPad.archeryFragment.CArcheryFragment.java
com.Andryyo.ArchPad.archeryFragment.CCurrentEndView.java
com.Andryyo.ArchPad.archeryFragment.CDistanceTemplate.java
com.Andryyo.ArchPad.archeryFragment.CDistance.java
com.Andryyo.ArchPad.archeryFragment.CRoundTemplate.java
com.Andryyo.ArchPad.archeryFragment.CRound.java
com.Andryyo.ArchPad.archeryFragment.IOnShotAddListener.java
com.Andryyo.ArchPad.archeryFragment.?EndsCounterView.java
com.Andryyo.ArchPad.database.CSQLiteOpenHelper.java
com.Andryyo.ArchPad.note.CNoteCreateActivity.java
com.Andryyo.ArchPad.note.CNotesFragment.java
com.Andryyo.ArchPad.sight.CSightSelectFragment.java
com.Andryyo.ArchPad.sight.?SightPropertiesFragment.java
com.Andryyo.ArchPad.start.CArrowSelectView.java
com.Andryyo.ArchPad.start.CColorSelectView.java
com.Andryyo.ArchPad.start.CRoundSelectView.java
com.Andryyo.ArchPad.start.CStartFragment.java
com.Andryyo.ArchPad.start.CTargetSelectView.java
com.Andryyo.ArchPad.start.IOnFragmentSwapRequiredListener.java
com.Andryyo.ArchPad.statistics.CBorderedTextView.java
com.Andryyo.ArchPad.statistics.CRecordViewFragment.java
com.Andryyo.ArchPad.statistics.CStatisticsFragment.java
com.Andryyo.ArchPad.statistics.IOnUpdateListener.java
com.Andryyo.ArchPad.target.CEditableTargetView.java
com.Andryyo.ArchPad.target.CRing.java
com.Andryyo.ArchPad.target.CTargetView.java
com.Andryyo.ArchPad.target.CTarget.java
com.Andryyo.ArchPad.target.CZoomableTargetView.java