Bug 1042809 - Part 1: Lightweight first-run experience. r=lucasr

This commit is contained in:
Chenxia Liu 2014-08-21 17:18:42 -07:00
parent b42a99a924
commit ddc14fd84a
14 changed files with 255 additions and 2 deletions

View File

@ -230,6 +230,11 @@
</intent-filter>
</activity-alias>
<activity android:name="org.mozilla.gecko.StartPane"
android:theme="@style/GeckoStartPane"
android:excludeFromRecents="true"
android:noHistory="true" />
<activity android:name="org.mozilla.gecko.webapp.Dispatcher"
android:noHistory="true" >
<intent-filter>

View File

@ -0,0 +1,49 @@
package org.mozilla.gecko;
import org.mozilla.gecko.fxa.activities.FxAccountGetStartedActivity;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class StartPane extends Activity {
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.onboard_start_pane);
final Button accountButton = (Button) findViewById(R.id.button_account);
accountButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showAccountSetup();
}
});
final Button browserButton = (Button) findViewById(R.id.button_browser);
browserButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
showBrowser();
}
});
}
private void showBrowser() {
// StartPane is on the stack above the browser, so just kill this activity.
finish();
}
private void showAccountSetup() {
final Intent intent = new Intent(this, FxAccountGetStartedActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
finish();
}
}

View File

@ -6,6 +6,11 @@
<!ENTITY no_space_to_start_error "There is not enough space available for &brandShortName; to start.">
<!ENTITY error_loading_file "An error occurred when trying to load files required to run &brandShortName;">
<!ENTITY onboard_start_message "Welcome to &brandShortName;!">
<!ENTITY onboard_start_subtext "Committed to you, your privacy, and an Open Web">
<!ENTITY onboard_start_button_account "Sign in to &brandShortName;">
<!ENTITY onboard_start_button_browser "Start Browsing">
<!-- Localization note: These are used as the titles of different pages on the home screen.
They are automatically converted to all caps by the Android platform. -->
<!ENTITY bookmarks_title "Bookmarks">

View File

