Merge "Cleaned up Samples by removing unsed imports and variables. Changed deprecated Config.LOGD to Config.DEBUG Removed unnecessary whitespaces"
This commit is contained in:
@@ -18,15 +18,12 @@ package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
public class AlphaBitmap extends GraphicsActivity {
|
||||
|
||||
|
||||
@@ -18,14 +18,14 @@ package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.drawable.*;
|
||||
import android.view.animation.*;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
|
||||
public class AnimateDrawables extends GraphicsActivity {
|
||||
|
||||
@@ -55,7 +55,8 @@ public class AnimateDrawables extends GraphicsActivity {
|
||||
an.startNow();
|
||||
}
|
||||
|
||||
@Override protected void onDraw(Canvas canvas) {
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.drawColor(Color.WHITE);
|
||||
|
||||
mDrawable.draw(canvas);
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.example.android.apis.graphics;
|
||||
// class is in a sub-package.
|
||||
//import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -18,15 +18,12 @@ package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.drawable.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -48,6 +45,9 @@ public class BitmapDecode extends GraphicsActivity {
|
||||
private Movie mMovie;
|
||||
private long mMovieStart;
|
||||
|
||||
//Set to false to use decodeByteArray
|
||||
private static final boolean DECODE_STREAM = true;
|
||||
|
||||
private static byte[] streamToBytes(InputStream is) {
|
||||
ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
|
||||
byte[] buffer = new byte[1024];
|
||||
@@ -101,7 +101,8 @@ public class BitmapDecode extends GraphicsActivity {
|
||||
mDrawable.setBounds(150, 20, 300, 100);
|
||||
|
||||
is = context.getResources().openRawResource(R.drawable.animated_gif);
|
||||
if (true) {
|
||||
|
||||
if (DECODE_STREAM) {
|
||||
mMovie = Movie.decodeStream(is);
|
||||
} else {
|
||||
byte[] array = streamToBytes(is);
|
||||
@@ -109,7 +110,8 @@ public class BitmapDecode extends GraphicsActivity {
|
||||
}
|
||||
}
|
||||
|
||||
@Override protected void onDraw(Canvas canvas) {
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.drawColor(0xFFCCCCCC);
|
||||
|
||||
Paint p = new Paint();
|
||||
@@ -140,4 +142,3 @@ public class BitmapDecode extends GraphicsActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,14 +16,9 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.drawable.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
@@ -41,7 +36,6 @@ public class BitmapPixels extends GraphicsActivity {
|
||||
private Bitmap mBitmap1;
|
||||
private Bitmap mBitmap2;
|
||||
private Bitmap mBitmap3;
|
||||
private Bitmap mBitmap4;
|
||||
|
||||
// access the red component from a premultiplied color
|
||||
private static int getR32(int c) { return (c >> 0) & 0xFF; }
|
||||
@@ -165,4 +159,3 @@ public class BitmapPixels extends GraphicsActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -23,7 +23,6 @@ import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.drawable.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
public class ColorFilters extends GraphicsActivity {
|
||||
@@ -160,8 +159,6 @@ public class ColorFilters extends GraphicsActivity {
|
||||
|
||||
@Override
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
float x = event.getX();
|
||||
float y = event.getY();
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
break;
|
||||
@@ -181,4 +178,3 @@ public class ColorFilters extends GraphicsActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,9 @@ package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
||||
public class ColorMatrixSample extends GraphicsActivity {
|
||||
@@ -35,9 +33,7 @@ public class ColorMatrixSample extends GraphicsActivity {
|
||||
|
||||
private static class SampleView extends View {
|
||||
private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private ColorMatrix mCM = new ColorMatrix();
|
||||
private Bitmap mBitmap;
|
||||
private float mSaturation;
|
||||
private float mAngle;
|
||||
|
||||
public SampleView(Context context) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Compass extends GraphicsActivity {
|
||||
|
||||
private final SensorEventListener mListener = new SensorEventListener() {
|
||||
public void onSensorChanged(SensorEvent event) {
|
||||
if (Config.LOGD) Log.d(TAG,
|
||||
if (Config.DEBUG) Log.d(TAG,
|
||||
"sensorChanged (" + event.values[0] + ", " + event.values[1] + ", " + event.values[2] + ")");
|
||||
mValues = event.values;
|
||||
if (mView != null) {
|
||||
@@ -62,7 +62,7 @@ public class Compass extends GraphicsActivity {
|
||||
@Override
|
||||
protected void onResume()
|
||||
{
|
||||
if (Config.LOGD) Log.d(TAG, "onResume");
|
||||
if (Config.DEBUG) Log.d(TAG, "onResume");
|
||||
super.onResume();
|
||||
|
||||
mSensorManager.registerListener(mListener, mSensor,
|
||||
@@ -72,7 +72,7 @@ public class Compass extends GraphicsActivity {
|
||||
@Override
|
||||
protected void onStop()
|
||||
{
|
||||
if (Config.LOGD) Log.d(TAG, "onStop");
|
||||
if (Config.DEBUG) Log.d(TAG, "onStop");
|
||||
mSensorManager.unregisterListener(mListener);
|
||||
super.onStop();
|
||||
}
|
||||
@@ -81,7 +81,6 @@ public class Compass extends GraphicsActivity {
|
||||
private Paint mPaint = new Paint();
|
||||
private Path mPath = new Path();
|
||||
private boolean mAnimate;
|
||||
private long mNextTime;
|
||||
|
||||
public SampleView(Context context) {
|
||||
super(context);
|
||||
@@ -118,14 +117,15 @@ public class Compass extends GraphicsActivity {
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
mAnimate = true;
|
||||
if (Config.DEBUG) Log.d(TAG, "onAttachedToWindow. mAnimate=" + mAnimate);
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
mAnimate = false;
|
||||
if (Config.DEBUG) Log.d(TAG, "onDetachedFromWindow. mAnimate=" + mAnimate);
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,9 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
@@ -88,10 +88,10 @@ class Cube
|
||||
|
||||
public void draw(GL10 gl)
|
||||
{
|
||||
gl.glFrontFace(gl.GL_CW);
|
||||
gl.glVertexPointer(3, gl.GL_FIXED, 0, mVertexBuffer);
|
||||
gl.glColorPointer(4, gl.GL_FIXED, 0, mColorBuffer);
|
||||
gl.glDrawElements(gl.GL_TRIANGLES, 36, gl.GL_UNSIGNED_BYTE, mIndexBuffer);
|
||||
gl.glFrontFace(GL10.GL_CW);
|
||||
gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer);
|
||||
gl.glColorPointer(4, GL10.GL_FIXED, 0, mColorBuffer);
|
||||
gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer);
|
||||
}
|
||||
|
||||
private IntBuffer mVertexBuffer;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@ package com.example.android.apis.graphics;
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application;
|
||||
import android.os.Bundle;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Bitmap;
|
||||
@@ -34,8 +33,6 @@ import android.widget.ScrollView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.example.android.apis.graphics;
|
||||
// class is in a sub-package.
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class GradientDrawable1 extends GraphicsActivity {
|
||||
|
||||
@@ -20,9 +20,11 @@ import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
|
||||
class GraphicsActivity extends Activity {
|
||||
// set to true to test Picture
|
||||
private static final boolean TEST_PICTURE = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -30,7 +32,7 @@ class GraphicsActivity extends Activity {
|
||||
|
||||
@Override
|
||||
public void setContentView(View view) {
|
||||
if (false) { // set to true to test Picture
|
||||
if (TEST_PICTURE) {
|
||||
ViewGroup vg = new PictureLayout(this);
|
||||
vg.addView(view);
|
||||
view = vg;
|
||||
@@ -39,4 +41,3 @@ class GraphicsActivity extends Activity {
|
||||
super.setContentView(view);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -16,13 +16,9 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
public class MeasureText extends GraphicsActivity {
|
||||
@@ -114,4 +110,3 @@ public class MeasureText extends GraphicsActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -20,11 +20,9 @@ package com.example.android.apis.graphics;
|
||||
// class is in a sub-package.
|
||||
//import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
||||
public class PathFillTypes extends GraphicsActivity {
|
||||
|
||||
@@ -16,11 +16,9 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.*;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewParent;
|
||||
|
||||
|
||||
public class PictureLayout extends ViewGroup {
|
||||
private final Picture mPicture = new Picture();
|
||||
|
||||
|
||||
@@ -16,13 +16,11 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.PictureDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
@@ -20,7 +20,6 @@ package com.example.android.apis.graphics;
|
||||
// class is in a sub-package.
|
||||
//import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
@@ -73,9 +72,8 @@ public class PolyToPoly extends GraphicsActivity {
|
||||
mFontMetrics = mPaint.getFontMetrics();
|
||||
}
|
||||
|
||||
@Override protected void onDraw(Canvas canvas) {
|
||||
Paint paint = mPaint;
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.drawColor(Color.WHITE);
|
||||
|
||||
canvas.save();
|
||||
@@ -107,4 +105,3 @@ public class PolyToPoly extends GraphicsActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
@@ -91,7 +90,8 @@ public class Regions extends GraphicsActivity {
|
||||
r.right - inset, r.bottom - inset, p);
|
||||
}
|
||||
|
||||
@Override protected void onDraw(Canvas canvas) {
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.drawColor(Color.GRAY);
|
||||
|
||||
canvas.save();
|
||||
|
||||
@@ -16,14 +16,10 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.drawable.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
public class RoundRects extends GraphicsActivity {
|
||||
@@ -112,8 +108,6 @@ public class RoundRects extends GraphicsActivity {
|
||||
setCornerRadii(mDrawable, 0, r, 0, r);
|
||||
mDrawable.draw(canvas);
|
||||
canvas.restore();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
@@ -92,9 +91,8 @@ public class ScaleToFit extends GraphicsActivity {
|
||||
canvas.drawRect(mDstR, mHairPaint);
|
||||
}
|
||||
|
||||
@Override protected void onDraw(Canvas canvas) {
|
||||
Paint paint = mPaint;
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
canvas.drawColor(Color.WHITE);
|
||||
|
||||
canvas.translate(10, 10);
|
||||
@@ -121,4 +119,3 @@ public class ScaleToFit extends GraphicsActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import android.hardware.SensorEventListener;
|
||||
import android.hardware.SensorManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Config;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
public class SensorTest extends GraphicsActivity {
|
||||
@@ -96,7 +97,7 @@ public class SensorTest extends GraphicsActivity {
|
||||
if (show) {
|
||||
// only shows if we think the delta is big enough, in an attempt
|
||||
// to detect "serious" moves left/right or up/down
|
||||
android.util.Log.e(TAG, "sensorChanged " + event.sensor.getName() +
|
||||
Log.e(TAG, "sensorChanged " + event.sensor.getName() +
|
||||
" (" + event.values[0] + ", " + event.values[1] + ", " +
|
||||
event.values[2] + ")" + " diff(" + diff[0] +
|
||||
" " + diff[1] + " " + diff[2] + ")");
|
||||
@@ -114,15 +115,15 @@ public class SensorTest extends GraphicsActivity {
|
||||
if ((gestX || gestY) && !(gestX && gestY)) {
|
||||
if (gestX) {
|
||||
if (x < 0) {
|
||||
android.util.Log.e("test", "<<<<<<<< LEFT <<<<<<<<<<<<");
|
||||
Log.e("test", "<<<<<<<< LEFT <<<<<<<<<<<<");
|
||||
} else {
|
||||
android.util.Log.e("test", ">>>>>>>>> RITE >>>>>>>>>>>");
|
||||
Log.e("test", ">>>>>>>>> RITE >>>>>>>>>>>");
|
||||
}
|
||||
} else {
|
||||
if (y < -2) {
|
||||
android.util.Log.e("test", "<<<<<<<< UP <<<<<<<<<<<<");
|
||||
Log.e("test", "<<<<<<<< UP <<<<<<<<<<<<");
|
||||
} else {
|
||||
android.util.Log.e("test", ">>>>>>>>> DOWN >>>>>>>>>>>");
|
||||
Log.e("test", ">>>>>>>>> DOWN >>>>>>>>>>>");
|
||||
}
|
||||
}
|
||||
mLastGestureTime = now;
|
||||
@@ -141,28 +142,27 @@ public class SensorTest extends GraphicsActivity {
|
||||
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
|
||||
mView = new SampleView(this);
|
||||
setContentView(mView);
|
||||
if (Config.LOGD) android.util.Log.d(TAG, "create " + mSensorManager);
|
||||
if (Config.DEBUG) Log.d(TAG, "create " + mSensorManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mSensorManager.registerListener(mListener, mSensor, SensorManager.SENSOR_DELAY_FASTEST);
|
||||
if (Config.LOGD) android.util.Log.d(TAG, "resume " + mSensorManager);
|
||||
if (Config.DEBUG) Log.d(TAG, "resume " + mSensorManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
mSensorManager.unregisterListener(mListener);
|
||||
super.onStop();
|
||||
if (Config.LOGD) android.util.Log.d(TAG, "stop " + mSensorManager);
|
||||
if (Config.DEBUG) Log.d(TAG, "stop " + mSensorManager);
|
||||
}
|
||||
|
||||
private class SampleView extends View {
|
||||
private Paint mPaint = new Paint();
|
||||
private Path mPath = new Path();
|
||||
private boolean mAnimate;
|
||||
private long mNextTime;
|
||||
|
||||
public SampleView(Context context) {
|
||||
super(context);
|
||||
@@ -200,12 +200,14 @@ public class SensorTest extends GraphicsActivity {
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
mAnimate = true;
|
||||
if (Config.DEBUG) Log.d(TAG, "onAttachedToWindow. mAnimate="+mAnimate);
|
||||
super.onAttachedToWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
mAnimate = false;
|
||||
if (Config.DEBUG) Log.d(TAG, "onAttachedToWindow. mAnimate="+mAnimate);
|
||||
super.onDetachedFromWindow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,16 +16,12 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.ShapeDrawable;
|
||||
import android.graphics.drawable.shapes.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
public class ShapeDrawable1 extends GraphicsActivity {
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
// Need the following import to get access to the app resources, since this
|
||||
// class is in a sub-package.
|
||||
//import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -16,13 +16,9 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
public class TextAlign extends GraphicsActivity {
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.nio.ByteOrder;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.ShortBuffer;
|
||||
|
||||
import javax.microedition.khronos.egl.EGL10;
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
@@ -64,7 +63,7 @@ public class UnicodeChart extends GraphicsActivity {
|
||||
float[] pos = mPos;
|
||||
int index = 0;
|
||||
for (int col = 0; col < 16; col++) {
|
||||
final float x = col * 20 + 10;
|
||||
final float x = col * XMUL + 10;
|
||||
for (int row = 0; row < 16; row++) {
|
||||
pos[index++] = x;
|
||||
pos[index++] = row * YMUL + YBASE;
|
||||
@@ -73,7 +72,7 @@ public class UnicodeChart extends GraphicsActivity {
|
||||
}
|
||||
|
||||
private float computeX(int index) {
|
||||
return (index >> 4) * 20 + 10;
|
||||
return (index >> 4) * XMUL + 10;
|
||||
}
|
||||
|
||||
private float computeY(int index) {
|
||||
@@ -118,4 +117,3 @@ public class UnicodeChart extends GraphicsActivity {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,17 +18,11 @@ package com.example.android.apis.graphics;
|
||||
|
||||
import com.example.android.apis.R;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.graphics.drawable.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class Vertices extends GraphicsActivity {
|
||||
|
||||
@Override
|
||||
@@ -41,7 +35,6 @@ public class Vertices extends GraphicsActivity {
|
||||
private final Paint mPaint = new Paint();
|
||||
private final float[] mVerts = new float[10];
|
||||
private final float[] mTexs = new float[10];
|
||||
private final int[] mColors = new int[10];
|
||||
private final short[] mIndices = { 0, 1, 2, 3, 4, 1 };
|
||||
|
||||
private final Matrix mMatrix = new Matrix();
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.example.android.apis.graphics;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapShader;
|
||||
|
||||
Reference in New Issue
Block a user