am 57007ed5: Merge "Workaround return preserved backing view height when the backing view is not ready" into jb-dev

* commit '57007ed582fbe89b2f2ac24e06a15a4fb5a948df':
  Workaround return preserved backing view height when the backing view is not ready
main
satok 2012-05-02 01:44:30 -07:00 committed by Android Git Automerger
commit 34590d6cd1
1 changed files with 17 additions and 2 deletions

View File

@ -93,6 +93,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
private static final int QUICK_PRESS = 200;
private static final int PENDING_IMS_CALLBACK_DURATION = 800;
// TODO: remove this
private static final boolean WORKAROUND_USE_LAST_BACKING_HEIGHT_WHEN_NOT_READY = true;
private static int sLastBackingHeight = 0;
/**
* The name of the scheme used by the Package Manager to warn of a new package installation,
@ -933,8 +936,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
// be considered.
// See {@link android.inputmethodservice.InputMethodService#onComputeInsets}.
final int extractHeight = isFullscreenMode() ? mExtractArea.getHeight() : 0;
final int backingHeight = (mKeyPreviewBackingView.getVisibility() == View.GONE) ? 0
: mKeyPreviewBackingView.getHeight();
final boolean backingGone = mKeyPreviewBackingView.getVisibility() == View.GONE;
int backingHeight = backingGone ? 0 : mKeyPreviewBackingView.getHeight();
if (WORKAROUND_USE_LAST_BACKING_HEIGHT_WHEN_NOT_READY && !backingGone) {
if (backingHeight <= 0) {
backingHeight = sLastBackingHeight;
} else {
sLastBackingHeight = backingHeight;
}
}
final int suggestionsHeight = (mSuggestionsContainer.getVisibility() == View.GONE) ? 0
: mSuggestionsContainer.getHeight();
final int extraHeight = extractHeight + backingHeight + suggestionsHeight;
@ -954,6 +964,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
}
outInsets.contentTopInsets = touchY;
outInsets.visibleTopInsets = touchY;
if (WORKAROUND_USE_LAST_BACKING_HEIGHT_WHEN_NOT_REQADY) {
if (LatinImeLogger.sDBG) {
Log.i(TAG, "--- insets: " + touchY + "," + backingHeight + "," + suggestionsHeight);
}
}
}
@Override