BigImageViewer
BigImageViewer copied to clipboard
getSSIV().resetScaleAndCenter() does not work
Hello! I need the picture to be scaled (fit) when the screen rotates. In SSIV it worked:
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if(oldh != 0 && oldw != 0){
resetScaleAndCenter();
}
}
But, if I override onSizeChanged for BIV, it does not work:
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if(oldh != 0 && oldw != 0){
getSSIV().resetScaleAndCenter();
}
}
How can I fix it?
You mean onSizeChanged not called?
onSizeChanged is called (Log.d(...) inside the onSizeChanged prints a log). But getSSIV().resetScaleAndCenter() not called. I asked the initial question here. I override onSizeChanged for SubsamplingScaleImageView, and the picture began to fit into the screen when the screen was rotated. It work:
public class MyImageView extends SubsamplingScaleImageView {
...
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if(oldh != 0 && oldw != 0){
resetScaleAndCenter();
}
}
}
Then I switched to using BigImageViewer. And a similar code did not work:
public class MyImageView extends BigImageView {
...
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
if(oldh != 0 && oldw != 0){
getSSIV().resetScaleAndCenter();
}
}
}
getSSIV().resetScaleAndCenter() not called. I need to enter the picture in the screen size when turning the screen.
What do you mean by "getSSIV().resetScaleAndCenter() not called"? oldh != 0 && oldw != 0 always be false?
Now, if I turn the screen, the image will go beyond it (I use BIV in Fragment):
I want the image to be placed in it when turning the screen:
For this, I override onSizeChanged so that when the screen was rotated, the scale and center were reset. But it does not work. It works for the original SSIV, but does not work for BIV. The problem is not oldh != 0 && oldw != 0. I can write like this:
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
getSSIV().resetScaleAndCenter();
}
But I still get this result:
I conclude that the reset (getSSIV().resetScaleAndCenter()) does not work.
I see.
Could you please clone this project, and debug it under your use case?
Any update? @scifinder
I just used original SSIV =(