Android Open Source - MobileCodeGenerator App 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.
 * //from w  w w.ja  v a 2s .c o m
 * 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 app_extensions;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;

public class AppJavaUtil {
  public static String APPLICATION_NAME;
  
  public static void saveApplicationName(String applicationName){
    APPLICATION_NAME = applicationName;
  }
  
  public static List<String> userFilesNames(){
    File folder = new File("utils/user_files");
    List<String> userFilesNames = new ArrayList<String>();
    for(File source : folder.listFiles()){
        userFilesNames.add(source.getName());
    }
    return userFilesNames;
  }

  public static void copyFile(File source, File destination){
    try{
      if(!destination.exists()){
        destination.createNewFile();
      }
      InputStream in = new FileInputStream(source);
      OutputStream out = new FileOutputStream(destination);
      byte[] buffer = new byte[1024];
      int length;
      while((length=in.read(buffer))>0){
        out.write(buffer, 0, length);
      }
      in.close();
      out.close();
    }
    catch(FileNotFoundException e){
      e.printStackTrace();
    } 
    catch (IOException e) {
      e.printStackTrace();
    }
  }
  
  public static void deleteFolder(File folder) {
      File[] files = folder.listFiles();
      if(files!=null) {
          for(File f: files) {
              if(f.isDirectory()) {
                  deleteFolder(f);
              } else {
                  f.delete();
              }
          }
      }
      folder.delete();
  }
}




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