Idea intellij plugin not working in android studio 1.5.1 - android-studio

I'm developing a test plugin for android studio, my plugin works (The actions created are visible ) in Android studio 1.5 when added using "install plugin from disk". But the same jar file is not working in Android studio 1.5.1.
Below is the plugin.xml file. Please help.
<idea-plugin version="2">
<id>com.test.android.studio.plugin</id>
<name>test Android Studio Plugin</name>
<version>1.0</version>
<vendor email="test#test.com" url="http://www.test.com">test test Services Pvt. Ltd.</vendor>
<description>
Android Studio plugin to integrate test SDK
</description>
<change-notes>
Release 0.0.1: Initial release.
</change-notes>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
<idea-version since-build="131"/>
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
on how to target different products -->
<!-- uncomment to enable plugin in all products-->
<depends>com.intellij.modules.lang</depends>
<extensions defaultExtensionNs="com.intellij">
<!-- Add your extensions here -->
</extensions>
<actions>
<!-- Add your actions here -->
<group id="Test" class="org.test.plugin.actions.TestMainActionGroup" text="Test" description="Main Test invocation Action"
popup="true">
<add-to-group group-id="MainMenu" anchor="last"/>
<action id="testMode" class="org.Test.plugin.actions.TestModeAction" text="Test Mode" description="Test mode action">
<keyboard-shortcut keymap="$default" first-keystroke="ctrl k"/>
</action>
<action id="invocationCode" class="org.Test.plugin.actions.InvocationCodeAction" text="Invocation Code"
description="Test mode action">
</action>
<action id="onlineDoc" class="org.Test.plugin.actions.OnlineDocAction" text="Online Documentation"
description="Test mode action">
</action>
<action id="aboutUs" class="org.Test.plugin.actions.AboutUsAction" text="About Us" description="Test mode action">
</action>
</group>
</actions>

As the other answer already pointed out the problem is caused by using a custom group class for the action group.
When you may need custom action group?
A Custom action group is needed only if you have some custom logic that controls the behavior of your group of actions, such as the group should be enabled on some selection in the editor,or on mouse hover ,or if you want to add actions dynamically to the group etc.
If the purpose of group is to group the predefined actions and display it in a particular location the default action group is all that you need
and it can be easily accomplished by following lines
<group id="Test" text="Test" description="Main Test invocation Action"
popup="true">
<add-to-group group-id="MainMenu" anchor="last"/>
<!--List of predefined actions here -->
</group>
Note that the class attribute from the group tag is removed. Now the IDE considers its group as Default Action Group.

The problem is caused by using a custom group class for the action group you add to the main menu. This is not supported in some versions of IntelliJ IDEA/Android Studio.

Related

How to implement themed icons by Material You in my Android App?

I can't find anything about that online, no documentation, nothing. Maybe one of you know how to do it or have got some advice for me.
Thank you in advance.
Update on 02/18/2022: Android 13 has official support for themed icons. Just follow their steps here: https://developer.android.com/about/versions/13/features#themed-app-icons
To follow their example:
Create a monochrome version of your app icon
Add this to your ic_launcher.xml file, under the <adaptive-icon /> tagset:
<adaptive-icon>
<background android:drawable="..." />
<foreground android:drawable="..." />
<monochrome android:drawable="#drawable/myicon" />
</adaptive-icon>
Add your icon to your manifest:
<application
…
android:icon="#mipmap/ic_launcher"
…>
</application>
Note: If android:roundIcon and android:icon are both in your manifest, you must either remove the reference to android:roundIcon or supply the monochrome icon in the drawable defined by the android:roundIcon attribute.
All of that was pulled directly from the Google developer's example.
There seems to be competing answers on this, but this issue on the Material Components GitHub repository seems to offer the most insight: https://github.com/material-components/material-components-android/issues/2357
Particularly, using an adaptive icon, like this:
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt">
<background android:drawable="#color/launcher_icon_background"/>
<foreground>
<aapt:attr name="android:drawable">
<vector
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#color/launcher_icon"
android:pathData="m54,74.5l23.3,-29c-0.9,-0.7 -9.9,-8 -23.3,-8c-13.4,0 -22.4,7.3 -23.3,8l23.3,29l0,0c0,0 0,0 0,0zm7.7,-27.3c1.4,1.7 2.3,3.9 2.3,6.3l0,2l-20,0l0,-2c0,-2.4 0.9,-4.6 2.3,-6.3l-2.3,-2.3l1.4,-1.4l2.3,2.3c1.7,-1.4 3.9,-2.3 6.3,-2.3c2.4,0 4.6,0.9 6.3,2.3l2.3,-2.3l1.4,1.4l-2.3,2.3zm-9.7,4.3c0,1.1 -0.9,2 -2,2c-1.1,0 -2,-0.9 -2,-2c0,-1.1 0.9,-2 2,-2c1.1,0 2,0.9 2,2zm8,0c0,1.1 -0.9,2 -2,2c-1.1,0 -2,-0.9 -2,-2c0,-1.1 0.9,-2 2,-2c1.1,0 2,0.9 2,2z" />
</vector>
</aapt:attr>
</foreground>
</adaptive-icon>
... with colors defined in colors.xml that refer to system-defined colors that derive from the Material 3 color pallet:
<resources>
<color name="launcher_icon_background">#android:color/system_accent1_100</color>
<color name="launcher_icon">#android:color/system_neutral1_800</color>
</resources>
Note that these colors derive from the system-defined pallet, as described in Material Design 3: https://m3.material.io/libraries/mdc-android/color-theming
You will likely have to create separate resource files that target API 31+ specifically. I have not tested out these recommendations.

