diff options
| author | jaguillo | 2015-10-28 00:39:20 +0100 |
|---|---|---|
| committer | jaguillo | 2015-10-28 00:39:20 +0100 |
| commit | 804e9a7adcc58d81327873ba787c2230eeee350b (patch) | |
| tree | 5edc844ba40b4f3c022b08f89cbd32fb0238661f /srcs/juloo.keyboard2/KeyPreviewPopup.java | |
| parent | 8716801261b2f1f494b97fb33d17520bba97340d (diff) | |
| download | unexpected-keyboard-804e9a7adcc58d81327873ba787c2230eeee350b.tar.gz unexpected-keyboard-804e9a7adcc58d81327873ba787c2230eeee350b.zip | |
Fix some bugs + Try to show a preview popup
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); + } + } +} |
