Set keyboard visibility change event listener.
This automatically remove registered event listener when the Activity is destroyed

@param activity Activity
@param listener KeyboardVisibilityEventListener
547182
public static void setEventListener(final Activity activity,
                                        final KeyboardVisibilityEventListener listener) {

        final Unregistrar unregistrar = registerEventListener(activity, listener);
        activity.getApplication()
                .registerActivityLifecycleCallbacks(new AutoActivityLifecycleCallback(activity) {
                    @Override
                    protected void onTargetActivityDestroyed() {
                        unregistrar.unregister();
                    }
                });
    }
593223
public void removeEventListener(EventListener listener)
    {
        if(log.isDebugEnabled())log.debug("removeEventListener: "+listener);
        _eventListeners=LazyList.remove(_eventListeners,listener);
    }
558426
public static void hideKeyboard(Activity activity) {
        View view = activity.getWindow().getDecorView();

        if (view != null) {
            hideKeyboard(activity, view);
        }
    }
1355859
@Override
  public void onVisibilityChange(boolean isVisible) {
    if (mIsVisible == isVisible) {
      return;
    }
    mEventTracker.recordEvent(isVisible ? Event.ON_DRAWABLE_SHOW : Event.ON_DRAWABLE_HIDE);
    mIsVisible = isVisible;
    attachOrDetachController();
  }
446575
@Override
    void setVisibility(boolean visibility) {
        if (isVisible && !visibility) {
            // make the X cursor invisible
            xLib.XDefineCursor(xdisplay, xwindow, transparentCursor);
            MonocleWindowManager.getInstance().repaintAll();
        } else if (!isVisible && visibility) {
            // make the cursor visible
            xLib.XUndefineCursor(xdisplay, xwindow);
            MonocleWindowManager.getInstance().repaintAll();
        }
        isVisible = visibility;
    }
1281199
public void addPostSelectionChangedListener(
			ISelectionChangedListener listener)
	{
		if (fOutlineViewer != null)
		{
			fOutlineViewer.addPostSelectionChangedListener(listener);
		} else
		{
			fPostSelectionChangedListeners.add(listener);
		}
	}
577775
public void removeListener(RunListener listener) {
        if (listener == null) {
            throw new NullPointerException("Cannot remove a null listener");
        }
        listeners.remove(wrapIfNotThreadSafe(listener));
    }
875721
public T imeAction(TextView.OnEditorActionListener listener) {
        if (view instanceof EditText) {
            ((EditText)view).setOnEditorActionListener(listener);
        }
        return self();
    }
1020672
public void removeUserEventListener(UserEventListener listener)
   {
      SecurityHelper.validateSecurityPermission(PermissionConstants.MANAGE_LISTENERS);
      listeners.remove(listener);
   }
947917
public boolean filterSetVisibility(final int visibility) {
        if (visibility == View.VISIBLE) {
            this.mIsHide = false;
        }

        if (visibility == panelLayout.getVisibility()) {
            return true;
        }

        /**
         * For handling Keyboard->Panel.
         *
         * Will be handled on {@link KPSwitchRootLayoutHandler#handleBeforeMeasure(int, int)} ->
         * {@link IPanelConflictLayout#handleShow()} Delay show, until the
         * {@link KPSwitchRootLayoutHandler} discover
         * the size is changed by keyboard-show. And will show, on the next frame of the above
         * change discovery.
         */
        //noinspection RedundantIfStatement
        if (isKeyboardShowing() && visibility == View.VISIBLE) {
            return true;
        }

        return false;
    }
1355843
@Override
    final public void removeConnectionEventListener(
                                                    final ConnectionEventListener listener) {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "removeConnectionEventListener", listener);
        }

        synchronized (_connectionListeners) {
            _connectionListeners.remove(listener);
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "removeConnectionEventListener");
        }

    }
882691
@Override
  public void setVisible( boolean bVisible )
  {
    super.setVisible( bVisible );

    if( bVisible )
    {
      registerListeners();
    }
    else
    {
      unregisterListeners();
      _editor.getEditor().requestFocus();
    }
  }
705094
public synchronized void removeEventListener(EventListener listener)
    {
        if (_sessionManager != null)
            _sessionManager.removeEventListener(listener);

        _sessionListeners= LazyList.remove(_sessionListeners, listener);
        _requestListeners= LazyList.remove(_requestListeners, listener);
        _requestAttributeListeners= LazyList.remove(_requestAttributeListeners, listener);
        _contextAttributeListeners= LazyList.remove(_contextAttributeListeners, listener);
        super.removeEventListener(listener);
    }
1273310
public static void hideKeyboard(Context context, View target) {
        if (context == null || target == null) {
            return;
        }

        InputMethodManager imm = getInputMethodManager(context);
        imm.hideSoftInputFromWindow(target.getWindowToken(), 0);
    }
1235997
public void removeListener(ChangeListener listener) {
        synchronized (hsChangeListeners) {
            hsChangeListeners.remove(listener);
            changeListenerCount = hsChangeListeners.size();
            bUpdateChangeListener = true;
        }
    }
980918
public synchronized void removeEventListener(EventListener listener)
    {
        _contextListeners= LazyList.remove(_contextListeners, listener);
        super.removeEventListener(listener);
    }
756905
public synchronized boolean removeChangeListener(ChangeListener listener) {
        if (bEnableListener && listener != null) {
            eventSource.removeListener(listener);
            return true;
        }
        return false;
    }