Bug 951304 - Follow-up: Look better on tablets; improve interstitial. r=rnewman

This commit is contained in:
Nick Alexander 2014-01-20 21:26:17 -08:00
parent 87952f92c1
commit 288d1a3a57
16 changed files with 69 additions and 28 deletions

View File

@ -38,11 +38,14 @@ abstract class FxAccountSetupTask<T> extends AsyncTask<Void, Void, InnerRequestD
protected final String email;
protected final byte[] emailUTF8;
protected final String password;
public final byte[] quickStretchedPW;
protected final byte[] passwordUTF8;
protected final FxAccountClient20 client;
protected ProgressDialog progressDialog = null;
// Initialized lazily.
protected byte[] quickStretchedPW;
// AsyncTask's are one-time-use, so final members are fine.
protected final CountDownLatch latch = new CountDownLatch(1);
protected final InnerRequestDelegate<T> innerDelegate = new InnerRequestDelegate<T>(latch);
@ -54,11 +57,25 @@ abstract class FxAccountSetupTask<T> extends AsyncTask<Void, Void, InnerRequestD
this.email = email;
this.emailUTF8 = email.getBytes("UTF-8");
this.password = password;
this.quickStretchedPW = FxAccountUtils.generateQuickStretchedPW(emailUTF8, password.getBytes("UTF-8"));
this.passwordUTF8 = password.getBytes("UTF-8");
this.client = client;
this.delegate = delegate;
}
/**
* Stretching the password is expensive, so we compute the stretched value lazily.
*
* @return stretched password.
* @throws GeneralSecurityException
* @throws UnsupportedEncodingException
*/
public byte[] generateQuickStretchedPW() throws UnsupportedEncodingException, GeneralSecurityException {
if (this.quickStretchedPW == null) {
this.quickStretchedPW = FxAccountUtils.generateQuickStretchedPW(emailUTF8, passwordUTF8);
}
return this.quickStretchedPW;
}
@Override
protected void onPreExecute() {
progressDialog = new ProgressDialog(context);
@ -137,10 +154,10 @@ abstract class FxAccountSetupTask<T> extends AsyncTask<Void, Void, InnerRequestD
@Override
protected InnerRequestDelegate<String> doInBackground(Void... arg0) {
try {
client.createAccount(emailUTF8, quickStretchedPW, false, innerDelegate);
client.createAccount(emailUTF8, generateQuickStretchedPW(), false, innerDelegate);
latch.await();
return innerDelegate;
} catch (InterruptedException e) {
} catch (Exception e) {
Logger.error(LOG_TAG, "Got exception logging in.", e);
delegate.handleError(e);
}
@ -158,10 +175,10 @@ abstract class FxAccountSetupTask<T> extends AsyncTask<Void, Void, InnerRequestD
@Override
protected InnerRequestDelegate<LoginResponse> doInBackground(Void... arg0) {
try {
client.loginAndGetKeys(emailUTF8, quickStretchedPW, innerDelegate);
client.loginAndGetKeys(emailUTF8, generateQuickStretchedPW(), innerDelegate);
latch.await();
return innerDelegate;
} catch (InterruptedException e) {
} catch (Exception e) {
Logger.error(LOG_TAG, "Got exception signing in.", e);
delegate.handleError(e);
}

View File

@ -6,7 +6,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@android:color/transparent" />
android:color="@android:color/white" />
<stroke
android:width="@dimen/fxaccount_stroke_width"
android:color="@color/fxaccount_input_borderActive" />

View File

@ -6,7 +6,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@android:color/transparent" />
android:color="@android:color/white" />
<stroke
android:width="@dimen/fxaccount_stroke_width"
android:color="@color/fxaccount_input_borderActive" />

View File

@ -6,7 +6,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@android:color/transparent" />
android:color="@android:color/white" />
<stroke
android:width="@dimen/fxaccount_stroke_width"
android:color="@color/fxaccount_input_borderInactive" />

View File

@ -6,7 +6,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@android:color/transparent" />
android:color="@android:color/white" />
<stroke
android:width="@dimen/fxaccount_stroke_width"
android:color="@color/fxaccount_input_borderInactive" />

View File

@ -6,7 +6,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@android:color/transparent" />
android:color="@android:color/white" />
<stroke
android:width="@dimen/fxaccount_stroke_width"
android:color="@color/fxaccount_input_borderActive" />

View File

@ -5,6 +5,8 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@android:color/white" />
<stroke
android:width="@dimen/fxaccount_stroke_width"
android:color="@color/fxaccount_input_borderInactive" />

View File

@ -14,6 +14,8 @@
android:id="@+id/create_account_view"
style="@style/FxAccountMiddle" >
<LinearLayout style="@style/FxAccountSpacer" />
<TextView
style="@style/FxAccountHeaderItem"
android:text="@string/firefox_accounts" />
@ -76,4 +78,4 @@
android:contentDescription="@string/fxaccount_icon_contentDescription" />
</LinearLayout>
</ScrollView>
</ScrollView>

View File

@ -13,6 +13,8 @@
android:id="@+id/create_success_view"
style="@style/FxAccountMiddle" >
<LinearLayout style="@style/FxAccountSpacer" />
<TextView
style="@style/FxAccountHeaderItem"
android:text="@string/firefox_accounts" >

View File

@ -13,6 +13,8 @@
android:id="@+id/intro_view"
style="@style/FxAccountMiddle" >
<LinearLayout style="@style/FxAccountSpacer" />
<TextView
style="@style/FxAccountHeaderItem"
android:text="@string/firefox_accounts" >

View File

@ -14,6 +14,8 @@
android:id="@+id/sign_in_view"
style="@style/FxAccountMiddle" >
<LinearLayout style="@style/FxAccountSpacer" />
<TextView
style="@style/FxAccountHeaderItem"
android:text="@string/firefox_accounts" />
@ -62,4 +64,4 @@
android:contentDescription="@string/fxaccount_icon_contentDescription" />
</LinearLayout>
</ScrollView>
</ScrollView>

View File

@ -156,4 +156,4 @@
</LinearLayout>
</LinearLayout>
</ScrollView>
</ScrollView>

View File

@ -14,6 +14,8 @@
android:id="@+id/update_credentials_view"
style="@style/FxAccountMiddle" >
<LinearLayout style="@style/FxAccountSpacer" />
<TextView
style="@style/FxAccountHeaderItem"
android:text="@string/firefox_accounts" />
@ -43,4 +45,4 @@
android:contentDescription="@string/fxaccount_icon_contentDescription" />
</LinearLayout>
</ScrollView>
</ScrollView>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="FxAccountMiddle">
<item name="android:orientation">vertical</item>
<item name="android:layout_width">500dp</item>
<item name="android:minWidth">500dp</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_weight">1</item>
<item name="android:layout_gravity">center</item>
<item name="android:paddingTop">25dp</item>
<item name="android:paddingLeft">12dp</item>
<item name="android:paddingRight">12dp</item>
<item name="android:paddingBottom">15dp</item>
</style>
</resources>

View File

@ -10,6 +10,7 @@
<style name="FxAccountTheme" parent="@style/Gecko" />
<style name="FxAccountMiddle">
<item name="android:background">@android:color/white</item>
<item name="android:orientation">vertical</item>
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>

View File

@ -9,7 +9,7 @@
Apps screen, which we only want when testing. -->
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
</intent-filter>
</activity>
@ -33,9 +33,6 @@
android:icon="@drawable/fxaccount_icon"
android:name="org.mozilla.gecko.fxa.activities.FxAccountCreateAccountActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
@ -43,9 +40,6 @@
android:icon="@drawable/fxaccount_icon"
android:name="org.mozilla.gecko.fxa.activities.FxAccountCreateSuccessActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
@ -53,9 +47,6 @@
android:icon="@drawable/fxaccount_icon"
android:name="org.mozilla.gecko.fxa.activities.FxAccountSignInActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>
<activity
@ -63,7 +54,4 @@
android:icon="@drawable/fxaccount_icon"
android:name="org.mozilla.gecko.fxa.activities.FxAccountUpdateCredentialsActivity"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
</intent-filter>
</activity>