Search in sources :

Example 1 with ActionBar

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);
}
Also used : ActionBar(android.support.v7.app.ActionBar)

Example 2 with ActionBar

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);
}
Also used : NavigationView(android.support.design.widget.NavigationView) TabLayout(android.support.design.widget.TabLayout) FloatingActionButton(android.support.design.widget.FloatingActionButton) ViewPager(android.support.v4.view.ViewPager) NavigationView(android.support.design.widget.NavigationView) View(android.view.View) AdapterView(android.widget.AdapterView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 3 with ActionBar

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);
}
Also used : SearchView(android.support.v7.widget.SearchView) MenuInflater(android.view.MenuInflater) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Example 4 with ActionBar

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);
}
Also used : SearchView(android.support.v7.widget.SearchView) MenuInflater(android.view.MenuInflater) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Example 5 with ActionBar

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);
}
Also used : StringHolder(com.mikepenz.materialdrawer.holder.StringHolder) SearchView(android.support.v7.widget.SearchView) MenuInflater(android.view.MenuInflater) ITypeface(com.mikepenz.iconics.typeface.ITypeface) MenuItem(android.view.MenuItem) IconicsDrawable(com.mikepenz.iconics.IconicsDrawable)

Aggregations

ActionBar (android.support.v7.app.ActionBar)788 View (android.view.View)248 Toolbar (android.support.v7.widget.Toolbar)218 TextView (android.widget.TextView)160 Intent (android.content.Intent)118 ImageView (android.widget.ImageView)76 AppCompatActivity (android.support.v7.app.AppCompatActivity)70 RecyclerView (android.support.v7.widget.RecyclerView)57 AdapterView (android.widget.AdapterView)52 Bundle (android.os.Bundle)49 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)49 ListView (android.widget.ListView)44 ColorDrawable (android.graphics.drawable.ColorDrawable)33 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)32 ViewPager (android.support.v4.view.ViewPager)29 ArrayList (java.util.ArrayList)29 SharedPreferences (android.content.SharedPreferences)28 Fragment (android.support.v4.app.Fragment)28 MenuItem (android.view.MenuItem)28 BindView (butterknife.BindView)28