- Posts: 2
- 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
Problem with refreshing page after move page
11 years 3 months ago #8983
by barwoź
Problem with refreshing page after move page was created by barwoź
Hello
I have problem with refreshing page after slide. It's refreshing only after tap screen.
I'm not using PDFLayoutView and i won't do this.
Is there any possibility to move page smothly ? without refreshing after next tap?
Best Regards,
Bartłomiej
I have problem with refreshing page after slide. It's refreshing only after tap screen.
I'm not using PDFLayoutView and i won't do this.
Is there any possibility to move page smothly ? without refreshing after next tap?
Best Regards,
Bartłomiej
Code:
public class PDFReader extends View implements PDFViewVert.PDFViewListener
{
private ReadPDFActivity m_Padre;
private PDFDoc m_Widok = null;
private int m_Styl = -1;
private boolean m_ZablokujWielkosc = false;
private boolean m_ZablokujPozycje=false;
private int m_Szerokosc = 0;
private int m_Wysokosc = 0;
private int m_IndexStrony = 0;
private PaintView m_PaintView;
public PDFReader(Context context)
{
super(context);
}
public PDFReader(Context context, AttributeSet attrs)
{
super(context, attrs);
}
public void ustawActivity(ReadPDFActivity _Act)
{
m_Padre=_Act;
}
public void ustawPaintView(PaintView _Paint)
{
m_PaintView=_Paint;
}
public void ustawStylWidoku()
{
///PDFPos _Pozycja = null;
Document _Dokument = null;
if( m_Widok != null )
{
_Dokument = m_Widok.viewGetDoc();
//_Pozycja = m_Widok.vgetP
m_Widok.vClose();
}
m_Widok = new PDFDoc(m_Padre);
if( m_Widok != null )
{
if( _Dokument != null )
m_Widok.vOpen( _Dokument,3, getContext().getResources().getColor(R.color.tlo_reader),this);
m_Widok.vResize(getWidth(), getHeight());/*
if( _Pozycja != null )
m_Widok.vGotoPage(_Pozycja);*/
}
}
/*
public void ustawStylWidoku( int _Styl )
{
if( _Styl == m_Styl )
return;
PDFPosition _Pozycja = null;
PDFAnnotListener annot_listener = null;
PDFViewListener view_listener = null;
Document _Dokument = null;
if( m_Widok != null )
{
_Dokument = m_Widok.viewGetDoc();
annot_listener = m_Widok.viewGetAnnotListener();
view_listener = m_Widok.viewGetViewListener();
_Pozycja = m_Widok.viewGetPos();
m_Widok.viewClose();
}
switch( _Styl )
{
case 1:
m_Widok = new PDFViewHorz();
break;
case 2:
m_Widok = new PDFViewScroll();
break;
case 3:
m_Widok = new PDFViewSingle();
break;
case 4:
m_Widok = new PDFViewSingleEx();
break;
case 5:
m_Widok = new PDFViewReflow();
break;
case 6:
m_Widok = new PDFViewDual(true);
break;
default:
m_Widok = new PDFViewVert();
break;
}
if( m_Widok != null )
{
if( _Dokument != null )
m_Widok.viewOpen(getContext(), _Dokument, 0xFFdbf3dc, 4);
m_Widok.viewSetAnnotListener( annot_listener );
m_Widok.viewSetViewListener( view_listener );
m_Widok.viewResize(getWidth(), getHeight());
if( _Pozycja != null )
m_Widok.viewGoto(_Pozycja);
}
}*/
protected void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
}
public PDFDoc zwrocWidok()
{
return m_Widok;
}
public void otworz( Document doc )
{
ustawStylWidoku();
//ustawStylWidoku( Global.def_view );
if( m_Widok != null )
m_Widok.vOpen(doc, 4,getContext().getResources().getColor(R.color.tlo_reader), this);
}
public void zamknij()
{
if( m_Widok != null )
m_Widok.vClose();
m_Widok = null;
}
protected void onSizeChanged (int w, int h, int oldw, int oldh)
{
m_Szerokosc = w;
m_Wysokosc = h;
if( m_Widok != null && !m_ZablokujWielkosc )
m_Widok.vResize(w, h);
}
protected void onDraw( Canvas canvas )
{
if( m_Widok != null )
{
m_Widok.vDraw(canvas);
}
}
private float xSelStart = 0;
private float ySelStart = 0;
public boolean onTouchEvent (MotionEvent event)
{
/*if (event.getActionMasked()==MotionEvent.ACTION_DOWN)
{
xSelStart= event.getX();
ySelStart= event.getY();
}
if (event.getActionMasked()==MotionEvent.ACTION_MOVE)
{
float x= event.getX();
float y= event.getY();
m_Widok.vSetSel(xSelStart, ySelStart, x, y);
}
if (event.getActionMasked()==MotionEvent.ACTION_UP || event.getActionMasked()==MotionEvent.ACTION_CANCEL)
{
float x= event.getX();
float y= event.getY();
m_Widok.vSetSel(xSelStart, ySelStart, x, y);
m_Widok.annotSetMarkup(0);
m_Widok.annotEnd();
}
return true;*/
if( m_Widok != null && !m_ZablokujPozycje)
{
return m_Widok.vTouchEvent(event);
}
else
return true;
}
/*
* TODO
* public void setAnnotListener( PDFView.PDFAnnotListener listener )
{
if( m_Widok != null )
m_Widok.viewSetAnnotListener(listener);
}*/
public void setViewListener( PDFView.PDFViewListener listener )
{
/*
* TODO
* if( m_Widok != null )
m_Widok.viewSetViewListener(listener);*/
}
/*public String annotGetText()
{
if( m_Widok != null )
return m_Widok.annotGetText();
else
return null;
}*/
/*public String annotGetSubject()
{
if( m_Widok != null )
return m_Widok.annotGetSubject();
else
return null;
}
public boolean annotSetText(String txt)
{
if( m_Widok != null )
return m_Widok.annotSetText(txt);
else
return false;
}
public boolean annotSetEditText(String txt)
{
if( m_Widok != null )
return m_Widok.annotSetEditText(txt);
else
return false;
}
public boolean annotSetChoice(int item)
{
if( m_Widok != null )
return m_Widok.annotSetChoice(item);
else
return false;
}
public boolean annotSetSubject(String subj)
{
if( m_Widok != null )
return m_Widok.annotSetSubject(subj);
else
return false;
}
public void annotInk()
{
if( m_Widok != null )
m_Widok.annotInk();
}
public void annotRect()
{
if( m_Widok != null )
m_Widok.annotRect();
}
public void annotPerform()
{
if( m_Widok != null )
m_Widok.annotPerform();
}
public void annotEnd()
{
if( m_Widok != null )
m_Widok.annotEnd();
}
public void annotRemove()
{
if( m_Widok != null )
m_Widok.annotRemove();
}*/
public void znajdz(int dir)
{
if( m_Widok != null )
m_Widok.vFind(dir);
}
public void znajdz(String str, boolean match_case, boolean whole_word)
{
if( m_Widok != null )
m_Widok.vFindStart(str, match_case, whole_word);
}
public void idzDoStrony(int _Index)
{
m_Widok.vGotoPage(_Index);
}
@Override
public void invalidate(Rect dirty) {
super.invalidate(dirty);
if( m_Widok != null )
invalidate();
}
@Override
public void OnPDFPageChanged(int pageno) {
m_IndexStrony = pageno;
m_Padre.zmienilSieNumerStrony(pageno);
}
@Override
public boolean OnPDFSingleTapped(float x, float y) {
invalidate();
//m_Padre.kliknietoStrone(x,y);
return false;
}
@Override
public void OnPDFPageDisplayed(Canvas arg0, PDFVPage arg1) {
m_PaintView.stronaZmienilaSie(arg1);
}
public void onHold()
{
}
public void onPressDown()
{
}
public void onPressUp()
{
}
public void onClickPage(int pageno)
{
m_Widok.vGotoPage(pageno);
invalidate();
}
public void lockResize(boolean lock)
{
if( m_ZablokujWielkosc == lock ) return;
m_ZablokujWielkosc = lock;
if( lock )
{
m_Szerokosc = getWidth();
m_Wysokosc = getHeight();
}
else
{
m_Widok.vResize(m_Szerokosc, m_Wysokosc);
}
}
public int zwrocNumerStronyAktualnej()
{
return m_IndexStrony;
}
public void ustawBlokadePozycji(boolean _Blokada)
{
m_ZablokujPozycje=_Blokada;
}
@Override
public boolean OnPDFDoubleTapped(float arg0, float arg1) {
// TODO Auto-generated method stub
return false;
}
@Override
public void OnPDFFound(boolean arg0) {
// TODO Auto-generated method stub
}
@Override
public void OnPDFInvalidate(boolean arg0) {
// TODO Auto-generated method stub
invalidate();
}
@Override
public void OnPDFLongPressed(float arg0, float arg1) {
// TODO Auto-generated method stub
}
@Override
public void OnPDFSelectEnd() {
// TODO Auto-generated method stub
invalidate();
}
@Override
public void OnPDFSelecting(Canvas arg0, int[] arg1, int[] arg2) {
// TODO Auto-generated method stub
}
@Override
public void OnPDFShowPressed(float arg0, float arg1) {
// TODO Auto-generated method stub
}
}
Time to create page: 0.394 seconds