Пример #1
0
  private void copyProject() {
    Logger.print(this, "copyProject");
    try {
      defaultAndroidProjectPath = settings.getProjectPath();
      fileHandler.copyDirectory(
          new File(defaultAndroidProjectPath),
          new File(tempAndroidProjectPath),
          new FileFilter() {

            public boolean accept(File pathname) {

              fireModelChanged(new Event(null, (progress++) % 100, 0, action, PLATFORM));
              Logger.print(this, pathname.getPath());
              if (pathname.getPath().contains("src")) {
                return false;
              }
              if (pathname.getPath().contains("assets")) {
                return false;
              }
              return true;
            }
          });
    } catch (IOException ex) {
      java.util.logging.Logger.getLogger(AndroidApplicationModel.class.getName())
          .log(Level.SEVERE, null, ex);
    }
  }
Пример #2
0
  /**
   * generate Android application
   *
   * @param debug flag for using debug keys for signing
   */
  public void generate(boolean debug) {
    action = "Generating";
    progress = 0;

    prepare();

    String target;
    if (debug) {
      target = "debug";
    } else {
      target = "release";
    }

    antHelper.runAnt(tempBuildFile, target, current);
    try {
      fileHandler.copyDirectory(
          new File(tempAndroidProjectPath + "/bin"),
          getDestinationDir(),
          new FileFilter() {

            public boolean accept(File pathname) {
              final String fileName = pathname.getName().toLowerCase();

              return fileName.endsWith(".apk") || fileName.equalsIgnoreCase("bin");
            }
          });
    } catch (IOException ex) {
      java.util.logging.Logger.getLogger(AndroidApplicationModel.class.getName())
          .log(Level.SEVERE, null, ex);
    }
    fireModelChanged(new Event(null, 100, 0, "Created", PLATFORM));
  }
Пример #3
0
  private void copyAssets() throws IOException {
    fireModelChanged(new Event(null, (progress++) % 100, 0, action, PLATFORM));
    File targetAssetsFolder = new File(tempWwwPath);
    // Delete assets/www folder and recreate it.
    // Copy assets to assets/www
    fileHandler.copyDirectory(
        new File(getSelectedFolder()),
        targetAssetsFolder,
        new FileFilter() {

          public boolean accept(File pathname) {

            fireModelChanged(new Event(null, (progress++) % 100, 0, action, PLATFORM));
            return !pathname.getPath().toLowerCase().contains("phonegap.js");
          }
        });
  }