This source file includes following definitions.
- createContent
- onButtonClicked
package org.chromium.chrome.browser.infobar;
import android.content.Context;
import android.widget.TextView;
import org.chromium.chrome.R;
public class TranslateNeverPanel implements TranslateSubPanel {
private final TranslateOptions mOptions;
private final SubPanelListener mListener;
public TranslateNeverPanel(SubPanelListener listener, TranslateOptions options) {
mOptions = options;
mListener = listener;
}
@Override
public void createContent(Context context, InfoBarLayout layout) {
String changeLanguage = context.getString(
R.string.translate_never_translate_message_text, mOptions.sourceLanguage());
TextView panelMessage = (TextView) layout.findViewById(R.id.infobar_message);
panelMessage.setText(changeLanguage);
layout.addButtons(
context.getString(R.string.translate_never_translate_site),
context.getString(R.string.translate_never_translate_language,
mOptions.sourceLanguage()));
}
@Override
public void onButtonClicked(boolean primary) {
if (primary) {
mOptions.toggleNeverTranslateDomainState(true);
} else {
mOptions.toggleNeverTranslateLanguageState(true);
}
mListener.onPanelClosed(InfoBar.ACTION_TYPE_NONE);
}
}