Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make circular reveal effect when theme changed? (Like in Telegram or VK)

I am using DayNight theme in my application. And I have a button that changes the theme. In VK and Telegram app there is a beautiful reveal animation that changes the theme without restarting activity or something like that.

I have tried to make that with reveal animation implementation in different ways, but it doesn't work or working bad in some cases with AppCompatDelegate.setDefaultNightMode(...). All examples with that reveal animation are for ActivityA -> ActivityB, but I just need to update theme without starting any activity.

And one more thing: AppCompatDelegate.setDefaultNightMode recreates my activity, so do I need a custom theme changing implementation?

And main question: how to create that animation with theme changing?

Examples:

Telegram (From Dark to Light)

Telegram (From Light to Dark)

VK (From Light to Dark)

VK (From Dark to Light)

like image 604
Darth Vader Avatar asked Jan 18 '20 19:01

Darth Vader


Video Answer


1 Answers

since telegram is an open source app you can find the code -> line 3154: github. it seems that it converts layout into bitmap and use it with an existing imageView to animate circular reveal

like image 102
Hooman Avatar answered Oct 24 '22 15:10

Hooman