@BindingMethods({ @BindingMethod(type = RelativeTimeTextView.class, attribute = "rttv:relative_time_prefix", method = "setPrefix"), @BindingMethod(type = RelativeTimeTextView.class, attribute = "rttv:relative_time_suffix", method = "setSuffix"), }) public class RelativeTimeTextViewBindingAdapter { @BindingAdapter("rttv:reference_time") public static void setReferenceTime(RelativeTimeTextView view, long time) { view.setReferenceTime(time); } }
private void addRenamed(RoundEnvironment roundEnv, SetterStore store) { for (Element element : AnnotationUtil .getElementsAnnotatedWith(roundEnv, BindingMethods.class)) { BindingMethods bindingMethods = element.getAnnotation(BindingMethods.class); for (BindingMethod bindingMethod : bindingMethods.value()) { final String attribute = bindingMethod.attribute(); final String method = bindingMethod.method(); warnAttributeNamespace(element, attribute); String type; try { type = bindingMethod.type().getCanonicalName(); } catch (MirroredTypeException e) { type = AnnotationTypeUtil.getInstance().toJava(e.getTypeMirror()); } store.addRenamedMethod(attribute, type, method, (TypeElement) element); } } }
@BindingMethods(@BindingMethod(type = TagsViewGroup.class, attribute = "onClickTag", method = "setOnTagClickListener")) public class TagsViewGroup extends ViewGroup {
@BindingMethods({ @BindingMethod(type = SwipeRefreshLayout.class, attribute = "android:onRefresh", method = "setOnRefreshListener"), @BindingMethod(type = FloatingActionButton.class, attribute = "android:onClick", method = "setOnClickListener"), @BindingMethod(type = SimpleDraweeView.class, attribute = "android:onClick", method = "setOnClickListener"), @BindingMethod(type = CollapsingToolbarLayout.class, attribute = "android:onClick", method = "setOnClickListener"), @BindingMethod(type = TextView.class, attribute = "android:onClick", method = "setOnClickListener") }) public class DatabindingUtil { @BindingAdapter({"android:actualImageUri"}) public static void setImageUri(SimpleDraweeView view, String url) { view.setImageURI(url); } @BindingAdapter({"android:smallImage", "android:highImage"}) public static void setLowImageUri(SimpleDraweeView view, String small, String high) { FrescoUtil.loadLowImage(view, small, high); } @BindingAdapter(value = {"android:timeFormatValue", "android:timeValue"}, requireAll = false) public static void formatTime(TextView view, String format, String time) { String timeFormat = StringUtil.isEmpty(format) ? "yyyy-MM-dd" : format; SimpleDateFormat dateFormat = new SimpleDateFormat(timeFormat, Locale.CHINA); view.setText(dateFormat.format(Long.valueOf(time))); } }
@BindingMethods({ @BindingMethod(type = HorizontalCounter.class, attribute = "initialValue", method = "setCurrentValue"), @BindingMethod(type = HorizontalCounter.class, attribute = "stepValue", method = "setStepValue"),