Java Code Examples for org.luaj.vm2.Varargs#optdouble()

The following examples show how to use org.luaj.vm2.Varargs#optdouble() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UIImageViewMethodMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 6 votes vote down vote up
/**
 * 开始帧动画
 *
 * @param view
 * @param varargs 时间是秒而不是毫秒
 * @return
 */
@Deprecated
public LuaValue startAnimationImages(U view, Varargs varargs) {//TODO 支持UDImageView和UDBitmap
    final LuaTable imagesTable = varargs.opttable(2, null);
    final double duration = varargs.optdouble(3, 1f);
    boolean repeat = false;
    if (varargs.isnumber(4)) {
        repeat = varargs.optint(4, -1) > 0;
    } else {
        repeat = varargs.optboolean(4, false);
    }
    if (imagesTable != null && imagesTable.length() > 0) {
        final String[] images = new String[imagesTable.length()];
        int i = 0;
        for (LuaValue key : imagesTable.keys()) {
            images[i++] = imagesTable.get(key).optjstring(null);
        }
        return view.startAnimationImages(images, (int) duration * 1000, repeat);
    }
    return view;
}
 
Example 2
Source File: UITextViewMethodMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
public LuaValue setTextSize(U view, Varargs varargs) {
    final float fontSize = (float) varargs.optdouble(2, 12.0);//TODO 这里需要转sp么?
    float density = AndroidUtil.getDensity(view.getContext());
    if (density < 3) {
        return view.setTextSize(fontSize - 2);
    } else {
        return view.setTextSize(fontSize);
    }
}
 
Example 3
Source File: ParamUtil.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
/**
 * get float value from Varargs
 *
 * @param varargs
 * @param firstIndex 开始的位置
 * @return
 */
public static float[] getFloatValues(Varargs varargs, int firstIndex) {
    float[] values = null;
    if (varargs.narg() > (firstIndex - 1)) {
        values = new float[varargs.narg() - (firstIndex - 1)];
        for (int i = firstIndex; i <= varargs.narg(); i++) {
            values[i - firstIndex] = (float) varargs.optdouble(i, 0f);
        }
    }
    return values;
}
 
Example 4
Source File: VenvyLVSvgeImageView.java    From VideoOS-Android-SDK with GNU General Public License v3.0 5 votes vote down vote up
public void stepToPercentage(Varargs varargs) {
    if (iSvgaImageView == null) {
        return;
    }
    if (varargs == null || varargs.narg() <= 1) {
        return;
    }
    double percentage = varargs.optdouble(2, 0);
    boolean autoPlay = varargs.optboolean(3, true);
    iSvgaImageView.stepToPercentage(percentage, autoPlay);
}
 
Example 5
Source File: UIViewMethodMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
public LuaValue setAlpha(U view, Varargs varargs) {
    final float alpha = (float) varargs.optdouble(2, 1.0f);
    return view.setAlpha(alpha);
}
 
Example 6
Source File: UIViewMethodMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
public LuaValue setAnchorPoint(U view, Varargs varargs) {
    //TODO oc实现跟这个不一样,oc会移动一下
    final float pivotX = (float) varargs.optdouble(2, 0.5f);
    final float pivotY = (float) varargs.optdouble(3, 0.5f);
    return view.setPivot(pivotX, pivotY);
}
 
Example 7
Source File: UIViewMethodMapper.java    From VideoOS-Android-SDK with GNU General Public License v3.0 4 votes vote down vote up
public LuaValue setRotation(U view, Varargs varargs) {
    final float rotation = (float) varargs.optdouble(2, 0.0);
    return view.setRotation(rotation);
}