Android Open Source - MobileCodeGenerator Android Java Util






From Project

Back to project page MobileCodeGenerator.

License

The source code is released under:

GNU General Public License

If you think the Android project MobileCodeGenerator listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/************************************************************************************************************************
 * Copyright 2013 Gregorio Perego, Stefania Pezzetti
 * This file is part of it.polimi.mobilecodegenerator.
 * // w  ww  .  j a va  2 s .c om
 * it.polimi.mobilecodegenerator is free software: 
 * you can redistribute it and/or modify it under the terms of the 
 * GNU General Public License as published by the Free Software Foundation, 
 * either version 3 of the License, or (at your option) any later version.
 * 
 * it.polimi.mobilecodegenerator is distributed in the hope that it will be useful, 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
 * See the GNU General Public License for more details.You should have received a copy of the GNU General Public License
 * along with it.polimi.mobilecodegenerator. If not, see <http://www.gnu.org/licenses/>
 * ***********************************************************************************************************************/

package android_extensions;

import java.io.File;

import app_extensions.AppJavaUtil;

public class AndroidJavaUtil {
  
  //deletes application code folder and its content (if already exists)
  public static void deleteApplicationFolder(){
    File androidAppFolder = new File(AndroidConstants.destinationFilesFolder);
    AppJavaUtil.deleteFolder(androidAppFolder);
  }
  
  public static void copyUserFiles(){
    File folder = new File("utils/user_files");
    for(File source : folder.listFiles()){
      String sourceFileName = source.getName();
      String sourceFileExtension = source.getName().split("\\.")[1];
      if(sourceFileExtension.equalsIgnoreCase("html") || sourceFileExtension.equalsIgnoreCase("txt")){
        File destination = new File(AndroidConstants.rawFolder+"/"+sourceFileName);
        AppJavaUtil.copyFile(source, destination);
      }
      else if(sourceFileExtension.equalsIgnoreCase("css")){
        File destination = new File(AndroidConstants.assetsFolder+"/"+sourceFileName);
        AppJavaUtil.copyFile(source, destination);
      }
      else if(sourceFileExtension.equalsIgnoreCase("png") || sourceFileExtension.equalsIgnoreCase("jpg") || sourceFileExtension.equalsIgnoreCase("gif")){
        File destination = new File(AndroidConstants.drawableFolder+"/"+sourceFileName);
        AppJavaUtil.copyFile(source, destination);
      }
      else if(sourceFileExtension.equalsIgnoreCase("mp4") || sourceFileExtension.equalsIgnoreCase("3gp")){
        File destination = new File(AndroidConstants.rawFolder+"/"+sourceFileName);
        AppJavaUtil.copyFile(source, destination);
      }
      else if(sourceFileExtension.equalsIgnoreCase("mp3")){
        File destination = new File(AndroidConstants.assetsFolder+"/"+sourceFileName);
        AppJavaUtil.copyFile(source, destination);
      }
    }
  }
  
  public static void copyDefaultAndroidFiles(){
    new File(AndroidConstants.destinationFilesFolder+"/libs").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/assets").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/drawable").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/drawable-hdpi").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/drawable-mdpi").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/drawable-xhdpi").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/drawable-xxhdpi").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/menu").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/raw").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/values").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/values-v11").mkdirs();
    new File(AndroidConstants.destinationFilesFolder+"/res/values-v14").mkdirs();
    
    for(int i=0; i<AndroidConstants.sourceFilesPaths.length; i++){
      File source = new File(AndroidConstants.sourceFilesPaths[i]);
      File destination = new File(AndroidConstants.destinationFilesPaths[i]);
      AppJavaUtil.copyFile(source, destination);
    }
  }
}




Java Source Code List

android_extensions.AndroidConstants.java
android_extensions.AndroidJavaUtil.java
app_extensions.AppJavaUtil.java
ios_extensions.IOSConstants.java
ios_extensions.IOSJavaUtil.java
it.polimi.multimedia.AudioListActivity.java
it.polimi.multimedia.AudioListActivity.java
it.polimi.multimedia.AudioPlayerActivity.java
it.polimi.multimedia.AudioPlayerActivity.java
it.polimi.multimedia.AudioRecorderActivity.java
it.polimi.multimedia.AudioRecorderActivity.java
it.polimi.multimedia.GalleryActivity.java
it.polimi.multimedia.GalleryActivity.java
it.polimi.multimedia.MenuActivity.java
it.polimi.multimedia.MenuActivity.java
it.polimi.multimedia.PhotoGridActivity.java
it.polimi.multimedia.PhotoGridActivity.java
it.polimi.multimedia.PhotoViewerActivity.java
it.polimi.multimedia.PhotoViewerActivity.java
it.polimi.multimedia.PhotocameraActivity.java
it.polimi.multimedia.PhotocameraActivity.java
it.polimi.multimedia.Utils.java
it.polimi.multimedia.Utils.java
it.polimi.multimedia.VideoListActivity.java
it.polimi.multimedia.VideoListActivity.java
it.polimi.multimedia.VideoViewerActivity.java
it.polimi.multimedia.VideoViewerActivity.java
it.polimi.multimedia.VideocameraActivity.java
it.polimi.multimedia.VideocameraActivity.java
it.polimi.promemoria.HomeActivity.java
it.polimi.promemoria.NoteDetailActivity.java
it.polimi.promemoria.NotesListActivity.java
it.polimi.promemoria.Utils.java
it.polimi.valtellina.DescriptionActivity.java
it.polimi.valtellina.DescriptionActivity.java
it.polimi.valtellina.ImageDownloadingTask.java
it.polimi.valtellina.ImageDownloadingTask.java
it.polimi.valtellina.MenuActivity.java
it.polimi.valtellina.MenuActivity.java
it.polimi.valtellina.TurismLocationDetailActivity.java
it.polimi.valtellina.TurismLocationDetailActivity.java
it.polimi.valtellina.TurismLocationsListActivity.java
it.polimi.valtellina.TurismLocationsListActivity.java
it.polimi.valtellina.Utils.java
it.polimi.valtellina.Utils.java
it.polimi.valtellina.VideoActivity.java
it.polimi.valtellina.VideoActivity.java
model_checks.JavaChecks.java