jenkins-bot has submitted this change and it was merged.

Change subject: Minor tweaks of the Toolbar design.
......................................................................


Minor tweaks of the Toolbar design.

- Made the drop shadow under the toolbar a bit more subtle.
- Made the toolbar color a bit lighter.
- Decreased the font size of the search hint text.
- Made the background of the SearchView be the same as the placeholder.
- Removed the Submit button from the SearchView (the "go" button on the
  keyboard still applies).
- Removed the magnify icon from the SearchView when active.
- Fixed checkstyle.

Change-Id: Ic1ace7a314d80c46c48a4cf88a899f5fcebe8dcf
---
M wikipedia/res/drawable/toolbar_bottom_shadow.xml
M wikipedia/res/layout/activity_main.xml
M wikipedia/res/values/colors.xml
M 
wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
M wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
5 files changed, 61 insertions(+), 48 deletions(-)

Approvals:
  BearND: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/wikipedia/res/drawable/toolbar_bottom_shadow.xml 
b/wikipedia/res/drawable/toolbar_bottom_shadow.xml
index 8b16103..8a8cbb9 100644
--- a/wikipedia/res/drawable/toolbar_bottom_shadow.xml
+++ b/wikipedia/res/drawable/toolbar_bottom_shadow.xml
@@ -2,7 +2,7 @@
 <shape xmlns:android="http://schemas.android.com/apk/res/android";
     android:shape="rectangle">
     <gradient
-        android:startColor="#50000000"
+        android:startColor="#40000000"
         android:endColor="#00000000"
         android:angle="270"/>
 </shape>
\ No newline at end of file
diff --git a/wikipedia/res/layout/activity_main.xml 
b/wikipedia/res/layout/activity_main.xml
index 4a70fde..8270400 100644
--- a/wikipedia/res/layout/activity_main.xml
+++ b/wikipedia/res/layout/activity_main.xml
@@ -53,10 +53,10 @@
                         android:layout_height="36dp"
                         android:orientation="horizontal"
                         android:layout_gravity="center_vertical"
-                        android:layout_marginLeft="8dp"
-                        android:layout_marginRight="8dp"
-                        android:paddingLeft="4dp"
-                        android:paddingRight="4dp"
+                        android:layout_marginLeft="4dp"
+                        android:layout_marginRight="4dp"
+                        android:paddingLeft="6dp"
+                        android:paddingRight="6dp"
                         android:background="?attr/search_bar_shape">
                         <ImageView
                             android:id="@+id/main_search_bar_icon"
@@ -68,11 +68,12 @@
                         <TextView
                             android:id="@+id/main_search_bar_text"
                             android:layout_width="wrap_content"
-                            android:layout_height="wrap_content"
+                            android:layout_height="match_parent"
                             android:paddingLeft="4dp"
                             android:paddingRight="4dp"
+                            android:gravity="center"
                             android:text="@string/search_hint"
-                            style="?android:textAppearanceMedium"
+                            android:textSize="16sp"
                             android:singleLine="true"
                             android:ellipsize="end"
                             android:layout_gravity="center_vertical"/>
@@ -80,9 +81,11 @@
                     <android.support.v7.widget.SearchView
                         android:id="@+id/main_search_view"
                         android:layout_width="match_parent"
-                        android:layout_height="match_parent"
+                        android:layout_height="36dp"
+                        android:layout_gravity="center_vertical"
                         android:layout_marginRight="8dp"
                         android:layout_marginEnd="8dp"
+                        android:textSize="16sp"
                         android:visibility="gone"
                         android:focusable="true"
                         android:inputType="text"
@@ -100,7 +103,7 @@
         </FrameLayout>
         <View
             android:layout_width="match_parent"
-            android:layout_height="6dp"
+            android:layout_height="5dp"
             android:layout_gravity="bottom"
             android:background="@drawable/toolbar_bottom_shadow"
             />
diff --git a/wikipedia/res/values/colors.xml b/wikipedia/res/values/colors.xml
index 6302b9f..611f8e6 100644
--- a/wikipedia/res/values/colors.xml
+++ b/wikipedia/res/values/colors.xml
@@ -32,7 +32,7 @@
     <color name="button_light">#ff777777</color>
     <color name="window_background_light">#fff2f2f2</color>
     <color name="page_background_light">#ffffffff</color>
-    <color name="actionbar_background_light">#ffe0e0e0</color>
+    <color name="actionbar_background_light">#ffe8e8e8</color>
     <color name="search_background_light">#ffffffff</color>
     <color name="toc_background_light">#ffffffff</color>
     <color name="toc_section_text_light">#ff333333</color>
@@ -41,7 +41,7 @@
     <color name="abusefilter_background_light">#E8E8E8</color>
     <color name="subtle_gray_light">#fff0f0f0</color>
     <color name="list_separator_light">#ffcccccc</color>
-    <color name="search_bar_light">#fff0f0f0</color>
+    <color name="search_bar_light">#fff2f2f2</color>
 
     <color name="link_dark">#ff2B6FB2</color>
     <color name="button_dark">#ff2B6FB2</color>
diff --git 
a/wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
 
b/wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
index 65a0106..0d56c08 100644
--- 
a/wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
+++ 
b/wikipedia/src/main/java/org/wikipedia/page/bottomcontent/BottomContentHandler.java
@@ -266,8 +266,7 @@
                     // If there are results, set up section and make sure it's 
visible
                     setupReadMoreSection(layoutInflater, readMoreItems);
                     readMoreContainer.setVisibility(View.VISIBLE);
-                }
-                else {
+                } else {
                     // If there's no results, just hide the section
                     readMoreContainer.setVisibility(View.GONE);
                 }
