Resolve theme resource id by flags
545367
public static int getThemeResource(int themeTag, boolean applyModifier) {
        if (themeTag >= _START_RESOURCES_ID) {
            return themeTag;
        }
        themeTag = prepareFlags(themeTag, applyModifier);
        if (ThemeManager.sThemeGetters != null) {
            int getterResource;
            final ThemeTag tag = new ThemeTag(themeTag);
            for (int i = ThemeManager.sThemeGetters.size() - 1; i >= 0; i--) {
                getterResource = ThemeManager.sThemeGetters.get(i).getThemeResource(tag);
                if (getterResource != 0) {
                    return getterResource;
                }
            }
        }
        final int i = _THEMES_MAP.get(themeTag, -1);
        if (i == -1) {
            return _THEMES_MAP.get(_DEFAULT_THEME, R.style.Holo_Theme);
        } else {
            return i;
        }
    }
191325
public static String getXAResourceEndFlagString(int flag) {
        switch (flag) {
            case XAResource.TMFAIL:
                return "TMFAIL (" + flag + ')'; 

            case XAResource.TMSUCCESS:
                return "TMSUCCESS (" + flag + ')'; 

            case XAResource.TMSUSPEND:
                return "TMSUSPEND (" + flag + ')'; 
        }

        return "UNKNOWN XA RESOURCE END FLAG (" + flag + ')'; 
    }
620829
def makeStylesheetResource(self, path, registry):
        
        return StylesheetRewritingResourceWrapper(
            File(path), self.installedOfferingNames, self.rootURL)
1149004
def _resolve_resource_name(self, name):
        """"""
        if name[:4] == 'http':  # already a url
            return name
        name = name.rstrip('/').lstrip('/')
        return '%s%s/%s' % (self.scheme, self.host, name)
721011
def _set_flag(self, flag):
        """"""
        self.folder._invalidate_cache()
        # TODO::: turn the flag off when it's already on
        def replacer(m):
            return "%s/%s.%s%s" % (
                joinpath(self.folder.base, self.folder.folder, "cur"),
                m.group("key"),
                m.group("hostname"),
                ":2,%s" % (
                    "%s%s" % (m.group("flags"), flag) if m.group("flags") \
                        else flag
                    )
                )
        newfilename = self.msgpathre.sub(replacer, self.filename)
        self.filesystem.rename(self.filename, newfilename)
        self.filename = newfilename
297701
public function themePath(string $resource): string
    {
        if (null === $this->theme) {
            return $resource;
        }

        if (file_exists($this->sourceDirectory.'/'.$resource)) {
            return $resource;
        }

        $themeResource = $this->findThemeResource($this->theme, $resource);
        if (null !== $themeResource) {
            return $themeResource;
        }

        if (isset($this->theme['parent'])) {
            $themeResource = $this->findThemeResource($this->theme['parent'], $resource);
            if (null !== $themeResource) {
                return $themeResource;
            }
        }

        return $resource;
    }
21516
private void obtainWidth(@StyleRes final int themeResourceId) {
        TypedArray typedArray = getContext().getTheme()
                .obtainStyledAttributes(themeResourceId, new int[]{R.attr.materialDialogWidth});
        int defaultValue = getContext().getResources().getDimensionPixelSize(R.dimen.dialog_width);

        try {
            setWidth(typedArray.getDimensionPixelSize(0, defaultValue));
        } catch (Resources.NotFoundException | UnsupportedOperationException e) {
            setWidth(typedArray.getInteger(0, defaultValue));
        }
    }
95265
function View_resolve(toPath, fromPath) {
            var file = di.normalizePath(toPath),
                themes = this.config.themes.slice(),
                theme,
                re,
                filePath,
                normalizers = this.normalizers.slice(),
                isNormalized = false,
                path,
                pathRegex,
                pathReplace,
                trace = [];

            // file name normalizers
            while (normalizers.length) {
                path = di.normalizePath(normalizers.shift());
                pathReplace = path.replace(/\\/g, '\\\\');
                pathRegex = new RegExp(pathReplace);
                if (file.match(pathRegex)) {
                    file = file.replace(pathRegex, '').replace(this.suffix, '');
                    isNormalized = true;
                    break;
                }
            }
            // try normalize fromPath
            if (!isNormalized && !!fromPath) {
                normalizers = this.normalizers.slice();
                fromPath = di.normalizePath(fromPath);
                // file name normalizers
                while (normalizers.length) {
                    path = di.normalizePath(normalizers.shift());
                    pathReplace = path.replace(/\\/g, '\\\\');
                    pathRegex = new RegExp(pathReplace);
                    if (fromPath.match(pathRegex)) {
                        isNormalized = true;
                        break;
                    }
                }
            }

            // check themes
            if (isNormalized) {
                while (themes.length) {
                    theme = di.normalizePath(themes.shift() + '/');
                    pathReplace = theme.replace(/\\/g, '\\\\');
                    re = new RegExp('^' + pathReplace);
                    file = file.replace(re, '');

                    filePath = di.normalizePath(path + theme + '/' + file + this.config.suffix);
                    if (this.isFile(filePath)) {
                        return filePath;
                    }
                    trace.push({
                        theme: theme,
                        path: path,
                        filePath: filePath
                    });
                }
            }


            throw new error.HttpError(500, {
                from: fromPath,
                load: toPath,
                filePath: filePath,
                paths: this.paths,
                isNormalized: isNormalized,
                file: file,
                path: path,
                trace: trace,
                themes: this.config.themes
            }, "View.resolve: template don't exists");
        }
