From 100b9f0a4716adaa7b156883e88da1fbc7efec62 Mon Sep 17 00:00:00 2001 From: Vavassor Date: Thu, 22 Jun 2017 02:00:03 -0400 Subject: [PATCH] Extends the width of the search view. --- .../main/java/com/keylesspalace/tusky/SearchActivity.java | 5 ++++- app/src/main/res/layout/activity_search.xml | 3 ++- app/src/main/res/layout/search_view.xml | 8 ++++++++ app/src/main/res/menu/search_toolbar.xml | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 app/src/main/res/layout/search_view.xml diff --git a/app/src/main/java/com/keylesspalace/tusky/SearchActivity.java b/app/src/main/java/com/keylesspalace/tusky/SearchActivity.java index 141e18df..f75b33ac 100644 --- a/app/src/main/java/com/keylesspalace/tusky/SearchActivity.java +++ b/app/src/main/java/com/keylesspalace/tusky/SearchActivity.java @@ -89,7 +89,8 @@ public class SearchActivity extends BaseActivity implements SearchView.OnQueryTe super.onCreateOptionsMenu(menu); getMenuInflater().inflate(R.menu.search_toolbar, menu); - SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); + SearchView searchView = (SearchView) menu.findItem(R.id.action_search) + .getActionView(); setupSearchView(searchView); if (currentQuery != null) { @@ -160,6 +161,8 @@ public class SearchActivity extends BaseActivity implements SearchView.OnQueryTe searchView.setOnQueryTextListener(this); searchView.setFocusable(false); searchView.setFocusableInTouchMode(false); + + searchView.setMaxWidth(Integer.MAX_VALUE); } private void search(String query) { diff --git a/app/src/main/res/layout/activity_search.xml b/app/src/main/res/layout/activity_search.xml index 81ae2b0b..04ec3127 100644 --- a/app/src/main/res/layout/activity_search.xml +++ b/app/src/main/res/layout/activity_search.xml @@ -16,7 +16,8 @@ android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/toolbar_background_color" - app:navigationIcon="?attr/homeAsUpIndicator" /> + app:navigationIcon="?attr/homeAsUpIndicator" + app:contentInsetStartWithNavigation="0dp" /> + \ No newline at end of file diff --git a/app/src/main/res/menu/search_toolbar.xml b/app/src/main/res/menu/search_toolbar.xml index 172a1208..31a7f860 100644 --- a/app/src/main/res/menu/search_toolbar.xml +++ b/app/src/main/res/menu/search_toolbar.xml @@ -6,5 +6,6 @@ android:title="@string/action_search" android:icon="@android:drawable/ic_menu_search" app:actionViewClass="android.support.v7.widget.SearchView" + android:actionLayout="@layout/search_view" app:showAsAction="always" /> \ No newline at end of file