OSDN Git Service

Don't call requestLayout from onLayout
authorMarco Nelissen <marcone@google.com>
Wed, 6 Feb 2013 23:35:52 +0000 (15:35 -0800)
committerMarco Nelissen <marcone@google.com>
Wed, 6 Feb 2013 23:35:52 +0000 (15:35 -0800)
Doing a layout within a layout can lead to various problems, so it should
be avoided. There's some logging that warns of this, which got triggered
by CommonControllerOverlay.
I don't know what problem this code was originally trying to solve, but it
doesn't seem to be necessary anymore. The line in question was originally
introduced in change 209a9163d4e8cee0bfe162ae598ef40e6051479c, in Oct 2011.

Change-Id: I1402a842df59df31b69ad981337ea1c8630103df

src/com/android/gallery3d/app/CommonControllerOverlay.java

index 089872f..a5aa805 100644 (file)
@@ -274,10 +274,6 @@ public abstract class CommonControllerOverlay extends FrameLayout implements
         mBackground.layout(0, y - mTimeBar.getBarHeight(), w, y);
         mTimeBar.layout(pl, y - mTimeBar.getPreferredHeight(), w - pr, y);
 
-        // Needed, otherwise the framework will not re-layout in case only the
-        // padding is changed
-        mTimeBar.requestLayout();
-
         // Put the play/pause/next/ previous button in the center of the screen
         layoutCenteredView(mPlayPauseReplayView, 0, 0, w, h);