Android Open Source - ArchPad C Current End 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.archeryFragment;
/* w w  w  .  j a  v a 2 s . c  o  m*/
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
import com.Andryyo.ArchPad.CShot;

import java.util.Vector;

/**
 * Created with IntelliJ IDEA.
 * User: ???????
 * Date: 23.04.13
 * Time: 23:38
 * To change this template use File | Settings | File Templates.
 */

public class CCurrentEndView extends View {
    CDistance distance;
    int textHeight;
    int textWidth;
    int screenWidth;
    CArcheryFragment mArcheryView;
    Paint paint = new Paint();

    public CCurrentEndView(Context context, CArcheryFragment mArcheryView)   {
        super(context);
        this.mArcheryView = mArcheryView;
        paint.setColor(Color.WHITE);
    }

    @Override
    public void onSizeChanged(int w, int h, int oldw, int oldh) {
        paint.setTextAlign(Paint.Align.LEFT);
        textHeight = h*8/10;
        paint.setTextSize(textHeight);
        screenWidth = w;
    }

    @Override
    public void onDraw(Canvas canvas)   {
        int i=0;
        distance = mArcheryView.getCurrentDistance();
        textWidth = screenWidth/(distance.arrowsInEnd +1);
        Vector<CShot> buf;
        if ((distance.ends.lastElement().isEmpty())&&(distance.ends.size()>1))
            buf = distance.ends.get(distance.ends.size()-2);
        else
            buf = distance.ends.lastElement();
        for (CShot shot : buf)
        {
            canvas.drawText(shot.toString(), i*textWidth+textWidth/2, textHeight, paint);
            i++;
        }
    }
}




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