Java Code Examples for android.widget.ExpandableListView#setChoiceMode()

The following examples show how to use android.widget.ExpandableListView#setChoiceMode() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RootsFragment.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final View view = inflater.inflate(R.layout.fragment_roots, container, false);
    mList = (ExpandableListView) view.findViewById(android.R.id.list);
    mList.setOnChildClickListener(mItemListener);
    mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    DisplayMetrics metrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int width = Utils.dpToPx(302);

    boolean rtl = Utils.isRTL();
    int leftPadding = rtl ? 10 : 50;
    int rightPadding = rtl ? 50 : 10;
    int leftWidth = width - Utils.dpToPx(leftPadding);
    int rightWidth = width - Utils.dpToPx(rightPadding);

    if(Utils.hasJellyBeanMR2()){
        mList.setIndicatorBoundsRelative(leftWidth, rightWidth);

    } else {
        mList.setIndicatorBounds(leftWidth, rightWidth);
    }
    return view;
}
 
Example 2
Source File: RootsFragment.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final View view = inflater.inflate(R.layout.fragment_roots, container, false);
    mList = (ExpandableListView) view.findViewById(android.R.id.list);
    mList.setOnChildClickListener(mItemListener);
    mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    DisplayMetrics metrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int width = Utils.dpToPx(302);

    boolean rtl = Utils.isRTL();
    int leftPadding = rtl ? 10 : 50;
    int rightPadding = rtl ? 50 : 10;
    int leftWidth = width - Utils.dpToPx(leftPadding);
    int rightWidth = width - Utils.dpToPx(rightPadding);

    if(Utils.hasJellyBeanMR2()){
        mList.setIndicatorBoundsRelative(leftWidth, rightWidth);

    } else {
        mList.setIndicatorBounds(leftWidth, rightWidth);
    }
    return view;
}
 
Example 3
Source File: RootsFragment.java    From FireFiles with Apache License 2.0 5 votes vote down vote up
@Override
public View onCreateView(
        LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    final View view = inflater.inflate(R.layout.fragment_roots, container, false);
    mList = (ExpandableListView) view.findViewById(android.R.id.list);
    mList.setOnChildClickListener(mItemListener);
    mList.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

    DisplayMetrics metrics = new DisplayMetrics();
    getActivity().getWindowManager().getDefaultDisplay().getMetrics(metrics);
    int width = Utils.dpToPx(302);

    boolean rtl = Utils.isRTL();
    int leftPadding = rtl ? 10 : 50;
    int rightPadding = rtl ? 50 : 10;
    int leftWidth = width - Utils.dpToPx(leftPadding);
    int rightWidth = width - Utils.dpToPx(rightPadding);

    if(Utils.hasJellyBeanMR2()){
        mList.setIndicatorBoundsRelative(leftWidth, rightWidth);

    } else {
        mList.setIndicatorBounds(leftWidth, rightWidth);
    }
    return view;
}
 
Example 4
Source File: PadListActivity.java    From padland with Apache License 2.0 5 votes vote down vote up
/**
 * Makes an empty ListView and returns it.
 *
 * @return ListView
 */
private void _initListView() {
    expandableListView = (ExpandableListView) findViewById(R.id.listView);
    expandableListView.setTextFilterEnabled(true);
    expandableListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
    expandableListView.setEmptyView(findViewById(android.R.id.empty));

    // Set the data
    setAdapter();

    // events
    this._setListViewEvents();

    adapter.notifyDataSetChanged();
}