Java Code Examples for android.support.annotation.CheckResult

The following are top voted examples for showing how to use android.support.annotation.CheckResult. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Customerly-Android-SDK   File: Customerly.java   View source code 8 votes vote down vote up
/**
 * Optionally you can specify the user attributes
 * @param pAttributes The attributes of the user. Can contain only String, char, byte, int, long, float or double values
 * @return The Task itself for method chaining
 * @throws IllegalArgumentException if the attributes map check fails
 */
@CheckResult @NonNull public RegisterUserTask attributes(@Nullable JSONObject pAttributes) throws IllegalArgumentException {
    if(pAttributes != null) {
        Iterator<String> keysIterator = pAttributes.keys();
        String key;
        while(keysIterator.hasNext()) {
            Object attr = pAttributes.opt(keysIterator.next());
            if(     attr != null && (
                    attr instanceof String ||
                    attr instanceof Integer ||
                    attr instanceof Byte ||
                    attr instanceof Long ||
                    attr instanceof Double ||
                    attr instanceof Float ||
                    attr instanceof Character ||
                    attr instanceof Boolean)) {
                continue;
            }
            _log("Attributes HashMap can contain only String, char, byte, int, long, float or double values");
            throw new IllegalArgumentException("Attributes HashMap can contain only Strings, int, float, long, double or char values");
        }
    } else {
        this.attributes = null;
    }
    return this;
}
 
Example 2
Project: GitHub   File: GlideOptions.java   View source code 5 votes vote down vote up
/**
 * @see RequestOptions#noTransformation()
 */
@CheckResult
public static GlideOptions noTransformation() {
  if (GlideOptions.noTransformation4 == null) {
    GlideOptions.noTransformation4 =
        new GlideOptions().dontTransform().autoClone();
  }
  return GlideOptions.noTransformation4;
}
 
Example 3
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#placeholder(Drawable)
 */
@CheckResult
public GlideRequest<TranscodeType> placeholder(@Nullable Drawable arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).placeholder(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).placeholder(arg0);
  }
  return this;
}
 
Example 4
Project: GitHub   File: GlideOptions.java   View source code 5 votes vote down vote up
/**
 * @see RequestOptions#noTransformation()
 */
@CheckResult
public static GlideOptions noTransformation() {
  if (GlideOptions.noTransformation4 == null) {
    GlideOptions.noTransformation4 =
        new GlideOptions().dontTransform().autoClone();
  }
  return GlideOptions.noTransformation4;
}
 
Example 5
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#placeholder(int)
 */
@CheckResult
public GlideRequest<TranscodeType> placeholder(@DrawableRes int arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).placeholder(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).placeholder(arg0);
  }
  return this;
}
 
Example 6
Project: GitHub   File: GlideOptions.java   View source code 5 votes vote down vote up
/**
 * @see RequestOptions#centerCropTransform()
 */
@CheckResult
public static GlideOptions centerCropTransform() {
  if (GlideOptions.centerCropTransform3 == null) {
    GlideOptions.centerCropTransform3 =
        new GlideOptions().centerCrop().autoClone();
  }
  return GlideOptions.centerCropTransform3;
}
 
Example 7
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#frame(long)
 */
@CheckResult
public GlideRequest<TranscodeType> frame(@IntRange(from = 0) long arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).frame(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).frame(arg0);
  }
  return this;
}
 
Example 8
Project: Phoenix-for-VK   File: IUsersApi.java   View source code 5 votes vote down vote up
@CheckResult
Single<Items<VKApiUser>> search(String query, Integer sort, Integer offset, Integer count,
                                String fields, Integer city, Integer country, String hometown,
                                Integer universityCountry, Integer university, Integer universityYear,
                                Integer universityFaculty, Integer universityChair, Integer sex,
                                Integer status, Integer ageFrom, Integer ageTo, Integer birthDay,
                                Integer birthMonth, Integer birthYear, Boolean online,
                                Boolean hasPhoto, Integer schoolCountry, Integer schoolCity,
                                Integer schoolClass, Integer school, Integer schoolYear,
                                String religion, String interests, String company,
                                String position, Integer groupId, String fromList);
 
Example 9
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#set(Option<T>, T)
 */
@CheckResult
public <T> GlideRequest<TranscodeType> set(@NonNull Option<T> arg0, @NonNull T arg1) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).set(arg0, arg1);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).set(arg0, arg1);
  }
  return this;
}
 
Example 10
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#set(Option<T>, T)
 */
@CheckResult
public <T> GlideRequest<TranscodeType> set(@NonNull Option<T> arg0, @NonNull T arg1) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).set(arg0, arg1);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).set(arg0, arg1);
  }
  return this;
}
 
Example 11
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#fitCenter()
 */
