Search in sources :

Example 71 with ExpandableListView

use of android.widget.ExpandableListView in project netxms by netxms.

the class GraphBrowser method onCreateStep2.

/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * org.netxms.ui.android.main.activities.AbstractClientActivity#onCreateStep2
	 * (android.os.Bundle)
	 */
@Override
protected void onCreateStep2(Bundle savedInstanceState) {
    dialog = new ProgressDialog(this);
    setContentView(R.layout.graph_view);
    TextView title = (TextView) findViewById(R.id.ScreenTitlePrimary);
    title.setText(R.string.predefined_graphs_title);
    // keeps current list of graphs as datasource for listview
    adapter = new GraphAdapter(this, new ArrayList<String>(), new ArrayList<ArrayList<GraphSettings>>());
    listView = (ExpandableListView) findViewById(R.id.GraphList);
    listView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {

        @Override
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
            GraphSettings gs = (GraphSettings) adapter.getChild(groupPosition, childPosition);
            if (gs != null) {
                drawGraph(gs);
                return true;
            }
            return false;
        }
    });
    listView.setAdapter(adapter);
    registerForContextMenu(listView);
}
Also used : GraphAdapter(org.netxms.ui.android.main.adapters.GraphAdapter) GraphSettings(org.netxms.client.datacollection.GraphSettings) ArrayList(java.util.ArrayList) TextView(android.widget.TextView) ProgressDialog(android.app.ProgressDialog) TextView(android.widget.TextView) View(android.view.View) ExpandableListView(android.widget.ExpandableListView) ExpandableListView(android.widget.ExpandableListView)

Example 72 with ExpandableListView

use of android.widget.ExpandableListView in project netxms by netxms.

the class ExpandableListFragment method onCreateView.

/**
 * Provide default implementation to return a simple list view.  Subclasses
 * can override to replace with their own layout.  If doing so, the
 * returned view hierarchy <em>must</em> have a ListView whose id
 * is {@link android.R.id#list android.R.id.list} and can optionally
 * have a sibling view id {@link android.R.id#empty android.R.id.empty}
 * that is to be shown when the list is empty.
 * <p/>
 * <p>If you are overriding this method with your own custom content,
 * consider including the standard layout {@link android.R.layout#list_content}
 * in your layout file, so that you continue to retain all of the standard
 * behavior of ListFragment.  In particular, this is currently the only
 * way to have the built-in indeterminant progress state be shown.
 */
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    FrameLayout root = new FrameLayout(getActivity());
    FrameLayout lframe = new FrameLayout(getActivity());
    lframe.setId(INTERNAL_LIST_CONTAINER_ID);
    ExpandableListView lv = new ExpandableListView(getActivity());
    lv.setId(android.R.id.list);
    lv.setDrawSelectorOnTop(false);
    lv.setOnChildClickListener(this);
    lv.setOnGroupExpandListener(this);
    lv.setOnGroupCollapseListener(this);
    lframe.addView(lv, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    root.addView(lframe, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
    ListView.LayoutParams lp = new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    root.setLayoutParams(lp);
    return root;
}
Also used : ListView(android.widget.ListView) ExpandableListView(android.widget.ExpandableListView) FrameLayout(android.widget.FrameLayout) ExpandableListView(android.widget.ExpandableListView)

Example 73 with ExpandableListView

use of android.widget.ExpandableListView in project AnExplorer by 1hakr.

the class RootsFragment method getExpandedIds.

private ArrayList<Long> getExpandedIds() {
    ExpandableListView list = mList;
    ExpandableListAdapter adapter = mAdapter;
    if (adapter != null) {
        int length = adapter.getGroupCount();
        ArrayList<Long> expandedIds = new ArrayList<Long>();
        for (int i = 0; i < length; i++) {
            if (list.isGroupExpanded(i)) {
                expandedIds.add(adapter.getGroupId(i));
            }
        }
        return expandedIds;
    } else {
        return null;
    }
}
Also used : ArrayList(java.util.ArrayList) ExpandableListAdapter(android.widget.ExpandableListAdapter) ExpandableListView(android.widget.ExpandableListView)

Example 74 with ExpandableListView

use of android.widget.ExpandableListView 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)

