Dbrant has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/179947

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).

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/search/SearchArticlesFragment.java
4 files changed, 30 insertions(+), 32 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/47/179947/1

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..8337076 100644
--- a/wikipedia/res/layout/activity_main.xml
+++ b/wikipedia/res/layout/activity_main.xml
@@ -72,7 +72,7 @@
                             android:paddingLeft="4dp"
                             android:paddingRight="4dp"
                             android:text="@string/search_hint"
-                            style="?android:textAppearanceMedium"
+                            android:textSize="16sp"
                             android:singleLine="true"
                             android:ellipsize="end"
                             android:layout_gravity="center_vertical"/>
@@ -80,9 +80,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="wrap_content"
+                        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 +102,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 019e64a..56ddb02 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/search/SearchArticlesFragment.java 
b/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
index f3874c9..c477504 100644
--- a/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
+++ b/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java
@@ -13,16 +13,19 @@
 
 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.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.EditText;
 import android.widget.ImageView;
+import android.widget.TextView;
 
 public class SearchArticlesFragment extends Fragment {
     private static final String ARG_LAST_SEARCHED_TEXT = "lastSearchedText";
@@ -352,13 +355,26 @@
             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)));
-            }
+
+            EditText editText = (EditText) searchView
+                    
.findViewById(android.support.v7.appcompat.R.id.search_src_text);
+            // need to explicitly set text color (you're welcome, 2.3!).
+            editText.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
+            editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, ((TextView) 
getActivity()
+                    .findViewById(R.id.main_search_bar_text)).getTextSize());
+            // make its background be the same as the placeholder...
+            editText.setBackgroundResource(
+                    Utils.getThemedAttributeId(getActivity(), 
R.attr.search_bar_shape));
+
+            // remove the underline from the SearchView plate...
+            View searchPlate = searchView
+                    
.findViewById(android.support.v7.appcompat.R.id.search_plate);
+            searchPlate.setBackgroundColor(Color.TRANSPARENT);
+
             // 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)) {
@@ -375,26 +391,6 @@
             searchView.setVisibility(View.GONE);
             searchButton.setVisibility(View.VISIBLE);
         }
-    }
-
-    /**
-     * 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;
     }
 
     /*

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic1ace7a314d80c46c48a4cf88a899f5fcebe8dcf
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>

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

Reply via email to