Search in sources :

Example 6 with Toolbar

use of android.support.v7.widget.Toolbar in project UltimateAndroid by cymcsg.

the class MaterialTabTextActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.material_tab_text_activity_main);
    Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar);
    this.setSupportActionBar(toolbar);
    tabHost = (MaterialTabHost) this.findViewById(R.id.tabHost);
    pager = (ViewPager) this.findViewById(R.id.pager);
    // init view pager
    adapter = new ViewPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(adapter);
    pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            // when user do a swipe the selected tab change
            tabHost.setSelectedNavigationItem(position);
        }
    });
    // insert all tabs from pagerAdapter data
    for (int i = 0; i < adapter.getCount(); i++) {
        tabHost.addTab(tabHost.newTab().setText(adapter.getPageTitle(i)).setTabListener(this));
    }
}
Also used : ViewPager(android.support.v4.view.ViewPager) Toolbar(android.support.v7.widget.Toolbar)

Example 7 with Toolbar

use of android.support.v7.widget.Toolbar in project UltimateAndroid by cymcsg.

the class MaterialTabsWithIconsActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.material_tab_activity_main);
    res = this.getResources();
    // init toolbar (old action bar)
    Toolbar toolbar = (Toolbar) this.findViewById(R.id.toolbar);
    toolbar.setTitleTextColor(Color.WHITE);
    this.setSupportActionBar(toolbar);
    tabHost = (MaterialTabHost) this.findViewById(R.id.materialTabHost);
    pager = (ViewPager) this.findViewById(R.id.viewpager);
    // init view pager
    pagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
    pager.setAdapter(pagerAdapter);
    pager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {

        @Override
        public void onPageSelected(int position) {
            // when user do a swipe the selected tab change
            tabHost.setSelectedNavigationItem(position);
        }
    });
    // insert all tabs from pagerAdapter data
    for (int i = 0; i < pagerAdapter.getCount(); i++) {
        tabHost.addTab(tabHost.newTab().setIcon(getIcon(i)).setTabListener(this));
    }
//tabHost.setAccentColor(Color.BLUE);
}
Also used : ViewPager(android.support.v4.view.ViewPager) SuppressLint(android.annotation.SuppressLint) Toolbar(android.support.v7.widget.Toolbar)

Example 8 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 9 with Toolbar

use of android.support.v7.widget.Toolbar in project GeekNews by codeestX.

the class NodeListActivity method initEventAndData.

@Override
protected void initEventAndData() {
    nodeName = getIntent().getStringExtra(Constants.IT_VTEX_NODE_NAME);
    setToolBar(toolBar, nodeName);
    mAdapter = new NodeListAdapter(mContext, new ArrayList<NodeListBean>());
    rvContent.setLayoutManager(new LinearLayoutManager(mContext));
    rvContent.setAdapter(mAdapter);
    swipeRefresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {

        @Override
        public void onRefresh() {
            mPresenter.getContent(nodeName);
        }
    });
    ivProgress.start();
    mPresenter.getContent(nodeName);
    mPresenter.getTopInfo(nodeName);
}
Also used : NodeListAdapter(com.codeest.geeknews.ui.vtex.adapter.NodeListAdapter) ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout)

Example 10 with Toolbar

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

