diff options
Diffstat (limited to 'srcs/juloo.keyboard2/KeyPreviewPopup.java')
| -rw-r--r-- | srcs/juloo.keyboard2/KeyPreviewPopup.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/srcs/juloo.keyboard2/KeyPreviewPopup.java b/srcs/juloo.keyboard2/KeyPreviewPopup.java new file mode 100644 index 0000000..3eb1505 --- /dev/null +++ b/srcs/juloo.keyboard2/KeyPreviewPopup.java @@ -0,0 +1,38 @@ +package juloo.keyboard2; + +import android.view.Gravity; +import android.view.View; +import android.view.WindowManager; +import android.widget.PopupWindow; +import android.widget.TextView; + +class KeyPreviewPopup extends PopupWindow +{ + private TextView _content; + private View _anchor; + + public KeyPreviewPopup(View anchor) + { + super(anchor.getContext()); + _content = new TextView(anchor.getContext()); + _content.setTextColor(0xFFFFFFFF); + _anchor = anchor; + setWidth(WindowManager.LayoutParams.WRAP_CONTENT); + setHeight(WindowManager.LayoutParams.WRAP_CONTENT); + setContentView(_content); + setTouchable(false); + } + + public void setPreview(String preview) + { + System.out.println("popup preview: " + preview); + if (preview == null) + dismiss(); + else + { + _content.setText(preview); + if (!isShowing()) + showAtLocation(_anchor, Gravity.CENTER_HORIZONTAL | Gravity.TOP, 0, -400); + } + } +} |
