/* (non-Javadoc) * @see android.app.Activity#onCreateOptionsMenu(android.view.Menu) */ @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); if (optManager != null) optManager.createMenu(menu, true); return true; }
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); ManagePreferences.setPermissionManager(permMgr); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.popup); getWindow() .addFlags( WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); resizeLayout(); // Find the main textviews fromImage = (ImageView) findViewById(R.id.FromImageView); fromTV = (TextView) findViewById(R.id.FromTextView); messageTV = (TextView) findViewById(R.id.MessageTextView); messageTV.setAutoLinkMask(Linkify.WEB_URLS); messageReceivedTV = (TextView) findViewById(R.id.HeaderTextView); // Enable long-press context menu mainLL = (LinearLayout) findViewById(R.id.MainLinearLayout); registerForContextMenu(mainLL); // We can't hook the current donations status here because it may change // from msg to message. donateStatusBtn = (Button) findViewById(R.id.donate_status_button); // Populate display fields populateViews(getIntent()); }
/* * Handle results of Dontation status menu */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // If Cadpage is still restricted, close activity if (!DonationManager.instance().isEnabled()) finish(); }
@Override public void onSaveInstanceState(Bundle outState) { // Save values from most recent bundle (ie. most recent message) outState.putAll(getIntent().getExtras()); super.onSaveInstanceState(outState); }
@Override protected void onResume() { super.onResume(); if (Log.DEBUG) Log.v("SMSPopupActivity: onResume()"); wasVisible = false; // Supposed to workaround Android 4 problem // setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR); }
@Override protected void onSaveInstanceState(Bundle outState) { outState.putString("WORKAROUND_FOR_BUG_19917_KEY", "WORKAROUND_FOR_BUG_19917_VALUE"); super.onSaveInstanceState(outState); int orientation = Safe40Activity.getDisplayOrientation(this); // Lock the screen orientation to the current display orientation : Landscape or Portrait this.setRequestedOrientation(orientation); }
@Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); // Log.v("SMSPopupActivity: onWindowFocusChanged(" + hasFocus + ")"); if (hasFocus) { // This is really hacky, basically a flag that is set if the message // was at some point visible. I tried using onResume() or other methods // to prevent doing some things 2 times but this seemed to be the only // reliable way (?) wasVisible = true; } }
/** Back key pressed */ @Override public void onBackPressed() { // Suppress back activity if response button menu is visible if (ManageNotification.isActiveNotice()) return; // Otherwise carry on with back function super.onBackPressed(); // Clear any active notification and wake locks ClearAllReceiver.clearAll(this); // Flag message acknowledgment message.acknowledge(this); }
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // First things first, acquire wakelock, otherwise the phone may sleep // ManageWakeLock.acquirePartial(getApplicationContext()); setIntent(intent); // Force a reload of the contact photo // contactPhoto = null; // Re-populate views with new intent data (ie. new sms data) populateViews(intent); }
@Override protected void onPause() { super.onPause(); if (Log.DEBUG) Log.v("SMSPopupActivity: onPause()"); // // Shutdown eyes-free TTS // if (eyesFreeTts != null) { // eyesFreeTts.shutdown(); // } // // // Shutdown Android TTS // if (androidTextToSpeechAvailable) { // if (androidTts != null) { // androidTts.shutdown(); // } // } // Dismiss loading dialog if (mProgressDialog != null) { mProgressDialog.dismiss(); } if (wasVisible) ManageKeyguard.reenableKeyguard(); }
/* * Create Context Menu (Long-press menu) */ @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); optManager.createMenu(menu, true); }
@Override protected void onDestroy() { MainDonateEvent.instance().setButton(null, null, null); ManagePreferences.releasePermissionManager(permMgr); super.onDestroy(); }
@Override protected void onStop() { super.onStop(); if (Log.DEBUG) Log.v("SMSPopupActivity: onStop()"); if (wasVisible) ManageKeyguard.reenableKeyguard(); }
@Override protected void onStart() { super.onStart(); if (Log.DEBUG) Log.v("SMSPopupActivity: onStart()"); // ManageWakeLock.acquirePartial(getApplicationContext()); }