Tabnine Logo
HorizontalOverScrollBounceEffectDecorator.getCurrentState
Code IndexAdd Tabnine to your IDE (free)

How to use
getCurrentState
method
in
me.everything.android.ui.overscroll.HorizontalOverScrollBounceEffectDecorator

Best Java code snippets using me.everything.android.ui.overscroll.HorizontalOverScrollBounceEffectDecorator.getCurrentState (Showing top 12 results out of 315)

origin: EverythingMe/overscroll-decor

@Test
public void onTouchMoveAction_notInViewEnds_ignoreTouchEvent() throws Exception {
  // Arrange
  MotionEvent event = createShortRightMoveEvent();
  when(mViewAdapter.isInAbsoluteStart()).thenReturn(false);
  when(mViewAdapter.isInAbsoluteEnd()).thenReturn(false);
  HorizontalOverScrollBounceEffectDecorator uut = getUUT();
  // Act
  boolean ret = uut.onTouch(mView, event);
  // Assert
  verify(mView, never()).setTranslationX(anyFloat());
  verify(mView, never()).setTranslationY(anyFloat());
  assertFalse(ret);
  assertEquals(STATE_IDLE, uut.getCurrentState());
  verify(mStateListener, never()).onOverScrollStateChange(eq(uut), anyInt(), anyInt());
  verify(mUpdateListener, never()).onOverScrollUpdate(eq(uut), anyInt(), anyFloat());
}
origin: EverythingMe/overscroll-decor

@Test
public void onTouchMoveAction_dragLeftInRightEnd_overscrollLeft() throws Exception {
  // Arrange
  MotionEvent event = createShortLeftMoveEvent();
  when(mViewAdapter.isInAbsoluteStart()).thenReturn(false);
  when(mViewAdapter.isInAbsoluteEnd()).thenReturn(true);
  HorizontalOverScrollBounceEffectDecorator uut = getUUT();
  // Act
  final boolean ret = uut.onTouch(mView, event);
  // Assert
  final float expectedTransX = (event.getX() - event.getHistoricalX(0)) / DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
  verify(mView).setTranslationX(expectedTransX);
  verify(mView, never()).setTranslationY(anyFloat());
  assertTrue(ret);
  assertEquals(STATE_DRAG_END_SIDE, uut.getCurrentState());
  verify(mStateListener).onOverScrollStateChange(eq(uut), eq(STATE_IDLE), eq(STATE_DRAG_END_SIDE));
  verify(mUpdateListener).onOverScrollUpdate(eq(uut), eq(STATE_DRAG_END_SIDE), eq(expectedTransX));
}
origin: EverythingMe/overscroll-decor

@Test
public void onTouchMoveAction_dragLeftInLeftEnd_ignoreTouchEvent() throws Exception {
  // Arrange
  MotionEvent event = createShortLeftMoveEvent();
  when(mViewAdapter.isInAbsoluteStart()).thenReturn(true);
  when(mViewAdapter.isInAbsoluteEnd()).thenReturn(false);
  HorizontalOverScrollBounceEffectDecorator uut = getUUT();
  // Act
  final boolean ret = uut.onTouch(mView, event);
  // Assert
  verify(mView, never()).setTranslationX(anyFloat());
  verify(mView, never()).setTranslationY(anyFloat());
  assertFalse(ret);
  assertEquals(STATE_IDLE, uut.getCurrentState());
  verify(mStateListener, never()).onOverScrollStateChange(eq(uut), anyInt(), anyInt());
  verify(mUpdateListener, never()).onOverScrollUpdate(eq(uut), anyInt(), anyFloat());
}
origin: EverythingMe/overscroll-decor

