Example usage for android.app ActionBar startActionMode

List of usage examples for android.app ActionBar startActionMode

Introduction

In this page you can find the example usage for android.app ActionBar startActionMode.

Prototype

public ActionMode startActionMode(ActionMode.Callback callback) 

Source Link

Usage

From source file:android.support.v7.app.AppCompatDelegateImplV7.java

@Override
public ActionMode startSupportActionMode(ActionMode.Callback callback) {
    if (callback == null) {
        throw new IllegalArgumentException("ActionMode callback can not be null.");
    }/*from  w  w w  .  j  a va2  s. co  m*/

    if (mActionMode != null) {
        mActionMode.finish();
    }

    final ActionMode.Callback wrappedCallback = new ActionModeCallbackWrapper(callback);

    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        mActionMode = ab.startActionMode(wrappedCallback);
        if (mActionMode != null && mAppCompatCallback != null) {
            mAppCompatCallback.onSupportActionModeStarted(mActionMode);
        }
    }

    if (mActionMode == null) {
        // If the action bar didn't provide an action mode, start the emulated window one
        mActionMode = startSupportActionModeFromWindow(wrappedCallback);
    }

    return mActionMode;
}

From source file:android.support.v7ox.app.AppCompatDelegateImplV7.java

@Override
public ActionMode startSupportActionMode(ActionMode.Callback callback) {
    if (callback == null) {
        throw new IllegalArgumentException("ActionMode callback can not be null.");
    }/*  w  w w . j  a va2  s. c o  m*/

    if (mActionMode != null) {
        mActionMode.finish();
    }

    final ActionMode.Callback wrappedCallback = new ActionModeCallbackWrapperV7(callback);

    ActionBar ab = getSupportActionBar();
    if (ab != null) {
        mActionMode = ab.startActionMode(wrappedCallback);
        if (mActionMode != null && mAppCompatCallback != null) {
            mAppCompatCallback.onSupportActionModeStarted(mActionMode);
        }
    }

    if (mActionMode == null) {
        // If the action bar didn't provide an action mode, start the emulated window one
        mActionMode = startSupportActionModeFromWindow(wrappedCallback);
    }

    return mActionMode;
}