Android Studio plugin which automatically generates drawable selectors from appropriately named resources.

Overview

SelectorChapek for Android

This Android Studio plugin automatically generates drawable selectors from appropriately named Android resources.

How to install it:

  • in Android Studio: go to Preferences→Plugins→Browse repositories and search for SelectorChapek

or

  • download it and install via Preferences→Plugins→Install plugin from disk

How to use it:

  1. Right-click folder with your resources e.g 'drawable-xhdpi'

  1. Select 'Generate Android Selectors'

  1. All selectors automagically appear in the 'drawable' folder!

Naming convention:

In order of plugin to work, resources need to be appropriately named. The plugin supports png or nine-patch files with certain suffices anywhere in the file name. You can also combine any suffixes together.

Mapping

File name suffix Drawable state
_normal (default state)
_pressed state_pressed
_focused state_focused
_disabled state_enabled (false)
_checked state_checked
_selected state_selected
_hovered state_hovered
_checkable state_checkable
_activated state_activated
_windowfocused state_window_focused

Wishlist

  • UI which will tell you which selectors will be generated
  • possibility to change naming mapping

Pull requests are welcomed!

Why 'Chapek'?

Karel Čapek was a famous Czech writer, inventor of the word 'robot'. The word comes from Czech word 'robota', which means 'hard manual labor'. As with Čapek's robots, this plugin will remove your unnecessary manual labor.

See our other Czech personalities who help with #AndroidDev.

You might also like...
This is an android studio plugin that allows you to creates new color in hex format based on a percentage (0-100) and a base color you specify.

alpha-color Description This is an android studio plugin that allows you to creates new color in hex format based on a percentage (0-100) and a base c

A plugin for Android Studio that speeds up your day-to-day flutter development.

Flutter-Toolkit 中文文档 A plugin for Android Studio that speeds up your day-to-day flutter development. Flutter ToolKit(Flutter Build Runner Helper), to

[Deprecated] Android Studio IDE support for Android gradle unit tests. Prepared for Robolectric.
[Deprecated] Android Studio IDE support for Android gradle unit tests. Prepared for Robolectric.

#[Deprecated] Google has finally released a proper solution for unit testing. Therefore this plugin will no longer be activlty maintained. android-stu

Android Studio plug-in for generating ButterKnife injections from selected layout XML.
Android Studio plug-in for generating ButterKnife injections from selected layout XML.

ButterKnifeZelezny Simple plug-in for Android Studio/IDEA that allows one-click creation of Butterknife view injections. How to install in Android Stu

An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play.

DroidLane An Android Studio / IntelliJ plug-in help you upload your apk or listing to Google Play. Installation Open Android Studio or IntelliJ IDEA O

gradle-android-scala-plugin adds scala language support to official gradle android plugin

gradle-android-scala-plugin gradle-android-scala-plugin adds scala language support to official gradle android plugin. See also sample projects at htt

eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.
eventbus-intellij-plugin 3.8 0.0 L1 Java Plugin to navigate between events posted by EventBus.

eventbus-intellij-plugin Plugin to navigate between events posted by EventBus. Post to onEvent and onEvent to Post Install There are two ways. Prefere

IntelliJ Idea Astor Plugin is a plugin that integrates Astor in Intellij Idea

IntelliJ Idea Astor Plugin IntelliJ Idea Astor Plugin is a plugin that integrates Astor in Intellij Idea. It communicates with a local/remote program

Intellij-platform-plugin-template - IntelliJ Platform Plugin Template
Intellij-platform-plugin-template - IntelliJ Platform Plugin Template

IntelliJ Platform Plugin Template TL;DR: Click the Use this template button and

