List of usage examples for android.support.v4.util Preconditions checkNotNull
public static @NonNull <T> T checkNotNull(final T reference, final Object errorMessage)
From source file:android.support.text.emoji.widget.EmojiTextViewHelper.java
/** * Default constructor./*from www . java 2 s.c om*/ * * @param textView TextView instance */ public EmojiTextViewHelper(@NonNull TextView textView) { Preconditions.checkNotNull(textView, "textView cannot be null"); mHelper = Build.VERSION.SDK_INT >= 19 ? new HelperInternal19(textView) : new HelperInternal(); }
From source file:android.support.text.emoji.EmojiSpan.java
/** * Default constructor./*from w w w.j a v a 2 s. c o m*/ * * @param metadata information about the emoji, cannot be {@code null} * * @hide */ @RestrictTo(LIBRARY_GROUP) EmojiSpan(@NonNull final EmojiMetadata metadata) { Preconditions.checkNotNull(metadata, "metadata cannot be null"); mMetadata = metadata; }
From source file:android.support.text.emoji.widget.SpannableBuilder.java
/** * @hide//from w w w .j av a2 s . co m */ @RestrictTo(LIBRARY_GROUP) SpannableBuilder(@NonNull Class<?> watcherClass) { Preconditions.checkNotNull(watcherClass, "watcherClass cannot be null"); mWatcherClass = watcherClass; }
From source file:android.support.text.emoji.widget.SpannableBuilder.java
/** * @hide/*from ww w . jav a 2s.c om*/ */ @RestrictTo(LIBRARY_GROUP) SpannableBuilder(@NonNull Class<?> watcherClass, @NonNull CharSequence text) { super(text); Preconditions.checkNotNull(watcherClass, "watcherClass cannot be null"); mWatcherClass = watcherClass; }
From source file:android.support.text.emoji.widget.EmojiEditTextHelper.java
/** * Default constructor./*from ww w . j ava2s .c o m*/ * * @param editText EditText instance */ public EmojiEditTextHelper(@NonNull final EditText editText) { Preconditions.checkNotNull(editText, "editText cannot be null"); mHelper = Build.VERSION.SDK_INT >= 19 ? new HelperInternal19(editText) : new HelperInternal(); }
From source file:android.support.text.emoji.widget.SpannableBuilder.java
/** * @hide//from w ww. ja va 2s . c o m */ @RestrictTo(LIBRARY_GROUP) SpannableBuilder(@NonNull Class<?> watcherClass, @NonNull CharSequence text, int start, int end) { super(text, start, end); Preconditions.checkNotNull(watcherClass, "watcherClass cannot be null"); mWatcherClass = watcherClass; }
From source file:android.support.text.emoji.widget.EmojiEditTextHelper.java
/** * Attaches EmojiCompat KeyListener to the widget. Should be called from {@link * TextView#setKeyListener(KeyListener)}. Existing keyListener is wrapped into EmojiCompat * KeyListener. When used on devices running API 18 or below, this method returns * {@code keyListener} that is given as a parameter. * * @param keyListener KeyListener passed into {@link TextView#setKeyListener(KeyListener)} * * @return a new KeyListener instance that wraps {@code keyListener}. */// w ww .j a v a 2 s . c om @NonNull public KeyListener getKeyListener(@NonNull final KeyListener keyListener) { Preconditions.checkNotNull(keyListener, "keyListener cannot be null"); return mHelper.getKeyListener(keyListener); }
From source file:android.support.text.emoji.MetadataRepo.java
/** * Add an EmojiMetadata to the index.//from w w w . j a v a2 s . c om * * @hide */ @RestrictTo(LIBRARY_GROUP) @VisibleForTesting void put(@NonNull final EmojiMetadata data) { Preconditions.checkNotNull(data, "emoji metadata cannot be null"); Preconditions.checkArgument(data.getCodepointsLength() > 0, "invalid metadata codepoint length"); mRootNode.put(data, 0, data.getCodepointsLength() - 1); }
From source file:android.support.text.emoji.EmojiCompat.java
/** * Registers an initialization callback. If the initialization is already completed by the time * the listener is added, the callback functions are called immediately. Callbacks are called on * the main looper.//from www . jav a2s. co m * <p/> * When used on devices running API 18 or below, {@link InitCallback#onInitialized()} is called * without loading any metadata. In such cases {@link InitCallback#onFailed(Throwable)} is never * called. * * @param initCallback the initialization callback to register, cannot be {@code null} * * @see #unregisterInitCallback(InitCallback) */ public void registerInitCallback(@NonNull InitCallback initCallback) { Preconditions.checkNotNull(initCallback, "initCallback cannot be null"); mInitLock.writeLock().lock(); try { if (mLoadState == LOAD_STATE_SUCCEEDED || mLoadState == LOAD_STATE_FAILED) { mMainHandler.post(new ListenerDispatcher(initCallback, mLoadState)); } else { mInitCallbacks.add(initCallback); } } finally { mInitLock.writeLock().unlock(); } }
From source file:android.support.text.emoji.EmojiCompat.java
/** * Unregisters a callback that was added before. * * @param initCallback the callback to be removed, cannot be {@code null} *//*from w w w. j a va 2 s. c o m*/ public void unregisterInitCallback(@NonNull InitCallback initCallback) { Preconditions.checkNotNull(initCallback, "initCallback cannot be null"); mInitLock.writeLock().lock(); try { mInitCallbacks.remove(initCallback); } finally { mInitLock.writeLock().unlock(); } }