Skip to content

Commit

Permalink
Merge pull request #84 from winterDroid/feature/tvdpi_support
Browse files Browse the repository at this point in the history
Added TVDPI as a possible density
  • Loading branch information
winterDroid committed Oct 12, 2015
2 parents 8c71596 + 17964be commit ff6957e
Show file tree
Hide file tree
Showing 9 changed files with 107 additions and 32 deletions.
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
@@ -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
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.AndroidMultiDrawableImporter">
<grid id="27dc6" binding="uiContainer" layout-manager="GridLayoutManager" row-count="17" column-count="7" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="uiContainer" layout-manager="GridLayoutManager" row-count="13" column-count="7" 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="650" height="409"/>
Expand All @@ -21,69 +21,69 @@
</component>
<component id="5ee16" 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="9" 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="Resource Name:"/>
</properties>
</component>
<component id="d77d9" class="de.mprengemann.intellij.plugin.androidicons.widgets.ExportNameField" binding="resExportName">
<constraints>
<grid row="13" column="3" row-span="1" col-span="3" vsize-policy="0" hsize-policy="4" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="9" column="3" row-span="1" col-span="3" vsize-policy="0" hsize-policy="4" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
<component id="3a3c4" class="javax.swing.JLabel">
<constraints>
<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"/>
<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"/>
</constraints>
<properties>
<text value="Resources root:"/>
</properties>
</component>
<component id="659d3" class="de.mprengemann.intellij.plugin.androidicons.widgets.FileBrowserField" binding="resRoot" custom-create="true">
<constraints>
<grid row="15" column="3" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="11" column="3" row-span="1" col-span="3" vsize-policy="0" hsize-policy="0" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="283f6" class="javax.swing.JLabel">
<constraints>
<grid row="3" 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="2" 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="MDPI Asset:"/>
</properties>
</component>
<component id="bb437" class="javax.swing.JLabel">
<constraints>
<grid row="5" 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="3" 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="HDPI Asset:"/>
</properties>
</component>
<component id="ab4d4" class="javax.swing.JLabel">
<constraints>
<grid row="7" 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="4" 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="XHDPI Asset:"/>
</properties>
</component>
<component id="ed1d6" class="javax.swing.JLabel">
<constraints>
<grid row="9" 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="5" 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="XXHDPI Asset:"/>
</properties>
</component>
<component id="c2714" class="javax.swing.JLabel" binding="imageContainer">
<constraints>
<grid row="1" column="5" row-span="11" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="5" row-span="7" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<alignmentX value="0.5"/>
Expand All @@ -103,39 +103,53 @@
</component>
<component id="7022d" class="de.mprengemann.intellij.plugin.androidicons.widgets.FileBrowserField" binding="mdpiFile" custom-create="true">
<constraints>
<grid row="3" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="2" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="97ede" class="de.mprengemann.intellij.plugin.androidicons.widgets.FileBrowserField" binding="hdpiFile" custom-create="true">
<constraints>
<grid row="5" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="3" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="5d1e3" class="de.mprengemann.intellij.plugin.androidicons.widgets.FileBrowserField" binding="xhdpiFile" custom-create="true">
<constraints>
<grid row="7" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="4" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="cb187" class="de.mprengemann.intellij.plugin.androidicons.widgets.FileBrowserField" binding="xxhdpiFile" custom-create="true">
<constraints>
<grid row="9" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="5" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="fbc8b" 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="6" 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="XXXHDPI Asset:"/>
</properties>
</component>
<component id="72b40" class="de.mprengemann.intellij.plugin.androidicons.widgets.FileBrowserField" binding="xxxhdpiFile" custom-create="true">
<constraints>
<grid row="11" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="6" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
<component id="85a8c" class="javax.swing.JLabel">
<constraints>
<grid row="7" 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="TVDPI Asset:"/>
</properties>
</component>
<component id="47129" class="de.mprengemann.intellij.plugin.androidicons.widgets.FileBrowserField" binding="tvdpiFile" custom-create="true">
<constraints>
<grid row="7" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="4" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
</component>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public class AndroidMultiDrawableImporter extends DialogWrapper implements Multi
private JLabel imageContainer;
private ExportNameField resExportName;
private JPanel uiContainer;
private FileBrowserField tvdpiFile;
private final ISettingsController settingsController;

public AndroidMultiDrawableImporter(final Project project, final Module module) {
Expand All @@ -75,6 +76,7 @@ public AndroidMultiDrawableImporter(final Project project, final Module module)
initBrowser(Resolution.XHDPI, xhdpiFile);
initBrowser(Resolution.XXHDPI, xxhdpiFile);
initBrowser(Resolution.XXXHDPI, xxxhdpiFile);
initBrowser(Resolution.TVDPI, tvdpiFile);

setTitle("Android Multi Drawable Importer");
setResizable(false);
Expand Down Expand Up @@ -179,5 +181,6 @@ private void createUIComponents() {
xhdpiFile = new FileBrowserField(FileBrowserField.IMAGE_FILE_CHOOSER);
xxhdpiFile = new FileBrowserField(FileBrowserField.IMAGE_FILE_CHOOSER);
xxxhdpiFile = new FileBrowserField(FileBrowserField.IMAGE_FILE_CHOOSER);
tvdpiFile = new FileBrowserField(FileBrowserField.IMAGE_FILE_CHOOSER);
}
}
Loading

0 comments on commit ff6957e

Please sign in to comment.