Search in sources :

Example 16 with ExpandableListView

use of android.widget.ExpandableListView in project android_packages_apps_crDroidSettings by crdroidandroid.

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)

Example 17 with ExpandableListView

use of android.widget.ExpandableListView in project android_packages_apps_DU-Tweaks by DirtyUnicorns.

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)

Example 18 with ExpandableListView

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

the class Common method onScrollStateChanged.

private void onScrollStateChanged(ExpandableListView elv, int scrollState) {
    elv.setTag(AQuery.TAG_NUM, scrollState);
    if (scrollState == SCROLL_STATE_IDLE) {
        int first = elv.getFirstVisiblePosition();
        int last = elv.getLastVisiblePosition();
        int count = last - first;
        ExpandableListAdapter ela = elv.getExpandableListAdapter();
        for (int i = 0; i <= count; i++) {
            long packed = elv.getExpandableListPosition(i + first);
            int group = ExpandableListView.getPackedPositionGroup(packed);
            int child = ExpandableListView.getPackedPositionChild(packed);
            if (group >= 0) {
                View convertView = elv.getChildAt(i);
                Long targetPacked = (Long) convertView.getTag(AQuery.TAG_NUM);
                if (targetPacked != null && targetPacked.longValue() == packed) {
                    if (child == -1) {
                        ela.getGroupView(group, elv.isGroupExpanded(group), convertView, elv);
                    } else {
                        ela.getChildView(group, child, child == ela.getChildrenCount(group) - 1, convertView, elv);
                    }
                    convertView.setTag(AQuery.TAG_NUM, null);
                } else {
                // AQUtility.debug("skip!");
                }
            }
        }
    }
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter) AbsListView(android.widget.AbsListView) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView)

Example 19 with ExpandableListView

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

the class AbstractAQuery method adapter.

/**
 * Set the adapter of an ExpandableListView.
 *
 * @param adapter adapter
 * @return self
 */
public T adapter(ExpandableListAdapter adapter) {
    if (view instanceof ExpandableListView) {
        ExpandableListView av = (ExpandableListView) view;
        av.setAdapter(adapter);
    }
    return self();
}
Also used : ExpandableListView(android.widget.ExpandableListView)

Example 20 with ExpandableListView

use of android.widget.ExpandableListView in project AndroidDevMetrics by frogermcs.

the class Dagger2MetricsFragment method onCreateView.

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.adm_fragment_dagger2_metrics, container, false);
    lvMetrics = (ExpandableListView) view.findViewById(R.id.lvMetrics);
    tvEmpty = (TextView) view.findViewById(R.id.tvEmpty);
    interceptorList = AndroidDevMetrics.singleton().interceptors();
    if (interceptorList.size() > 1) {
        btnMenu = (Button) view.findViewById(R.id.btnMenu);
        btnMenu.setVisibility(View.VISIBLE);
        btnMenu.setText(interceptorList.get(0).getName());
        btnMenu.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                showUIInterceptorMenu();
            }
        });
    }
    return view;
}
Also used : TextView(android.widget.TextView) View(android.view.View) ExpandableListView(android.widget.ExpandableListView) Nullable(android.support.annotation.Nullable)

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