use of android.support.v7.app.ActionBar in project UltimateAndroid by cymcsg.
the class CustomViewActionbarActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
ActionBar actionBar = getSupportActionBar();
//使自定义的普通View能在title栏显示, actionBar.setCustomView能起作用.
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(getCustomActionBarView());
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayShowHomeEnabled(false);
}
use of android.support.v7.app.ActionBar in project cheesesquare by chrisbanes.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
if (navigationView != null) {
setupDrawerContent(navigationView);
}
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
if (viewPager != null) {
setupViewPager(viewPager);
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.v7.app.ActionBar 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.app.ActionBar 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);
}
use of android.support.v7.app.ActionBar in project Android-Iconics by mikepenz.
the class MainActivity 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.menu_main, menu);
//
menu.findItem(R.id.search).setIcon(new IconicsDrawable(this, MaterialDesignIconic.Icon.gmi_search).color(Color.WHITE).sizeDp(24).respectFontBounds(true));
if (android.os.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) {
search(s);
return true;
}
@Override
public boolean onQueryTextChange(String s) {
search(s);
return true;
}
private void search(String s) {
mCurrentSearch = s;
if (mDrawer != null) {
int count = 0;
for (ITypeface font : mFonts) {
int foundCount = 0;
if (font.getIcons() != null) {
for (String icon : font.getIcons()) {
if (icon.toLowerCase().contains(s.toLowerCase())) {
foundCount++;
}
}
}
mDrawer.updateBadge(count, new StringHolder(foundCount + ""));
count++;
}
}
//filter out the current fragment
if (mIconsFragment != null)
mIconsFragment.onSearch(s);
}
});
} else {
menu.findItem(R.id.search).setVisible(false);
}
MenuItem menuItem = menu.findItem(R.id.action_opensource);
menuItem.setIcon(new IconicsDrawable(this, FontAwesome.Icon.faw_github).actionBar().color(Color.WHITE));
return super.onCreateOptionsMenu(menu);
}
Aggregations