Search in sources :

Example 11 with ActionMode

use of android.view.ActionMode in project android_frameworks_base by DirtyUnicorns.

the class WindowDecorActionBarTest method testStartActionMode.

@UiThreadTest
public void testStartActionMode() {
    ActionMode mode = mWindowDecorActionBar.startActionMode(mCallback);
    assertNotNull(mode);
    assertTrue(mCallback.mIsCreateActionModeCalled);
}
Also used : ActionMode(android.view.ActionMode) UiThreadTest(android.test.UiThreadTest)

Example 12 with ActionMode

use of android.view.ActionMode in project android_frameworks_base by DirtyUnicorns.

the class WindowDecorActionBarTest method testStartActionModeWhenCreateReturnsFalse.

@UiThreadTest
public void testStartActionModeWhenCreateReturnsFalse() {
    mCallback.mShouldCreateActionMode = false;
    ActionMode mode = mWindowDecorActionBar.startActionMode(mCallback);
    assertNull(mode);
    assertTrue(mCallback.mIsCreateActionModeCalled);
}
Also used : ActionMode(android.view.ActionMode) UiThreadTest(android.test.UiThreadTest)

Example 13 with ActionMode

use of android.view.ActionMode in project android_frameworks_base by DirtyUnicorns.

the class PhoneWindowActionModeTest method testStartActionModeFloatingFinishesPreviousMode.

public void testStartActionModeFloatingFinishesPreviousMode() {
    // Use custom callback to control the provided ActionMode.
    mWindowCallback.mShouldReturnOwnActionMode = true;
    ActionMode mode1 = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
    ActionMode mode2 = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
    assertTrue(mode1 instanceof MockActionMode);
    assertTrue(((MockActionMode) mode1).mIsFinished);
    assertNotNull(mode2);
}
Also used : ActionMode(android.view.ActionMode)

Example 14 with ActionMode

use of android.view.ActionMode in project android_frameworks_base by DirtyUnicorns.

the class PhoneWindowActionModeTest method testStartActionModePreservesPreviousModeOfDifferentType1.

public void testStartActionModePreservesPreviousModeOfDifferentType1() {
    // Use custom callback to control the provided ActionMode.
    mWindowCallback.mShouldReturnOwnActionMode = true;
    ActionMode mode1 = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
    ActionMode mode2 = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_PRIMARY);
    assertTrue(mode1 instanceof MockActionMode);
    assertFalse(((MockActionMode) mode1).mIsFinished);
    assertNotNull(mode2);
}
Also used : ActionMode(android.view.ActionMode)

Example 15 with ActionMode

use of android.view.ActionMode in project android_frameworks_base by DirtyUnicorns.

the class PhoneWindowActionModeTest method testCreatedModeIsNotStartedIfCreateReturnsFalse.

@UiThreadTest
public void testCreatedModeIsNotStartedIfCreateReturnsFalse() {
    mWindowCallback.mShouldReturnOwnActionMode = false;
    mActionModeCallback.mShouldCreateActionMode = false;
    ActionMode mode = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
    assertTrue(mActionModeCallback.mIsCreateActionModeCalled);
    assertFalse(mWindowCallback.mIsActionModeStarted);
    assertNull(mode);
}
Also used : ActionMode(android.view.ActionMode) UiThreadTest(android.test.UiThreadTest)

Aggregations

ActionMode (android.view.ActionMode)99 UiThreadTest (android.test.UiThreadTest)30 FloatingActionMode (com.android.internal.view.FloatingActionMode)15 StandaloneActionMode (com.android.internal.view.StandaloneActionMode)10 Menu (android.view.Menu)9 MenuItem (android.view.MenuItem)9 Animator (android.animation.Animator)6 Context (android.content.Context)6 Paint (android.graphics.Paint)6 View (android.view.View)6 AnimatorListenerAdapter (android.animation.AnimatorListenerAdapter)5 ObjectAnimator (android.animation.ObjectAnimator)5 Resources (android.content.res.Resources)5 TypedValue (android.util.TypedValue)5 ContextThemeWrapper (android.view.ContextThemeWrapper)5 ViewStub (android.view.ViewStub)5 PopupWindow (android.widget.PopupWindow)5 ActionBarContextView (com.android.internal.widget.ActionBarContextView)5 MenuInflater (android.view.MenuInflater)4 AdapterView (android.widget.AdapterView)3