コード例 #1
0
  public static String getFileName(Context ctx, OsmandRegions regions, String fileName) {
    String basename = getBasename(fileName);
    if (basename.endsWith(WIKI_NAME)) { // wiki files
      return getWikiName(ctx, basename);
    } else if (fileName.endsWith("tts")) { // tts files
      return getVoiceName(ctx, fileName);
    } else if (fileName.startsWith(HILL_SHADE)) {
      return getHillShadeName(ctx, regions, basename);
    } else if (fileName.length() == 2) { // voice recorded files
      try {
        Field f = R.string.class.getField("lang_" + fileName);
        if (f != null) {
          Integer in = (Integer) f.get(null);
          return ctx.getString(in);
        }
      } catch (Exception e) {
        System.err.println(e.getMessage());
      }
    }

    // if nothing else
    String lc = basename.toLowerCase();
    String std = getStandardMapName(ctx, lc);
    if (std != null) {
      return std;
    }

    if (regions != null) {
      return regions.getLocaleName(basename);
    }

    return null;
  }
コード例 #2
0
 public static String getHillShadeName(Context ctx, OsmandRegions regions, String basename) {
   String hillsh = ctx.getString(R.string.download_hillshade_item) + " ";
   String locName = regions.getLocaleName(basename.trim());
   return hillsh + locName;
 }