diff options
| author | Jin Cao <jinyan@google.com> | 2014-10-13 21:04:46 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-13 21:04:46 +0000 |
| commit | 19cc5d6a2a1fa0f95e4113ee2ff3443996989b6d (patch) | |
| tree | 1165397628570a89f77646097b2e595533ea171f | |
| parent | 73d3824ef4534438ff889a77f11bde9c56420857 (diff) | |
| parent | f6ddb7541feb5e415f9750fb403814dbbc9068be (diff) | |
| download | android_frameworks_opt_chips-19cc5d6a2a1fa0f95e4113ee2ff3443996989b6d.tar.gz android_frameworks_opt_chips-19cc5d6a2a1fa0f95e4113ee2ff3443996989b6d.tar.bz2 android_frameworks_opt_chips-19cc5d6a2a1fa0f95e4113ee2ff3443996989b6d.zip | |
am f6ddb754: Don\'t rely on action bar height
* commit 'f6ddb7541feb5e415f9750fb403814dbbc9068be':
Don't rely on action bar height
| -rw-r--r-- | src/com/android/ex/chips/RecipientEditTextView.java | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/com/android/ex/chips/RecipientEditTextView.java b/src/com/android/ex/chips/RecipientEditTextView.java index fed819e..a9df27f 100644 --- a/src/com/android/ex/chips/RecipientEditTextView.java +++ b/src/com/android/ex/chips/RecipientEditTextView.java @@ -17,7 +17,6 @@ package com.android.ex.chips; -import android.app.Activity; import android.app.Dialog; import android.content.ClipData; import android.content.ClipDescription; @@ -63,7 +62,6 @@ import android.text.util.Rfc822Token; import android.text.util.Rfc822Tokenizer; import android.util.AttributeSet; import android.util.Log; -import android.util.TypedValue; import android.view.ActionMode; import android.view.ActionMode.Callback; import android.view.DragEvent; @@ -141,7 +139,6 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements private static final int MAX_CHIPS_PARSED = 50; private static int sSelectedTextColor = -1; - private static int sVisibleDisplayFrameTop = -1; // Work variables to avoid re-allocation on every typed character. private final Rect mRect = new Rect(); @@ -496,24 +493,6 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements } } - // sVisibleDisplayFrameTop is computed on a on-demand basis because the view needs to be fully - // measured and created in order to calculate the visible display frame. - private int getVisibleDisplayFrameTop() { - if (sVisibleDisplayFrameTop == -1) { - final TypedValue tv = new TypedValue(); - final Context context = getContext(); - // Visible top is our visible display (due to status bar) plus the height of action bar. - if (context.getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) { - sVisibleDisplayFrameTop = TypedValue.complexToDimensionPixelSize(tv.data, - getResources().getDisplayMetrics()); - } - // Compute the status bar height, or rather where our visible display starts - getWindowVisibleDisplayFrame(mRect); - sVisibleDisplayFrameTop += mRect.top; - } - return sVisibleDisplayFrameTop; - } - @Override public <T extends ListAdapter & Filterable> void setAdapter(T adapter) { super.setAdapter(adapter); @@ -567,7 +546,8 @@ public class RecipientEditTextView extends MultiAutoCompleteTextView implements // content. final int height = getHeight(); final int currentPos = mCoords[1] + height; - final int desiredPos = getVisibleDisplayFrameTop() + height / getLineCount(); + mScrollView.getLocationInWindow(mCoords); + final int desiredPos = mCoords[1] + height / getLineCount(); if (currentPos > desiredPos) { mScrollView.scrollBy(0, currentPos - desiredPos); } |
