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
300d6d94
Commit
300d6d94
authored
Jan 21, 2020
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
名字改动
parent
c17774e6
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
34 additions
and
31 deletions
+34
-31
mobile/src/main/AndroidManifest.xml
mobile/src/main/AndroidManifest.xml
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchActivityImpl.java
.../cn/garymb/ygomobile/ui/cards/CardSearchActivityImpl.java
+4
-4
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
...cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
+2
-3
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
...c/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
+1
-1
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/DuelAssistantService.java
...ava/cn/garymb/ygomobile/ui/plus/DuelAssistantService.java
+13
-13
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
...mb/ygomobile/ui/preference/fragments/SettingFragment.java
+3
-5
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
+10
-4
No files found.
mobile/src/main/AndroidManifest.xml
View file @
300d6d94
...
...
@@ -198,7 +198,7 @@
<!-- 为防止Service被系统回收,可以尝试通过提高服务的优先级解决,1000是最高优先级,数字越小,优先级越低 -->
<!--android:priority="1000"-->
<service
android:name=
"cn.garymb.ygomobile.ui.plus.
ServiceDuelAssistant
"
android:name=
"cn.garymb.ygomobile.ui.plus.
DuelAssistantService
"
android:priority=
"1000"
/>
<!-- 如果已经安装过原版YGOMobile,请注释掉或修改成其他,否则会导致无法安装 -->
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/CardSearchActivityImpl.java
View file @
300d6d94
...
...
@@ -32,7 +32,7 @@ import cn.garymb.ygomobile.ui.adapters.CardListAdapter;
import
cn.garymb.ygomobile.ui.home.HomeActivity
;
import
cn.garymb.ygomobile.ui.plus.AOnGestureListener
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.
ServiceDuelAssistant
;
import
cn.garymb.ygomobile.ui.plus.
DuelAssistantService
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
ocgcore.DataManager
;
import
ocgcore.LimitManager
;
...
...
@@ -65,7 +65,7 @@ class CardSearchActivityImpl extends BaseActivity implements CardLoader.CallBack
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
currentCardSearchMessage
=
HomeActivity
.
cardSearchMessage
;
}
else
{
currentCardSearchMessage
=
ServiceDuelAssistant
.
cardSearchMessage
;
currentCardSearchMessage
=
DuelAssistantService
.
cardSearchMessage
;
}
}
Toolbar
toolbar
=
$
(
R
.
id
.
toolbar
);
...
...
@@ -115,7 +115,7 @@ class CardSearchActivityImpl extends BaseActivity implements CardLoader.CallBack
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
currentCardSearchMessage
=
HomeActivity
.
cardSearchMessage
;
}
else
{
currentCardSearchMessage
=
ServiceDuelAssistant
.
cardSearchMessage
;
currentCardSearchMessage
=
DuelAssistantService
.
cardSearchMessage
;
}
intentSearch
();
}
...
...
@@ -126,7 +126,7 @@ class CardSearchActivityImpl extends BaseActivity implements CardLoader.CallBack
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
currentCardSearchMessage
=
HomeActivity
.
cardSearchMessage
;
}
else
{
currentCardSearchMessage
=
ServiceDuelAssistant
.
cardSearchMessage
;
currentCardSearchMessage
=
DuelAssistantService
.
cardSearchMessage
;
}
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/DeckManagerActivityImpl.java
View file @
300d6d94
...
...
@@ -69,10 +69,9 @@ import cn.garymb.ygomobile.ui.mycard.mcchat.util.ImageUtil;
import
cn.garymb.ygomobile.ui.plus.AOnGestureListener
;
import
cn.garymb.ygomobile.ui.plus.DefaultOnBoomListener
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.
ServiceDuelAssistant
;
import
cn.garymb.ygomobile.ui.plus.
DuelAssistantService
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.BitmapUtil
;
import
cn.garymb.ygomobile.utils.DeckUtil
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.ShareUtil
;
...
...
@@ -799,7 +798,7 @@ class DeckManagerActivityImpl extends BaseCardsAcitivity implements RecyclerView
@Override
public
void
onClick
(
View
v
)
{
du
.
dis
();
stopService
(
new
Intent
(
DeckManagerActivityImpl
.
this
,
ServiceDuelAssistant
.
class
));
stopService
(
new
Intent
(
DeckManagerActivityImpl
.
this
,
DuelAssistantService
.
class
));
YGOUtil
.
copyMessage
(
DeckManagerActivityImpl
.
this
,
et_code
.
getText
().
toString
().
trim
());
showToast
(
getString
(
R
.
string
.
deck_text_copyed
));
//复制完毕开启决斗助手
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/home/HomeActivity.java
View file @
300d6d94
...
...
@@ -151,7 +151,7 @@ public abstract class HomeActivity extends BaseActivity implements NavigationVie
TrPay
.
getInstance
(
HomeActivity
.
this
).
initPaySdk
(
"e1014da420ea4405898c01273d6731b6"
,
"YGOMobile"
);
//check update
Beta
.
checkUpgrade
(
false
,
false
);
//
ServiceDuelAssistant
//
DuelAssistantService
YGOUtil
.
startDuelService
(
this
);
//萌卡
StartMycard
();
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/
ServiceDuelAssistant
.java
→
mobile/src/main/java/cn/garymb/ygomobile/ui/plus/
DuelAssistantService
.java
View file @
300d6d94
...
...
@@ -49,9 +49,9 @@ import cn.garymb.ygomobile.utils.PermissionUtil;
import
static
cn
.
garymb
.
ygomobile
.
Constants
.
ASSET_SERVER_LIST
;
public
class
ServiceDuelAssistant
extends
Service
{
public
class
DuelAssistantService
extends
Service
{
private
final
static
String
TAG
=
"
ServiceDuelAssistant
"
;
private
final
static
String
TAG
=
"
DuelAssistantService
"
;
private
static
final
String
CHANNEL_ID
=
"YGOMobile"
;
private
static
final
String
CHANNEL_NAME
=
"Duel_Assistant"
;
private
final
static
String
DUEL_ASSISTANT_SERVICE_ACTION
=
"YGOMOBILE:ACTION_DUEL_ASSISTANT_SERVICE"
;
...
...
@@ -193,7 +193,7 @@ public class ServiceDuelAssistant extends Service {
return
;
}
//如果有悬浮窗权限再显示
if
(
PermissionUtil
.
isServicePermission
(
ServiceDuelAssistant
.
this
,
false
))
if
(
PermissionUtil
.
isServicePermission
(
DuelAssistantService
.
this
,
false
))
joinRoom
(
clipMessage
,
start
,
end
);
}
else
{
for
(
String
s
:
cardSearchKey
)
{
...
...
@@ -209,7 +209,7 @@ public class ServiceDuelAssistant extends Service {
if
(
cardSearchMessage
.
contains
(
"="
)
&&
clipMessage
.
contains
(
"."
))
{
return
;
}
Intent
intent
=
new
Intent
(
ServiceDuelAssistant
.
this
,
CardSearchAcitivity
.
class
);
Intent
intent
=
new
Intent
(
DuelAssistantService
.
this
,
CardSearchAcitivity
.
class
);
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
intent
.
putExtra
(
CardSearchAcitivity
.
SEARCH_MESSAGE
,
cardSearchMessage
);
startActivity
(
intent
);
...
...
@@ -253,7 +253,7 @@ public class ServiceDuelAssistant extends Service {
}
else
{
//如果没有通知权限则关闭服务
stopForeground
(
true
);
stopService
(
new
Intent
(
ServiceDuelAssistant
.
this
,
ServiceDuelAssistant
.
class
));
stopService
(
new
Intent
(
DuelAssistantService
.
this
,
DuelAssistantService
.
class
));
}
}
}
...
...
@@ -278,7 +278,7 @@ public class ServiceDuelAssistant extends Service {
break
;
case
CMD_START_GAME:
Intent
intent2
=
new
Intent
(
ServiceDuelAssistant
.
this
,
MainActivity
.
class
);
Intent
intent2
=
new
Intent
(
DuelAssistantService
.
this
,
MainActivity
.
class
);
intent2
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
intent2
);
break
;
...
...
@@ -348,7 +348,7 @@ public class ServiceDuelAssistant extends Service {
if
(
isUrl
)
{
Deck
deckInfo
=
new
Deck
(
getString
(
R
.
string
.
rename_deck
)
+
System
.
currentTimeMillis
(),
Uri
.
parse
(
deckMessage
));
File
file
=
deckInfo
.
saveTemp
(
AppsSettings
.
get
().
getDeckDir
());
Intent
startdeck
=
new
Intent
(
ServiceDuelAssistant
.
this
,
DeckManagerActivity
.
getDeckManager
());
Intent
startdeck
=
new
Intent
(
DuelAssistantService
.
this
,
DeckManagerActivity
.
getDeckManager
());
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
file
.
getAbsolutePath
());
startdeck
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
startdeck
);
...
...
@@ -357,13 +357,13 @@ public class ServiceDuelAssistant extends Service {
try
{
//以当前时间戳作为卡组名保存卡组
File
file
=
DeckUtils
.
save
(
getString
(
R
.
string
.
rename_deck
)
+
System
.
currentTimeMillis
(),
deckMessage
);
Intent
startdeck
=
new
Intent
(
ServiceDuelAssistant
.
this
,
DeckManagerActivity
.
getDeckManager
());
Intent
startdeck
=
new
Intent
(
DuelAssistantService
.
this
,
DeckManagerActivity
.
getDeckManager
());
startdeck
.
putExtra
(
Intent
.
EXTRA_TEXT
,
file
.
getAbsolutePath
());
startdeck
.
addFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
startActivity
(
startdeck
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
Toast
.
makeText
(
ServiceDuelAssistant
.
this
,
getString
(
R
.
string
.
save_failed_bcos
)
+
e
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
DuelAssistantService
.
this
,
getString
(
R
.
string
.
save_failed_bcos
)
+
e
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
}
...
...
@@ -400,14 +400,14 @@ public class ServiceDuelAssistant extends Service {
isdis
=
false
;
mWindowManager
.
removeView
(
mFloatLayout
);
}
ServerListAdapter
mServerListAdapter
=
new
ServerListAdapter
(
ServiceDuelAssistant
.
this
);
ServerListAdapter
mServerListAdapter
=
new
ServerListAdapter
(
DuelAssistantService
.
this
);
ServerListManager
mServerListManager
=
new
ServerListManager
(
ServiceDuelAssistant
.
this
,
mServerListAdapter
);
ServerListManager
mServerListManager
=
new
ServerListManager
(
DuelAssistantService
.
this
,
mServerListAdapter
);
mServerListManager
.
syncLoadData
();
File
xmlFile
=
new
File
(
getFilesDir
(),
Constants
.
SERVER_FILE
);
VUiKit
.
defer
().
when
(()
->
{
ServerList
assetList
=
ServerListManager
.
readList
(
ServiceDuelAssistant
.
this
.
getAssets
().
open
(
ASSET_SERVER_LIST
));
ServerList
assetList
=
ServerListManager
.
readList
(
DuelAssistantService
.
this
.
getAssets
().
open
(
ASSET_SERVER_LIST
));
ServerList
fileList
=
xmlFile
.
exists
()
?
ServerListManager
.
readList
(
new
FileInputStream
(
xmlFile
))
:
null
;
if
(
fileList
==
null
)
{
return
assetList
;
...
...
@@ -422,7 +422,7 @@ public class ServiceDuelAssistant extends Service {
ServerInfo
serverInfo
=
list
.
getServerInfoList
().
get
(
0
);
duelIntent
(
ServiceDuelAssistant
.
this
,
serverInfo
.
getServerAddr
(),
serverInfo
.
getPort
(),
serverInfo
.
getPlayerName
(),
password
);
duelIntent
(
DuelAssistantService
.
this
,
serverInfo
.
getServerAddr
(),
serverInfo
.
getPort
(),
serverInfo
.
getPlayerName
(),
password
);
}
});
...
...
mobile/src/main/java/cn/garymb/ygomobile/ui/preference/fragments/SettingFragment.java
View file @
300d6d94
...
...
@@ -35,16 +35,14 @@ import cn.garymb.ygomobile.App;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.Constants
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.home.HomeActivity
;
import
cn.garymb.ygomobile.ui.home.MainActivity
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.
ServiceDuelAssistant
;
import
cn.garymb.ygomobile.ui.plus.
DuelAssistantService
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.ui.preference.PreferenceFragmentPlus
;
import
cn.garymb.ygomobile.utils.FileUtils
;
import
cn.garymb.ygomobile.utils.IOUtils
;
import
cn.garymb.ygomobile.utils.SystemUtils
;
import
cn.garymb.ygomobile.utils.PermissionUtil
;
import
ocgcore.ConfigManager
;
import
ocgcore.DataManager
;
...
...
@@ -192,9 +190,9 @@ public class SettingFragment extends PreferenceFragmentPlus {
//开关决斗助手
if
(
preference
.
getKey
().
equals
(
PREF_START_SERVICEDUELASSISTANT
))
{
if
(
checkBoxPreference
.
isChecked
())
{
getActivity
().
startService
(
new
Intent
(
getActivity
(),
ServiceDuelAssistant
.
class
));
getActivity
().
startService
(
new
Intent
(
getActivity
(),
DuelAssistantService
.
class
));
}
else
{
getActivity
().
stopService
(
new
Intent
(
getActivity
(),
ServiceDuelAssistant
.
class
));
getActivity
().
stopService
(
new
Intent
(
getActivity
(),
DuelAssistantService
.
class
));
}
}
return
true
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
View file @
300d6d94
...
...
@@ -14,9 +14,8 @@ import androidx.core.content.ContextCompat;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
import
cn.garymb.ygomobile.ui.plus.
ServiceDuelAssistant
;
import
cn.garymb.ygomobile.ui.plus.
DuelAssistantService
;
public
class
YGOUtil
{
...
...
@@ -32,6 +31,11 @@ public class YGOUtil {
return
App
.
get
().
getResources
().
getString
(
stringId
);
}
/**
* 根据卡密获取高清图下载地址
* @param code 卡密
* @return 高清图url
*/
public
static
String
getCardImageDetailUrl
(
int
code
){
return
"https://code.mycard.moe/fallenstardust/ygoimage/raw/master/"
+
code
+
".jpg"
;
}
...
...
@@ -53,6 +57,8 @@ public class YGOUtil {
//复制字符串到剪贴板
public
static
void
copyMessage
(
Context
context
,
String
message
)
{
ClipboardManager
cmb
=
(
ClipboardManager
)
context
.
getSystemService
(
Context
.
CLIPBOARD_SERVICE
);
if
(
cmb
==
null
)
return
;
cmb
.
setPrimaryClip
(
ClipData
.
newPlainText
(
null
,
message
));
//复制命令
}
...
...
@@ -61,11 +67,11 @@ public class YGOUtil {
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
DialogPlus
dialogPlus
=
PermissionUtil
.
isNotificationPermission
(
context
);
if
(
dialogPlus
==
null
)
context
.
startForegroundService
(
new
Intent
(
context
,
ServiceDuelAssistant
.
class
));
context
.
startForegroundService
(
new
Intent
(
context
,
DuelAssistantService
.
class
));
else
dialogPlus
.
show
();
}
else
{
context
.
startService
(
new
Intent
(
context
,
ServiceDuelAssistant
.
class
));
context
.
startService
(
new
Intent
(
context
,
DuelAssistantService
.
class
));
}
}
}
...
...
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