Search in sources :

Example 1 with CommonDialog

use of la.xiong.androidquick.ui.dialog.CommonDialog in project AndroidQuick by ddnosh.

the class UIActivity method initViewsAndEvents.

@Override
protected void initViewsAndEvents() {
    GroupItem groupItem0 = new GroupItem();
    groupItem0.title = "Fragment";
    groupItem0.childList.add("CommonFragment");
    groupItem0.childList.add("Fragmentation");
    parentList.add(groupItem0);
    GroupItem groupItem1 = new GroupItem();
    groupItem1.title = "Adapter";
    groupItem1.childList.add("CommonAdapter");
    groupItem1.childList.add("MultiViewTypeAdapter");
    groupItem1.childList.add("BaseRecycleViewAdapterHelper");
    parentList.add(groupItem1);
    GroupItem groupItem2 = new GroupItem();
    groupItem2.title = "Toolbar";
    groupItem2.childList.add("DefaultToolbar");
    groupItem2.childList.add("CommonToolbar");
    parentList.add(groupItem2);
    GroupItem groupItem3 = new GroupItem();
    groupItem3.title = "BottomBar";
    groupItem3.childList.add("RadioButton");
    groupItem3.childList.add("BottomBar");
    parentList.add(groupItem3);
    GroupItem groupItem4 = new GroupItem();
    groupItem4.title = "Dialog";
    groupItem4.childList.add("LoadingDialog");
    groupItem4.childList.add("CommonDialog");
    parentList.add(groupItem4);
    GroupItem groupItem5 = new GroupItem();
    groupItem5.title = "Tab";
    groupItem5.childList.add("SmartTabLayout");
    groupItem5.childList.add("FlycoTabLayout");
    parentList.add(groupItem5);
    GroupItem groupItem6 = new GroupItem();
    groupItem6.title = "Banner";
    parentList.add(groupItem6);
    GroupItem groupItem7 = new GroupItem();
    groupItem7.title = "Code";
    parentList.add(groupItem7);
    GroupItem groupItem8 = new GroupItem();
    groupItem8.title = "Permission";
    parentList.add(groupItem8);
    GroupItem groupItem9 = new GroupItem();
    groupItem9.title = "Refresh";
    parentList.add(groupItem9);
    GroupItem groupItem10 = new GroupItem();
    groupItem10.title = "WebView";
    parentList.add(groupItem10);
    GroupItem groupItem11 = new GroupItem();
    groupItem11.title = "DataBinding";
    parentList.add(groupItem11);
    mAnimatedExpandableListView.setAdapter(new AnimatedListAdapter(this, parentList));
    // 默认第一组打开
    // mAnimatedExpandableListView.expandGroupWithAnimation(0);
    // 点击分组打开或关闭时添加动画
    mAnimatedExpandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {

        @Override
        public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
            Log.i(TAG, "group" + groupPosition + " was clicked!");
            if (parentList.get(groupPosition).childList.size() > 0) {
                if (mAnimatedExpandableListView.isGroupExpanded(groupPosition)) {
                    mAnimatedExpandableListView.collapseGroupWithAnimation(groupPosition);
                } else {
                    mAnimatedExpandableListView.expandGroupWithAnimation(groupPosition);
                }
            }
            switch(groupPosition) {
                case 6:
                    readyGo(BannerFragment.class);
                    break;
                case 7:
                    readyGo(CodeFragment.class);
                    break;
                case 8:
                    readyGo(PermissionActivity.class);
                    break;
                case 9:
                    readyGo(Example1Fragment.class);
                    break;
                case 10:
                    readyGo(WebViewActivity.class);
                    break;
                case 11:
                    readyGo(DatabindingFragment.class);
                    break;
            }
            return true;
        }
    });
    mAnimatedExpandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {

        @Override
        public boolean onChildClick(ExpandableListView expandableListView, View view, int groupPosition, int childPosition, long l) {
            Log.i(TAG, "group" + groupPosition + " with child" + childPosition + " was clicked!");
            switch(groupPosition) {
                case 0:
                    switch(childPosition) {
                        case 0:
                            readyGo(Example1Fragment.class);
                            break;
                        case 1:
                            readyGo(FragmentationActivity.class);
                            break;
                    }
                    break;
                case 1:
                    switch(childPosition) {
                        case 0:
                            readyGo(CommonAdapterFragment.class);
                            break;
                        case 1:
                            readyGo(MultiViewTypeAdapterFragment.class);
                            break;
                        case 2:
                            readyGo(BaseRecyclerViewAdapterHelperFragment.class);
                            break;
                    }
                    break;
                case 2:
                    switch(childPosition) {
                        case 0:
                            readyGo(ToolbarActivity.class);
                            break;
                        case 1:
                            readyGo(CommonToolBarFragment.class);
                            break;
                    }
                    break;
                case 3:
                    switch(childPosition) {
                        case 0:
                            readyGo(RadioButtonFragment.class);
                            break;
                        case 1:
                            readyGo(BottomBarFragment.class);
                            break;
                    }
                    break;
                case 4:
                    switch(childPosition) {
                        case 0:
                            DialogUtil.showLoadingDialog(UIActivity.this);
                            break;
                        case 1:
                            DialogUtil.getDialogBuilder(UIActivity.this).setTitle(R.string.app_name).setMessage("this is an information").setPositiveButton("Confirm").setNegativeButton("Cancel").setBtnClickCallBack(new CommonDialog.DialogBtnCallBack() {

                                @Override
                                public void onDialogButClick(boolean isConfirm) {
                                    if (isConfirm) {
                                        ToastUtil.showToast("Confirm clicked");
                                    }
                                }
                            }).show();
                            break;
                    }
                    break;
                case 5:
                    switch(childPosition) {
                        case 0:
                            readyGo(TabSTLFragment.class);
                            break;
                        case 1:
                            readyGo(TabFTLFragment.class);
                            break;
                    }
                    break;
            }
            return true;
        }
    });
}
Also used : TabFTLFragment(la.xiong.androidquick.demo.ui.fragment.TabFTLFragment) RadioButtonFragment(la.xiong.androidquick.demo.ui.fragment.RadioButtonFragment) CommonAdapterFragment(la.xiong.androidquick.demo.ui.fragment.CommonAdapterFragment) BottomBarFragment(la.xiong.androidquick.demo.ui.fragment.BottomBarFragment) Example1Fragment(la.xiong.androidquick.demo.ui.fragment.Example1Fragment) GroupItem(la.xiong.androidquick.demo.view.expandablelistview.GroupItem) TabSTLFragment(la.xiong.androidquick.demo.ui.fragment.TabSTLFragment) CommonToolBarFragment(la.xiong.androidquick.demo.ui.fragment.CommonToolBarFragment) AnimatedExpandableListView(la.xiong.androidquick.demo.view.expandablelistview.AnimatedExpandableListView) ExpandableListView(android.widget.ExpandableListView) MultiViewTypeAdapterFragment(la.xiong.androidquick.demo.ui.fragment.MultiViewTypeAdapterFragment) BannerFragment(la.xiong.androidquick.demo.ui.fragment.BannerFragment) DatabindingFragment(la.xiong.androidquick.demo.ui.fragment.DatabindingFragment) CodeFragment(la.xiong.androidquick.demo.ui.fragment.CodeFragment) AnimatedListAdapter(la.xiong.androidquick.demo.view.expandablelistview.AnimatedListAdapter) CommonDialog(la.xiong.androidquick.ui.dialog.CommonDialog) BindView(butterknife.BindView) View(android.view.View) AnimatedExpandableListView(la.xiong.androidquick.demo.view.expandablelistview.AnimatedExpandableListView) ExpandableListView(android.widget.ExpandableListView) BaseRecyclerViewAdapterHelperFragment(la.xiong.androidquick.demo.ui.fragment.BaseRecyclerViewAdapterHelperFragment)