@ -378,6 +378,7 @@ gbjar.sources += [
'sqlite/MatrixBlobCursor.java',
'sqlite/SQLiteBridge.java',
'sqlite/SQLiteBridgeException.java',
'StartPane.java',
'SuggestClient.java',
'SurfaceBits.java',
'Tab.java',

View File

@ -0,0 +1,20 @@
<?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/. -->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="false">
<shape>
<solid android:color="@color/onboard_start"/>
</shape>
</item>
<item android:state_pressed="true">
<shape>
<solid android:color="@color/onboard_start_highlight"/>
</shape>
</item>
</selector>

View File

@ -0,0 +1,126 @@
<?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/. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@style/OnboardStartLayout"
android:orientation="vertical"
android:background="@color/onboard_start"
android:windowIsFloating="true">
<ScrollView android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:fillViewport="true" >
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<!-- Empty spacer view -->
<View android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="15dp">
<ImageView android:id="@+id/image_shield"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:paddingRight="92dp"
android:src="@drawable/onboard_start_shield"
android:contentDescription="@string/onboard_empty_contentDescription"/>
<ImageView android:id="@+id/image_private"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:paddingLeft="92dp"
android:src="@drawable/onboard_start_private"
android:contentDescription="@string/onboard_empty_contentDescription"/>
<ImageView android:id="@+id/image_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/image_shield"
android:layout_marginTop="23dp"
android:src="@drawable/large_icon"
android:contentDescription="@string/onboard_empty_contentDescription"/>
<ImageView android:id="@+id/image_sync"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image_shield"
android:layout_toLeftOf="@id/image_logo"
android:layout_marginRight="30dp"
android:src="@drawable/onboard_start_sync"
android:contentDescription="@string/onboard_empty_contentDescription"/>
<ImageView android:id="@+id/image_addon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image_private"
android:layout_toRightOf="@id/image_logo"
android:layout_marginLeft="30dp"
android:src="@drawable/onboard_start_addon"
android:contentDescription="@string/onboard_empty_contentDescription"/>
<TextView android:id="@+id/text_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/image_logo"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:padding="10sp"
android:text="@string/onboard_start_message"
android:textAppearance="@style/OnboardStartTextAppearance"
android:textSize="23sp" />
<TextView android:layout_width="295dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:layout_below="@id/text_message"
android:layout_centerHorizontal="true"
android:lineSpacingExtra="12sp"
android:padding="10sp"
android:text="@string/onboard_start_subtext"
android:textAppearance="@style/OnboardStartTextAppearance.Subtext" />
</RelativeLayout>
<!-- Empty spacer view -->
<View android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1"/>
</LinearLayout>
</ScrollView>
<!-- Bottom row of navigation buttons. -->
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@color/android:white">
<Button android:id="@+id/button_account"
style="@style/Widget.Onboard.Start.Button"
android:layout_marginTop="3px"
android:layout_marginRight="3px"
android:text="@string/onboard_start_button_account"/>
<Button android:id="@+id/button_browser"
style="@style/Widget.Onboard.Start.Button"
android:layout_marginTop="3px"
android:text="@string/onboard_start_button_browser"/>
</LinearLayout>
</LinearLayout>

View File

@ -125,6 +125,11 @@
<item name="android:layout_gravity">center</item>
</style>
<style name="OnboardStartLayout">
<item name="android:layout_height">568dp</item>
<item name="android:layout_width">400dp</item>
</style>
<style name="TextAppearance.UrlBar.Title" parent="TextAppearance.Medium">
<item name="android:textSize">16sp</item>
</style>

View File

@ -3,7 +3,7 @@
- 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>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme. This could be overridden by GeckoBaseTheme
@ -15,5 +15,7 @@
<item name="android:windowNoTitle">true</item>
<item name="arrowPopupWidth">400dp</item>
</style>
<style name="GeckoStartPane" parent="Gecko.Dialog"/>
</resources>

View File

@ -3,7 +3,7 @@
- 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>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!--
Base application theme. This could be overridden by GeckoBaseTheme

View File

@ -17,6 +17,10 @@
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="OnboardStartTextAppearance.Subtext">
<item name="android:textSize">18sp</item>
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="TextAppearance.UrlBar.Title" parent="TextAppearance.Small">
<item name="android:textSize">15sp</item>
<item name="android:fontFamily">sans-serif-light</item>

View File

@ -31,6 +31,10 @@
<!-- highlight-focused on private nav button: 10% white over background_private -->
<color name="highlight_nav_focused_pb">#FF3F423F</color>
<!-- Onboarding start pane -->
<color name="onboard_start">#EAEAEA</color>
<color name="onboard_start_highlight">#D8D8D8</color>
<!--
Application theme colors
-->

View File

@ -253,6 +253,17 @@
<style name="Widget.Home.HistoryPanelTitle" parent="Widget.Home.HistoryTabIndicator"/>
<style name="Widget.Onboard.Start.Button" parent="Widget.BaseButton">
<item name="android:layout_width">0dp</item>
<item name="android:layout_height">match_parent</item>
<item name="android:layout_weight">1</item>
<item name="android:paddingTop">15dp</item>
<item name="android:paddingBottom">15dp</item>
<item name="android:background">@drawable/onboard_start_button</item>
<item name="android:textColor">#4A90E2</item>
<item name="android:textSize">16sp</item>
</style>
<!--
TextAppearance
Note: Gecko uses light theme as default, while Android uses dark.
@ -769,4 +780,17 @@
<item name="android:paddingTop">0dp</item>
</style>
<style name="OnboardStartLayout">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
</style>
<style name="OnboardStartTextAppearance">
<item name="android:textColor">#5F636B</item>
</style>
<style name="OnboardStartTextAppearance.Subtext">
<item name="android:textSize">18sp</item>
</style>
</resources>

View File

@ -99,4 +99,6 @@
<item name="floatingHintEditTextStyle">@style/FloatingHintEditText</item>
</style>
<style name="GeckoStartPane" parent="GeckoBase"/>
</resources>

View File

@ -41,6 +41,12 @@
<string name="no_space_to_start_error">&no_space_to_start_error;</string>
<string name="error_loading_file">&error_loading_file;</string>
<string name="onboard_start_message">&onboard_start_message;</string>
<string name="onboard_start_subtext">&onboard_start_subtext;</string>
<string name="onboard_start_button_account">&onboard_start_button_account;</string>
<string name="onboard_start_button_browser">&onboard_start_button_browser;</string>
<string name="onboard_empty_contentDescription"></string>
<string name="bookmarks_title">&bookmarks_title;</string>
<string name="history_title">&history_title;</string>
<string name="reading_list_title">&reading_list_title;</string>