avoid multiple renders per zoom
This commit is contained in:
parent
371cb3efdc
commit
760d6f1186
@ -254,16 +254,12 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onZoomIn(int steps) {
|
public void onZoomIn(int steps) {
|
||||||
for (int i = 0; i < steps; i++) {
|
zoomIn(steps);
|
||||||
zoomIn();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onZoomOut(int steps) {
|
public void onZoomOut(int steps) {
|
||||||
for (int i = 0; i < steps; i++) {
|
zoomOut(steps);
|
||||||
zoomOut();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -348,17 +344,17 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
|
|||||||
startActivityForResult(intent, ACTION_OPEN_DOCUMENT_REQUEST_CODE);
|
startActivityForResult(intent, ACTION_OPEN_DOCUMENT_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void zoomIn() {
|
private void zoomIn(int steps) {
|
||||||
if (mZoomRatio < MAX_ZOOM_RATIO) {
|
if (mZoomRatio < MAX_ZOOM_RATIO) {
|
||||||
mZoomRatio += 0.25f;
|
mZoomRatio += 0.25f * steps;
|
||||||
renderPage(true);
|
renderPage(true);
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void zoomOut() {
|
private void zoomOut(int steps) {
|
||||||
if (mZoomRatio > MIN_ZOOM_RATIO) {
|
if (mZoomRatio > MIN_ZOOM_RATIO) {
|
||||||
mZoomRatio -= 0.25f;
|
mZoomRatio -= 0.25f * steps;
|
||||||
renderPage(true);
|
renderPage(true);
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
@ -498,11 +494,11 @@ public class PdfViewer extends AppCompatActivity implements LoaderManager.Loader
|
|||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
|
|
||||||
case R.id.action_zoom_out:
|
case R.id.action_zoom_out:
|
||||||
zoomOut();
|
zoomOut(1);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.action_zoom_in:
|
case R.id.action_zoom_in:
|
||||||
zoomIn();
|
zoomIn(1);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case R.id.action_rotate_clockwise:
|
case R.id.action_rotate_clockwise:
|
||||||
|
Loading…
Reference in New Issue
Block a user