Java Code Examples for org.luaj.vm2.Varargs#optboolean()
The following examples show how to use
org.luaj.vm2.Varargs#optboolean() .
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 |
/** * 开始帧动画 * * @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: VenvyLVSvgeImageView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
public void startAnimation(Varargs varargs) { if (iSvgaImageView == null) { return; } if (varargs == null) { iSvgaImageView.startAnimation(); } else { int length = varargs.optint(2, -1); int location = varargs.optint(3, -1); if (length != -1 && location != -1) { boolean isReverse = varargs.optboolean(4, false); iSvgaImageView.startAnimation(length, location, isReverse); } else { iSvgaImageView.startAnimation(); } } }
Example 3
Source File: UIHorizontalScrollViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue setOffset(U view, Varargs varargs) { final int x = DimenUtil.dpiToPx(varargs.arg(2)); final int y = DimenUtil.dpiToPx(varargs.arg(3)); final boolean smooth = varargs.optboolean(4, false); if (smooth) { return view.smoothScrollTo(x, y); } else { return view.scrollTo(x, y); } }
Example 4
Source File: VenvyLVSvgeImageView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public void stepToFrame(Varargs varargs) { if (iSvgaImageView == null) { return; } if (varargs == null || varargs.narg() <= 1) { return; } int frame = varargs.optint(2, 0); boolean autoPlay = varargs.optboolean(3, true); iSvgaImageView.stepToFrame(frame, autoPlay); }
Example 5
Source File: UIScrollViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
/** * 滚动一段距离 * * @param view * @param varargs * @return */ @Deprecated public LuaValue scrollBy(U view, Varargs varargs) { final int dx = DimenUtil.dpiToPx(varargs.arg(2)); ; final int dy = DimenUtil.dpiToPx(varargs.arg(3)); final boolean smooth = varargs.optboolean(4, false); if (smooth) { return view.smoothScrollBy(dx, dy); } else { return view.scrollBy(dx, dy); } }
Example 6
Source File: UIScrollViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue setOffsetBy(U view, Varargs varargs) { final int x = DimenUtil.dpiToPx(varargs.arg(2)); final int y = DimenUtil.dpiToPx(varargs.arg(3)); final boolean smooth = varargs.optboolean(4, false); if (smooth) { return view.smoothScrollBy(x, y); } else { return view.scrollBy(x, y); } }
Example 7
Source File: UIScrollViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue setOffset(U view, Varargs varargs) { final int x = DimenUtil.dpiToPx(varargs.arg(2)); final int y = DimenUtil.dpiToPx(varargs.arg(3)); final boolean smooth = varargs.optboolean(4, false); if (smooth) { return view.smoothScrollTo(x, y); } else { return view.scrollTo(x, y); } }
Example 8
Source File: UIHorizontalScrollViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
/** * 滚动一段距离 * * @param view * @param varargs * @return */ @Deprecated public LuaValue scrollBy(U view, Varargs varargs) { final int dx = DimenUtil.dpiToPx(varargs.arg(2)); ; final int dy = DimenUtil.dpiToPx(varargs.arg(3)); final boolean smooth = varargs.optboolean(4, false); if (smooth) { return view.smoothScrollBy(dx, dy); } else { return view.scrollBy(dx, dy); } }
Example 9
Source File: UIHorizontalScrollViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue setOffsetBy(U view, Varargs varargs) { final int x = DimenUtil.dpiToPx(varargs.arg(2)); final int y = DimenUtil.dpiToPx(varargs.arg(3)); final boolean smooth = varargs.optboolean(4, false); if (smooth) { return view.smoothScrollBy(x, y); } else { return view.scrollBy(x, y); } }
Example 10
Source File: VenvyLVSvgeImageView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public void stopAnimation(Varargs varargs) { boolean b = varargs.optboolean(2, false); if (iSvgaImageView != null) { if (b) { iSvgaImageView.stopAnimation(b); } iSvgaImageView.stopAnimation(); } }
Example 11
Source File: UDActionBar.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
@Override public Varargs invoke(Varargs args) { ActionBar actionBar = LuaViewUtil.getActionBar(getGlobals()); if (actionBar != null) { boolean showBack = args.optboolean(2, true); actionBar.setDisplayHomeAsUpEnabled(showBack); } return UDActionBar.this; }
Example 12
Source File: UIViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public LuaValue setShowScrollIndicator(U view, Varargs varargs) { final boolean horizontalIndicator = varargs.optboolean(2, false); final boolean verticalIndicator = varargs.optboolean(3, false); view.setHorizontalScrollBarEnabled(horizontalIndicator); view.setVerticalScrollBarEnabled(verticalIndicator); return view; }
Example 13
Source File: UIViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
/** * 显示 * * @param view * @param varargs * @return */ public LuaValue hidden(U view, Varargs varargs) { if (varargs.narg() > 1) { boolean isHide = varargs.optboolean(2, true); return isHide ? hide(view, varargs) : show(view, varargs); } else { return isHide(view, varargs); } }
Example 14
Source File: VenvyLVSvgeImageView.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
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 15
Source File: UIBaseListOrRecyclerViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
/** * (x, y, w, h, animate) 滚动到指定位置 * * @param view * @param varargs * @return */ public LuaValue scrollToCell(U view, Varargs varargs) { final int section = LuaUtil.toJavaInt(varargs.arg(2));//lua从1开始 final int rowInSection = LuaUtil.toJavaInt(varargs.arg(3));//lua从1开始 final int offset = DimenUtil.dpiToPx(varargs.arg(4)); final boolean animate = varargs.optboolean(5, true); return getUDBaseListOrRecyclerView(varargs).scrollToItem(section, rowInSection, offset, animate); }
Example 16
Source File: UIViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue setEnabled(U view, Varargs args) { final boolean enable = args.optboolean(2, true); return view.setEnabled(enable); }
Example 17
Source File: UIViewPagerMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue setCurrentItem(U view, Varargs varargs) { final int currentItem = LuaUtil.toJavaInt(varargs.arg(2)); final boolean smoothScroll = varargs.optboolean(3, true); return view.setCurrentItem(currentItem, smoothScroll); }
Example 18
Source File: UIBaseListOrRecyclerViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 4 votes |
public LuaValue setShowScrollIndicator(U view, Varargs varargs) { final boolean isShow = varargs.optboolean(2, true); return view.setVerticalScrollBarEnabled(isShow); }
Example 19
Source File: UIAnimatorMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * 设置动画repeat mode 类型是否reverse * * @param udAnimation * @param varargs * @return */ public LuaValue reverses(U udAnimation, Varargs varargs) { final boolean reverse = varargs.optboolean(2, true); return udAnimation.setRepeatMode(reverse ? ValueAnimator.REVERSE : ValueAnimator.RESTART); }
Example 20
Source File: UIBaseListOrRecyclerViewMethodMapper.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 2 votes |
/** * (x, y, w, h, animate) 滚动到指定位置 * * @param view * @param varargs * @return */ public LuaValue scrollToTop(U view, Varargs varargs) { final int offset = varargs.isnumber(2) ? DimenUtil.dpiToPx(varargs.arg(2)) : 0; final boolean animate = varargs.isnumber(2) ? varargs.optboolean(3, true) : varargs.optboolean(2, true); return getUDBaseListOrRecyclerView(varargs).scrollToTop(offset, animate); }