package com.liuguangqiang.idaily.uitls;

import android.databinding.BindingAdapter;
import android.text.TextUtils;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;

/**
 * Created by Eric on 15/6/23.
 */
public class DataBindingUtils {

    @BindingAdapter({"bind:imageUrl"})
    public static void loadImage(ImageView iv, String imageUrl) {
        if (!TextUtils.isEmpty(imageUrl))
            Picasso.with(iv.getContext()).load(imageUrl).into(iv);
    }

    @BindingAdapter({"bind:body"})
    public static void loadBody(WebView webView, String body) {
        if (!TextUtils.isEmpty(body)) {
            webView.loadData(body, "text/html; charset=UTF-8", null);
        }
    }

    @BindingAdapter({"bind:datetime"})
    public static void loadDatetime(TextView textView, int datetime) {
        textView.setText(DailyUtils.getDisplayDate(textView.getContext(), datetime));
    }

}

@@ -205,16 +205,236 @@
 tView;%0A%0A
+import com.liuguangqiang.framework.utils.Logs;%0Aimport com.liuguangqiang.idaily.adapter.BaseRecyclerAdapter;%0Aimport com.liuguangqiang.idaily.entity.BaseEntity;%0Aimport com.liuguangqiang.idaily.widget.PageableRecyclerView;%0A
 import c
@@ -463,16 +463,40 @@
 casso;%0A%0A
+import java.util.List;%0A%0A
 /**%0A * C
@@ -1112,24 +1112,24 @@
 datetime) %7B%0A
-
         text
@@ -1209,10 +1209,493 @@
 %0A    %7D%0A%0A
+    @BindingAdapter(%7B%22bind:adapter%22%7D)%0A    public static void bindAdapter(PageableRecyclerView recyclerView, BaseRecyclerAdapter adapter) %7B%0A        Logs.i(%22bindAdapter%22);%0A        adapter.setRecylerView(recyclerView);%0A        recyclerView.setAdapter(adapter);%0A    %7D%0A%0A    @BindingAdapter(%7B%22bind:data%22%7D)%0A    public static void bindData(PageableRecyclerView recyclerView, List%3CBaseEntity%3E data) %7B%0A        recyclerView.notifyDataSetChanged();%0A        recyclerView.onPageFinished();%0A    %7D%0A%0A
 %7D%0A

Update @BindingAdapter.