Commit 42335384 authored by newt@chromium.org's avatar newt@chromium.org

Update infobar assets.

This also removes the yellow "warning" background variation, so all
infobars now have the same background color.

BUG=375379
R=dfalcantara@chromium.org

Review URL: https://codereview.chromium.org/346853005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278877 0039d316-1c4b-4281-b951-d872f2087c98
parent 6d368af1
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2013 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="false"
android:state_focused="false"
android:drawable="@drawable/infobar_button_warning_floating_enabled" />
<item
android:drawable="@drawable/infobar_button_warning_floating_pressed" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2013 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="false"
android:state_focused="false"
android:drawable="@drawable/infobar_button_warning_full_left_enabled" />
<item
android:drawable="@drawable/infobar_button_warning_full_left_pressed" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2013 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.
-->
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="false"
android:state_focused="false"
android:drawable="@drawable/infobar_button_warning_full_right_enabled" />
<item
android:drawable="@drawable/infobar_button_warning_full_right_pressed" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2013 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#fffbfbfb"
android:endColor="#fff2f2f2"
android:angle="270" />
</shape>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2013 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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#ffffe991"
android:endColor="#fffee289"
android:angle="270" />
</shape>
......@@ -71,7 +71,7 @@
android:id="@+id/close_button"
android:contentDescription="@string/infobar_close"
android:adjustViewBounds="true"
android:src="@drawable/dismiss"
android:src="@drawable/infobar_close_button"
android:background="@drawable/app_banner_button_close"
android:padding="@dimen/app_banner_close_button_padding"
android:layout_width="wrap_content"
......
......@@ -5,10 +5,9 @@
-->
<resources>
<!-- Colors were copied from browser/views/infobars/infobars.cc -->
<color name="infobar_text">#000000</color>
<color name="infobar_info_background_separator">#afafaf</color>
<color name="infobar_warning_background_separator">#ccb771</color>
<color name="infobar_text">#333</color>
<color name="infobar_background">#fff</color>
<color name="infobar_background_separator">#afafaf</color>
<!-- Tab Switcher Colors -->
<color name="tab_switcher_background">#111111</color>
......
......@@ -27,21 +27,21 @@
<dimen name="edge_swipe_in_additional_slop">50dp</dimen>
<dimen name="edge_swipe_out_slop">18dp</dimen>
<!-- Infobar dimensions -->
<!-- Text size of the InfoBar message. -->
<!-- Infobar dimensions -->
<!-- Text size of the infobar message. -->
<dimen name="infobar_text_size">16sp</dimen>
<!-- Text size of text inside InfoBar buttons. -->
<!-- Text size of text inside infobar buttons. -->
<dimen name="infobar_button_text_size">16sp</dimen>
<!-- Minimum dimension (height or width) of the upper row of an InfoBar. -->
<!-- Minimum dimension (height or width) of the upper row of an infobar. -->
<dimen name="infobar_min_size">60dp</dimen>
<!-- Margin between items in an InfoBar. -->
<!-- Margin between items in an infobar. -->
<dimen name="infobar_margin">10dp</dimen>
<!-- Left/right padding for infobar button text. -->
<dimen name="infobar_button_horizontal_padding">30dp</dimen>
<!-- Minimum height for a touch target. -->
<dimen name="infobar_touch_target_height">40dp</dimen>
<!-- Dimension (height or width) of the InfoBar icon. -->
<dimen name="infobar_icon_size">31dp</dimen>
<!-- Height and width of the infobar icon. -->
<dimen name="infobar_icon_size">36dp</dimen>
<!-- App banner dimensions -->
<dimen name="app_banner_max_width">424dp</dimen>
......
......@@ -33,21 +33,25 @@ public class ConfirmInfoBar extends TwoButtonInfoBar {
public ConfirmInfoBar(InfoBarListeners.Confirm confirmListener, int backgroundType,
int iconDrawableId, String message, String primaryButtonText,
String secondaryButtonText) {
this(confirmListener, backgroundType, iconDrawableId, message, null, primaryButtonText,
this(confirmListener, iconDrawableId, message, primaryButtonText, secondaryButtonText);
}
public ConfirmInfoBar(InfoBarListeners.Confirm confirmListener, int iconDrawableId,
String message, String primaryButtonText, String secondaryButtonText) {
this(confirmListener, iconDrawableId, message, null, primaryButtonText,
secondaryButtonText);
}
public ConfirmInfoBar(InfoBarListeners.Confirm confirmListener, int backgroundType,
int iconDrawableId, String message, String linkText, String primaryButtonText,
String secondaryButtonText) {
this(0, confirmListener, backgroundType, iconDrawableId, message, linkText,
primaryButtonText, secondaryButtonText);
public ConfirmInfoBar(InfoBarListeners.Confirm confirmListener, int iconDrawableId,
String message, String linkText, String primaryButtonText, String secondaryButtonText) {
this(0, confirmListener, iconDrawableId, message, linkText, primaryButtonText,
secondaryButtonText);
}
public ConfirmInfoBar(long nativeInfoBar, InfoBarListeners.Confirm confirmListener,
int backgroundType, int iconDrawableId, String message, String linkText,
String primaryButtonText, String secondaryButtonText) {
super(confirmListener, backgroundType, iconDrawableId);
int iconDrawableId, String message, String linkText, String primaryButtonText,
String secondaryButtonText) {
super(confirmListener, iconDrawableId);
mMessage = message;
mLinkText = linkText;
mPrimaryButtonText = primaryButtonText;
......
......@@ -36,11 +36,8 @@ public class ConfirmInfoBarDelegate {
String linkText, String buttonOk, String buttonCancel) {
int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
// Apparently, yellow was the popular choice at the time these InfoBars were implemented
// because they stuck out more (hence the BACKGROUND_TYPE_WARNING) default.
ConfirmInfoBar infoBar = new ConfirmInfoBar(nativeInfoBar, null,
InfoBar.BACKGROUND_TYPE_WARNING, drawableId, message, linkText, buttonOk,
buttonCancel);
ConfirmInfoBar infoBar = new ConfirmInfoBar(nativeInfoBar, null, drawableId, message,
linkText, buttonOk, buttonCancel);
return infoBar;
}
}
......@@ -16,7 +16,6 @@ import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.FrameLayout;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.chrome.R;
import java.util.ArrayList;
......@@ -46,7 +45,7 @@ public class ContentWrapperView extends FrameLayout {
* Constructs a ContentWrapperView object.
* @param context The context to create this View with.
*/
public ContentWrapperView(Context context, InfoBar infoBar, int backgroundType, View panel,
public ContentWrapperView(Context context, InfoBar infoBar, View panel,
boolean infoBarsFromTop) {
// Set up this ViewGroup.
super(context);
......@@ -54,24 +53,16 @@ public class ContentWrapperView extends FrameLayout {
mGravity = infoBarsFromTop ? Gravity.BOTTOM : Gravity.TOP;
mInfoBarsFromTop = infoBarsFromTop;
// Pull out resources we need for the backgrounds. Defaults to the INFO type.
int separatorBackground = R.color.infobar_info_background_separator;
int layoutBackground = R.drawable.infobar_info_background;
if (backgroundType == InfoBar.BACKGROUND_TYPE_WARNING) {
layoutBackground = R.drawable.infobar_warning_background;
separatorBackground = R.color.infobar_warning_background_separator;
}
// Set up this view.
Resources resources = context.getResources();
LayoutParams wrapParams = new LayoutParams(LayoutParams.MATCH_PARENT,
LayoutParams.WRAP_CONTENT);
setLayoutParams(wrapParams);
ApiCompatibilityUtils.setBackgroundForView(this, resources.getDrawable(layoutBackground));
setBackgroundColor(resources.getColor(R.color.infobar_background));
// Add a separator line that delineates different InfoBars.
View separator = new View(context);
separator.setBackgroundColor(resources.getColor(separatorBackground));
separator.setBackgroundColor(resources.getColor(R.color.infobar_background_separator));
addView(separator, new LayoutParams(LayoutParams.MATCH_PARENT, getBoundaryHeight(context),
mGravity));
......
......@@ -40,7 +40,6 @@ public abstract class InfoBar implements InfoBarView {
public static final int BACKGROUND_TYPE_INFO = 0;
public static final int BACKGROUND_TYPE_WARNING = 1;
private final int mBackgroundType;
private final int mIconDrawableId;
private InfoBarListeners.Dismiss mListener;
......@@ -66,13 +65,11 @@ public abstract class InfoBar implements InfoBarView {
/**
* @param listener Listens to when buttons have been clicked on the InfoBar.
* @param backgroundType Background type to use (INFO or WARNING).
* @param iconDrawableId ID of the resource to use for the Icon. If 0, no icon will be shown.
*/
public InfoBar(InfoBarListeners.Dismiss listener, int backgroundType, int iconDrawableId) {
public InfoBar(InfoBarListeners.Dismiss listener, int iconDrawableId) {
mListener = listener;
mId = generateId();
mBackgroundType = backgroundType;
mIconDrawableId = iconDrawableId;
mExpireOnNavigation = true;
}
......@@ -92,17 +89,19 @@ public abstract class InfoBar implements InfoBarView {
/**
* Change the pointer to the native-side counterpart of this InfoBar. Native-side code is
* responsible for managing the cleanup of the pointer.
* @param nativeInfoBarPtr Pointer to the NativeInfoBar.
* @param newInfoBarPtr Pointer to the NativeInfoBar.
*/
protected void replaceNativePointer(long newInfoBarPtr) {
mNativeInfoBarPtr = newInfoBarPtr;
}
// Determine if the infobar should be dismissed when |url| is loaded. Calling
// setExpireOnNavigation(true/false) causes this method always to return true/false.
// This only applies to java-only infobars. C++ infobars will use the same logic
// as other platforms so they are not attempted to be dismissed twice.
// It should really be removed once all infobars have a C++ counterpart.
/**
* Determine if the infobar should be dismissed when |url| is loaded. Calling
* setExpireOnNavigation(true/false) causes this method always to return true/false.
* This only applies to java-only infobars. C++ infobars will use the same logic
* as other platforms so they are not attempted to be dismissed twice.
* It should really be removed once all infobars have a C++ counterpart.
*/
public final boolean shouldExpire(String url) {
return mExpireOnNavigation && mNativeInfoBarPtr == 0;
}
......@@ -147,7 +146,7 @@ public abstract class InfoBar implements InfoBarView {
*/
protected final View createView() {
assert mContext != null;
return new InfoBarLayout(mContext, this, mBackgroundType, mIconDrawableId);
return new InfoBarLayout(mContext, this, mIconDrawableId);
}
/**
......@@ -178,8 +177,8 @@ public abstract class InfoBar implements InfoBarView {
protected ContentWrapperView getContentWrapper(boolean createIfNotFound) {
if (mContentView == null && createIfNotFound) {
mContentView = new ContentWrapperView(getContext(), this, mBackgroundType,
createView(), getInfoBarContainer().areInfoBarsOnTop());
mContentView = new ContentWrapperView(getContext(), this, createView(),
getInfoBarContainer().areInfoBarsOnTop());
mContentView.setFocusable(false);
}
return mContentView;
......
......@@ -107,26 +107,18 @@ public class InfoBarLayout extends ViewGroup implements View.OnClickListener {
* Constructs the layout for the specified InfoBar.
* @param context The context used to render.
* @param infoBarView InfoBarView that listens to events.
* @param backgroundType Type of InfoBar background being shown.
* @param iconResourceId ID of the icon to use for the InfoBar.
*/
public InfoBarLayout(Context context, InfoBarView infoBarView, int backgroundType,
int iconResourceId) {
public InfoBarLayout(Context context, InfoBarView infoBarView, int iconResourceId) {
super(context);
mIndicesOfRows = new ArrayList<Integer>();
mLayoutRTL = LocalizationUtils.isLayoutRtl();
mInfoBarView = infoBarView;
// Determine what backgrounds we'll be needing for the buttons.
if (backgroundType == InfoBar.BACKGROUND_TYPE_INFO) {
mBackgroundFloating = R.drawable.infobar_button_normal_floating;
mBackgroundFullLeft = R.drawable.infobar_button_normal_full_left;
mBackgroundFullRight = R.drawable.infobar_button_normal_full_right;
} else {
mBackgroundFloating = R.drawable.infobar_button_warning_floating;
mBackgroundFullLeft = R.drawable.infobar_button_warning_full_left;
mBackgroundFullRight = R.drawable.infobar_button_warning_full_right;
}
mBackgroundFloating = R.drawable.infobar_button_normal_floating;
mBackgroundFullLeft = R.drawable.infobar_button_normal_full_left;
mBackgroundFullRight = R.drawable.infobar_button_normal_full_right;
// Grab the dimensions.
mDimensionMinSize =
......@@ -144,7 +136,7 @@ public class InfoBarLayout extends ViewGroup implements View.OnClickListener {
// Set up the close button.
mCloseButton.setId(R.id.infobar_close_button);
mCloseButton.setImageResource(R.drawable.dismiss);
mCloseButton.setImageResource(R.drawable.infobar_close_button);
mCloseButton.setBackgroundResource(R.drawable.infobar_close_bg);
mCloseButton.setOnClickListener(this);
......
......@@ -22,7 +22,7 @@ public class MessageInfoBar extends InfoBar {
* @return the infobar.
*/
public static MessageInfoBar createInfoBar(CharSequence title) {
return new MessageInfoBar(null, 0, title, BACKGROUND_TYPE_INFO);
return new MessageInfoBar(null, 0, title);
}
/**
......@@ -32,7 +32,7 @@ public class MessageInfoBar extends InfoBar {
* @return the infobar.
*/
public static MessageInfoBar createInfoBar(int iconResourceId, CharSequence title) {
return new MessageInfoBar(null, iconResourceId, title, BACKGROUND_TYPE_INFO);
return new MessageInfoBar(null, iconResourceId, title);
}
/**
......@@ -52,12 +52,17 @@ public class MessageInfoBar extends InfoBar {
*/
public static MessageInfoBar createWarningInfoBar(InfoBarListeners.Dismiss listener,
CharSequence title) {
return new MessageInfoBar(listener, R.drawable.warning, title, BACKGROUND_TYPE_WARNING);
return new MessageInfoBar(listener, R.drawable.infobar_warning, title);
}
protected MessageInfoBar(InfoBarListeners.Dismiss listener, int iconResourceId,
CharSequence title, int backgroundType) {
super(listener, backgroundType, iconResourceId);
this(listener, iconResourceId, title);
}
protected MessageInfoBar(InfoBarListeners.Dismiss listener, int iconResourceId,
CharSequence title) {
super(listener, iconResourceId);
mTitle = title;
}
......
......@@ -20,8 +20,8 @@ public class SavePasswordInfoBar extends ConfirmInfoBar {
public SavePasswordInfoBar(long nativeInfoBar, SavePasswordInfoBarDelegate delegate,
int iconDrawableId, String message, String primaryButtonText,
String secondaryButtonText) {
super(nativeInfoBar, null, InfoBar.BACKGROUND_TYPE_WARNING, iconDrawableId,
message, null, primaryButtonText, secondaryButtonText);
super(nativeInfoBar, null, iconDrawableId, message,
null, primaryButtonText, secondaryButtonText);
mNativeInfoBar = nativeInfoBar;
mDelegate = delegate;
}
......
......@@ -45,8 +45,7 @@ public class TranslateInfoBar extends TwoButtonInfoBar implements SubPanelListen
int infoBarType, int sourceLanguageIndex, int targetLanguageIndex,
boolean autoTranslatePair, boolean shouldShowNeverBar,
boolean triggeredFromMenu, String[] languages) {
super(null, BACKGROUND_TYPE_INFO,
R.drawable.infobar_translate);
super(null, R.drawable.infobar_translate);
mTranslateDelegate = delegate;
mOptions = new TranslateOptions(sourceLanguageIndex, targetLanguageIndex, languages,
autoTranslatePair, triggeredFromMenu);
......
......@@ -15,7 +15,11 @@ import org.chromium.chrome.R;
public abstract class TwoButtonInfoBar extends InfoBar {
public TwoButtonInfoBar(InfoBarListeners.Dismiss dismissListener, int backgroundType,
int iconDrawableId) {
super(dismissListener, backgroundType, iconDrawableId);
super(dismissListener, iconDrawableId);
}
public TwoButtonInfoBar(InfoBarListeners.Dismiss dismissListener, int iconDrawableId) {
super(dismissListener, iconDrawableId);
}
/**
......
......@@ -16,7 +16,8 @@ DEFINE_RESOURCE_ID(0, 0)
// InfoBar resources.
DEFINE_RESOURCE_ID(IDR_INFOBAR_ALT_NAV_URL, R.drawable.infobar_didyoumean)
DEFINE_RESOURCE_ID(IDR_INFOBAR_AUTOFILL, R.drawable.infobar_autofill)
DEFINE_RESOURCE_ID(IDR_INFOBAR_AUTOLOGIN, R.drawable.infobar_autologin)
DEFINE_RESOURCE_ID(IDR_INFOBAR_AUTOLOGIN,\
R.drawable.infobar_savepassword_autologin)
DEFINE_RESOURCE_ID(IDR_INFOBAR_COOKIE, R.drawable.infobar_cookie)
DEFINE_RESOURCE_ID(IDR_INFOBAR_DESKTOP_NOTIFICATIONS,\
R.drawable.infobar_desktop_notifications)
......@@ -32,7 +33,8 @@ DEFINE_RESOURCE_ID(IDR_INFOBAR_PLUGIN_INSTALL, R.drawable.infobar_plugin)
DEFINE_RESOURCE_ID(IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER,
R.drawable.infobar_protected_media_identifier)
DEFINE_RESOURCE_ID(IDR_INFOBAR_RESTORE_SESSION, R.drawable.infobar_restore)
DEFINE_RESOURCE_ID(IDR_INFOBAR_SAVE_PASSWORD, R.drawable.infobar_savepassword)
DEFINE_RESOURCE_ID(IDR_INFOBAR_SAVE_PASSWORD,\
R.drawable.infobar_savepassword_autologin)
DEFINE_RESOURCE_ID(IDR_INFOBAR_WARNING, R.drawable.infobar_warning)
DEFINE_RESOURCE_ID(IDR_INFOBAR_THEME, R.drawable.infobar_theme)
DEFINE_RESOURCE_ID(IDR_INFOBAR_TRANSLATE, R.drawable.infobar_translate)
......
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