Mholloway has uploaded a new change for review. https://gerrit.wikimedia.org/r/224512
Change subject: Refine design of search bar language selection button ...................................................................... Refine design of search bar language selection button Bug: T73136 Change-Id: Ic016c5d67130d1636a5948df0bfc85709c4aef70 --- M wikipedia/res/drawable/lang_button_shape.xml M wikipedia/res/layout/activity_page.xml M wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java 3 files changed, 31 insertions(+), 9 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia refs/changes/12/224512/1 diff --git a/wikipedia/res/drawable/lang_button_shape.xml b/wikipedia/res/drawable/lang_button_shape.xml index 25016b6..0d8f59d 100644 --- a/wikipedia/res/drawable/lang_button_shape.xml +++ b/wikipedia/res/drawable/lang_button_shape.xml @@ -3,10 +3,8 @@ android:shape="rectangle" > <corners - android:radius="7dp" /> + android:radius="4dp" /> - <stroke - android:width="1dp" - android:color="@android:color/darker_gray" /> - + <solid + android:color="#aaaaaa" /> </shape> \ No newline at end of file diff --git a/wikipedia/res/layout/activity_page.xml b/wikipedia/res/layout/activity_page.xml index 1d928fe..880c861 100644 --- a/wikipedia/res/layout/activity_page.xml +++ b/wikipedia/res/layout/activity_page.xml @@ -119,8 +119,12 @@ app:cabEnabled="false" /> <Button android:id="@+id/search_lang_button" - android:layout_width="36dp" - android:layout_height="36dp" + android:layout_width="24dp" + android:layout_height="24dp" + android:layout_marginTop="6dp" + android:layout_marginBottom="6dp" + android:layout_marginRight="16dp" + android:layout_marginEnd="16dp" android:gravity="center" android:background="@drawable/lang_button_shape" style="@style/AppTheme.ActionModeStyle" diff --git a/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java b/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java index de8837b..3807de2 100644 --- a/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java +++ b/wikipedia/src/main/java/org/wikipedia/search/SearchArticlesFragment.java @@ -17,6 +17,7 @@ import android.app.AlertDialog; import android.content.DialogInterface; import android.graphics.Color; +import android.graphics.Rect; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.SearchView; @@ -25,6 +26,7 @@ import android.util.TypedValue; import android.view.Gravity; import android.view.LayoutInflater; +import android.view.TouchDelegate; import android.view.View; import android.view.ViewGroup; import android.widget.Button; @@ -286,11 +288,13 @@ LinearLayout enabledSearchBar = (LinearLayout) getActivity().findViewById(R.id.search_bar_enabled); TextView searchButton = (TextView) getActivity().findViewById(R.id.main_search_bar_text); langButton = (Button) getActivity().findViewById(R.id.search_lang_button); + final int langButtonExtraTouchArea = 12; if (enabled) { // set up the language picker langButton.setText(app.getAppOrSystemLanguageCode()); formatLangButtonText(); + expandTouchArea(langButton, langButtonExtraTouchArea); langButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { @@ -454,8 +458,8 @@ final int langButtonTextMaxLength = 7; // These values represent scaled pixels (sp) - final int langButtonTextSizeSmaller = 10; - final int langButtonTextSizeLarger = 12; + final int langButtonTextSizeSmaller = 8; + final int langButtonTextSizeLarger = 10; String langCode = app.getAppOrSystemLanguageCode(); if (langCode.length() > langCodeStandardLength) { @@ -467,4 +471,20 @@ } langButton.setTextSize(langButtonTextSizeLarger); } + + public static void expandTouchArea(final View view, final int extraPadding) { + final View parent = (View) view.getParent(); + parent.post(new Runnable() { + @Override + public void run() { + final Rect rect = new Rect(); + view.getHitRect(rect); + rect.left -= extraPadding; + rect.right += extraPadding; + rect.top -= extraPadding; + rect.bottom += extraPadding; + parent.setTouchDelegate(new TouchDelegate(rect, view)); + } + }); + } } -- To view, visit https://gerrit.wikimedia.org/r/224512 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic016c5d67130d1636a5948df0bfc85709c4aef70 Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Mholloway <mhollo...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits