PositionObserver.java revision 5f1c94371a64b3196d4be9466099bb892df9b88e
1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package org.chromium.content.browser;
6
7/**
8 * Used to register listeners that can be notified of changes to the position of a view.
9 */
10public interface PositionObserver {
11    public interface Listener {
12        /**
13         * Called during predraw if the position of the underlying view has changed.
14         */
15        void onPositionChanged(int positionX, int positionY);
16    }
17
18    /**
19     * @return The current x position of the observed view.
20     */
21    int getPositionX();
22
23    /**
24     * @return The current y position of the observed view.
25     */
26    int getPositionY();
27
28    /**
29     * Register a listener to be called when the position of the underlying view changes.
30     */
31    void addListener(Listener listener);
32
33    /**
34     * Remove a previously installed listener.
35     */
36    void removeListener(Listener listener);
37
38    /**
39     * Clears registerned listener(s).
40     */
41    void clearListener();
42}
43