skylot / jadx

Dex to Java decompiler
Apache License 2.0
41.82k stars 4.89k forks source link

[feature] Add prettify xml layout file popup action. #2012

Open cesaryuan opened 1 year ago

cesaryuan commented 1 year ago

Describe your idea

I found a github repo called android-xml-formatter that implements prettify for android layout files, and the current effect looks very good. I have also added this feature to jadx in my jadx fork: image

However, the problem is that the open source license of this repo is GPL v3.0, so I can’t seem to make a PR. The possible solutions seem to be as follows:

All in all, the prettified xml file greatly improves the look and feel, so I hope there is a proper way to add this function. 🥰

skylot commented 1 year ago

@cesaryuan yeah, taking someone else code like this is not good :cry:

But I think general XML formatters will also work well, something like here : https://stackoverflow.com/questions/31651710/formatting-xml-file-in-java (uses apache xerces)

Re-implement an xml prettier yourself, but this seems to be reinventing the wheel

Actually, as soon as jadx generate/decode most of XML files in APK, it is not hard to adjust output ... and option to put attributes on new line already exists in code but was disabled. I commit a change to enable it, so output is closer to what you archive with formatter lib. Please check :slightly_smiling_face:

allow users to add popup actions to the view of xml files in jadx script

Sure, I will add this, and I also need to add methods to change shown text but this slightly harder.

is there a way to introduce local jar files into the script?

Use this @file:DependsOn("/path/to/local.jar") (ref to https://github.com/skylot/jadx/issues/1912#issuecomment-1591503677)