์ด๋ฏธ์ง๋ฅผ ๋ ๋ฒ ํญํ๊ณ ์์๋๋ก ์คํฌ๋กคํ๋ฉด ์ด๋ฏธ์ง๊ฐ "๋ค์ง์ด์ง๊ฑฐ๋" 90๋ ํ์ ๋ฉ๋๋ค. ๊ฒฐ๊ณผ๋ ๊ฑฐ๊พธ๋ก ๋ ์ด๋ฏธ์ง์ ๋๋ค. ์ด ๊ณผ์ ์ ๋ฐ๋ณตํ๋ฉด ์๋ ์ํ๋ก ๋์๊ฐ๋๋ค.
๋น๋ถ๊ฐ ์ด ํ ์๊ฐ๋ฝ ์คํฌ๋กค์ ๋นํ์ฑํํ ์ ์๋ ๋ฐฉ๋ฒ์ด ์์ต๋๊น?
๊ทธ๊ฑด ๊ทธ๋ ๊ณ , ์ ๋ Picasso์ ์ ์ฒด ํ๋ฉด ํ๋์์ PhotoView๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
photoView = (PhotoView) findViewById(R.id.fullscreen_content);
String imageUrl = getIntent().getStringExtra(EXTRA_IMAGE);
attacher = new PhotoViewAttacher(photoView);
Picasso.with(this).load(imageUrl).into(photoView, new Callback() {
<strong i="9">@Override</strong>
public void onSuccess() {
attacher.update();
}
<strong i="10">@Override</strong>
public void onError() {
}
});
๋ด๊ฐ ์ด๊ฒ์ ์ฌ๋ฐ๋ฅธ ๋ฐฉ๋ฒ์ผ๋ก ์ฌ์ฉํ๊ณ ์๋์ง ํ์คํ์ง ์์ง๋ง ์ด๋ฒคํธ๋ฅผ ์๋นํด๋ ๋ ๋ฒ ํญ ํ๋/์ถ์๊ฐ ๋นํ์ฑํ๋์ง ์์ต๋๋ค.
photoView.setOnDoubleTapListener(new GestureDetector.OnDoubleTapListener() {
<strong i="14">@Override</strong>
public boolean onSingleTapConfirmed(MotionEvent e) {
return true;
}
<strong i="15">@Override</strong>
public boolean onDoubleTap(MotionEvent e) {
return true;
}
<strong i="16">@Override</strong>
public boolean onDoubleTapEvent(MotionEvent e) {
return true;
}
});
ScaleGestureDetector๊ฐ Nougat์์ ์ด๋ฌํ ํํ์ ํฌ๊ธฐ ์กฐ์ ์ ์ค์ฒ๋ฅผ ์ค๋จํ ๊ฒ ๊ฐ์ต๋๋ค. https://code.google.com/p/android/issues/detail?id=230118 ์์ ๋ฌธ์ ๋ฅผ ๋ณด๊ณ ํ์ต๋๋ค.
ํ ๊ฐ์ง ๊ฐ๋ฅ์ฑ์ Nougat ์ฅ์น์์ ์คํ ์ค์ธ ๊ฒฝ์ฐ FroyoGestureDetector.java
์์ ScaleGestureDetectorCompat.setQuickScaleEnabled(mDetector, false)
๋ฅผ ํธ์ถํ๋ ๊ฒ์
๋๋ค.
๊ฐ์ ๋ฌธ์ ์ ์ง๋ฉดํด ์์ต๋๋ค. ์์ง ๊ณ ์ณ์ง์ง ์์๋์?
์์ ๋์์ต๋๋ค. ์ต์ ๋ฒ์ ์ผ๋ก ์ ๋ฐ์ดํธํ์ญ์์ค.
๋๋ '2.1.3' ๋ฒ์ ์ ์ฌ์ฉํ๊ณ ์์ง๋ง ์ด์ '2.3.0' ์ด ์๋ค๋ ๊ฒ์ ์ ์ ์์ต๋๋ค. ๋ค์ ํ์ธํ๊ฒ ์ต๋๋ค. ๊ฐ์ฌ ํด์
์ด๋ค ๋ฒ์ ์์ ์์ ๋์๋์?
์ฌ๊ธฐ์์ ์์ : https://github.com/chrisbanes/PhotoView/pull/667 ๊ทธ๋์ 2.3.0๋ถํฐ
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
ScaleGestureDetector๊ฐ Nougat์์ ์ด๋ฌํ ํํ์ ํฌ๊ธฐ ์กฐ์ ์ ์ค์ฒ๋ฅผ ์ค๋จํ ๊ฒ ๊ฐ์ต๋๋ค. https://code.google.com/p/android/issues/detail?id=230118 ์์ ๋ฌธ์ ๋ฅผ ๋ณด๊ณ ํ์ต๋๋ค.
ํ ๊ฐ์ง ๊ฐ๋ฅ์ฑ์ Nougat ์ฅ์น์์ ์คํ ์ค์ธ ๊ฒฝ์ฐ
FroyoGestureDetector.java
์์ScaleGestureDetectorCompat.setQuickScaleEnabled(mDetector, false)
๋ฅผ ํธ์ถํ๋ ๊ฒ์ ๋๋ค.