diff --git 
a/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java 
b/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
index f3874c9..e6d2fb7 100644
--- a/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
+++ b/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
@@ -13,16 +13,21 @@
 
 import android.app.AlertDialog;
 import android.content.DialogInterface;
+import android.graphics.Color;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
 import android.support.v7.widget.SearchView;
 import android.text.TextUtils;
 import android.util.Log;
+import android.util.TypedValue;
+import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.EditText;
 import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
 
 public class SearchArticlesFragment extends Fragment {
     private static final String ARG_LAST_SEARCHED_TEXT = "lastSearchedText";
@@ -34,6 +39,7 @@
 
     private WikipediaApp app;
     private SearchView searchView;
+    private EditText searchEditText;
     private SearchFunnel funnel;
     public SearchFunnel getFunnel() {
         return funnel;
@@ -346,27 +352,50 @@
 
     private void setSearchViewEnabled(boolean enabled) {
         View searchButton = getActivity().findViewById(R.id.main_search_bar);
-        searchView = 
(SearchView)getActivity().findViewById(R.id.main_search_view);
         if (enabled) {
+            // set up the SearchView...
+            if (searchView == null) {
+                searchView = 
(SearchView)getActivity().findViewById(R.id.main_search_view);
+                searchView.setOnQueryTextListener(searchQueryListener);
+                searchView.setOnCloseListener(searchCloseListener);
+
+                searchEditText = (EditText) searchView
+                        
.findViewById(android.support.v7.appcompat.R.id.search_src_text);
+                // need to explicitly set text color (you're welcome, 2.3!).
+                searchEditText.setTextColor(getResources().getColor(
+                        Utils.getThemedAttributeId(getActivity(), 
R.attr.edit_text_color)));
+                // and make the text size be the same as the size of the 
search field
+                // placeholder in the main activity
+                searchEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, 
((TextView) getActivity()
+                        
.findViewById(R.id.main_search_bar_text)).getTextSize());
+                // reset its background
+                searchEditText.setBackgroundColor(Color.TRANSPARENT);
+                // make the search frame match_parent
+                View searchEditFrame = searchView
+                        
.findViewById(android.support.v7.appcompat.R.id.search_edit_frame);
+                LinearLayout.LayoutParams params = new 
LinearLayout.LayoutParams(
+                        ViewGroup.LayoutParams.MATCH_PARENT, 
ViewGroup.LayoutParams.MATCH_PARENT);
+                searchEditFrame.setLayoutParams(params);
+                // center the search text in it
+                searchEditText.setGravity(Gravity.CENTER_VERTICAL);
+                // and make the background of the search plate the same as our 
placeholder...
+                View searchPlate = searchView
+                        
.findViewById(android.support.v7.appcompat.R.id.search_plate);
+                
searchPlate.setBackgroundResource(Utils.getThemedAttributeId(getActivity(), 
R.attr.search_bar_shape));
+            }
+
+            updateZeroChrome();
             searchView.setIconified(false);
             searchView.requestFocusFromTouch();
-            searchView.setOnQueryTextListener(searchQueryListener);
-            searchView.setOnCloseListener(searchCloseListener);
-            searchView.setSubmitButtonEnabled(true);
-            updateZeroChrome();
-            EditText editText = getSearchViewEditText(searchView);
-            if (editText != null) {
-                // need to explicitly set text color (you're welcome, 2.3!).
-                
editText.setTextColor(getResources().getColor(Utils.getThemedAttributeId(getActivity(),
 R.attr.edit_text_color)));
-            }
+
             // if we already have a previous search query, then put it into 
the SearchView, and it will
             // automatically trigger the showing of the corresponding search 
results.
             if (isValidQuery(lastSearchedText)) {
                 searchView.setQuery(lastSearchedText, false);
                 // automatically select all text in the search field, so that 
typing a new character
                 // will clear it by default
-                if (editText != null) {
-                    editText.selectAll();
+                if (searchEditText != null) {
+                    searchEditText.selectAll();
                 }
             }
             searchButton.setVisibility(View.GONE);
@@ -377,33 +406,15 @@
         }
     }
 
-    /**
-     * Retrieve the EditText component from inside a SearchView widget, so 
that operations
-     * may be performed on the EditText, such as selecting text.
-     * @param parent SearchView from which to retrieve the EditText view.
-     * @return EditText view, or null if not found.
-     */
-    private EditText getSearchViewEditText(ViewGroup parent) {
-        for (int i = 0; i < parent.getChildCount(); i++) {
-            if (parent.getChildAt(i) instanceof EditText) {
-                return (EditText)parent.getChildAt(i);
-            } else if (parent.getChildAt(i) instanceof ViewGroup) {
-                EditText et = 
getSearchViewEditText((ViewGroup)parent.getChildAt(i));
-                if (et != null) {
-                    return et;
-                }
-            }
-        }
-        return null;
-    }
-
     /*
     Update any UI elements related to WP Zero
      */
     private void updateZeroChrome() {
-        if (searchView != null) {
-            searchView.setQueryHint(
-                    app.getWikipediaZeroHandler().isZeroEnabled() ? 
getString(R.string.zero_search_hint) : getString(R.string.search_hint));
+        if (searchEditText != null) {
+            // setting the hint directly on the search EditText (instead of 
the SearchView)
+            // gets rid of the magnify icon, which we don't want.
+            
searchEditText.setHint(app.getWikipediaZeroHandler().isZeroEnabled() ? 
getString(
+                    R.string.zero_search_hint) : 
getString(R.string.search_hint));
         }
     }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/179947
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic1ace7a314d80c46c48a4cf88a899f5fcebe8dcf
Gerrit-PatchSet: 5
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
Gerrit-Reviewer: BearND <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to