Search in sources :

Example 81 with Toolbar

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);
}
Also used : NavigationView(android.support.design.widget.NavigationView) TabLayout(android.support.design.widget.TabLayout) FloatingActionButton(android.support.design.widget.FloatingActionButton) ViewPager(android.support.v4.view.ViewPager) NavigationView(android.support.design.widget.NavigationView) View(android.view.View) AdapterView(android.widget.AdapterView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 82 with Toolbar

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();
}
Also used : CollapsingToolbarLayout(android.support.design.widget.CollapsingToolbarLayout) Intent(android.content.Intent) Toolbar(android.support.v7.widget.Toolbar)

Example 83 with Toolbar

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);
}
Also used : DefaultItemTouchHelpCallback(com.codeest.geeknews.widget.DefaultItemTouchHelpCallback) ItemTouchHelper(android.support.v7.widget.helper.ItemTouchHelper) GoldManagerAdapter(com.codeest.geeknews.ui.gold.adapter.GoldManagerAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 84 with Toolbar

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();
        }
    }
}
Also used : RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) CheckedTextView(android.widget.CheckedTextView) Toolbar(android.support.v7.widget.Toolbar)

Example 85 with Toolbar

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;
}
Also used : Button(android.widget.Button) View(android.view.View) 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