@Test
public void onTouchMoveAction_dragRightInLeftEnd_overscrollRight() throws Exception {
  // Arrange
  MotionEvent event = createShortRightMoveEvent();
  when(mViewAdapter.isInAbsoluteStart()).thenReturn(true);
  when(mViewAdapter.isInAbsoluteEnd()).thenReturn(false);
  HorizontalOverScrollBounceEffectDecorator uut = getUUT();
  // Act
  final boolean ret = uut.onTouch(mView, event);
  // Assert
  final float expectedTransX = (event.getX() - event.getHistoricalX(0)) / DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
  verify(mView).setTranslationX(expectedTransX);
  verify(mView, never()).setTranslationY(anyFloat());
  assertTrue(ret);
  assertEquals(STATE_DRAG_START_SIDE, uut.getCurrentState());
  verify(mStateListener).onOverScrollStateChange(eq(uut), eq(STATE_IDLE), eq(STATE_DRAG_START_SIDE));
  verify(mUpdateListener).onOverScrollUpdate(eq(uut), eq(STATE_DRAG_START_SIDE), eq(expectedTransX));
}
origin: EverythingMe/overscroll-decor

@Test
public void onTouchMoveAction_dragRightInRightEnd_ignoreTouchEvent() throws Exception {
  // Arrange
  MotionEvent event = createShortRightMoveEvent();
  when(mViewAdapter.isInAbsoluteStart()).thenReturn(false);
  when(mViewAdapter.isInAbsoluteEnd()).thenReturn(true);
  HorizontalOverScrollBounceEffectDecorator uut = getUUT();
  // Act
  boolean ret = uut.onTouch(mView, event);
  // Assert
  verify(mView, never()).setTranslationX(anyFloat());
  verify(mView, never()).setTranslationY(anyFloat());
  assertFalse(ret);
  assertEquals(STATE_IDLE, uut.getCurrentState());
  verify(mStateListener, never()).onOverScrollStateChange(eq(uut), anyInt(), anyInt());
  verify(mUpdateListener, never()).onOverScrollUpdate(eq(uut), anyInt(), anyFloat());
}
origin: EverythingMe/overscroll-decor

@Test
public void onTouchUpAction_eventWhenNotOverscrolled_ignoreTouchEvent() throws Exception {
  // Arrange
  MotionEvent event = createDefaultUpActionEvent();
  when(mViewAdapter.isInAbsoluteStart()).thenReturn(true);
  when(mViewAdapter.isInAbsoluteEnd()).thenReturn(true);
  HorizontalOverScrollBounceEffectDecorator uut = getUUT();
  // Act
  boolean ret = uut.onTouch(mView, event);
  // Assert
  verify(mView, never()).setTranslationX(anyFloat());
  verify(mView, never()).setTranslationY(anyFloat());
  assertFalse(ret);
  assertEquals(STATE_IDLE, uut.getCurrentState());
  verify(mStateListener, never()).onOverScrollStateChange(eq(uut), anyInt(), anyInt());
  verify(mUpdateListener, never()).onOverScrollUpdate(eq(uut), anyInt(), anyFloat());
}
origin: EverythingMe/overscroll-decor

@Test
public void onTouchMoveAction_2ndLeftDragInRightEnd_overscrollLeftFurther() throws Exception {
  // Arrange
  // Bring UUT to a left-overscroll state
  MotionEvent event1 = createShortLeftMoveEvent();
  when(mViewAdapter.isInAbsoluteStart()).thenReturn(false);
  when(mViewAdapter.isInAbsoluteEnd()).thenReturn(true);
  HorizontalOverScrollBounceEffectDecorator uut = getUUT();
  uut.onTouch(mView, event1);
  reset(mView);
  // Create 2nd left-drag event
  MotionEvent event2 = createLongLeftMoveEvent();
  // Act
  final boolean ret = uut.onTouch(mView, event2);
  // Assert
  final float expectedTransX1 = (event1.getX() - event1.getHistoricalX(0)) / DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
  final float expectedTransX2 = (event2.getX() - event2.getHistoricalX(0)) / DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
  verify(mView).setTranslationX(expectedTransX2);
  verify(mView, never()).setTranslationY(anyFloat());
  assertTrue(ret);
  assertEquals(STATE_DRAG_END_SIDE, uut.getCurrentState());
  // State-change listener called only once?
  verify(mStateListener).onOverScrollStateChange(eq(uut), eq(STATE_IDLE), eq(STATE_DRAG_END_SIDE));
  verify(mStateListener).onOverScrollStateChange(eq(uut), anyInt(), anyInt());
  // Update-listener called exactly twice?
  verify(mUpdateListener).onOverScrollUpdate(eq(uut), eq(STATE_DRAG_END_SIDE), eq(expectedTransX1));
  verify(mUpdateListener).onOverScrollUpdate(eq(uut), eq(STATE_DRAG_END_SIDE), eq(expectedTransX2));
  verify(mUpdateListener, times(2)).onOverScrollUpdate(eq(uut), anyInt(), anyFloat());
}
origin: EverythingMe/overscroll-decor

