Merge "Cleanup FrameLayoutCompatUtils to ViewLayoutUtils"

This commit is contained in:
Tadashi G. Takaoka 2012-04-03 00:47:32 -07:00 committed by Android (Google) Code Review
commit 7a0779a441
3 changed files with 8 additions and 20 deletions

View file

@ -37,7 +37,6 @@ import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.inputmethod.compat.FrameLayoutCompatUtils;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
@ -853,7 +852,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
windowContentView.addView(mPreviewPlacer);
}
mPreviewPlacer.addView(
keyPreview, FrameLayoutCompatUtils.newLayoutParam(mPreviewPlacer, 0, 0));
keyPreview, ViewLayoutUtils.newLayoutParam(mPreviewPlacer, 0, 0));
}
private void showKey(PointerTracker tracker) {
@ -919,7 +918,7 @@ public class KeyboardView extends View implements PointerTracker.DrawingProxy {
previewText.getBackground().setState(
key.mMoreKeys != null ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
previewText.setTextColor(params.mPreviewTextColor);
FrameLayoutCompatUtils.placeViewAt(
ViewLayoutUtils.placeViewAt(
previewText, previewX, previewY, previewWidth, previewHeight);
previewText.setVisibility(VISIBLE);
}

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.android.inputmethod.compat;
package com.android.inputmethod.keyboard;
import android.view.View;
import android.view.ViewGroup;
@ -22,20 +22,9 @@ import android.view.ViewGroup.MarginLayoutParams;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
public class FrameLayoutCompatUtils {
private static final boolean NEEDS_FRAME_LAYOUT_HACK = (
android.os.Build.VERSION.SDK_INT < 11 /* Honeycomb */);
public static ViewGroup getPlacer(ViewGroup container) {
if (NEEDS_FRAME_LAYOUT_HACK) {
// Insert RelativeLayout to be able to setMargin because pre-Honeycomb FrameLayout
// could not handle setMargin properly.
final ViewGroup placer = new RelativeLayout(container.getContext());
container.addView(placer);
return placer;
} else {
return container;
}
public class ViewLayoutUtils {
private ViewLayoutUtils() {
// This utility class is not publicly instantiable.
}
public static MarginLayoutParams newLayoutParam(ViewGroup placer, int width, int height) {

View file

@ -52,11 +52,11 @@ import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.android.inputmethod.compat.FrameLayoutCompatUtils;
import com.android.inputmethod.keyboard.KeyboardActionListener;
import com.android.inputmethod.keyboard.KeyboardView;
import com.android.inputmethod.keyboard.MoreKeysPanel;
import com.android.inputmethod.keyboard.PointerTracker;
import com.android.inputmethod.keyboard.ViewLayoutUtils;
import com.android.inputmethod.latin.LatinImeLogger;
import com.android.inputmethod.latin.R;
import com.android.inputmethod.latin.StaticInnerHandlerWrapper;
@ -416,7 +416,7 @@ public class SuggestionsView extends RelativeLayout implements OnClickListener,
ViewGroup.LayoutParams.WRAP_CONTENT);
final int infoWidth = info.getMeasuredWidth();
final int y = info.getMeasuredHeight();
FrameLayoutCompatUtils.placeViewAt(
ViewLayoutUtils.placeViewAt(
info, x - infoWidth, y, infoWidth, info.getMeasuredHeight());
}
}