Skip to content

Commit

Permalink
Merge pull request #98 from winterDroid/develop
Browse files Browse the repository at this point in the history
Release 0.3.3
  • Loading branch information
winterDroid committed Oct 29, 2015
2 parents 30bde59 + 3fe2560 commit 235917a
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ hs_err_pid*

### Specific ###
*.zip
!icon_packs.zip
!libs/*

### Maven ###
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "org.jetbrains.intellij" version "0.0.23"
id "org.jetbrains.intellij" version "0.0.25"
}

apply plugin: 'org.jetbrains.intellij'
Expand All @@ -15,7 +15,7 @@ intellij {
}

group 'de.mprengemann.intellij.plugin.androidicons'
version '0.3.2'
version '0.3.3'

repositories {
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
org.gradle.jvmargs=-XX:MaxPermSize=4g -XX:+HeapDumpOnOutOfMemoryError -Xmx4g
# org.gradle.jvmargs=-XX:MaxPermSize=4g -XX:+HeapDumpOnOutOfMemoryError -Xmx4g
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.mprengemann.intellij.plugin.androidicons.controllers.batchscale.additem;

import com.google.common.base.Objects;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import de.mprengemann.intellij.plugin.androidicons.images.ResizeAlgorithm;
Expand All @@ -12,7 +13,6 @@
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
Expand All @@ -21,6 +21,7 @@

public class AddItemBatchScaleImporterController implements IAddItemBatchScaleImporterController {

private static final Logger LOGGER = Logger.getInstance(AddItemBatchScaleImporterController.class);
private Set<AddItemBatchScaleDialogObserver> observers;
private Set<Resolution> targetResolutions;
private Resolution sourceResolution;
Expand Down Expand Up @@ -75,14 +76,15 @@ public AddItemBatchScaleImporterController(Resolution sourceResolution, List<Ima

private void init(File file) {
try {
LOGGER.info(String.format("Adding file %s", file));
BufferedImage image = ImageIO.read(file);
imageFile = file;
originalImageWidth = image.getWidth();
targetWidth = image.getWidth();
targetHeight = image.getHeight();
aspectRatio = (float) image.getHeight() / (float) originalImageWidth;
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
LOGGER.error(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,17 @@ public class AndroidBatchScaleImporter extends DialogWrapper implements BatchSca
false,
false) {
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return file.getFileType() == imageFileType;
if (file.isDirectory()) {
return super.isFileVisible(file, showHiddenFiles);
}
return file.getFileType().equals(imageFileType);
}

public boolean isFileSelectable(VirtualFile file) {
return super.isFileSelectable(file) && file.getFileType() == imageFileType;
if (file.isDirectory()) {
return super.isFileSelectable(file);
}
return super.isFileSelectable(file) && file.getFileType().equals(imageFileType);
}
};
private final Project project;
Expand Down Expand Up @@ -120,12 +126,11 @@ public void actionPerformed(ActionEvent actionEvent) {
FileChooser.chooseFile(imageDescriptor, project, getInitialFile(), new Consumer<VirtualFile>() {
@Override
public void consume(final VirtualFile file) {
container.getControllerFactory()
.getSettingsController()
.saveLastImageFolder(project, file.getCanonicalPath());
AddItemBatchScaleDialog addItemBatchScaleDialog =
new AddItemBatchScaleDialog(project, module, controller, file);
addItemBatchScaleDialog.show();
if (!file.isDirectory()) {
addSingleFile(file);
} else {
addMultipleFiles(Arrays.asList(file));
}
}
});
}
Expand Down Expand Up @@ -176,12 +181,15 @@ public void dropFiles(final List<VirtualFile> virtualFiles) {
}

private void addMultipleFiles(List<VirtualFile> virtualFiles) {
for (VirtualFile file : virtualFiles) {
for (final VirtualFile file : virtualFiles) {
if (file.isDirectory()) {
VfsUtilCore.visitChildrenRecursively(file, new VirtualFileVisitor() {
@Override
public boolean visitFile(@NotNull VirtualFile file) {
addSingleFileImmediately(file);
public boolean visitFile(@NotNull VirtualFile child) {
if (file.equals(child)) {
return true;
}
addMultipleFiles(Arrays.asList(child));
return true;
}
});
Expand All @@ -192,6 +200,9 @@ public boolean visitFile(@NotNull VirtualFile file) {
}

private void addSingleFileImmediately(VirtualFile file) {
if (!file.getFileType().equals(imageFileType)) {
return;
}
// Hack
String path = file.getCanonicalPath();
if (path == null) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<idea-plugin version="2">
<id>de.mprengemann.intellij.plugin.androidicons</id>
<name>Android Drawable Importer</name>
<version>0.3.2</version>
<vendor email="[email protected]" url="https://plus.google.com/+MarcPrengemann">Marc Prengemann</vendor>
<description><![CDATA[
This plugin consists of three main features. You can access them by a right-click anywhere, but <b>not on a file</b>, inside an Android module under New.<br><br>
Expand Down Expand Up @@ -45,7 +44,8 @@
- Bundled icon packs to prevent own download and to get rid of the settings<br>
- Show actions on library modules<br>
- Add TVDPI as suitable export density<br>
- Fix for Windows where the bundled resources couldn't be loaded
- Fix for Windows where the bundled resources couldn't be loaded<br>
- Fix for image asset selection in batch importer on Windows
]]>
</change-notes>

Expand Down
Binary file added src/main/resources/assets/icon_packs.zip
Binary file not shown.

0 comments on commit 235917a

Please sign in to comment.