|
|
@ -31,6 +31,7 @@ import android.content.IntentFilter;
|
|
|
|
import android.content.IntentSender;
|
|
|
|
import android.content.IntentSender;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.content.SharedPreferences;
|
|
|
|
import android.database.Cursor;
|
|
|
|
import android.database.Cursor;
|
|
|
|
|
|
|
|
import android.database.MatrixCursor;
|
|
|
|
import android.graphics.Canvas;
|
|
|
|
import android.graphics.Canvas;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.Color;
|
|
|
|
import android.graphics.PorterDuff;
|
|
|
|
import android.graphics.PorterDuff;
|
|
|
@ -69,6 +70,7 @@ import android.webkit.WebSettings;
|
|
|
|
import android.webkit.WebView;
|
|
|
|
import android.webkit.WebView;
|
|
|
|
import android.webkit.WebViewClient;
|
|
|
|
import android.webkit.WebViewClient;
|
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
import android.widget.ArrayAdapter;
|
|
|
|
|
|
|
|
import android.widget.AutoCompleteTextView;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.CheckBox;
|
|
|
|
import android.widget.ImageButton;
|
|
|
|
import android.widget.ImageButton;
|
|
|
@ -2282,11 +2284,30 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
searchView.setQuery(searching, false);
|
|
|
|
searchView.setQuery(searching, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AutoCompleteTextView autoCompleteTextView = searchView.findViewById(androidx.appcompat.R.id.search_src_text);
|
|
|
|
|
|
|
|
autoCompleteTextView.setThreshold(0);
|
|
|
|
|
|
|
|
|
|
|
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
|
|
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean onQueryTextChange(String newText) {
|
|
|
|
public boolean onQueryTextChange(String newText) {
|
|
|
|
searching = newText;
|
|
|
|
searching = newText;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(newText)) {
|
|
|
|
|
|
|
|
MatrixCursor cursor = new MatrixCursor(new String[]{"_id", "suggestion"});
|
|
|
|
|
|
|
|
String prefix = getString(R.string.title_search_special_prefix);
|
|
|
|
|
|
|
|
cursor.addRow(new Object[]{-1, prefix + ":" + getString(R.string.title_search_special_unseen)});
|
|
|
|
|
|
|
|
cursor.addRow(new Object[]{-2, prefix + ":" + getString(R.string.title_search_special_flagged)});
|
|
|
|
|
|
|
|
cursor.addRow(new Object[]{-3, prefix + ":" + getString(R.string.title_search_special_snoozed)});
|
|
|
|
|
|
|
|
SimpleCursorAdapter adapter = new SimpleCursorAdapter(
|
|
|
|
|
|
|
|
getContext(),
|
|
|
|
|
|
|
|
R.layout.search_suggestion,
|
|
|
|
|
|
|
|
cursor,
|
|
|
|
|
|
|
|
new String[]{"suggestion"},
|
|
|
|
|
|
|
|
new int[]{android.R.id.text1},
|
|
|
|
|
|
|
|
0);
|
|
|
|
|
|
|
|
searchView.setSuggestionsAdapter(adapter);
|
|
|
|
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
|
|
|
|
} else {
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
Bundle args = new Bundle();
|
|
|
|
args.putString("query", newText);
|
|
|
|
args.putString("query", newText);
|
|
|
|
|
|
|
|
|
|
|
@ -2318,6 +2339,7 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|
|
|
Helper.unexpectedError(getFragmentManager(), ex);
|
|
|
|
Helper.unexpectedError(getFragmentManager(), ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}.execute(FragmentMessages.this, args, "messages:suggestions");
|
|
|
|
}.execute(FragmentMessages.this, args, "messages:suggestions");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|