Is posible custom player control view timeout animation via override androidx.media3.ui#PlayerControlView (Exoplayer StyledPlayerControlView)? - androidx

I want make some custom hide/show player controller animations.
And saw ExoPlayer issue #2277 and #3098 there.
It say that override hide() and show() to do animate stuff.
So I tried overide androidx.media3.ui#PlayerControlView(witch same as StyledPlayerControlView in ExoPlayer lib) and rewrite those two method.
It work for me when I trigger via calling those method, but the timeout auto hide not really working, it still animate the default one.
I also trace the trace the PlayerControlView#hide() method there, saw that animate via hardcode in androidx.media3.ui.PlayerControlViewLayoutManager, and it is final class.
It any correct solution or work around to make auto hide animation may animate with my custom animation?

Related

Is there a way to delay the rendering of a component in react

I have a component that is using React Transition Group to animate a component as it changes from one component to the next.
The problem I am having is that the next component is loading before the current animation is finished, so it looks a bit odd.
I think i could solve this if it were possible to delay the render() method when the component updates, as it never really unmounts, and this is why the component flashes the next image.
there is FAR too much code involved to paste it all here so i made my github public, and created an issue there to show what I am experiencing.
also you can view the site as it is live for this debugging session.
stevensheaves.me
Also, no judgy, its not 100% finished.
You can simply use the callback of the Transition Group namely onEntered.
A callback fired immediately after the 'enter' or 'appear' classes are removed and the done class is added to the DOM node.
You can use a flag variable to display your content. Set it to true when the callback is fired and to false when it's onEntering

GWT call method on presenter show

My question is related to my another question here: SVG using CSS3 animations in GWT
But it is more simple. Is there a way in GWT to call method after a presenter has been fully loaded?
For example lets have a SVG picture in one window (presenter) and text in another window(presenter). A button is there that when clicked it changes text presenter for SVG image presenter and vice versa (calling the go() method). I need to strip all CSS from svg an reapply it, but it has to be done AFTER the presenter is changed and image loaded. If I do it in the go() method, it will not work. Currently hacking it with schudleFixedDelay(), but want something less hacky.
EDIT1:
I mean when presenter contents are fully displayed in DOM, then I want to launch some code. It probably doesn't have anything to do with loading SVG image, just displaying it. How to know when everything from the presenter has been displayed and added to the DOM?
EDIT2:
Ok so the scheduleDeferred function is really what I am looking for. I know this function and use it, but I had more specific problem it seems. The scheduleDeferred function calls my method to fix the coordinats just fine. But when I was using it before, it did not work because of the method to fix coordinates. It seems, when I call removeAttribute("class") on SVG element, I cannot setAttribute("class", "classname") just after that. I had to make a scheduleFixedDelay there for at least 100ms, or it does not work. Not sure if the delay will work everywhere (mobiles, tablets...), but I don't know why it does not work without the delay. This is probably a solution for me.
Unless you use code splitting, GWT code is loaded all at once - before your app executes its first line of code. I assume you mean either "all presenter code is executed" or "the SVG image completed loading".
Depending on how you load the image, you can use Image class which implements load handlers (i.e. you can use onLoad()).
Alternatively, instead of a fixed delay you should use scheduleDeferred method in a Scheduler class, as explained here: GWT: Timer and Scheduler Classes

How to completely initialise a component but not add it to the display? Flex

I need to completely initialize a custom component in my Flex app (i.e. I should be able to access it from action script and get its properties and its children etc), But I do not want to add it to the display or make it visible.
I have tried to add it to my visible component, but keep it visible, but often many of its properties are set only when it is drawn, so i don't get what i need.
Is there a way to add a custom component to some sort of 'Virtual' display, that is not visible to the user?
You could add the component to an invisible Sprite - that way the component itself could both be on the stage and have its own visible property set to true.
Did you try using initialize()? After a view is added to the display list, the initialization stage begins. Calling initialize() before addChild() should let you initialize the view without needing to first add it to the stage.
For more info visit:
http://flexscript.wordpress.com/2008/10/24/flex-component-lifecycle-and-flex-component-framework/
http://blog.deadinkvinyl.com/2008/10/05/flex-3-addchild-and-initialize/
Not sure if possible without adding it to the display list, although I'd wish it were to some extent.
I once had to make custom drag proxy, which didn't work with the real component, because of some weird skinning issues. So instead I had PopupMananger add a box as a popup, added my component to the box, called validateNow on the component, drew it in a bitmap data, removed the popup, and used the bitmap data as the proxy.
So what you were trying was missing a call to validateNow most likely.

