@Override public void onReceive(Context context, Intent intent) { handleReceivedResult(context, getResultCode(), intent); } };
@Override public void onReceive(Context context, Intent intent) { handleSentResult(getResultCode(), intent); } };
@Override protected void onDestroy() { super.onDestroy(); if (mSentReceiver != null) { unregisterReceiver(mSentReceiver); } if (mReceivedReceiver != null) { unregisterReceiver(mReceivedReceiver); } }
@SmallTest public void testCharacterS() throws Exception { long[] expectedBeeps = { MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT}; long[] beeps = MorseCodeConverter.pattern('s'); assertArraysEqual(expectedBeeps, beeps); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get an instance of the SensorManager mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); // Create our Preview view and set it as the content of our // Activity mRenderer = new MyRenderer(); mGLSurfaceView = new GLSurfaceView(this); mGLSurfaceView.setRenderer(mRenderer); setContentView(mGLSurfaceView); }
public void onClick(View v) { // Get the text out of the view String text = mTextView.getText().toString(); // convert it using the function defined above. See the docs for // android.os.Vibrator for more info about the format of this array long[] pattern = MorseCodeConverter.pattern(text); // Start the vibration Vibrator vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(pattern, -1); } };
private void assertArraysEqual(long[] expected, long[] actual) { assertEquals("Unexpected array length.", expected.length, actual.length); for (int i = 0; i < expected.length; i++) { long expectedLong = expected[i]; long actualLong = actual[i]; assertEquals("Unexpected long at index: " + i, expectedLong, actualLong); } } }
public MyRenderer() { // find the rotation-vector sensor mRotationVectorSensor = mSensorManager.getDefaultSensor( Sensor.TYPE_ROTATION_VECTOR); mCube = new Cube(); // initialize the rotation matrix to identity mRotationMatrix[ 0] = 1; mRotationMatrix[ 4] = 1; mRotationMatrix[ 8] = 1; mRotationMatrix[12] = 1; }
public void onDrawFrame(GL10 gl) { // clear screen gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // set-up modelview matrix gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -3.0f); gl.glMultMatrixf(mRotationMatrix, 0); // draw our object gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); mCube.draw(gl); }
public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); finish(); } })
@SmallTest public void testCharacterS() throws Exception { long[] expectedBeeps = { MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT, MorseCodeConverter.DOT}; long[] beeps = MorseCodeConverter.pattern('s'); assertArraysEqual(expectedBeeps, beeps); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get an instance of the SensorManager mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE); // Create our Preview view and set it as the content of our // Activity mRenderer = new MyRenderer(); mGLSurfaceView = new GLSurfaceView(this); mGLSurfaceView.setRenderer(mRenderer); setContentView(mGLSurfaceView); }
public void onClick(View v) { // Get the text out of the view String text = mTextView.getText().toString(); // convert it using the function defined above. See the docs for // android.os.Vibrator for more info about the format of this array long[] pattern = MorseCodeConverter.pattern(text); // Start the vibration Vibrator vibrator = (Vibrator)getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(pattern, -1); } };
@Override public void onReceive(Context context, Intent intent) { handleReceivedResult(context, getResultCode(), intent); } };
private void assertArraysEqual(long[] expected, long[] actual) { assertEquals("Unexpected array length.", expected.length, actual.length); for (int i = 0; i < expected.length; i++) { long expectedLong = expected[i]; long actualLong = actual[i]; assertEquals("Unexpected long at index: " + i, expectedLong, actualLong); } } }
@Override public void onReceive(Context context, Intent intent) { handleSentResult(getResultCode(), intent); } };
@Override protected void onDestroy() { super.onDestroy(); if (mSentReceiver != null) { unregisterReceiver(mSentReceiver); } if (mReceivedReceiver != null) { unregisterReceiver(mReceivedReceiver); } }
public MyRenderer() { // find the rotation-vector sensor mRotationVectorSensor = mSensorManager.getDefaultSensor( Sensor.TYPE_ROTATION_VECTOR); mCube = new Cube(); // initialize the rotation matrix to identity mRotationMatrix[ 0] = 1; mRotationMatrix[ 4] = 1; mRotationMatrix[ 8] = 1; mRotationMatrix[12] = 1; }
public void onDrawFrame(GL10 gl) { // clear screen gl.glClear(GL10.GL_COLOR_BUFFER_BIT); // set-up modelview matrix gl.glMatrixMode(GL10.GL_MODELVIEW); gl.glLoadIdentity(); gl.glTranslatef(0, 0, -3.0f); gl.glMultMatrixf(mRotationMatrix, 0); // draw our object gl.glEnableClientState(GL10.GL_VERTEX_ARRAY); gl.glEnableClientState(GL10.GL_COLOR_ARRAY); mCube.draw(gl); }
public void onClick(DialogInterface dialog, int whichButton) { dialog.dismiss(); finish(); } })