cleaned up background view, removed unused thread

This commit is contained in:
n8fr8 2012-06-28 17:01:24 -04:00
parent ecf3c79b72
commit eb2b7531c9
1 changed files with 8 additions and 33 deletions

View File

@ -13,7 +13,8 @@ import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.View.MeasureSpec; import android.view.View.MeasureSpec;
public class AnimatedBlockView extends View implements Runnable { public class AnimatedBlockView extends View
{
private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
@ -22,14 +23,6 @@ public class AnimatedBlockView extends View implements Runnable {
Random rand = new Random(); Random rand = new Random();
private Handler mHandler = new Handler()
{
public void handleMessage(Message msg) {
invalidate();
}
};
public AnimatedBlockView(Context context) { public AnimatedBlockView(Context context) {
super(context); super(context);
@ -54,15 +47,15 @@ public class AnimatedBlockView extends View implements Runnable {
paint.setColor(Color.WHITE); paint.setColor(Color.WHITE);
paint.setAntiAlias(true); paint.setAntiAlias(true);
new Thread (this).start();
} }
@Override @Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
// TODO Auto-generated method stub super.onMeasure(widthMeasureSpec, heightMeasureSpec);
setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec), setMeasuredDimension(MeasureSpec.getSize(widthMeasureSpec),
MeasureSpec.getSize(heightMeasureSpec)); MeasureSpec.getSize(heightMeasureSpec));
} }
int a1 = 30; int a1 = 30;
@ -71,6 +64,7 @@ public class AnimatedBlockView extends View implements Runnable {
@Override @Override
protected void onDraw(Canvas canvas) { protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
for (int i = 0; i < 20; i++) for (int i = 0; i < 20; i++)
{ {
@ -105,26 +99,6 @@ public class AnimatedBlockView extends View implements Runnable {
} }
public void run ()
{
/*while (true)
{
try
{
Thread.sleep(10);
}
catch (Exception e)
{}
mHandler.sendEmptyMessage(0);
}*/
}
@Override @Override
public boolean onTouchEvent(MotionEvent event) { public boolean onTouchEvent(MotionEvent event) {
@ -155,6 +129,7 @@ public class AnimatedBlockView extends View implements Runnable {
} }
return true; return true;
} }
} }