@CheckResult
public GlideRequest<TranscodeType> fitCenter() {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).fitCenter();
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).fitCenter();
  }
  return this;
}
 
Example 12
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#error(Drawable)
 */
@CheckResult
public GlideRequest<TranscodeType> error(@Nullable Drawable arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).error(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).error(arg0);
  }
  return this;
}
 
Example 13
Project: Toasty   File: Toasty.java   View source code 5 votes vote down vote up
@SuppressLint("ShowToast")
@CheckResult
public static Toast custom(@NonNull Context context, @NonNull CharSequence message, Drawable icon,
                           @ColorInt int tintColor, int duration,
                           boolean withIcon, boolean shouldTint) {
    final Toast currentToast = Toast.makeText(context, null, duration);
    final View toastLayout = ((LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE))
            .inflate(R.layout.toast_layout, null);
    final ImageView toastIcon = toastLayout.findViewById(R.id.toast_icon);
    final TextView toastTextView = toastLayout.findViewById(R.id.toast_text);
    Drawable drawableFrame;

    if (shouldTint)
        drawableFrame = ToastyUtils.tint9PatchDrawableFrame(context, tintColor);
    else
        drawableFrame = ToastyUtils.getDrawable(context, R.drawable.toast_frame);
    ToastyUtils.setBackground(toastLayout, drawableFrame);

    if (withIcon) {
        if (icon == null)
            throw new IllegalArgumentException("Avoid passing 'icon' as null if 'withIcon' is set to true");
        if (tintIcon)
            icon = ToastyUtils.tintIcon(icon, DEFAULT_TEXT_COLOR);
        ToastyUtils.setBackground(toastIcon, icon);
    } else {
        toastIcon.setVisibility(View.GONE);
    }

    toastTextView.setText(message);
    toastTextView.setTextColor(DEFAULT_TEXT_COLOR);
    toastTextView.setTypeface(currentTypeface);
    toastTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);

    currentToast.setView(toastLayout);
    return currentToast;
}
 
Example 14
Project: GitHub   File: GlideOptions.java   View source code 5 votes vote down vote up
/**
 * @see RequestOptions#centerCropTransform()
 */
@CheckResult
public static GlideOptions centerCropTransform() {
  if (GlideOptions.centerCropTransform2 == null) {
    GlideOptions.centerCropTransform2 =
        new GlideOptions().centerCrop().autoClone();
  }
  return GlideOptions.centerCropTransform2;
}
 
Example 15
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#transforms(Transformation<Bitmap>[])
 */
@CheckResult
@SuppressWarnings({
    "unchecked",
    "varargs"
})
public GlideRequest<TranscodeType> transforms(@NonNull Transformation<Bitmap>... arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).transforms(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).transforms(arg0);
  }
  return this;
}
 
Example 16
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#frame(long)
 */
@CheckResult
public GlideRequest<TranscodeType> frame(@IntRange(from = 0) long arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).frame(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).frame(arg0);
  }
  return this;
}
 
Example 17
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#fallback(int)
 */
@CheckResult
public GlideRequest<TranscodeType> fallback(@DrawableRes int arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).fallback(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).fallback(arg0);
  }
  return this;
}
 
Example 18
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#decode(Class<?>)
 */
@CheckResult
public GlideRequest<TranscodeType> decode(@NonNull Class<?> arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).decode(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).decode(arg0);
  }
  return this;
}
 
Example 19
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#optionalCenterCrop()
 */
@CheckResult
public GlideRequest<TranscodeType> optionalCenterCrop() {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).optionalCenterCrop();
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).optionalCenterCrop();
  }
  return this;
}
 
Example 20
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#dontTransform()
 */
@CheckResult
public GlideRequest<TranscodeType> dontTransform() {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).dontTransform();
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).dontTransform();
  }
  return this;
}
 
Example 21
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#fallback(Drawable)
 */
@CheckResult
public GlideRequest<TranscodeType> fallback(@Nullable Drawable arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).fallback(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).fallback(arg0);
  }
  return this;
}
 
Example 22
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#centerInside()
 */
@CheckResult
public GlideRequest<TranscodeType> centerInside() {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).centerInside();
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).centerInside();
  }
  return this;
}
 
Example 23
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#error(Drawable)
 */
@CheckResult
public GlideRequest<TranscodeType> error(@Nullable Drawable arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).error(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).error(arg0);
  }
  return this;
}
 
Example 24
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#fallback(Drawable)
 */
@CheckResult
public GlideRequest<TranscodeType> fallback(@Nullable Drawable arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).fallback(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).fallback(arg0);
  }
  return this;
}
 
Example 25
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#useAnimationPool(boolean)
 */
