partial code to handle action button and for loading gif need to complete
this