Android Open Source - FindYourWords Win 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

package win;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import com.sara.find_your_words.R;
//ww  w.  j  av a 2 s  .  c  o  m
public class WinView extends View 
{
    private Bitmap star;
    
    private Matrix rotator;

    private int widthView,heightView;
    private int widthStar,heightStar;

   
    public WinView(Context context, AttributeSet attrs) 
    {
        super(context, attrs);
        
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 2;
        
        star=BitmapFactory.decodeResource(getResources(), R.drawable.vortex, options);
        
        widthStar= star.getWidth(); 
        heightStar= star.getHeight();
        
        rotator= new Matrix();
        rotator.preTranslate(widthView/2 - widthStar/2, heightView/2 - heightStar/2);
    }
    
    @Override
    protected void onDraw(Canvas canvas) 
    {
        super.onDraw(canvas);
        
        canvas.drawBitmap(star, rotator, null);
      
        //refresh canvas
        invalidate();
    }
  
    //update position
    public void updatePosition(int degrees)
    {
        Matrix m = new Matrix();
        m.postRotate(degrees, widthStar/2, heightStar/2);
        m.postTranslate(widthView/2 - widthStar/2,  heightView/2 - heightStar/2);

        // Set the current position to the updated rotation
        rotator.set(m);
    }
    
  //record the size of the view
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) 
  {
      widthView=MeasureSpec.getSize(widthMeasureSpec);
      heightView=MeasureSpec.getSize(heightMeasureSpec);
      setMeasuredDimension(widthView,heightView);
  }
  
  @Override
  public boolean onTouchEvent (MotionEvent event)
  {  
    switch(event.getAction()) 
    {
      case(MotionEvent.ACTION_DOWN):
        DialogWin.thread.stopIt();
        DialogWin.istance.getDialog().cancel();
        return true;
     }
    return false;
  }
}




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