mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-05 18:25:39 +00:00
Search support in ConversationList for <3.0 devices.
Switch to the newly-introduced ActionBarSherlock SearchView.
This commit is contained in:
parent
c7e6a2afeb
commit
2397176d9e
@ -4,7 +4,7 @@
|
|||||||
<item android:title="@string/conversation_list__menu_search"
|
<item android:title="@string/conversation_list__menu_search"
|
||||||
android:id="@+id/menu_search"
|
android:id="@+id/menu_search"
|
||||||
android:icon="@drawable/ic_menu_search_holo_dark"
|
android:icon="@drawable/ic_menu_search_holo_dark"
|
||||||
android:actionViewClass="android.widget.SearchView"
|
android:actionViewClass="com.actionbarsherlock.widget.SearchView"
|
||||||
android:showAsAction="ifRoom|collapseActionView" />
|
android:showAsAction="ifRoom|collapseActionView" />
|
||||||
|
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -16,14 +16,12 @@
|
|||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v4.app.LoaderManager;
|
import android.support.v4.app.LoaderManager;
|
||||||
import android.support.v4.content.Loader;
|
import android.support.v4.content.Loader;
|
||||||
@ -45,6 +43,7 @@ import com.actionbarsherlock.view.ActionMode;
|
|||||||
import com.actionbarsherlock.view.Menu;
|
import com.actionbarsherlock.view.Menu;
|
||||||
import com.actionbarsherlock.view.MenuInflater;
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
import com.actionbarsherlock.view.MenuItem;
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
import com.actionbarsherlock.widget.SearchView;
|
||||||
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -83,9 +82,9 @@ public class ConversationListFragment extends SherlockListFragment
|
|||||||
public void onPrepareOptionsMenu(Menu menu) {
|
public void onPrepareOptionsMenu(Menu menu) {
|
||||||
MenuInflater inflater = this.getSherlockActivity().getSupportMenuInflater();
|
MenuInflater inflater = this.getSherlockActivity().getSupportMenuInflater();
|
||||||
|
|
||||||
if (this.masterSecret != null && Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
|
if (this.masterSecret != null) {
|
||||||
inflater.inflate(R.menu.conversation_list, menu);
|
inflater.inflate(R.menu.conversation_list, menu);
|
||||||
initializeSearch((android.widget.SearchView)menu.findItem(R.id.menu_search).getActionView());
|
initializeSearch((SearchView)menu.findItem(R.id.menu_search).getActionView());
|
||||||
} else {
|
} else {
|
||||||
inflater.inflate(R.menu.conversation_list_empty, menu);
|
inflater.inflate(R.menu.conversation_list_empty, menu);
|
||||||
}
|
}
|
||||||
@ -108,9 +107,8 @@ public class ConversationListFragment extends SherlockListFragment
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint({ "NewApi", "NewApi" })
|
private void initializeSearch(SearchView searchView) {
|
||||||
private void initializeSearch(android.widget.SearchView searchView) {
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
searchView.setOnQueryTextListener(new android.widget.SearchView.OnQueryTextListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextSubmit(String query) {
|
public boolean onQueryTextSubmit(String query) {
|
||||||
ConversationListFragment.this.queryFilter = query;
|
ConversationListFragment.this.queryFilter = query;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user