Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile
Commits
fc625291
Commit
fc625291
authored
Dec 09, 2018
by
fallenstardust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test log
parent
250ff94b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
52 deletions
+54
-52
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+53
-51
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
...ava/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
+1
-1
No files found.
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
fc625291
...
...
@@ -3,13 +3,10 @@ package cn.garymb.ygomobile;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.content.Context
;
import
android.os.Build
;
import
android.os.Environment
;
import
android.text.TextUtils
;
import
android.util.DisplayMetrics
;
import
android.util.Log
;
import
android.view.Display
;
import
android.view.WindowManager
;
import
org.json.JSONArray
;
...
...
@@ -39,11 +36,18 @@ import static cn.garymb.ygomobile.Constants.PREF_READ_EX;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_SENSOR_REFRESH
;
public
class
AppsSettings
{
private
static
final
String
PREF_VERSION
=
"app_version"
;
private
static
AppsSettings
sAppsSettings
;
private
Context
context
;
private
PreferenceFragmentPlus
.
SharedPreferencesPlus
mSharedPreferences
;
private
float
mScreenHeight
,
mScreenWidth
,
mDensity
;
private
static
final
String
PREF_VERSION
=
"app_version"
;
private
AppsSettings
(
Context
context
)
{
this
.
context
=
context
;
mSharedPreferences
=
PreferenceFragmentPlus
.
SharedPreferencesPlus
.
create
(
context
,
context
.
getPackageName
()
+
".settings"
);
mSharedPreferences
.
setAutoSave
(
true
);
update
(
context
);
}
public
static
void
init
(
Context
context
)
{
if
(
sAppsSettings
==
null
)
{
...
...
@@ -55,15 +59,23 @@ public class AppsSettings {
return
sAppsSettings
;
}
public
File
getSystemConfig
()
{
return
new
File
(
getResourcePath
(),
CORE_SYSTEM_PATH
);
}
private
AppsSettings
(
Context
context
)
{
this
.
context
=
context
;
mSharedPreferences
=
PreferenceFragmentPlus
.
SharedPreferencesPlus
.
create
(
context
,
context
.
getPackageName
()
+
".settings"
);
mSharedPreferences
.
setAutoSave
(
true
);
update
(
context
);
//获取刘海屏的参数
public
static
int
[]
getNotchSize
(
Context
context
)
{
int
[]
notchSize
=
new
int
[]{
0
,
0
};
try
{
ClassLoader
cl
=
context
.
getClassLoader
();
Class
HwNotchSizeUtil
=
cl
.
loadClass
(
"com.huawei.android.util.HwNotchSizeUtil"
);
Method
get
=
HwNotchSizeUtil
.
getMethod
(
"getNotchSize"
);
notchSize
=
(
int
[])
get
.
invoke
(
HwNotchSizeUtil
);
}
catch
(
ClassNotFoundException
e
)
{
Log
.
e
(
"test"
,
"getNotchSize ClassNotFoundException"
);
}
catch
(
NoSuchMethodException
e
)
{
Log
.
e
(
"test"
,
"getNotchSize NoSuchMethodException"
);
}
catch
(
Exception
e
)
{
Log
.
e
(
"test"
,
"getNotchSize Exception"
);
}
finally
{
return
notchSize
;
}
}
//检测是否存在刘海屏
...
...
@@ -85,25 +97,6 @@ public class AppsSettings {
}
}
//获取刘海屏的参数
public
static
int
[]
getNotchSize
(
Context
context
)
{
int
[]
notchSize
=
new
int
[]{
0
,
0
};
try
{
ClassLoader
cl
=
context
.
getClassLoader
();
Class
HwNotchSizeUtil
=
cl
.
loadClass
(
"com.huawei.android.util.HwNotchSizeUtil"
);
Method
get
=
HwNotchSizeUtil
.
getMethod
(
"getNotchSize"
);
notchSize
=
(
int
[])
get
.
invoke
(
HwNotchSizeUtil
);
}
catch
(
ClassNotFoundException
e
)
{
Log
.
e
(
"test"
,
"getNotchSize ClassNotFoundException"
);
}
catch
(
NoSuchMethodException
e
)
{
Log
.
e
(
"test"
,
"getNotchSize NoSuchMethodException"
);
}
catch
(
Exception
e
)
{
Log
.
e
(
"test"
,
"getNotchSize Exception"
);
}
finally
{
return
notchSize
;
}
}
//获取系统状态栏高度
public
static
int
getStatusBarHeight
(
Context
context
)
{
int
StatusBarHeight
=
0
;
...
...
@@ -114,6 +107,10 @@ public class AppsSettings {
return
StatusBarHeight
;
}
public
File
getSystemConfig
()
{
return
new
File
(
getResourcePath
(),
CORE_SYSTEM_PATH
);
}
public
void
update
(
Context
context
)
{
mDensity
=
context
.
getResources
().
getDisplayMetrics
().
density
;
mScreenHeight
=
context
.
getResources
().
getDisplayMetrics
().
heightPixels
;
...
...
@@ -122,6 +119,10 @@ public class AppsSettings {
DisplayMetrics
dm
=
SystemUtils
.
getHasVirtualDisplayMetrics
((
Activity
)
context
);
if
(
dm
!=
null
)
{
int
height
=
Math
.
max
(
dm
.
widthPixels
,
dm
.
heightPixels
);
Log
.
i
(
"机横屏height"
,
""
+
height
);
if
(
dm
.
widthPixels
/
dm
.
heightPixels
>
16
/
9
)
{
height
=
height
-
getStatusBarHeight
(
context
);
}
if
(
mScreenHeight
==
Math
.
max
(
mScreenHeight
,
mScreenWidth
))
{
mScreenHeight
=
height
;
}
else
{
...
...
@@ -129,10 +130,11 @@ public class AppsSettings {
}
}
}
if
(!
hasNotchInScreen
(
context
))
{
}
Log
.
i
(
"屏幕不算虚拟键"
,
""
+
mScreenHeight
);
Log
.
i
(
"机屏幕高度"
,
""
+
mScreenHeight
);
Log
.
i
(
"机屏幕宽度"
,
""
+
mScreenWidth
);
Log
.
i
(
"机刘海高度"
,
""
+
getNotchSize
(
context
));
Log
.
i
(
"机状态栏高度"
,
""
+
getStatusBarHeight
(
context
));
Log
.
i
(
"机是否存在刘海"
,
""
+
hasNotchInScreen
(
context
));
}
public
int
getAppVersion
()
{
...
...
@@ -386,10 +388,6 @@ public class AppsSettings {
return
mSharedPreferences
.
getBoolean
(
Constants
.
PREF_USE_EXTRA_CARD_CARDS
,
Constants
.
PREF_DEF_USE_EXTRA_CARD_CARDS
);
}
public
String
getCoreSkinPath
()
{
return
new
File
(
getResourcePath
(),
Constants
.
CORE_SKIN_PATH
).
getAbsolutePath
();
}
/***
* 设置是否使用额外卡库
*/
...
...
@@ -397,18 +395,22 @@ public class AppsSettings {
mSharedPreferences
.
putBoolean
(
Constants
.
PREF_USE_EXTRA_CARD_CARDS
,
useExtraCards
);
}
public
String
getCoreSkinPath
()
{
return
new
File
(
getResourcePath
(),
Constants
.
CORE_SKIN_PATH
).
getAbsolutePath
();
}
/***
* 字体路径
*/
public
void
setFontPath
(
String
font
)
{
mSharedPreferences
.
putString
(
Constants
.
PREF_GAME_FONT
,
font
);
public
String
getFontPath
(
)
{
return
mSharedPreferences
.
getString
(
Constants
.
PREF_GAME_FONT
,
getFontDefault
()
);
}
/***
* 字体路径
*/
public
String
getFontPath
(
)
{
return
mSharedPreferences
.
getString
(
Constants
.
PREF_GAME_FONT
,
getFontDefault
()
);
public
void
setFontPath
(
String
font
)
{
mSharedPreferences
.
putString
(
Constants
.
PREF_GAME_FONT
,
font
);
}
/**
...
...
@@ -458,6 +460,13 @@ public class AppsSettings {
return
mSharedPreferences
.
getBoolean
(
PREF_SENSOR_REFRESH
,
PREF_DEF_SENSOR_REFRESH
);
}
/***
* 最后卡组名
*/
public
String
getLastDeck
()
{
return
mSharedPreferences
.
getString
(
Constants
.
PREF_LAST_YDK
,
Constants
.
PREF_DEF_LAST_YDK
);
}
/***
* 最后卡组名
*/
...
...
@@ -469,13 +478,6 @@ public class AppsSettings {
mSharedPreferences
.
putString
(
Constants
.
PREF_LAST_YDK
,
name
);
}
/***
* 最后卡组名
*/
public
String
getLastDeck
()
{
return
mSharedPreferences
.
getString
(
Constants
.
PREF_LAST_YDK
,
Constants
.
PREF_DEF_LAST_YDK
);
}
public
String
getCurLastDeck
()
{
return
mSharedPreferences
.
getString
(
Constants
.
PREF_LAST_YDK
,
null
);
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
View file @
fc625291
...
...
@@ -63,7 +63,7 @@ public class ServiceDuelAssistant extends Service {
//加房关键字
public
static
final
String
[]
passwordPrefix
=
{
"M,"
,
"m,"
,
"T,"
,
"t,"
,
"T,"
,
"PR,"
,
"pr,"
,
"AI,"
,
"ai,"
,
"LF2,"
,
"lf2,"
,
...
...
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