Skip to content

Commit

Permalink
Merge pull request #86 from winterDroid/develop
Browse files Browse the repository at this point in the history
Release 0.3.1
  • Loading branch information
winterDroid committed Oct 12, 2015
2 parents 5348116 + 6813f62 commit 8c36e6c
Show file tree
Hide file tree
Showing 63,549 changed files with 156 additions and 81 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

![alt text](src/main/resources/images/menu.png "New menu")

This plugin consists of 4 main features. You can access them by **right-clicking** anywhere, but **not** on a file, inside an **Android (library) module** under **New**.
This plugin consists of three main features. You can access them by **right-clicking** anywhere, but **not** on a file, inside an **Android (library) module** under **New**.

## AndroidIcons and Material Icons Drawable Import
You are able to select the asset, specify your color, change the target resource name and select all the resolutions you want to import.
Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ intellij {
version '14.1.5'
pluginName 'android-drawable-importer-intellij-plugin'
plugins 'android'
updateSinceUntilBuild false
}

group 'de.mprengemann.intellij.plugin.androidicons'
version '0.3'
version '0.3.1'

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.google.gson.reflect.TypeToken;
import com.intellij.openapi.components.ApplicationComponent;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.util.io.ZipUtil;
import de.mprengemann.intellij.plugin.androidicons.controllers.DefaultControllerFactory;
import de.mprengemann.intellij.plugin.androidicons.controllers.IControllerFactory;
import de.mprengemann.intellij.plugin.androidicons.model.IconPack;
Expand All @@ -25,22 +26,25 @@ public class IconApplication implements ApplicationComponent {
private IControllerFactory controllerFactory;

@NotNull
@Override
public String getComponentName() {
return getClass().getName();
}

@Override
public void initComponent() {
IconPack androidIcons = null;
IconPack materialIcons = null;
try {
final File contentFile = ResourceLoader.getFile("content.json");
final File contentFile = ResourceLoader.getBundledResource("content.json");
final FileReader fileReader = new FileReader(contentFile);
final Type listType = new TypeToken<ArrayList<IconPack>>() {}.getType();
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(Resolution.class, new Resolution.Deserializer());
final Gson gson = gsonBuilder.create();
final List<IconPack> iconPacks = gson.fromJson(fileReader, listType);

final File archiveFile = ResourceLoader.getBundledResource("icon_packs.zip");
ZipUtil.extract(archiveFile, ResourceLoader.getExportPath(), null, false);
androidIcons = iconPacks.get(0);
materialIcons = iconPacks.get(1);
} catch (Exception e) {
Expand All @@ -50,6 +54,7 @@ public void initComponent() {
controllerFactory = new DefaultControllerFactory(androidIcons, materialIcons);
}

@Override
public void disposeComponent() {
controllerFactory.tearDown();
controllerFactory = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ public RefactoringTask getTask(Project project) {
selectedImageFile = getSelectedImageFile(Resolution.XXHDPI);
imageInformationBuilder.setFactor(RefactorUtils.getScaleFactor(resolution, Resolution.XXHDPI));
} else if (getSelectedIconPack().getId().equals("material_icons")) {
selectedImageFile = getSelectedImageFile(Resolution.MDPI);
imageInformationBuilder.setFactor(RefactorUtils.getScaleFactor(resolution, Resolution.MDPI));
selectedImageFile = getSelectedImageFile(Resolution.HDPI);
imageInformationBuilder.setFactor(RefactorUtils.getScaleFactor(resolution, Resolution.HDPI));
} else {
throw new IllegalStateException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public File getImageFile(ImageAsset asset, String color, String size, Resolution
color,
resolution.toString().toLowerCase(),
asset.getName());
return ResourceLoader.getFile(new File(iconPack.getPath(), localPath).getPath());
return ResourceLoader.getAssetResource(new File(iconPack.getPath(), localPath).getPath());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public File getImageFile(ImageAsset asset, String color, String size, Resolution
asset.getName(),
color,
size);
return ResourceLoader.getFile(new File(iconPack.getPath(), localPath).getPath());
return ResourceLoader.getAssetResource(new File(iconPack.getPath(), localPath).getPath());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="de.mprengemann.intellij.plugin.androidicons.dialogs.AddItemBatchScaleDialog">
<grid id="27dc6" binding="uiContainer" layout-manager="GridLayoutManager" row-count="16" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="uiContainer" layout-manager="GridLayoutManager" row-count="17" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="900" height="800"/>
Expand Down Expand Up @@ -134,29 +134,29 @@
</component>
<component id="cc3f7" class="javax.swing.JLabel">
<constraints>
<grid row="11" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Target-Name"/>
</properties>
</component>
<component id="56fa4" class="javax.swing.JLabel">
<constraints>
<grid row="12" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Target-Root"/>
</properties>
</component>
<component id="5a54a" class="de.mprengemann.intellij.plugin.androidicons.widgets.ExportNameField" binding="targetName">
<constraints>
<grid row="11" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<grid row="12" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="3d284" class="de.mprengemann.intellij.plugin.androidicons.widgets.FileBrowserField" binding="targetRoot" custom-create="true">
<constraints>
<grid row="12" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<grid row="13" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<editable value="false"/>
Expand Down Expand Up @@ -192,32 +192,42 @@
</component>
<component id="9fa77" class="javax.swing.JLabel">
<constraints>
<grid row="13" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="14" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Algorithm"/>
</properties>
</component>
<component id="169fe" class="javax.swing.JLabel">
<constraints>
<grid row="14" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="15" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Method"/>
</properties>
</component>
<component id="7f611" class="javax.swing.JComboBox" binding="algorithmSpinner">
<constraints>
<grid row="13" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<grid row="14" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="f56cf" class="javax.swing.JComboBox" binding="methodSpinner">
<constraints>
<grid row="14" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
<grid row="15" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="6b77d" class="javax.swing.JCheckBox" binding="TVDPICheckBox">
<constraints>
<grid row="11" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
<preferred-size width="541" height="20"/>
</grid>
</constraints>
<properties>
<text value="TVDPI"/>
</properties>
</component>
</children>
</grid>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class AddItemBatchScaleDialog extends DialogWrapper implements AddItemBat
private FileBrowserField targetRoot;
private JComboBox algorithmSpinner;
private JComboBox methodSpinner;
private JCheckBox TVDPICheckBox;
private IAddItemBatchScaleImporterController controller;
private final ActionListener sourceResolutionListener = new ActionListener() {
@Override
Expand Down Expand Up @@ -185,6 +186,7 @@ private void initCheckBoxes() {
XHDPICheckBox.setModel(new ResolutionButtonModel(Resolution.XHDPI));
XXHDPICheckBox.setModel(new ResolutionButtonModel(Resolution.XXHDPI));
XXXHDPICheckBox.setModel(new ResolutionButtonModel(Resolution.XXXHDPI));
TVDPICheckBox.setModel(new ResolutionButtonModel(Resolution.TVDPI));
}

private void initExportRoot() {
Expand Down Expand Up @@ -288,7 +290,8 @@ private void updateTargetResolutions() {
HDPICheckBox,
XHDPICheckBox,
XXHDPICheckBox,
XXXHDPICheckBox)) {
XXXHDPICheckBox,
TVDPICheckBox)) {
checkBox.addActionListener(resolutionActionListener);
final Resolution resolution = ((ResolutionButtonModel) checkBox.getModel()).getResolution();
checkBox.setSelected(resolutions.contains(resolution));
Expand Down
Loading

0 comments on commit 8c36e6c

Please sign in to comment.