Чем я могу заменить ViewTreeObserver.OnComputeInternalInsetsListener, который объявлен как скрытый?

Я пытаюсь импортировать в мою библиотеку некоторый внутренний исходный код Android. Однако у меня есть некоторые проблемы, чтобы импортировать эту часть кода:

    private final ViewTreeObserver.OnComputeInternalInsetsListener mInsetsComputer =
            new ViewTreeObserver.OnComputeInternalInsetsListener() {
                public void onComputeInternalInsets(
                        ViewTreeObserver.InternalInsetsInfo info) {
                    info.contentInsets.setEmpty();
                    info.visibleInsets.setEmpty();
                    info.touchableRegion.set(mTouchableRegion);
                    info.setTouchableInsets(ViewTreeObserver.InternalInsetsInfo
                            .TOUCHABLE_INSETS_REGION);
                }
            };

это потому, что в ViewTreeObserver.java OnComputeInternalInsetsListener объявлен как скрытый

/**
 * Interface definition for a callback to be invoked when layout has
 * completed and the client can compute its interior insets.
 * 
 * We are not yet ready to commit to this API and support it, so
 * @hide
 */
public interface OnComputeInternalInsetsListener {
    /**
     * Callback method to be invoked when layout has completed and the
     * client can compute its interior insets.
     *
     * @param inoutInfo Should be filled in by the implementation with
     * the information about the insets of the window.  This is called
     * with whatever values the previous OnComputeInternalInsetsListener
     * returned, if there are multiple such listeners in the window.
     */
    public void onComputeInternalInsets(InternalInsetsInfo inoutInfo);
} 

позже я использую это так

    /**
     * Make the touchable area of this popup be the area specified by mTouchableRegion.
     * This should be called after the popup window has been dismissed (dismiss/hide)
     * and is probably being re-shown with a new content root view.
     */
    private void setTouchableSurfaceInsetsComputer() {

        ViewTreeObserver viewTreeObserver = mPopupWindow.getContentView()
                .getRootView()
                .getViewTreeObserver();
        viewTreeObserver.removeOnComputeInternalInsetsListener(mInsetsComputer);
        viewTreeObserver.addOnComputeInternalInsetsListener(mInsetsComputer);

    }

так чем я могу заменить ViewTreeObserver.OnComputeInternalInsetsListener, removeOnComputeInternalInsetsListener а также addOnComputeInternalInsetsListener? я даже не знаю назначение этих функций...

0 ответов

Другие вопросы по тегам