Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 28ab3b12 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 8917 into donut

* changes:
  implement api level toggling  and rename navtree.js to android-developer-reference.js for all reference related scripts  TODO: shading for hidden classes in the treeview navigation... these aren't dynamic yet.
parents 1aca962a 25fda196
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -863,6 +863,7 @@ public class ClassInfo extends DocInfo implements ContainerInfo, Comparable, Sco
        data.setValue(base + ".kind", this.kind());
        TagInfo.makeHDF(data, base + ".shortDescr", this.firstSentenceTags());
        TagInfo.makeHDF(data, base + ".deprecated", deprecatedTags());
        data.setValue(base + ".since", getSince());
    }

    /**
+2 −1
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ public class DroidDoc
    public static ArrayList<String[]> mHDFData = new ArrayList<String[]>();
    public static Map<Character,String> escapeChars = new HashMap<Character,String>();
    public static String title = "";
    public static SinceTagger sinceTagger = new SinceTagger();

    public static boolean checkLevel(int level)
    {
@@ -97,7 +98,6 @@ public class DroidDoc
        String apiFile = null;
        String debugStubsFile = "";
        HashSet<String> stubPackages = null;
        SinceTagger sinceTagger = new SinceTagger();

        root = r;

@@ -518,6 +518,7 @@ public class DroidDoc
            i++;
        }

        sinceTagger.writeVersionNames(data);
        return data;
    }

+10 −6
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ public class NavTree {
        for (PackageInfo pkg: DroidDoc.choosePackages()) {
            children.add(makePackageNode(pkg));
        }
        Node node = new Node("Reference", dir + "packages.html", children);
        Node node = new Node("Reference", dir + "packages.html", children, null);

        StringBuilder buf = new StringBuilder();
        if (false) {
@@ -46,7 +46,7 @@ public class NavTree {
    private static Node makePackageNode(PackageInfo pkg) {
        ArrayList<Node> children = new ArrayList();

        children.add(new Node("Description", pkg.fullDescriptionHtmlPage(), null));
        children.add(new Node("Description", pkg.fullDescriptionHtmlPage(), null, null));

        addClassNodes(children, "Interfaces", pkg.interfaces());
        addClassNodes(children, "Classes", pkg.ordinaryClasses());
@@ -54,7 +54,7 @@ public class NavTree {
        addClassNodes(children, "Exceptions", pkg.exceptions());
        addClassNodes(children, "Errors", pkg.errors());

        return new Node(pkg.name(), pkg.htmlPage(), children);
        return new Node(pkg.name(), pkg.htmlPage(), children, pkg.getSince());
    }

    private static void addClassNodes(ArrayList<Node> parent, String label, ClassInfo[] classes) {
@@ -62,12 +62,12 @@ public class NavTree {

        for (ClassInfo cl: classes) {
            if (cl.checkLevel()) {
                children.add(new Node(cl.name(), cl.htmlPage(), null));
                children.add(new Node(cl.name(), cl.htmlPage(), null, cl.getSince()));
            }
        }

        if (children.size() > 0) {
            parent.add(new Node(label, null, children));
            parent.add(new Node(label, null, children, null));
        }
    }

@@ -75,11 +75,13 @@ public class NavTree {
        private String mLabel;
        private String mLink;
        ArrayList<Node> mChildren;
        private String mSince;

        Node(String label, String link, ArrayList<Node> children) {
        Node(String label, String link, ArrayList<Node> children, String since) {
            mLabel = label;
            mLink = link;
            mChildren = children;
            mSince = since;
        }

        static void renderString(StringBuilder buf, String s) {
@@ -136,6 +138,8 @@ public class NavTree {
            renderString(buf, mLink);
            buf.append(", ");
            renderChildren(buf);
            buf.append(", ");
            renderString(buf, mSince);
            buf.append(" ]");
        }
    }
+1 −0
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ public class PackageInfo extends DocInfo implements ContainerInfo
        ClassInfo.makeLinkListHDF(data, base + ".enums", enums());
        ClassInfo.makeLinkListHDF(data, base + ".exceptions", exceptions());
        ClassInfo.makeLinkListHDF(data, base + ".errors", errors());
        data.setValue(base + ".since", getSince());
    }

    public ClassInfo[] interfaces()
+13 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ import com.android.apicheck.*;

import java.util.*;

import org.clearsilver.HDF;

/**
 * Applies version information to the DroidDoc class model from apicheck XML
 * files. Sample usage:
@@ -45,6 +47,17 @@ public class SinceTagger {
        }
    }

    /**
     * Writes an index of the version names to {@code data}. 
     */
    public void writeVersionNames(HDF data) {
        int index = 1;
        for (String version : xmlToName.values()) {
            data.setValue("since." + index + ".name", version);
            index++;
        }
    }

    /**
     * Applies the version information to {@code classDocs} where not already
     * present.
Loading