mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-30 21:55:31 +00:00
Bug 1238780 - Add interactive slide. r=sebastian
--HG-- extra : commitid : 5iXQpY8keE6 extra : rebase_source : 75053ea8c98b5bba133e215eaabc9e6a2743de32
This commit is contained in:
parent
40ac435891
commit
732f115f19
@ -0,0 +1,47 @@
|
||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
|
||||
* 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/. */
|
||||
|
||||
package org.mozilla.gecko.firstrun;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.PrefsHelper;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.Telemetry;
|
||||
import org.mozilla.gecko.TelemetryContract;
|
||||
|
||||
public class DataPanel extends FirstrunPanel {
|
||||
private boolean isEnabled = false;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstance) {
|
||||
final View root = super.onCreateView(inflater, container, savedInstance);
|
||||
final ImageView clickableImage = (ImageView) root.findViewById(R.id.firstrun_image);
|
||||
clickableImage.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
// Set new state.
|
||||
isEnabled = !isEnabled;
|
||||
int newResource = isEnabled ? R.drawable.firstrun_data_on : R.drawable.firstrun_data_off;
|
||||
((ImageView) view).setImageResource(newResource);
|
||||
if (isEnabled) {
|
||||
// Always block images.
|
||||
PrefsHelper.setPref("browser.image_blocking", 0);
|
||||
} else {
|
||||
// Default: always load images.
|
||||
PrefsHelper.setPref("browser.image_blocking", 1);
|
||||
}
|
||||
Telemetry.sendUIEvent(TelemetryContract.Event.ACTION, TelemetryContract.Method.BUTTON, "firstrun-datasaving-" + isEnabled);
|
||||
}
|
||||
});
|
||||
|
||||
return root;
|
||||
}
|
||||
}
|
@ -80,7 +80,7 @@ public class FirstrunPager extends ViewPager {
|
||||
@Override
|
||||
public void next() {
|
||||
final int currentPage = FirstrunPager.this.getCurrentItem();
|
||||
if (currentPage < FirstrunPager.this.getChildCount() - 1) {
|
||||
if (currentPage < FirstrunPager.this.getAdapter().getCount() - 1) {
|
||||
FirstrunPager.this.setCurrentItem(currentPage + 1);
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,11 @@ public class FirstrunPagerConfig {
|
||||
panels.add(new FirstrunPanelConfig(SyncPanel.class.getName(), SyncPanel.TITLE_RES));
|
||||
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, ONBOARDING_B);
|
||||
} else if (isInExperimentLocal(context, ONBOARDING_C)) {
|
||||
// TODO: Add new interactive onboarding flow.
|
||||
panels.add(SimplePanelConfigs.urlbarPanelConfig);
|
||||
panels.add(SimplePanelConfigs.bookmarksPanelConfig);
|
||||
panels.add(SimplePanelConfigs.dataPanelConfig);
|
||||
panels.add(SimplePanelConfigs.syncPanelConfig);
|
||||
panels.add(new FirstrunPanelConfig(SyncPanel.class.getName(), SyncPanel.TITLE_RES));
|
||||
Telemetry.startUISession(TelemetryContract.Session.EXPERIMENT, ONBOARDING_C);
|
||||
} else {
|
||||
Log.d(LOGTAG, "Not in an experiment!");
|
||||
@ -117,5 +121,6 @@ public class FirstrunPagerConfig {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,9 @@
|
||||
<!ENTITY firstrun_bookmarks_title "History">
|
||||
<!ENTITY firstrun_bookmarks_message "Your faves, front and center">
|
||||
<!ENTITY firstrun_bookmarks_subtext "Get results from your bookmarks and history when you search.">
|
||||
<!ENTITY firstrun_data_title "Data">
|
||||
<!ENTITY firstrun_data_message "Less data, more savings">
|
||||
<!ENTITY firstrun_data_subtext "Block images to spend less data on every site you visit.">
|
||||
<!ENTITY firstrun_sync_title "Sync">
|
||||
<!ENTITY firstrun_sync_message "&brandShortName;, always by your side">
|
||||
<!ENTITY firstrun_sync_subtext "Sync your tabs, passwords, and more everywhere you use it.">
|
||||
|
@ -274,6 +274,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
|
||||
'FilePicker.java',
|
||||
'FilePickerResultHandler.java',
|
||||
'FindInPageBar.java',
|
||||
'firstrun/DataPanel.java',
|
||||
'firstrun/FirstrunAnimationContainer.java',
|
||||
'firstrun/FirstrunPager.java',
|
||||
'firstrun/FirstrunPagerConfig.java',
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 66 KiB |
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
@ -46,6 +46,9 @@
|
||||
<string name="firstrun_bookmarks_title">&firstrun_bookmarks_title;</string>
|
||||
<string name="firstrun_bookmarks_message">&firstrun_bookmarks_message;</string>
|
||||
<string name="firstrun_bookmarks_subtext">&firstrun_bookmarks_subtext;</string>
|
||||
<string name="firstrun_data_title">&firstrun_data_title;</string>
|
||||
<string name="firstrun_data_message">&firstrun_data_message;</string>
|
||||
<string name="firstrun_data_subtext">&firstrun_data_subtext;</string>
|
||||
<string name="firstrun_sync_title">&firstrun_sync_title;</string>
|
||||
<string name="firstrun_sync_message">&firstrun_sync_message;</string>
|
||||
<string name="firstrun_sync_subtext">&firstrun_sync_subtext;</string>
|
||||
|
Loading…
Reference in New Issue
Block a user