зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changesets ba4b4066c0fe and 1372b8919331 (bug 1071738) for Android crashes.
CLOSED TREE
This commit is contained in:
Родитель
3acbbbf2f6
Коммит
82dd1e7c7e
|
@ -34,7 +34,6 @@ import android.widget.ArrayAdapter;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.RelativeLayout.LayoutParams;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
@ -61,14 +60,12 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
|||
}
|
||||
private PopupType mPopupType;
|
||||
|
||||
private static final int MAX_VISIBLE_ROWS = 5;
|
||||
|
||||
private static int sAutoCompleteMinWidth;
|
||||
private static int sAutoCompleteRowHeight;
|
||||
private static int sValidationMessageHeight;
|
||||
private static int sValidationTextMarginTop;
|
||||
private static LayoutParams sValidationTextLayoutNormal;
|
||||
private static LayoutParams sValidationTextLayoutInverted;
|
||||
private static RelativeLayout.LayoutParams sValidationTextLayoutNormal;
|
||||
private static RelativeLayout.LayoutParams sValidationTextLayoutInverted;
|
||||
|
||||
private static final String LOGTAG = "GeckoFormAssistPopup";
|
||||
|
||||
|
@ -217,10 +214,10 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
|||
|
||||
sValidationTextMarginTop = (int) (mContext.getResources().getDimension(R.dimen.validation_message_margin_top));
|
||||
|
||||
sValidationTextLayoutNormal = new LayoutParams(mValidationMessageText.getLayoutParams());
|
||||
sValidationTextLayoutNormal = new RelativeLayout.LayoutParams(mValidationMessageText.getLayoutParams());
|
||||
sValidationTextLayoutNormal.setMargins(0, sValidationTextMarginTop, 0, 0);
|
||||
|
||||
sValidationTextLayoutInverted = new LayoutParams((ViewGroup.MarginLayoutParams) sValidationTextLayoutNormal);
|
||||
sValidationTextLayoutInverted = new RelativeLayout.LayoutParams((ViewGroup.MarginLayoutParams) sValidationTextLayoutNormal);
|
||||
sValidationTextLayoutInverted.setMargins(0, 0, 0, 0);
|
||||
|
||||
mValidationMessageArrow = (ImageView) mValidationMessage.findViewById(R.id.validation_message_arrow);
|
||||
|
@ -263,10 +260,9 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
|||
|
||||
// Don't show the form assist popup when using fullscreen VKB
|
||||
InputMethodManager imm =
|
||||
(InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm.isFullscreenMode()) {
|
||||
(InputMethodManager) GeckoAppShell.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
if (imm.isFullscreenMode())
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide/show the appropriate popup contents
|
||||
if (mAutoCompleteList != null)
|
||||
|
@ -291,7 +287,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
|||
int width = (int) (mW * zoom);
|
||||
int height = (int) (mH * zoom);
|
||||
|
||||
int popupWidth = LayoutParams.MATCH_PARENT;
|
||||
int popupWidth = RelativeLayout.LayoutParams.MATCH_PARENT;
|
||||
int popupLeft = left < 0 ? 0 : left;
|
||||
|
||||
FloatSize viewport = aMetrics.getSize();
|
||||
|
@ -306,23 +302,16 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
|||
popupWidth = sAutoCompleteMinWidth;
|
||||
|
||||
// Move the popup to the left if there isn't enough room for it.
|
||||
if ((popupLeft + popupWidth) > viewport.width) {
|
||||
if ((popupLeft + popupWidth) > viewport.width)
|
||||
popupLeft = (int) (viewport.width - popupWidth);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int rows = mAutoCompleteList.getAdapter().getCount();
|
||||
if (rows > MAX_VISIBLE_ROWS) {
|
||||
rows = MAX_VISIBLE_ROWS;
|
||||
}
|
||||
|
||||
int popupHeight;
|
||||
if (mPopupType == PopupType.AUTOCOMPLETE) {
|
||||
popupHeight = sAutoCompleteRowHeight * rows;
|
||||
} else {
|
||||
if (mPopupType == PopupType.AUTOCOMPLETE)
|
||||
popupHeight = sAutoCompleteRowHeight * mAutoCompleteList.getAdapter().getCount();
|
||||
else
|
||||
popupHeight = sValidationMessageHeight;
|
||||
}
|
||||
|
||||
int popupTop = top + height;
|
||||
|
||||
|
@ -357,7 +346,8 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
|
|||
}
|
||||
}
|
||||
|
||||
LayoutParams layoutParams = new LayoutParams(popupWidth, popupHeight);
|
||||
RelativeLayout.LayoutParams layoutParams =
|
||||
new RelativeLayout.LayoutParams(popupWidth, popupHeight);
|
||||
layoutParams.setMargins(popupLeft, popupTop, 0, 0);
|
||||
setLayoutParams(layoutParams);
|
||||
requestLayout();
|
||||
|
|
Загрузка…
Ссылка в новой задаче