@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.shape_drawable_1); } }
@Override protected void onPause() { super.onPause(); // Make sure to never run the fading pulse while we are paused or // stopped. stopFading(); }
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); return true; }
@Override protected void onResume() { super.onResume(); mSensorManager.registerListener(mListener, mSensor, SensorManager.SENSOR_DELAY_FASTEST); if (false) Log.d(TAG, "resume " + mSensorManager); }
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, CLEAR_ID, 0, "Clear"); menu.add(0, FADE_ID, 0, "Fade").setCheckable(true); return super.onCreateOptionsMenu(menu); }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case CLEAR_ID: mView.clear(); return true; case FADE_ID: mFading = !mFading; if (mFading) { startFading(); } else { stopFading(); } return true; default: return super.onOptionsItemSelected(item); } }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Save away the fading state to restore if needed later. Note that // we do not currently save the contents of the display. outState.putBoolean("fading", mFading); outState.putInt("color", mView.mColorIndex); }
@Override protected void onStop() { if (false) Log.d(TAG, "onStop"); mSensorManager.unregisterListener(mListener); super.onStop(); }
@Override protected void onResume() { if (false) Log.d(TAG, "onResume"); super.onResume(); mSensorManager.registerListener(mListener, mSensor, SensorManager.SENSOR_DELAY_GAME); }
@Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(0, CLEAR_ID, 0, "Clear"); menu.add(0, FADE_ID, 0, "Fade").setCheckable(true); return super.onCreateOptionsMenu(menu); }
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case CLEAR_ID: mView.clear(); return true; case FADE_ID: mFading = !mFading; if (mFading) { startFading(); } else { stopFading(); } return true; default: return super.onOptionsItemSelected(item); } }
@Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); // Save away the fading state to restore if needed later. Note that // we do not currently save the contents of the display. outState.putBoolean("fading", mFading); outState.putInt("color", mView.mColorIndex); }
@Override protected void onStop() { mSensorManager.unregisterListener(mListener); super.onStop(); if (false) Log.d(TAG, "stop " + mSensorManager); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.shape_drawable_1); } }
@Override protected void onResume() { if (false) Log.d(TAG, "onResume"); super.onResume(); mSensorManager.registerListener(mListener, mSensor, SensorManager.SENSOR_DELAY_GAME); }
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); return true; }
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); menu.add(0, COLOR_MENU_ID, 0, "Color").setShortcut('3', 'c'); menu.add(0, EMBOSS_MENU_ID, 0, "Emboss").setShortcut('4', 's'); menu.add(0, BLUR_MENU_ID, 0, "Blur").setShortcut('5', 'z'); menu.add(0, ERASE_MENU_ID, 0, "Erase").setShortcut('5', 'z'); menu.add(0, SRCATOP_MENU_ID, 0, "SrcATop").setShortcut('5', 'z'); /**** Is this the mechanism to extend with filter effects? Intent intent = new Intent(null, getIntent().getData()); intent.addCategory(Intent.CATEGORY_ALTERNATIVE); menu.addIntentOptions( Menu.ALTERNATIVE, 0, new ComponentName(this, NotesList.class), null, intent, 0, null); *****/ return true; }
return true; return super.onOptionsItemSelected(item);
@Override protected void onPause() { super.onPause(); // Make sure to never run the fading pulse while we are paused or // stopped. stopFading(); }
@Override protected void onStop() { mSensorManager.unregisterListener(mListener); super.onStop(); if (false) Log.d(TAG, "stop " + mSensorManager); }