@Test public void testFilter_whenEmojiCompatLoadFailed() { when(mEmojiCompat.getLoadState()).thenReturn(EmojiCompat.LOAD_STATE_FAILED); final CharSequence result = mTransformationMethod.getTransformation(mTestString, mView); assertSame(mTestString, result); verify(mWrappedTransformationMethod, times(1)).getTransformation( sameCharSequence(mTestString), same(mView)); verify(mEmojiCompat, never()).process(sameCharSequence(mTestString)); verify(mEmojiCompat, never()).registerInitCallback(any(EmojiCompat.InitCallback.class)); }
@Override public CharSequence getTransformation(@Nullable CharSequence source, @NonNull final View view) { if (view.isInEditMode()) { return source; } if (mTransformationMethod != null) { source = mTransformationMethod.getTransformation(source, view); } if (source != null) { switch (EmojiCompat.get().getLoadState()){ case EmojiCompat.LOAD_STATE_SUCCEEDED: return EmojiCompat.get().process(source); case EmojiCompat.LOAD_STATE_LOADING: case EmojiCompat.LOAD_STATE_FAILED: case EmojiCompat.LOAD_STATE_DEFAULT: default: break; } } return source; }
EmojiTransformationMethod implements TransformationMethod { @Override public CharSequence getTransformation(@Nullable CharSequence source, @NonNull final View view) { if (view.isInEditMode()) { return source; } if (mTransformationMethod != null) { source = mTransformationMethod.getTransformation(source, view); } if (source != null) { switch (EmojiCompat.get().getLoadState()){ case EmojiCompat.LOAD_STATE_SUCCEEDED: return EmojiCompat.get().process(source); case EmojiCompat.LOAD_STATE_LOADING: case EmojiCompat.LOAD_STATE_FAILED: case EmojiCompat.LOAD_STATE_DEFAULT: default: break; } } return source; } }
EmojiTransformationMethod implements TransformationMethod { @Override public CharSequence getTransformation(@Nullable CharSequence source, @NonNull final View view) { if (view.isInEditMode()) { return source; } if (mTransformationMethod != null) { source = mTransformationMethod.getTransformation(source, view); } if (source != null) { switch (EmojiCompat.get().getLoadState()){ case EmojiCompat.LOAD_STATE_SUCCEEDED: return EmojiCompat.get().process(source); case EmojiCompat.LOAD_STATE_LOADING: case EmojiCompat.LOAD_STATE_FAILED: case EmojiCompat.LOAD_STATE_DEFAULT: default: break; } } return source; } EmojiTransformationMethod(TransformationMethod transformationMethod); }
EmojiTransformationMethod implements TransformationMethod { @Override public CharSequence getTransformation(@Nullable CharSequence source, @NonNull final View view) { if (view.isInEditMode()) { return source; } if (mTransformationMethod != null) { source = mTransformationMethod.getTransformation(source, view); } if (source != null) { switch (EmojiCompat.get().getLoadState()){ case EmojiCompat.LOAD_STATE_SUCCEEDED: return EmojiCompat.get().process(source); case EmojiCompat.LOAD_STATE_LOADING: case EmojiCompat.LOAD_STATE_FAILED: case EmojiCompat.LOAD_STATE_DEFAULT: default: break; } } return source; } EmojiTransformationMethod(TransformationMethod transformationMethod); @Override CharSequence getTransformation(@Nullable CharSequence source, @NonNull final View view); @Override void onFocusChanged(final View view, final CharSequence sourceText,
            final boolean focused, final int direction, final Rect previouslyFocusedRect); }
EmojiTransformationMethod implements TransformationMethod { @Override public CharSequence getTransformation(@Nullable CharSequence source, @NonNull final View view) { if (view.isInEditMode()) { return source; } if (mTransformationMethod != null) { source = mTransformationMethod.getTransformation(source, view); } if (source != null) { switch (EmojiCompat.get().getLoadState()){ case EmojiCompat.LOAD_STATE_SUCCEEDED: return EmojiCompat.get().process(source); case EmojiCompat.LOAD_STATE_LOADING: case EmojiCompat.LOAD_STATE_FAILED: case EmojiCompat.LOAD_STATE_DEFAULT: default: break; } } return source; } EmojiTransformationMethod(TransformationMethod transformationMethod); @Override CharSequence getTransformation(@Nullable CharSequence source, @NonNull final View view); @Override void onFocusChanged(final View view, final CharSequence sourceText,
            final boolean focused, final int direction, final Rect previouslyFocusedRect);  }