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
a0f630b0
Commit
a0f630b0
authored
Dec 15, 2018
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复刘海高度变量无法共享读取的问题
parent
9f19757f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
33 deletions
+32
-33
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
.../src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
+3
-0
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
+14
-20
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+2
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+12
-12
mobile/src/main/java/cn/garymb/ygomobile/utils/CrashHandler.java
...src/main/java/cn/garymb/ygomobile/utils/CrashHandler.java
+1
-1
No files found.
libcore/src/main/java/cn/garymb/ygomobile/YGOMobileActivity.java
View file @
a0f630b0
...
@@ -78,6 +78,9 @@ public class YGOMobileActivity extends NativeActivity implements
...
@@ -78,6 +78,9 @@ public class YGOMobileActivity extends NativeActivity implements
private
Handler
handler
=
new
Handler
();
private
Handler
handler
=
new
Handler
();
private
FullScreenUtils
mFullScreenUtils
;
private
FullScreenUtils
mFullScreenUtils
;
// public static int notchHeight;
private
GameApplication
app
()
{
private
GameApplication
app
()
{
if
(
mApp
==
null
)
{
if
(
mApp
==
null
)
{
synchronized
(
this
)
{
synchronized
(
this
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/AppsSettings.java
View file @
a0f630b0
...
@@ -27,6 +27,7 @@ import cn.garymb.ygomobile.utils.SystemUtils;
...
@@ -27,6 +27,7 @@ import cn.garymb.ygomobile.utils.SystemUtils;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_EXPANSIONS
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_EXPANSIONS
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_SYSTEM_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
CORE_SYSTEM_PATH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_FONT_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_FONT_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_NOTCH_HEIGHT
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_ONLY_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_ONLY_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_READ_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
DEF_PREF_READ_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEF_IMMERSIVE_MODE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_DEF_IMMERSIVE_MODE
;
...
@@ -34,6 +35,7 @@ import static cn.garymb.ygomobile.Constants.PREF_DEF_SENSOR_REFRESH;
...
@@ -34,6 +35,7 @@ import static cn.garymb.ygomobile.Constants.PREF_DEF_SENSOR_REFRESH;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_FONT_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_FONT_SIZE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_IMMERSIVE_MODE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_IMMERSIVE_MODE
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_LOCK_SCREEN
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_LOCK_SCREEN
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_NOTCH_HEIGHT
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_ONLY_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_ONLY_GAME
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_READ_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_READ_EX
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_SENSOR_REFRESH
;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
PREF_SENSOR_REFRESH
;
...
@@ -44,14 +46,14 @@ public class AppsSettings {
...
@@ -44,14 +46,14 @@ public class AppsSettings {
private
Context
context
;
private
Context
context
;
private
PreferenceFragmentPlus
.
SharedPreferencesPlus
mSharedPreferences
;
private
PreferenceFragmentPlus
.
SharedPreferencesPlus
mSharedPreferences
;
private
float
mScreenHeight
,
mScreenWidth
,
mDensity
;
private
float
mScreenHeight
,
mScreenWidth
,
mDensity
;
public
static
int
notchHeight
;
private
AppsSettings
(
Context
context
)
{
private
AppsSettings
(
Context
context
)
{
this
.
context
=
context
;
this
.
context
=
context
;
mSharedPreferences
=
PreferenceFragmentPlus
.
SharedPreferencesPlus
.
create
(
context
,
context
.
getPackageName
()
+
".settings"
);
mSharedPreferences
=
PreferenceFragmentPlus
.
SharedPreferencesPlus
.
create
(
context
,
context
.
getPackageName
()
+
".settings"
);
mSharedPreferences
.
setAutoSave
(
true
);
mSharedPreferences
.
setAutoSave
(
true
);
Log
.
e
(
"YGOMobile
"
,
"初始化AppsSettings"
);
Log
.
e
(
"YGOMobile
Log"
,
"初始化类地址: "
+
System
.
identityHashCode
(
this
)
);
update
(
context
);
update
(
context
);
}
}
...
@@ -65,23 +67,6 @@ public class AppsSettings {
...
@@ -65,23 +67,6 @@ public class AppsSettings {
return
sAppsSettings
;
return
sAppsSettings
;
}
}
//获取刘海高度
public
int
getNotchHeight
()
{
return
notchHeight
;
}
//设置刘海高度
public
void
setNotchHeight
(
int
notchHeight
)
{
this
.
notchHeight
=
notchHeight
;
try
{
FileLogUtil
.
writeAndTime
(
"设置刘海高度"
+
notchHeight
);
FileLogUtil
.
writeAndTime
(
"当前文件设置刘海高度"
+
this
.
notchHeight
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
public
File
getSystemConfig
()
{
public
File
getSystemConfig
()
{
return
new
File
(
getResourcePath
(),
CORE_SYSTEM_PATH
);
return
new
File
(
getResourcePath
(),
CORE_SYSTEM_PATH
);
}
}
...
@@ -96,7 +81,9 @@ public class AppsSettings {
...
@@ -96,7 +81,9 @@ public class AppsSettings {
if
(
dm
!=
null
)
{
if
(
dm
!=
null
)
{
int
height
=
Math
.
max
(
dm
.
widthPixels
,
dm
.
heightPixels
);
int
height
=
Math
.
max
(
dm
.
widthPixels
,
dm
.
heightPixels
);
Log
.
e
(
"YGOMobileLog"
,
"类地址"
+
System
.
identityHashCode
(
this
));
int
notchHeight
=
getNotchHeight
();
try
{
try
{
FileLogUtil
.
writeAndTime
(
"是否沉浸: "
+
isImmerSiveMode
());
FileLogUtil
.
writeAndTime
(
"是否沉浸: "
+
isImmerSiveMode
());
...
@@ -105,7 +92,6 @@ public class AppsSettings {
...
@@ -105,7 +92,6 @@ public class AppsSettings {
FileLogUtil
.
writeAndTime
(
"界面长: "
+
dm
.
heightPixels
);
FileLogUtil
.
writeAndTime
(
"界面长: "
+
dm
.
heightPixels
);
FileLogUtil
.
writeAndTime
(
"界面宽: "
+
dm
.
widthPixels
);
FileLogUtil
.
writeAndTime
(
"界面宽: "
+
dm
.
widthPixels
);
FileLogUtil
.
writeAndTime
(
"刘海长: "
+
notchHeight
);
FileLogUtil
.
writeAndTime
(
"刘海长: "
+
notchHeight
);
FileLogUtil
.
writeAndTime
(
"get刘海长: "
+
getNotchHeight
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
@@ -159,6 +145,14 @@ public class AppsSettings {
...
@@ -159,6 +145,14 @@ public class AppsSettings {
return
true
;
// mSharedPreferences.getBoolean(PREF_DECK_DELETE_DILAOG, PREF_DEF_DECK_DELETE_DILAOG);
return
true
;
// mSharedPreferences.getBoolean(PREF_DECK_DELETE_DILAOG, PREF_DEF_DECK_DELETE_DILAOG);
}
}
public
int
getNotchHeight
()
{
return
mSharedPreferences
.
getInt
(
PREF_NOTCH_HEIGHT
,
DEF_PREF_NOTCH_HEIGHT
);
}
public
void
setNotchHeight
(
int
height
){
mSharedPreferences
.
putInt
(
PREF_NOTCH_HEIGHT
,
height
);
}
public
int
getFontSize
()
{
public
int
getFontSize
()
{
return
mSharedPreferences
.
getInt
(
PREF_FONT_SIZE
,
DEF_PREF_FONT_SIZE
);
return
mSharedPreferences
.
getInt
(
PREF_FONT_SIZE
,
DEF_PREF_FONT_SIZE
);
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
a0f630b0
...
@@ -95,6 +95,8 @@ public interface Constants {
...
@@ -95,6 +95,8 @@ public interface Constants {
String
PREF_FONT_SIZE
=
"pref_settings_font_size"
;
String
PREF_FONT_SIZE
=
"pref_settings_font_size"
;
int
DEF_PREF_FONT_SIZE
=
14
;
int
DEF_PREF_FONT_SIZE
=
14
;
String
PREF_NOTCH_HEIGHT
=
"pref_notch_height"
;
int
DEF_PREF_NOTCH_HEIGHT
=
0
;
String
PREF_ONLY_GAME
=
"pref_settings_only_game"
;
String
PREF_ONLY_GAME
=
"pref_settings_only_game"
;
boolean
DEF_PREF_ONLY_GAME
=
false
;
boolean
DEF_PREF_ONLY_GAME
=
false
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
a0f630b0
...
@@ -55,6 +55,8 @@ import cn.garymb.ygodata.YGOGameOptions;
...
@@ -55,6 +55,8 @@ import cn.garymb.ygodata.YGOGameOptions;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.GameApplication
;
import
cn.garymb.ygomobile.YGOMobileActivity
;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.YGOStarter
;
import
cn.garymb.ygomobile.bean.ServerInfo
;
import
cn.garymb.ygomobile.bean.ServerInfo
;
import
cn.garymb.ygomobile.bean.events.ServerInfoEvent
;
import
cn.garymb.ygomobile.bean.events.ServerInfoEvent
;
...
@@ -135,7 +137,6 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
...
@@ -135,7 +137,6 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
//萌卡
//萌卡
StartMycard
();
StartMycard
();
checkNotch
();
checkNotch
();
}
}
//检查是否有刘海
//检查是否有刘海
...
@@ -148,8 +149,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
...
@@ -148,8 +149,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
// AppsSettings.get().setNotchHeight(notchHeight);
AppsSettings
.
get
().
setNotchHeight
(
notchHeight
);
AppsSettings
.
notchHeight
=
notchHeight
;
}
}
});
});
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/CrashHandler.java
View file @
a0f630b0
...
@@ -127,7 +127,7 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
...
@@ -127,7 +127,7 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
try
{
try
{
// long timestamp = System.currentTimeMillis();
// long timestamp = System.currentTimeMillis();
String
time
=
formatter
.
format
(
new
Date
());
String
time
=
formatter
.
format
(
new
Date
());
String
fileName
=
"【
Demo
】"
+
time
+
/* timestamp +*/
".log"
;
String
fileName
=
"【
YGO
】"
+
time
+
/* timestamp +*/
".log"
;
String
path
=
AppsSettings
.
get
().
getMobileLogPath
()
+
"/"
;
String
path
=
AppsSettings
.
get
().
getMobileLogPath
()
+
"/"
;
FileOutputStream
fos
=
new
FileOutputStream
(
path
+
fileName
);
FileOutputStream
fos
=
new
FileOutputStream
(
path
+
fileName
);
fos
.
write
(
sb
.
toString
().
getBytes
());
fos
.
write
(
sb
.
toString
().
getBytes
());
...
...
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