lmw
2024-05-27 c00669a852702e1aa1326872bb916f9a079b57e2
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package cn.sinata.xldutils.view;
 
import android.graphics.Matrix;
import android.graphics.RectF;
import android.view.MotionEvent;
 
public interface ZoomableController {
 
  /**
   * Listener interface.
   */
  public interface Listener {
 
    /**
     * Notifies the view that the transform changed.
     *
     * @param transform the new matrix
     */
    void onTransformChanged(Matrix transform);
  }
 
  /**
   * Enables the controller. The controller is enabled when the image has been loaded.
   *
   * @param enabled whether to enable the controller
   */
  void setEnabled(boolean enabled);
 
  /**
   * Gets whether the controller is enabled. This should return the last value passed to
   * {@link #setEnabled}.
   *
   * @return whether the controller is enabled.
   */
  boolean isEnabled();
 
  /**
   * Sets the listener for the controller to call back when the matrix changes.
   *
   * @param listener the listener
   */
  void setListener(Listener listener);
 
  /**
   * Gets the current scale factor. A convenience method for calculating the scale from the
   * transform.
   *
   * @return the current scale factor
   */
  float getScaleFactor();
 
  /**
   * Gets the current transform.
   *
   * @return the transform
   */
  Matrix getTransform();
 
  /**
   * Sets the bounds of the image post transform prior to application of the zoomable
   * transformation.
   *
   * @param imageBounds the bounds of the image
   */
  void setImageBounds(RectF imageBounds);
 
  /**
   * Sets the bounds of the view.
   *
   * @param viewBounds the bounds of the view
   */
  void setViewBounds(RectF viewBounds);
 
  /**
   * Allows the controller to handle a touch event.
   *
   * @param event the touch event
   * @return whether the controller handled the event
   */
  boolean onTouchEvent(MotionEvent event);
}