use of android.support.v7.widget.Toolbar in project UltimateRecyclerView by cymcsg.
the class GridLayoutRVTest method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getMainLayout());
mToolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowTitleEnabled(true);
listuv = (UltimateRecyclerView) findViewById(R.id.ultimate_recycler_view);
mGridAdapter = new GridJRAdapter(getJRList());
mGridAdapter.setSpanColumns(columns);
mGridLayoutManager = new BasicGridLayoutManager(this, columns, mGridAdapter);
listuv.setLayoutManager(mGridLayoutManager);
listuv.setHasFixedSize(true);
listuv.setSaveEnabled(true);
listuv.setClipToPadding(false);
// mGridAdapter.setCustomLoadMoreView(LayoutInflater.from(this).inflate(R.layout.custom_bottom_progressbar, null));
listuv.setNormalHeader(setupHeaderView());
final Handler f = new Handler();
listuv.setOnLoadMoreListener(new UltimateRecyclerView.OnLoadMoreListener() {
@Override
public void loadMore(int itemsCount, int maxLastVisiblePosition) {
// Log.d(TAG, itemsCount + " :: " + itemsCount);
f.postDelayed(new Runnable() {
@Override
public void run() {
mGridAdapter.insert(SampleDataboxset.genJRList(5));
afterAdd();
}
}, 2000);
}
});
// listuv.enableLoadmore();
// listuv.disableLoadmore();
listuv.setLoadMoreView(R.layout.custom_bottom_progressbar);
listuv.setAdapter(mGridAdapter);
listuv.setItemAnimator(new DefaultItemAnimator());
harness_control();
}
use of android.support.v7.widget.Toolbar in project SpringIndicator by chenupt.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
viewPager = (ScrollerViewPager) findViewById(R.id.view_pager);
SpringIndicator springIndicator = (SpringIndicator) findViewById(R.id.indicator);
Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
setSupportActionBar(toolbar);
PagerModelManager manager = new PagerModelManager();
manager.addCommonFragment(GuideFragment.class, getBgRes(), getTitles());
ModelPagerAdapter adapter = new ModelPagerAdapter(getSupportFragmentManager(), manager);
viewPager.setAdapter(adapter);
viewPager.fixScrollSpeed();
// just set viewPager
springIndicator.setViewPager(viewPager);
}
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