From 4f7e5159409e71ecfeba86858f5ec044d043aff8 Mon Sep 17 00:00:00 2001 From: Dirk Dougherty Date: Thu, 16 Sep 2010 10:43:40 -0700 Subject: [PATCH] doc change: Samples browsing: basic support in templates and js/css. Change-Id: Ie2323f5323c624420c90c8c782b840f183238f7c --- .../templates-sdk/assets/css/default.css | 148 ++++++++++- .../assets/images/file-generic.png | Bin 0 -> 224 bytes .../assets/images/file-image.png | Bin 0 -> 511 bytes .../templates-sdk/assets/images/file-java.png | Bin 0 -> 299 bytes .../assets/images/file-manifest.png | Bin 0 -> 341 bytes .../templates-sdk/assets/images/file-xml.png | Bin 0 -> 301 bytes .../templates-sdk/assets/images/folder.png | Bin 0 -> 311 bytes .../droiddoc/templates-sdk/assets/js/docs.js | 32 ++- .../templates-sdk/components/masthead.cs | 10 +- .../droiddoc/templates-sdk/customizations.cs | 47 ++-- tools/droiddoc/templates-sdk/docpage.cs | 2 +- tools/droiddoc/templates-sdk/head_tag.cs | 2 +- tools/droiddoc/templates-sdk/sample.cs | 165 +++++++++++++ tools/droiddoc/templates-sdk/sampleindex.cs | 230 +++++++++++++++--- .../templates-sdk/samples_navtree_data.cs | 3 + 15 files changed, 573 insertions(+), 66 deletions(-) create mode 100644 tools/droiddoc/templates-sdk/assets/images/file-generic.png create mode 100644 tools/droiddoc/templates-sdk/assets/images/file-image.png create mode 100644 tools/droiddoc/templates-sdk/assets/images/file-java.png create mode 100644 tools/droiddoc/templates-sdk/assets/images/file-manifest.png create mode 100644 tools/droiddoc/templates-sdk/assets/images/file-xml.png create mode 100644 tools/droiddoc/templates-sdk/assets/images/folder.png create mode 100644 tools/droiddoc/templates-sdk/sample.cs create mode 100644 tools/droiddoc/templates-sdk/samples_navtree_data.cs diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css index 3bfb6874d..d11a862ed 100644 --- a/tools/droiddoc/templates-sdk/assets/css/default.css +++ b/tools/droiddoc/templates-sdk/assets/css/default.css @@ -338,7 +338,8 @@ video.with-shadow { width: 34px; height: 34px; } #nav li.expanded li ul.tree-list-children { - padding:0; + display:block; /*dd temporary for debug */ + padding: 0 0 0 10px; } #nav li.expanded li ul.tree-list-children .tree-list-children { padding:0 0 0 10px; @@ -957,7 +958,7 @@ scroll top left; background-image: url(../images/styles/ico_wrong.png); } .do-dont-label.good { background-image: url(../images/styles/ico_good.png); } - + @@ -2358,6 +2359,9 @@ div.toggle-content.closed .toggle-content-toggleme { #jd-content img.toggle-content-img { margin:0 5px 5px 0; } +div.toggle-content p { + margin:10px 0 0; +} div.toggle-content-toggleme { padding:0 0 0 15px; } @@ -2443,6 +2447,144 @@ Lightbox background-position: -10px 0; } + +/* Styles for toggleable divs */ +.toggleable { + padding: .25em 1em 0em 1em; + margin-bottom: 0; +} +.toggleme { + padding: 1em 1em 0 2em; + line-height:1em; +} +.toggleable a { + text-decoration:none; +} +.toggleme a { + text-decoration:underline; +} + +.toggleable.closed .toggleme { + display:none; +} +#jd-content .toggle-img { + margin:0; +} + +/* -------------------------------------------------------------------------- +Styles for samples project trees and code browsing in resources tab +*/ + +.structure-dir { +background-image:url(../../assets/images/folder.png); +background-repeat:no-repeat; +background-position:16px 2px; + margin:.25em 0 0 0; + padding:0 0 0 0; +} + +.structure-toggleme { + margin:0 0 0 3em; + padding:0 0 0 0; + text-decoration:none; +} + +.structure-java{ +background-image:url(../../assets/images/file-java.png); +background-repeat:no-repeat; +background-position:0px 2px; + margin:.3em 0 0 0; + padding:.3em 0 .3em 22px; +} + +.structure-file { +background-image:url(../../assets/images/file-generic.png); +background-repeat:no-repeat; +background-position:0px 2px; + margin:.3em 0 0 0; + padding:.3em 0 .3em 22px; +} + +.structure-xml { +background-image:url(../../assets/images/file-xml.png); +background-repeat:no-repeat; +background-position:0px 2px; + margin:.3em 0 0 0; + padding:.3em 0 .25em 22px; +} + +.structure-img { +background-image:url(../../assets/images/file-image.png); +background-repeat:no-repeat; +background-position:0px 2px; + margin:.3em 0 0 0; + padding:.3em 0 .25em 22px; +} + +.structure-manifest { +background-image:url(../../assets/images/file-manifest.png); +background-repeat:no-repeat; + margin:.0 0 0 1.25em; + padding:0 0 0 22px; + text-decoration:none; +} + +#jd-content .structure-toggle-img { + margin:.5em 0 0 0; +padding-right:2.1em; +} + +.dirInfo { + margin-left:2em; +} + +.structure-dir a { + text-decoration:none; +} + +.structure-manifest a { + text-decoration: none; +} +.structure-file a { + text-decoration: none; +} + +.sampleEmbed { + background-color:rgb(249, 249, 249); +} + +.sampleEmbed ol.lineNumbers { + list-style-type: decimal; + padding-left:1em; +} + +.sampleEmbed ol.lineNumbers li { +border-left:1px solid #ddd; +border-right:1px solid #ddd; +color:gray; +background-color:#f7f7f7; +margin:0 0 0 24px; +padding: 2px 2px 2px 6px; +} + +.sampleEmbed ol.lineNumbers li:hover { +background: #efefef; +} + +/* -------------------------------------------------------------------------- +Styles for raw formatted line numbers (not used with listformatted version) +div.sampleLine div.lineNumber { + display: inline; +} +div.sampleLine div.lineCode { + display: inline; + padding-left:6px; +} +div.sampleLine { + padding:0; + margin:0; +}*/ + /* -------------------------------------------------------------------------- Butterbar */ @@ -2489,7 +2631,7 @@ table.blank th, table.blank td { .caption { margin: 0.5em 0 2em 0; color: #000; - font-size: 11.5px; + font-size: 11.5px; } .nolist { diff --git a/tools/droiddoc/templates-sdk/assets/images/file-generic.png b/tools/droiddoc/templates-sdk/assets/images/file-generic.png new file mode 100644 index 0000000000000000000000000000000000000000..18024577b17fa817c644e4271b0b21defc63b7b1 GIT binary patch literal 224 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*D5Xnmk<`Ln>}1{rUgj{_v%x-jWRt;vL?NH`qEvB{>>iyvT49 zILq`@n)zd*v9YnAr>AGz{`&uquI@=aEoLE|<}kgrm38^1O-3_5|M^)wXV%UgI|6?A z1l)263!By`!%*CK;rsjhlK1x2dT(O%;Sp&HWOn0q@av4YZ0X6S@Z2DX!J&bX!FH;& VO#Zpxr$E;*c)I$ztaD0e0sx@iQ&<21 literal 0 HcmV?d00001 diff --git a/tools/droiddoc/templates-sdk/assets/images/file-image.png b/tools/droiddoc/templates-sdk/assets/images/file-image.png new file mode 100644 index 0000000000000000000000000000000000000000..d3aec4634ba81035245fe0202b103c09278d56f6 GIT binary patch literal 511 zcmV6NdWwdc2w+KYk2n!wl%k&(G&{b8`c8o$wI4 zBhr(Bft!_qLGCI8!|w$Q&;Ne`%kuzD;&fwScsK)x7nb?NFg*2*V_*;zWnd5%U|?Xi zX1Ks!#Bd);4UZ}_ZWnw5+FSypt$|n*7-}zp^lfHMpf$3&-2O&)5Dk-0l0x z@a_IT++JWZX)yQKw;v4mr}Z;1Tzv~y!X=3(78pJP6}AJDk-Qo(wD^Dl zaEXE8`!~G#f(2_j|Nb6=1^6MD7z2=V7%2cCzyK64a`YLMMCt$l002ovPDHLkV1l50 B((eEO literal 0 HcmV?d00001 diff --git a/tools/droiddoc/templates-sdk/assets/images/file-java.png b/tools/droiddoc/templates-sdk/assets/images/file-java.png new file mode 100644 index 0000000000000000000000000000000000000000..ec85e4bf699c4af5764598b8df4ea39f905f3fc0 GIT binary patch literal 299 zcmV+`0o4A9P)QXsYg zVnqf5;KIBrMi9*c)ocu;4p+r`a9ZmsF_g^Ng;(?STX*1W7AW0SpXkjQXsZwAJb(8Y zr)EhZUKBnPls0fOQez+oz+51dF?lmqn>FPn7%~HF8S*Bs#%cf)AsaxNLEz7iujCm( z2nR}%BtPOyI}f;!zg@^=445XQniJ7ng=;@rKFhI^>qyT^b0{~a$H>RyXABF$`002ovPDHLkV1i|ba})po literal 0 HcmV?d00001 diff --git a/tools/droiddoc/templates-sdk/assets/images/file-manifest.png b/tools/droiddoc/templates-sdk/assets/images/file-manifest.png new file mode 100644 index 0000000000000000000000000000000000000000..332d06690a0585aef6ab2b026aebb5b04bccb811 GIT binary patch literal 341 zcmV-b0jmCqP)T?Ph*QXsYg zVnqf5pg!d?BZy`JYBUDYhrO+9I8|h97!Kbl#;ft%*{g6i3lMkt**0<-st17uKK*!v zQzIXT915Qahz&FpoEgXgAe)8uTuaAmBR1o zfPTiI8Dt{}Tz|5j;n3A~xPo-|Q-qxjb1Fz9D=QNNJ0}xCKf_hrdASix+i6!4r4dE* z$$On(T2m$v?00NxrgO)nvFdymSVR5KEmFgyN zmg#B^&l0}s=<5ZmPTVk%*%#as{(0x-@P|2K8h4+j-#(GKLXPEG&99Ff%hT-mEJf^u zr(vIlK=3f$6*?e zDtH~P@i5ucOi(zK&e6qa(E9S-@&~gn^8WktQM^un!R@wpT5)w|Yc6&qa-8`8A}1yM xp(#VGp;>Q;H@nV{OO~E&3eOFK7#tcH8B(l0J2yC&YzwjU5r z0AfWX`TIaz2E=QyX^xJLW?(_$Pc||#k`opdh6}uV_fGNb*|XDd82|!IKpX@bKY7IR5qP7XwgS6e#~64c`M|Z?G4Dc$%rHsi=&M3Sp0f^;Du=o)WSAtV3rP&!EzyNFxPioIfJjVb4002ov JPDHLkV1gj{cccIS literal 0 HcmV?d00001 diff --git a/tools/droiddoc/templates-sdk/assets/js/docs.js b/tools/droiddoc/templates-sdk/assets/js/docs.js index c21929ea1..86b7aa1d2 100644 --- a/tools/droiddoc/templates-sdk/assets/js/docs.js +++ b/tools/droiddoc/templates-sdk/assets/js/docs.js @@ -188,6 +188,8 @@ $(document).ready(function() { $("#nav-x li.tools a").addClass("selected"); } else if ($("body").hasClass("google")) { $("#nav-x li.google a").addClass("selected"); + } else if ($("body").hasClass("samples")) { + $("#nav-x li.samples a").addClass("selected"); } // highlight Distribute tab @@ -640,13 +642,6 @@ function updateSideNavPosition() { $('#devdoc-nav .totop').css({left: -(newLeft - parseInt($('#side-nav').css('margin-left')))}); } - - - - - - - // TODO: use $(document).ready instead function addLoadEvent(newfun) { var current = window.onload; @@ -2577,6 +2572,13 @@ function init_navtree(navtree_id, toroot, root_nodes) } } + + + + + + + /* TODO: eliminate redundancy with non-google functions */ function init_google_navtree(navtree_id, toroot, root_nodes) { @@ -2691,6 +2693,22 @@ function init_default_gcm_navtree(toroot) { }); } +function showSamplesRefTree() { + init_default_samples_navtree(toRoot); +} + +function init_default_samples_navtree(toroot) { + // load json file for navtree data + $.getScript(toRoot + 'samples_navtree_data.js', function(data, textStatus, jqxhr) { + // when the file is loaded, initialize the tree + if(jqxhr.status === 200) { + init_google_navtree("samples-tree-list", toroot, SAMPLES_NAVTREE_DATA); + highlightSidenav(); + resizeNav(); + } + }); +} + /* TOGGLE INHERITED MEMBERS */ /* Toggle an inherited class (arrow toggle) diff --git a/tools/droiddoc/templates-sdk/components/masthead.cs b/tools/droiddoc/templates-sdk/components/masthead.cs index 4f3273c69..78e53b271 100644 --- a/tools/droiddoc/templates-sdk/components/masthead.cs +++ b/tools/droiddoc/templates-sdk/components/masthead.cs @@ -188,6 +188,10 @@ onkeyup="return search_changed(event, false, '')" />
  • Google Services
  • + +
  • Samples +
  • +
  • @@ -214,7 +218,7 @@ onkeyup="return search_changed(event, false, '')" /> - +
  • Google Services
  • + +
  • Samples +
  • + diff --git a/tools/droiddoc/templates-sdk/customizations.cs b/tools/droiddoc/templates-sdk/customizations.cs index 33edbdef7..985f059a2 100644 --- a/tools/droiddoc/templates-sdk/customizations.cs +++ b/tools/droiddoc/templates-sdk/customizations.cs @@ -134,6 +134,30 @@ def:distribute_nav() ?> + +
    +
    +
    +to top + + + + +
    + +
    + + +
    @@ -177,28 +201,7 @@ def:about_nav() ?> }); - -
    -
    -
    -to top - - - - -
    -
    - -: - - @@ -322,6 +325,8 @@ def:custom_left_nav() ?> devsite> + + devsite> + + + + +
    class="fullpage"class="col-13" id="doc-col"class="col-12" id="doc-col" > + + + + + + + + + +
    + +
    + +
    +
    + +

    item2

    +

    + +

    + +
    + +
    + +
    +

    class="with-title-tabs">""

      +
    • + +
    • + +
    • +
    + +
    + + + + + +
    + + + + + + + + +

    The file containing the source code shown below is located in the corresponding directory in <sdk>/samples/android-<version>/...

    + + +
    + +
      + +
    +
    +
    + + + + + + + + + + +

    You can find the source code for this sample in your SDK at:

    +

    +<sdk>/samples/android-<version>/ +

    + + + +
    + + +
    + + + + + + + + + + + + diff --git a/tools/droiddoc/templates-sdk/sampleindex.cs b/tools/droiddoc/templates-sdk/sampleindex.cs index a1733634c..2447da895 100644 --- a/tools/droiddoc/templates-sdk/sampleindex.cs +++ b/tools/droiddoc/templates-sdk/sampleindex.cs @@ -1,53 +1,219 @@ - devsite> + - + +
    class="fullpage"class="col-13" id="doc-col"class="col-12" id="doc-col" > + + + + + + + + + +
    + +
    + +
    +
    + +

    item2

    +

    + +

    + +
    + +
    + +
    +

    class="with-title-tabs">

      +
    • + +
    • + +
    • +
    + +
    + + + + + +
    + + + + + + + + - -
    -
    - - Sample Code > - -

    -
    + -
    -

    ← Back

    + + +
    + +
    + + + Info ] + +
    + + + + +
    +
    + + + + + + + - -

    Subdirectories

    -
      - -
    • /
    • - -
    - +

    Project Structure

    - -

    Files

    -
      - -
    • - -
    - +

    Decide what to do with this ...

    -
    + + + + + +
    + +
    + + + Info ] + +
    + + + + +
    +
    + + + + + + + + + + +

    You can find the source code for this sample in your SDK at:

    +

    +<sdk>/samples/android-<version>/ +

    + + + +
    -
    + + diff --git a/tools/droiddoc/templates-sdk/samples_navtree_data.cs b/tools/droiddoc/templates-sdk/samples_navtree_data.cs new file mode 100644 index 000000000..24ac7b77c --- /dev/null +++ b/tools/droiddoc/templates-sdk/samples_navtree_data.cs @@ -0,0 +1,3 @@ +var SAMPLES_NAVTREE_DATA = + +;