public void loadConfiguration(Configuration configuration) { imagesList.clear(); String directory = configuration.getDirectory(); int maxSize = ImageHolder.coerceInteger(configuration.getMaxSize()); if (directory != null && !directory.isEmpty()) { File dir = new File(directory); File[] files = dir.listFiles( new FilenameFilter() { @Override public boolean accept(File dir, String name) { String lowerName = name.toLowerCase(); return lowerName.endsWith(".jpg") || lowerName.endsWith(".png") || lowerName.endsWith(".gif"); } }); if (files != null && files.length > 0) { imagesList.ensureCapacity(files.length); for (File file : files) { if (file.isFile()) { imagesList.add(new ImageHolder(file, maxSize)); } } imagesList.trimToSize(); } } boolean useTimer = configuration.isUseTimer(); if (useTimer) { if (timer.isRunning()) { timer.restart(); } else { timer.start(); } } else { if (timer.isRunning()) { timer.stop(); } } for (Editor editor : editorsList) { loadImage(editor); } }