Bug 1000149 - Part 2: Remove edit separator. r=lucasr, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 30 Apr 2014 10:25:42 -0700
changeset 199105 24acf0cad6f13769e9d8bf8c79472f7b511f236d
parent 199104 81a9f45f132bab38e71aa97826e9a912af81e94e
child 199106 7ec3008b2de486fe4225829577a0498101c100f0
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslucasr, sledru
bugs1000149
milestone31.0a2
Bug 1000149 - Part 2: Remove edit separator. r=lucasr, a=sledru
mobile/android/base/resources/drawable/toolbar_separator.xml
mobile/android/base/resources/drawable/toolbar_separator_pb.xml
mobile/android/base/resources/drawable/toolbar_separator_selector.xml
mobile/android/base/resources/layout/browser_toolbar.xml
mobile/android/base/toolbar/BrowserToolbar.java
deleted file mode 100644
--- a/mobile/android/base/resources/drawable/toolbar_separator.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="rectangle">
-
-    <solid android:color="#a6aeb4"/>
-    <size android:width="1dp" />
-
-</shape>
deleted file mode 100644
--- a/mobile/android/base/resources/drawable/toolbar_separator_pb.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<shape xmlns:android="http://schemas.android.com/apk/res/android"
-       android:shape="rectangle">
-
-    <solid android:color="#222"/>
-    <size android:width="1dp" />
-
-</shape>
deleted file mode 100644
--- a/mobile/android/base/resources/drawable/toolbar_separator_selector.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
-   - License, v. 2.0. If a copy of the MPL was not distributed with this
-   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-<!-- Note that android:color="@color/toolbar_separator" (which uses a selector)
-     directly in the <shape> does not appear to work, so instead we select
-     between two shapes with different colors. -->
-<selector xmlns:android="http://schemas.android.com/apk/res/android"
-          xmlns:gecko="http://schemas.android.com/apk/res-auto">
-
-    <item gecko:state_private="true" android:drawable="@drawable/toolbar_separator_pb"/>
-    <item android:drawable="@drawable/toolbar_separator"/>
-
-</selector>
--- a/mobile/android/base/resources/layout/browser_toolbar.xml
+++ b/mobile/android/base/resources/layout/browser_toolbar.xml
@@ -101,30 +101,19 @@
          depending on their location can properly layout. -->
     <ImageView android:id="@+id/edit_cancel"
                style="@style/UrlBar.ImageButton.Icon"
                android:layout_alignParentRight="true"
                android:src="@drawable/close_edit_mode"
                android:contentDescription="@string/edit_mode_cancel"
                android:visibility="invisible"/>
 
-    <org.mozilla.gecko.widget.ThemedView android:id="@+id/edit_separator"
-                                         android:layout_toLeftOf="@id/edit_cancel"
-                                         android:layout_width="1dip"
-                                         android:layout_height="match_parent"
-                                         android:layout_marginTop="12dp"
-                                         android:layout_marginBottom="12dp"
-                                         android:layout_marginLeft="8dp"
-                                         android:layout_marginRight="2dp"
-                                         android:background="@drawable/toolbar_separator_selector"
-                                         android:visibility="invisible"/>
-
     <org.mozilla.gecko.toolbar.ToolbarEditLayout android:id="@+id/edit_layout"
                   style="@style/UrlBar.Button"
-                  android:layout_toLeftOf="@id/edit_separator"
+                  android:layout_toLeftOf="@id/edit_cancel"
                   android:layout_marginLeft="4dp"
                   android:layout_marginRight="4dp"
                   android:paddingLeft="8dp"
                   android:paddingRight="8dp"
                   android:visibility="gone"/>
 
     <org.mozilla.gecko.toolbar.ToolbarDisplayLayout android:id="@+id/display_layout"
                   style="@style/UrlBar.Button"
--- a/mobile/android/base/toolbar/BrowserToolbar.java
+++ b/mobile/android/base/toolbar/BrowserToolbar.java
@@ -29,17 +29,16 @@ import org.mozilla.gecko.toolbar.Toolbar
 import org.mozilla.gecko.toolbar.ToolbarDisplayLayout.UpdateFlags;
 import org.mozilla.gecko.util.Clipboard;
 import org.mozilla.gecko.util.GeckoEventListener;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.MenuUtils;
 import org.mozilla.gecko.widget.ThemedImageButton;
 import org.mozilla.gecko.widget.ThemedImageView;
 import org.mozilla.gecko.widget.ThemedRelativeLayout;
