- Posts: 12
- Thank you received: 0
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
I want to reset zoom when changing orientation
9 years 5 months ago - 9 years 5 months ago #11362
by app2U
I want to reset zoom when changing orientation was created by app2U
Hello,
I'm trying to reset the zoom (full screen size) when changing the orientation. When I change the orientation from portrait to landscape, the zoom remains the same, and if the page was full screen in portrait mode, it's zoomed in landscape mode. (The other way around, landscape -> portrait, works as I want).
Example:
when i change the orientation.. :
what I want to see (full screen):
Does a function exist to reset the zoom to fit the page to full screen? How can I do what I'm trying to achieve?
I also want to remain in the same page, so I also tried to reset the activity but it returns the pdf to the first page.
Thank you.
I'm trying to reset the zoom (full screen size) when changing the orientation. When I change the orientation from portrait to landscape, the zoom remains the same, and if the page was full screen in portrait mode, it's zoomed in landscape mode. (The other way around, landscape -> portrait, works as I want).
Example:
when i change the orientation.. :
what I want to see (full screen):
Does a function exist to reset the zoom to fit the page to full screen? How can I do what I'm trying to achieve?
I also want to remain in the same page, so I also tried to reset the activity but it returns the pdf to the first page.
Thank you.
Last edit: 9 years 5 months ago by app2U.
9 years 5 months ago #11369
by Davide
Replied by Davide on topic I want to reset zoom when changing orientation
Hi,
I suggest you to set zoom to min level using vZoomSet and vGetMinScale() (to get min scale) in onConfigurationChanged method of PDFViewAct.
I suggest you to set zoom to min level using vZoomSet and vGetMinScale() (to get min scale) in onConfigurationChanged method of PDFViewAct.
9 years 5 months ago #11381
by app2U
Replied by app2U on topic I want to reset zoom when changing orientation
I'm trying this implementation and it is not working:
I have set m_layout from "PDFLayoutView" class to public in order to acces it.
What should I do in order to make it work?
Code:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
PDFLayout.PDFPos pdfPos = m_view.m_layout.vGetPos(0,0);
float minScale = m_view.m_layout.vGetMinScale();
m_view.m_layout.vZoomSet(m_view.m_layout.vGetX(), m_view.m_layout.vGetY(), pdfPos, minScale);
}
I have set m_layout from "PDFLayoutView" class to public in order to acces it.
What should I do in order to make it work?
9 years 5 months ago - 9 years 5 months ago #11382
by Davide
Replied by Davide on topic I want to reset zoom when changing orientation
Hi,
as a better implementation you can do as following in PDFLayoutView
This implementation resets the view scale even if you are in zoom state.
as a better implementation you can do as following in PDFLayoutView
Code:
@Override
protected void onSizeChanged( int w, int h, int oldw, int oldh )
{
super.onSizeChanged(w,h,oldw, oldh);
if(m_layout != null && m_status != STA_ANNOT && w > 0 && h > 0)
{
m_layout.vResize(w, h);
//new code
PDFLayout.PDFPos pdfPos = m_layout.vGetPos(0,0);
m_layout.vZoomSet(m_layout.vGetWidth()/2, m_layout.vGetHeight()/2, pdfPos, 1);
PDFGotoPage(m_pageno);
if( m_goto_pos != null )
{
m_layout.vSetPos(0, 0, m_goto_pos);
m_goto_pos = null;
invalidate();
}
}
}
This implementation resets the view scale even if you are in zoom state.
Last edit: 9 years 5 months ago by Davide.
Time to create page: 0.403 seconds