예제 #1
0
  /* (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;
  }
예제 #2
0
  @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());
  }
예제 #3
0
  /*
   * 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();
  }
예제 #4
0
  @Override
  public void onSaveInstanceState(Bundle outState) {

    // Save values from most recent bundle (ie. most recent message)
    outState.putAll(getIntent().getExtras());

    super.onSaveInstanceState(outState);
  }
예제 #5
0
  @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);
  }
예제 #6
0
  @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);
  }
예제 #7
0
 @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;
   }
 }
예제 #8
0
  /** 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);
  }
예제 #9
0
  @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);
  }
예제 #10
0
  @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();
  }
예제 #11
0
 /*
  * 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);
 }
예제 #12
0
 @Override
 protected void onDestroy() {
   MainDonateEvent.instance().setButton(null, null, null);
   ManagePreferences.releasePermissionManager(permMgr);
   super.onDestroy();
 }
예제 #13
0
 @Override
 protected void onStop() {
   super.onStop();
   if (Log.DEBUG) Log.v("SMSPopupActivity: onStop()");
   if (wasVisible) ManageKeyguard.reenableKeyguard();
 }
예제 #14
0
 @Override
 protected void onStart() {
   super.onStart();
   if (Log.DEBUG) Log.v("SMSPopupActivity: onStart()");
   // ManageWakeLock.acquirePartial(getApplicationContext());
 }