Search in sources :

Example 1 with Toolbar

use of android.support.v7.widget.Toolbar in project photo-picker-plus-android by chute.

the class BaseActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setEnterTransition(new Explode());
        getWindow().setExitTransition(new Explode());
    }
    setContentView(getLayoutResource());
    Toolbar toolBar = (Toolbar) findViewById(R.id.toolbar);
    if (toolBar != null) {
        toolBar.bringToFront();
        setSupportActionBar(toolBar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setIcon(new ColorDrawable(android.R.color.transparent));
        getSupportActionBar().setTitle(R.string.choose_service);
        setToolBar(toolBar);
    }
}
Also used : Explode(android.transition.Explode) ColorDrawable(android.graphics.drawable.ColorDrawable) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with Toolbar

use of android.support.v7.widget.Toolbar 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 Toolbar

use of android.support.v7.widget.Toolbar in project cheesesquare by chrisbanes.

the class CheeseDetailActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_detail);
    Intent intent = getIntent();
    final String cheeseName = intent.getStringExtra(EXTRA_NAME);
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbar.setTitle(cheeseName);
    loadBackdrop();
}
Also used : CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) Intent(android.content.Intent) Toolbar(android.support.v7.widget.Toolbar)

Example 4 with Toolbar

use of android.support.v7.widget.Toolbar in project nmid-headline by miao1007.

the class NavigationDrawerFragment method setUp.

public void setUp(DrawerLayout drawerLayout, Toolbar toolbar) {
    mDrawerLayout = drawerLayout;
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);
    mDrawerLayout.setStatusBarBackground(R.color.primarg_bg);
    mDrawerToggle = new ActionBarDrawerToggle(getActivity(), mDrawerLayout, toolbar, R.string.open, R.string.close) {

        @Override
        public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            if (!isAdded()) {
                return;
            }
            getActivity().invalidateOptionsMenu();
        }

        @Override
        public void onDrawerOpened(View drawerView) {
            super.onDrawerOpened(drawerView);
            if (!isAdded()) {
                return;
            }
            if (!mUserLearnedDrawer) {
                mUserLearnedDrawer = true;
                SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
                sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).commit();
            }
            getActivity().invalidateOptionsMenu();
        }
    };
    if (!mUserLearnedDrawer && !mFromSavedInstanceState) {
        mDrawerLayout.openDrawer(Gravity.START);
    }
    mDrawerLayout.post(new Runnable() {

        @Override
        public void run() {
            mDrawerToggle.syncState();
        }
    });
    mDrawerLayout.setDrawerListener(mDrawerToggle);
}
Also used : SharedPreferences(android.content.SharedPreferences) ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) ImageView(android.widget.ImageView) InjectView(butterknife.InjectView) View(android.view.View) TextView(android.widget.TextView) ListView(android.widget.ListView)

Example 5 with Toolbar

use of android.support.v7.widget.Toolbar in project FastAdapter by mikepenz.

