Android Open Source - FindYourWords Letter View






From Project

Back to project page FindYourWords.

License

The source code is released under:

Apache License

If you think the Android project FindYourWords 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

/**
 * The class LetterView creates and manages a view to show the letters
 *  //from  www .ja va 2  s  .  co  m
 * @author Sara Craba
 * @version 1.0
 */
package grid;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;

public class LetterView extends View
{
  private Paint letterPaint = new Paint(Paint.SUBPIXEL_TEXT_FLAG |Paint.ANTI_ALIAS_FLAG);

  /**
   * Constructor.
   * @see View class on Android
   */
  public LetterView(Context context) 
  {
    super(context);
    
    letterPaint.setTextSize(GridManager.CELL_TEXT_SIZE);
    letterPaint.setColor(GridManager.CELL_TEXT_COLOR);
    letterPaint.setTypeface(Typeface.createFromAsset(getContext().getAssets(),"jennifer.ttf"));
  }
     
  /**
   * Constructor.
   * @see View class on Android
   */
  public LetterView(Context context, AttributeSet attrs) 
  {
    super( context, attrs );
  }
   
  /**
   * Constructor.
   * @see View class on Android
   */
  public LetterView(Context context, AttributeSet attrs, int defStyle) 
  {
    super( context, attrs, defStyle );
  }

  /**
   * Drawer: draw all letters into the grid.
   * @see onDraw() in View class on Android
   */
  @Override
  protected void onDraw(Canvas canvas) 
  {
    // draw background
    super.onDraw(canvas);
  
    // draw letters
    for(int yPosition=0; yPosition<GridManager.GRID_Y_DIMENSION; yPosition++)
    {
      for(int xPosition=0; xPosition<GridManager.GRID_X_DIMENSION; xPosition++)
      {
        canvas.drawText(Character.toString( GridManager.mCells[yPosition][xPosition].getLetter()), 
          (GridManager.mCells[yPosition][xPosition].getCenterX()- GridManager.CELL_TEXT_SIZE/4), 
          (GridManager.mCells[yPosition][xPosition].getCenterY()+ GridManager.CELL_TEXT_SIZE/4), 
                                              letterPaint);
      }
    }
    Log.i("LetterView", "letters drawed");
  }
  
  /**
   * @see onLayout() in View class on Android
   */
  @Override
  public void onLayout(boolean changed, int left, int top, int right, int bottom) 
  {  
    super.onLayout(changed, left, top, right, bottom);
  }  
}




Java Source Code List

com.ipaulpro.afilechooser.FileChooserActivity.java
com.ipaulpro.afilechooser.FileListAdapter.java
com.ipaulpro.afilechooser.FileListFragment.java
com.ipaulpro.afilechooser.FileLoader.java
com.ipaulpro.afilechooser.utils.FileUtils.java
com.ipaulpro.afilechooser.utils.MimeTypeParser.java
com.ipaulpro.afilechooser.utils.MimeTypes.java
dialog.DialogCredits.java
dialog.DialogInfoMain.java
dialog.DialogInfo.java
dialog.DialogSaveFile.java
grid.CaptureWord.java
grid.Cell.java
grid.GridManager.java
grid.LetterView.java
grid.LineDrawView.java
grid.Positions.java
grid.RelativeLayoutView.java
mainClasses.MainActivity.java
mainClasses.SetWords.java
win.DialogWinThread.java
win.DialogWin.java
win.WinView.java
word.CompareStringList.java
word.OneWord.java