blob: 3eb1505c2a65989827400e4fa2c96bb6bd7128c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);
}
}
}
|