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