changes: add comments
This commit is contained in:
parent
3cb5b13230
commit
74257aad0d
|
|
@ -20,6 +20,7 @@
|
|||
package ru.touchin.roboswag.components.adapters;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.ColorRes;
|
||||
|
|
@ -68,26 +69,68 @@ public class BindableViewHolder extends RecyclerView.ViewHolder implements Lifec
|
|||
return viewById;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the string value associated with a particular resource ID. It
|
||||
* will be stripped of any styled text information.
|
||||
*
|
||||
* @param resId The resource id to search for data;
|
||||
* @return String The string data associated with the resource.
|
||||
* @throws Resources.NotFoundException Throws NotFoundException if the given ID does not exist.
|
||||
*/
|
||||
@NonNull
|
||||
public String getString(@StringRes final int resId) {
|
||||
return itemView.getResources().getString(resId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the string value associated with a particular resource ID. It
|
||||
* will be stripped of any styled text information.
|
||||
*
|
||||
* @param resId The resource id to search for data;
|
||||
* @param formatArgs The format arguments that will be used for substitution.
|
||||
* @return String The string data associated with the resource.
|
||||
* @throws Resources.NotFoundException Throws NotFoundException if the given ID does not exist.
|
||||
*/
|
||||
@NonNull
|
||||
public String getString(@StringRes final int resId, final Object... formatArgs) {
|
||||
return itemView.getResources().getString(resId, formatArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the color value associated with a particular resource ID.
|
||||
* Starting in {@link android.os.Build.VERSION_CODES#M}, the returned
|
||||
* color will be styled for the specified Context's theme.
|
||||
*
|
||||
* @param resId The resource id to search for data;
|
||||
* @return int A single color value in the form 0xAARRGGBB.
|
||||
* @throws Resources.NotFoundException Throws NotFoundException if the given ID does not exist.
|
||||
*/
|
||||
@ColorInt
|
||||
public int getColor(@ColorRes final int resId) {
|
||||
return ContextCompat.getColor(itemView.getContext(), resId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a color state list object associated with a particular resource ID.
|
||||
* Starting in {@link android.os.Build.VERSION_CODES#LOLLIPOP}, the
|
||||
* returned drawable will be styled for the specified Context's theme.
|
||||
*
|
||||
* @param resId The resource id to search for data;
|
||||
* @return Drawable An object that can be used to draw this resource.
|
||||
*/
|
||||
@NonNull
|
||||
public Drawable getDrawable(@DrawableRes final int resId) {
|
||||
return ContextCompat.getDrawable(itemView.getContext(), resId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a drawable object associated with a particular resource ID.
|
||||
* Starting in {@link android.os.Build.VERSION_CODES#LOLLIPOP}, the
|
||||
* returned drawable will be styled for the specified Context's theme.
|
||||
*
|
||||
* @param resId The resource id to search for data;
|
||||
* @return A color state list, or {@code null} if the resource could not be resolved.
|
||||
*/
|
||||
@NonNull
|
||||
public ColorStateList getColorStateList(@ColorRes final int resId) {
|
||||
return ContextCompat.getColorStateList(itemView.getContext(), resId);
|
||||
|
|
|
|||
Loading…
Reference in New Issue