mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-24 08:38:51 -05:00
First pass at adding "Searchable" infrastructure
This commit is contained in:
parent
9ba102599f
commit
151ae5a2a3
@ -27,6 +27,9 @@
|
||||
<uses-permission android:name="com.fsck.k9.permission.READ_ATTACHMENT"/>
|
||||
<application android:icon="@drawable/icon" android:label="@string/app_name" android:name="K9"
|
||||
>
|
||||
<meta-data android:name="android.app.default_searchable"
|
||||
android:value=".Search" />
|
||||
|
||||
<activity
|
||||
android:name="com.fsck.k9.activity.Accounts"
|
||||
android:label="@string/app_name">
|
||||
@ -183,6 +186,17 @@
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Search Activity - searchable -->
|
||||
<activity android:name="Search"
|
||||
android:label="@string/search_action"
|
||||
android:launchMode="singleTop">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.searchable"
|
||||
android:resource="@xml/searchable" />
|
||||
</activity>
|
||||
<receiver android:name="com.fsck.k9.service.BootReceiver"
|
||||
android:enabled="true"
|
||||
>
|
||||
|
4
res/xml/searchable.xml
Normal file
4
res/xml/searchable.xml
Normal file
@ -0,0 +1,4 @@
|
||||
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:label="@string/search_action"
|
||||
android:hint="@string/search_action" >
|
||||
</searchable>
|
@ -1273,6 +1273,23 @@ public class LocalStore extends Store implements Serializable
|
||||
|
||||
}
|
||||
|
||||
public Message[] searchForMessages(MessageRetrievalListener listener, String queryString) throws MessagingException {
|
||||
return getMessages(
|
||||
listener,
|
||||
"SELECT "
|
||||
+ GET_MESSAGES_COLS
|
||||
+ "FROM messages WHERE html_content LIKE ? OR subject LIKE ? OR sender_list LIKE ? ORDER BY date DESC"
|
||||
, new String[]
|
||||
{
|
||||
queryString,
|
||||
queryString,
|
||||
queryString
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a query string, actually do the query for the messages and
|
||||
* call the MessageRetrievalListener for each one
|
||||
|
Loading…
Reference in New Issue
Block a user