diff options
author | Brian Attwell <brianattwell@google.com> | 2014-06-30 18:44:04 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-06-26 18:35:29 +0000 |
commit | 8a43e7c99e1084f60bcf64528de96ce808946247 (patch) | |
tree | 384610a0d7c8d144945eec2ac462ff919873f824 /src/com | |
parent | 6c4385d3ee02325f0e69cf8bb74d1c3351e3548c (diff) | |
parent | ac3ed8e48cc474448aa5a7cfed5d6b95073b84f9 (diff) | |
download | packages_apps_Contacts-8a43e7c99e1084f60bcf64528de96ce808946247.tar.gz packages_apps_Contacts-8a43e7c99e1084f60bcf64528de96ce808946247.tar.bz2 packages_apps_Contacts-8a43e7c99e1084f60bcf64528de96ce808946247.zip |
Merge "Don't examine window width in MultiShrinScroller"
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/contacts/quickcontact/QuickContactActivity.java | 40 | ||||
-rw-r--r-- | src/com/android/contacts/widget/MultiShrinkScroller.java | 31 |
2 files changed, 32 insertions, 39 deletions
diff --git a/src/com/android/contacts/quickcontact/QuickContactActivity.java b/src/com/android/contacts/quickcontact/QuickContactActivity.java index 6581e109a..975ec65f2 100644 --- a/src/com/android/contacts/quickcontact/QuickContactActivity.java +++ b/src/com/android/contacts/quickcontact/QuickContactActivity.java @@ -374,17 +374,10 @@ public class QuickContactActivity extends ContactsActivity { ObjectAnimator.ofInt(mWindowScrim, "alpha", 0, 0xFF).setDuration(duration).start(); } - if (mScroller != null) { - mScroller.initialize(mMultiShrinkScrollerListener); - if (mHasAlreadyBeenOpened) { - mScroller.setVisibility(View.VISIBLE); - mScroller.setScroll(mScroller.getScrollNeededToBeFullScreen()); - } else { - // mScroller needs to perform asynchronous measurements after initalize(), therefore - // we can't mark this as GONE. - mScroller.setVisibility(View.INVISIBLE); - } - } + mScroller.initialize(mMultiShrinkScrollerListener); + // mScroller needs to perform asynchronous measurements after initalize(), therefore + // we can't mark this as GONE. + mScroller.setVisibility(View.INVISIBLE); setHeaderNameText(R.string.missing_name); @@ -400,17 +393,24 @@ public class QuickContactActivity extends ContactsActivity { if (savedInstanceState != null) { final int color = savedInstanceState.getInt(KEY_THEME_COLOR, 0); - if (color != 0) { - // Wait for pre draw. Setting the header tint before the MultiShrinkScroller has - // been measured will cause incorrect tinting calculations. - SchedulingUtils.doOnPreDraw(mScroller, /* drawNextFrame = */ true, - new Runnable() { - @Override - public void run() { + SchedulingUtils.doOnPreDraw(mScroller, /* drawNextFrame = */ false, + new Runnable() { + @Override + public void run() { + // Need to wait for the pre draw before setting the initial scroll + // value. Prior to pre draw all scroll values are invalid. + if (mHasAlreadyBeenOpened) { + mScroller.setVisibility(View.VISIBLE); + mScroller.setScroll(mScroller.getScrollNeededToBeFullScreen()); + } + // Need to wait for pre draw for setting the theme color. Setting the + // header tint before the MultiShrinkScroller has been measured will + // cause incorrect tinting calculations. + if (color != 0) { setThemeColor(color); } - }); - } + } + }); } Trace.endSection(); diff --git a/src/com/android/contacts/widget/MultiShrinkScroller.java b/src/com/android/contacts/widget/MultiShrinkScroller.java index 68195da78..67fbf3cc2 100644 --- a/src/com/android/contacts/widget/MultiShrinkScroller.java +++ b/src/com/android/contacts/widget/MultiShrinkScroller.java @@ -9,12 +9,12 @@ import android.animation.Animator.AnimatorListener; import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.content.Context; +import android.content.res.Configuration; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.ColorMatrix; import android.graphics.ColorMatrixColorFilter; -import android.graphics.Point; import android.graphics.Rect; import android.hardware.display.DisplayManagerGlobal; import android.os.Trace; @@ -27,7 +27,6 @@ import android.view.VelocityTracker; import android.view.View; import android.view.ViewGroup; import android.view.ViewConfiguration; -import android.view.WindowManager; import android.view.animation.Interpolator; import android.widget.EdgeEffect; import android.widget.FrameLayout; @@ -233,27 +232,21 @@ public class MultiShrinkScroller extends LinearLayout { }); } - final WindowManager windowManager = (WindowManager) getContext().getSystemService( - Context.WINDOW_SERVICE); - final Point windowSize = new Point(); - windowManager.getDefaultDisplay().getSize(windowSize); - if (!mIsTwoPanel) { - // We never want the height of the photo view to exceed its width. - mMaximumHeaderHeight = windowSize.x; - mIntermediateHeaderHeight = (int) (mMaximumHeaderHeight - * INTERMEDIATE_HEADER_HEIGHT_RATIO); - } - mMaximumPortraitHeaderHeight = Math.min(windowSize.x, windowSize.y); - setHeaderHeight(mIntermediateHeaderHeight); - SchedulingUtils.doOnPreDraw(this, /* drawNextFrame = */ false, new Runnable() { @Override public void run() { + if (!mIsTwoPanel) { + // We never want the height of the photo view to exceed its width. + mMaximumHeaderHeight = getWidth(); + mIntermediateHeaderHeight = (int) (mMaximumHeaderHeight + * INTERMEDIATE_HEADER_HEIGHT_RATIO); + } + final boolean isLandscape = getResources().getConfiguration().orientation + == Configuration.ORIENTATION_LANDSCAPE; + mMaximumPortraitHeaderHeight = isLandscape ? getHeight() : getWidth(); + setHeaderHeight(mIntermediateHeaderHeight); + mMaximumHeaderTextSize = mLargeTextView.getHeight(); - // Unlike Window width, we can't know the usable window height until predraw - // has occured. Therefore, setting these constraints must be done inside - // onPreDraw for the two panel layout. Fortunately, the two panel layout - // doesn't need these values anywhere else inside the activity's creation. if (mIsTwoPanel) { mMaximumHeaderHeight = getHeight(); mMinimumHeaderHeight = mMaximumHeaderHeight; |