Bug 1071738 - Formatting cleanup in FormAssistPopup.java r=bnicholson

This commit is contained in:
Mark Finkle 2014-09-29 15:07:09 -04:00
Родитель c7159fb7f7
Коммит 79c8be2f01
1 изменённых файлов: 16 добавлений и 11 удалений

Просмотреть файл

@ -34,6 +34,7 @@ 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;
@ -66,8 +67,8 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
private static int sAutoCompleteRowHeight;
private static int sValidationMessageHeight;
private static int sValidationTextMarginTop;
private static RelativeLayout.LayoutParams sValidationTextLayoutNormal;
private static RelativeLayout.LayoutParams sValidationTextLayoutInverted;
private static LayoutParams sValidationTextLayoutNormal;
private static LayoutParams sValidationTextLayoutInverted;
private static final String LOGTAG = "GeckoFormAssistPopup";
@ -216,10 +217,10 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
sValidationTextMarginTop = (int) (mContext.getResources().getDimension(R.dimen.validation_message_margin_top));
sValidationTextLayoutNormal = new RelativeLayout.LayoutParams(mValidationMessageText.getLayoutParams());
sValidationTextLayoutNormal = new LayoutParams(mValidationMessageText.getLayoutParams());
sValidationTextLayoutNormal.setMargins(0, sValidationTextMarginTop, 0, 0);
sValidationTextLayoutInverted = new RelativeLayout.LayoutParams((ViewGroup.MarginLayoutParams) sValidationTextLayoutNormal);
sValidationTextLayoutInverted = new LayoutParams((ViewGroup.MarginLayoutParams) sValidationTextLayoutNormal);
sValidationTextLayoutInverted.setMargins(0, 0, 0, 0);
mValidationMessageArrow = (ImageView) mValidationMessage.findViewById(R.id.validation_message_arrow);
@ -263,14 +264,17 @@ 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())
if (imm.isFullscreenMode()) {
return;
}
// Hide/show the appropriate popup contents
if (mAutoCompleteList != null)
if (mAutoCompleteList != null) {
mAutoCompleteList.setVisibility((mPopupType == PopupType.AUTOCOMPLETE) ? VISIBLE : GONE);
if (mValidationMessage != null)
}
if (mValidationMessage != null) {
mValidationMessage.setVisibility((mPopupType == PopupType.AUTOCOMPLETE) ? GONE : VISIBLE);
}
if (sAutoCompleteMinWidth == 0) {
Resources res = mContext.getResources();
@ -289,7 +293,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
int width = (int) (mW * zoom);
int height = (int) (mH * zoom);
int popupWidth = RelativeLayout.LayoutParams.MATCH_PARENT;
int popupWidth = LayoutParams.MATCH_PARENT;
int popupLeft = left < 0 ? 0 : left;
FloatSize viewport = aMetrics.getSize();
@ -304,13 +308,15 @@ 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 popupHeight;
if (mPopupType == PopupType.AUTOCOMPLETE) {
// Limit the amount of visible rows.
int rows = mAutoCompleteList.getAdapter().getCount();
if (rows > MAX_VISIBLE_ROWS) {
rows = MAX_VISIBLE_ROWS;
@ -354,8 +360,7 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
}
}
RelativeLayout.LayoutParams layoutParams =
new RelativeLayout.LayoutParams(popupWidth, popupHeight);
LayoutParams layoutParams = new LayoutParams(popupWidth, popupHeight);
layoutParams.setMargins(popupLeft, popupTop, 0, 0);
setLayoutParams(layoutParams);
requestLayout();