Cleanup FrameLayoutCompatUtils to ViewLayoutUtils

Bug: 6129704
Change-Id: I52f2e236c7dae3ac2cba64392165f955a53d3f42
main
Tadashi G. Takaoka 2012-04-02 22:55:12 +09:00
parent 01127fad51
commit c8461d1ae2
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());
}
}