Comments
  • update failed for AnAction(SelectorChapekAction, id=android-selector-chapek) with text=Generate Android Selectors

    update failed for AnAction(SelectorChapekAction, id=android-selector-chapek) with text=Generate Android Selectors

    I installed the plugin

    When right click on drawable-xhdpi, getting this pluggin crash.

    Here is the crash log

    update failed for AnAction(SelectorChapekAction, id=android-selector-chapek) with text=Generate Android Selectors
    
    java.lang.NoClassDefFoundError: com/intellij/openapi/actionSystem/DataKeys
    	at SelectorChapekAction.update(SelectorChapekAction.java:55)
    	at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performDumbAwareUpdate$0(ActionUtil.java:131)
    	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.java:145)
    	at com.intellij.openapi.actionSystem.impl.ActionUpdater.doUpdate(ActionUpdater.java:637)
    	at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$updateActionReal$7(ActionUpdater.java:129)
    	at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$callAction$9(ActionUpdater.java:200)
    	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:57)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:624)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:698)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:646)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:623)
    	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
    	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:57)
    	at com.intellij.openapi.actionSystem.impl.ActionUpdater.lambda$callAction$10(ActionUpdater.java:198)
    	at com.intellij.openapi.actionSystem.impl.ActionUpdateEdtExecutor.lambda$computeOnEdt$0(ActionUpdateEdtExecutor.java:45)
    	at com.intellij.openapi.application.TransactionGuardImpl$2.run(TransactionGuardImpl.java:199)
    	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:805)
    	at com.intellij.openapi.application.impl.ApplicationImpl.lambda$invokeLater$4(ApplicationImpl.java:348)
    	at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:82)
    	at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:131)
    	at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:47)
    	at com.intellij.openapi.application.impl.FlushQueue$FlushNow.run(FlushQueue.java:187)
    	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
    	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    	at java.base/java.security.AccessController.doPrivileged(Native Method)
    	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
    	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:891)
    	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:760)
    	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:447)
    	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:818)
    	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:446)
    	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:805)
    	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:492)
    	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
    Caused by: java.lang.ClassNotFoundException: com.intellij.openapi.actionSystem.DataKeys PluginClassLoader(plugin=PluginDescriptor(name=SelectorChapek for Android, id=eu.inmite.android.plugin.selectorchapek, descriptorPath=plugin.xml, path=~\AppData\Roaming\Google\AndroidStudio2021.3\plugins\android-selector-chapek, version=1.0.2, package=null, isBundled=false), packagePrefix=null, instanceId=11, state=active)
    	at com.intellij.ide.plugins.cl.PluginClassLoader.loadClass(PluginClassLoader.java:235)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    	... 44 more
    

    Android Studio version Android Studio Dolphin | 2021.3.1 Patch 1 Build #AI-213.7172.25.2113.9123335, built on September 30, 2022 Runtime version: 11.0.13+0-b1751.21-8125866 amd64

    Windows 11

    opened by qadirsuh 0
  • After clicked the item

    After clicked the item "Generate Android Selectors" and nothing worked for me.

    My Gradle: dependencies { classpath 'com.android.tools.build:gradle:3.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
    
    opened by SuperBeagleDog 1
  • Plug doesn't work with AS 2.3+,and reports NullPointerException.

    Plug doesn't work with AS 2.3+,and reports NullPointerException.

    I tested the origin plug code in IDEA, and found it ok, maybe there is something wrong with AS 2.3,and alse report tht error to Google.Holp it will be solved by next AS version.

    Here's my temp solution to solve this problem. 1.install plug in IDEA, 2.new Directory "drawable" 3.copy the image to "drawable" directory 4.do as before(right click the dir,and generate selectors) 5.copy the generated selectors to AS module.

    opened by Leon406 1
  • Can‘t generate success!Event log show NullPointerException

    Can‘t generate success!Event log show NullPointerException

    I put "btn_record_list_normal.png" and "btn_record_list_selected.png" into drawable-xxhdpi folder,and they failed to generate a selector xml file,event log show "NullPointerException:null" each time I do the genereate. The Android Studio version is 2.3.0,is it unsupported?

    opened by UltramanTIGA 9
Owner
Inmite s.r.o.
Inmite s.r.o.
A Mindustry modding Intellij IDEA plugin, named Plumy.

mgppi Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get familiar with the template documentation. Verify the pluginGroup,

Plumy Games 2 Jul 24, 2022
Kotlin compiler plugin generates support synthetic methods for use SaveStateHandle without constants and string variables.

SavedState Compiler Plugin Kotlin compiler plugin generates support methods for use SaveStateHandle without constants and string variables. Example If

Anton Nazarov 3 Sep 20, 2022
A Gradle Plugin that removes unused resources in Android projects.

#Lint Cleaner Plugin Removes unused resources reported by Android lint including strings, colors and dimensions. Depracated As of Android Studio 2.0+

Marco RS 705 Nov 25, 2022
UTBotJava generates test cases by code, trying to cover maximum statements and execution paths.

UTBotJava generates test cases by code, trying to cover maximum statements and execution paths. We treat source code as source of truth assuming that behavior is correct and corresponds to initial user demand. Generated tests are placed in so-called regression suite

null 60 Jan 3, 2023
A plugin for Android Studio and Intellij IDEA that speeds up your day to day android development.

ADB Idea A plugin for Android Studio and Intellij IDEA that speeds up your day to day android development. The following commands are provided: Uninst

Philippe Breault 2k Dec 28, 2022
IntelliJ / Android Studio plugin for Android Holo Colors

This project is not maintained anymore. Holo Colors doesn't make sense since the introduction of Material Design and the ability to set the primary co

Jérôme Van Der Linden 644 Nov 10, 2022
ADB WIFI Android Studio plugin for debug android app over Wi-Fi.

ADB WIFI ADB WIFI Android Studio plugin for debug android app over Wi-Fi. How to install in Android Studio: go to Preferences

Sutachad Wichai 298 Jan 3, 2023
Android Studio & IntelliJ Plugin for sort xml by name="xxx".

AndroidXmlSorter Android Studio & IntelliJ Plugin for sort xml by name="xxx". Options Insert space between difference prefix ('Snake Case', 'Camel Cas

Kaoru Tsutsumishita 102 Nov 29, 2022
DroidScript plugin example for Android Studio

Plugin-Java This is a basic example/template for building DroidScript plugins using Android Studio v4+ You can make and install the plugin to your dev

droidscript.org 8 Sep 25, 2022
plugin to use to replace text in android studio

replace-text-plugin Template ToDo list Create a new IntelliJ Platform Plugin Template project. Get known with the template documentation. Verify the p

null 1 Nov 29, 2022