use of android.support.v7.widget.SearchView in project ToolBarLib by jjhesk.
the class TopBarManagerExample method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.general);
toolbar = (Toolbar) findViewById(R.id.toolbar);
try {
worker = TopBarManager.Builder.with(this).companyLogo(R.drawable.starz_logo).searchBarEvents(new SimpleSearchCallBack() {
@Override
public void onKeySearchStartConfirm(String text) {
Log.d("start", text);
}
@Override
public void onKeySearchLetter(String text) {
Log.d("start", text);
}
@Override
public void onRestoreToNormal(ActionBar toolbar) {
worker.showBack();
}
@Override
public void onPressSearchButton(ActionBar toolbar) {
Log.d("tolk", toolbar.toString());
}
}).burgerIcon(R.drawable.ic_burger).searchMagnetifyIcon(R.drawable.ic_search_action_icn).searchView(LayoutAsset.classic_3).searchCancelColorId(R.color.amber_a100).searchCancalIconColorId(R.mipmap.cross_mi).setLiveIcon(R.layout.dynamic_icon_p, R.mipmap.crossmp).background(R.drawable.actionbar_bg_dark_black).searchArea(R.drawable.search_area).build(toolbar);
toolbar.setTitleTextColor(Color.WHITE);
worker.showCompanyLogo();
dynamic_icon = worker.getDynamicIcon();
} catch (Exception e) {
e.printStackTrace();
}
Button b = (Button) findViewById(R.id.b3);
b.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
worker.triggerfromSearchIcon();
}
});
social = (combar) findViewById(R.id.social_bar_component);
social.connectAlert(getFragmentManager()).setShareContent("Share item now", "This is the best to share the items", "http://www.wonderful.com");
}
use of android.support.v7.widget.SearchView in project ToolBarLib by jjhesk.
the class BeastBarDemo_v1 method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.general);
Toolbar temp = (Toolbar) findViewById(R.id.toolbar);
combar cBar = (combar) findViewById(R.id.social_bar_component);
cBar.setShareContent("exiting news", "this is the bredf", "http://www.popbee.com");
BeastBar.Builder bb = new BeastBar.Builder();
bb.back(R.drawable.ic_m_back);
bb.companyIcon(R.drawable.starz_logo);
bb.background(R.drawable.actionbar_bg_dark_black);
bb.search(R.drawable.ic_find_mg);
bb.setToolBarTitleSize(R.dimen.tb_title);
bb.defaultTitle("Wrtie Comment");
bb.setFontFace(this, "Pacifico.ttf");
bb.setToolBarTitleColor(R.color.amber_700);
bb.enableLogoAnimation(false);
toolbar = BeastBar.withToolbar(this, temp, bb);
searchView = (MaterialSearchView) findViewById(R.id.cmarterialsearch);
searchView.setVoiceSearch(true);
searchView.setCursorDrawable(R.drawable.color_cursor_white);
// searchView.setSuggestions(getSuggestions());
searchView.setOnQueryTextListener(new MaterialSearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
// searchSubmission(query);
return false;
}
@Override
public boolean onQueryTextChange(String newText) {
//Do some magic
return false;
}
});
//show title
Button b1 = (Button) findViewById(R.id.b1);
//how main bar
Button b2 = (Button) findViewById(R.id.b2);
//show search bar
Button b3 = (Button) findViewById(R.id.b3);
//other function
Button b4 = (Button) findViewById(R.id.b4);
b4.setText("show back");
//other function
Button b5 = (Button) findViewById(R.id.b5);
b5.setText("remove back");
//other function
Button bx = (Button) findViewById(R.id.bxx);
//other function
Button bs = (Button) findViewById(R.id.b_search);
//other function
Button search_off = (Button) findViewById(R.id.search_off);
//other function
Button search_on = (Button) findViewById(R.id.search_on);
bx.setText("close this App");
b1.setOnClickListener(this);
b2.setOnClickListener(this);
b3.setOnClickListener(this);
b4.setOnClickListener(this);
b5.setOnClickListener(this);
bx.setOnClickListener(this);
bs.setOnClickListener(this);
search_off.setOnClickListener(this);
search_on.setOnClickListener(this);
toolbar.setFindIconFunc(new ButtonCon());
}
use of android.support.v7.widget.SearchView in project materialistic by hidroh.
the class FavoriteActivityTest method testSearchView.
@Test
public void testSearchView() {
SearchView searchView = (SearchView) actionViewResolver.getActionView(mock(MenuItem.class));
verify(searchView, atLeastOnce()).setOnSearchClickListener(searchViewClickListener.capture());
verify(searchView, atLeastOnce()).setOnCloseListener(searchViewCloseListener.capture());
searchViewClickListener.getAllValues().get(searchViewClickListener.getAllValues().size() - 1).onClick(searchView);
assertFalse(((FavoriteFragment) fragment).startActionMode(null));
SearchView.OnCloseListener closeListener = searchViewCloseListener.getAllValues().get(searchViewCloseListener.getAllValues().size() - 1);
closeListener.onClose();
assertEquals(2, adapter.getItemCount());
((FavoriteFragment) fragment).filter("ask");
verify(favoriteManager, times(2)).attach(any(Context.class), any(LoaderManager.class), observerCaptor.capture(), any());
when(favoriteManager.getSize()).thenReturn(1);
when(favoriteManager.getItem(eq(0))).thenReturn(new TestFavorite("2", "http://example.com", "ask HN", System.currentTimeMillis()));
observerCaptor.getValue().onChanged();
assertEquals(1, adapter.getItemCount());
reset(searchView);
closeListener.onClose();
verify(searchView).setQuery(eq(FavoriteActivity.EMPTY_QUERY), eq(true));
}
use of android.support.v7.widget.SearchView in project FastAdapter by mikepenz.
the class EndlessScrollListActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.search, menu);
//search icon
menu.findItem(R.id.search).setIcon(new IconicsDrawable(this, MaterialDesignIconic.Icon.gmi_search).color(Color.BLACK).actionBar());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
final SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
touchCallback.setIsDragEnabled(false);
fastItemAdapter.filter(s);
return true;
}
@Override
public boolean onQueryTextChange(String s) {
fastItemAdapter.filter(s);
touchCallback.setIsDragEnabled(TextUtils.isEmpty(s));
return true;
}
});
} else {
menu.findItem(R.id.search).setVisible(false);
}
return super.onCreateOptionsMenu(menu);
}
use of android.support.v7.widget.SearchView in project FastAdapter by mikepenz.
the class SwipeListActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu items for use in the action bar
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.search, menu);
//search icon
menu.findItem(R.id.search).setIcon(new IconicsDrawable(this, MaterialDesignIconic.Icon.gmi_search).color(Color.BLACK).actionBar());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
final SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
touchCallback.setIsDragEnabled(false);
fastItemAdapter.filter(s);
return true;
}
@Override
public boolean onQueryTextChange(String s) {
fastItemAdapter.filter(s);
touchCallback.setIsDragEnabled(TextUtils.isEmpty(s));
return true;
}
});
} else {
menu.findItem(R.id.search).setVisible(false);
}
return super.onCreateOptionsMenu(menu);
}
Aggregations