PhotoViewAttacher
' 会boolean onFling(MotionEvent, MotionEvent, float, float)
阻止调用 myOnSingleFlingListener
的onFling
方法,除非当前比例是最小值。
我OnSingleFlingListener
从com.github.chrisbanes.photoview
. 但是,由于该onFling
方法仅对包可见,因此首先调用PhotoViewAttacher
' 的方法。防止我的方法在. 我需要我的,除非。(当我的图像宽度与窗口宽度匹配时。)我该如何解决这个问题?我需要自己制作整个包的副本并修改为公开吗?onFling
PhotoViewAttacher.onFling
onFling
scale > DEFAULT_MIN_SCALE
scale > getMediumScale()
scale == getMediumScale()
PhotoView
OnSingleFlingListener.onFling
我的代码:
public class BasicViewActivity extends AppCompatActivity implements DownloadCallback, OnSingleFlingListener {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
. . .
return true;
}
OnSingleFlingListener:
package com.github.chrisbanes.photoview;
public interface OnSingleFlingListener {
boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY);
}
PhotoViewAttacher:
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
if (mSingleFlingListener != null) {
if (getScale() > DEFAULT_MIN_SCALE) {
return false;
}
. . .
return mSingleFlingListener.onFling(e1, e2, velocityX, velocityY);
}
return false;
}
我想要我的onFling
被叫时getScale() <= getMediumScale()
。相反,我的onFling
方法仅在getScale() == DEFAULT_MIN_SCALE
.