Search in sources :

Example 21 with ExpandableListView

use of android.widget.ExpandableListView in project Thrift-box by Sash0k.

the class ExpandableListFragment method ensureList.

private void ensureList() {
    if (mExpandableList != null) {
        return;
    }
    View root = getView();
    if (root == null) {
        throw new IllegalStateException("Content view not yet created");
    }
    if (root instanceof ExpandableListView) {
        mExpandableList = (ExpandableListView) root;
    } else {
        mStandardEmptyView = (TextView) root.findViewById(INTERNAL_EMPTY_ID);
        if (mStandardEmptyView == null) {
            mEmptyView = root.findViewById(android.R.id.empty);
        } else {
            mStandardEmptyView.setVisibility(View.GONE);
        }
        mProgressContainer = root.findViewById(INTERNAL_PROGRESS_CONTAINER_ID);
        mExpandableListContainer = root.findViewById(INTERNAL_LIST_CONTAINER_ID);
        View rawExpandableListView = root.findViewById(android.R.id.list);
        if (!(rawExpandableListView instanceof ExpandableListView)) {
            if (rawExpandableListView == null) {
                throw new RuntimeException("Your content must have a ListView whose id attribute is " + "'android.R.id.list'");
            }
            throw new RuntimeException("Content has view with id attribute 'android.R.id.list' " + "that is not a ListView class");
        }
        mExpandableList = (ExpandableListView) rawExpandableListView;
        if (mEmptyView != null) {
            mExpandableList.setEmptyView(mEmptyView);
        } else if (mEmptyText != null) {
            mStandardEmptyView.setText(mEmptyText);
            mExpandableList.setEmptyView(mStandardEmptyView);
        }
    }
    mExpandableListShown = true;
    mExpandableList.setOnItemClickListener(mOnClickListener);
    // add invisible indicator
    mExpandableList.setGroupIndicator(getResources().getDrawable(R.drawable.expandable_list_icon_selector));
    if (mAdapter != null) {
        ExpandableListAdapter adapter = mAdapter;
        mAdapter = null;
        setListAdapter(adapter);
    } else {
        // have our data right away and start with the progress indicator.
        if (mProgressContainer != null) {
            setListShown(false, false);
        }
    }
    mHandler.post(mRequestFocus);
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter) TextView(android.widget.TextView) View(android.view.View) AdapterView(android.widget.AdapterView) ExpandableListView(android.widget.ExpandableListView) ExpandableListView(android.widget.ExpandableListView)

Example 22 with ExpandableListView

use of android.widget.ExpandableListView in project Thrift-box by Sash0k.

the class ExpensesFragment method onActivityCreated.

// ============================================================================
@Override
public void onActivityCreated(Bundle savedState) {
    super.onActivityCreated(savedState);
    setEmptyText(getString(R.string.list_empty));
    setHasOptionsMenu(false);
    setListShown(false);
    // styling listView
    final ExpandableListView list = getListView();
    final Drawable divider = getResources().getDrawable(R.drawable.empty_divider);
    list.setChildDivider(divider);
    list.setOnChildClickListener(this);
    LoaderManager lm = getLoaderManager();
    if (lm != null)
        lm.initLoader(LOADER_ID, null, this);
}
Also used : LoaderManager(android.support.v4.app.LoaderManager) Drawable(android.graphics.drawable.Drawable) ExpandableListView(android.widget.ExpandableListView)

Example 23 with ExpandableListView

use of android.widget.ExpandableListView in project packages_apps_AicpExtras by AICP.

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 24 with ExpandableListView

use of android.widget.ExpandableListView in project mobile-messaging-sdk-android by infobip.

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    Toolbar toolbar = findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    totalReceivedTextView = findViewById(R.id.totalReceivedTextView);
    ExpandableListView messagesListView = findViewById(R.id.messagesListView);
    assert messagesListView != null;
    listAdapter = new ExpandableListAdapter(this, onMessageExpandedListener);
    messagesListView.setAdapter(listAdapter);
    initializeMobileMessaging();
    registerReceivers();
    registerPreferenceChangeListener();
    clearNotifications();
    // handle event started from SDK from background
    Intent intent = getIntent();
    if (InteractiveEvent.NOTIFICATION_ACTION_TAPPED.getKey().equals(intent.getAction())) {
        onNotificationActionTapped(intent);
    }
    if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
        String[] permissions = { Manifest.permission.ACCESS_FINE_LOCATION };
        ActivityCompat.requestPermissions(this, permissions, LOCATION_PERMISSION_REQUEST_CODE);
        return;
    }
    activateGeofencing();
}
Also used : Intent(android.content.Intent) ExpandableListView(android.widget.ExpandableListView) Toolbar(android.support.v7.widget.Toolbar)

Example 25 with ExpandableListView

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

the class RootsFragment method restoreExpandedState.

private void restoreExpandedState(ArrayList<Long> expandedIds) {
    this.expandedIds = expandedIds;
    if (expandedIds != null) {
        ExpandableListView list = mList;
        ExpandableListAdapter adapter = mAdapter;
        if (adapter != null) {
            for (int i = 0; i < adapter.getGroupCount(); i++) {
                long id = adapter.getGroupId(i);
                if (expandedIds.contains(id))
                    list.expandGroup(i);
            }
        }
    }
}
Also used : ExpandableListAdapter(android.widget.ExpandableListAdapter) 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