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
8423a99e
Commit
8423a99e
authored
Oct 01, 2021
by
feihuaduo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡组1.0协议优化,减短url长度
parent
dfdc0d7b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
251 additions
and
99 deletions
+251
-99
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
+1
-0
mobile/src/main/java/cn/garymb/ygomobile/bean/Deck.java
mobile/src/main/java/cn/garymb/ygomobile/bean/Deck.java
+173
-74
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
+77
-25
No files found.
mobile/src/main/java/cn/garymb/ygomobile/Constants.java
View file @
8423a99e
...
...
@@ -209,6 +209,7 @@ public interface Constants {
String
QUERY_YDK
=
"ydk"
;
String
QUERY_NAME
=
"name"
;
String
QUERY_MAIN
=
"m"
;
String
QUERY_DECK
=
"d"
;
String
QUERY_EXTRA
=
"e"
;
String
QUERY_SIDE
=
"s"
;
String
QUERY_VERSION
=
"v"
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/bean/Deck.java
View file @
8423a99e
This diff is collapsed.
Click to expand it.
mobile/src/main/java/cn/garymb/ygomobile/utils/YGOUtil.java
View file @
8423a99e
...
...
@@ -17,7 +17,6 @@ import com.ourygo.assistant.util.PermissionUtil;
import
com.ourygo.assistant.util.Util
;
import
cn.garymb.ygomobile.App
;
import
cn.garymb.ygomobile.AppsSettings
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.plus.DialogPlus
;
...
...
@@ -36,6 +35,51 @@ public class YGOUtil {
return
App
.
get
().
getResources
().
getString
(
stringId
);
}
public
static
byte
[]
toBytes
(
String
bits
)
{
int
y
=
bits
.
length
()
%
8
;
Log
.
e
(
"Deck"
,
bits
.
length
()+
"之前余数"
+
y
);
if
(
y
!=
0
)
bits
=
toNumLengthLast
(
bits
,
bits
.
length
()+
8
-
y
);
Log
.
e
(
"Deck"
,
bits
.
length
()+
"余数"
+
y
);
byte
[]
bytes
=
new
byte
[
bits
.
length
()/
8
];
for
(
int
i
=
0
;
i
<
bits
.
length
()/
8
;
i
++)
{
bytes
[
i
]
=
(
byte
)
Integer
.
valueOf
(
bits
.
substring
(
i
*
8
,
i
*
8
+
8
),
2
).
intValue
();
if
(
i
<
8
){
Log
.
e
(
"Deck"
,
bits
.
substring
(
i
*
8
,
i
*
8
+
8
)+
" 字节 "
+
bytes
[
i
]
);
}
}
Log
.
e
(
"Deck"
,
"二进制"
+
bits
);
return
bytes
;
}
public
static
String
toNumLength
(
String
message
,
int
num
)
{
while
(
message
.
length
()
<
num
)
{
message
=
"0"
+
message
;
}
return
message
;
}
public
static
String
toNumLengthLast
(
String
message
,
int
num
)
{
while
(
message
.
length
()
<
num
)
{
message
+=
"0"
;
}
return
message
;
}
public
static
String
[]
toNumLength
(
String
[]
nums
,
int
num
)
{
if
(
nums
.
length
<
num
)
{
String
[]
bms
=
nums
;
nums
=
new
String
[
num
];
for
(
int
i
=
0
;
i
<
num
-
bms
.
length
;
i
++)
nums
[
i
]
=
"0"
;
for
(
int
i
=
0
;
i
<
bms
.
length
;
i
++)
nums
[
i
+
num
-
bms
.
length
]
=
bms
[
i
];
}
return
nums
;
}
/**
* 根据卡密获取高清图下载地址
*
...
...
@@ -46,6 +90,14 @@ public class YGOUtil {
return
"https://cdn02.moecube.com:444/ygomobile-images/"
+
code
+
".png"
;
}
public
static
String
getArrayString
(
String
[]
bytes
,
int
start
,
int
end
)
{
String
message
=
""
;
for
(
int
i
=
start
;
i
<
end
;
i
++)
{
message
+=
bytes
[
i
];
}
return
message
;
}
//关闭输入法
public
static
void
closeKeyboard
(
Activity
activity
)
{
...
...
@@ -96,9 +148,9 @@ public class YGOUtil {
dialog
.
setOnDismissListener
(
new
DialogInterface
.
OnDismissListener
()
{
@Override
public
void
onDismiss
(
DialogInterface
dialogInterface
)
{
Log
.
e
(
"YGOUtil"
,
"当前版本"
+
Build
.
VERSION
.
SDK_INT
);
Log
.
e
(
"YGOUtil"
,
"o的版本"
+
Build
.
VERSION_CODES
.
O
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
&&
!
PermissionUtil
.
isNotificationListenerEnabled
(
context
))
{
Log
.
e
(
"YGOUtil"
,
"当前版本"
+
Build
.
VERSION
.
SDK_INT
);
Log
.
e
(
"YGOUtil"
,
"o的版本"
+
Build
.
VERSION_CODES
.
O
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
&&
!
PermissionUtil
.
isNotificationListenerEnabled
(
context
))
{
getNotificationPermissionDialog
(
context
).
show
();
}
}
...
...
@@ -118,27 +170,27 @@ public class YGOUtil {
public
static
DialogPlus
getNotificationPermissionDialog
(
Context
context
)
{
DialogPlus
dialog
=
new
DialogPlus
(
context
);
dialog
.
setTitle
(
R
.
string
.
tip
);
dialog
.
setMessage
(
R
.
string
.
EXPAND_STATUS_BAR
);
dialog
.
setLeftButtonText
(
R
.
string
.
to_open
);
dialog
.
setRightButtonText
(
R
.
string
.
Cancel
);
dialog
.
setLeftButtonListener
(
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
// 根据isOpened结果,判断是否需要提醒用户跳转AppInfo页面,去打开App通知权限
context
.
startActivity
(
Util
.
getNotificationPermissionInitent
(
context
));
dialog
.
dismiss
();
}
});
dialog
.
setRightButtonListener
(
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
dialog
.
dismiss
();
}
});
return
dialog
;
DialogPlus
dialog
=
new
DialogPlus
(
context
);
dialog
.
setTitle
(
R
.
string
.
tip
);
dialog
.
setMessage
(
R
.
string
.
EXPAND_STATUS_BAR
);
dialog
.
setLeftButtonText
(
R
.
string
.
to_open
);
dialog
.
setRightButtonText
(
R
.
string
.
Cancel
);
dialog
.
setLeftButtonListener
(
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
// 根据isOpened结果,判断是否需要提醒用户跳转AppInfo页面,去打开App通知权限
context
.
startActivity
(
Util
.
getNotificationPermissionInitent
(
context
));
dialog
.
dismiss
();
}
});
dialog
.
setRightButtonListener
(
new
DialogInterface
.
OnClickListener
()
{
@Override
public
void
onClick
(
DialogInterface
dialogInterface
,
int
i
)
{
dialog
.
dismiss
();
}
});
return
dialog
;
}
...
...
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