Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/firstrun/DataReductionProxyFirstRunFragment.java

Issue 1339613004: Add Data Reduction Proxy card to Clank FRE in EM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.chromium.chrome.browser.firstrun;
6
7 import android.os.Bundle;
8 import android.view.LayoutInflater;
9 import android.view.View;
10 import android.view.View.OnClickListener;
11 import android.view.ViewGroup;
12 import android.widget.Button;
13 import android.widget.Switch;
14
15 import org.chromium.chrome.R;
16 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
17 import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoS creen;
18
19 /**
20 * The First Run Experience fragment that allows the user to opt in to Data Save r.
21 */
22 public class DataReductionProxyFirstRunFragment extends FirstRunPage {
23
24 @Override
25 public View onCreateView(
26 LayoutInflater inflater, ViewGroup container, Bundle savedInstanceSt ate) {
27 return inflater.inflate(R.layout.fre_data_reduction_proxy, container, fa lse);
28 }
29
30 @Override
31 public void onViewCreated(View view, Bundle savedInstanceState) {
32 super.onViewCreated(view, savedInstanceState);
33
34 final Switch enableDataSaverSwitch = (Switch) view
35 .findViewById(R.id.enable_data_saver_switch);
36 Button nextButton = (Button) view.findViewById(R.id.next_button);
37
38 mEnableDataSaverSwitch.setOnClickListener(new OnClickListener() {
39 @Override
40 public void onClick(View v) {
41 DataReductionProxySettings.getInstance().setDataReductionProxyEn abled(
42 v.getContext(), enableDataSaverSwitch.isChecked());
43 if (enableDataSaverSwitch.isChecked()) {
44 enableDataSaverSwitch.setText(R.string.data_reduction_enable d_switch);
45 } else {
46 enableDataSaverSwitch.setText(R.string.data_reduction_disabl ed_switch);
47 }
48 }
49 });
50
51 nextButton.setOnClickListener(new OnClickListener() {
52 @Override
53 public void onClick(View v) {
54 advanceToNextPage();
55 }
56 });
57
58 mEnableDataSaverSwitch.setChecked(true);
59 DataReductionProxySettings.getInstance().setDataReductionProxyEnabled(
60 view.getContext(), enableDataSaverSwitch.isChecked());
61 }
62
63 @Override
64 public void onStart() {
65 super.onStart();
66 DataReductionPromoScreen.setDisplayedDataReductionPromo(getActivity(), t rue);
67 }
68 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698