Example 75 with ExpandableListView

use of android.widget.ExpandableListView in project platform_packages_apps_Galaxy by Cosmic-OS.

the class ShortcutPickHelper method processShortcut.

private void processShortcut(final Intent intent, int requestCodeApplication, int requestCodeShortcut) {
    // Handle case where user selected "Applications"
    String applicationName = mParent.getString(R.string.profile_applist_title);
    String application2name = mParent.getString(R.string.picker_activities);
    String shortcutName = intent.getStringExtra(Intent.EXTRA_SHORTCUT_NAME);
    if (applicationName != null && applicationName.equals(shortcutName)) {
        Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
        mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
        Intent pickIntent = new Intent(Intent.ACTION_PICK_ACTIVITY);
        pickIntent.putExtra(Intent.EXTRA_INTENT, mainIntent);
        startFragmentOrActivity(pickIntent, requestCodeApplication);
    } else if (application2name != null && application2name.equals(shortcutName)) {
        final List<PackageInfo> pInfos = mPackageManager.getInstalledPackages(PackageManager.GET_ACTIVITIES);
        ExpandableListView appListView = new ExpandableListView(mParent);
        AppExpandableAdapter appAdapter = new AppExpandableAdapter(pInfos, mParent);
        appListView.setAdapter(appAdapter);
        appListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {

            @Override
            public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
                Intent shortIntent = new Intent(Intent.ACTION_MAIN);
                String pkgName = ((GroupInfo) parent.getExpandableListAdapter().getGroup(groupPosition)).info.packageName;
                String actName = ((GroupInfo) parent.getExpandableListAdapter().getGroup(groupPosition)).info.activities[childPosition].name;
                shortIntent.setClassName(pkgName, actName);
                completeSetCustomApp(shortIntent);
                mAlertDialog.dismiss();
                return true;
            }
        });
        Builder builder = new Builder(mParent);
        builder.setView(appListView);
        mAlertDialog = builder.create();
        mAlertDialog.setTitle(mParent.getString(R.string.select_custom_activity_title));
        mAlertDialog.show();
        mAlertDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {

            @Override
            public void onCancel(DialogInterface dialog) {
                mListener.shortcutPicked(null, null, false);
            }
        });
    } else {
        startFragmentOrActivity(intent, requestCodeShortcut);
    }
}
Also used : DialogInterface(android.content.DialogInterface) Builder(android.app.AlertDialog.Builder) Intent(android.content.Intent) ArrayList(java.util.ArrayList) List(java.util.List) TextView(android.widget.TextView) View(android.view.View) ExpandableListView(android.widget.ExpandableListView) ExpandableListView(android.widget.ExpandableListView)

Aggregations

ExpandableListView (android.widget.ExpandableListView)86 View (android.view.View)59 TextView (android.widget.TextView)30 AdapterView (android.widget.AdapterView)18 Intent (android.content.Intent)16 ListView (android.widget.ListView)16 ArrayList (java.util.ArrayList)16 AbsListView (android.widget.AbsListView)14 DialogInterface (android.content.DialogInterface)11 ImageView (android.widget.ImageView)11 List (java.util.List)11 Builder (android.app.AlertDialog.Builder)9 ViewGroup (android.view.ViewGroup)9 ExpandableListAdapter (android.widget.ExpandableListAdapter)7 AbsSpinner (android.widget.AbsSpinner)6 QuickContactBadge (android.widget.QuickContactBadge)6 TabHost (android.widget.TabHost)6 AdapterBinding (com.android.ide.common.rendering.api.AdapterBinding)6 ResourceReference (com.android.ide.common.rendering.api.ResourceReference)6 SessionParams (com.android.ide.common.rendering.api.SessionParams)6