the class SimpleSampleActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Simple Sample");
    toolbar.setNavigationIcon(R.drawable.ic_arrow_back_white_24dp);
    toolbar.setNavigationOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            onBackPressed();
        }
    });
    toolbar.inflateMenu(R.menu.main_menu);
    toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            switch(item.getItemId()) {
                case R.id.menu_zoom_toggle:
                    mPhotoView.setZoomable(!mPhotoView.isZoomEnabled());
                    item.setTitle(mPhotoView.isZoomEnabled() ? R.string.menu_zoom_disable : R.string.menu_zoom_enable);
                    return true;
                case R.id.menu_scale_fit_center:
                    mPhotoView.setScaleType(ImageView.ScaleType.CENTER);
                    return true;
                case R.id.menu_scale_fit_start:
                    mPhotoView.setScaleType(ImageView.ScaleType.FIT_START);
                    return true;
                case R.id.menu_scale_fit_end:
                    mPhotoView.setScaleType(ImageView.ScaleType.FIT_END);
                    return true;
                case R.id.menu_scale_fit_xy:
                    mPhotoView.setScaleType(ImageView.ScaleType.FIT_XY);
                    return true;
                case R.id.menu_scale_scale_center:
                    mPhotoView.setScaleType(ImageView.ScaleType.CENTER);
                    return true;
                case R.id.menu_scale_scale_center_crop:
                    mPhotoView.setScaleType(ImageView.ScaleType.CENTER_CROP);
                    return true;
                case R.id.menu_scale_scale_center_inside:
                    mPhotoView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
                    return true;
                case R.id.menu_scale_random_animate:
                case R.id.menu_scale_random:
                    Random r = new Random();
                    float minScale = mPhotoView.getMinimumScale();
                    float maxScale = mPhotoView.getMaximumScale();
                    float randomScale = minScale + (r.nextFloat() * (maxScale - minScale));
                    mPhotoView.setScale(randomScale, item.getItemId() == R.id.menu_scale_random_animate);
                    showToast(String.format(SCALE_TOAST_STRING, randomScale));
                    return true;
                case R.id.menu_matrix_restore:
                    if (mCurrentDisplayMatrix == null)
                        showToast("You need to capture display matrix first");
                    else
                        mPhotoView.setDisplayMatrix(mCurrentDisplayMatrix);
                    return true;
                case R.id.menu_matrix_capture:
                    mCurrentDisplayMatrix = new Matrix();
                    mPhotoView.getDisplayMatrix(mCurrentDisplayMatrix);
                    return true;
            }
            return false;
        }
    });
    mPhotoView = (PhotoView) findViewById(R.id.iv_photo);
    mCurrMatrixTv = (TextView) findViewById(R.id.tv_current_matrix);
    Drawable bitmap = ContextCompat.getDrawable(this, R.drawable.wallpaper);
    mPhotoView.setImageDrawable(bitmap);
    // Lets attach some listeners, not required though!
    mPhotoView.setOnMatrixChangeListener(new MatrixChangeListener());
    mPhotoView.setOnPhotoTapListener(new PhotoTapListener());
    mPhotoView.setOnSingleFlingListener(new SingleFlingListener());
}
Also used : Matrix(android.graphics.Matrix) Random(java.util.Random) Drawable(android.graphics.drawable.Drawable) MenuItem(android.view.MenuItem) OnPhotoTapListener(com.github.chrisbanes.photoview.OnPhotoTapListener) OnSingleFlingListener(com.github.chrisbanes.photoview.OnSingleFlingListener) PhotoView(com.github.chrisbanes.photoview.PhotoView) ImageView(android.widget.ImageView) TextView(android.widget.TextView) View(android.view.View) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Toolbar (android.support.v7.widget.Toolbar)442 View (android.view.View)316 ActionBar (android.support.v7.app.ActionBar)155 TextView (android.widget.TextView)149 RecyclerView (android.support.v7.widget.RecyclerView)120 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)112 ImageView (android.widget.ImageView)77 Intent (android.content.Intent)65 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)49 ArrayList (java.util.ArrayList)46 AdapterView (android.widget.AdapterView)38 AppCompatActivity (android.support.v7.app.AppCompatActivity)35 NavigationView (android.support.design.widget.NavigationView)34 FloatingActionButton (android.support.design.widget.FloatingActionButton)29 ViewPager (android.support.v4.view.ViewPager)29 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)28 BindView (butterknife.BindView)28 MenuItem (android.view.MenuItem)24 ViewGroup (android.view.ViewGroup)24 Handler (android.os.Handler)23