| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.chrome.browser.infobar; | 5 package org.chromium.chrome.browser.infobar; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Color; | 8 import android.graphics.Color; |
| 9 import android.text.SpannableString; | 9 import android.text.SpannableString; |
| 10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 mOptions = options; | 63 mOptions = options; |
| 64 mSessionOptions = new TranslateOptions(mOptions); | 64 mSessionOptions = new TranslateOptions(mOptions); |
| 65 } | 65 } |
| 66 | 66 |
| 67 @Override | 67 @Override |
| 68 public void createContent(Context context, InfoBarLayout layout) { | 68 public void createContent(Context context, InfoBarLayout layout) { |
| 69 mSourceSpinner = null; | 69 mSourceSpinner = null; |
| 70 mTargetSpinner = null; | 70 mTargetSpinner = null; |
| 71 | 71 |
| 72 String changeLanguage = context.getString(R.string.translate_infobar_cha
nge_languages); | 72 String changeLanguage = context.getString(R.string.translate_infobar_cha
nge_languages); |
| 73 TextView panelMessage = (TextView) layout.findViewById(R.id.infobar_mess
age); | 73 layout.setMessage(changeLanguage); |
| 74 panelMessage.setText(changeLanguage); | |
| 75 | 74 |
| 76 // Set up the spinners. | 75 // Set up the spinners. |
| 77 createSpinners(context); | 76 createSpinners(context); |
| 78 layout.addGroup(mSourceSpinner, mTargetSpinner); | 77 layout.setCustomContent(mSourceSpinner, mTargetSpinner); |
| 79 | 78 |
| 80 // Set up the buttons. | 79 // Set up the buttons. |
| 81 layout.addButtons(context.getString(R.string.translate_button_done), | 80 layout.setButtons(context.getString(R.string.translate_button_done), |
| 82 context.getString(R.string.cancel)); | 81 context.getString(R.string.cancel)); |
| 83 } | 82 } |
| 84 | 83 |
| 85 @Override | 84 @Override |
| 86 public void onButtonClicked(boolean primary) { | 85 public void onButtonClicked(boolean primary) { |
| 87 if (primary) { | 86 if (primary) { |
| 88 mOptions.setSourceLanguage(mSessionOptions.sourceLanguageIndex()); | 87 mOptions.setSourceLanguage(mSessionOptions.sourceLanguageIndex()); |
| 89 mOptions.setTargetLanguage(mSessionOptions.targetLanguageIndex()); | 88 mOptions.setTargetLanguage(mSessionOptions.targetLanguageIndex()); |
| 90 } | 89 } |
| 91 mListener.onPanelClosed(InfoBar.ACTION_TYPE_NONE); | 90 mListener.onPanelClosed(InfoBar.ACTION_TYPE_NONE); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 /** | 274 /** |
| 276 * This is the text displayed in the spinner element so make sure no deb
ug information | 275 * This is the text displayed in the spinner element so make sure no deb
ug information |
| 277 * is added. | 276 * is added. |
| 278 */ | 277 */ |
| 279 @Override | 278 @Override |
| 280 public String toString() { | 279 public String toString() { |
| 281 return mLanguageName; | 280 return mLanguageName; |
| 282 } | 281 } |
| 283 } | 282 } |
| 284 } | 283 } |
| OLD | NEW |