Use ActionView for main search view

This commit is contained in:
Moez Bhatti
2018-08-14 19:10:41 +02:00
parent 7be398ee06
commit 25580e88e8
7 changed files with 155 additions and 27 deletions
@@ -0,0 +1,27 @@
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
</vector>
@@ -32,7 +32,7 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:animateLayoutChanges="true"
android:elevation="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
app:layout_constraintEnd_toEndOf="parent"
@@ -41,16 +41,8 @@
<com.moez.QKSMS.common.widget.QkTextView
android:id="@+id/toolbarTitle"
style="@style/ToolbarText" />
<com.moez.QKSMS.common.widget.QkEditText
android:id="@+id/toolbarSearch"
style="@style/ToolbarText"
android:layout_marginEnd="16dp"
android:hint="@string/title_conversations"
android:textColorHint="?android:attr/textColorTertiary"
app:textSize="primary"
tools:textSize="16sp" />
tools:text="Conversations" />
</androidx.appcompat.widget.Toolbar>
@@ -93,14 +85,6 @@
app:layout_constraintEnd_toEndOf="parent"
tools:backgroundTint="@color/tools_theme" />
<View
android:layout_width="0dp"
android:layout_height="8dp"
android:background="@drawable/ab_shadow"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/toolbar" />
<View
android:id="@+id/bottom"
android:layout_width="match_parent"
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (C) 2017 Moez Bhatti <moez.bhatti@gmail.com>
~
~ This file is part of QKSMS.
~
~ QKSMS is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ QKSMS is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
-->
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:parentTag="com.moez.QKSMS.common.widget.SearchView">
<com.moez.QKSMS.common.widget.QkEditText
android:id="@+id/query"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:hint="@string/title_conversations"
android:textColor="?android:attr/textColorPrimary"
android:textColorHint="?android:attr/textColorTertiary"
app:textSize="primary" />
</merge>
+7
View File
@@ -19,6 +19,13 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/search"
android:icon="@drawable/ic_search_black_24dp"
android:title="@string/main_menu_search"
app:actionViewClass="com.moez.QKSMS.common.widget.SearchView"
app:showAsAction="always|collapseActionView" />
<item
android:id="@+id/archive"
android:icon="@drawable/ic_archive_black_24dp"
@@ -35,8 +35,10 @@
<string name="menu_info">Details</string>
<string name="menu_save">Save to gallery</string>
<string name="main_title">Inbox</string>
<string name="main_drawer_open_cd">Open navigation drawer</string>
<string name="main_title_selected">%d selected</string>
<string name="main_menu_search">Search</string>
<string name="main_menu_clear">Clear</string>
<string name="main_menu_archive">Archive</string>
<string name="main_menu_unarchive">Unarchive</string>