diff options
| author | Mitsuru Oshima <oshima@google.com> | 2009-06-09 21:16:08 -0700 |
|---|---|---|
| committer | Mitsuru Oshima <oshima@google.com> | 2009-06-10 15:22:17 -0700 |
| commit | e5fb328825995aa33b5b7ecf8b5bee2b17f81715 (patch) | |
| tree | 4b6ca87aaf21dd587e1d033f5ba3318c4329698f /core/java/android/view/ViewRoot.java | |
| parent | ca436e24dec0fa258a8a756c3e7d07bcb096c5b3 (diff) | |
| download | frameworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.zip frameworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.tar.gz frameworks_base-e5fb328825995aa33b5b7ecf8b5bee2b17f81715.tar.bz2 | |
resolution support fix/improvement
* adding compatibility menu
* backup gravity
* set expanable=true if the screen size is hvga * density.
* added "supports any density" mode. I'll add sdk check later.
* disallow to catch orientation change event if the app is not expandable. This
was causing layout problem under non-expandable mode. I discussed this with Mike C
and we agreed to do this approach for now. We'll revisit if this causes problem to
a lot of applications.
Diffstat (limited to 'core/java/android/view/ViewRoot.java')
| -rw-r--r-- | core/java/android/view/ViewRoot.java | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index d8bab56..ee8229d 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -129,7 +129,6 @@ public final class ViewRoot extends Handler implements ViewParent, boolean mIsAnimating; private CompatibilityInfo mCompatibilityInfo; - private int[] mWindowLayoutParamsBackup = null; final View.AttachInfo mAttachInfo; @@ -388,10 +387,11 @@ public final class ViewRoot extends Handler implements ViewParent, if (mView == null) { mView = view; mWindowAttributes.copyFrom(attrs); - mCompatibilityInfo = - mView.getContext().getResources().getCompatibilityInfo(); - if (mCompatibilityInfo.mScalingRequired) { - mWindowLayoutParamsBackup = new int[4]; + mCompatibilityInfo = mView.getContext().getResources().getCompatibilityInfo(); + boolean restore = false; + if (mCompatibilityInfo.mScalingRequired || !mCompatibilityInfo.mExpandable) { + restore = true; + mWindowAttributes.backup(); } if (!mCompatibilityInfo.mExpandable) { adjustWindowAttributesForCompatibleMode(mWindowAttributes); @@ -420,6 +420,11 @@ public final class ViewRoot extends Handler implements ViewParent, unscheduleTraversals(); throw new RuntimeException("Adding window failed", e); } + + if (restore) { + mWindowAttributes.restore(); + } + if (mCompatibilityInfo.mScalingRequired) { mAttachInfo.mContentInsets.scale( mCompatibilityInfo.mApplicationInvertedScale); @@ -1921,9 +1926,6 @@ public final class ViewRoot extends Handler implements ViewParent, } else { didFinish = false; } - if (event != null && mCompatibilityInfo.mScalingRequired) { - event.scale(mCompatibilityInfo.mApplicationInvertedScale); - } if (DEBUG_TRACKBALL) Log.v(TAG, "Motion event:" + event); @@ -2355,13 +2357,15 @@ public final class ViewRoot extends Handler implements ViewParent, boolean restore = false; float appScale = mCompatibilityInfo.mApplicationScale; boolean scalingRequired = mCompatibilityInfo.mScalingRequired; - if (params != null && !mCompatibilityInfo.mExpandable) { + restore = true; + params.backup(); adjustWindowAttributesForCompatibleMode(params); } if (params != null && scalingRequired) { + if (!restore) params.backup(); restore = true; - params.scale(appScale, mWindowLayoutParamsBackup); + params.scale(appScale); } int relayoutResult = sWindowSession.relayout( mWindow, params, @@ -2370,7 +2374,7 @@ public final class ViewRoot extends Handler implements ViewParent, viewVisibility, insetsPending, mWinFrame, mPendingContentInsets, mPendingVisibleInsets, mSurface); if (restore) { - params.restore(mWindowLayoutParamsBackup); + params.restore(); } if (scalingRequired) { float invertedScale = mCompatibilityInfo.mApplicationInvertedScale; @@ -2396,12 +2400,15 @@ public final class ViewRoot extends Handler implements ViewParent, if (attrs.width == ViewGroup.LayoutParams.FILL_PARENT) { attrs.width = metrics.widthPixels; attrs.gravity |= Gravity.CENTER_HORIZONTAL; + mWindowAttributesChanged = attrs == mWindowAttributes; } if (attrs.height == ViewGroup.LayoutParams.FILL_PARENT) { attrs.height = metrics.heightPixels; + attrs.gravity |= Gravity.TOP; + mWindowAttributesChanged = attrs == mWindowAttributes; } if (DEBUG_LAYOUT) { - Log.d(TAG, "Attributes fixed for compatibility : " + attrs); + Log.d(TAG, "Adjusted Attributes for compatibility : " + attrs); } } } |
