当前位置: 首页>>代码示例>>Java>>正文


Java InfoBar类代码示例

本文整理汇总了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);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:20,代码来源:TranslateCheckBox.java

示例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;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:26,代码来源:TranslateInfoBar.java

示例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);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:12,代码来源:ReaderModeManager.java

示例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);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:9,代码来源:ReaderModeManager.java

示例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;
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:14,代码来源:ChromeDownloadDelegate.java

示例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);
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:12,代码来源:OmahaUpdateInfobar.java

示例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);
    }
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:TranslateAlwaysPanel.java

示例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);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:9,代码来源:TranslateLanguagePanel.java

示例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;
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:11,代码来源:TranslateInfoBarDelegate.java

示例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);
}
 
开发者ID:morristech,项目名称:android-chromium,代码行数:10,代码来源:TranslateNeverPanel.java

示例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();
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:5,代码来源:ReaderModeManager.java

示例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();
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:5,代码来源:ReaderModeManager.java


注:本文中的org.chromium.chrome.browser.infobar.InfoBar类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。