android-ktx icon indicating copy to clipboard operation
android-ktx copied to clipboard

Improve View.doOnPreDraw(...)

Open andkulikov opened this issue 7 years ago • 1 comments

Hi, Recently I found OneShotPreDrawListener class in android framework which looks for me like a solution which covers all the cornercases like removing the view from the hierarchy before the first drawing: https://android.googlesource.com/platform/frameworks/base/+/master/core/java/com/android/internal/view/OneShotPreDrawListener.java Don't you think View.doOnPreDraw(...) should use analog of it internally(with addOnAttachStateChangeListener)?

andkulikov avatar Jun 25 '18 17:06 andkulikov

Makes sense, although it seems like we should try to land this in 'core' and then consume it from 'core-ktx' first.

On Mon, Jun 25, 2018 at 1:25 PM Andrey Kulikov [email protected] wrote:

Hi, Recently I found OneShotPreDrawListener class in android framework which looks for me like a solution which covers all the cornercases like removing the view from the hierarchy before the first drawing:

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/com/android/internal/view/OneShotPreDrawListener.java Don't you think View.doOnPreDraw(...) should use analog of it internally(with addOnAttachStateChangeListener)?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/android/android-ktx/issues/588, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEVv8bSfdBNvGhlhCyTtxel-0bChBks5uARz9gaJpZM4U2jF2 .

JakeWharton avatar Jun 28 '18 20:06 JakeWharton