Backed out 2 changesets (bug 1144707, bug 1201623) for bustage

Backed out changeset 3aef96cabf2c (bug 1201623)
Backed out changeset a362959c7f52 (bug 1144707)

--HG--
extra : rebase_source : d1fa77c2dc2b788304e27159da06e5abee9a5dc7
This commit is contained in:
Carsten "Tomcat" Book 2015-09-25 16:19:04 +02:00
parent 8f54300771
commit f5891cfdca
6 changed files with 44 additions and 103 deletions

View File

@ -68,6 +68,7 @@
<org.mozilla.gecko.toolbar.ToolbarEditLayout android:id="@+id/edit_layout"
style="@style/UrlBar.Button"
android:paddingLeft="10dp"
android:paddingRight="12dp"
android:visibility="gone"
android:orientation="horizontal"
@ -109,20 +110,11 @@
android:layout_marginRight="16dp"
android:background="@drawable/tabs_count"/>
<!-- Bug 1144707. Use clickable View instead of menu button margin to prevent
edit mode actiivation when user clicks on the edge of the screen. -->
<View android:id="@+id/menu_margin"
android:layout_width="6dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:clickable="true"
android:visibility="gone"/>
<org.mozilla.gecko.widget.themed.ThemedFrameLayout
android:id="@+id/menu"
style="@style/UrlBar.ImageButton"
android:layout_toLeftOf="@id/menu_margin"
android:layout_alignWithParentIfMissing="true"
android:layout_alignParentRight="true"
android:layout_marginRight="6dp"
android:contentDescription="@string/menu"
android:background="@drawable/browser_toolbar_action_bar_button"
android:visibility="gone">

View File

@ -14,9 +14,7 @@
android:layout_gravity="center_vertical"/>
<!-- The site security icon is misaligned with the page title so
we add a bottom margin to align their bottoms.
Site security icon must have exact position and size as search icon in
edit layout -->
we add a bottom margin to align their bottoms. -->
<ImageButton android:id="@+id/site_security"
style="@style/UrlBar.ImageButton"
android:layout_width="@dimen/browser_toolbar_site_security_width"

View File

@ -6,21 +6,11 @@
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:gecko="http://schemas.android.com/apk/res-auto">
<!-- Search icon must have exact position and size as site security in
display layout -->
<ImageView android:id="@+id/search_icon"
android:layout_width="@dimen/browser_toolbar_site_security_width"
android:layout_height="@dimen/browser_toolbar_site_security_height"
android:layout_marginBottom="@dimen/browser_toolbar_site_security_margin_bottom"
android:layout_marginRight="@dimen/browser_toolbar_site_security_margin_right"
android:paddingBottom="@dimen/browser_toolbar_site_security_padding_vertical"
android:paddingLeft="@dimen/browser_toolbar_site_security_padding_horizontal"
android:paddingRight="@dimen/browser_toolbar_site_security_padding_horizontal"
android:paddingTop="@dimen/browser_toolbar_site_security_padding_vertical"
android:scaleType="fitCenter"
android:src="@drawable/search_icon_inactive"
android:visibility="gone"/>
<!-- Overall, we want 12dp of padding from mic to the right edge of the toolbar.
However, setting a value of 12dp (using the padding from the parent container)
does not match drawablePadding=12dp. Part of this is the url_bar_entry drawable
overlaps the EditText, but I can't figure out the rest. Thus eyeballing for
paddingRight. -->
<org.mozilla.gecko.toolbar.ToolbarEditText
android:id="@+id/url_edit_text"
style="@style/UrlBar.Title"
@ -31,6 +21,7 @@
android:imeOptions="actionGo|flagNoExtractUi|flagNoFullscreen"
android:selectAllOnFocus="true"
android:contentDescription="@string/url_bar_default_text"
android:drawablePadding="12dp"
android:paddingRight="8dp"
gecko:autoUpdateTheme="false"/>

View File

