fine tuned style of toolbar search view
This commit is contained in:
parent
d79f5030be
commit
a11c678770
|
@ -100,6 +100,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemActionExpand(MenuItem item) {
|
public boolean onMenuItemActionExpand(MenuItem item) {
|
||||||
mSearchEditText.post(() -> {
|
mSearchEditText.post(() -> {
|
||||||
|
updateSearchViewHint();
|
||||||
mSearchEditText.requestFocus();
|
mSearchEditText.requestFocus();
|
||||||
if (oneShotKeyboardSuppress.compareAndSet(true, false)) {
|
if (oneShotKeyboardSuppress.compareAndSet(true, false)) {
|
||||||
return;
|
return;
|
||||||
|
@ -543,6 +544,17 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
super.invalidateOptionsMenu();
|
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
|
@Override
|
||||||
public boolean onCreateOptionsMenu(Menu menu) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
getMenuInflater().inflate(R.menu.start_conversation, menu);
|
getMenuInflater().inflate(R.menu.start_conversation, menu);
|
||||||
|
@ -564,6 +576,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
|
||||||
mSearchEditText.append(initialSearchValue);
|
mSearchEditText.append(initialSearchValue);
|
||||||
filter(initialSearchValue);
|
filter(initialSearchValue);
|
||||||
}
|
}
|
||||||
|
updateSearchViewHint();
|
||||||
return super.onCreateOptionsMenu(menu);
|
return super.onCreateOptionsMenu(menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:addStatesFromChildren="true"
|
android:addStatesFromChildren="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:gravity="center"
|
android:gravity="center">
|
||||||
android:paddingLeft="5dp"
|
|
||||||
android:paddingRight="5dp">
|
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
android:id="@+id/search_field"
|
android:id="@+id/search_field"
|
||||||
|
@ -14,7 +12,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
android:hint="@string/search_for_contacts_or_groups"
|
|
||||||
android:imeOptions="actionSearch"
|
android:imeOptions="actionSearch"
|
||||||
android:inputType="textEmailAddress|textNoSuggestions"/>
|
android:inputType="textEmailAddress|textNoSuggestions"/>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2018, Daniel Gultsch All rights reserved.
|
||||||
|
~
|
||||||
|
~ Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
~ are permitted provided that the following conditions are met:
|
||||||
|
~
|
||||||
|
~ 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
~ list of conditions and the following disclaimer.
|
||||||
|
~
|
||||||
|
~ 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
~ this list of conditions and the following disclaimer in the documentation and/or
|
||||||
|
~ other materials provided with the distribution.
|
||||||
|
~
|
||||||
|
~ 3. Neither the name of the copyright holder nor the names of its contributors
|
||||||
|
~ may be used to endorse or promote products derived from this software without
|
||||||
|
~ specific prior written permission.
|
||||||
|
~
|
||||||
|
~ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
~ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
~ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
~ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
~ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
~ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
~ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
~ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
~ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
~ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<include
|
||||||
|
android:id="@+id/toolbar"
|
||||||
|
layout="@layout/toolbar"/>
|
||||||
|
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/search_results"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/color_background_secondary"
|
||||||
|
android:divider="@android:color/transparent"
|
||||||
|
android:dividerHeight="0dp"/>
|
||||||
|
</LinearLayout>
|
||||||
|
</layout>
|
|
@ -426,7 +426,8 @@
|
||||||
<string name="none">None</string>
|
<string name="none">None</string>
|
||||||
<string name="recently_used">Most recently used</string>
|
<string name="recently_used">Most recently used</string>
|
||||||
<string name="choose_quick_action">Choose quick action</string>
|
<string name="choose_quick_action">Choose quick action</string>
|
||||||
<string name="search_for_contacts_or_groups">Search for contacts or groups</string>
|
<string name="search_contacts">Search contacts</string>
|
||||||
|
<string name="search_groups">Search group chats</string>
|
||||||
<string name="send_private_message">Send private message</string>
|
<string name="send_private_message">Send private message</string>
|
||||||
<string name="user_has_left_conference">%1$s has left the group chat!</string>
|
<string name="user_has_left_conference">%1$s has left the group chat!</string>
|
||||||
<string name="username">Username</string>
|
<string name="username">Username</string>
|
||||||
|
|
|
@ -34,6 +34,8 @@
|
||||||
<style name="Widget.Conversations.SearchView" parent="Widget.Conversations.EditText">
|
<style name="Widget.Conversations.SearchView" parent="Widget.Conversations.EditText">
|
||||||
<item name="android:textColor">@color/white</item>
|
<item name="android:textColor">@color/white</item>
|
||||||
<item name="android:textColorHint">@color/white70</item>
|
<item name="android:textColorHint">@color/white70</item>
|
||||||
|
<item name="android:background">@android:color/transparent</item>
|
||||||
|
<item name="android:textSize">18sp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="Widget.Conversations.CheckBox" parent="Widget.AppCompat.CompoundButton.CheckBox">
|
<style name="Widget.Conversations.CheckBox" parent="Widget.AppCompat.CompoundButton.CheckBox">
|
||||||
|
|
Loading…
Reference in New Issue