Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
keyescgm
jadx
提交
cf918a89
J
jadx
项目概览
keyescgm
/
jadx
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jadx
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
cf918a89
编写于
11月 12, 2021
作者:
S
Skylot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix(gui): collect FlatLaf themes without reflection
上级
5fc27c11
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
33 addition
and
33 deletion
+33
-33
jadx-gui/build.gradle
jadx-gui/build.gradle
+0
-1
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
+15
-3
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
.../src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
+1
-0
jadx-gui/src/main/java/jadx/gui/utils/LafManager.java
jadx-gui/src/main/java/jadx/gui/utils/LafManager.java
+17
-29
未找到文件。
jadx-gui/build.gradle
浏览文件 @
cf918a89
...
...
@@ -19,7 +19,6 @@ dependencies {
implementation
'com.formdev:flatlaf-intellij-themes:1.6.1'
implementation
'com.formdev:flatlaf-extras:1.6.1'
implementation
'com.formdev:svgSalamander:1.1.2.4'
implementation
'org.reflections:reflections:0.10.2'
implementation
'com.google.code.gson:gson:2.8.9'
implementation
'org.apache.commons:commons-lang3:3.12.0'
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxSettings.java
浏览文件 @
cf918a89
...
...
@@ -43,7 +43,7 @@ public class JadxSettings extends JadxCLIArgs {
private
static
final
Path
USER_HOME
=
Paths
.
get
(
System
.
getProperty
(
"user.home"
));
private
static
final
int
RECENT_PROJECTS_COUNT
=
15
;
private
static
final
int
CURRENT_SETTINGS_VERSION
=
1
3
;
private
static
final
int
CURRENT_SETTINGS_VERSION
=
1
4
;
private
static
final
Font
DEFAULT_FONT
=
new
RSyntaxTextArea
().
getFont
();
...
...
@@ -62,10 +62,10 @@ public class JadxSettings extends JadxCLIArgs {
private
String
fontStr
=
""
;
private
String
smaliFontStr
=
""
;
private
String
editorThemePath
=
""
;
private
String
lafTheme
=
LafManager
.
SYSTEM
_THEME_NAME
;
private
String
lafTheme
=
LafManager
.
INITIAL
_THEME_NAME
;
private
LangLocale
langLocale
=
NLS
.
defaultLocale
();
private
boolean
autoStartJobs
=
false
;
pr
otected
String
excludedPackages
=
""
;
pr
ivate
String
excludedPackages
=
""
;
private
boolean
autoSaveProject
=
false
;
private
boolean
showHeapUsageBar
=
false
;
...
...
@@ -130,6 +130,14 @@ public class JadxSettings extends JadxCLIArgs {
}
}
public
int
getSettingsVersion
()
{
return
settingsVersion
;
}
public
void
setSettingsVersion
(
int
settingsVersion
)
{
this
.
settingsVersion
=
settingsVersion
;
}
public
String
getCmdSelectClass
()
{
return
cmdSelectClass
;
}
...
...
@@ -635,6 +643,10 @@ public class JadxSettings extends JadxCLIArgs {
alwaysSelectOpened
=
false
;
fromVersion
++;
}
if
(
fromVersion
==
13
)
{
lafTheme
=
LafManager
.
INITIAL_THEME_NAME
;
fromVersion
++;
}
if
(
fromVersion
!=
CURRENT_SETTINGS_VERSION
)
{
throw
new
JadxRuntimeException
(
"Incorrect settings upgrade"
);
}
...
...
jadx-gui/src/main/java/jadx/gui/settings/JadxSettingsAdapter.java
浏览文件 @
cf918a89
...
...
@@ -37,6 +37,7 @@ public class JadxSettingsAdapter {
return
JadxSettings
.
SKIP_FIELDS
.
contains
(
f
.
getName
())
||
f
.
hasModifier
(
Modifier
.
PUBLIC
)
||
f
.
hasModifier
(
Modifier
.
TRANSIENT
)
||
f
.
hasModifier
(
Modifier
.
STATIC
)
||
(
f
.
getAnnotation
(
GsonExclude
.
class
)
!=
null
);
}
...
...
jadx-gui/src/main/java/jadx/gui/utils/LafManager.java
浏览文件 @
cf918a89
package
jadx.gui.utils
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
javax.swing.LookAndFeel
;
import
javax.swing.UIManager
;
import
org.reflections.Reflections
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.formdev.flatlaf.FlatDarculaLaf
;
import
com.formdev.flatlaf.FlatDarkLaf
;
import
com.formdev.flatlaf.FlatIntelliJLaf
;
import
com.formdev.flatlaf.FlatLaf
;
import
com.formdev.flatlaf.FlatLightLaf
;
import
com.formdev.flatlaf.extras.FlatAnimatedLafChange
;
import
com.formdev.flatlaf.intellijthemes.FlatAllIJThemes
;
import
ch.qos.logback.classic.Level
;
import
jadx.cli.LogHelper
;
import
jadx.gui.settings.JadxSettings
;
public
class
LafManager
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
LafManager
.
class
);
public
static
final
String
SYSTEM_THEME_NAME
=
"default"
;
public
static
final
String
INITIAL_THEME_NAME
=
FlatLightLaf
.
NAME
;
private
static
final
Map
<
String
,
String
>
THEMES_MAP
=
initThemesMap
();
public
static
void
init
(
JadxSettings
settings
)
{
...
...
@@ -66,28 +64,18 @@ public class LafManager {
private
static
Map
<
String
,
String
>
initThemesMap
()
{
Map
<
String
,
String
>
map
=
new
LinkedHashMap
<>();
map
.
put
(
SYSTEM_THEME_NAME
,
SYSTEM_THEME_NAME
);
for
(
FlatLaf
flatLafTheme
:
collectFlatLafThemes
())
{
map
.
put
(
flatLafTheme
.
getName
(),
flatLafTheme
.
getClass
().
getName
());
}
return
map
;
}
private
static
List
<
FlatLaf
>
collectFlatLafThemes
()
{
LogHelper
.
setLevelForPackage
(
"org.reflections"
,
Level
.
WARN
);
Reflections
reflections
=
new
Reflections
(
"com.formdev.flatlaf"
);
Set
<
Class
<?
extends
FlatLaf
>>
lafClasses
=
reflections
.
getSubTypesOf
(
FlatLaf
.
class
);
List
<
FlatLaf
>
themes
=
new
ArrayList
<>(
lafClasses
.
size
());
for
(
Class
<?
extends
FlatLaf
>
lafClass
:
lafClasses
)
{
try
{
themes
.
add
(
lafClass
.
getDeclaredConstructor
().
newInstance
());
}
catch
(
Exception
e
)
{
// some classes not themes, ignore them
LOG
.
trace
(
"Failed make instance for class: {}"
,
lafClass
.
getName
(),
e
);
}
// default flatlaf themes
map
.
put
(
FlatLightLaf
.
NAME
,
FlatLightLaf
.
class
.
getName
());
map
.
put
(
FlatDarkLaf
.
NAME
,
FlatDarkLaf
.
class
.
getName
());
map
.
put
(
FlatIntelliJLaf
.
NAME
,
FlatIntelliJLaf
.
class
.
getName
());
map
.
put
(
FlatDarculaLaf
.
NAME
,
FlatDarculaLaf
.
class
.
getName
());
// themes from flatlaf-intellij-themes
for
(
FlatAllIJThemes
.
FlatIJLookAndFeelInfo
themeInfo
:
FlatAllIJThemes
.
INFOS
)
{
map
.
put
(
themeInfo
.
getName
(),
themeInfo
.
getClassName
());
}
themes
.
sort
(
Comparator
.
comparing
(
LookAndFeel:
:
getName
));
return
themes
;
return
map
;
}
private
static
boolean
applyLaf
(
String
theme
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录