@ -13,7 +13,6 @@ import org.mozilla.gecko.Tabs;
import org.mozilla.gecko.tabs.TabHistoryController;
import org.mozilla.gecko.menu.MenuItemActionBar;
import org.mozilla.gecko.util.ColorUtils;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.widget.themed.ThemedTextView;
import android.content.Context;
@ -41,8 +40,6 @@ abstract class BrowserToolbarTabletBase extends BrowserToolbar {
protected final BackButton backButton;
protected final ForwardButton forwardButton;
protected final View menuButtonMarginView;
private final PorterDuffColorFilter privateBrowsingTabletMenuItemColorFilter;
protected abstract void animateForwardButton(ForwardButtonAnimation animation);
@ -66,11 +63,6 @@ abstract class BrowserToolbarTabletBase extends BrowserToolbar {
privateBrowsingTabletMenuItemColorFilter = new PorterDuffColorFilter(
ColorUtils.getColor(context, R.color.tabs_tray_icon_grey), PorterDuff.Mode.SRC_IN);
menuButtonMarginView = findViewById(R.id.menu_margin);
if (menuButtonMarginView != null && !HardwareUtils.hasMenuButton()) {
menuButtonMarginView.setVisibility(View.VISIBLE);
}
}
private void initButtonListeners() {

View File

@ -7,7 +7,6 @@ package org.mozilla.gecko.toolbar;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.speech.RecognizerIntent;
import android.widget.Button;
import android.widget.ImageButton;
@ -25,8 +24,6 @@ import org.mozilla.gecko.toolbar.BrowserToolbar.OnDismissListener;
import org.mozilla.gecko.toolbar.BrowserToolbar.OnFilterListener;
import org.mozilla.gecko.toolbar.BrowserToolbar.TabEditingState;
import org.mozilla.gecko.util.ActivityResultHandler;
import org.mozilla.gecko.util.DrawableUtil;
import org.mozilla.gecko.util.HardwareUtils;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.InputOptionsUtils;
import org.mozilla.gecko.widget.themed.ThemedLinearLayout;
@ -36,7 +33,6 @@ import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.ImageView;
import java.util.List;
@ -48,12 +44,6 @@ import java.util.List;
*/
public class ToolbarEditLayout extends ThemedLinearLayout {
public interface OnSearchStateChangeListener {
public void onSearchStateChange(boolean isActive);
}
private final ImageView mSearchIcon;
private final ToolbarEditText mEditText;
private final ImageButton mVoiceInput;
@ -69,8 +59,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
setOrientation(HORIZONTAL);
LayoutInflater.from(context).inflate(R.layout.toolbar_edit_layout, this);
mSearchIcon = (ImageView) findViewById(R.id.search_icon);
mEditText = (ToolbarEditText) findViewById(R.id.url_edit_text);
mVoiceInput = (ImageButton) findViewById(R.id.mic);
@ -79,10 +67,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
@Override
public void onAttachedToWindow() {
if (HardwareUtils.isTablet()) {
mSearchIcon.setVisibility(View.VISIBLE);
}
mEditText.setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
@ -107,13 +91,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
}
});
mEditText.setOnSearchStateChangeListener(new OnSearchStateChangeListener() {
@Override
public void onSearchStateChange(boolean isActive) {
updateSearchIcon(isActive);
}
});
mVoiceInput.setOnClickListener(new Button.OnClickListener() {
@Override
public void onClick(View v) {
@ -127,37 +104,6 @@ public class ToolbarEditLayout extends ThemedLinearLayout {
launchQRCodeReader();
}
});
// Set an inactive search icon on tablet devices when in editing mode
updateSearchIcon(false);
}
/**
* Update the search icon at the left of the edittext based
* on its state.
*
* @param isActive The state of the edittext. Active is when the initialized
* text has changed and is not empty.
*/
void updateSearchIcon(boolean isActive) {
if (!HardwareUtils.isTablet()) {
return;
}
// When on tablet show a magnifying glass in editing mode
final int searchDrawableId = R.drawable.search_icon_active;
final Drawable searchDrawable;
if (!isActive) {
searchDrawable = DrawableUtil.tintDrawable(getContext(), searchDrawableId, R.color.placeholder_grey);
} else {
if (isPrivateMode()) {
searchDrawable = DrawableUtil.tintDrawable(getContext(), searchDrawableId, R.color.tabs_tray_icon_grey);
} else {
searchDrawable = getResources().getDrawable(searchDrawableId);
}
}
mSearchIcon.setImageDrawable(searchDrawable);
}
@Override

View File

@ -13,11 +13,13 @@ import org.mozilla.gecko.R;
import org.mozilla.gecko.toolbar.BrowserToolbar.OnCommitListener;
import org.mozilla.gecko.toolbar.BrowserToolbar.OnDismissListener;
import org.mozilla.gecko.toolbar.BrowserToolbar.OnFilterListener;
import org.mozilla.gecko.toolbar.ToolbarEditLayout.OnSearchStateChangeListener;
import org.mozilla.gecko.util.DrawableUtil;
import org.mozilla.gecko.util.GamepadUtils;
import org.mozilla.gecko.util.StringUtils;
import org.mozilla.gecko.util.HardwareUtils;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.graphics.Rect;
import android.text.Editable;
import android.text.NoCopySpan;
@ -54,7 +56,6 @@ public class ToolbarEditText extends CustomEditText
private OnCommitListener mCommitListener;
private OnDismissListener mDismissListener;
private OnFilterListener mFilterListener;
private OnSearchStateChangeListener mSearchStateChangeListener;
private ToolbarPrefs mPrefs;
@ -86,16 +87,14 @@ public class ToolbarEditText extends CustomEditText
mFilterListener = listener;
}
void setOnSearchStateChangeListener(OnSearchStateChangeListener listener) {
mSearchStateChangeListener = listener;
}
@Override
public void onAttachedToWindow() {
setOnKeyListener(new KeyListener());
setOnKeyPreImeListener(new KeyPreImeListener());
setOnSelectionChangedListener(new SelectionChangeListener());
addTextChangedListener(new TextChangeListener());
// Set an inactive search icon on tablet devices when in editing mode
updateSearchIcon(false);
}
@Override
@ -105,9 +104,7 @@ public class ToolbarEditText extends CustomEditText
// Make search icon inactive when edit toolbar search term isn't a user entered
// search term
final boolean isActive = !TextUtils.isEmpty(getText());
if (mSearchStateChangeListener != null) {
mSearchStateChangeListener.onSearchStateChange(isActive);
}
updateSearchIcon(isActive);
if (gainFocus) {
resetAutocompleteState();
@ -163,6 +160,33 @@ public class ToolbarEditText extends CustomEditText
mPrefs = prefs;
}
/**
* Update the search icon at the left of the edittext based
* on its state.
*
* @param isActive The state of the edittext. Active is when the initialized
* text has changed and is not empty.
*/
void updateSearchIcon(boolean isActive) {
if (!HardwareUtils.isTablet()) {
return;
}
// When on tablet show a magnifying glass in editing mode
final int searchDrawableId = R.drawable.search_icon_active;
final Drawable searchDrawable;
if (!isActive) {
searchDrawable = DrawableUtil.tintDrawable(getContext(), searchDrawableId, R.color.placeholder_grey);
} else {
if (isPrivateMode()) {
searchDrawable = DrawableUtil.tintDrawable(getContext(), searchDrawableId, R.color.tabs_tray_icon_grey);
} else {
searchDrawable = getResources().getDrawable(searchDrawableId);
}
}
setCompoundDrawablesWithIntrinsicBounds(searchDrawable, null, null, null);
}
/**
* Mark the start of autocomplete changes so our text change
* listener does not react to changes in autocomplete text
@ -540,9 +564,7 @@ public class ToolbarEditText extends CustomEditText
}
// Update search icon with an active state since user is typing
if (mSearchStateChangeListener != null) {
mSearchStateChangeListener.onSearchStateChange(textLength > 0);
}
updateSearchIcon(textLength > 0);
if (mFilterListener != null) {
mFilterListener.onFilter(text, doAutocomplete ? ToolbarEditText.this : null);