MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / animate

Method animate

CodenameOne/src/com/codename1/ui/Tabs.java:350–409  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

348
349 /// {@inheritDoc}
350 @Override
351 public boolean animate() {
352 boolean b = super.animate();
353 // Indicator-animation tick: redraw the tab bar each frame while
354 // the motion is in flight. We let the existing super.animate /
355 // slide motion control deregistration; the indicator motion is
356 // cheap enough to run alongside without coordination.
357 if (indicatorAnimMotion != null) {
358 if (indicatorAnimMotion.isFinished()) {
359 indicatorAnimMotion = null;
360 } else {
361 tabsContainer.repaint();
362 b = true;
363 }
364 }
365 if (slideToDestMotion != null) {
366 if (swipeOnXAxis) {
367 int motionX = slideToDestMotion.getValue();
368 final int size = contentPane.getComponentCount();
369 int tabWidth = contentPane.getWidth() - tabsGap * 2;
370 for (int i = 0; i < size; i++) {
371 int xOffset;
372 if (isRTL()) {
373 xOffset = (size - i) * tabWidth;
374 xOffset -= ((size - active) * tabWidth);
375 } else {
376 xOffset = i * tabWidth;
377 xOffset -= (active * tabWidth);
378 }
379 xOffset += motionX;
380 Component component = contentPane.getComponentAt(i);
381 component.setX(xOffset);
382 }
383 } else {
384 int motionY = slideToDestMotion.getValue();
385 final int size = contentPane.getComponentCount();
386 int tabHeight = contentPane.getHeight() - tabsGap * 2;
387 for (int i = 0; i < size; i++) {
388 int yOffset;
389 yOffset = i * tabHeight;
390 yOffset -= (active * tabHeight);
391 yOffset += motionY;
392 Component component = contentPane.getComponentAt(i);
393 component.setY(yOffset);
394 }
395 }
396 if (slideToDestMotion.isFinished()) {
397 for (int i = 0; i < contentPane.getComponentCount(); i++) {
398 Component component = contentPane.getComponentAt(i);
399 component.paintLockRelease();
400 }
401 slideToDestMotion = null;
402 setEnableLayoutOnPaint(true);
403 deregisterAnimatedInternal();
404 setSelectedIndex(active);
405 }
406 return true;
407 }

Callers

nothing calls this directly

Calls 15

setXMethod · 0.95
setYMethod · 0.95
paintLockReleaseMethod · 0.95
setSelectedIndexMethod · 0.95
animateMethod · 0.65
isFinishedMethod · 0.65
repaintMethod · 0.65
getValueMethod · 0.65
getComponentCountMethod · 0.65
getWidthMethod · 0.65

Tested by

no test coverage detected