am 8cf3654a: Merge "Use calculated backing view height instead of the view\'s height" into jb-dev
* commit '8cf3654a937677237d4bdb49a48f3c72e94e73b8': Use calculated backing view height instead of the view's heightmain
commit
e2832daf4c
|
@ -96,9 +96,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
private static final int QUICK_PRESS = 200;
|
private static final int QUICK_PRESS = 200;
|
||||||
|
|
||||||
private static final int PENDING_IMS_CALLBACK_DURATION = 800;
|
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,
|
* The name of the scheme used by the Package Manager to warn of a new package installation,
|
||||||
|
@ -941,13 +938,16 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
setSuggestionStripShownInternal(shown, /* needsInputViewShown */true);
|
setSuggestionStripShownInternal(shown, /* needsInputViewShown */true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void adjustInputViewHeight() {
|
private int getAdjustedBackingViewHeight() {
|
||||||
if (mKeyPreviewBackingView.getHeight() > 0) {
|
final int currentHeight = mKeyPreviewBackingView.getHeight();
|
||||||
return;
|
if (currentHeight > 0) {
|
||||||
|
return currentHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
final KeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView keyboardView = mKeyboardSwitcher.getKeyboardView();
|
||||||
if (keyboardView == null) return;
|
if (keyboardView == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
final int keyboardHeight = keyboardView.getHeight();
|
final int keyboardHeight = keyboardView.getHeight();
|
||||||
final int suggestionsHeight = mSuggestionsContainer.getHeight();
|
final int suggestionsHeight = mSuggestionsContainer.getHeight();
|
||||||
final int displayHeight = mResources.getDisplayMetrics().heightPixels;
|
final int displayHeight = mResources.getDisplayMetrics().heightPixels;
|
||||||
|
@ -960,6 +960,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final LayoutParams params = mKeyPreviewBackingView.getLayoutParams();
|
final LayoutParams params = mKeyPreviewBackingView.getLayoutParams();
|
||||||
params.height = mSuggestionsView.setMoreSuggestionsHeight(remainingHeight);
|
params.height = mSuggestionsView.setMoreSuggestionsHeight(remainingHeight);
|
||||||
mKeyPreviewBackingView.setLayoutParams(params);
|
mKeyPreviewBackingView.setLayoutParams(params);
|
||||||
|
return params.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -968,20 +969,11 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
final KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
final KeyboardView inputView = mKeyboardSwitcher.getKeyboardView();
|
||||||
if (inputView == null || mSuggestionsContainer == null)
|
if (inputView == null || mSuggestionsContainer == null)
|
||||||
return;
|
return;
|
||||||
adjustInputViewHeight();
|
final int backingHeight = getAdjustedBackingViewHeight();
|
||||||
// In fullscreen mode, the height of the extract area managed by InputMethodService should
|
// In fullscreen mode, the height of the extract area managed by InputMethodService should
|
||||||
// be considered.
|
// be considered.
|
||||||
// See {@link android.inputmethodservice.InputMethodService#onComputeInsets}.
|
// See {@link android.inputmethodservice.InputMethodService#onComputeInsets}.
|
||||||
final int extractHeight = isFullscreenMode() ? mExtractArea.getHeight() : 0;
|
final int extractHeight = isFullscreenMode() ? mExtractArea.getHeight() : 0;
|
||||||
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
|
final int suggestionsHeight = (mSuggestionsContainer.getVisibility() == View.GONE) ? 0
|
||||||
: mSuggestionsContainer.getHeight();
|
: mSuggestionsContainer.getHeight();
|
||||||
final int extraHeight = extractHeight + backingHeight + suggestionsHeight;
|
final int extraHeight = extractHeight + backingHeight + suggestionsHeight;
|
||||||
|
@ -1001,11 +993,6 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
}
|
}
|
||||||
outInsets.contentTopInsets = touchY;
|
outInsets.contentTopInsets = touchY;
|
||||||
outInsets.visibleTopInsets = touchY;
|
outInsets.visibleTopInsets = touchY;
|
||||||
if (WORKAROUND_USE_LAST_BACKING_HEIGHT_WHEN_NOT_READY) {
|
|
||||||
if (LatinImeLogger.sDBG) {
|
|
||||||
Log.i(TAG, "--- insets: " + touchY + "," + backingHeight + "," + suggestionsHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue