Ejemplo n.º 1
0
  private void changePackage() {
    defaultAndroidProjectPath = settings.getProjectPath();
    // File androidPhonegapFolder = new File(installDirectory +
    // "/PhonegapSDK/Default/android/src/com/phonegap");
    File androidPhonegapFolder = new File(defaultAndroidProjectPath + "/src/com/phonegap");
    System.out.println("Folder: " + androidPhonegapFolder.getPath());
    File[] files =
        androidPhonegapFolder.listFiles(
            new FileFilter() {

              public boolean accept(File pathname) {
                fireModelChanged(new Event(null, (progress++) % 100, 0, action, PLATFORM));
                if (pathname.getPath().endsWith("java")) {
                  return true;
                }
                return false;
              }
            });
    System.out.println("Package: " + getPackageName());
    for (int i = 0; files != null && i < files.length; i++) {
      File file = files[i];
      fileHandler.changePackage(phonegapPackage, getPackageName(), new File(tempSrcPath), file);
    }
    File manifestXml = new File(tempManifestPath);
    fileHandler.changeStringInFile(phonegapPackage, getPackageName(), manifestXml);
  }
Ejemplo n.º 2
0
  public AndroidApplicationModel(Settings settings) {
    super(PLATFORM, settings);

    this.settings = settings;
    this.installDirectory = RegistryHandler.getInstallDir();
    this.tempPath = System.getProperty("java.io.tmpdir");
    // this.defaultAndroidProjectPath = installDirectory + "/PhonegapSDK/Default/android";
    this.defaultAndroidProjectPath = settings.getProjectPath();
    this.tempAndroidProjectPath = tempPath + "/android";
    this.tempBuildFile = new File(tempPath + "/android/" + "build.xml");
    this.tempWwwPath = tempAndroidProjectPath + "/assets/www";
    this.tempManifestPath = tempAndroidProjectPath + "/AndroidManifest.xml";
    this.tempSrcPath = tempAndroidProjectPath + "/src/";
    this.tempStringsPath = tempAndroidProjectPath + "/res/values/strings.xml";
    this.tempDrawableFolder = tempAndroidProjectPath + "/res/drawable";
    this.buildProperties = tempAndroidProjectPath + "/build.properties";

    this.antListener = new AntListener();
    this.fileHandler = new FileHandler();
    this.cmdHelper = new CmdHelper();
    cmdHelper.addListener(this);
    antHelper = new AntHelper();
    antHelper.addBuildListener(antListener);
    current = new AntClassLoader(null, Path.systemClasspath);
    androidKeys = settings.getAndroidKeys();
  }
Ejemplo n.º 3
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);
    }
  }