Automation Steps not firing for custom screen?

I have used automation steps to add an action menu to an existing screen, add approval automation and other automations to an existing screen, and control fields/values of existing screens. Each of those cases appear to work fine. However, I have added a new custom screen that does not require approvals, and automation steps seem to do nothing for me other than adding an action item to the menu.
What would prevent my custom screen from executing my simple automation steps? I have 1 view set as the data member for both the form and tab in a form/tab screen used to break up the data to keep the data simple for the end user to view. The only thing working is that the Action menu option "Convert to Repair" is added to the screen, although it is not disabled as intended nor the status updated when the hold checkbox is changed.
Automation Definition:
<?xml version="1.0" encoding="utf-8"?>
<Screens>
<Screen ScreenID="ZI302000">
<Step StepID="Hold -> Open" Description="Hold -> Open" GraphName="SSCS.IN.ZZINNcmTagEntry" ViewName="NCMTags" TimeStampName="Tstamp">
<Filter FieldName="Hold" Condition="Equals" Value="False" Value2="False" Operator="And" />
<Filter FieldName="Status" Condition="Equals" Value="H" Operator="And" />
<Action ActionName="*" IsDefault="1">
<Fill FieldName="Status" Value="O" />
</Action>
<Action ActionName="Action" MenuText="Convert to Repair">
<Fill FieldName="#ActionName" Value="ConvertRepair" />
</Action>
</Step>
<Step StepID="On Hold" Description="On Hold" GraphName="SSCS.IN.ZZINNcmTagEntry" ViewName="NCMTags" TimeStampName="Tstamp">
<Filter FieldName="Hold" Condition="Equals" Value="True" Value2="False" Operator="And" />
<Action ActionName="*" IsDefault="1">
<Fill FieldName="Status" Value="H" />
</Action>
<Action ActionName="Action" MenuText="Convert to Repair" IsDisabled="1">
<Fill FieldName="#ActionName" Value="ConvertRepair" />
</Action>
</Step>
</Screen>
</Screens>
As it turns out, it seems the automation steps referenced a node id of an earlier version of the page. After experimenting with some formatting of the page, I removed it and started over. By not removing the old automation steps entirely, the system was firing automation for a page referenced by an outdated node id.
Solution: Delete the automation steps entirely and start over. In my case, I deleted the automation definition as well because I had tried deleting the automation steps before but not the automation definition with no success. I also deleted the site map to the page, the files from the customization project, the files from the OS, and recreated it all from scratch. Once confirmed that automation steps were working on the newly recreated page, I was able to go to a backup copy of the aspx file and paste the contents into my new page aspx file in the customization project to restore all my work on the layout and settings.

Conflict control ID

I am having problem in publishing my custom project in Acumatica ERP. It prompts me the following message.
Conflict control ID:phG_tab_Items#0_grid_Levels#0 from page
~/pages/so/so303000.aspx Validation failed.
Here is what my code looks like in the Invoices page (ScreenID: SO303000)
<Page path="~/pages/so/so303000.aspx" ControlId="2" pageSource="711Ft7m6F+foDk0z4+/8B">
<PXGridLevel DataMember="Transactions" ParentId="phG_tab_Items#0_grid_Levels#0" TypeFullName="PX.Web.UI.PXGridLevel">
<Children Key="Columns">
<AddItem>
<PXGridColumn TypeFullName="PX.Web.UI.PXGridColumn">
<Prop Key="DataField" Value="UsrContractID" />
<Prop Key="Width" Value="70" />
</PXGridColumn>
</AddItem>
<AddItem>
<PXGridColumn TypeFullName="PX.Web.UI.PXGridColumn">
<Prop Key="DataField" Value="UsrPhoneNumber" />
<Prop Key="Width" Value="70" />
</PXGridColumn>
</AddItem>
<AddItem>
<PXGridColumn TypeFullName="PX.Web.UI.PXGridColumn">
<Prop Key="DataField" Value="UsrSIMCardID" />
<Prop Key="Width" Value="160" />
</PXGridColumn>
</AddItem>
</Children>
</PXGridLevel>
</Page>
I have shortened the pageSource value for readability.
Since, I have another custom project as well, and got answer that that could cause this, I have no idea what changes should I do to make this work.
When you publish more that one customization project, the system merges the content of all projects into a single customization project. If different projects include customization for the same ASPX page, the platform tries to merge the changes. For example, the platform can merge different properties of the same control in an ASPX page.
On the Customization Projects form, you can specify an optional number (level) for each customization project, assigning the highest number to the most important change. The level can be used to resolve conflicts that arise while you are publishing customization projects if multiple modifications for the same ASPX page are merged. As a result, the customization from the project with the highest level is added to the merged project.
For more information on this topic, please check Acumatica Customization Guide
I don't know if it's the best way to do it, but here is what I did.
I copied the changes from the my one custom project to another custom project in the same page screen. And it worked!
This worked for now. But please let me know if there is better way to do this.

