remove concept of zoom steps from API
This commit is contained in:
parent
0f05f9e1f4
commit
69a6219634
@ -15,8 +15,8 @@ class GestureHelper {
|
||||
public interface GestureListener {
|
||||
boolean onTapUp();
|
||||
// Can be replaced with ratio when supported
|
||||
void onZoomIn(int steps);
|
||||
void onZoomOut(int steps);
|
||||
void onZoomIn(float value);
|
||||
void onZoomOut(float value);
|
||||
void onZoomEnd();
|
||||
}
|
||||
|
||||
@ -52,9 +52,9 @@ class GestureHelper {
|
||||
if (curNbStep != prevNbStep) {
|
||||
int stepDiff = curNbStep - prevNbStep;
|
||||
if (stepDiff > 0) {
|
||||
listener.onZoomOut(stepDiff);
|
||||
listener.onZoomOut(stepDiff * 0.25f);
|
||||
} else {
|
||||
listener.onZoomIn(Math.abs(stepDiff));
|
||||
listener.onZoomIn(Math.abs(stepDiff * 0.25f));
|
||||
}
|
||||
prevNbStep = curNbStep;
|
||||
}
|
||||
|
@ -253,13 +253,13 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onZoomIn(int steps) {
|
||||
zoomIn(steps);
|
||||
public void onZoomIn(float value) {
|
||||
zoomIn(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onZoomOut(int steps) {
|
||||
zoomOut(steps);
|
||||
public void onZoomOut(float value) {
|
||||
zoomOut(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -349,17 +349,17 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
|
||||
startActivityForResult(intent, ACTION_OPEN_DOCUMENT_REQUEST_CODE);
|
||||
}
|
||||
|
||||
private void zoomIn(int steps) {
|
||||
private void zoomIn(float value) {
|
||||
if (mZoomRatio < MAX_ZOOM_RATIO) {
|
||||
mZoomRatio += 0.25f * steps;
|
||||
mZoomRatio += value;
|
||||
renderPage(true);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
}
|
||||
|
||||
private void zoomOut(int steps) {
|
||||
private void zoomOut(float value) {
|
||||
if (mZoomRatio > MIN_ZOOM_RATIO) {
|
||||
mZoomRatio -= 0.25f * steps;
|
||||
mZoomRatio -= value;
|
||||
renderPage(true);
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
@ -503,11 +503,11 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
|
||||
return super.onOptionsItemSelected(item);
|
||||
|
||||
case R.id.action_zoom_out:
|
||||
zoomOut(1);
|
||||
zoomOut(0.25f);
|
||||
return true;
|
||||
|
||||
case R.id.action_zoom_in:
|
||||
zoomIn(1);
|
||||
zoomIn(0.25f);
|
||||
return true;
|
||||
|
||||
case R.id.action_rotate_clockwise:
|
||||
|
Loading…
Reference in New Issue
Block a user