private TextView mCurrentPageNumber;
private TextView mLastPageNumber;
private TextView mViewerStateText;
+ private TextView mZoomValue;
private ViewTreeObserver mPreviewImgObserver;
private String mFilePath;
private PdfPageView mPdfView;
mCurrentPageNumber = (TextView) findViewById(R.id.page_number);
mLastPageNumber = (TextView) findViewById(R.id.total_pages_num);
mViewerStateText = (TextView) findViewById(R.id.pdf_viewer_state);
+ mZoomValue = (TextView) findViewById(R.id.zoom_value);
mViewStates = ViewStates.SCROLLING;
mProgressContainer = (RelativeLayout) findViewById(R.id.progress_container);
if (event.getAction() == MotionEvent.ACTION_MOVE) {
dzoom = event.getRawX() - startX;
Log.d(TAG,"move_action, dzoom: " + dzoom);
- mPdfView.zoom(dzoom /1000f);
+ zoomPage(dzoom /1000f);
startX = event.getRawX();
return false;
}
}
+ private void zoomPage(float deltaZoom) {
+ mPdfView.zoom(deltaZoom);
+ mZoomValue.setText(Integer.toString(Math.round(mPdfView.getZoomRatio()*100)));
+ }
+
private class LoadPageTask extends AsyncTask<Void, Void, Void> {
@Override
super.onPostExecute(aVoid);
mProgressContainer.setVisibility(View.INVISIBLE);
mPdfImageContainer.addView(mPdfView);
+ zoomPage(0.0f); // just for update the zoom value indicator
Log.d(TAG, "PDF page loaded.");
}
}
</RelativeLayout>
</FrameLayout>
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:text="@string/zoom_label"
+ android:id="@+id/textView6"
+ android:layout_above="@+id/pdf_view_container"
+ android:layout_toEndOf="@+id/total_pages_num"
+ android:layout_marginStart="36dp"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:text="100"
+ android:id="@+id/zoom_value"
+ android:layout_alignParentTop="true"
+ android:layout_toEndOf="@+id/textView6"/>
+
+ <TextView
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:text="%"
+ android:id="@+id/textView7"
+ android:layout_above="@+id/pdf_view_container"
+ android:layout_toEndOf="@+id/zoom_value"/>
+
</RelativeLayout>