use of org.aisen.weibo.sina.ui.widget.sheetfab.MaterialSheetFab in project AisenWeiBo by wangdan.
the class MainActivity method setupFab.
private void setupFab(Bundle savedInstanceState) {
ArrayList<Group> groupList = new ArrayList<>();
// 全部微博
Group group = new Group();
group.setName(getString(R.string.timeline_all));
group.setId("statusesFriendsTimeLine");
groupList.add(group);
// 互相关注
group = new Group();
group.setName(getString(R.string.timeline_bilateral));
group.setId("statusesBilateralTimeLine");
groupList.add(group);
// 发给我的
group = new Group();
group.setName(getString(R.string.timeline_tome));
group.setId("statusesToMe");
groupList.add(group);
// 分组微博
groupList.addAll(AppContext.getAccount().getGroups().getLists());
fabGroupsFragment = (FabGroupsFragment) getFragmentManager().findFragmentById(R.id.fragmentFabGroups);
fabGroupsFragment.resetSelectedPosition();
fabGroupsFragment.setItems(groupList);
View sheetView = findViewById(R.id.fab_sheet);
View overlay = findViewById(R.id.overlay);
int sheetColor = getResources().getColor(R.color.comm_white);
int fabColor = MDHelper.resolveColor(this, R.attr.colorPrimary, Color.BLACK);
materialSheetFab = new MaterialSheetFab(fabBtn, sheetView, overlay, sheetColor, fabColor);
materialSheetFab.setEventListener(new MaterialSheetFabEventListener() {
@Override
public void onShowSheet() {
super.onShowSheet();
fabGroupsFragment.show();
MobclickAgent.onEvent(MainActivity.this, "fab_groups");
}
});
materialSheetFab.showFab();
}
Aggregations