Search in sources :

Example 51 with Toolbar

use of android.support.v7.widget.Toolbar in project simple-tool-tip by xizzhu.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    findViewById(R.id.top_left_button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showToolTipView(v, Gravity.RIGHT, "Simple tool tip!", ContextCompat.getColor(MainActivity.this, R.color.blue));
        }
    });
    findViewById(R.id.top_right_button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showToolTipView(v, Gravity.BOTTOM, "It is yet another very simple tool tip!", ContextCompat.getColor(MainActivity.this, R.color.green));
        }
    });
    findViewById(R.id.central_button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showToolTipView(v, Gravity.END, "It is a very simple tool tip in the center!", ContextCompat.getColor(MainActivity.this, R.color.magenta));
        }
    });
    findViewById(R.id.bottom_left_button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showToolTipView(v, Gravity.TOP, "Tool tip, once more!", ContextCompat.getColor(MainActivity.this, R.color.maroon));
        }
    });
    findViewById(R.id.bottom_right_button).setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showToolTipView(v, Gravity.LEFT, "Magical tool tip!", ContextCompat.getColor(MainActivity.this, R.color.navy));
        }
    });
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle(R.string.app_name);
    toolbar.setTitleTextColor(Color.WHITE);
    toolbar.inflateMenu(R.menu.menu_main);
    View menuItem = findViewById(R.id.menu_item);
    showToolTipView(menuItem, Gravity.BOTTOM, "A simple but considerably long tool tip for menu item!", ContextCompat.getColor(this, R.color.magenta), 750L);
    View.OnClickListener listener = new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            showToolTipViewWithParent((Button) v, v.getId() == R.id.button1 ? Gravity.TOP : Gravity.BOTTOM);
        }
    };
    findViewById(R.id.button1).setOnClickListener(listener);
    findViewById(R.id.button2).setOnClickListener(listener);
    findViewById(R.id.button3).setOnClickListener(listener);
    findViewById(R.id.button4).setOnClickListener(listener);
    findViewById(R.id.button5).setOnClickListener(listener);
    findViewById(R.id.button6).setOnClickListener(listener);
    findViewById(R.id.button7).setOnClickListener(listener);
}
Also used : View(android.view.View) ToolTipView(com.github.xizzhu.simpletooltip.ToolTipView) Toolbar(android.support.v7.widget.Toolbar)

Example 52 with Toolbar

use of android.support.v7.widget.Toolbar in project SwipeRecyclerView by yanzhenjie.

the class MenuCardActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    actionBar.setDisplayHomeAsUpEnabled(true);
    mContext = this;
    List<String> dataList = new ArrayList<>();
    for (int i = 0; i < 30; i++) {
        dataList.add("我是第" + i + "个菜单");
    }
    mMenuRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.recycler_view);
    // 布局管理器。
    mMenuRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    mMenuRecyclerView.addItemDecoration(new RecyclerView.ItemDecoration() {

        @Override
        public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) {
            outRect.set(10, 10, 10, 10);
        }
    });
    MenuCardAdapter menuCardAdapter = new MenuCardAdapter(dataList);
    menuCardAdapter.setOnItemClickListener(onItemClickListener);
    mMenuRecyclerView.setAdapter(menuCardAdapter);
}
Also used : Rect(android.graphics.Rect) ArrayList(java.util.ArrayList) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) SwipeMenuRecyclerView(com.yanzhenjie.recyclerview.swipe.SwipeMenuRecyclerView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView) SwipeMenuRecyclerView(com.yanzhenjie.recyclerview.swipe.SwipeMenuRecyclerView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar) MenuCardAdapter(com.yanzhenjie.swiperecyclerview.adapter.MenuCardAdapter)

Example 53 with Toolbar

use of android.support.v7.widget.Toolbar in project SwipeRecyclerView by yanzhenjie.

the class MenuDefineActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mContext = this;
    setContentView(R.layout.activity_define);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    actionBar.setDisplayHomeAsUpEnabled(true);
    mSwipeSwitch = (SwipeSwitch) findViewById(R.id.swipe_layout);
    TextView btnLeft = (TextView) findViewById(R.id.left_view);
    TextView btnRight = (TextView) findViewById(R.id.right_view);
    btnLeft.setOnClickListener(xOnClickListener);
    btnRight.setOnClickListener(xOnClickListener);
}
Also used : TextView(android.widget.TextView) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 54 with Toolbar

use of android.support.v7.widget.Toolbar in project SwipeRecyclerView by yanzhenjie.

the class MenuDrawerActivity method onCreate.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_drawer_layout);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    actionBar.setDisplayHomeAsUpEnabled(true);
    mContext = this;
    mStrings = new ArrayList<>();
    for (int i = 0; i < 30; i++) {
        mStrings.add("我是第" + i + "个。");
    }
    mMenuRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.recycler_view);
    // 布局管理器。
    mMenuRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    // 添加分割线。
    mMenuRecyclerView.addItemDecoration(new ListViewDecoration());
    // 为SwipeRecyclerView的Item创建菜单就两句话,不错就是这么简单:
    // 设置菜单创建器。
    mMenuRecyclerView.setSwipeMenuCreator(swipeMenuCreator);
    // 设置菜单Item点击监听。
    mMenuRecyclerView.setSwipeMenuItemClickListener(menuItemClickListener);
    mMenuAdapter = new MenuAdapter(mStrings);
    mMenuAdapter.setOnItemClickListener(onItemClickListener);
    mMenuRecyclerView.setAdapter(mMenuAdapter);
}
Also used : ListViewDecoration(com.yanzhenjie.swiperecyclerview.view.ListViewDecoration) MenuAdapter(com.yanzhenjie.swiperecyclerview.adapter.MenuAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ActionBar(android.support.v7.app.ActionBar) Toolbar(android.support.v7.widget.Toolbar)

Example 55 with Toolbar

use of android.support.v7.widget.Toolbar in project SwipeRecyclerView by yanzhenjie.

the class MenuHorizontalActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    assert actionBar != null;
    actionBar.setDisplayHomeAsUpEnabled(true);
    mContext = this;
    mDataList = new ArrayList<>();
    for (int i = 0; i < 30; i++) {
        mDataList.add("我是第" + i + "个。");
    }
    mMenuRecyclerView = (SwipeMenuRecyclerView) findViewById(R.id.recycler_view);
    // 布局管理器。
    mMenuRecyclerView.setLayoutManager(new LinearLayoutManager(this));
    // 添加分割线。
    mMenuRecyclerView.addItemDecoration(new ListViewDecoration());
    // 为SwipeRecyclerView的Item创建菜单就两句话,不错就是这么简单:
    // 设置菜单创建器。
    mMenuRecyclerView.setSwipeMenuCreator(swipeMenuCreator);
    // 设置菜单Item点击监听。
    mMenuRecyclerView.setSwipeMenuItemClickListener(menuItemClickListener);
    mMenuAdapter = new MenuAdapter(mDataList);
    mMenuAdapter.setOnItemClickListener(onItemClickListener);
    mMenuRecyclerView.setAdapter(mMenuAdapter);
}
Also used : ListViewDecoration(com.yanzhenjie.swiperecyclerview.view.ListViewDecoration) MenuAdapter(com.yanzhenjie.swiperecyclerview.adapter.MenuAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager) ActionBar(android.support.v7.app.ActionBar) 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