mobile/android/base/fxa/activities/FxAccountVerifiedAccountActivity.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 package org.mozilla.gecko.fxa.activities;
     7 import org.mozilla.gecko.R;
     8 import org.mozilla.gecko.background.common.log.Logger;
     9 import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount;
    10 import org.mozilla.gecko.fxa.login.State;
    11 import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
    13 import android.os.Bundle;
    14 import android.view.View;
    15 import android.view.View.OnClickListener;
    17 /**
    18  * Activity which displays "Account verified" success screen.
    19  */
    20 public class FxAccountVerifiedAccountActivity extends FxAccountAbstractActivity {
    21   private static final String LOG_TAG = FxAccountVerifiedAccountActivity.class.getSimpleName();
    23   protected AndroidFxAccount fxAccount;
    25   public FxAccountVerifiedAccountActivity() {
    26     super(CANNOT_RESUME_WHEN_NO_ACCOUNTS_EXIST);
    27   }
    29   /**
    30    * {@inheritDoc}
    31    */
    32   @Override
    33   public void onCreate(Bundle icicle) {
    34     Logger.debug(LOG_TAG, "onCreate(" + icicle + ")");
    36     super.onCreate(icicle);
    37     setContentView(R.layout.fxaccount_account_verified);
    38   }
    40   @Override
    41   public void onResume() {
    42     super.onResume();
    43     this.fxAccount = getAndroidFxAccount();
    44     if (fxAccount == null) {
    45       Logger.warn(LOG_TAG, "Could not get Firefox Account.");
    46       setResult(RESULT_CANCELED);
    47       finish();
    48       return;
    49     }
    50     State state = fxAccount.getState();
    51     if (!state.verified) {
    52       Logger.warn(LOG_TAG, "Firefox Account is not verified; not displaying verified account activity.");
    53       setResult(RESULT_CANCELED);
    54       finish();
    55       return;
    56     }
    58     View backToBrowsingButton = ensureFindViewById(null, R.id.button, "back to browsing button");
    59     backToBrowsingButton.setOnClickListener(new OnClickListener() {
    60       @Override
    61       public void onClick(View v) {
    62         ActivityUtils.openURLInFennec(v.getContext(), null);
    63       }
    64     });
    65   }
    66 }

mercurial