Search in sources :

Example 1 with MaterialSheetFabEventListener

use of org.aisen.weibo.sina.ui.widget.sheetfab.MaterialSheetFabEventListener 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();
}
Also used : Group(org.aisen.weibo.sina.sinasdk.bean.Group) MaterialSheetFabEventListener(org.aisen.weibo.sina.ui.widget.sheetfab.MaterialSheetFabEventListener) ArrayList(java.util.ArrayList) MaterialSheetFab(org.aisen.weibo.sina.ui.widget.sheetfab.MaterialSheetFab) View(android.view.View)

Aggregations

View (android.view.View)1 ArrayList (java.util.ArrayList)1 Group (org.aisen.weibo.sina.sinasdk.bean.Group)1 MaterialSheetFab (org.aisen.weibo.sina.ui.widget.sheetfab.MaterialSheetFab)1 MaterialSheetFabEventListener (org.aisen.weibo.sina.ui.widget.sheetfab.MaterialSheetFabEventListener)1