/** * Sets the drawable to be used to fill the area below the line. * * @param drawable */ @TargetApi(18) public void setFillDrawable(Drawable drawable) { this.mFillDrawable = drawable; }
@SuppressLint("InlinedApi") private static boolean isHandledMediaKey(int keyCode) { return keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD || keyCode == KeyEvent.KEYCODE_MEDIA_REWIND || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE || keyCode == KeyEvent.KEYCODE_MEDIA_PLAY || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE || keyCode == KeyEvent.KEYCODE_MEDIA_NEXT || keyCode == KeyEvent.KEYCODE_MEDIA_PREVIOUS; }
public AppUsageObserver( int observerId, @NonNull Collection<String> packageNames, long timeLimit, @NonNull TimeUnit timeUnit, @NonNull PendingIntent callbackIntent) { this.observerId = observerId; this.packageNames = packageNames; this.timeLimit = timeLimit; this.timeUnit = timeUnit; this.callbackIntent = callbackIntent; }
/** * Set an attribute to the given value. * * The value will be interpreted according to the attribute's format. * * @param resId The attribute resource id to set. * @param value The value to set. * @return This {@link org.robolectric.android.AttributeSetBuilder}. */ AttributeSetBuilder addAttribute(@IdRes int resId, String value);
@TargetApi(11) private void copyOptions11(Options srcOptions, Options destOptions) { destOptions.inBitmap = srcOptions.inBitmap; destOptions.inMutable = srcOptions.inMutable; }
@SuppressLint("InlinedApi") private boolean isDpadKey(int keyCode) { return keyCode == KeyEvent.KEYCODE_DPAD_UP || keyCode == KeyEvent.KEYCODE_DPAD_UP_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_DOWN_RIGHT || keyCode == KeyEvent.KEYCODE_DPAD_DOWN || keyCode == KeyEvent.KEYCODE_DPAD_DOWN_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_UP_LEFT || keyCode == KeyEvent.KEYCODE_DPAD_CENTER; }
@TargetApi(10) private void copyOptions10(Options srcOptions, Options destOptions) { destOptions.inPreferQualityOverSpeed = srcOptions.inPreferQualityOverSpeed; }
@SuppressLint("NewApi") public AnimatedZoomJob(ViewPortHandler viewPortHandler, View v, Transformer trans, YAxis axis, float xAxisRange, float scaleX, float scaleY, float xOrigin, float yOrigin, float zoomCenterX, float zoomCenterY, float zoomOriginX, float zoomOriginY, long duration) { super(viewPortHandler, scaleX, scaleY, trans, v, xOrigin, yOrigin, duration); this.zoomCenterX = zoomCenterX; this.zoomCenterY = zoomCenterY; this.zoomOriginX = zoomOriginX; this.zoomOriginY = zoomOriginY; this.animator.addListener(this); this.yAxis = axis; this.xAxisRange = xAxisRange; }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) private static class FragmentAccessorFrameworkJellyBean extends FragmentAccessorFrameworkHoneycomb { @Nullable @Override public FragmentManager getChildFragmentManager(Fragment fragment) { return fragment.getChildFragmentManager(); } }
@SuppressLint("NewApi") @Override public void run() { animator.start(); }
/** * Returns an equivalent {@link android.media.MediaCodec.CryptoInfo} instance. * <p> * Successive calls to this method on a single {@link CryptoInfo} will return the same instance. * Changes to the {@link CryptoInfo} will be reflected in the returned object. The return object * should not be modified directly. * * @return The equivalent {@link android.media.MediaCodec.CryptoInfo} instance. */ @TargetApi(16) public android.media.MediaCodec.CryptoInfo getFrameworkCryptoInfoV16() { return frameworkCryptoInfo; }
@SuppressLint("HandlerLeak") class EventPostHandler extends Handler { public EventPostHandler(Looper looper) { super(looper); } @Override public void handleMessage(Message msg) { eventBus.post(msg.obj); } void post(Object event) { sendMessage(obtainMessage(0, event)); } }
@TargetApi(24) private static final class PatternHolderV24 { private final android.media.MediaCodec.CryptoInfo frameworkCryptoInfo; private final android.media.MediaCodec.CryptoInfo.Pattern pattern; private PatternHolderV24(android.media.MediaCodec.CryptoInfo frameworkCryptoInfo) { this.frameworkCryptoInfo = frameworkCryptoInfo; pattern = new android.media.MediaCodec.CryptoInfo.Pattern(0, 0); } private void set(int encryptedBlocks, int clearBlocks) { pattern.set(encryptedBlocks, clearBlocks); frameworkCryptoInfo.setPattern(pattern); } }
@SuppressLint("CheckResult") @SuppressWarnings("PMD.ConstructorCallsOverridableMethod") protected RequestBuilder(Class<TranscodeType> transcodeClass, RequestBuilder<?> other) { this(other.glide, other.requestManager, transcodeClass, other.context); model = other.model; isModelSet = other.isModelSet; // This is safe because it will always mutate, no one else has access to the object. apply(other); }
@TargetApi(Build.VERSION_CODES.O) private static void assertNotHardwareConfig(Bitmap.Config config) { // Avoid short circuiting on sdk int since it breaks on some versions of Android. if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) { return; } if (config == Bitmap.Config.HARDWARE) { throw new IllegalArgumentException("Cannot create a mutable Bitmap with config: " + config + ". Consider setting Downsampler#ALLOW_HARDWARE_CONFIG to false in your RequestOptions" + " and/or in GlideBuilder.setDefaultRequestOptions"); } }
@SuppressWarnings("unchecked") // addListener always returns the same instance. @SuppressLint("CheckResult") private void initRequestListeners(List<RequestListener<Object>> requestListeners) { for (RequestListener<Object> listener : requestListeners) { addListener((RequestListener<TranscodeType>) listener); } }
/** * Returns the current time in either millis or nanos depending on the api level to be used with * {@link #getElapsedMillis(long)}. */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static long getLogTime() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return SystemClock.elapsedRealtimeNanos(); } else { return SystemClock.uptimeMillis(); } }
@SuppressLint("WrongConstant") private void saveLayerCompat(Canvas canvas, RectF rect, Paint paint, boolean all) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { // This method was deprecated in API level 26 and not recommended since 22, but its // 2-parameter replacement is only available starting at API level 21. canvas.saveLayer(rect, paint, all ? Canvas.ALL_SAVE_FLAG : SAVE_FLAGS); } else { canvas.saveLayer(rect, paint); } }
@TargetApi(Build.VERSION_CODES.KITKAT) private static void maybeSetPreMultiplied(Bitmap bitmap) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { bitmap.setPremultiplied(true); } }
@TargetApi(M) private boolean hasStoragePermission() { if (SDK_INT < M) { return true; } // Once true, this won't change for the life of the process so we can cache it. if (writeExternalStorageGranted) { return true; } writeExternalStorageGranted = context.checkSelfPermission(WRITE_EXTERNAL_STORAGE) == PERMISSION_GRANTED; return writeExternalStorageGranted; }