Commit b7a33c21 authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

[WebLayer] Reuse Chrome's InfoBarWrapper.java

This CL eliminates //weblayer's copy of chrome's InfoBarWrapper.java in
favor of directly using the latter now that it has been componentized.
There were no substantive changes introduced in //weblayer and no
behavioral changes.

Bug: 1099169
Change-Id: Ie9cc819f17ce30bb66085cb05040ce11696725ec
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2270554
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#783894}
parent ef61c9e7
......@@ -9,7 +9,6 @@ import("//weblayer/variables.gni")
android_resources("weblayer_resources") {
sources = [
"res/drawable/weblayer_infobar_wrapper_bg.xml",
"res/drawable/weblayer_tab_indicator.xml",
"res/layout/site_settings_layout.xml",
"res/layout/weblayer_infobar_translate_compact_content.xml",
......@@ -97,7 +96,6 @@ android_library("java") {
"org/chromium/weblayer_private/InfoBarContainer.java",
"org/chromium/weblayer_private/InfoBarContainerLayout.java",
"org/chromium/weblayer_private/InfoBarContainerView.java",
"org/chromium/weblayer_private/InfoBarWrapper.java",
"org/chromium/weblayer_private/IntentUtils.java",
"org/chromium/weblayer_private/InterceptNavigationDelegateClientImpl.java",
"org/chromium/weblayer_private/LocaleChangedBroadcastReceiver.java",
......
......@@ -19,6 +19,7 @@ import android.view.View;
import android.widget.FrameLayout;
import org.chromium.components.infobars.InfoBarUiItem;
import org.chromium.components.infobars.InfoBarWrapper;
import org.chromium.ui.widget.OptimizedFrameLayout;
import org.chromium.weblayer_private.InfoBarContainer.InfoBarAnimationListener;
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.weblayer_private;
import android.content.Context;
import android.content.res.Resources;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import org.chromium.components.infobars.InfoBarUiItem;
/**
* Layout that holds an infobar's contents and provides a background color and a top shadow.
*/
class InfoBarWrapper extends FrameLayout {
private final InfoBarUiItem mItem;
/**
* Constructor for inflating from Java.
*/
InfoBarWrapper(Context context, InfoBarUiItem item) {
super(context);
mItem = item;
Resources res = context.getResources();
int peekingHeight = res.getDimensionPixelSize(R.dimen.infobar_peeking_height);
int shadowHeight = res.getDimensionPixelSize(R.dimen.infobar_shadow_height);
setMinimumHeight(peekingHeight + shadowHeight);
// setBackgroundResource() changes the padding, so call setPadding() second.
setBackgroundResource(R.drawable.weblayer_infobar_wrapper_bg);
setPadding(0, shadowHeight, 0, 0);
}
InfoBarUiItem getItem() {
return mItem;
}
@Override
public void onViewAdded(View child) {
child.setLayoutParams(new LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, Gravity.TOP));
}
}
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file. -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<bitmap
android:src="@drawable/infobar_shadow_top"
android:gravity="top|fill_horizontal"
android:tileMode="disabled" />
</item>
<item
android:top="@dimen/infobar_shadow_height"
android:drawable="@color/infobar_background_color" />
</layer-list>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment