@android.annotation.Nullable

Here are the examples of the java api @android.annotation.Nullable taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

496 Examples 7

19 Source : TaskSnapshotController.java
with Apache License 2.0
from lulululbj

/**
 * Retrieves a snapshot. If {@param restoreFromDisk} equals {@code true}, DO HOLD THE WINDOW
 * MANAGER LOCK WHEN CALLING THIS METHOD!
 */
@Nullable
TaskSnapshot getSnapshot(int taskId, int userId, boolean restoreFromDisk, boolean reducedResolution) {
    return mCache.getSnapshot(taskId, userId, restoreFromDisk, reducedResolution || DISABLE_FULL_SIZED_BITMAPS);
}

19 Source : TextServicesManagerService.java
with Apache License 2.0
from lulululbj

/**
 * @param callingUserId user ID of the calling process
 * @return {@link TextServicesData} for the given user.  {@code null} if spell checker is not
 *         temporarily / permanently available for the specified user
 */
@Nullable
private TextServicesData getDataFromCallingUserIdLocked(@UserIdInt int callingUserId) {
    final int spellCheckerOwnerUserId = mSpellCheckerOwnerUserIdMap.get(callingUserId);
    final TextServicesData data = mUserData.get(spellCheckerOwnerUserId);
    if (DISABLE_PER_PROFILE_SPELL_CHECKER) {
        if (spellCheckerOwnerUserId != callingUserId) {
            // Calling process is running under child profile.
            if (data == null) {
                return null;
            }
            final SpellCheckerInfo info = data.getCurrentSpellChecker();
            if (info == null) {
                return null;
            }
            final ServiceInfo serviceInfo = info.getServiceInfo();
            if ((serviceInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
                // To be conservative, non pre-installed spell checker services are not allowed
                // to be used for child profiles.
                return null;
            }
        }
    }
    return data;
}

19 Source : ServiceWatcher.java
with Apache License 2.0
from lulululbj

@Nullable
public String getBestPackageName() {
    synchronized (mLock) {
        return mBoundPackageName;
    }
}

19 Source : PermissionSettings.java
with Apache License 2.0
from lulululbj

@Nullable
public BasePermission getPermission(@NonNull String permName) {
    synchronized (mLock) {
        return getPermissionLocked(permName);
    }
}

19 Source : PinnerService.java
with Apache License 2.0
from lulululbj

/**
 * Retrieves the current application info for the given app type.
 *
 * @param key The app type to retrieve the info for.
 * @param userHandle The user id of the current user.
 */
@Nullable
private ApplicationInfo getInfoForKey(@AppKey int key, int userHandle) {
    switch(key) {
        case KEY_CAMERA:
            return getCameraInfo(userHandle);
        case KEY_HOME:
            return getHomeInfo(userHandle);
        default:
            return null;
    }
}

19 Source : NotificationRecord.java
with Apache License 2.0
from lulululbj

/**
 * @return all {@link Uri} that should have permission granted to whoever
 *         will be rendering it. This list has already been vetted to only
 *         include {@link Uri} that the enqueuing app can grant.
 */
@Nullable
public ArraySet<Uri> getGrantableUris() {
    return mGrantableUris;
}

19 Source : NetworkScoreService.java
with Apache License 2.0
from lulululbj

@Nullable
private INetworkRecommendationProvider getRecommendationProvider() {
    synchronized (mServiceConnectionLock) {
        if (mServiceConnection != null) {
            return mServiceConnection.getRecommendationProvider();
        }
    }
    return null;
}

19 Source : WatchlistLoggingHandler.java
with Apache License 2.0
from lulululbj

/**
 * Search if any ip addresses are in watchlist.
 *
 * @param ipAddresses Ip address that you want to search in watchlist.
 * @return Ip address that exists in watchlist, null if it does not match anything.
 */
@Nullable
private String searchIpInWatchlist(String[] ipAddresses) {
    for (String ipAddress : ipAddresses) {
        if (isIpInWatchlist(ipAddress)) {
            return ipAddress;
        }
    }
    return null;
}

19 Source : WatchlistLoggingHandler.java
with Apache License 2.0
from lulululbj

/**
 * Search if any sub-domain in host is in watchlist.
 *
 * @param host Host that we want to search.
 * @return Domain that exists in watchlist, null if it does not match anything.
 */
@Nullable
private String searchAllSubDomainsInWatchlist(String host) {
    if (host == null) {
        return null;
    }
    final String[] subDomains = getAllSubDomains(host);
    for (String subDomain : subDomains) {
        if (isHostInWatchlist(subDomain)) {
            return subDomain;
        }
    }
    return null;
}

19 Source : RecoverableKeyStoreManager.java
with Apache License 2.0
from lulululbj

/**
 * Returns an alias for the key.
 *
 * @param userId The user ID of the calling process.
 * @param uid The uid of the calling process.
 * @param alias The alias of the key.
 * @return The alias in the calling process's keystore.
 */
@Nullable
private String getAlias(int userId, int uid, String alias) {
    return mApplicationKeyStorage.getGrantAlias(userId, uid, alias);
}

19 Source : LockSettingsStorage.java
with Apache License 2.0
from lulululbj

@Nullable
public PersistentDataBlockManagerInternal getPersistentDataBlock() {
    if (mPersistentDataBlockManagerInternal == null) {
        mPersistentDataBlockManagerInternal = LocalServices.getService(PersistentDataBlockManagerInternal.clreplaced);
    }
    return mPersistentDataBlockManagerInternal;
}

19 Source : Convert.java
with Apache License 2.0
from lulululbj

@Nullable
static <T> ArrayList<T> listToArrayList(@Nullable List<T> list) {
    if (list == null)
        return null;
    if (list instanceof ArrayList)
        return (ArrayList) list;
    return new ArrayList<>(list);
}

19 Source : MemoryStatUtil.java
with Apache License 2.0
from lulululbj

/**
 * Reads memory stat for a process.
 *
 * Reads from per-app memcg if available on device, else fallback to procfs.
 * Returns null if no stats can be read.
 */
@Nullable
static MemoryStat readMemoryStatFromFilesystem(int uid, int pid) {
    return hasMemcg() ? readMemoryStatFromMemcg(uid, pid) : readMemoryStatFromProcfs(pid);
}

19 Source : TabWidget.java
with Apache License 2.0
from lulululbj

/**
 * @return the drawable used as the right part of the strip below the tab
 *         indicators, may be {@code null}
 * @see #setRightStripDrawable(int)
 * @see #setRightStripDrawable(Drawable)
 * @attr ref android.R.styleable#TabWidget_tabStripRight
 */
@Nullable
public Drawable getRightStripDrawable() {
    return mRightStrip;
}

19 Source : TabWidget.java
with Apache License 2.0
from lulululbj

/**
 * @return the drawable used as the left part of the strip below the tab
 *         indicators, may be {@code null}
 * @see #setLeftStripDrawable(int)
 * @see #setLeftStripDrawable(Drawable)
 * @attr ref android.R.styleable#TabWidget_tabStripLeft
 */
@Nullable
public Drawable getLeftStripDrawable() {
    return mLeftStrip;
}

19 Source : TabHost.java
with Apache License 2.0
from lulululbj

/**
 * Returns the current tab.
 *
 * @return the current tab, may be {@code null} if no tab is set as current
 */
@Nullable
public int getCurrentTab() {
    return mCurrentTab;
}

19 Source : TabHost.java
with Apache License 2.0
from lulululbj

/**
 * Returns the view for the current tab.
 *
 * @return the view for the current tab, may be {@code null} if no tab is
 *         set as current
 */
@Nullable
public View getCurrentTabView() {
    if (mCurrentTab >= 0 && mCurrentTab < mTabSpecs.size()) {
        return mTabWidget.getChildTabViewAt(mCurrentTab);
    }
    return null;
}

19 Source : SelectionActionModeHelper.java
with Apache License 2.0
from lulululbj

@Nullable
public TextClreplacedification getTextClreplacedification() {
    return mTextClreplacedification;
}

19 Source : ListPopupWindow.java
with Apache License 2.0
from lulululbj

/**
 * @return The View for the currently selected item or null if
 * {@link #isShowing()} == {@code false}.
 *
 * @see ListView#getSelectedView()
 */
@Nullable
public View getSelectedView() {
    if (!isShowing()) {
        return null;
    }
    return mDropDownList.getSelectedView();
}

19 Source : ListPopupWindow.java
with Apache License 2.0
from lulululbj

/**
 * @return The currently selected item or null if the popup is not showing.
 */
@Nullable
public Object getSelectedItem() {
    if (!isShowing()) {
        return null;
    }
    return mDropDownList.getSelectedItem();
}

19 Source : ListPopupWindow.java
with Apache License 2.0
from lulululbj

/**
 * Returns the view that will be used to anchor this popup.
 *
 * @return The popup's anchor view
 */
@Nullable
public View getAnchorView() {
    return mDropDownAnchorView;
}

19 Source : ListPopupWindow.java
with Apache License 2.0
from lulululbj

/**
 * @return The background drawable for the popup window.
 */
@Nullable
public Drawable getBackground() {
    return mPopup.getBackground();
}

19 Source : CompoundButton.java
with Apache License 2.0
from lulululbj

/**
 * @return the blending mode used to apply the tint to the button drawable
 * @attr ref android.R.styleable#CompoundButton_buttonTintMode
 * @see #setButtonTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getButtonTintMode() {
    return mButtonTintMode;
}

19 Source : CompoundButton.java
with Apache License 2.0
from lulululbj

/**
 * @return the tint applied to the button drawable
 * @attr ref android.R.styleable#CompoundButton_buttonTint
 * @see #setButtonTintList(ColorStateList)
 */
@Nullable
public ColorStateList getButtonTintList() {
    return mButtonTintList;
}

19 Source : CompoundButton.java
with Apache License 2.0
from lulululbj

/**
 * @return the drawable used as the compound button image
 * @see #setButtonDrawable(Drawable)
 * @see #setButtonDrawable(int)
 */
@Nullable
public Drawable getButtonDrawable() {
    return mButtonDrawable;
}

19 Source : CheckedTextView.java
with Apache License 2.0
from lulululbj

/**
 * Returns the blending mode used to apply the tint to the check mark
 * drawable, if specified.
 *
 * @return the blending mode used to apply the tint to the check mark
 *         drawable
 * @attr ref android.R.styleable#CheckedTextView_checkMarkTintMode
 * @see #setCheckMarkTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getCheckMarkTintMode() {
    return mCheckMarkTintMode;
}

19 Source : CheckedTextView.java
with Apache License 2.0
from lulululbj

/**
 * Returns the tint applied to the check mark drawable, if specified.
 *
 * @return the tint applied to the check mark drawable
 * @attr ref android.R.styleable#CheckedTextView_checkMarkTint
 * @see #setCheckMarkTintList(ColorStateList)
 */
@Nullable
public ColorStateList getCheckMarkTintList() {
    return mCheckMarkTintList;
}

19 Source : AdapterView.java
with Apache License 2.0
from lulululbj

/**
 * @return The callback to be invoked with an item in this AdapterView has
 *         been clicked, or null if no callback has been set.
 */
@Nullable
public final OnItemClickListener getOnItemClickListener() {
    return mOnItemClickListener;
}

19 Source : AdapterView.java
with Apache License 2.0
from lulululbj

@Nullable
public final OnItemSelectedListener getOnItemSelectedListener() {
    return mOnItemSelectedListener;
}

19 Source : ActionMenuView.java
with Apache License 2.0
from lulululbj

/**
 * Return the current drawable used as the overflow icon.
 *
 * @return The overflow icon drawable
 */
@Nullable
public Drawable getOverflowIcon() {
    getMenu();
    return mPresenter.getOverflowIcon();
}

19 Source : AbsSeekBar.java
with Apache License 2.0
from lulululbj

/**
 * Returns the blending mode used to apply the tint to the tick mark drawable,
 * if specified.
 *
 * @return the blending mode used to apply the tint to the tick mark drawable
 * @attr ref android.R.styleable#SeekBar_tickMarkTintMode
 * @see #setTickMarkTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getTickMarkTintMode() {
    return mTickMarkTintMode;
}

19 Source : AbsSeekBar.java
with Apache License 2.0
from lulululbj

/**
 * Returns the blending mode used to apply the tint to the thumb drawable,
 * if specified.
 *
 * @return the blending mode used to apply the tint to the thumb drawable
 * @attr ref android.R.styleable#SeekBar_thumbTintMode
 * @see #setThumbTintMode(PorterDuff.Mode)
 */
@Nullable
public PorterDuff.Mode getThumbTintMode() {
    return mThumbTintMode;
}

19 Source : AbsSeekBar.java
with Apache License 2.0
from lulululbj

/**
 * Returns the tint applied to the tick mark drawable, if specified.
 *
 * @return the tint applied to the tick mark drawable
 * @attr ref android.R.styleable#SeekBar_tickMarkTint
 * @see #setTickMarkTintList(ColorStateList)
 */
@Nullable
public ColorStateList getTickMarkTintList() {
    return mTickMarkTintList;
}

19 Source : AbsSeekBar.java
with Apache License 2.0
from lulululbj

/**
 * Returns the tint applied to the thumb drawable, if specified.
 *
 * @return the tint applied to the thumb drawable
 * @attr ref android.R.styleable#SeekBar_thumbTint
 * @see #setThumbTintList(ColorStateList)
 */
@Nullable
public ColorStateList getThumbTintList() {
    return mThumbTintList;
}

19 Source : WebViewClient.java
with Apache License 2.0
from lulululbj

/**
 * Notify the host application of a resource request and allow the
 * application to return the data.  If the return value is {@code null}, the WebView
 * will continue to load the resource as usual.  Otherwise, the return
 * response and data will be used.
 *
 * <p>This callback is invoked for a variety of URL schemes (e.g., {@code http(s):}, {@code
 * data:}, {@code file:}, etc.), not only those schemes which send requests over the network.
 * This is not called for {@code javascript:} URLs, {@code blob:} URLs, or for replacedets accessed
 * via {@code file:///android_replacedet/} or {@code file:///android_res/} URLs.
 *
 * <p>In the case of redirects, this is only called for the initial resource URL, not any
 * subsequent redirect URLs.
 *
 * <p clreplaced="note"><b>Note:</b> This method is called on a thread
 * other than the UI thread so clients should exercise caution
 * when accessing private data or the view system.
 *
 * <p clreplaced="note"><b>Note:</b> When Safe Browsing is enabled, these URLs still undergo Safe
 * Browsing checks. If this is undesired, whitelist the URL with {@link
 * WebView#setSafeBrowsingWhitelist} or ignore the warning with {@link #onSafeBrowsingHit}.
 *
 * @param view The {@link android.webkit.WebView} that is requesting the
 *             resource.
 * @param request Object containing the details of the request.
 * @return A {@link android.webkit.WebResourceResponse} containing the
 *         response information or {@code null} if the WebView should load the
 *         resource itself.
 */
@Nullable
public WebResourceResponse shouldInterceptRequest(WebView view, WebResourceRequest request) {
    return shouldInterceptRequest(view, request.getUrl().toString());
}

19 Source : WebMessage.java
with Apache License 2.0
from lulululbj

/**
 * Returns the ports that are sent with the message, or {@code null} if no port
 * is sent.
 */
@Nullable
public WebMessagePort[] getPorts() {
    return mPorts;
}

19 Source : WebChromeClient.java
with Apache License 2.0
from lulululbj

/**
 * Obtains a View to be displayed while buffering of full screen video is taking
 * place. The host application can override this method to provide a View
 * containing a spinner or similar.
 *
 * @return View The View to be displayed whilst the video is loading.
 */
@Nullable
public View getVideoLoadingProgressView() {
    return null;
}

19 Source : WebChromeClient.java
with Apache License 2.0
from lulululbj

/**
 * When not playing, video elements are represented by a 'poster' image. The
 * image to use can be specified by the poster attribute of the video tag in
 * HTML. If the attribute is absent, then a default poster will be used. This
 * method allows the ChromeClient to provide that default image.
 *
 * @return Bitmap The image to use as a default poster, or {@code null} if no such image is
 * available.
 */
@Nullable
public Bitmap getDefaultVideoPoster() {
    return null;
}

19 Source : ServiceWorkerClient.java
with Apache License 2.0
from lulululbj

/**
 * Notify the host application of a resource request and allow the
 * application to return the data. If the return value is {@code null}, the
 * Service Worker will continue to load the resource as usual.
 * Otherwise, the return response and data will be used.
 *
 * <p clreplaced="note"><b>Note:</b> This method is called on a thread other than the UI thread so
 * clients should exercise caution when accessing private data or the view system.
 *
 * @param request Object containing the details of the request.
 * @return A {@link android.webkit.WebResourceResponse} containing the
 *         response information or {@code null} if the WebView should load the
 *         resource itself.
 * @see WebViewClient#shouldInterceptRequest(WebView, WebResourceRequest)
 */
@Nullable
public WebResourceResponse shouldInterceptRequest(WebResourceRequest request) {
    return null;
}

19 Source : WindowInsets.java
with Apache License 2.0
from lulululbj

/**
 * Returns the display cutout if there is one.
 *
 * @return the display cutout or null if there is none
 * @see DisplayCutout
 */
@Nullable
public DisplayCutout getDisplayCutout() {
    return mDisplayCutout;
}

19 Source : TextSelection.java
with Apache License 2.0
from lulululbj

/**
 * Information about where text selection should be.
 */
public final clreplaced TextSelection implements Parcelable {

    private final int mStartIndex;

    private final int mEndIndex;

    private final EnreplacedyConfidence mEnreplacedyConfidence;

    @Nullable
    private final String mId;

    private TextSelection(int startIndex, int endIndex, Map<String, Float> enreplacedyConfidence, String id) {
        mStartIndex = startIndex;
        mEndIndex = endIndex;
        mEnreplacedyConfidence = new EnreplacedyConfidence(enreplacedyConfidence);
        mId = id;
    }

    /**
     * Returns the start index of the text selection.
     */
    public int getSelectionStartIndex() {
        return mStartIndex;
    }

    /**
     * Returns the end index of the text selection.
     */
    public int getSelectionEndIndex() {
        return mEndIndex;
    }

    /**
     * Returns the number of enreplacedies found in the clreplacedified text.
     */
    @IntRange(from = 0)
    public int getEnreplacedyCount() {
        return mEnreplacedyConfidence.getEnreplacedies().size();
    }

    /**
     * Returns the enreplacedy at the specified index. Enreplacedies are ordered from high confidence
     * to low confidence.
     *
     * @throws IndexOutOfBoundsException if the specified index is out of range.
     * @see #getEnreplacedyCount() for the number of enreplacedies available.
     */
    @NonNull
    @EnreplacedyType
    public String getEnreplacedy(int index) {
        return mEnreplacedyConfidence.getEnreplacedies().get(index);
    }

    /**
     * Returns the confidence score for the specified enreplacedy. The value ranges from
     * 0 (low confidence) to 1 (high confidence). 0 indicates that the enreplacedy was not found for the
     * clreplacedified text.
     */
    @FloatRange(from = 0.0, to = 1.0)
    public float getConfidenceScore(@EnreplacedyType String enreplacedy) {
        return mEnreplacedyConfidence.getConfidenceScore(enreplacedy);
    }

    /**
     * Returns the id, if one exists, for this object.
     */
    @Nullable
    public String getId() {
        return mId;
    }

    @Override
    public String toString() {
        return String.format(Locale.US, "TextSelection {id=%s, startIndex=%d, endIndex=%d, enreplacedies=%s}", mId, mStartIndex, mEndIndex, mEnreplacedyConfidence);
    }

    /**
     * Builder used to build {@link TextSelection} objects.
     */
    public static final clreplaced Builder {

        private final int mStartIndex;

        private final int mEndIndex;

        private final Map<String, Float> mEnreplacedyConfidence = new ArrayMap<>();

        @Nullable
        private String mId;

        /**
         * Creates a builder used to build {@link TextSelection} objects.
         *
         * @param startIndex the start index of the text selection.
         * @param endIndex the end index of the text selection. Must be greater than startIndex
         */
        public Builder(@IntRange(from = 0) int startIndex, @IntRange(from = 0) int endIndex) {
            Preconditions.checkArgument(startIndex >= 0);
            Preconditions.checkArgument(endIndex > startIndex);
            mStartIndex = startIndex;
            mEndIndex = endIndex;
        }

        /**
         * Sets an enreplacedy type for the clreplacedified text and replacedigns a confidence score.
         *
         * @param confidenceScore a value from 0 (low confidence) to 1 (high confidence).
         *      0 implies the enreplacedy does not exist for the clreplacedified text.
         *      Values greater than 1 are clamped to 1.
         */
        @NonNull
        public Builder setEnreplacedyType(@NonNull @EnreplacedyType String type, @FloatRange(from = 0.0, to = 1.0) float confidenceScore) {
            Preconditions.checkNotNull(type);
            mEnreplacedyConfidence.put(type, confidenceScore);
            return this;
        }

        /**
         * Sets an id for the TextSelection object.
         */
        @NonNull
        public Builder setId(@Nullable String id) {
            mId = id;
            return this;
        }

        /**
         * Builds and returns {@link TextSelection} object.
         */
        @NonNull
        public TextSelection build() {
            return new TextSelection(mStartIndex, mEndIndex, mEnreplacedyConfidence, mId);
        }
    }

    /**
     * A request object for generating TextSelection.
     */
    public static final clreplaced Request implements Parcelable {

        private final CharSequence mText;

        private final int mStartIndex;

        private final int mEndIndex;

        @Nullable
        private final LocaleList mDefaultLocales;

        private final boolean mDarkLaunchAllowed;

        private Request(CharSequence text, int startIndex, int endIndex, LocaleList defaultLocales, boolean darkLaunchAllowed) {
            mText = text;
            mStartIndex = startIndex;
            mEndIndex = endIndex;
            mDefaultLocales = defaultLocales;
            mDarkLaunchAllowed = darkLaunchAllowed;
        }

        /**
         * Returns the text providing context for the selected text (which is specified by the
         * sub sequence starting at startIndex and ending at endIndex).
         */
        @NonNull
        public CharSequence getText() {
            return mText;
        }

        /**
         * Returns start index of the selected part of text.
         */
        @IntRange(from = 0)
        public int getStartIndex() {
            return mStartIndex;
        }

        /**
         * Returns end index of the selected part of text.
         */
        @IntRange(from = 0)
        public int getEndIndex() {
            return mEndIndex;
        }

        /**
         * Returns true if the TextClreplacedifier should return selection suggestions when "dark
         * launched". Otherwise, returns false.
         *
         * @hide
         */
        public boolean isDarkLaunchAllowed() {
            return mDarkLaunchAllowed;
        }

        /**
         * @return ordered list of locale preferences that can be used to disambiguate the
         * provided text.
         */
        @Nullable
        public LocaleList getDefaultLocales() {
            return mDefaultLocales;
        }

        /**
         * A builder for building TextSelection requests.
         */
        public static final clreplaced Builder {

            private final CharSequence mText;

            private final int mStartIndex;

            private final int mEndIndex;

            @Nullable
            private LocaleList mDefaultLocales;

            private boolean mDarkLaunchAllowed;

            /**
             * @param text text providing context for the selected text (which is specified by the
             *      sub sequence starting at selectionStartIndex and ending at selectionEndIndex)
             * @param startIndex start index of the selected part of text
             * @param endIndex end index of the selected part of text
             */
            public Builder(@NonNull CharSequence text, @IntRange(from = 0) int startIndex, @IntRange(from = 0) int endIndex) {
                Utils.checkArgument(text, startIndex, endIndex);
                mText = text;
                mStartIndex = startIndex;
                mEndIndex = endIndex;
            }

            /**
             * @param defaultLocales ordered list of locale preferences that may be used to
             *      disambiguate the provided text. If no locale preferences exist, set this to null
             *      or an empty locale list.
             *
             * @return this builder.
             */
            @NonNull
            public Builder setDefaultLocales(@Nullable LocaleList defaultLocales) {
                mDefaultLocales = defaultLocales;
                return this;
            }

            /**
             * @param allowed whether or not the TextClreplacedifier should return selection suggestions
             *      when "dark launched". When a TextClreplacedifier is dark launched, it can suggest
             *      selection changes that should not be used to actually change the user's
             *      selection. Instead, the suggested selection is logged, compared with the user's
             *      selection interaction, and used to generate quality metrics for the
             *      TextClreplacedifier. Not parceled.
             *
             * @return this builder.
             * @hide
             */
            @NonNull
            public Builder setDarkLaunchAllowed(boolean allowed) {
                mDarkLaunchAllowed = allowed;
                return this;
            }

            /**
             * Builds and returns the request object.
             */
            @NonNull
            public Request build() {
                return new Request(mText, mStartIndex, mEndIndex, mDefaultLocales, mDarkLaunchAllowed);
            }
        }

        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(mText.toString());
            dest.writeInt(mStartIndex);
            dest.writeInt(mEndIndex);
            dest.writeInt(mDefaultLocales != null ? 1 : 0);
            if (mDefaultLocales != null) {
                mDefaultLocales.writeToParcel(dest, flags);
            }
        }

        public static final Parcelable.Creator<Request> CREATOR = new Parcelable.Creator<Request>() {

            @Override
            public Request createFromParcel(Parcel in) {
                return new Request(in);
            }

            @Override
            public Request[] newArray(int size) {
                return new Request[size];
            }
        };

        private Request(Parcel in) {
            mText = in.readString();
            mStartIndex = in.readInt();
            mEndIndex = in.readInt();
            mDefaultLocales = in.readInt() == 0 ? null : LocaleList.CREATOR.createFromParcel(in);
            mDarkLaunchAllowed = false;
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(mStartIndex);
        dest.writeInt(mEndIndex);
        mEnreplacedyConfidence.writeToParcel(dest, flags);
        dest.writeString(mId);
    }

    public static final Parcelable.Creator<TextSelection> CREATOR = new Parcelable.Creator<TextSelection>() {

        @Override
        public TextSelection createFromParcel(Parcel in) {
            return new TextSelection(in);
        }

        @Override
        public TextSelection[] newArray(int size) {
            return new TextSelection[size];
        }
    };

    private TextSelection(Parcel in) {
        mStartIndex = in.readInt();
        mEndIndex = in.readInt();
        mEnreplacedyConfidence = EnreplacedyConfidence.CREATOR.createFromParcel(in);
        mId = in.readString();
    }

    // TODO: Remove once apps can build against the latest sdk.
    /**
     * Optional input parameters for generating TextSelection.
     * @hide
     */
    public static final clreplaced Options {

        @Nullable
        private final TextClreplacedificationSessionId mSessionId;

        @Nullable
        private final Request mRequest;

        @Nullable
        private LocaleList mDefaultLocales;

        private boolean mDarkLaunchAllowed;

        public Options() {
            this(null, null);
        }

        private Options(@Nullable TextClreplacedificationSessionId sessionId, @Nullable Request request) {
            mSessionId = sessionId;
            mRequest = request;
        }

        /**
         * Helper to create Options from a Request.
         */
        public static Options from(TextClreplacedificationSessionId sessionId, Request request) {
            final Options options = new Options(sessionId, request);
            options.setDefaultLocales(request.getDefaultLocales());
            return options;
        }

        /**
         * @param defaultLocales ordered list of locale preferences.
         */
        public Options setDefaultLocales(@Nullable LocaleList defaultLocales) {
            mDefaultLocales = defaultLocales;
            return this;
        }

        @Nullable
        public LocaleList getDefaultLocales() {
            return mDefaultLocales;
        }

        @Nullable
        public Request getRequest() {
            return mRequest;
        }

        @Nullable
        public TextClreplacedificationSessionId getSessionId() {
            return mSessionId;
        }
    }
}

19 Source : TextSelection.java
with Apache License 2.0
from lulululbj

/**
 * Returns the id, if one exists, for this object.
 */
@Nullable
public String getId() {
    return mId;
}

19 Source : TextClassificationContext.java
with Apache License 2.0
from lulululbj

/**
 * A representation of the context in which text clreplacedification would be performed.
 * @see TextClreplacedificationManager#createTextClreplacedificationSession(TextClreplacedificationContext)
 */
public final clreplaced TextClreplacedificationContext implements Parcelable {

    private final String mPackageName;

    private final String mWidgetType;

    @Nullable
    private final String mWidgetVersion;

    private TextClreplacedificationContext(String packageName, String widgetType, String widgetVersion) {
        mPackageName = Preconditions.checkNotNull(packageName);
        mWidgetType = Preconditions.checkNotNull(widgetType);
        mWidgetVersion = widgetVersion;
    }

    /**
     * Returns the package name for the calling package.
     */
    @NonNull
    public String getPackageName() {
        return mPackageName;
    }

    /**
     * Returns the widget type for this clreplacedification context.
     */
    @NonNull
    @WidgetType
    public String getWidgetType() {
        return mWidgetType;
    }

    /**
     * Returns a custom version string for the widget type.
     *
     * @see #getWidgetType()
     */
    @Nullable
    public String getWidgetVersion() {
        return mWidgetVersion;
    }

    @Override
    public String toString() {
        return String.format(Locale.US, "TextClreplacedificationContext{" + "packageName=%s, widgetType=%s, widgetVersion=%s}", mPackageName, mWidgetType, mWidgetVersion);
    }

    /**
     * A builder for building a TextClreplacedification context.
     */
    public static final clreplaced Builder {

        private final String mPackageName;

        private final String mWidgetType;

        @Nullable
        private String mWidgetVersion;

        /**
         * Initializes a new builder for text clreplacedification context objects.
         *
         * @param packageName the name of the calling package
         * @param widgetType the type of widget e.g. {@link TextClreplacedifier#WIDGET_TYPE_TEXTVIEW}
         *
         * @return this builder
         */
        public Builder(@NonNull String packageName, @NonNull @WidgetType String widgetType) {
            mPackageName = Preconditions.checkNotNull(packageName);
            mWidgetType = Preconditions.checkNotNull(widgetType);
        }

        /**
         * Sets an optional custom version string for the widget type.
         *
         * @return this builder
         */
        public Builder setWidgetVersion(@Nullable String widgetVersion) {
            mWidgetVersion = widgetVersion;
            return this;
        }

        /**
         * Builds the text clreplacedification context object.
         *
         * @return the built TextClreplacedificationContext object
         */
        @NonNull
        public TextClreplacedificationContext build() {
            return new TextClreplacedificationContext(mPackageName, mWidgetType, mWidgetVersion);
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel parcel, int flags) {
        parcel.writeString(mPackageName);
        parcel.writeString(mWidgetType);
        parcel.writeString(mWidgetVersion);
    }

    private TextClreplacedificationContext(Parcel in) {
        mPackageName = in.readString();
        mWidgetType = in.readString();
        mWidgetVersion = in.readString();
    }

    public static final Parcelable.Creator<TextClreplacedificationContext> CREATOR = new Parcelable.Creator<TextClreplacedificationContext>() {

        @Override
        public TextClreplacedificationContext createFromParcel(Parcel parcel) {
            return new TextClreplacedificationContext(parcel);
        }

        @Override
        public TextClreplacedificationContext[] newArray(int size) {
            return new TextClreplacedificationContext[size];
        }
    };
}

19 Source : TextClassificationContext.java
with Apache License 2.0
from lulululbj

/**
 * Returns a custom version string for the widget type.
 *
 * @see #getWidgetType()
 */
@Nullable
public String getWidgetVersion() {
    return mWidgetVersion;
}

19 Source : TextClassification.java
with Apache License 2.0
from lulululbj

/**
 * Gets the clreplacedified text.
 */
@Nullable
public String getText() {
    return mText;
}

19 Source : TextClassification.java
with Apache License 2.0
from lulululbj

/**
 * Returns the OnClickListener that may be triggered to act on the clreplacedified text.
 *
 * <p><strong>NOTE: </strong>This field is not parcelable and only represents the first
 * {@link RemoteAction} (if one exists) when this object is read from a parcel.
 *
 * @deprecated Use {@link #getActions()} instead.
 */
@Nullable
public OnClickListener getOnClickListener() {
    return mLegacyOnClickListener;
}

19 Source : SelectionEvent.java
with Apache License 2.0
from lulululbj

/**
 * Returns the selection session id.
 */
@Nullable
public TextClreplacedificationSessionId getSessionId() {
    return mSessionId;
}

19 Source : SelectionEvent.java
with Apache License 2.0
from lulululbj

/**
 * Returns the id of the text clreplacedifier result replacedociated with this event.
 */
@Nullable
public String getResultId() {
    return mResultId;
}

19 Source : SelectionEvent.java
with Apache License 2.0
from lulululbj

/**
 * Returns a string version info for the widget this event was triggered in.
 */
@Nullable
public String getWidgetVersion() {
    return mWidgetVersion;
}

19 Source : KeyboardShortcutInfo.java
with Apache License 2.0
from lulululbj

/**
 * Returns the icon to be used to describe this shortcut.
 *
 * @hide
 */
@Nullable
public Icon getIcon() {
    return mIcon;
}

See More Examples