Example usage for android.view ViewGroup isSelected

List of usage examples for android.view ViewGroup isSelected

Introduction

In this page you can find the example usage for android.view ViewGroup isSelected.

Prototype

@ViewDebug.ExportedProperty
public boolean isSelected() 

Source Link

Document

Indicates the selection state of this view.

Usage

From source file:de.grobox.liberario.TripsActivity.java

private void selectTrip(View view, ViewGroup vg) {
    // take care of cases for ActionMode is already activated
    if (mActionMode != null) {
        if (vg.isSelected()) {
            // disable action mode for current item
            mActionMode.finish();//w  w w  . j  a  va2s . c  o  m

            // exit here to not start new ActionMode
            return;
        } else {
            // deselect previously selected trip
            mSelectedTrip.setSelected(false);

            // disable action mode for current item
            mActionMode.finish();
        }
    }

    // select clicked trip
    mSelectedTrip = vg;
    mSelectedTrip.setSelected(true);

    // active new ActionMode for clicked trip
    mActionMode = startActionMode(mTripActionMode);
}