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

Commit 3a198337 authored by Kenny Root's avatar Kenny Root
Browse files

Multiple asset adding in one shot for AssetManager

Add a hidden convenience method to allow adding multiple assets
to an AssetManager at once.

Change-Id: I56753a85904a2c8e9a405cba2ea3cb85ec40e1cc
parent 051ab623
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -571,6 +571,26 @@ public final class AssetManager {
     */
    public native final int addAssetPath(String path);

    /**
     * Add multiple sets of assets to the asset manager at once.  See
     * {@link #addAssetPath(String)} for more information.  Returns array of
     * cookies for each added asset with 0 indicating failure, or null if
     * the input array of paths is null.
     * {@hide}
     */
    public final int[] addAssetPaths(String[] paths) {
        if (paths == null) {
            return null;
        }

        int[] cookies = new int[paths.length];
        for (int i = 0; i < paths.length; i++) {
            cookies[i] = addAssetPath(paths[i]);
        }

        return cookies;
    }

    /**
     * Determine whether the state in this asset manager is up-to-date with
     * the files on the filesystem.  If false is returned, you need to