michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: package org.mozilla.gecko.fxa.activities; michael@0: michael@0: import org.mozilla.gecko.R; michael@0: import org.mozilla.gecko.background.common.log.Logger; michael@0: import org.mozilla.gecko.fxa.authenticator.AndroidFxAccount; michael@0: import org.mozilla.gecko.fxa.login.State; michael@0: import org.mozilla.gecko.sync.setup.activities.ActivityUtils; michael@0: michael@0: import android.os.Bundle; michael@0: import android.view.View; michael@0: import android.view.View.OnClickListener; michael@0: michael@0: /** michael@0: * Activity which displays "Account verified" success screen. michael@0: */ michael@0: public class FxAccountVerifiedAccountActivity extends FxAccountAbstractActivity { michael@0: private static final String LOG_TAG = FxAccountVerifiedAccountActivity.class.getSimpleName(); michael@0: michael@0: protected AndroidFxAccount fxAccount; michael@0: michael@0: public FxAccountVerifiedAccountActivity() { michael@0: super(CANNOT_RESUME_WHEN_NO_ACCOUNTS_EXIST); michael@0: } michael@0: michael@0: /** michael@0: * {@inheritDoc} michael@0: */ michael@0: @Override michael@0: public void onCreate(Bundle icicle) { michael@0: Logger.debug(LOG_TAG, "onCreate(" + icicle + ")"); michael@0: michael@0: super.onCreate(icicle); michael@0: setContentView(R.layout.fxaccount_account_verified); michael@0: } michael@0: michael@0: @Override michael@0: public void onResume() { michael@0: super.onResume(); michael@0: this.fxAccount = getAndroidFxAccount(); michael@0: if (fxAccount == null) { michael@0: Logger.warn(LOG_TAG, "Could not get Firefox Account."); michael@0: setResult(RESULT_CANCELED); michael@0: finish(); michael@0: return; michael@0: } michael@0: State state = fxAccount.getState(); michael@0: if (!state.verified) { michael@0: Logger.warn(LOG_TAG, "Firefox Account is not verified; not displaying verified account activity."); michael@0: setResult(RESULT_CANCELED); michael@0: finish(); michael@0: return; michael@0: } michael@0: michael@0: View backToBrowsingButton = ensureFindViewById(null, R.id.button, "back to browsing button"); michael@0: backToBrowsingButton.setOnClickListener(new OnClickListener() { michael@0: @Override michael@0: public void onClick(View v) { michael@0: ActivityUtils.openURLInFennec(v.getContext(), null); michael@0: } michael@0: }); michael@0: } michael@0: }