Bug 1268647 - Add new sync slide. r=sebastian

MozReview-Commit-ID: 69YpFgmIN80

--HG--
extra : rebase_source : aca93ae276b39a9a222fc9b7ce6530338122dcdf
This commit is contained in:
Chenxia Liu 2016-05-10 19:52:30 -07:00
Родитель 282cc4cde3
Коммит 3ef1b7e6b4
3 изменённых файлов: 25 добавлений и 15 удалений

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

@ -26,7 +26,6 @@ public class FirstrunPagerConfig {
public static List<FirstrunPanelConfig> getDefault(Context context) {
final List<FirstrunPanelConfig> panels = new LinkedList<>();
if (Experiments.isInExperimentLocal(context, Experiments.ONBOARDING3_A)) {
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, Experiments.ONBOARDING3_A);
GeckoSharedPrefs.forProfile(context).edit().putString(Experiments.PREF_ONBOARDING_VERSION, Experiments.ONBOARDING3_A).apply();
@ -35,12 +34,13 @@ public class FirstrunPagerConfig {
panels.add(SimplePanelConfigs.bookmarksPanelConfig);
panels.add(SimplePanelConfigs.dataPanelConfig);
panels.add(SimplePanelConfigs.syncPanelConfig);
panels.add(new FirstrunPanelConfig(SyncPanel.class.getName(), SyncPanel.TITLE_RES));
panels.add(SimplePanelConfigs.signInPanelConfig);
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, Experiments.ONBOARDING3_B);
GeckoSharedPrefs.forProfile(context).edit().putString(Experiments.PREF_ONBOARDING_VERSION, Experiments.ONBOARDING3_B).apply();
} else if (Experiments.isInExperimentLocal(context, Experiments.ONBOARDING3_C)) {
panels.add(SimplePanelConfigs.notificationsPanelConfig);
panels.add(SimplePanelConfigs.readerviewPanelConfig);
panels.add(SimplePanelConfigs.accountPanelConfig);
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, Experiments.ONBOARDING3_C);
GeckoSharedPrefs.forProfile(context).edit().putString(Experiments.PREF_ONBOARDING_VERSION, Experiments.ONBOARDING3_C).apply();
} else {
@ -97,10 +97,12 @@ public class FirstrunPagerConfig {
private static class SimplePanelConfigs {
public static final FirstrunPanelConfig urlbarPanelConfig = new FirstrunPanelConfig(FirstrunPanel.class.getName(), R.string.firstrun_panel_title_welcome, R.drawable.firstrun_urlbar, R.string.firstrun_urlbar_message, R.string.firstrun_urlbar_subtext);
public static final FirstrunPanelConfig bookmarksPanelConfig = new FirstrunPanelConfig(FirstrunPanel.class.getName(), R.string.firstrun_bookmarks_title, R.drawable.firstrun_bookmarks, R.string.firstrun_bookmarks_message, R.string.firstrun_bookmarks_subtext);
public static final FirstrunPanelConfig syncPanelConfig = new FirstrunPanelConfig(FirstrunPanel.class.getName(), R.string.firstrun_sync_title, R.drawable.firstrun_sync, R.string.firstrun_sync_message, R.string.firstrun_sync_subtext);
public static final FirstrunPanelConfig dataPanelConfig = new FirstrunPanelConfig(DataPanel.class.getName(), R.string.firstrun_data_title, R.drawable.firstrun_data_off, R.string.firstrun_data_message, R.string.firstrun_data_subtext);
public static final FirstrunPanelConfig syncPanelConfig = new FirstrunPanelConfig(FirstrunPanel.class.getName(), R.string.firstrun_sync_title, R.drawable.firstrun_sync, R.string.firstrun_sync_message, R.string.firstrun_sync_subtext);
public static final FirstrunPanelConfig signInPanelConfig = new FirstrunPanelConfig(SyncPanel.class.getName(), R.string.pref_sync, R.drawable.firstrun_signin, R.string.firstrun_signin_message, R.string.firstrun_welcome_button_browser);
public static final FirstrunPanelConfig notificationsPanelConfig = new FirstrunPanelConfig(FirstrunPanel.class.getName(), R.string.firstrun_notifications_title, R.drawable.firstrun_notifications, R.string.firstrun_notifications_message, R.string.firstrun_notifications_subtext);
public static final FirstrunPanelConfig readerviewPanelConfig = new FirstrunPanelConfig(FirstrunPanel.class.getName(), R.string.firstrun_readerview_title, R.drawable.firstrun_readerview, R.string.firstrun_readerview_message, R.string.firstrun_readerview_subtext);
public static final FirstrunPanelConfig accountPanelConfig = new FirstrunPanelConfig(SyncPanel.class.getName(), R.string.firstrun_account_title, R.drawable.firstrun_account, R.string.firstrun_account_message, R.string.firstrun_button_notnow);
}
}

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

@ -10,6 +10,8 @@ import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import org.mozilla.gecko.R;
import org.mozilla.gecko.Telemetry;
import org.mozilla.gecko.TelemetryContract;
@ -17,13 +19,20 @@ import org.mozilla.gecko.fxa.FxAccountConstants;
import org.mozilla.gecko.fxa.activities.FxAccountWebFlowActivity;
public class SyncPanel extends FirstrunPanel {
// XXX: To simplify localization, this uses the pref_sync string. If this is used in the final product, add a new string to Nightly.
public static final int TITLE_RES = R.string.pref_sync;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
final ViewGroup root = (ViewGroup) inflater.inflate(R.layout.firstrun_sync_fragment, container, false);
// TODO: Update id names.
final Bundle args = getArguments();
if (args != null) {
final int imageRes = args.getInt(FirstrunPagerConfig.KEY_IMAGE);
final int textRes = args.getInt(FirstrunPagerConfig.KEY_TEXT);
final int subtextRes = args.getInt(FirstrunPagerConfig.KEY_SUBTEXT);
((ImageView) root.findViewById(R.id.firstrun_image)).setImageResource(imageRes);
((TextView) root.findViewById(R.id.firstrun_text)).setText(textRes);
((TextView) root.findViewById(R.id.welcome_browse)).setText(subtextRes);
}
root.findViewById(R.id.welcome_account).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {

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

@ -18,21 +18,21 @@
android:orientation="vertical">
<ImageView android:layout_width="wrap_content"
<ImageView android:id="@+id/firstrun_image"
android:layout_width="wrap_content"
android:layout_height="@dimen/firstrun_background_height"
android:layout_marginTop="40dp"
android:layout_marginBottom="40dp"
android:scaleType="fitCenter"
android:layout_gravity="center"
android:adjustViewBounds="true"
android:src="@drawable/firstrun_signin"/>
android:adjustViewBounds="true"/>
<TextView android:layout_width="@dimen/firstrun_content_width"
<TextView android:id="@+id/firstrun_text"
android:layout_width="@dimen/firstrun_content_width"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingBottom="40dp"
android:textAppearance="@style/TextAppearance.FirstrunLight.Main"
android:text="@string/firstrun_signin_message"/>
android:textAppearance="@style/TextAppearance.FirstrunLight.Main"/>
<Button android:id="@+id/welcome_account"
style="@style/Widget.Firstrun.Button"
@ -49,7 +49,6 @@
android:layout_height="wrap_content"
android:padding="30dp"
android:gravity="center"
android:textAppearance="@style/TextAppearance.FirstrunRegular.Link"
android:text="@string/firstrun_welcome_button_browser"/>
android:textAppearance="@style/TextAppearance.FirstrunRegular.Link"/>
</LinearLayout>
</ScrollView>