use of android.view.ActionMode in project platform_frameworks_base by android.
the class PhoneWindowActionModeTest method testWindowCallbackModesLifecycleIsNotHandled.
public void testWindowCallbackModesLifecycleIsNotHandled() {
mWindowCallback.mShouldReturnOwnActionMode = true;
ActionMode mode = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_PRIMARY);
assertNotNull(mode);
assertEquals(mWindowCallback.mLastCreatedActionMode, mode);
assertFalse(mActionModeCallback.mIsCreateActionModeCalled);
assertTrue(mWindowCallback.mIsActionModeStarted);
}
use of android.view.ActionMode in project platform_frameworks_base by android.
the class PhoneWindowActionModeTest method testStartActionModeWithCallback.
public void testStartActionModeWithCallback() {
mWindowCallback.mShouldReturnOwnActionMode = true;
ActionMode mode = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
assertEquals(mWindowCallback.mLastCreatedActionMode, mode);
}
use of android.view.ActionMode in project platform_frameworks_base by android.
the class PhoneWindowActionModeTest method testCreatedFloatingModeLifecycleIsHandled.
@UiThreadTest
public void testCreatedFloatingModeLifecycleIsHandled() {
mWindowCallback.mShouldReturnOwnActionMode = false;
ActionMode mode = mPhoneWindow.getDecorView().startActionMode(mActionModeCallback, ActionMode.TYPE_FLOATING);
assertNotNull(mode);
assertEquals(ActionMode.TYPE_FLOATING, mode.getType());
assertTrue(mActionModeCallback.mIsCreateActionModeCalled);
assertTrue(mWindowCallback.mIsActionModeStarted);
}
use of android.view.ActionMode in project platform_frameworks_base by android.
the class ActionBarContainerTest method testPrimaryActionModesAreStopped.
public void testPrimaryActionModesAreStopped() {
TestViewGroup viewGroup = new TestViewGroup(mContext);
viewGroup.addView(mActionBarContainer);
ActionMode mode = mActionBarContainer.startActionModeForChild(null, null, ActionMode.TYPE_PRIMARY);
assertNull(mode);
// Should not bubble up.
assertFalse(viewGroup.isStartActionModeForChildTypedCalled);
assertFalse(viewGroup.isStartActionModeForChildTypelessCalled);
mode = mActionBarContainer.startActionModeForChild(null, null);
assertNull(mode);
// Should not bubble up.
assertFalse(viewGroup.isStartActionModeForChildTypedCalled);
assertFalse(viewGroup.isStartActionModeForChildTypelessCalled);
}
use of android.view.ActionMode in project android_frameworks_base by DirtyUnicorns.
the class StatusBarWindowView method startActionMode.
private ActionMode startActionMode(View originatingView, ActionMode.Callback callback, int type) {
ActionMode.Callback2 wrappedCallback = new ActionModeCallback2Wrapper(callback);
ActionMode mode = createFloatingActionMode(originatingView, wrappedCallback);
if (mode != null && wrappedCallback.onCreateActionMode(mode, mode.getMenu())) {
setHandledFloatingActionMode(mode);
} else {
mode = null;
}
return mode;
}
Aggregations