本文整理汇总了Java中org.chromium.chrome.browser.infobar.InfoBar类的典型用法代码示例。如果您正苦于以下问题:Java InfoBar类的具体用法?Java InfoBar怎么用?Java InfoBar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InfoBar类属于org.chromium.chrome.browser.infobar包,在下文中一共展示了InfoBar类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContent
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
public void createContent(Context context, InfoBarLayout layout) {
CheckBox checkBox = new CheckBox(context);
checkBox.setId(R.id.infobar_extra_check);
checkBox.setText(context.getString(R.string.translate_always_text,
mOptions.sourceLanguage()));
checkBox.setChecked(mOptions.alwaysTranslateLanguageState());
checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton view, boolean isChecked) {
mOptions.toggleAlwaysTranslateLanguageState(isChecked);
if (isChecked){
mListener.onPanelClosed(InfoBar.ACTION_TYPE_NONE);
} else {
mListener.onOptionsChanged();
}
}
});
layout.addGroup(checkBox);
}
示例2: actionFor
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
/**
* Based on the infobar and the button pressed figure out what action needs to happen.
*/
private int actionFor(boolean isPrimaryButton) {
int action = InfoBar.ACTION_TYPE_NONE;
int infobarType = getInfoBarType();
switch (infobarType) {
case TranslateInfoBar.BEFORE_TRANSLATE_INFOBAR:
action = isPrimaryButton
? InfoBar.ACTION_TYPE_TRANSLATE : InfoBar.ACTION_TYPE_CANCEL;
break;
case TranslateInfoBar.AFTER_TRANSLATE_INFOBAR:
if (!isPrimaryButton) {
action = InfoBar.ACTION_TYPE_TRANSLATE_SHOW_ORIGINAL;
}
break;
case TranslateInfoBar.TRANSLATE_ERROR_INFOBAR:
// retry
action = InfoBar.ACTION_TYPE_TRANSLATE;
break;
default:
break;
}
return action;
}
示例3: onAddInfoBar
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onAddInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isFirst) {
mIsInfoBarContainerShown = true;
// If the panel is opened past the peeking state, obscure the infobar.
if (mReaderModePanel != null && mReaderModePanel.isPanelOpened() && container != null) {
container.setIsObscuredByOtherView(true);
} else if (isFirst) {
// Temporarily hides the reader mode button while the infobars are shown.
closeReaderPanel(StateChangeReason.INFOBAR_SHOWN, false);
}
}
示例4: onRemoveInfoBar
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onRemoveInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isLast) {
// Re-shows the reader mode button if necessary once the infobars are dismissed.
if (isLast) {
mIsInfoBarContainerShown = false;
requestReaderPanelShow(StateChangeReason.INFOBAR_HIDDEN);
}
}
示例5: onInfoBarDismissed
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onInfoBarDismissed(InfoBar infoBar) {
if (mPendingRequest != null) {
if (mPendingRequest.hasDownloadId()) {
nativeDangerousDownloadValidated(mTab, mPendingRequest.getDownloadId(), false);
} else if (!mPendingRequest.isGETRequest()) {
// Infobar was dismissed, discard the file if a POST download is pending.
discardFile(mPendingRequest.getFilePath());
}
}
// Forget the pending request.
mPendingRequest = null;
}
示例6: onInfoBarDismissed
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onInfoBarDismissed(InfoBar infoBar) {
assert infoBar instanceof OmahaUpdateInfobar;
OmahaUpdateInfobar infoBarInstance = (OmahaUpdateInfobar) infoBar;
// If the user hasn't taken an action and the infobar is getting dismissed, then
// record that it was dismissed.
if (!infoBarInstance.mActionTaken) {
infoBarInstance.recordHistograms(ACTION_DISMISSED);
}
}
示例7: onButtonClicked
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onButtonClicked(boolean primary) {
if (primary) {
mListener.onPanelClosed(InfoBar.ACTION_TYPE_NONE);
} else {
mListener.onPanelClosed(InfoBar.ACTION_TYPE_TRANSLATE_SHOW_ORIGINAL);
}
}
示例8: onButtonClicked
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onButtonClicked(boolean primary) {
if (primary) {
mOptions.setSourceLanguage(mSessionOptions.sourceLanguageIndex());
mOptions.setTargetLanguage(mSessionOptions.targetLanguageIndex());
}
mListener.onPanelClosed(InfoBar.ACTION_TYPE_NONE);
}
示例9: showTranslateInfoBar
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@CalledByNative
InfoBar showTranslateInfoBar(
int nativeInfoBar, int translateBarType,
int sourceLanguageIndex, int targetLanguageIndex, boolean autoTranslatePair,
boolean showNeverInfobar, String[] languages) {
mInfoBar = new TranslateInfoBar(nativeInfoBar, this, translateBarType,
sourceLanguageIndex, targetLanguageIndex, autoTranslatePair, showNeverInfobar,
languages);
return mInfoBar;
}
示例10: onButtonClicked
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onButtonClicked(boolean primary) {
if (primary) {
mOptions.toggleNeverTranslateDomainState(true);
} else {
mOptions.toggleNeverTranslateLanguageState(true);
}
mListener.onPanelClosed(InfoBar.ACTION_TYPE_NONE);
}
示例11: onAddInfoBar
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onAddInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isFirst) {
if (isFirst && mReaderModePanel != null) mReaderModePanel.onShowInfobarContainer();
}
示例12: onRemoveInfoBar
import org.chromium.chrome.browser.infobar.InfoBar; //导入依赖的package包/类
@Override
public void onRemoveInfoBar(InfoBarContainer container, InfoBar infoBar, boolean isLast) {
if (isLast && mReaderModePanel != null) mReaderModePanel.onHideInfobarContainer();
}