@CheckResult
public GlideRequest<TranscodeType> useAnimationPool(boolean flag) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).useAnimationPool(flag);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).useAnimationPool(flag);
  }
  return this;
}
 
Example 26
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#transforms(Transformation<Bitmap>[])
 */
@CheckResult
@SuppressWarnings({
    "unchecked",
    "varargs"
})
public GlideRequest<TranscodeType> transforms(@NonNull Transformation<Bitmap>... arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).transforms(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).transforms(arg0);
  }
  return this;
}
 
Example 27
Project: GitHub   File: GlideOptions.java   View source code 5 votes vote down vote up
/**
 * @see RequestOptions#noTransformation()
 */
@CheckResult
public static GlideOptions noTransformation() {
  if (GlideOptions.noTransformation4 == null) {
    GlideOptions.noTransformation4 =
        new GlideOptions().dontTransform().autoClone();
  }
  return GlideOptions.noTransformation4;
}
 
Example 28
Project: GitHub   File: GlideOptions.java   View source code 5 votes vote down vote up
/**
 * @see RequestOptions#fitCenterTransform()
 */
@CheckResult
public static GlideOptions fitCenterTransform() {
  if (GlideOptions.fitCenterTransform0 == null) {
    GlideOptions.fitCenterTransform0 =
        new GlideOptions().fitCenter().autoClone();
  }
  return GlideOptions.fitCenterTransform0;
}
 
Example 29
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#transforms(Transformation<Bitmap>[])
 */
@CheckResult
@SuppressWarnings({
    "unchecked",
    "varargs"
})
public GlideRequest<TranscodeType> transforms(@NonNull Transformation<Bitmap>... arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).transforms(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).transforms(arg0);
  }
  return this;
}
 
Example 30
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#downsample(DownsampleStrategy)
 */
@CheckResult
public GlideRequest<TranscodeType> downsample(@NonNull DownsampleStrategy arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).downsample(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).downsample(arg0);
  }
  return this;
}
 
Example 31
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#disallowHardwareConfig()
 */
@CheckResult
public GlideRequest<TranscodeType> disallowHardwareConfig() {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).disallowHardwareConfig();
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).disallowHardwareConfig();
  }
  return this;
}
 
Example 32
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#optionalCircleCrop()
 */
@CheckResult
public GlideRequest<TranscodeType> optionalCircleCrop() {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).optionalCircleCrop();
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).optionalCircleCrop();
  }
  return this;
}
 
Example 33
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#fallback(int)
 */
@CheckResult
public GlideRequest<TranscodeType> fallback(@DrawableRes int arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).fallback(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).fallback(arg0);
  }
  return this;
}
 
Example 34
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#sizeMultiplier(float)
 */
@CheckResult
public GlideRequest<TranscodeType> sizeMultiplier(@FloatRange(from = 0.0, to = 1.0) float arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).sizeMultiplier(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).sizeMultiplier(arg0);
  }
  return this;
}
 
Example 35
Project: GitHub   File: GlideRequest.java   View source code 5 votes vote down vote up
/**
 * @see GlideOptions#encodeQuality(int)
 */
@CheckResult
public GlideRequest<TranscodeType> encodeQuality(@IntRange(from = 0, to = 100) int arg0) {
  if (getMutableOptions() instanceof GlideOptions) {
    this.requestOptions = ((GlideOptions) getMutableOptions()).encodeQuality(arg0);
  } else {
    this.requestOptions = new GlideOptions().apply(this.requestOptions).encodeQuality(arg0);
  }
  return this;
}
 
Example 36
Project: Phoenix-for-VK   File: ITopicsStore.java   View source code 4 votes vote down vote up
@CheckResult
Completable attachPoll(int accountId, int ownerId, int topicId, PollEntity pollDbo);
 
Example 37
Project: GitHub   File: GlideOptions.java   View source code 4 votes vote down vote up
@Override
@CheckResult
public final GlideOptions transform(@NonNull Transformation<Bitmap> arg0) {
  return (GlideOptions) super.transform(arg0);
}
 
Example 38
Project: GitHub   File: GlideOptions.java   View source code 4 votes vote down vote up
@Override
@CheckResult
public final GlideOptions dontTransform() {
  return (GlideOptions) super.dontTransform();
}
 
Example 39
Project: Toasty   File: Toasty.java   View source code 4 votes vote down vote up
@CheckResult
public static Toast warning(@NonNull Context context, @NonNull CharSequence message) {
    return warning(context, message, Toast.LENGTH_SHORT, true);
}
 
Example 40
Project: Utils   File: ToastUtil.java   View source code 4 votes vote down vote up
@CheckResult
public static Toast error(@NonNull Context context, @NonNull String message, int duration) {
    return error(context, message, duration, true);
}