Java 类android.databinding.BindingConversion 实例源码

项目:moserp    文件:Quantity.java   
@BindingConversion
public static String convertQuantityToString(Quantity quantity) {
    Log.d("Quantity", "convert quantity to string " + quantity);
    if (quantity == null) {
        return null;
    }
    return quantity.toString();
}
项目:moserp    文件:Quantity.java   
@BindingConversion
public static Quantity convertStringToQuantity(String string) {
    Log.d("Quantity", "convert string to quantity " + string);
    if (string == null) {
        return Quantity.ZERO;
    }
    return new Quantity(string);
}
项目:kickmaterial    文件:BindingAdapters.java   
/**
 * Allows to pass additional parameter (click listener)
 * to adapter created by {@link me.tatarka.bindingcollectionadapter.BindingRecyclerViewAdapters}
 *
 * @param clickListener click listener to be bound to all items.
 * @return
 */
@BindingConversion
public static BindingRecyclerViewAdapterFactory toRecyclerViewAdapterFactory(final CategoryClickListener clickListener) {
    return new BindingRecyclerViewAdapterFactory() {
        public <T> BindingRecyclerViewAdapter<T> create(RecyclerView recyclerView, ItemViewArg<T> arg) {
            return new CategoriesRecyclerViewAdapter<>(arg, clickListener);
        }
    };
}
项目:onyxbeacon-android-sdk    文件:BindingAdapters.java   
/**
 * Allows to pass additional parameter (click listener)
 * to adapter created by {@link me.tatarka.bindingcollectionadapter.BindingRecyclerViewAdapters}
 *
 * @param clickListener click listener to be bound to all items.
 * @return
 */
@BindingConversion
public static BindingRecyclerViewAdapterFactory toRecyclerViewAdapterFactory(final CategoryClickListener clickListener) {
    return new BindingRecyclerViewAdapterFactory() {
        public <T> BindingRecyclerViewAdapter<T> create(RecyclerView recyclerView, ItemViewArg<T> arg) {
            return new CategoriesRecyclerViewAdapter<>(arg, clickListener);
        }
    };
}
项目:android-advanced-light    文件:Utils.java   
@BindingConversion
public static String convertDate(Date date) {
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    return sdf.format(date);
}
项目:MVVM-JueJin    文件:RecyclerViewAdapter.java   
@BindingConversion
public static ItemView resToResHolder(@LayoutRes int layoutRes) {
    int defaultBindingVariable = BR.item;
    return ItemView.of(defaultBindingVariable, layoutRes);
}
项目:chameleon-live-wallpaper    文件:Util.java   
@BindingConversion
public static ColorDrawable convertColorToDrawable(int color) {
    return color != 0 ? new ColorDrawable(color) : null;
}
项目:Dahaka    文件:BindingAdapter.java   
@BindingConversion
public static int convertBooleanToVisibility(boolean visible) {
    return visible ? View.VISIBLE : View.GONE;
}
项目:DereHelper    文件:BindingAdapter.java   
@BindingConversion
public static String dateToString(Date date) {
    return Utils.formatDate(date);
}
项目:DereHelper    文件:BindingAdapter.java   
@BindingConversion
public static String intToString(int integer) {
    return integer == 0 ? "" : String.valueOf(integer);
}
项目:DereHelper    文件:BindingAdapter.java   
@BindingConversion
public static String doubleToString(double d) {
    return d == 0 ? "" : String.valueOf(d);
}
项目:DataBindingGuide    文件:CustomBindings.java   
@BindingConversion
public static ColorDrawable convertColorToDrawable(int color) {
    return new ColorDrawable(color);
}
项目:awesome-android-mvvm    文件:ConverterActivity.java   
@BindingConversion
public static ColorDrawable convertColorToDrawable(int color) {
    Log.d("BindingConversion", "convertColorToDrawable:" + color);
    return new ColorDrawable(color);
}
项目:droidcon2016    文件:ViewBindings.java   
@BindingConversion
public static int convertBooleanToVisibility(boolean visible) {
    return visible ? View.VISIBLE : View.GONE;
}
项目:Architecture-Demo    文件:BindingHelpers.java   
@BindingConversion
public static int convertBoolToVisibility(boolean visible) {
    return visible ? View.VISIBLE : View.GONE;
}
项目:easydatabinding    文件:ObservableString.java   
@BindingConversion
public static String convertToString(ObservableString s) {
    return s.get();
}
项目:devfest-2016-realm    文件:Binding.java   
@BindingConversion
public static int booleanToVisibility(boolean visible) {
  return visible ? View.VISIBLE : View.GONE;
}
项目:NaikSoftware-Lib-Android    文件:Converters.java   
@BindingConversion
public static ColorDrawable convertColorToDrawable(int color) {
    return new ColorDrawable(color);
}
项目:NaikSoftware-Lib-Android    文件:Converters.java   
@BindingConversion
public static int convertBooleanToInt(Boolean value) {
    return (value != null && value) ? View.VISIBLE : View.GONE;
}
项目:binea_project_for_android    文件:DataBindingHelper.java   
@BindingConversion public static ColorDrawable convertColorToDrawable(int color) {
    return new ColorDrawable(color);
}
项目:binding-collection-adapter    文件:BindingCollectionAdapters.java   
@BindingConversion
public static <T> ItemBinding<T> toItemBinding(OnItemBind<T> onItemBind) {
    return ItemBinding.of(onItemBind);
}
项目:MasteringAndroidDataBinding    文件:ConversionsActivity.java   
@BindingConversion
public static ColorDrawable convertColorToDrawable(int color) {
    return new ColorDrawable(color);
}
项目:TvDialog    文件:FontUtil.java   
@BindingConversion
    public static Typeface convertStringToFace(String fontName) {
        try {
            return Typeface.create(fontName, 0);
        } catch (Exception e) {
            return null;
        }
    }