Search in sources :

Example 71 with Toolbar

use of android.support.v7.widget.Toolbar in project MaterializeYourApp by antoniolg.

the class DetailActivity method onCreate.

@SuppressWarnings("ConstantConditions")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initActivityTransitions();
    setContentView(R.layout.activity_detail);
    ViewCompat.setTransitionName(findViewById(R.id.app_bar_layout), EXTRA_IMAGE);
    supportPostponeEnterTransition();
    setSupportActionBar((Toolbar) findViewById(R.id.toolbar));
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    String itemTitle = getIntent().getStringExtra(EXTRA_TITLE);
    collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsingToolbarLayout.setTitle(itemTitle);
    collapsingToolbarLayout.setExpandedTitleColor(getResources().getColor(android.R.color.transparent));
    final ImageView image = (ImageView) findViewById(R.id.image);
    Picasso.with(this).load(getIntent().getStringExtra(EXTRA_IMAGE)).into(image, new Callback() {

        @Override
        public void onSuccess() {
            Bitmap bitmap = ((BitmapDrawable) image.getDrawable()).getBitmap();
            Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() {

                public void onGenerated(Palette palette) {
                    applyPalette(palette);
                }
            });
        }

        @Override
        public void onError() {
        }
    });
    TextView title = (TextView) findViewById(R.id.title);
    title.setText(itemTitle);
}
Also used : Palette(android.support.v7.graphics.Palette) Bitmap(android.graphics.Bitmap) Callback(com.squareup.picasso.Callback) TextView(android.widget.TextView) ImageView(android.widget.ImageView)

Example 72 with Toolbar

use of android.support.v7.widget.Toolbar in project MaterializeYourApp by antoniolg.

the class MainActivity method initToolbar.

private void initToolbar() {
    final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    final ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp);
        actionBar.setDisplayHomeAsUpEnabled(true);
    }
}
Also used : ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 73 with Toolbar

use of android.support.v7.widget.Toolbar in project FlyRefresh by race604.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initDataSet();
    setContentView(R.layout.activity_main);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayShowTitleEnabled(false);
    mFlylayout = (FlyRefreshLayout) findViewById(R.id.fly_layout);
    mFlylayout.setOnPullRefreshListener(this);
    mListView = (RecyclerView) findViewById(R.id.list);
    mLayoutManager = new LinearLayoutManager(this);
    mListView.setLayoutManager(mLayoutManager);
    mAdapter = new ItemAdapter(this);
    mListView.setAdapter(mAdapter);
    mListView.setItemAnimator(new SampleItemAnimator());
    View actionButton = mFlylayout.getHeaderActionButton();
    if (actionButton != null) {
        actionButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                mFlylayout.startRefresh();
            }
        });
    }
}
Also used : LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) Toolbar(android.support.v7.widget.Toolbar)

Example 74 with Toolbar

use of android.support.v7.widget.Toolbar in project android by owncloud.

the class LocalFolderPickerActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    Log_OC.d(TAG, "onCreate() start");
    super.onCreate(savedInstanceState);
    // set current folder
    String startPath = (savedInstanceState != null) ? savedInstanceState.getString(LocalFolderPickerActivity.EXTRA_PATH) : getIntent().getStringExtra(EXTRA_PATH);
    if (startPath != null) {
        mCurrentFolder = new File(startPath);
    }
    if (mCurrentFolder == null || !mCurrentFolder.exists()) {
        // default
        mCurrentFolder = Environment.getExternalStorageDirectory();
    } else if (!mCurrentFolder.isDirectory()) {
        mCurrentFolder = mCurrentFolder.getParentFile();
    }
    // inflate and set the layout view
    // beware - inflated in other activities too
    setContentView(R.layout.files_folder_picker);
    if (savedInstanceState == null) {
        createFragments();
    }
    // set input controllers
    mCancelBtn = (Button) findViewById(R.id.folder_picker_btn_cancel);
    mCancelBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            setResult(RESULT_CANCELED);
            finish();
        }
    });
    mChooseBtn = (Button) findViewById(R.id.folder_picker_btn_choose);
    mChooseBtn.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            // return the path of the current folder
            Intent data = new Intent();
            data.putExtra(EXTRA_PATH, mCurrentFolder.getAbsolutePath());
            setResult(RESULT_OK, data);
            finish();
        }
    });
    // init toolbar
    setupToolbar();
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayShowTitleEnabled(true);
    }
    updateActionBar();
    Log_OC.d(TAG, "onCreate() end");
}
Also used : Intent(android.content.Intent) File(java.io.File) View(android.view.View) ActionBar(android.support.v7.app.ActionBar)

Example 75 with Toolbar

use of android.support.v7.widget.Toolbar in project MovieGuide by esoxjem.

the class MoviesListingActivity method setToolbar.

private void setToolbar() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    if (getSupportActionBar() != null) {
        getSupportActionBar().setTitle(R.string.movie_guide);
        getSupportActionBar().setDisplayShowTitleEnabled(true);
    }
}
Also used : Toolbar(android.support.v7.widget.Toolbar)

Aggregations

Toolbar (android.support.v7.widget.Toolbar)496 View (android.view.View)358 ActionBar (android.support.v7.app.ActionBar)178 TextView (android.widget.TextView)167 RecyclerView (android.support.v7.widget.RecyclerView)134 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)123 ImageView (android.widget.ImageView)84 Intent (android.content.Intent)75 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)56 ArrayList (java.util.ArrayList)56 BindView (butterknife.BindView)46 AppCompatActivity (android.support.v7.app.AppCompatActivity)41 AdapterView (android.widget.AdapterView)41 NavigationView (android.support.design.widget.NavigationView)39 BarPainter (com.xabber.android.ui.color.BarPainter)36 MenuItem (android.view.MenuItem)35 FloatingActionButton (android.support.design.widget.FloatingActionButton)31 ViewPager (android.support.v4.view.ViewPager)31 ViewGroup (android.view.ViewGroup)31 Bundle (android.os.Bundle)29