Speed up access to Android offline documents

Source: Internet
Author: User

Optandroiddocs background:
Accessing the Android API documentation has been a problem since Google was walled. Although the Android SDK can download the development documentation offline, it is still slow to access the online resource guides (js,fonts, etc.) that still link to Google in the document.

    • There are about 2 ways to do this online:

      1. Use a script to delete a reference to an online resource in an HTML file (it can be downloaded from someone else on the web)

      2. Is offline view, someone also wrote a plugin under Chrome.

    • But I'm not satisfied with either of these methods:

      1. After the Android document is updated, it needs to be processed again. The script is slow, waiting for users to provide processed documents and not timely.

      2. I use the usual browser when Firefox

Project Address: Http://git.oschina.net/velable/OptAndroidDocs

So decided to use C + + to re-write an optimized Android offline document access speed of small programs. This project uses QT Creator Development (Linux under this very cool, very convenient). This project was passed in the Linux compilation test, in theory windows is also possible.

After compiling this project, Optandroiddocs will be generated and executed Optandroiddocs in the Android document directory.

[Email protected]:~/.my_files/usr/android_develop/sdk/docs$ time Optandroiddocsreal 0m14.163suser 0m11.227ssys 0 m1.180s

As you can see from the above data, it takes only 14 seconds to process hundreds of trillion of Android 5.0 offline documents (probably more than 9,000 HTML files).

    • Finally there are two files that need to be manually edited under:

In 1.assets/js/docs.js:

var po = document.createelement (' script '); Po.type = ' Text/javascript ';  Po.async = true;  PO.SRC = ' https://apis.google.com/js/plusone.js '; var s = document.getelementsbytagname (' script ') [0]; S.parentnode.insertbefore (PO, s);

Switch

var po = document.createelement (' script '); Po.type = ' Text/javascript ';  Po.async = true;  PO.SRC = ' https://apis.google.com/js/plusone.js '; var s = document.getelementsbytagname (' script ') [0]; S.parentnode.insertbefore (PO, s);

is to comment out the middle line.

In 2.reference/packages.html:

</div> <!--end Body-content--</body>

Switch

</div> <!--end Body-content--<script src= ". /jd_lists_unified.js?v=2 "type=" Text/javascript "></script> <script src=". /jd_extras.js?v=3 "type=" Text/javascript "></script> <script src=". /jd_collections.js?v=3 "type=" Text/javascript "></script> <script src=". /jd_tag_helpers.js?v=2 "type=" Text/javascript "></script></body>

This 2nd is more important, if you do not add these sentences (these sentences from the end of index.html in the document root) the search function of the document cannot be automatically complete (only the first two letters)


Speed up access to Android offline documents

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.