Profile

Cover photo
David Wu
Attended National Taiwan University
Lives in Taipei, Taiwan
1,960 followers|268,599 views
AboutPostsPhotosYouTubeReviews

Stream

David Wu

Shared publicly  - 
 
So excited about the new flagship that will be announced on the 25th.  I can't be more proud!
9
蔡仲明's profile photoTed Chien's profile photo
2 comments
 
希望螢幕不要太大(祈禱)
 ·  Translate
Add a comment...

David Wu

commented on a video on YouTube.
Shared publicly  - 
 
很好聽 :)  為了公益而唱的歌聲特別溫暖,很期待正式上台的表現!
 ·  Translate
1
Add a comment...

David Wu

Shared publicly  - 
 
上星期接受了 TechTalk@TW的訪問,內容介紹了 vert.x 這套跑在 JVM 上的 framework。 http://www.techtalk.tw/2013/09/episode-22-vertx.html
 ·  Translate
4
1
Liwei Chou's profile photoScott Tsai's profile photo
2 comments
 
好酷~
 ·  Translate
Add a comment...

David Wu

Shared publicly  - 
 
 
Performance bits and pieces, part II - use fewer Views

One of +Romain Guy's hobbies is to file bugs on people to use fewer Views. But you didn't hear it from me. Anyhow...

The screenshot below shows a full-width banner row with image that cross-fades into solid-color background, with title and (optional) subtitle to its right. In the previous release of the Play Store app we used six child views. Now we use three. What did we remove?

The first one to go was a View that spanned the whole width and height of the parent minus the paddings. That view had the main background fill color set on it. Now that background color is set on the parent view, with one minor caveat. If you call View.setBackgroundColor, it will set the color on the full bounds including the padding. Instead, what you want to do is to use an InsetDrawable and wrap it around a PaintDrawable initialized with your color. I mentioned this before, and I'll mention it here. Do not use ColorDrawable as a bug on older OS versions will cause it to ignore the insets.

The next one was used to create the cross-fade between the right edge of the image and the solid fill. One option is to tweak the bits of the bitmap itself after you load it from network or local cache. Any kind of device-side image processing (in general so YMMV) is expensive in terms of both memory and CPU, so we opted out for overlaying the right part of the ImageView with a View that had a GradientDrawable set as its background. That drawable was initialized with two end points - full-opacity fill color on the right, and the same fill color with 0x00FFFFFF mask applied to it on the left. You usually don't want a "random" transparent color used on such a gradient, as the intermediate pixels will not look right across a variety of solid colors. The gradient drawable should be created once in the constructor and then have its setBounds method called from within the onLayout of your custom view group (so that it is properly positioned on its view).

In the latest release we're achieving the same visual effect using fading edges. Here, you extend the ImageView class and do the following:

* call setHorizontalFadingEdgeEnabled(true)
* call setFadingEdgeLength passing the width of the fade area in pixels
* override getLeftFadingEdgeStrength() to return 0.0f (in our case)
* override getRightFadingEdgeStrength() to return 1.0f (in our case)
* override getSolidColor() to return the ARGB value of the matching solid fill to be used in the fading edge part
* override hasOverlappingRendering() to return true and onSetAlpha(int alpha) to return false

The last two are needed to indicate that the fading edge should be respected during image view fade-in sequence.

Finally, the last view to go was a full-span child that provided light blue highlight visuals for pressed/focused state. Instead, we override the draw method to paint those states explicitly. If isPressed() and isClickable() return true, we call setBounds on the press Drawable and call its draw(Canvas) method. Otherwise, if isFocused() returns true, we do the same for the focus Drawable.

Note that none of this results in improving the overdraw. We're touching all the pixels the same number of times we used to. However, we're spending slightly less time inflating the view itself, as well as on measuring and laying out the child views.
2
1
Yao-Te Tsai's profile photo
Add a comment...

David Wu

Shared publicly  - 
 
As a developer I have had experience working with many different APIs provided by various online services.  Thus far I am most impressed with the StackExchange v2 API.  It has great documentation and a well thought-out feature set.
1
Add a comment...

David Wu

Shared publicly  - 
 
I'll be speaking about vert.x at the Taiwan Java User Group.  Feel free to sign up and join.
1
Add a comment...
In his circles
1,332 people
Have him in circles
1,960 people

David Wu

Shared publicly  - 
3
Patrick Tsai's profile photoDavid Wu's profile photo
4 comments
 
Do you know any Go community in Taiwan?
Add a comment...
Guyuan Lin was tagged in David Wu's photo.

David Wu

Shared publicly  - 
 
Sad to miss COSCUP and JavaOne because of a business trip. QQ
2
Kene Lin's profile photoJulian Shen's profile photo
2 comments
 
又要去哪爽?
 ·  Translate
Add a comment...

David Wu

Shared publicly  - 
 
This will be my first time speaking at the TWJUG.  Can't wait to see what the Oracle office looks like.
2
Add a comment...
People
In his circles
1,332 people
Have him in circles
1,960 people
Work
Occupation
Software Engineer
Places
Map of the places this user has livedMap of the places this user has livedMap of the places this user has lived
Currently
Taipei, Taiwan
Previously
Taipei and Vancouver - Vancouver, BC, Canada - Kingston, Ontario, Canada
Story
Introduction
David Wu is a principal software engineer at HTC. He works on the social network team for HTC Sense, responsible for adding “social touches” to the overall user experience. He is one of the core developers behind HTC Friend Stream.

In his free time he is also an active participant in the free software community in Taiwan. He is a regular at both the Taipei Open Source Software User Group and Hacking Thursday.
Education
  • National Taiwan University
  • Queen's University
Basic Information
Gender
Male
Relationship
Married
7 reviews
Map
Map
Map