827125
private void initialize(@StyleRes final int themeResourceId) {
        int themeId = themeResourceId;

        if (themeId == 0) {
            TypedValue typedValue = new TypedValue();
            getContext().getTheme().resolveAttribute(R.attr.materialDialogTheme, typedValue, true);
            themeId = typedValue.resourceId;
            themeId = themeId != 0 ? themeId : R.style.MaterialDialog_Light;
        }

        setContext(new ContextThemeWrapper(getContext(), themeId));
        this.themeResourceId = themeId;
        obtainStyledAttributes(themeId);
    }
1207706
def resource(resource_id):
    """"""
    resource_obj = app.db.resource(resource_id)

    if 'raw' in request.args:
        return send_from_directory(os.path.dirname(resource_obj.path),
                                   os.path.basename(resource_obj.path))

    return render_template('resource.html', resource=resource_obj)
947102
function renderThemeTree(themeId, fileList, themeName) {
        var getTreeNodes = function (arr) {
            var ret = [];
            _.each(arr, function (fileName) {
                ret.push({title:fileName});
            });
            return ret;
        };
        var css = {title:validTitleName[0], isFolder:true, children:getTreeNodes(fileList["css"])},
            js = {title:validTitleName[1], isFolder:true, children:getTreeNodes(fileList["js"])},
            images = {title:validTitleName[2], isFolder:true, children:getTreeNodes(fileList["images"])},
            tmpl = {title:validTitleName[3], isFolder:true, children:getTreeNodes(fileList["tmpl"])},
            children = [css, images, js, tmpl];
        tree = treeObj.dynatree({
                onActivate:function (node) {
                    var data = node.data;
                    if (!data.isFolder) {
                        openFile(themeId, node.parent.data.title, data.title);
                    }
                    else {
                        hideEditor();
                        hideImageHolder();
                    }
                },
                children:{title:themeName, children:children, isFolder:true, expand:true}
            }
        );
        $(tree).dynatree("getTree").reload();
    }
162175
private function init_theme_providers()
    {
        foreach (Config::get('services.theme_providers') as $class_name) {
            if (\is_subclass_of($class_name, \Snap\Services\Service_Provider::class)) {
                $provider = Container::resolve($class_name);
                Container::resolve_method($provider, 'register');
                return;
            }
        }
    }
1140706
private void obtainWindowBackground(@StyleRes final int themeResourceId) {
        TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId,
                new int[]{R.attr.materialDialogWindowBackground});
        int resourceId = typedArray.getResourceId(0, 0);

        if (resourceId != 0) {
            setWindowBackground(resourceId);
        } else {
            setWindowBackground(R.drawable.material_dialog_background);
        }
    }
1310350
function getThemeId(configName) {
    // Search for plugin configured theme
    var configTheme = $.grep(THEMES, function(theme) {
      return theme.config == configName;
    })[0];
    // Fallback to default theme
    return !!configTheme ? configTheme.id : 0;
  }
355550
def get_resource_id(self):
        
        # Implemented from template for osid.resource.Resource.get_avatar_id_template
        if not bool(self._my_map['resourceId']):
            raise errors.IllegalState('this Authorization has no resource')
        else:
            return Id(self._my_map['resourceId'])
161901
def get_file_flags(flags):
    
    res = render_flags(flags & ~rf.RAR_FILE_DICTMASK, file_bits)

    xf = (flags & rf.RAR_FILE_DICTMASK) >> 5
    res += "," + file_parms[xf]
    return res
136405
private void obtainTitleColor(@StyleRes final int themeResourceId) {
        TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(themeResourceId,
                new int[]{R.attr.materialDialogTitleColor});
        int defaultColor =
                ThemeUtil.getColor(getContext(), themeResourceId, android.R.attr.textColorPrimary);
        setTitleColor(typedArray.getColor(0, defaultColor));
    }