I have a series of animation which is started one after the other as shown in below code.
animPath.playFromStart();
animPath.setOnFinished((evt) -> {
TranslateTransition tCut = showText(lblCutover);
tCut.playFromStart();
lblCutover.setVisible(true);
tCut.setOnFinished((e11) -> {
try {
Thread.sleep(10000);
} catch (InterruptedException ex) {
Logger.getLogger(ARUOLandingPageController.class.getName()).log(Level.SEVERE, null, ex);
}
TranslateTransition tCutBack = hideText(lblCutover);
tCutBack.playFromStart();
tCutBack.setOnFinished((e12) -> {
lblCutover.setVisible(false);
anim11.playFromStart();
anim11.setOnFinished((evt11) -> {
(Some new animation)...
});
});
});
});
I have two types of animations. One is path animation and the other one is translate animation. No time gap is required after the path animation.
But after one translate animation is finished I want to give a time gap of 10 seconds for the next animation to start.
I used Thread.Sleep(10000) but it stops my entire stage. The stage becomes not responding if I click anywhere.
Is there a way I can just put time gap between these animations without affecting any other section in my ui?
You can put multiple transitions into SequentialTransition, where one of them can be a PauseTransition with a Duration.seconds(10).
Related
I've been trying out shared element transition on Lollipop. i have a recyclerview which loads some cards and one click the card expands to its details in the next activity.
I have set a ripple effect and a StateListAnimator on the card. But those are not visible cause the transition starts before these effects are completed.
Is there any way to delay the transition so that it can wait for the statelist animator and ripple to complete?
Here is the code I use
ActivityOptions options = null;
if (Utilities.isLollipop()) {
options = ActivityOptions.makeSceneTransitionAnimation(this, Pair.create(view, "hero_view"), Pair.create((View) fab, "fab"));
startActivity(detailIntent, options.toBundle());
}
Thanks in advance
I ended up using a work around, but I still would want to know what is the right way of doing this and therefore leaving the question open.
The work around I did was
1. remove the state list animator and add that as an animator in the onclick method.
2. Used a Handler to post a delayed call to the activity
new Handler().postDelayed(new Runnable() {
#Override
public void run() {
Intent i=new Intent(SearxhJobs.this,JobsTypes.class);
startActivity(i);
}
}, 200);
P.S- I did end up removing the effect as it was not very intuitive.
The way that may help some that already have the Transitions setup in Second Activity:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
getWindow().getSharedElementEnterTransition().setDuration(500);
getWindow().getSharedElementReturnTransition().setDuration(500)
.setInterpolator(new DecelerateInterpolator());
}
In trying to figure out how to start and stop Sprite animations from a SpriteSheet, I tried this:
// other code...
// define animations in SpriteSheet:
"animations": {"intro": [0, 19, "false"]}
// other code...
var spriteSheet = new createjs.SpriteSheet(data);
var intro = new createjs.Sprite(spriteSheet, "intro");
stage.addChild(intro);
createjs.Ticker.addEventListener("tick", stage);
intro.stop();
var btnStart = document.getElementById("btnStart");
btnStart.onclick = function() {
console.log("btnStart clicked");
intro.on("animationend", onStartAnimEnd);
intro.play();
};
function onStartAnimEnd(e) {
intro.removeEventListener("animationend", onStartAnimEnd);
console.log("Start anim ended");
}
In the above example, if the user clicks the btnStart button, the onStartAnimEnd callback fires indefinitely, even though by defining "false" in the animation configuration to signal we want to stop on the last frame, and the animation does in fact stop, and I'm removing the event listener in the first line of the callback.
If I add:
function onStartAnimEnd(e) {
intro.removeEventListener("animationend", onStartAnimEnd);
intro.stop();
console.log("Start anim ended");
}
The problem goes away, but that doesn't seem right... So, if I change the listener assignment of the animationend event from:
intro.on("animationend", onStartAnimEnd);
to:
ask.addEventListener("animationend", onAskAnimEnd);
...and with this change, the indefinite event captures goes away. So my questions are:
What's the difference with these two event listener assignments?
Is this animationend event continually firing in the background because we're updating the stage on the tick event, even though nothing needs re-rendering?
Thanks for your time!
This is actually a duplicated question. As I answered you previous question, your animation definition is wrong, you need to use the boolean value (false) and not the string value ("false").
Now sure what ask is, but the method on is a wrapper for addEventListener, and where you can specify things such as the scope of the callback and if it will run only once. Take a look at the API to know more:
http://www.createjs.com/Docs/EaselJS/classes/EventDispatcher.html#method_on
dhtmlxscheduler timeline when I use filtering
scheduler.filter_timeline = scheduler.filter_month = scheduler.filter_day = scheduler.filter_week = function(id, event) {
// display event only if its type is set to true in filters obj
if (rules[event.user_id]) {
return true;
}
// default, do not display event
return false;
};
drag animation (drawing a Node/session) doesn't work.
if you look at the DHTMLX_scheduler samples you will see create a new event doesn't work properly.
/samples/09_api/09_filtering_events.html
I am using Trace Skin . Every thing is working well. even light box is loading . the main problem is when I use this statement filter_timeline then Timeline drawing stop draw event.(It can also create it but the it is like transparent)
It is not a bug in scheduler itself, but badly written sample
In code of sample, update next line
CODE: SELECT ALL
if (filters[event.type]) {
as
CODE: SELECT ALL
if (filters[event.type] || event.type==scheduler.undefined) {
When event just created it doesn't have the type defined yet, so it was filtered out with previous logic
I have created a tilelist and each tile of tile list is a canvas where graphics is drawn on rollover. When mouse is rolled out from that particular canvas the graphics drawn has to be removed. So I am doing graphics.clear but not able to remove the graphics.
Code
protected function canvas1_updateCompleteHandler(event:FlexEvent):void
{
var allowHighLight:Boolean = QzGridImpl(this.owner).m_bEnableHighLight;
if(!allowHighLight)
return;
var highLighted:Boolean = TileList(this.owner).isItemHighlighted(this.data);
if(highLighted)
{
high = true;
DrawBackgroundImage(QzGridImpl(this.owner).m_strBackgroundImage as String);
}
//when highlighted becomes false the below part is called
else
{
if(high)
{
this.graphics.endFill();//and cleanly im observing that endfill and clear is getting called and they are able to clear graphics when mouse is rolled out slowly but not able to clear when mouse is rolled out fast.
trace("endfill");
this.graphics.clear();
trace("clear");
}
}
private function DrawBackgroundImage(n_strBackImg:String):void
{
//code for drawing the background image
}
and cleanly I am observing that endfill and clear is getting called and they are able to clear graphics when mouse is rolled out slowly but not able to clear when mouse is rolled out fast.
What need to be done to make it working?
You could create a custom ItemRenderer for the TileList, and apply the image effect when the rollover is triggered in the itemRenderer (by adding a rollOver listener to the renderer). That might work - and is probably a neater way of doing it too.
I write automated scripts for testing web applications that are very heavy on ajax. For example, a modal dialog is displayed with the text "Saving..." when saving settings, while a lightbox greys out the rest of the page.
My test scripts are trying to click the next link in the test before the message disappears. It almost always works when driving Firefox, but when driving Chrome the following error is displayed:
Exception in thread "main" org.openqa.selenium.WebDriverException: Element is not clickable at point (99.5, 118.5). Other element would receive the click: <div class="dijitDialogUnderlay _underlay" dojoattachpoint="node" id="lfn10Dijit_freedom_widget_common_environment_Dialog_8_underlay" style="width: 1034px; height: 1025px; "></div> (WARNING: The server did not provide any stacktrace information)
This happens because the lightbox is obscuring the element I want to click on. I want to wait for the lightbox to disappear before attempting to click the link.
Checking for the lightbox to no longer exist is not a valid workaround because there are, at times, multiple levels of modal dialogs and lightboxes, and no easy way to distinguish between them.
Is there a way in Selenium to detect if the element is clickable (no other elements obscuring it)? A try/catch would be a workaround, but I'd prefer to do a proper check if that is possible.
Use the WebDriverWait conditions.
WebDriverWait wait = new WebDriverWait(yourWebDriver, 5);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//xpath_to_element")));
Webdriver will wait for 5 seconds for your element to be able to be clicked.
You can use the ExpectedConditions.invisibilityOfElementLocated(By by) method which waits until the element is either invisible or not present on the DOM.
WebDriverWait wait = new WebDriverWait(yourWebDriver, 10);
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("yourSavingModalDialogDiv")));
So, depending on how much time your modal dialog takes to go invisible or go off the DOM, webdriver will wait. The wait is for a maximum of 10 seconds.
You could create a clickUntil function/method that does a WebDriver wait until the element is clickable with a timeout. It would attempt to click on the element, and throw away "Element is not clickable" error messages each time until it becomes clicked or times out.
Not sure how to write that in dojo, but that's an idea.
I also have same problems, but I tested many input in site. One are clickable which I tested and other - not clickable one just skipped. I made it by try() catch()
Simply Code :
for(){ // for all my input
try {
driver.findElement(By.xpath("...."
+ "//input)["+(i+1)+"]")).click();
... tests...
} catch(Exception e) {
if(e.getMessage().contains("is not clickable at point")) {
System.out.println(driver.findElement(By.xpath(locator)).
getAttribute("name")+" are not clicable");
} else {
System.err.println(e.getMessage());
}
}
And more elegant:
#SuppressWarnings("finally")
public boolean tryClick(WebDriver driver,String locator, locatorMethods m) {
boolean result = false;
switch (m) {
case xpath:
try {
driver.findElement(By.xpath(locator)).click();
result= true;
} catch (Exception e) {
if(e.getMessage().contains("is not clickable at point")) {
System.out.println(driver.findElement(By.xpath(locator)).getAttribute("name")+" are not clicable");
} else {
System.err.println(e.getMessage());
}
} finally {
break;
}
case id:
try {
driver.findElement(By.id(locator)).click();
return true;
} catch (Exception e) {
if(e.getMessage().contains("is not clickable at point")) {
System.out.println(driver.findElement(By.id(locator)).getAttribute("name")+" are not clicable");
} else {
System.err.println(e.getMessage());
}
} finally {
break;
}
default:
System.err.println("Unknown locator!");
}
return result;
}
In Scala:
Standard code for waiting (visibility/invisibility)
(new WebDriverWait(remote, 45)).until(
ExpectedConditions.visibilityOf(remote.findElement(locator))
)
Thread.sleep(3000)
More visibility in logs :
while (remote.findElement(locator).isDisplayed) {
println(s"isDisplayed: $ii $a : " + remote.findElement(locator).isDisplayed)
Thread.sleep(100)
}
If you have asynchronous JavaScript processes use web-elements with timestamp:
val oldtimestamp = remote.findElements(locator).get(0).getAttribute("data-time-stamp")
while (oldtimestamp == remote.findElements(locator).get(0).getAttribute("data-time-stamp")) {
println("Tstamp2:" + remote.findElements(locator).get(0).getAttribute("data-time-stamp"))
Thread.sleep(200)
}