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
bd0682d2
Commit
bd0682d2
authored
Dec 09, 2018
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化软件启动速度
parent
250ff94b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
68 additions
and
34 deletions
+68
-34
libcore/src/main/java/cn/garymb/ygomobile/GameApplication.java
...re/src/main/java/cn/garymb/ygomobile/GameApplication.java
+11
-2
mobile/build.gradle
mobile/build.gradle
+0
-2
mobile/src/main/java/cn/garymb/ygomobile/App.java
mobile/src/main/java/cn/garymb/ygomobile/App.java
+5
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
.../java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
...cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
+5
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+5
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
+7
-7
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
...ava/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
+2
-0
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
...mb/ygomobile/ui/preference/fragments/SettingFragment.java
+31
-21
mobile/src/main/res/layout/activity_home.xml
mobile/src/main/res/layout/activity_home.xml
+1
-1
No files found.
libcore/src/main/java/cn/garymb/ygomobile/GameApplication.java
View file @
bd0682d2
...
...
@@ -20,12 +20,13 @@ public abstract class GameApplication extends Application implements IrrlichtBri
private
Map
<
String
,
Integer
>
mSoundIdMap
;
private
static
GameApplication
sGameApplication
;
private
boolean
isInitSoundEffectPool
=
false
;
@Override
public
void
onCreate
()
{
super
.
onCreate
();
sGameApplication
=
this
;
initSoundEffectPool
();
//
initSoundEffectPool();
}
public
static
GameApplication
get
()
{
...
...
@@ -43,8 +44,16 @@ public abstract class GameApplication extends Application implements IrrlichtBri
mSoundEffectPool
.
release
();
}
public
boolean
isInitSoundEffectPool
()
{
return
isInitSoundEffectPool
;
}
protected
void
setInitSoundEffectPool
(
boolean
initSoundEffectPool
)
{
isInitSoundEffectPool
=
initSoundEffectPool
;
}
@SuppressWarnings
(
"deprecation"
)
p
rotected
void
initSoundEffectPool
()
{
p
ublic
void
initSoundEffectPool
()
{
mSoundEffectPool
=
new
SoundPool
(
2
,
AudioManager
.
STREAM_MUSIC
,
0
);
AssetManager
am
=
getAssets
();
String
[]
sounds
;
...
...
mobile/build.gradle
View file @
bd0682d2
...
...
@@ -86,8 +86,6 @@ dependencies {
implementation
'com.android.support:design:'
+
rootProject
.
ext
.
supportVersion
implementation
'org.jdeferred:jdeferred-android-aar:1.2.4'
implementation
'org.jdeferred:jdeferred-android-aar:1.2.4'
implementation
'com.github.bumptech.glide:glide:3.7.0'
implementation
'com.github.bumptech.glide:glide:3.7.0'
implementation
(
'com.github.chrisbanes.photoview:library:1.2.4'
)
{
implementation
'com.github.chrisbanes.photoview:library:1.2.4'
...
...
mobile/src/main/java/cn/garymb/ygomobile/App.java
View file @
bd0682d2
...
...
@@ -12,6 +12,11 @@ public class App extends GameApplication {
super
.
onCreate
();
AppCompatDelegate
.
setCompatVectorFromResourcesEnabled
(
true
);
AppsSettings
.
init
(
this
);
if
(
AppsSettings
.
get
().
isSoundEffect
())
{
initSoundEffectPool
();
setInitSoundEffectPool
(
true
);
}
// QbSdk.initX5Environment(this, null);
// QbSdk.setCurrentID("");
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/activities/LogoActivity.java
View file @
bd0682d2
...
...
@@ -37,7 +37,7 @@ public class LogoActivity extends Activity {
finish
();
}
};
handler
.
postDelayed
(
runnable
,
1
5
00
);
handler
.
postDelayed
(
runnable
,
1
0
00
);
Toast
.
makeText
(
LogoActivity
.
this
,
R
.
string
.
logo_text
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
View file @
bd0682d2
...
...
@@ -873,6 +873,11 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_sort
,
R
.
string
.
sort
,
R
.
drawable
.
sort
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_quit
,
R
.
string
.
quit
,
R
.
drawable
.
quit
);
//设置展开或隐藏的延时。 默认值为 800ms。
menu
.
setDuration
(
150
);
//设置每两个子按钮之间动画的延时(ms为单位)。 比如,如果延时设为0,那么所有子按钮都会同时展开或隐藏,默认值为100ms。
menu
.
setDelay
(
10
);
menu
.
setOnBoomListener
(
new
DefaultOnBoomListener
()
{
@Override
public
void
onClicked
(
int
index
,
BoomButton
boomButton
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
bd0682d2
...
...
@@ -400,6 +400,11 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
action_settings
,
R
.
string
.
settings
,
R
.
drawable
.
setting
);
addMenuButton
(
mMenuIds
,
menu
,
R
.
id
.
nav_donation
,
R
.
string
.
donation
,
R
.
drawable
.
about
);
//设置展开或隐藏的延时。 默认值为 800ms。
menu
.
setDuration
(
220
);
//设置每两个子按钮之间动画的延时(ms为单位)。 比如,如果延时设为0,那么所有子按钮都会同时展开或隐藏,默认值为100ms。
menu
.
setDelay
(
20
);
menu
.
setOnBoomListener
(
new
DefaultOnBoomListener
()
{
@Override
public
void
onClicked
(
int
index
,
BoomButton
boomButton
)
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/MainActivity.java
View file @
bd0682d2
...
...
@@ -59,16 +59,16 @@ public class MainActivity extends HomeActivity{
ActivityCompat
.
requestPermissions
(
this
,
PERMISSIONS
,
0
);
}
@SuppressLint
(
"StringFormatMatches"
)
@SuppressLint
(
{
"StringFormatMatches"
,
"StringFormatInvalid"
}
)
@Override
public
void
onRequestPermissionsResult
(
int
requestCode
,
@NonNull
String
[]
permissions
,
@NonNull
int
[]
grantResults
)
{
super
.
onRequestPermissionsResult
(
requestCode
,
permissions
,
grantResults
);
for
(
int
i
=
0
;
i
<
permissions
.
length
;
i
++){
if
(
grantResults
[
i
]
==
PackageManager
.
PERMISSION_DENIED
){
showToast
(
getString
(
R
.
string
.
tip_no_permission
,
permissions
[
i
]));
break
;
}
}
//
for(int i=0;i<permissions.length;i++){
//
if(grantResults[i] == PackageManager.PERMISSION_DENIED){
//
showToast(getString(R.string.tip_no_permission,permissions[i]));
//
break;
//
}
//
}
//资源复制
checkRes
();
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/ServiceDuelAssistant.java
View file @
bd0682d2
...
...
@@ -222,6 +222,8 @@ public class ServiceDuelAssistant extends Service {
@Override
public
int
onStartCommand
(
Intent
intent
,
int
flags
,
int
startId
)
{
if
(
intent
==
null
)
return
super
.
onStartCommand
(
intent
,
flags
,
startId
);
String
action
=
intent
.
getAction
();
Log
.
d
(
TAG
,
"rev action:"
+
action
);
if
(
DUEL_ASSISTANT_SERVICE_ACTION
.
equals
(
action
))
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
View file @
bd0682d2
...
...
@@ -33,6 +33,7 @@ import java.io.FileInputStream;
import
java.io.IOException
;
import
java.io.InputStream
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.lite.R
;
...
...
@@ -96,9 +97,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
addPreferencesFromResource
(
R
.
xml
.
preference_game
);
bind
(
PREF_GAME_PATH
,
mSettings
.
getResourcePath
());
// bind(PREF_GAME_VERSION, mSettings.getVersionString(mSettings.getGameVersion()));
bind
(
PREF_CHANGE_LOG
,
SystemUtils
.
getVersionName
(
getActivity
())
bind
(
PREF_CHANGE_LOG
,
SystemUtils
.
getVersionName
(
getActivity
())
+
"("
+
SystemUtils
.
getVersion
(
getActivity
())
+
")"
);
bind
(
PREF_CHECK_UPDATE
,
getString
(
R
.
string
.
settings_about_author_pref
)+
" : "
+
getString
(
R
.
string
.
settings_author
));
bind
(
PREF_CHECK_UPDATE
,
getString
(
R
.
string
.
settings_about_author_pref
)
+
" : "
+
getString
(
R
.
string
.
settings_author
));
bind
(
PREF_SOUND_EFFECT
,
mSettings
.
isSoundEffect
());
bind
(
PREF_LOCK_SCREEN
,
mSettings
.
isLockSreenOrientation
());
bind
(
PREF_FONT_ANTIALIAS
,
mSettings
.
isFontAntiAlias
());
...
...
@@ -116,7 +117,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
bind
(
PREF_DECK_DELETE_DILAOG
,
mSettings
.
isDialogDelete
());
//bind(PREF_USE_EXTRA_CARD_CARDS, mSettings.isUseExtraCards());
bind
(
SETTINGS_AVATAR
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_ME
).
getAbsolutePath
());
bind
(
SETTINGS_AVATAR
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_ME
).
getAbsolutePath
());
bind
(
SETTINGS_COVER
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_COVER
).
getAbsolutePath
());
bind
(
SETTINGS_CARD_BG
,
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
).
getAbsolutePath
());
bind
(
PREF_FONT_SIZE
,
mSettings
.
getFontSize
());
...
...
@@ -158,10 +159,19 @@ public class SettingFragment extends PreferenceFragmentPlus {
CheckBoxPreference
checkBoxPreference
=
(
CheckBoxPreference
)
preference
;
mSharedPreferences
.
edit
().
putBoolean
(
preference
.
getKey
(),
checkBoxPreference
.
isChecked
()).
apply
();
//如果事设置额外卡库的选项
if
(
preference
.
getKey
().
equals
(
PREF_READ_EX
)){
if
(
preference
.
getKey
().
equals
(
PREF_READ_EX
))
{
//设置使用额外卡库后重新加载卡片数据
DataManager
.
get
().
load
(
true
);
}
//如果是音效开关
if
(
preference
.
getKey
().
equals
(
PREF_SOUND_EFFECT
))
{
//如果打勾开启音效
if
(
checkBoxPreference
.
isChecked
())
{
//如果未初始化音效
if
(
App
.
get
().
isInitSoundEffectPool
())
App
.
get
().
initSoundEffectPool
();
}
}
return
true
;
}
boolean
rs
=
super
.
onPreferenceChange
(
preference
,
value
);
...
...
@@ -186,7 +196,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
.
show
();
}
if
(
PREF_CHECK_UPDATE
.
equals
(
key
))
{
HomeActivity
.
checkPgyerUpdateSilent
(
getActivity
(),
true
,
true
,
true
);
HomeActivity
.
checkPgyerUpdateSilent
(
getActivity
(),
true
,
true
,
true
);
}
if
(
PREF_PENDULUM_SCALE
.
equals
(
key
))
{
CheckBoxPreference
checkBoxPreference
=
(
CheckBoxPreference
)
preference
;
...
...
@@ -203,14 +213,14 @@ public class SettingFragment extends PreferenceFragmentPlus {
View
viewDialog
=
dialog
.
getContentView
();
ImageView
avatar1
=
viewDialog
.
findViewById
(
R
.
id
.
me
);
ImageView
avatar2
=
viewDialog
.
findViewById
(
R
.
id
.
opponent
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_AVATAR_ME
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
],
avatar1
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_AVATAR_OPPONENT
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
],
avatar2
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_AVATAR_ME
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
],
avatar1
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_AVATAR_OPPONENT
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
],
avatar2
);
avatar1
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_ME
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
outFile
,
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
dialog
.
dismiss
();
});
avatar2
.
setOnClickListener
((
v
)
->
{
...
...
@@ -218,10 +228,10 @@ public class SettingFragment extends PreferenceFragmentPlus {
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_AVATAR_OPPONENT
).
getAbsolutePath
();
showImageDialog
(
preference
,
getString
(
R
.
string
.
settings_game_avatar
),
outFile
,
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
true
,
CORE_SKIN_AVATAR_SIZE
[
0
],
CORE_SKIN_AVATAR_SIZE
[
1
]);
dialog
.
dismiss
();
});
}
else
if
(
SETTINGS_COVER
.
equals
(
key
))
{
}
else
if
(
SETTINGS_COVER
.
equals
(
key
))
{
//显示卡背图片对话框
final
DialogPlus
dialog
=
new
DialogPlus
(
getContext
());
dialog
.
setContentView
(
R
.
layout
.
dialog_cover_select
);
...
...
@@ -230,8 +240,8 @@ public class SettingFragment extends PreferenceFragmentPlus {
View
viewDialog
=
dialog
.
getContentView
();
ImageView
cover1
=
viewDialog
.
findViewById
(
R
.
id
.
cover1
);
ImageView
cover2
=
viewDialog
.
findViewById
(
R
.
id
.
cover2
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_COVER
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
],
cover1
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_COVER2
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
],
cover2
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_COVER
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
],
cover1
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_COVER2
,
CORE_SKIN_CARD_COVER_SIZE
[
0
],
CORE_SKIN_CARD_COVER_SIZE
[
1
],
cover2
);
cover1
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_COVER
).
getAbsolutePath
();
...
...
@@ -258,9 +268,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
ImageView
bg
=
viewDialog
.
findViewById
(
R
.
id
.
bg
);
ImageView
bg_menu
=
viewDialog
.
findViewById
(
R
.
id
.
bg_menu
);
ImageView
bg_deck
=
viewDialog
.
findViewById
(
R
.
id
.
bg_deck
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_BG
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_BG_MENU
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg_menu
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_BG_DECK
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg_deck
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_BG
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_BG_MENU
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg_menu
);
setImage
(
mSettings
.
getCoreSkinPath
()
+
"/"
+
Constants
.
CORE_SKIN_BG_DECK
,
CORE_SKIN_BG_SIZE
[
0
],
CORE_SKIN_BG_SIZE
[
1
],
bg_deck
);
bg
.
setOnClickListener
((
v
)
->
{
//打开系统文件相册
String
outFile
=
new
File
(
mSettings
.
getCoreSkinPath
(),
Constants
.
CORE_SKIN_BG
).
getAbsolutePath
();
...
...
@@ -349,13 +359,13 @@ public class SettingFragment extends PreferenceFragmentPlus {
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
layoutParams
.
gravity
=
Gravity
.
CENTER_HORIZONTAL
;
frameLayout
.
addView
(
imageView
,
layoutParams
);
// builder.setContentView(frameLayout);
// builder.setContentView(frameLayout);
//builder.setLeftButtonText(R.string.settings);
//builder.setLeftButtonListener((dlg, s) -> {
showImageCropChooser
(
preference
,
getString
(
R
.
string
.
dialog_select_image
),
outFile
,
isJpeg
,
outWidth
,
outHeight
);
//dlg.dismiss();
// });
showImageCropChooser
(
preference
,
getString
(
R
.
string
.
dialog_select_image
),
outFile
,
isJpeg
,
outWidth
,
outHeight
);
//dlg.dismiss();
// });
// builder.setOnCancelListener((dlg) -> {
// BitmapUtil.destroy(imageView.getDrawable());
// });
...
...
@@ -369,7 +379,7 @@ public class SettingFragment extends PreferenceFragmentPlus {
}
}
public
void
setImage
(
String
outFile
,
int
outWidth
,
int
outHeight
,
ImageView
imageView
)
{
public
void
setImage
(
String
outFile
,
int
outWidth
,
int
outHeight
,
ImageView
imageView
)
{
File
img
=
new
File
(
outFile
);
if
(
img
.
exists
())
{
Glide
.
with
(
this
).
load
(
img
).
signature
(
new
StringSignature
(
img
.
getName
()
+
img
.
lastModified
()))
...
...
mobile/src/main/res/layout/activity_home.xml
View file @
bd0682d2
...
...
@@ -48,7 +48,7 @@
<ImageView
android:id=
"@+id/cube"
android:layout_width=
"40dp"
android:layout_height=
"4
0
dp"
android:layout_height=
"4
1
dp"
android:layout_gravity=
"center"
app:srcCompat=
"@drawable/cube"
/>
</com.nightonke.boommenu.BoomMenuButton>
...
...
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