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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial