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);
}
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);
}
}
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();
}
});
}
}
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");
}
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);
}
}
Aggregations