i'm building chathead with closeArea.. CloseArea is bottom of screen, where when you move chathead so chathead disappear. Like facebook messanger have. I have annimation, which show and hide closeArea.
Here is code:
private ImageView chatHead;
private TextView deleteArea;
chatHead = new ImageView(this);
chatHead.setImageResource(R.drawable.ic_launcher);
closeArea = new TextView(this);
closeArea.setText("Close Area");
closeArea.setFocusable(true);
mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
mMainIconLayoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
PixelFormat.TRANSLUCENT);
mMainIconLayoutParams.gravity = Gravity.TOP | Gravity.LEFT;
mMainIconLayoutParams.x = 0;
mMainIconLayoutParams.y = 100;
mWindowManager.addView(chatHead, mMainIconLayoutParams);
mDeleteAreaLayoutParams = new WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
PixelFormat.TRANSLUCENT);
mDeleteAreaLayoutParams.gravity = Gravity.TOP /*| Gravity.LEFT*/;
mDeleteAreaLayoutParams.x = 0;
mDeleteAreaLayoutParams.y = mDisplayHeight-closeArea.getHeight();
mWindowManager.addView(closeArea, mDeleteAreaLayoutParams);
Problem is, that i don't know how to recognise that chathead is in closeArea. Should i use any Listener or anything else?