Hi,
to enable edit text moving you have to edit OnPDFSingleTapped method of PDFReader class as following:
public boolean OnPDFSingleTapped(float x, float y)
{
if( m_status == STA_NORMAL || m_status == STA_ANNOT )
{
m_annot_pos = m_view.vGetPos((int)x, (int)y);
m_annot_page = m_view.vGetPage(m_annot_pos.pageno);
final Page page = m_annot_page.GetPage();
if( page == null ) m_annot = null;
else m_annot = page.GetAnnotFromPoint(m_annot_pos.x, m_annot_pos.y);
if( m_annot == null )
{
m_annot_page = null;
m_annot_pos = null;
m_annot_rect = null;
m_view.vSetLock(0);
if( m_listener != null && m_status == STA_ANNOT )
m_listener.OnAnnotClicked(m_annot_page, null);
m_status = STA_NORMAL;
}
else
{
m_annot_rect = m_annot.GetRect();
int px = m_annot_page.GetVX(m_view.vGetX());
int py = m_annot_page.GetVY(m_view.vGetY());
float tmp = m_annot_rect[1];
m_annot_rect[0] = m_annot_page.ToDIBX(m_annot_rect[0]) + px;
m_annot_rect[1] = m_annot_page.ToDIBY(m_annot_rect[3]) + py;
m_annot_rect[2] = m_annot_page.ToDIBX(m_annot_rect[2]) + px;
m_annot_rect[3] = m_annot_page.ToDIBY(tmp) + py;
m_view.vSetLock(3);
m_status = STA_ANNOT;
if( m_doc.CanSave() && m_annot.GetEditType() > 3 ) //don't open edit text requetser
{
int[] location = new int[2];
getLocationOnScreen(location);
m_pEdit = new PopupWindow(LayoutInflater.from(getContext()).inflate(R.layout.pop_edit, null) );
m_pEdit.setFocusable(true);
m_pEdit.setTouchable(true);
BitmapDrawable bitmap = new BitmapDrawable();//add back
m_pEdit.setBackgroundDrawable(bitmap);
m_pEdit.setWidth((int)(m_annot_rect[2] - m_annot_rect[0]));
m_pEdit.setHeight((int)(m_annot_rect[3] - m_annot_rect[1]));
final EditText edit = (EditText)m_pEdit.getContentView().findViewById(R.id.annot_text);
edit.setBackgroundColor(0xFFFFFFC0);
m_pEdit.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
if (m_edit_type == 1)//edit box
{
m_annot.SetEditText(edit.getText().toString());
m_view.vRenderSync(m_annot_page);
if (m_listener != null)
m_listener.OnPageModified(m_annot_page.GetPageNo());
PDFEndAnnot();
}
m_edit_type = 0;
}
});
float fsize = m_annot.GetEditTextSize() * m_annot_page.GetScale();
edit.setTextSize(TypedValue.COMPLEX_UNIT_PX, fsize);
edit.setPadding(2, 2, 2, 2);
switch( m_annot.GetEditType() )
{
case 1:
edit.setSingleLine();
edit.setInputType(InputType.TYPE_CLASS_TEXT + InputType.TYPE_TEXT_VARIATION_NORMAL);
break;
case 2:
edit.setSingleLine();
edit.setInputType(InputType.TYPE_CLASS_TEXT + InputType.TYPE_TEXT_VARIATION_PASSWORD);
break;
case 3:
edit.setSingleLine(false);
edit.setInputType(InputType.TYPE_CLASS_TEXT + InputType.TYPE_TEXT_VARIATION_NORMAL);
break;
}
int maxlen = m_annot.GetEditMaxlen();
if( maxlen > 0 )
edit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(maxlen)});
else
edit.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1020)});
edit.setText(m_annot.GetEditText());
m_edit_type = 1;
m_pEdit.showAtLocation(this, Gravity.NO_GRAVITY, (int)m_annot_rect[0] + location[0], (int)m_annot_rect[1] + location[1]);
}
if( m_doc.CanSave() && m_annot.GetComboItemCount() >= 3 ) //move edit text
{
int[] location = new int[2];
getLocationOnScreen(location);
String opts[] = new String[m_annot.GetComboItemCount()];
int cur = 0;
while( cur < opts.length )
{
opts[cur] = m_annot.GetComboItem(cur);
cur++;
}
m_pCombo = new PopupWindow(LayoutInflater.from(getContext()).inflate(R.layout.pop_combo, null));
m_pCombo.setFocusable(true);
m_pCombo.setTouchable(true);
BitmapDrawable bitmap = new BitmapDrawable();//add back
m_pCombo.setBackgroundDrawable(bitmap);
m_pCombo.setWidth((int)(m_annot_rect[2] - m_annot_rect[0]));
if( (m_annot_rect[3] - m_annot_rect[1] - 4) * opts.length > 250 )
m_pCombo.setHeight(250);
else
m_pCombo.setHeight((int)(m_annot_rect[3] - m_annot_rect[1] - 4) * opts.length);
ComboList combo = (ComboList)m_pCombo.getContentView().findViewById(R.id.annot_combo);
combo.set_opts(opts);
combo.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
m_sel_index = i;
m_pCombo.dismiss();
}
});
m_pCombo.setOnDismissListener(new PopupWindow.OnDismissListener() {
@Override
public void onDismiss() {
if (m_edit_type == 2)//combo
{
if (m_sel_index >= 0) {
m_annot.SetComboItem(m_sel_index);
m_view.vRenderSync(m_annot_page);
if (m_listener != null)
m_listener.OnPageModified(m_annot_page.GetPageNo());
}
m_sel_index = -1;
PDFEndAnnot();
}
m_edit_type = 0;
}
});
m_edit_type = 2;
m_sel_index = -1;
m_pCombo.showAtLocation(this, Gravity.NO_GRAVITY, (int)m_annot_rect[0] + location[0], (int)(m_annot_rect[3] + location[1]));
}
if( m_listener != null )
m_listener.OnAnnotClicked(m_annot_page, m_annot);
invalidate();
}
return true;
}
return false;
}