the class EndlessScrollListActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    findViewById(android.R.id.content).setSystemUiVisibility(findViewById(android.R.id.content).getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_sample);
    // Handle Toolbar
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    //style our ui
    new MaterializeBuilder().withActivity(this).build();
    //create our FastAdapter which will manage everything
    fastItemAdapter = new FastItemAdapter<>();
    fastItemAdapter.withSelectable(true);
    //create our FooterAdapter which will manage the progress items
    footerAdapter = new FooterAdapter<>();
    //configure our fastAdapter
    fastItemAdapter.withOnClickListener(new FastAdapter.OnClickListener<SimpleItem>() {

        @Override
        public boolean onClick(View v, IAdapter<SimpleItem> adapter, SimpleItem item, int position) {
            Toast.makeText(v.getContext(), (item).name.getText(v.getContext()), Toast.LENGTH_LONG).show();
            return false;
        }
    });
    //configure the itemAdapter
    fastItemAdapter.withFilterPredicate(new IItemAdapter.Predicate<SimpleItem>() {

        @Override
        public boolean filter(SimpleItem item, CharSequence constraint) {
            //return false to keep it
            return !item.name.getText().toLowerCase().contains(constraint.toString().toLowerCase());
        }
    });
    fastItemAdapter.getItemAdapter().withItemFilterListener(this);
    //get our recyclerView and do basic setup
    RecyclerView recyclerView = (RecyclerView) findViewById(R.id.rv);
    recyclerView.setLayoutManager(new LinearLayoutManager(this));
    recyclerView.setItemAnimator(new DefaultItemAnimator());
    recyclerView.setAdapter(footerAdapter.wrap(fastItemAdapter));
    recyclerView.addOnScrollListener(new EndlessRecyclerOnScrollListener(footerAdapter) {

        @Override
        public void onLoadMore(final int currentPage) {
            footerAdapter.clear();
            footerAdapter.add(new ProgressItem().withEnabled(false));
            //simulate networking (2 seconds)
            Handler handler = new Handler();
            handler.postDelayed(new Runnable() {

                @Override
                public void run() {
                    footerAdapter.clear();
                    for (int i = 1; i < 16; i++) {
                        fastItemAdapter.add(fastItemAdapter.getAdapterItemCount(), new SimpleItem().withName("Item " + i + " Page " + currentPage));
                    }
                }
            }, 2000);
        }
    });
    //fill with some sample data (load the first page here)
    List<SimpleItem> items = new ArrayList<>();
    for (int i = 1; i < 16; i++) {
        items.add(new SimpleItem().withName("Item " + i + " Page " + 1));
    }
    fastItemAdapter.add(items);
    //add drag and drop for item
    touchCallback = new SimpleDragCallback(this);
    // Create ItemTouchHelper and pass with parameter the SimpleDragCallback
    touchHelper = new ItemTouchHelper(touchCallback);
    // Attach ItemTouchHelper to RecyclerView
    touchHelper.attachToRecyclerView(recyclerView);
    //restore selections (this has to be done after the items were added
    fastItemAdapter.withSavedInstanceState(savedInstanceState);
    //set the back arrow in the toolbar
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setHomeButtonEnabled(false);
}
Also used : EndlessRecyclerOnScrollListener(com.mikepenz.fastadapter_extensions.scroll.EndlessRecyclerOnScrollListener) SimpleDragCallback(com.mikepenz.fastadapter_extensions.drag.SimpleDragCallback) ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ProgressItem(com.mikepenz.fastadapter_extensions.items.ProgressItem) DefaultItemAnimator(android.support.v7.widget.DefaultItemAnimator) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) IItemAdapter(com.mikepenz.fastadapter.IItemAdapter) Toolbar(android.support.v7.widget.Toolbar) Handler(android.os.Handler) MaterializeBuilder(com.mikepenz.materialize.MaterializeBuilder) SearchView(android.support.v7.widget.SearchView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) FastAdapter(com.mikepenz.fastadapter.FastAdapter) SimpleItem(com.mikepenz.fastadapter.app.items.SimpleItem)

Aggregations

Toolbar (android.support.v7.widget.Toolbar)1075 View (android.view.View)699 TextView (android.widget.TextView)369 ActionBar (android.support.v7.app.ActionBar)304 RecyclerView (android.support.v7.widget.RecyclerView)262 Intent (android.content.Intent)236 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)228 ImageView (android.widget.ImageView)177 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)150 NavigationView (android.support.design.widget.NavigationView)120 AdapterView (android.widget.AdapterView)107 Bundle (android.os.Bundle)102 FloatingActionButton (android.support.design.widget.FloatingActionButton)101 ArrayList (java.util.ArrayList)95 DrawerLayout (android.support.v4.widget.DrawerLayout)89 BindView (butterknife.BindView)77 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)70 MenuItem (android.view.MenuItem)70 ListView (android.widget.ListView)62 ViewGroup (android.view.ViewGroup)56