Search in sources :

Example 1 with UDBitmap

use of com.taobao.luaview.userdata.kit.UDBitmap in project LuaViewSDK by alibaba.

the class UIImageViewMethodMapper method setImage.

public LuaValue setImage(U view, Varargs varargs) {
    if (varargs.isstring(2)) {
        final String url = varargs.optjstring(2, null);
        final LuaFunction callback = varargs.optfunction(3, null);
        return view.setImageUrl(url, callback);
    } else if (varargs.arg(2) instanceof UDData) {
        // data
        final UDData data = (UDData) varargs.arg(2);
        return view.setImageBytes(data != null ? data.bytes() : null);
    } else if (varargs.arg(2) instanceof UDBitmap) {
        // bitmap
        final UDBitmap bitmap = (UDBitmap) varargs.arg(2);
        return view.setImageBitmap(bitmap);
    }
    return view;
}
Also used : UDData(com.taobao.luaview.userdata.kit.UDData) UDBitmap(com.taobao.luaview.userdata.kit.UDBitmap) LuaFunction(org.luaj.vm2.LuaFunction)

Aggregations

UDBitmap (com.taobao.luaview.userdata.kit.UDBitmap)1 UDData (com.taobao.luaview.userdata.kit.UDData)1 LuaFunction (org.luaj.vm2.LuaFunction)1