@Test
public void onTouchMoveAction_2ndRightDragInLeftEnd_overscrollRightFurther() throws Exception {
  // Arrange
  // Bring UUT to a right-overscroll state
  MotionEvent event1 = createShortRightMoveEvent();
  when(mViewAdapter.isInAbsoluteStart()).thenReturn(true);
  when(mViewAdapter.isInAbsoluteEnd()).thenReturn(false);
  HorizontalOverScrollBounceEffectDecorator uut = getUUT();
  uut.onTouch(mView, event1);
  reset(mView);
  // Create 2nd right-drag event
  MotionEvent event2 = createLongRightMoveEvent();
  // Act
  final boolean ret = uut.onTouch(mView, event2);
  // Assert
  final float expectedTransX1 = (event1.getX() - event1.getHistoricalX(0)) / DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
  final float expectedTransX2 = (event2.getX() - event2.getHistoricalX(0)) / DEFAULT_TOUCH_DRAG_MOVE_RATIO_FWD;
  verify(mView).setTranslationX(expectedTransX2);
  verify(mView, never()).setTranslationY(anyFloat());
  assertTrue(ret);
  assertEquals(STATE_DRAG_START_SIDE, uut.getCurrentState());
  // State-change listener called only once?
  verify(mStateListener).onOverScrollStateChange(eq(uut), eq(STATE_IDLE), eq(STATE_DRAG_START_SIDE));
  verify(mStateListener).onOverScrollStateChange(eq(uut), anyInt(), anyInt());
  // Update-listener called exactly twice?
  verify(mUpdateListener).onOverScrollUpdate(eq(uut), eq(STATE_DRAG_START_SIDE), eq(expectedTransX1));
  verify(mUpdateListener).onOverScrollUpdate(eq(uut), eq(STATE_DRAG_START_SIDE), eq(expectedTransX2));
  verify(mUpdateListener, times(2)).onOverScrollUpdate(eq(uut), anyInt(), anyFloat());
}
origin: EverythingMe/overscroll-decor

verify(mView, never()).setTranslationY(anyFloat());
assertTrue(ret);
assertEquals(STATE_IDLE, uut.getCurrentState());
origin: EverythingMe/overscroll-decor

verify(mView, never()).setTranslationY(anyFloat());
assertTrue(ret);
assertEquals(STATE_IDLE, uut.getCurrentState());
origin: EverythingMe/overscroll-decor

verify(mView, never()).setTranslationY(anyFloat());
assertTrue(ret);
assertEquals(STATE_DRAG_END_SIDE, uut.getCurrentState());
origin: EverythingMe/overscroll-decor

verify(mView, never()).setTranslationY(anyFloat());
assertTrue(ret);
assertEquals(STATE_DRAG_START_SIDE, uut.getCurrentState());
me.everything.android.ui.overscrollHorizontalOverScrollBounceEffectDecoratorgetCurrentState

Popular methods of HorizontalOverScrollBounceEffectDecorator

  • <init>
    C'tor, creating the effect with explicit arguments.
  • detach
  • onTouch
  • setOverScrollStateListener
  • setOverScrollUpdateListener

Popular in Java

  • Reading from database using SQL prepared statement
  • getResourceAsStream (ClassLoader)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • Notification (javax.management)
  • JFileChooser (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now