-import org.mozilla.gecko.widget.ThemedView;
 
 import android.content.Context;
 import android.content.res.Resources;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.StateListDrawable;
 import android.os.Build;
 import android.text.TextUtils;
 import android.util.AttributeSet;
@@ -132,17 +131,16 @@ public class BrowserToolbar extends Them
     private ToolbarProgressView progressBar;
     private TabCounter tabsCounter;
     private ThemedImageButton menuButton;
     private ThemedImageView menuIcon;
     private LinearLayout actionItemBar;
     private MenuPopup menuPopup;
     private List<View> focusOrder;
 
-    private final ThemedView editSeparator;
     private final View editCancel;
 
     private boolean shouldShrinkURLBar = false;
 
     private OnActivateListener activateListener;
     private OnFocusChangeListener focusChangeListener;
     private OnStartEditingListener startEditingListener;
     private OnStopEditingListener stopEditingListener;
@@ -215,17 +213,16 @@ public class BrowserToolbar extends Them
         forwardButton = (ImageButton) findViewById(R.id.forward);
         setButtonEnabled(forwardButton, false);
 
         menuButton = (ThemedImageButton) findViewById(R.id.menu);
         menuIcon = (ThemedImageView) findViewById(R.id.menu_icon);
         actionItemBar = (LinearLayout) findViewById(R.id.menu_items);
         hasSoftMenuButton = !HardwareUtils.hasMenuButton();
 
-        editSeparator = (ThemedView) findViewById(R.id.edit_separator);
         editCancel = findViewById(R.id.edit_cancel);
 
         // We use different layouts on phones and tablets, so adjust the focus
         // order appropriately.
         focusOrder = new ArrayList<View>();
         if (HardwareUtils.isTablet()) {
             focusOrder.addAll(Arrays.asList(tabsButton, backButton, forwardButton, this));
             focusOrder.addAll(urlDisplayLayout.getFocusOrder());
@@ -596,25 +593,25 @@ public class BrowserToolbar extends Them
         tabsButton.setNextFocusDownId(nextId);
         backButton.setNextFocusDownId(nextId);
         forwardButton.setNextFocusDownId(nextId);
         urlDisplayLayout.setNextFocusDownId(nextId);
         menuButton.setNextFocusDownId(nextId);
     }
 
     private int getUrlBarEntryTranslation() {
-        if (editSeparator == null) {
+        if (editCancel == null) {
             // We are on tablet, and there is no animation so return a translation of 0.
             return 0;
         }
 
         // We would ideally use the right-most point of the edit layout instead of the
         // edit separator and its margin, but it is not inflated when this code initially runs.
-        final LayoutParams lp = (LayoutParams) editSeparator.getLayoutParams();
-        return editSeparator.getLeft() - lp.leftMargin - urlBarEntry.getRight();
+        final LayoutParams lp = (LayoutParams) editCancel.getLayoutParams();
+        return editCancel.getLeft() - lp.leftMargin - urlBarEntry.getRight();
     }
 
     private int getUrlBarCurveTranslation() {
         return getWidth() - tabsButton.getLeft();
     }
 
     private boolean canDoBack(Tab tab) {
         return (tab.canDoBack() && !isEditing());
@@ -892,18 +889,17 @@ public class BrowserToolbar extends Them
                 if (showEditLayout) {
                     setCancelVisibility(View.VISIBLE);
                 }
             }
         });
     }
 
     private void setCancelVisibility(final int visibility) {
-        if (editSeparator != null && editCancel != null) {
-            editSeparator.setVisibility(visibility);
+        if (editCancel != null) {
             editCancel.setVisibility(visibility);
         }
     }
 
     /**
      * Disables and dims all toolbar elements which are not
      * related to editing mode.
      */
@@ -1333,19 +1329,16 @@ public class BrowserToolbar extends Them
     @Override
     public void setPrivateMode(boolean isPrivate) {
         super.setPrivateMode(isPrivate);
 
         tabsButton.setPrivateMode(isPrivate);
         menuButton.setPrivateMode(isPrivate);
         menuIcon.setPrivateMode(isPrivate);
         urlEditLayout.setPrivateMode(isPrivate);
-        if (editSeparator != null) {
-            editSeparator.setPrivateMode(isPrivate);
-        }
 
         if (backButton instanceof BackButton) {
             ((BackButton) backButton).setPrivateMode(isPrivate);
         }
 
         if (forwardButton instanceof ForwardButton) {
             ((ForwardButton) forwardButton).setPrivateMode(isPrivate);
         }