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

This commit is contained in:
Mark Finkle 2014-09-29 15:07:09 -04:00
parent e26df52232
commit 5eeddf01a2

View File

@ -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,8 +264,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())
if (imm.isFullscreenMode()) {
return;
}
// Hide/show the appropriate popup contents
if (mAutoCompleteList != null)
@ -289,7 +291,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,8 +306,9 @@ 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);
}
}
}
@ -315,10 +318,11 @@ public class FormAssistPopup extends RelativeLayout implements GeckoEventListene
}
int popupHeight;
if (mPopupType == PopupType.AUTOCOMPLETE)
if (mPopupType == PopupType.AUTOCOMPLETE) {
popupHeight = sAutoCompleteRowHeight * rows;
else
} else {
popupHeight = sValidationMessageHeight;
}
int popupTop = top + height;
@ -353,8 +357,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();