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

returning to first page when orientation change

  • admin
  • Topic Author
  • New Member
  • New Member
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7232 by admin
Hello,
I've noticed Radaee doesn't remember the current page when the orientation change.
So when I change from portrain to landscape I am getting the first page of pdf.
Demo Radaee doesn't provide solution for that.
How can I solve this problem? :side:
Last edit: 11 years 6 months ago by vishwakarmaspot.
  • admin
  • Topic Author
  • New Member
  • New Member
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7249 by admin
Replied by admin on topic change page to another page
solved :lol:
Last edit: 11 years 6 months ago by vishwakarmaspot.
More
IP: 192.168.0.71 11 years 6 months ago #7316 by dkastner
How do you fixed it?


Cheers,
Daniel
  • admin
  • Topic Author
  • New Member
  • New Member
More
IP: 192.168.0.71 11 years 6 months ago - 11 years 6 months ago #7320 by admin
Replied by admin on topic change page to another page
I added one snipet to source (demo) code and changed manifest file to handle configchanges:

In ReaderController:

protected void onSizeChanged(int w, int h, int oldw, int oldh) {
m_save_w = w;
m_save_h = h;
if (m_pdv != null && !m_lock_resize)
m_pdv.vResize(w, h);

//added this part
if (m_pdv == null) return;
PDFView.PDFPos pos = m_pdv.vGetPos(0, 0);
m_pdv.vResize(w, h);
m_pdv.vSetScale(0, 0, 0);
if (m_cur_page >= 0) {
m_pdv.vGotoPage(m_cur_page);
} else if (pos != null) {
m_pdv.vSetPos(pos, 0, 0);
m_pdv.vCenterPage(pos.pageno);
}
}

And in manifes.xm for activity displaying pdf I added:

android:configChanges="orientation|screenSize"
Last edit: 11 years 6 months ago by vishwakarmaspot.
More
IP: 192.168.0.71 11 years 5 months ago #7352 by dkastner
Hey admin,

thanks for sharing your solution. Unfortunately it doesn't work for me. Or better say it works only partial. If I start in Landscape displaying page 2 of the PDF ad switch to Porttrait it's showing half of page one and half of page 2. When I swicth back to Landscape it shows again page two, but with a slight offset to the right (page is not centered on screen). Do you have the same behavior or does it work like a charm for you?


Thanks again,

Daniel
  • admin
  • Topic Author
  • New Member
  • New Member
More
IP: 192.168.0.71 11 years 5 months ago - 11 years 5 months ago #7359 by admin
Replied by admin on topic change page to another page
it means you are doing it wrong :) Catch the zip project and test it!

This project is simple project demo. It handles two pages when landscape mode and one when portrait. If you see two pages 2&3 and you change to portrait, you will see only 2.

www34.zippyshare.com/v/71793623/file.html

Write back asap if it is working.
Last edit: 11 years 5 months ago by vishwakarmaspot.
Time to create page: 0.406 seconds
Powered by Kunena Forum