@Override
 protected void attachLabel(ThemeBase themeBase, int position) {
   if (sharedPreferences
       .getString("setting", ThemeConstants.DEFAULT_THEME_PKG)
       .equals(themeBase.getPkg())) {
     statusFlags.put(position, statusFlagBitmap);
   }
 }
 @Override
 protected String getThumbnailPath(ThemeBase themeBase) {
   // TODO Auto-generated method stub
   //        return null;
   return new StringBuilder()
       .append(ThemeConstants.THEME_LOCAL_THUMBNAIL)
       .append("/")
       .append(ThemeConstants.THEME_THUMBNAIL_SETTING_PREFIX)
       .append(ThemeUtil.getNameNoBuffix(themeBase.getPkg()))
       .toString();
 }
예제 #3
0
  @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);
    }
  }