use of android.support.v7.widget.Toolbar in project cheesesquare by chrisbanes.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
final ActionBar ab = getSupportActionBar();
ab.setHomeAsUpIndicator(R.drawable.ic_menu);
ab.setDisplayHomeAsUpEnabled(true);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
if (navigationView != null) {
setupDrawerContent(navigationView);
}
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
if (viewPager != null) {
setupViewPager(viewPager);
}
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG).setAction("Action", null).show();
}
});
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
use of android.support.v7.widget.Toolbar in project cheesesquare by chrisbanes.
the class CheeseDetailActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
Intent intent = getIntent();
final String cheeseName = intent.getStringExtra(EXTRA_NAME);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
CollapsingToolbarLayout collapsingToolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
collapsingToolbar.setTitle(cheeseName);
loadBackdrop();
}
use of android.support.v7.widget.Toolbar in project GeekNews by codeestX.
the class GoldManagerActivity method initEventAndData.
@Override
protected void initEventAndData() {
setToolBar(toolBar, "首页特别展示");
mList = ((GoldManagerBean) getIntent().getParcelableExtra(Constants.IT_GOLD_MANAGER)).getManagerList();
mAdapter = new GoldManagerAdapter(mContext, mList);
rvGoldManagerList.setLayoutManager(new LinearLayoutManager(mContext));
rvGoldManagerList.setAdapter(mAdapter);
mCallback = new DefaultItemTouchHelpCallback(new DefaultItemTouchHelpCallback.OnItemTouchCallbackListener() {
@Override
public void onSwiped(int adapterPosition) {
}
@Override
public boolean onMove(int srcPosition, int targetPosition) {
if (mList != null) {
Collections.swap(mList, srcPosition, targetPosition);
mAdapter.notifyItemMoved(srcPosition, targetPosition);
return true;
}
return false;
}
});
mCallback.setDragEnable(true);
mCallback.setSwipeEnable(false);
ItemTouchHelper itemTouchHelper = new ItemTouchHelper(mCallback);
itemTouchHelper.attachToRecyclerView(rvGoldManagerList);
}
use of android.support.v7.widget.Toolbar in project xLog by elvishew.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
tagView = (TextView) findViewById(R.id.tag);
tagView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showChangeTagDialog();
}
});
levelView = (Spinner) findViewById(R.id.level);
threadInfo = (CheckedTextView) findViewById(R.id.thread_info);
threadInfo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
threadInfo.toggle();
}
});
stackTraceInfo = (CheckedTextView) findViewById(R.id.stack_trace_info);
stackTraceInfo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
stackTraceInfo.toggle();
setEnabledStateOnViews(stackTraceDepthContainer, stackTraceInfo.isChecked());
}
});
stackTraceDepthContainer = findViewById(R.id.stack_trace_depth_container);
setEnabledStateOnViews(stackTraceDepthContainer, false);
stackTraceDepth = (Spinner) stackTraceDepthContainer.findViewById(R.id.stack_trace_depth);
border = (CheckedTextView) findViewById(R.id.border);
border.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
border.toggle();
}
});
// Setup print button.
findViewById(R.id.print).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
printLog();
}
});
// Setup view printer.
RecyclerView logContainer = (RecyclerView) findViewById(R.id.log_container);
viewPrinter = new RecyclerViewPrinter(logContainer);
// Print welcome message.
XLog.printers(viewPrinter).i("XLog is ready.\nPrint your log now!");
// Check permission.
hasPermission = hasPermission();
if (!hasPermission) {
if (shouldShowRequestPermissionRationale()) {
showPermissionRequestDialog(false);
} else {
requestPermission();
}
}
}
use of android.support.v7.widget.Toolbar in project MyDiary by erttyy8821.
the class DirectoryPickerFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = super.onCreateView(inflater, container, savedInstanceState);
//Set toolbar
Toolbar toolbar = (Toolbar) rootView.findViewById(com.nononsenseapps.filepicker.R.id.nnf_picker_toolbar);
toolbar.setBackgroundColor(ThemeManager.getInstance().getThemeMainColor(getActivity()));
//set RecyclerView
recyclerView.setBackgroundColor(Color.WHITE);
//set Button
((Button) rootView.findViewById(com.nononsenseapps.filepicker.R.id.nnf_button_cancel)).setText(getResources().getString(R.string.dialog_button_cancel));
((Button) rootView.findViewById(com.nononsenseapps.filepicker.R.id.nnf_button_ok)).setText(getResources().getString(R.string.dialog_button_ok));
return rootView;
}
Aggregations