From 1d0a152fa8905b9dfb87dc87da8e5432e48eae96 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Wed, 18 Nov 2009 01:35:42 -0800 Subject: Workaround for 2262578: Don't draw tabs if view is not in the correct orientation for the layout This is an uber hack. Since there is a race between resizing the view and getting the orientation-changed notification, this just tries to avoid drawing the tabs in the wrong orientation (based on what we *expect* to be the orientation specified in the layout file for the SlidingTab). This masks the problem *most* of the time. --- core/java/com/android/internal/widget/SlidingTab.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/java/com/android/internal/widget/SlidingTab.java b/core/java/com/android/internal/widget/SlidingTab.java index b7dd27d..cb67bfc 100644 --- a/core/java/com/android/internal/widget/SlidingTab.java +++ b/core/java/com/android/internal/widget/SlidingTab.java @@ -17,6 +17,7 @@ package com.android.internal.widget; import android.content.Context; +import android.content.res.Configuration; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Canvas; @@ -150,6 +151,14 @@ public class SlidingTab extends ViewGroup { // TODO: For debugging; remove after glitches debugged. @Override protected void dispatchDraw(Canvas canvas) { + int orientation = getResources().getConfiguration().orientation; + if (mOrientation == HORIZONTAL && orientation != Configuration.ORIENTATION_PORTRAIT + || mOrientation == VERTICAL && orientation != Configuration.ORIENTATION_LANDSCAPE) { + // UBER HACK ALERT. This is a workaround for a configuration race condition between + // orientation changed notification and the resize notification. This just prevents + // us from drawing under this circumstance, though the view will still be wrong. + return; + } super.dispatchDraw(canvas); } -- cgit v1.1