Aggregations

View (android.view.View)1 ExpandableListView (android.widget.ExpandableListView)1 BindView (butterknife.BindView)1 BannerFragment (la.xiong.androidquick.demo.ui.fragment.BannerFragment)1 BaseRecyclerViewAdapterHelperFragment (la.xiong.androidquick.demo.ui.fragment.BaseRecyclerViewAdapterHelperFragment)1 BottomBarFragment (la.xiong.androidquick.demo.ui.fragment.BottomBarFragment)1 CodeFragment (la.xiong.androidquick.demo.ui.fragment.CodeFragment)1 CommonAdapterFragment (la.xiong.androidquick.demo.ui.fragment.CommonAdapterFragment)1 CommonToolBarFragment (la.xiong.androidquick.demo.ui.fragment.CommonToolBarFragment)1 DatabindingFragment (la.xiong.androidquick.demo.ui.fragment.DatabindingFragment)1 Example1Fragment (la.xiong.androidquick.demo.ui.fragment.Example1Fragment)1 MultiViewTypeAdapterFragment (la.xiong.androidquick.demo.ui.fragment.MultiViewTypeAdapterFragment)1 RadioButtonFragment (la.xiong.androidquick.demo.ui.fragment.RadioButtonFragment)1 TabFTLFragment (la.xiong.androidquick.demo.ui.fragment.TabFTLFragment)1 TabSTLFragment (la.xiong.androidquick.demo.ui.fragment.TabSTLFragment)1 AnimatedExpandableListView (la.xiong.androidquick.demo.view.expandablelistview.AnimatedExpandableListView)1 AnimatedListAdapter (la.xiong.androidquick.demo.view.expandablelistview.AnimatedListAdapter)1 GroupItem (la.xiong.androidquick.demo.view.expandablelistview.GroupItem)1 CommonDialog (la.xiong.androidquick.ui.dialog.CommonDialog)1