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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/TranslateCheckBox.java

Issue 1411853007: Begin adding class for laying out InfoBar controls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 5 years, 1 month 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 2013 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 package org.chromium.chrome.browser.infobar;
5
6 import android.content.Context;
7 import android.support.v7.widget.AppCompatCheckBox;
8 import android.widget.CompoundButton;
9 import android.widget.CompoundButton.OnCheckedChangeListener;
10
11 import org.chromium.base.ApiCompatibilityUtils;
12 import org.chromium.chrome.R;
13
14 /**
15 * A check box used to determine if a page should always be translated.
16 */
17 public class TranslateCheckBox extends AppCompatCheckBox implements OnCheckedCha ngeListener {
18 private static final int TEXT_SIZE_SP = 13;
19
20 private final SubPanelListener mListener;
21 private final TranslateOptions mOptions;
22
23 public TranslateCheckBox(Context context, TranslateOptions options, SubPanel Listener listener) {
24 super(context);
25 mOptions = options;
26 mListener = listener;
27
28 setId(R.id.infobar_extra_check);
29 setText(context.getString(R.string.translate_always_text, mOptions.sourc eLanguage()));
30 setTextColor(
31 ApiCompatibilityUtils.getColor(context.getResources(), R.color.d efault_text_color));
32 setTextSize(TEXT_SIZE_SP);
33 setChecked(mOptions.alwaysTranslateLanguageState());
34 setOnCheckedChangeListener(this);
35 }
36
37 @Override
38 public void onCheckedChanged(CompoundButton view, boolean isChecked) {
39 mOptions.toggleAlwaysTranslateLanguageState(isChecked);
40 mListener.onPanelClosed(ActionType.NONE);
41 }
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698