From a11c678770cd32f67cca7dc9321aa4c30148038a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Tue, 24 Apr 2018 16:45:37 +0200 Subject: [PATCH] fine tuned style of toolbar search view --- .../ui/StartConversationActivity.java | 13 +++++ src/main/res/layout/actionview_search.xml | 5 +- src/main/res/layout/activity_search.xml | 51 +++++++++++++++++++ src/main/res/values/strings.xml | 3 +- src/main/res/values/styles.xml | 2 + 5 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 src/main/res/layout/activity_search.xml diff --git a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java index 5ee20b8f4..48a513dec 100644 --- a/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/StartConversationActivity.java @@ -100,6 +100,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne @Override public boolean onMenuItemActionExpand(MenuItem item) { mSearchEditText.post(() -> { + updateSearchViewHint(); mSearchEditText.requestFocus(); if (oneShotKeyboardSuppress.compareAndSet(true, false)) { return; @@ -543,6 +544,17 @@ public class StartConversationActivity extends XmppActivity implements XmppConne super.invalidateOptionsMenu(); } + private void updateSearchViewHint() { + if (binding == null || mSearchEditText == null) { + return; + } + if (binding.startConversationViewPager.getCurrentItem() == 0) { + mSearchEditText.setHint(R.string.search_contacts); + } else { + mSearchEditText.setHint(R.string.search_groups); + } + } + @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.start_conversation, menu); @@ -564,6 +576,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne mSearchEditText.append(initialSearchValue); filter(initialSearchValue); } + updateSearchViewHint(); return super.onCreateOptionsMenu(menu); } diff --git a/src/main/res/layout/actionview_search.xml b/src/main/res/layout/actionview_search.xml index 2c35438c7..9cee924e0 100644 --- a/src/main/res/layout/actionview_search.xml +++ b/src/main/res/layout/actionview_search.xml @@ -4,9 +4,7 @@ android:layout_height="wrap_content" android:addStatesFromChildren="true" android:focusable="true" - android:gravity="center" - android:paddingLeft="5dp" - android:paddingRight="5dp"> + android:gravity="center"> diff --git a/src/main/res/layout/activity_search.xml b/src/main/res/layout/activity_search.xml new file mode 100644 index 000000000..b234ad7be --- /dev/null +++ b/src/main/res/layout/activity_search.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 35e1c5440..a0338a4f0 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -426,7 +426,8 @@ None Most recently used Choose quick action - Search for contacts or groups + Search contacts + Search group chats Send private message %1$s has left the group chat! Username diff --git a/src/main/res/values/styles.xml b/src/main/res/values/styles.xml index e236a2943..3a163b9a8 100644 --- a/src/main/res/values/styles.xml +++ b/src/main/res/values/styles.xml @@ -34,6 +34,8 @@