本文整理汇总了Java中com.miguelcatalan.materialsearchview.MaterialSearchView类的典型用法代码示例。如果您正苦于以下问题:Java MaterialSearchView类的具体用法?Java MaterialSearchView怎么用?Java MaterialSearchView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MaterialSearchView类属于com.miguelcatalan.materialsearchview包,在下文中一共展示了MaterialSearchView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initSearchView
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
private void initSearchView()
{
//初始化SearchBar
mSearchView.setVoiceSearch(false);
mSearchView.setCursorDrawable(R.drawable.custom_cursor);
mSearchView.setEllipsize(true);
mSearchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions));
mSearchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener()
{
@Override
public boolean onQueryTextSubmit(String query)
{
// TotalStationSearchActivity.launch(getActivity(), query);
return false;
}
@Override
public boolean onQueryTextChange(String newText)
{
return false;
}
});
}
示例2: onActivityResult
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == MaterialSearchView.REQUEST_VOICE && resultCode == Activity.RESULT_OK)
{
ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (matches != null && matches.size() > 0)
{
String searchWrd = matches.get(0);
if (!TextUtils.isEmpty(searchWrd))
{
mSearchView.setQuery(searchWrd, false);
}
}
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
示例3: initSearchView
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
private void initSearchView() {
//初始化SearchBar
mSearchView.setVoiceSearch(false);
mSearchView.setCursorDrawable(R.drawable.custom_cursor);
mSearchView.setEllipsize(true);
mSearchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions));
mSearchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
TotalStationSearchActivity.launch(getActivity(), query);
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
}
示例4: onActivityResult
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == MaterialSearchView.REQUEST_VOICE && resultCode == Activity.RESULT_OK) {
ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (matches != null && matches.size() > 0) {
String searchWrd = matches.get(0);
if (!TextUtils.isEmpty(searchWrd)) {
mSearchView.setQuery(searchWrd, false);
}
}
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
示例5: initSearchView
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
private void initSearchView() {
mSearchView.setVoiceSearch(false);
mSearchView.setCursorDrawable(R.drawable.custom_cursor);
mSearchView.setEllipsize(false);
mSearchView.setSuggestions(getResources().getStringArray(R.array.query_suggestions));
mSearchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
TotalStationSearchActivity.launch(getActivity(), query);
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
}
示例6: initSearchView
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
private void initSearchView() {
mSearchView.setVoiceSearch(false);
mSearchView.setCursorDrawable(R.drawable.shape_cursor);
mSearchView.setEllipsize(true);
mSearchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
SnackBarUtil.show(MainActivity.this, String.format(Locale.getDefault(), "哥,别搜%s了", query));
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
}
示例7: initSearchView
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
private void initSearchView() {
mSearchView.setVoiceSearch(false);
mSearchView.setCursorDrawable(R.drawable.shape_cursor);
mSearchView.setEllipsize(true);
mSearchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
SnackBarUtil.show(NormalActivity.this, String.format(Locale.getDefault(), "哥,别搜%s了", query));
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
return false;
}
});
}
示例8: onFinishInflate
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
View.inflate(getContext(), R.layout.merge_main_view, this);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.ic_menu_hamburger);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationView = (NavigationView) findViewById(R.id.nav_view);
logoutView = (NavigationView) navigationView.findViewById(R.id.logout_view);
View headerLayout = navigationView.getHeaderView(0);
profileImageView = (CircleImageView) headerLayout.findViewById(R.id.profileImageView);
nameTextView = (TextView) headerLayout.findViewById(R.id.nameTextView);
emailTextView = (TextView) headerLayout.findViewById(R.id.emailTextView);
searchView = (MaterialSearchView) findViewById(R.id.search_view);
}
示例9: onFinishInflate
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
@Override
protected void onFinishInflate() {
super.onFinishInflate();
View.inflate(getContext(), R.layout.merge_main_view, this);
toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.setNavigationIcon(R.drawable.ic_menu_hamburger);
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
navigationView = (NavigationView) findViewById(R.id.nav_view);
logoutView = (NavigationView) navigationView.findViewById(R.id.logout_view);
View headerLayout = navigationView.getHeaderView(0);
profileImageView = (CircularImageView) headerLayout.findViewById(R.id.profileImageView);
nameTextView = (TextView) headerLayout.findViewById(R.id.nameTextView);
emailTextView = (TextView) headerLayout.findViewById(R.id.emailTextView);
searchView = (MaterialSearchView) findViewById(R.id.search_view);
}
示例10: onActivityResult
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data)
{
//GESTION DE LA RECHERCHE VIA LA VOIX
if (requestCode == MaterialSearchView.REQUEST_VOICE && resultCode == RESULT_OK) {
ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (matches != null && matches.size() > 0) {
String searchWrd = matches.get(0);
if (!TextUtils.isEmpty(searchWrd)) {
searchView.setQuery(searchWrd, false);
}
}
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
示例11: initSearchView
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
private void initSearchView() {
searchView.setVoiceSearch(false);
searchView.setCursorDrawable(R.drawable.search_view_cursor);
searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override public boolean onQueryTextSubmit(final String query) {
Timber.d("pressed search icon");
searchTweets(query);
return false;
}
@Override public boolean onQueryTextChange(String newText) {
searchTweetsWithDelay(newText);
return false;
}
});
}
示例12: bindSearchView
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
@BindingAdapter("model")
public static void bindSearchView(final MaterialSearchView searchView, final SuggestionViewModel viewModel) {
final SuggestionAdapter adapter = new SuggestionAdapter(viewModel);
searchView.setAdapter(adapter);
searchView.addOnAttachStateChangeListener(new SubscribeActionOnAttachedStateChangeListener<>(
viewModel.didUpdateSuggestion(),
new Action1<Void>() {
@Override
public void call(Void aVoid) {
adapter.notifyDataSetChanged();
searchView.showSuggestions();
}
}
));
}
示例13: onPostCreate
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
@Override
public void onPostCreate(Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
toolbar.inflateMenu(R.menu.search);
searchView.setMenuItem(toolbar.getMenu().findItem(R.id.action_search));
searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
searchViewModel.setQuery(query);
searchView.closeSearch();
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
suggestionViewModel.setQuery(newText);
return false;
}
});
}
示例14: onActivityResult
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == MaterialSearchView.REQUEST_VOICE && resultCode == RESULT_OK){
ArrayList<String> matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS);
if (matches != null && matches.size() > 0){
String searchWord = matches.get(0);
if (!TextUtils.isEmpty(searchWord)){
mSearchView.setQuery(searchWord, false);
}
}
return;
}
super.onActivityResult(requestCode, resultCode, data);
}
示例15: initView
import com.miguelcatalan.materialsearchview.MaterialSearchView; //导入依赖的package包/类
private void initView() {
mToolbar = (Toolbar) findViewById(R.id.toolbar);
mRecyclerView = (RecyclerView) findViewById(R.id.recyclerview);
mSearchView = (MaterialSearchView) findViewById(R.id.search);
mTitle = (TextView) findViewById(R.id.title);
mAppBar = (AppBarLayout) findViewById(R.id.appbar);
}