How to get active theme name in velocity template in Liferay

We use one theme for our desktop web page and another for responsive/mobile version of the site. But for mobile we don't always want to show images and it would be good if we can restrict it from the template, not just hiding it with CSS (because it still loads the image, just does not show it).
For that I need to get liferay current active theme ID or name so I can add simple if statement in the template.
#if(${themename} == "desktopTheme")
<img src="foo.jpg"/>
#end
Does anyone has ideas how to get it? I searched and checked lots of liferay's forums, but didn't find anything.
Thanks!
My advice would be to not hardcode the theme's name, but use theme settings that are readily available. Just configure your theme to be "desktop" or "mobile" style and check for this property. This way you can cover many different themes without hardcoding particular ones.
Also, the various ThemeDisplay.getTheme*() methods will help you to get the required information almost anywhere you are.
Here's some untested pseudo code for your themes (I just typed it here, never compiled/deployed, you might want to add null-checks for the VM stuff)
<?xml version="1.0"?>
<!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 6.0.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_6_0_0.dtd">
<look-and-feel>
<compatibility>
<version>6.1.0+</version>
</compatibility>
<theme id="my-desktop-1" name="My First Desktop Theme">
<settings>
<setting key="mobile" value="false" />
</settings>
</theme>
</look-and-feel>
<?xml version="1.0"?>
<!DOCTYPE look-and-feel PUBLIC "-//Liferay//DTD Look and Feel 6.0.0//EN" "http://www.liferay.com/dtd/liferay-look-and-feel_6_0_0.dtd">
<look-and-feel>
<compatibility>
<version>6.1.0+</version>
</compatibility>
<theme id="my-mobile-1" name="My First Mobile Theme">
<settings>
<setting key="mobile" value="true" />
</settings>
</theme>
</look-and-feel>
And then, in VM or JSPs or other code:
#if( ! $themeDisplay.getSetting("mobile"))
## more resources, desktop only, here.
#end
#if( $themeDisplay.getSetting("mobile")
## mobile only stuff here.
#end
And finally you might also want to consider to use the Device Detection API to determine the current device's actual capabilities on a far finer granularity
Suggest you to use themeId whis is also unique. its something the following:
xxx_WAR_xxxtheme
#if($themeDisplay.getThemeId().equalsIgnoreCase("<dektop theme id>"))
### your logic here
#end
HTH

Resharper Clean-up Code - how to affect sorting of methods?

I've got a customized clean-up and it's almost 'there'.
However, R# appears to want to sort the member methods, but at least it does not appear to be alphabetically.
Is there a way to force that sorting?
Customizing the layout can indeed be accomplished with Resharper. Go to:
Resharper->Options->Languages->C#->Formatting Style->Type Members Layout
ReSharper 2017
Resharper -> Options-> Code Editing -> C# -> File Layout -> Interface Implementations/All Other Members
and uncheck the "Use Default Patterns" option.
Now you'll want to edit the xml in the "Custom Patterns" box. I'd recommend copying it out to an editor that can properly hi-light the xml (notepad++ or visual studio should work fine).
Now, find the section near the bottom:
<!--all other members-->
<Entry/>
and change it to:
<!--all other members-->
<Entry>
<Match>
<Kind Is="method"/>
</Match>
<Sort>
<Name/>
</Sort>
</Entry>
Now, make sure that your cleanup profile has "Reorder type members", and then right click on the filename in solution explorer and do "Cleanup code...". I've just tried this myself and it does order the methods alphabetically.
If you want to also sort by access type, you can add this under the <Sort> element:
<Access Order="public protected internal private" />
Here's an article to learn more.
Resharper->Options->Languages->C#->File Layout
Select "All other members" and select "Sort by name" (highlighted in bottom right of pic)
In the XML file layout you have to add the element Entry.SortBy
For example in All other members:
<Entry DisplayName="All other members">
<Entry.SortBy>
<Name />
</Entry.SortBy>
</Entry>
The problem with the 9.2 is that when the Entry.SortBy is missing from XML the selected value from the designer is not saved.

Resources