Giter Site home page Giter Site logo

dimenify's Introduction

Dimenify

An android studio plugin for creating scaled dimension values for different pixel buckets.

Usages

  • Generate for a specific dimen

    1. Locate the dimens.xml file in the editor.
    2. Move the cursor to the dimension and right click.
    3. Select Generate -> Generate alternate dimens..
    4. Insert the scale factors you want to use for conversion and click OK.
  • Generate for an entire file

    1. Locate the dimens.xml file in the project view and right click.
    2. Select 'Generate alternate dimens from file'.
    3. Insert the scale factors for conversion and click OK.

Alt Text

dimenify's People

Contributors

humblerookie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dimenify's Issues

not working as expected using Android studio 3.0.1

Using Android Studio 3.0.1 and following these steps,
Generate for a specific dimen
Locate the dimens.xml file in the editor.
Move the cursor to the dimension and right click.
Select Generate -> Generate alternate dimens..
Insert the scale factors you want to use for conversion and click OK. (Do not appear and hence no dimensions are generated)

Generate for an entire file
Locate the dimens.xml file in the project view and right click.
Select 'Generate alternate dimens from file'.
Insert the scale factors for conversion and click OK. (Scale factor appear this time, but empty dimens files are generated in respective resolution folders)

java.lang.IndexOutOfBoundsException

I always get this exception when trying to generate the dimens.

ava.lang.IndexOutOfBoundsException: Index: 5, Size: 5
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.hr.dimenify.action.AbstractDimenAction.normalizeToHashMap(AbstractDimenAction.java:192)
at com.hr.dimenify.action.GenerateSingleDimenAction.calculateAndWriteScaledValueToFiles(GenerateSingleDimenAction.java:90)
at com.hr.dimenify.action.AbstractDimenAction.fileCreationCompleteAndCheck(AbstractDimenAction.java:135)
at com.hr.dimenify.action.AbstractDimenAction.lambda$createDirectoriesAndFilesIfNeeded$0(AbstractDimenAction.java:125)
at com.intellij.openapi.command.WriteCommandAction.lambda$runWriteCommandAction$5(WriteCommandAction.java:364)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl$1.run(WriteCommandAction.java:124)
at com.intellij.openapi.application.RunResult.run(RunResult.java:35)
at com.intellij.openapi.command.WriteCommandAction.lambda$null$1(WriteCommandAction.java:265)
at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:1038)
at com.intellij.openapi.command.WriteCommandAction.lambda$performWriteCommandAction$2(WriteCommandAction.java:264)
at com.intellij.openapi.command.WriteCommandAction.lambda$doExecuteCommand$4(WriteCommandAction.java:322)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:139)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:107)
at com.intellij.openapi.command.WriteCommandAction.doExecuteCommand(WriteCommandAction.java:324)
at com.intellij.openapi.command.WriteCommandAction.performWriteCommandAction(WriteCommandAction.java:262)
at com.intellij.openapi.command.WriteCommandAction.execute(WriteCommandAction.java:244)
at com.intellij.openapi.command.WriteCommandAction$BuilderImpl.run(WriteCommandAction.java:126)
at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:364)
at com.intellij.openapi.command.WriteCommandAction.runWriteCommandAction(WriteCommandAction.java:356)
at com.hr.dimenify.action.AbstractDimenAction.createDirectoriesAndFilesIfNeeded(AbstractDimenAction.java:112)
at com.hr.dimenify.action.GenerateSingleDimenAction.showScaleDialog(GenerateSingleDimenAction.java:144)
at com.hr.dimenify.action.GenerateSingleDimenAction.initialize(GenerateSingleDimenAction.java:127)
at com.hr.dimenify.action.GenerateSingleDimenAction.actionPerformed(GenerateSingleDimenAction.java:69)
at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:255)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:272)
at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:203)
at com.intellij.ui.popup.ActionPopupStep.performAction(ActionPopupStep.java:191)
at com.intellij.ui.popup.ActionPopupStep.lambda$onChosen$2(ActionPopupStep.java:185)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:195)
at com.intellij.ui.popup.AbstractPopup.lambda$dispose$8(AbstractPopup.java:1417)
at com.intellij.util.ui.UIUtil.invokeLaterIfNeeded(UIUtil.java:3094)
at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:182)
at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:138)
at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:190)
at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.doWhenFocusSettlesDown(IdeFocusManagerImpl.java:58)
at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1411)
at com.intellij.ui.popup.WizardPopup.dispose(WizardPopup.java:160)
at com.intellij.ui.popup.list.ListPopupImpl.dispose(ListPopupImpl.java:307)
at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.dispose(PopupFactoryImpl.java:289)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:48)
at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44)
at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:138)
at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:107)
at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:182)
at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:107)
at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:151)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:129)
at com.intellij.openapi.util.Disposer.dispose(Disposer.java:125)
at com.intellij.ui.popup.WizardPopup.disposeAllParents(WizardPopup.java:263)
at com.intellij.ui.popup.list.ListPopupImpl.handleNextStep(ListPopupImpl.java:442)
at com.intellij.ui.popup.list.ListPopupImpl._handleSelect(ListPopupImpl.java:396)
at com.intellij.ui.popup.list.ListPopupImpl.handleSelect(ListPopupImpl.java:342)
at com.intellij.ui.popup.PopupFactoryImpl$ActionGroupPopup.handleSelect(PopupFactoryImpl.java:309)
at com.intellij.ui.popup.list.ListPopupImpl$MyMouseListener.mouseReleased(ListPopupImpl.java:501)
at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:290)
at java.awt.Component.processMouseEvent(Component.java:6548)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3325)
at com.intellij.ui.popup.list.ListPopupImpl$MyList.processMouseEvent(ListPopupImpl.java:552)
at java.awt.Component.processEvent(Component.java:6313)
at java.awt.Container.processEvent(Container.java:2237)
at java.awt.Component.dispatchEventImpl(Component.java:4903)
at java.awt.Container.dispatchEventImpl(Container.java:2295)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
at java.awt.Container.dispatchEventImpl(Container.java:2281)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4725)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
at java.awt.EventQueue.access$500(EventQueue.java:98)
at java.awt.EventQueue$3.run(EventQueue.java:715)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:737)
at java.awt.EventQueue$4.run(EventQueue.java:735)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:817)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:754)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:394)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

Generate option doen't appear.

Hi,

The plugin is not working for me in Android Studio (version 3.4.2).

I have installed the plugin dimenify.jar in my project in Android Studio and added the next line to my gradle file: implementation project(path: ':dimenify-plugin' )
After that I synced the gradle file and rebuild my project.
Still the generate option after right click in my dimens.xml does not appear.
What could cause this?
Thank you in advance, Marc

Code Cleanup

The code currently is purely functional and seems like a nightmare. Need to make this more readable. All PR's are welcome

String value in dimens file

The resultant dimens files for xhdpi, xxhdpi and so on contains , in some dp values like "76,8dp". This is not allowing to compile the program indicating a String value is not allowed.

Why is there a , in some values? Even if it is to be considered as 76.8dp, there are values 10.8dp being generated at the same time. Even if I wanted to ignore and replace ',' with a '.' , there are values 1,008.4dp.

Bulk generate dimen values

Current functionality allows only one at a time conversion. Need a way to bulk convert an entire dimension file.

Can't find Generate option

I have Android studio 3, I install this plugin , but when right click on dimens , I can't see Generate alternate dimens option. Please help .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.