cherry picks from the new_ui_code branch of legacy repo

Now I think new_ui_code branch in koreader/kindlepdfviewer can be deleted safely.