Best way to do loaders in a flex application?

What is the best way to do a loader in a flex application? I have an animated .gif that is to be used as our loader (whenever I need to wait for an action to complete), and I am not sure the best way to do it.
This is how I am thinking:
Have the loader be a custom component.
On the parent application, add an event listener for my custom event AceEvent.SHOW_LOADER.
In the event listener, use the PopUpManager to show the loader.
Listen for AceEvent.HIDE_LOADER.
Get rid fo the loader via PopUpManager.
What do you think about this? Is there a better way to do it?
Thanks!
Andrew
Well, last I checked, animated gifs don't work in Flex unless you have a workaround. Still, I wouldn't use an animated gif to create an animation because of their low quality. I would just recreate it using Flash.
The way I would do the loader however would be very different. personally, I don't believe in 'system loaders' unless it's your application's preloader. The reason for this is that there could be more than one thing loading at the same time (which might not know about each other) which means that the loader popup could disappear before everything is loaded (first one loads, dispatches event and removes popup, while the other is still loading).
What I like to do is create a custom component for the popup loader (since it will be reused quite a bit) and from there I can either use states the are appropriate for my view or have a boolean flag binded to show the popup when true (this can easily be done using frameworks like Parsley). The popup would only cover the part of the system that's actually loading data (since I doubt that your whole app is loading data at the same time) which makes for a better UX.
I ended up using as3gif (until I can get this recreated as a .swf). The way I do this is by using my custom event class (AceEvent.SHOW_LOADER and AceEvent.HIDE_LOADER), which bubbles up to the top. I then use the PopUpManager to add/remove this with modal to disable the application.

Flex: Modify an embedded icon and use it in a button?

Just that, if you embed an icon:
[Embed(source='icons/checkmark.png')]
private static var CheckMark:Class;
You end up with a dynamic class. You can pretty easily assign the icon to a button at runtime by calling the setStyle method:
var btn:Button = new Button();
btn.setStyle("icon", CheckMark);
But what if you wanted to alter the icon at runtime, like changing it's alpha value or even redrawing pixels, before assigning it to the button?
So far I can't find a satisfactory answer...
This is the only answer I could find that seemed close: Dynamic Icons (example with View Source)
His solution involves a custom "DynamicIcon" class which is used in the button's icon setting, and a custom Button class which adds one method to the Button class to draw dynamic icons.
The end result is that you are able to send BitmapData to the DynamicIcon class, which will show up in the button. So, embed your image, instantiate your asset class, get the bitmapasset and modify it however you need to and send the bitmapData to the icon.
It's an interesting problem and it seems like there should be an easier solution, but this works without a lot of hassle.
The way I'd solve this is to implement a programmatic skin class that draws the icon itself manually. There's probably more work you'll have to do to ensure the button calculates the correct size as if it has an icon even though it doesn't. You may have to poke through the Button source code to look at how the reference to the icon is stored.
I love just creating programmatic skins that do exactly what I want and then using interesting CSS declarations to modify states - for instance:
button.setStyle("customIconAlpha", .4);
and then of course the skin or the custom button class would have:
var alpha:Number = getStyle("customIconAlpha") as Number;
(not sure if you have to typecast that one)
The big problem I found with programmatic skins is that the button refuses to measure the width/height. I easily got around this by overriding the get methods for each:
override public function get width():Number { return WIDTH; }
override public function get height():Number { return HEIGHT; }
In my case I needed to modify buttons in a TabNavigator, hence no easy way to subclass the button. Thankfully, the parent of each skin is the button, so using static methods within your skin, you can identify the instance of the Button to which the icon skins belong.
If you're using the cover-all "icon" style, a new skin object will be created for each state. So you'll need to keep this in mind when changing the state of the icons.

Resources