本文整理汇总了Java中org.chromium.base.ApiCompatibilityUtils.setStatusBarColor方法的典型用法代码示例。如果您正苦于以下问题:Java ApiCompatibilityUtils.setStatusBarColor方法的具体用法?Java ApiCompatibilityUtils.setStatusBarColor怎么用?Java ApiCompatibilityUtils.setStatusBarColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.chromium.base.ApiCompatibilityUtils
的用法示例。
在下文中一共展示了ApiCompatibilityUtils.setStatusBarColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOverviewModeStartedShowing
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
public void onOverviewModeStartedShowing(boolean showToolbar) {
if (mFindToolbarManager != null) mFindToolbarManager.hideToolbar();
if (getAssistStatusHandler() != null) getAssistStatusHandler().updateAssistState();
if (getAppMenuHandler() != null) getAppMenuHandler().hideAppMenu();
ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK);
StartupMetrics.getInstance().recordOpenedTabSwitcher();
}
示例2: postInflationStartup
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
@Override
public void postInflationStartup() {
super.postInflationStartup();
getToolbarManager().setCloseButtonDrawable(mIntentDataProvider.getCloseButtonDrawable());
getToolbarManager().setShowTitle(mIntentDataProvider.getTitleVisibilityState()
== CustomTabsIntent.SHOW_PAGE_TITLE);
if (CustomTabsConnection.getInstance(getApplication())
.shouldHideDomainForSession(mSession)) {
getToolbarManager().setUrlBarHidden(true);
}
int toolbarColor = mIntentDataProvider.getToolbarColor();
getToolbarManager().updatePrimaryColor(toolbarColor, false);
if (!mIntentDataProvider.isOpenedByChrome()) {
getToolbarManager().setShouldUpdateToolbarPrimaryColor(false);
}
if (toolbarColor != ApiCompatibilityUtils.getColor(
getResources(), R.color.default_primary_color)) {
ApiCompatibilityUtils.setStatusBarColor(getWindow(),
ColorUtils.getDarkenedColorForStatusBar(toolbarColor));
}
// Setting task title and icon to be null will preserve the client app's title and icon.
ApiCompatibilityUtils.setTaskDescription(this, null, null, toolbarColor);
showCustomButtonOnToolbar();
mBottomBarDelegate = new CustomTabBottomBarDelegate(this, mIntentDataProvider);
mBottomBarDelegate.showBottomBarIfNecessary();
}
示例3: updateTaskDescription
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private void updateTaskDescription() {
String title = null;
if (!TextUtils.isEmpty(mWebappInfo.shortName())) {
title = mWebappInfo.shortName();
} else if (getActivityTab() != null) {
title = getActivityTab().getTitle();
}
Bitmap icon = null;
if (mWebappInfo.icon() != null) {
icon = mWebappInfo.icon();
} else if (getActivityTab() != null) {
icon = mLargestFavicon;
}
if (mBrandColor == null && mWebappInfo.hasValidThemeColor()) {
mBrandColor = (int) mWebappInfo.themeColor();
}
int taskDescriptionColor =
ApiCompatibilityUtils.getColor(getResources(), R.color.default_primary_color);
int statusBarColor = Color.BLACK;
if (mBrandColor != null) {
taskDescriptionColor = mBrandColor;
statusBarColor = ColorUtils.getDarkenedColorForStatusBar(mBrandColor);
}
ApiCompatibilityUtils.setTaskDescription(this, title, icon,
ColorUtils.getOpaqueColor(taskDescriptionColor));
ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}
示例4: setContentView
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* This function builds the {@link CompositorViewHolder}. Subclasses *must* call
* super.setContentView() before using {@link #getTabModelSelector()} or
* {@link #getCompositorViewHolder()}.
*/
@Override
protected final void setContentView() {
final long begin = SystemClock.elapsedRealtime();
TraceEvent.begin("onCreate->setContentView()");
enableHardwareAcceleration();
setLowEndTheme();
int controlContainerLayoutId = getControlContainerLayoutId();
WarmupManager warmupManager = WarmupManager.getInstance();
if (warmupManager.hasViewHierarchyWithToolbar(controlContainerLayoutId)) {
View placeHolderView = new View(this);
setContentView(placeHolderView);
ViewGroup contentParent = (ViewGroup) placeHolderView.getParent();
warmupManager.transferViewHierarchyTo(contentParent);
contentParent.removeView(placeHolderView);
} else {
warmupManager.clearViewHierarchy();
// Allow disk access for the content view and toolbar container setup.
// On certain android devices this setup sequence results in disk writes outside
// of our control, so we have to disable StrictMode to work. See crbug.com/639352.
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
try {
setContentView(R.layout.main);
if (controlContainerLayoutId != NO_CONTROL_CONTAINER) {
ViewStub toolbarContainerStub =
((ViewStub) findViewById(R.id.control_container_stub));
toolbarContainerStub.setLayoutResource(controlContainerLayoutId);
toolbarContainerStub.inflate();
}
// It cannot be assumed that the result of toolbarContainerStub.inflate() will be
// the control container since it may be wrapped in another view.
ControlContainer controlContainer =
(ControlContainer) findViewById(R.id.control_container);
// Inflate the correct toolbar layout for the device.
int toolbarLayoutId = getToolbarLayoutId();
if (toolbarLayoutId != NO_TOOLBAR_LAYOUT && controlContainer != null) {
controlContainer.initWithToolbar(toolbarLayoutId);
}
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
}
TraceEvent.end("onCreate->setContentView()");
mInflateInitialLayoutDurationMs = SystemClock.elapsedRealtime() - begin;
// Set the status bar color to black by default. This is an optimization for
// Chrome not to draw under status and navigation bars when we use the default
// black status bar
ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK);
ViewGroup rootView = (ViewGroup) getWindow().getDecorView().getRootView();
mCompositorViewHolder = (CompositorViewHolder) findViewById(R.id.compositor_view_holder);
mCompositorViewHolder.setRootView(rootView);
// Setting fitsSystemWindows to false ensures that the root view doesn't consume the insets.
rootView.setFitsSystemWindows(false);
// Add a custom view right after the root view that stores the insets to access later.
// ContentViewCore needs the insets to determine the portion of the screen obscured by
// non-content displaying things such as the OSK.
mInsetObserverView = InsetObserverView.create(this);
rootView.addView(mInsetObserverView, 0);
}
示例5: setStatusBarColor
import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
* Set device status bar to a given color.
* @param tab The tab that is currently showing.
* @param color The color that the status bar should be set to.
*/
protected void setStatusBarColor(Tab tab, int color) {
int statusBarColor = (tab != null && tab.isDefaultThemeColor())
? Color.BLACK : ColorUtils.getDarkenedColorForStatusBar(color);
ApiCompatibilityUtils.setStatusBarColor(getWindow(), statusBarColor);
}