Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jadx
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
jadx
Commits
6fb1c8d3
Commit
6fb1c8d3
authored
Feb 17, 2018
by
Skylot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gui: don't decode resources on file open
parent
6047a27c
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
49 additions
and
19 deletions
+49
-19
ResContainer.java
jadx-core/src/main/java/jadx/core/xmlgen/ResContainer.java
+1
-1
JClass.java
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
+6
-1
JLoadableNode.java
jadx-gui/src/main/java/jadx/gui/treemodel/JLoadableNode.java
+5
-0
JResource.java
jadx-gui/src/main/java/jadx/gui/treemodel/JResource.java
+28
-12
JRoot.java
jadx-gui/src/main/java/jadx/gui/treemodel/JRoot.java
+2
-1
JSources.java
jadx-gui/src/main/java/jadx/gui/treemodel/JSources.java
+2
-1
MainWindow.java
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
+3
-3
Messages_en_US.properties
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
+2
-0
No files found.
jadx-core/src/main/java/jadx/core/xmlgen/ResContainer.java
View file @
6fb1c8d3
...
@@ -51,7 +51,7 @@ public class ResContainer implements Comparable<ResContainer> {
...
@@ -51,7 +51,7 @@ public class ResContainer implements Comparable<ResContainer> {
try
{
try
{
decoder
.
decode
(
content
,
os
);
decoder
.
decode
(
content
,
os
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
LOG
.
error
(
"Failed to decode 9-patch png image
"
,
e
);
LOG
.
error
(
"Failed to decode 9-patch png image
, path: {}"
,
name
,
e
);
}
}
newContent
=
new
ByteArrayInputStream
(
os
.
toByteArray
());
newContent
=
new
ByteArrayInputStream
(
os
.
toByteArray
());
}
}
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JClass.java
View file @
6fb1c8d3
...
@@ -12,7 +12,7 @@ import jadx.core.dex.info.AccessInfo;
...
@@ -12,7 +12,7 @@ import jadx.core.dex.info.AccessInfo;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.Utils
;
import
jadx.gui.utils.Utils
;
public
class
JClass
extends
JNode
{
public
class
JClass
extends
J
Loadable
Node
{
private
static
final
long
serialVersionUID
=
-
1239986875244097177L
;
private
static
final
long
serialVersionUID
=
-
1239986875244097177L
;
private
static
final
ImageIcon
ICON_CLASS
=
Utils
.
openIcon
(
"class_obj"
);
private
static
final
ImageIcon
ICON_CLASS
=
Utils
.
openIcon
(
"class_obj"
);
...
@@ -43,6 +43,11 @@ public class JClass extends JNode {
...
@@ -43,6 +43,11 @@ public class JClass extends JNode {
return
cls
;
return
cls
;
}
}
@Override
public
void
loadNode
()
{
getRootClass
().
load
();
}
public
synchronized
void
load
()
{
public
synchronized
void
load
()
{
if
(!
loaded
)
{
if
(!
loaded
)
{
cls
.
decompile
();
cls
.
decompile
();
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JLoadableNode.java
0 → 100644
View file @
6fb1c8d3
package
jadx
.
gui
.
treemodel
;
public
abstract
class
JLoadableNode
extends
JNode
{
public
abstract
void
loadNode
();
}
jadx-gui/src/main/java/jadx/gui/treemodel/JResource.java
View file @
6fb1c8d3
...
@@ -6,16 +6,20 @@ import java.util.List;
...
@@ -6,16 +6,20 @@ import java.util.List;
import
java.util.Map
;
import
java.util.Map
;
import
org.fife.ui.rsyntaxtextarea.SyntaxConstants
;
import
org.fife.ui.rsyntaxtextarea.SyntaxConstants
;
import
org.jetbrains.annotations.NotNull
;
import
jadx.api.ResourceFile
;
import
jadx.api.ResourceFile
;
import
jadx.api.ResourceFileContent
;
import
jadx.api.ResourceFileContent
;
import
jadx.api.ResourceType
;
import
jadx.api.ResourceType
;
import
jadx.core.codegen.CodeWriter
;
import
jadx.core.codegen.CodeWriter
;
import
jadx.core.xmlgen.ResContainer
;
import
jadx.core.xmlgen.ResContainer
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.OverlayIcon
;
import
jadx.gui.utils.OverlayIcon
;
import
jadx.gui.utils.Utils
;
import
jadx.gui.utils.Utils
;
public
class
JResource
extends
JNode
implements
Comparable
<
JResource
>
{
import
static
jadx
.
api
.
ResourceFileContent
.
createResourceFileContentInstance
;
public
class
JResource
extends
JLoadableNode
implements
Comparable
<
JResource
>
{
private
static
final
long
serialVersionUID
=
-
201018424302612434L
;
private
static
final
long
serialVersionUID
=
-
201018424302612434L
;
private
static
final
ImageIcon
ROOT_ICON
=
Utils
.
openIcon
(
"cf_obj"
);
private
static
final
ImageIcon
ROOT_ICON
=
Utils
.
openIcon
(
"cf_obj"
);
...
@@ -50,22 +54,35 @@ public class JResource extends JNode implements Comparable<JResource> {
...
@@ -50,22 +54,35 @@ public class JResource extends JNode implements Comparable<JResource> {
this
.
name
=
name
;
this
.
name
=
name
;
this
.
shortName
=
shortName
;
this
.
shortName
=
shortName
;
this
.
type
=
type
;
this
.
type
=
type
;
this
.
loaded
=
false
;
}
}
public
final
void
update
()
{
public
final
void
update
()
{
loadContent
();
removeAllChildren
();
removeAllChildren
();
if
(!
loaded
)
{
if
(
type
==
JResType
.
DIR
||
type
==
JResType
.
ROOT
||
resFile
.
getType
()
==
ResourceType
.
ARSC
)
{
add
(
new
TextNode
(
NLS
.
str
(
"tree.loading"
)));
}
}
else
{
loadContent
();
for
(
JResource
res
:
files
)
{
for
(
JResource
res
:
files
)
{
res
.
update
();
res
.
update
();
add
(
res
);
add
(
res
);
}
}
}
}
}
@Override
public
void
loadNode
()
{
loadContent
();
loaded
=
true
;
update
();
}
private
void
loadContent
()
{
private
void
loadContent
()
{
getContent
();
getContent
();
for
(
JResource
res
:
files
)
{
res
.
loadContent
();
}
}
}
@Override
@Override
...
@@ -101,8 +118,8 @@ public class JResource extends JNode implements Comparable<JResource> {
...
@@ -101,8 +118,8 @@ public class JResource extends JNode implements Comparable<JResource> {
String
resName
=
rc
.
getName
();
String
resName
=
rc
.
getName
();
String
[]
path
=
resName
.
split
(
"/"
);
String
[]
path
=
resName
.
split
(
"/"
);
String
resShortName
=
path
.
length
==
0
?
resName
:
path
[
path
.
length
-
1
];
String
resShortName
=
path
.
length
==
0
?
resName
:
path
[
path
.
length
-
1
];
ResourceFileContent
fileContent
=
ResourceFileContent
.
createResourceFileContentInstance
(
resShortName
,
ResourceType
.
XML
,
cw
);
ResourceFileContent
fileContent
=
createResourceFileContentInstance
(
resShortName
,
ResourceType
.
XML
,
cw
);
if
(
fileContent
!=
null
)
{
if
(
fileContent
!=
null
)
{
addPath
(
path
,
root
,
new
JResource
(
fileContent
,
resName
,
resShortName
,
JResType
.
FILE
));
addPath
(
path
,
root
,
new
JResource
(
fileContent
,
resName
,
resShortName
,
JResType
.
FILE
));
}
}
}
}
...
@@ -242,7 +259,7 @@ public class JResource extends JNode implements Comparable<JResource> {
...
@@ -242,7 +259,7 @@ public class JResource extends JNode implements Comparable<JResource> {
}
}
@Override
@Override
public
int
compareTo
(
JResource
o
)
{
public
int
compareTo
(
@NotNull
JResource
o
)
{
return
name
.
compareTo
(
o
.
name
);
return
name
.
compareTo
(
o
.
name
);
}
}
...
@@ -266,5 +283,4 @@ public class JResource extends JNode implements Comparable<JResource> {
...
@@ -266,5 +283,4 @@ public class JResource extends JNode implements Comparable<JResource> {
public
int
hashCode
()
{
public
int
hashCode
()
{
return
name
.
hashCode
();
return
name
.
hashCode
();
}
}
}
}
jadx-gui/src/main/java/jadx/gui/treemodel/JRoot.java
View file @
6fb1c8d3
...
@@ -10,6 +10,7 @@ import java.util.regex.Pattern;
...
@@ -10,6 +10,7 @@ import java.util.regex.Pattern;
import
jadx.api.ResourceFile
;
import
jadx.api.ResourceFile
;
import
jadx.gui.JadxWrapper
;
import
jadx.gui.JadxWrapper
;
import
jadx.gui.treemodel.JResource.JResType
;
import
jadx.gui.treemodel.JResource.JResType
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.Utils
;
import
jadx.gui.utils.Utils
;
public
class
JRoot
extends
JNode
{
public
class
JRoot
extends
JNode
{
...
@@ -41,7 +42,7 @@ public class JRoot extends JNode {
...
@@ -41,7 +42,7 @@ public class JRoot extends JNode {
if
(
resources
.
isEmpty
())
{
if
(
resources
.
isEmpty
())
{
return
Collections
.
emptyList
();
return
Collections
.
emptyList
();
}
}
JResource
root
=
new
JResource
(
null
,
"Resources"
,
JResType
.
ROOT
);
JResource
root
=
new
JResource
(
null
,
NLS
.
str
(
"tree.resources_title"
)
,
JResType
.
ROOT
);
String
splitPathStr
=
Pattern
.
quote
(
File
.
separator
);
String
splitPathStr
=
Pattern
.
quote
(
File
.
separator
);
for
(
ResourceFile
rf
:
resources
)
{
for
(
ResourceFile
rf
:
resources
)
{
String
rfName
;
String
rfName
;
...
...
jadx-gui/src/main/java/jadx/gui/treemodel/JSources.java
View file @
6fb1c8d3
...
@@ -12,6 +12,7 @@ import java.util.Set;
...
@@ -12,6 +12,7 @@ import java.util.Set;
import
jadx.api.JavaPackage
;
import
jadx.api.JavaPackage
;
import
jadx.gui.JadxWrapper
;
import
jadx.gui.JadxWrapper
;
import
jadx.gui.utils.NLS
;
import
jadx.gui.utils.Utils
;
import
jadx.gui.utils.Utils
;
public
class
JSources
extends
JNode
{
public
class
JSources
extends
JNode
{
...
@@ -132,6 +133,6 @@ public class JSources extends JNode {
...
@@ -132,6 +133,6 @@ public class JSources extends JNode {
@Override
@Override
public
String
makeString
()
{
public
String
makeString
()
{
return
"Source code"
;
return
NLS
.
str
(
"tree.sources_title"
)
;
}
}
}
}
jadx-gui/src/main/java/jadx/gui/ui/MainWindow.java
View file @
6fb1c8d3
...
@@ -41,6 +41,7 @@ import jadx.gui.jobs.IndexJob;
...
@@ -41,6 +41,7 @@ import jadx.gui.jobs.IndexJob;
import
jadx.gui.settings.JadxSettings
;
import
jadx.gui.settings.JadxSettings
;
import
jadx.gui.settings.JadxSettingsWindow
;
import
jadx.gui.settings.JadxSettingsWindow
;
import
jadx.gui.treemodel.JClass
;
import
jadx.gui.treemodel.JClass
;
import
jadx.gui.treemodel.JLoadableNode
;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.treemodel.JNode
;
import
jadx.gui.treemodel.JResource
;
import
jadx.gui.treemodel.JResource
;
import
jadx.gui.treemodel.JRoot
;
import
jadx.gui.treemodel.JRoot
;
...
@@ -581,9 +582,8 @@ public class MainWindow extends JFrame {
...
@@ -581,9 +582,8 @@ public class MainWindow extends JFrame {
public
void
treeWillExpand
(
TreeExpansionEvent
event
)
throws
ExpandVetoException
{
public
void
treeWillExpand
(
TreeExpansionEvent
event
)
throws
ExpandVetoException
{
TreePath
path
=
event
.
getPath
();
TreePath
path
=
event
.
getPath
();
Object
node
=
path
.
getLastPathComponent
();
Object
node
=
path
.
getLastPathComponent
();
if
(
node
instanceof
JClass
)
{
if
(
node
instanceof
JLoadableNode
)
{
JClass
cls
=
(
JClass
)
node
;
((
JLoadableNode
)
node
).
loadNode
();
cls
.
getRootClass
().
load
();
}
}
}
}
...
...
jadx-gui/src/main/resources/i18n/Messages_en_US.properties
View file @
6fb1c8d3
...
@@ -23,6 +23,8 @@ file.save_all_msg=Select directory for save decompiled sources
...
@@ -23,6 +23,8 @@ file.save_all_msg=Select directory for save decompiled sources
file.select
=
Select
file.select
=
Select
file.exit
=
Exit
file.exit
=
Exit
tree.sources_title
=
Source code
tree.resources_title
=
Resources
tree.loading
=
Loading...
tree.loading
=
Loading...
search
=
Search
search
=
Search
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment