AnimationDrawable in RecyclerView item not animating on notifyDataSetChanged - android-recyclerview

I have a recyclerview whenever i select an item in recyclerview to play music i need to animate my AnimationDrawable equalizer of selected item but it is not animating when i call notifyDataSetChanged to refresh my view to show equalizer on selected item.

Related

React Native ScrollView hover touch event

I have a ScrollView and a Footer on absolute position.
When Scroll down the footer is hidden
and
When Scroll up the footer appears.
I want to modify the Scroll up animation.
when Scroll up with 1 touch(the finger doesn't stays on the ScrollView while scrolling) on ScrollView the footer appears.
but
when Scroll up with hover touch(the finger stays on the ScrollView while scrolling) footer remain hidden.
How can achieve this?
EXPO code:
https://snack.expo.dev/#stefanosalexandrou/humiliated-chips

Save button background and drawables using SharedPreferences for a for loop

A have a array of buttons which can have a different drawable and background depending if the button has been pressed. My question is: how can I save the drawable and background of each button in a for loop with SharedPreferences. I want to save this data because it gets reset after changing my screen orientation

How to addSubview to NSSrollView correctly?

My code:
#IBOutlet weak var scroller: NSScrollView!
var showSettingsButton = NSButton(frame: NSMakeRect(0, 860, 60, 40))
showSettingsButton.title = "Settings"
scroller.addSubview(showSettingsButton)
The button looks as intended by the scrollview keeps static, but when I scroll the ScrollView, the button just looks like this:
I want to put this button always in the down-left corner regardless of scroller's scrolling.
So which view should be the superView of this button?
It should be in your View. Put it underneath the Scroll View - Text View, but make sure it will be siblings with the Scroll View - Text View, and not a child.
If you're going to add it in code, add it like
view.addSubview(showSettingsButton)
For your requirement , you should subclass NSScrollView and override the "tile" method. There you can specify your buttons frame
When you want your Button not to scroll, why do you add it to the scroll view then?
Add it to view, the superview of scrollview. So make it a sibling of the scrollview. Just add the scrolliview first and the button next so that the button overwrites the scrollview and appears on top.
ViewController
-> View
-> ScrollView
-> TextView (and anything that you want to scroll)
-> Button
You may want to do parts of this programmatically because IB or Storyboard Editor respectivey may change the view hierarchy again by making the button a subview of your scroll view.

Resize views when menubar autohides/appear in fullscreen mode

I'm working on an OSX app that supports a fullscreen mode.
The window is generated from a nib file but everything else is handled programmatically.
When I goes in fullscreen mode, my views resize properly but when the menu bar appear/disappear, setFrame don't get called for either the contentView or my own views. I'd to be notified
Is there a delegate to implement to catch those notifications? Or do I have to subclass NSWindow and find out how Safari handles its menu bar by reversing it?
It would be helpful to see some code, how exactly "your views resize properly".
But next info might help:
When a window goes fullscreen it occupies entire screen after the end of the fullscreen animation. The main menu bar shows over the window ("above" in sense of z-ordering). So when main menu bar shows/hides frame of your window and content view don't change.
Also note, that -[NSScreen visibleFrame] returns unoccupied frame. And it will not return whole screen frame until the end of the fullscreen animation.
After some researches, I could at least get ride of the dirty gray bar at the top of the screen by subclassing the window's content view and add the following code to the setFrame method, before call super:
//isFullscreen
if(([self.window styleMask] & NSFullScreenWindowMask) == NSFullScreenWindowMask)
{
frameRect.size.height = self.window.frame.size.height;
frameRect.size.width = self.window.frame.size.width;
}
The window get resized to the screen size before setFrame get called, so we can use its size to update frameRect to window's size.

How to make scroll view reposition back to the top when I click a button

Hi I have a image in a view controller that has a scroll view, when the user scrolls to the bottom, there is a button that they click and it hides the view they were looking at and loads another, but it stays at the bottom because of the scroll view, so how can I go about reseting the scroll view back to the top when you click that button?
on your button click do
[self.scrollView setContentOffset:CGPointMake(0, 0)];
scrollView is the scroll view object.Replace it with your scroll view object name.