Bug 1149208 - Make it easier to create a Firefox Account pointing at stage. r=rnewman

========

a0ccd38174
Author: Nick Alexander <nalexander@mozilla.com>
    Bug 1149208 - Make it easier to create a Firefox Account pointing at stage.

    Tap the Firefox icon 5 times on the Getting Started screen, and the
    account sign up flow will start, pointing at the stage account
    constellation.

--HG--
extra : rebase_source : 9662008cf4aab09128b89bac46c4f99b750b73f4
This commit is contained in:
Nick Alexander 2015-03-30 13:31:58 -07:00
Родитель 7d82c01981
Коммит c33bd8d022
1 изменённых файлов: 24 добавлений и 3 удалений

Просмотреть файл

@ -6,6 +6,7 @@ package org.mozilla.gecko.fxa.activities;
import java.util.Locale;
import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.Locales;
import org.mozilla.gecko.R;
import org.mozilla.gecko.background.common.log.Logger;
@ -13,6 +14,7 @@ import org.mozilla.gecko.background.fxa.FxAccountAgeLockoutHelper;
import org.mozilla.gecko.background.fxa.FxAccountUtils;
import org.mozilla.gecko.fxa.FirefoxAccounts;
import org.mozilla.gecko.fxa.FxAccountConstants;
import org.mozilla.gecko.fxa.FxAccountServerConfiguration;
import org.mozilla.gecko.sync.setup.activities.ActivityUtils;
import android.accounts.AccountAuthenticatorActivity;
@ -35,6 +37,14 @@ public class FxAccountGetStartedActivity extends AccountAuthenticatorActivity {
private static final int CHILD_REQUEST_CODE = 1;
// If the user clicks the email field this many times, the account sign up flow will start,
// using the stage server configuration.
@SuppressWarnings("unused")
private final int NUMBER_OF_CLICKS_TO_LAUNCH_STAGE_FLOW =
// !defined(MOZILLA_OFFICIAL) || defined(NIGHTLY_BUILD) || defined(MOZ_DEBUG)
(!AppConstants.MOZILLA_OFFICIAL || AppConstants.NIGHTLY_BUILD || AppConstants.DEBUG_BUILD) ? 5 : -1 /* infinite */;
private int stageFlowClickCount = 0;
/**
* {@inheritDoc}
*/
@ -63,7 +73,19 @@ public class FxAccountGetStartedActivity extends AccountAuthenticatorActivity {
}
});
animateIconIn();
final View iconView = findViewById(R.id.icon);
animateIconIn(iconView);
iconView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
stageFlowClickCount += 1;
if (NUMBER_OF_CLICKS_TO_LAUNCH_STAGE_FLOW > 0 && stageFlowClickCount >= NUMBER_OF_CLICKS_TO_LAUNCH_STAGE_FLOW) {
stageFlowClickCount = 0;
startFlow(FxAccountServerConfiguration.Stage.toBundle());
}
}
});
}
/**
@ -76,7 +98,7 @@ public class FxAccountGetStartedActivity extends AccountAuthenticatorActivity {
* measurement has happened first, which requires a (sometimes buggy)
* onPreDrawListener.
*/
protected void animateIconIn() {
protected void animateIconIn(View iconView) {
final AlphaAnimation a = new AlphaAnimation(0.0f, 1.0f);
final TranslateAnimation t = new TranslateAnimation(
Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF, 0.0f,
@ -87,7 +109,6 @@ public class FxAccountGetStartedActivity extends AccountAuthenticatorActivity {
animationSet.addAnimation(a);
animationSet.addAnimation(t);
final View iconView = findViewById(R.id.icon);
iconView.startAnimation(animationSet);
}