@Override protected ArrayList<ThemeBase> getThemeBases() { // TODO Auto-generated method stub ArrayList<ThemeBase> bases = ThemeHelper.getThemeBases(mContext, ThemeConstants.THEME_LOCAL, ThemeConstants.NOTIFY); return addDefaultTheme(bases); }
@Override protected ArrayList<ThemeBase> updateThemeBases() { // TODO Auto-generated method stub return ThemeHelper.getThemeBases(mContext, ThemeConstants.THEME_LOCAL, ThemeConstants.SETTING); }
@Override protected void parseLocalModelInfo() { File bootsRoot = new File(ThemeConstants.THEME_MODEL_NOTIFY_STYLE); File[] localBoots = bootsRoot.listFiles( new ThemeFileFilter(ThemeConstants.THEME_MODEL_NOTIFY, ThemeFileFilter.STARTSWITH)); if ((localBoots != null) && (localBoots.length != 0)) { Arrays.sort(localBoots, new ThemeFileSort()); ArrayList<ThemeBase> themePkgInfos = ThemeHelper.getThemeBases(mContext, ThemeConstants.THEME_LOCAL, ThemeConstants.NOTIFY); int length = localBoots.length; for (int i = 0; i < length; i++) { File bootsFile = localBoots[i]; String bootsName = bootsFile.getName(); String themePkg = new StringBuilder() .append(bootsName.substring(bootsName.lastIndexOf("_") + 1)) .append(ThemeConstants.BUFFIX_LWT) .toString(); /** 如果是默认主题资源,则返回 */ if (themePkg.equals(ThemeConstants.DEFAULT_THEME_PKG)) { continue; } /** 如果模块存在,但是原始lwt文件不存在的话,则视为无效模块,因为主题信息在lwt文件中 */ String lwtPath = new StringBuilder() .append(ThemeConstants.THEME_LWT) .append("/") .append(themePkg) .toString(); if (!new File(lwtPath).exists()) { continue; } ThemeModelInfo themeModelInfo = new ThemeModelInfo(themePkg); ThemeBase boots = new ThemeBase(themeModelInfo, themePkg, null, true); for (ThemeBase themePkgInfo : themePkgInfos) { if (themePkg.equals(themePkgInfo.getPkg())) { boots.setCnAuthor(themePkgInfo.getCnAuthor()); boots.setEnAuthor(themePkgInfo.getEnAuthor()); boots.setCnName(themePkgInfo.getCnName()); boots.setEnName(themePkgInfo.getEnName()); break; } } boots.setPkg(themePkg); boots.setSize(ThemeUtil.fileLengthToSize(bootsFile.length())); /** 临时FC解决办法 */ if (themeBases.size() == 0) { themeBases.add(boots); } else { themeBases.add(ThemeConstants.SECOND, boots); } } ThemeHelper.saveThemeBases( mContext, themeBases, ThemeConstants.THEME_LOCAL, ThemeConstants.NOTIFY); } }