@Override public void unbind() { trySet(field, target, null); } }
@Override public void unbind() { ViewCollections.set(targets, setter, null); } }
static class UserViewHolder extends RecyclerView.ViewHolder { @Bind(R.id.title) TextView textViewTitle; UserViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } } }
UserViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } }
private static @Nullable Unbinder parseOnFocusChange(final Object target, final Method method, View source) { OnFocusChange onFocusChange = method.getAnnotation(OnFocusChange.class); if (onFocusChange == null) { return null; } validateMember(method); validateReturnType(method, void.class); final ArgumentTransformer argumentTransformer = createArgumentTransformer(method, ON_FOCUS_CHANGE_TYPES); List<View> views = findViews(source, onFocusChange.value(), isRequired(method), method.getName(), View.class); ViewCollections.set(views, ON_FOCUS_CHANGE, (v, hasFocus) -> tryInvoke(method, target, argumentTransformer.transform(v, hasFocus))); return new ListenerUnbinder<>(views, ON_FOCUS_CHANGE); }
static class IntTarget { @BindDimen(R.dimen.twelve_point_two_dp) int actual; }
static class Target { @BindString(R.string.hey) String actual; }
static class IntTarget { @BindColor(R.color.red) int actual; }
static class Target { @BindDrawable(R.drawable.circle) Drawable actual; }
static class StringArrayTarget { @BindArray(R.array.string_one_two_three) String[] actual; }
static class Target { @BindInt(R.integer.twelve) int actual; }
static class Target { @BindBool(R.bool.just_true) boolean actual; }
static class Target { @BindFloat(R.dimen.twelve_point_two) float actual; }
static class Target { @BindBitmap(R.drawable.pixel) Bitmap actual; }
private static @Nullable Unbinder parseOnClick(final Object target, final Method method, View source) { OnClick onClick = method.getAnnotation(OnClick.class); if (onClick == null) { return null; } validateMember(method); validateReturnType(method, void.class); final ArgumentTransformer argumentTransformer = createArgumentTransformer(method, ON_CLICK_TYPES); List<View> views = findViews(source, onClick.value(), isRequired(method), method.getName(), View.class); ViewCollections.set(views, ON_CLICK, v -> tryInvoke(method, target, argumentTransformer.transform(v))); return new ListenerUnbinder<>(views, ON_CLICK); }
static class FloatTarget { @BindDimen(R.dimen.twelve_point_two_dp) float actual; }
static class ColorStateListTarget { @BindColor(R.color.colors) ColorStateList actual; }
static class IntArrayTarget { @BindArray(R.array.int_one_two_three) int[] actual; }
private static @Nullable Unbinder parseOnCheckedChanged(final Object target, final Method method, View source) { OnCheckedChanged onCheckedChanged = method.getAnnotation(OnCheckedChanged.class); if (onCheckedChanged == null) { return null; } validateMember(method); validateReturnType(method, void.class); final ArgumentTransformer argumentTransformer = createArgumentTransformer(method, ON_CHECKED_CHANGED_TYPES); List<CompoundButton> views = findViews(source, onCheckedChanged.value(), isRequired(method), method.getName(), CompoundButton.class); ViewCollections.set(views, ON_CHECKED_CHANGE, (buttonView, isChecked) -> tryInvoke(method, target, argumentTransformer.transform(buttonView, isChecked))); return new ListenerUnbinder<>(views, ON_CHECKED_CHANGE); }
static class CharSequenceArrayTarget { @BindArray(R.array.int_one_two_three) CharSequence[] actual; }