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