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
1e1f6808
Commit
1e1f6808
authored
May 19, 2025
by
wangfugui
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开发登录、用户协议功能,优化用户在线卡组页面
parent
d151ae09
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
429 additions
and
172 deletions
+429
-172
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
...va/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
+25
-12
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareFragment.java
...a/cn/garymb/ygomobile/deck_square/DeckSquareFragment.java
+59
-1
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareListAdapter.java
...n/garymb/ygomobile/deck_square/DeckSquareListAdapter.java
+9
-1
mobile/src/main/java/cn/garymb/ygomobile/deck_square/LoginDialog.java
...ain/java/cn/garymb/ygomobile/deck_square/LoginDialog.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MCOnlineManageFragment.java
.../garymb/ygomobile/deck_square/MCOnlineManageFragment.java
+49
-14
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
...va/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
+16
-12
mobile/src/main/java/cn/garymb/ygomobile/deck_square/PrivacyDialogFragment.java
...n/garymb/ygomobile/deck_square/PrivacyDialogFragment.java
+70
-0
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/GetSquareDeckCondition.java
...bile/deck_square/api_response/GetSquareDeckCondition.java
+66
-0
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/LoginRequest.java
...rymb/ygomobile/deck_square/api_response/LoginRequest.java
+2
-2
mobile/src/main/java/cn/garymb/ygomobile/utils/OkhttpUtil.java
...e/src/main/java/cn/garymb/ygomobile/utils/OkhttpUtil.java
+7
-6
mobile/src/main/res/layout/dialog_deck_manager.xml
mobile/src/main/res/layout/dialog_deck_manager.xml
+1
-1
mobile/src/main/res/layout/dialog_privacy.xml
mobile/src/main/res/layout/dialog_privacy.xml
+55
-0
mobile/src/main/res/layout/fragment_deck_square.xml
mobile/src/main/res/layout/fragment_deck_square.xml
+27
-0
mobile/src/main/res/layout/fragment_mc_online_manage.xml
mobile/src/main/res/layout/fragment_mc_online_manage.xml
+0
-35
mobile/src/main/res/layout/item_deck_info.xml
mobile/src/main/res/layout/item_deck_info.xml
+1
-23
mobile/src/main/res/layout/item_my_deck.xml
mobile/src/main/res/layout/item_my_deck.xml
+38
-63
mobile/src/main/res/values/strings.xml
mobile/src/main/res/values/strings.xml
+2
-0
No files found.
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareApiUtil.java
View file @
1e1f6808
...
...
@@ -11,6 +11,7 @@ import java.util.Map;
import
cn.garymb.ygomobile.deck_square.api_response.BasicResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.DeckIdResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.DownloadDeckResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.GetSquareDeckCondition
;
import
cn.garymb.ygomobile.deck_square.api_response.LoginRequest
;
import
cn.garymb.ygomobile.deck_square.api_response.LoginResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.LoginToken
;
...
...
@@ -33,9 +34,19 @@ public class DeckSquareApiUtil {
private
static
final
String
TAG
=
DeckSquareListAdapter
.
class
.
getSimpleName
();
public
static
boolean
needLogin
()
{
String
serverToken
=
SharedPreferenceUtil
.
getServerToken
();
Integer
serverUserId
=
SharedPreferenceUtil
.
getServerUserId
();
if
(
serverToken
==
null
||
serverUserId
==
-
1
)
{
return
true
;
}
return
false
;
}
/**
*
* 如果未登录(不存在token),显示toast提示用户。如果已登录,返回token
*
* @return
*/
public
static
LoginToken
getLoginData
()
{
...
...
@@ -51,18 +62,22 @@ public class DeckSquareApiUtil {
}
public
static
SquareDeckResponse
getSquareDecks
()
throws
IOException
{
public
static
SquareDeckResponse
getSquareDecks
(
GetSquareDeckCondition
condition
)
throws
IOException
{
SquareDeckResponse
result
=
null
;
String
url
=
"http://rarnu.xyz:38383/api/mdpro3/deck/list"
;
Map
<
String
,
String
>
headers
=
new
HashMap
<>();
headers
.
put
(
"ReqSource"
,
"MDPro3"
);
Response
response
=
OkhttpUtil
.
synchronousGet
(
url
,
null
,
headers
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"page"
,
condition
.
getPage
());
paramMap
.
put
(
"size"
,
condition
.
getSize
());
Response
response
=
OkhttpUtil
.
synchronousGet
(
url
,
paramMap
,
headers
);
String
responseBodyString
=
response
.
body
().
string
();
// Type listType = new TypeToken<List<DeckInfo>>() {
// }.getType();
Gson
gson
=
new
Gson
();
// Convert JSON to Java object using Gson
result
=
gson
.
fromJson
(
responseBodyString
,
SquareDeckResponse
.
class
);
return
result
;
}
...
...
@@ -213,7 +228,6 @@ public class DeckSquareApiUtil {
Response
response
=
OkhttpUtil
.
postJson
(
url
,
json
,
headers
,
1000
);
String
responseBodyString
=
response
.
body
().
string
();
// Convert JSON to Java object using Gson
result
=
gson
.
fromJson
(
responseBodyString
,
PushDeckResponse
.
class
);
LogUtil
.
i
(
TAG
,
"push deck response:"
+
responseBodyString
);
...
...
@@ -245,16 +259,15 @@ public class DeckSquareApiUtil {
}
public
static
LoginResponse
login
(
Integer
userId
,
String
password
)
throws
IOException
{
public
static
LoginResponse
login
(
String
username
,
String
password
)
throws
IOException
{
LoginResponse
result
=
null
;
String
url
=
"https://sapi.moecube.com:444/accounts/signin"
;
String
baseUrl
=
"https://sapi.moecube.com:444/accounts/signin"
;
// Create request body using Gson
Gson
gson
=
new
Gson
();
userId
=
107630627
;
password
=
"Qbz95qbz96"
;
LoginRequest
loginRequest
=
new
LoginRequest
(
user
Id
,
password
);
//
userId = 107630627;
//
password = "Qbz95qbz96";
LoginRequest
loginRequest
=
new
LoginRequest
(
user
name
,
password
);
String
json
=
gson
.
toJson
(
loginRequest
);
//"{\"id\":1,\"name\":\"John\"}";
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareFragment.java
View file @
1e1f6808
...
...
@@ -4,6 +4,7 @@ import android.os.Bundle;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.inputmethod.EditorInfo
;
import
androidx.annotation.NonNull
;
import
androidx.fragment.app.Fragment
;
...
...
@@ -41,11 +42,68 @@ public class DeckSquareFragment extends Fragment {
binding
.
listDeckInfo
.
setLayoutManager
(
linearLayoutManager
);
binding
.
listDeckInfo
.
setAdapter
(
deckSquareListAdapter
);
deckSquareListAdapter
.
loadData
();
// 设置页码跳转监听
binding
.
etGoToPage
.
setOnEditorActionListener
((
v
,
actionId
,
event
)
->
{
if
(
actionId
==
EditorInfo
.
IME_ACTION_DONE
)
{
int
targetPage
=
0
;
try
{
targetPage
=
Integer
.
parseInt
(
v
.
getText
().
toString
());
}
catch
(
NumberFormatException
e
)
{
}
binding
.
tvPageInfo
.
setText
(
Integer
.
toString
(
targetPage
));
deckSquareListAdapter
.
loadData
(
targetPage
,
30
);
return
true
;
}
return
false
;
});
binding
.
nextPageBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
int
targetPage
=
0
;
try
{
targetPage
=
Integer
.
parseInt
(
binding
.
tvPageInfo
.
getText
().
toString
());
}
catch
(
NumberFormatException
e
)
{
}
int
newPage
=
targetPage
+
1
;
deckSquareListAdapter
.
loadData
(
newPage
,
30
);
binding
.
tvPageInfo
.
setText
(
Integer
.
toString
(
newPage
));
}
});
binding
.
formerPageBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
int
targetPage
=
0
;
try
{
targetPage
=
Integer
.
parseInt
(
binding
.
tvPageInfo
.
getText
().
toString
());
}
catch
(
NumberFormatException
e
)
{
}
int
newPage
=
targetPage
-
1
;
if
(
newPage
<
1
)
{
newPage
=
1
;
}
deckSquareListAdapter
.
loadData
(
newPage
,
30
);
binding
.
tvPageInfo
.
setText
(
Integer
.
toString
(
newPage
));
}
});
binding
.
refreshData
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
deckSquareListAdapter
.
loadData
();
int
targetPage
=
1
;
try
{
targetPage
=
Integer
.
parseInt
(
binding
.
tvPageInfo
.
getText
().
toString
());
}
catch
(
NumberFormatException
e
)
{
}
deckSquareListAdapter
.
loadData
(
targetPage
,
30
);
}
});
deckSquareListAdapter
.
setOnItemLongClickListener
((
adapter
,
view
,
position
)
->
{
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/DeckSquareListAdapter.java
View file @
1e1f6808
...
...
@@ -9,6 +9,7 @@ import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import
java.util.List
;
import
cn.garymb.ygomobile.deck_square.api_response.GetSquareDeckCondition
;
import
cn.garymb.ygomobile.deck_square.api_response.OnlineDeckDetail
;
import
cn.garymb.ygomobile.deck_square.api_response.SquareDeckResponse
;
import
cn.garymb.ygomobile.lite.R
;
...
...
@@ -29,9 +30,13 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba
}
public
void
loadData
()
{
loadData
(
1
,
30
);
}
public
void
loadData
(
int
page
,
int
size
)
{
final
DialogPlus
dialog_read_ex
=
DialogPlus
.
show
(
getContext
(),
null
,
getContext
().
getString
(
R
.
string
.
fetch_online_deck
));
VUiKit
.
defer
().
when
(()
->
{
SquareDeckResponse
result
=
DeckSquareApiUtil
.
getSquareDecks
();
SquareDeckResponse
result
=
DeckSquareApiUtil
.
getSquareDecks
(
new
GetSquareDeckCondition
(
page
,
size
)
);
if
(
result
==
null
)
{
return
null
;
}
else
{
...
...
@@ -85,6 +90,9 @@ public class DeckSquareListAdapter extends BaseQuickAdapter<OnlineDeckDetail, Ba
LogUtil
.
i
(
TAG
,
code
+
" "
+
item
.
getDeckName
());
if
(
code
!=
0
)
{
imageLoader
.
bindImage
(
cardImage
,
code
,
null
,
ImageLoader
.
Type
.
small
);
}
else
{
imageLoader
.
bindImage
(
cardImage
,
-
1
,
null
,
ImageLoader
.
Type
.
small
);
}
// ImageView imageview = helper.getView(R.id.ex_card_image);
//the function cn.garymb.ygomobile.loader.ImageLoader.bindT(...)
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/LoginDialog.java
View file @
1e1f6808
...
...
@@ -12,7 +12,6 @@ import android.widget.ProgressBar;
import
android.widget.Toast
;
import
cn.garymb.ygomobile.deck_square.api_response.LoginResponse
;
import
cn.garymb.ygomobile.deck_square.api_response.LoginToken
;
import
cn.garymb.ygomobile.lite.R
;
import
cn.garymb.ygomobile.ui.plus.VUiKit
;
import
cn.garymb.ygomobile.utils.LogUtil
;
...
...
@@ -70,7 +69,8 @@ public class LoginDialog extends Dialog {
VUiKit
.
defer
().
when
(()
->
{
LogUtil
.
d
(
TAG
,
"start fetch"
);
LoginResponse
result
=
DeckSquareApiUtil
.
login
(
1
,
""
);
LoginResponse
result
=
DeckSquareApiUtil
.
login
(
username
,
password
);
SharedPreferenceUtil
.
setServerToken
(
result
.
token
);
SharedPreferenceUtil
.
setServerUserId
(
result
.
user
.
id
);
return
result
;
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MCOnlineManageFragment.java
View file @
1e1f6808
...
...
@@ -13,13 +13,16 @@ import cn.garymb.ygomobile.deck_square.api_response.LoginResponse;
import
cn.garymb.ygomobile.lite.databinding.FragmentMcOnlineManageBinding
;
import
cn.garymb.ygomobile.utils.LogUtil
;
import
cn.garymb.ygomobile.utils.SharedPreferenceUtil
;
import
cn.garymb.ygomobile.utils.YGOUtil
;
//管理用户的登录状态、缓存状态
public
class
MCOnlineManageFragment
extends
Fragment
{
public
class
MCOnlineManageFragment
extends
Fragment
implements
PrivacyDialogFragment
.
PrivacyAgreementListener
{
private
FragmentMcOnlineManageBinding
binding
;
private
static
final
String
TAG
=
DeckSquareListAdapter
.
class
.
getSimpleName
();
boolean
privacAgree
=
false
;
LoginDialog
loginDialog
=
null
;
@Override
public
View
onCreateView
(
...
...
@@ -31,21 +34,37 @@ public class MCOnlineManageFragment extends Fragment {
binding
.
mcLoginBtn
.
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
LoginDialog
loginDialog
=
new
LoginDialog
(
getContext
(),
new
LoginDialog
.
LoginListener
()
{
@Override
public
void
notifyResult
(
boolean
success
,
LoginResponse
response
)
{
// Handle login logic
if
(
success
)
{
LogUtil
.
i
(
TAG
,
"login success"
+
SharedPreferenceUtil
.
getServerToken
());
refreshBtn
();
//response.token;
if
(!
DeckSquareApiUtil
.
needLogin
())
{
return
;
}
if
(
privacAgree
)
{
//如果不同意隐私协议,log提示用户,
loginDialog
=
new
LoginDialog
(
getContext
(),
new
LoginDialog
.
LoginListener
()
{
@Override
public
void
notifyResult
(
boolean
success
,
LoginResponse
response
)
{
// Handle login logic
if
(
success
)
{
LogUtil
.
i
(
TAG
,
"login success"
+
SharedPreferenceUtil
.
getServerToken
());
refreshBtn
();
//response.token;
}
else
{
YGOUtil
.
showTextToast
(
"登录失败:"
);
}
}
});
loginDialog
.
show
();
}
else
{
YGOUtil
.
showTextToast
(
"登录内容需要用户同意协议"
);
showPrivacyDialog
();
}
}
});
loginDialog
.
show
();
}
});
//其实仅仅是清除掉本机的token
...
...
@@ -76,11 +95,27 @@ public class MCOnlineManageFragment extends Fragment {
}
public
void
refreshBtn
()
{
if
(
SharedPreferenceUtil
.
getServerToken
()
!=
null
)
{
if
(
DeckSquareApiUtil
.
getLoginData
()
!=
null
)
{
binding
.
mcLoginBtn
.
setText
(
"已登录"
);
}
else
{
binding
.
mcLoginBtn
.
setText
(
"登录"
);
}
}
private
void
showPrivacyDialog
()
{
PrivacyDialogFragment
dialog
=
new
PrivacyDialogFragment
();
dialog
.
setPrivacyAgreementListener
(
this
);
dialog
.
show
(
getChildFragmentManager
(),
"PrivacyDialog"
);
}
@Override
public
void
onAgree
()
{
privacAgree
=
true
;
}
@Override
public
void
onDisagree
()
{
privacAgree
=
false
;
}
}
\ No newline at end of file
mobile/src/main/java/cn/garymb/ygomobile/deck_square/MyDeckListAdapter.java
View file @
1e1f6808
...
...
@@ -34,13 +34,12 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
List
<
MyDeckItem
>
myOnlieDecks
=
new
ArrayList
<>();
final
DialogPlus
dialog_read_ex
=
DialogPlus
.
show
(
getContext
(),
null
,
getContext
().
getString
(
R
.
string
.
fetch_online_deck
));
LoginToken
loginToken
=
DeckSquareApiUtil
.
getLoginData
();
if
(
loginToken
==
null
)
{
return
;
}
final
DialogPlus
dialog_read_ex
=
DialogPlus
.
show
(
getContext
(),
null
,
getContext
().
getString
(
R
.
string
.
fetch_online_deck
));
VUiKit
.
defer
().
when
(()
->
{
MyDeckResponse
result
=
DeckSquareApiUtil
.
getUserDecks
(
loginToken
);
...
...
@@ -103,17 +102,22 @@ public class MyDeckListAdapter extends BaseQuickAdapter<MyDeckItem, BaseViewHold
protected
void
convert
(
BaseViewHolder
helper
,
MyDeckItem
item
)
{
helper
.
setText
(
R
.
id
.
my_deck_name
,
item
.
getDeckName
());
//helper.setText(R.id.deck_upload_date, item.getDeckUploadDate());
ImageView
imageView
=
helper
.
getView
(
R
.
id
.
deck_upload_state_img
);
if
(
item
.
getDeckSouce
()
==
0
)
{
//本地
helper
.
setText
(
R
.
id
.
my_deck_id
,
"本地卡组"
);
imageView
.
setImageResource
(
R
.
drawable
.
ic_server_push
);
helper
.
setVisible
(
R
.
id
.
deck_update_date
,
false
);
helper
.
setVisible
(
R
.
id
.
deck_upload_date
,
false
);
}
else
if
(
item
.
getDeckSouce
()
==
1
)
{
helper
.
setText
(
R
.
id
.
my_deck_id
,
item
.
getDeckId
());
imageView
.
setImageResource
(
R
.
drawable
.
ic_server_download
);
helper
.
setText
(
R
.
id
.
deck_update_date
,
item
.
getUpdateDate
());
//ImageView imageView = helper.getView(R.id.deck_upload_state_img);
helper
.
setText
(
R
.
id
.
deck_update_date
,
item
.
getUpdateDate
());
ImageView
cardImage
=
helper
.
getView
(
R
.
id
.
deck_info_image
);
long
code
=
item
.
getDeckCoverCard1
();
LogUtil
.
i
(
TAG
,
code
+
" "
+
item
.
getDeckName
());
if
(
code
!=
0
)
{
imageLoader
.
bindImage
(
cardImage
,
code
,
null
,
ImageLoader
.
Type
.
small
);
}
else
{
imageLoader
.
bindImage
(
cardImage
,
-
1
,
null
,
ImageLoader
.
Type
.
small
);
}
// else if (item.getDeckSouce() == 1) {
// helper.setText(R.id.my_deck_id, item.getDeckId());
// imageView.setImageResource(R.drawable.ic_server_download);
// }
// long code = item.getDeckCoverCard1();
...
...
mobile/src/main/java/cn/garymb/ygomobile/deck_square/PrivacyDialogFragment.java
0 → 100644
View file @
1e1f6808
package
cn.garymb.ygomobile.deck_square
;
import
android.app.AlertDialog
;
import
android.app.Dialog
;
import
android.os.Bundle
;
import
android.util.DisplayMetrics
;
import
android.view.LayoutInflater
;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.widget.Button
;
import
androidx.annotation.NonNull
;
import
androidx.annotation.Nullable
;
import
androidx.fragment.app.DialogFragment
;
import
cn.garymb.ygomobile.lite.R
;
public
class
PrivacyDialogFragment
extends
DialogFragment
{
private
PrivacyAgreementListener
listener
;
public
interface
PrivacyAgreementListener
{
void
onAgree
();
void
onDisagree
();
}
public
void
setPrivacyAgreementListener
(
PrivacyAgreementListener
listener
)
{
this
.
listener
=
listener
;
}
@NonNull
@Override
public
Dialog
onCreateDialog
(
@Nullable
Bundle
savedInstanceState
)
{
AlertDialog
.
Builder
builder
=
new
AlertDialog
.
Builder
(
requireActivity
());
LayoutInflater
inflater
=
requireActivity
().
getLayoutInflater
();
View
view
=
inflater
.
inflate
(
R
.
layout
.
dialog_privacy
,
null
);
builder
.
setView
(
view
);
// 禁止点击外部关闭
setCancelable
(
false
);
Button
btnAgree
=
view
.
findViewById
(
R
.
id
.
btn_agree
);
Button
btnDisagree
=
view
.
findViewById
(
R
.
id
.
btn_disagree
);
btnAgree
.
setOnClickListener
(
v
->
{
if
(
listener
!=
null
)
listener
.
onAgree
();
dismiss
();
});
btnDisagree
.
setOnClickListener
(
v
->
{
if
(
listener
!=
null
)
listener
.
onDisagree
();
dismiss
();
});
return
builder
.
create
();
}
@Override
public
void
onStart
()
{
super
.
onStart
();
// 设置对话框宽度占屏幕 90%
if
(
getDialog
()
!=
null
&&
getDialog
().
getWindow
()
!=
null
)
{
DisplayMetrics
metrics
=
new
DisplayMetrics
();
requireActivity
().
getWindowManager
().
getDefaultDisplay
().
getMetrics
(
metrics
);
int
width
=
(
int
)
(
metrics
.
widthPixels
*
0.9
);
getDialog
().
getWindow
().
setLayout
(
width
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
);
}
}
}
\ No newline at end of file
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/GetSquareDeckCondition.java
0 → 100644
View file @
1e1f6808
package
cn.garymb.ygomobile.deck_square.api_response
;
public
class
GetSquareDeckCondition
{
Integer
page
;
Integer
size
;
String
keyWord
;
Boolean
sortLike
;
Boolean
sortRank
;
String
contributer
;
public
GetSquareDeckCondition
()
{
}
public
GetSquareDeckCondition
(
Integer
page
,
Integer
size
)
{
this
.
page
=
page
;
this
.
size
=
size
;
}
public
Integer
getPage
()
{
return
page
;
}
public
void
setPage
(
Integer
page
)
{
this
.
page
=
page
;
}
public
Integer
getSize
()
{
return
size
;
}
public
void
setSize
(
Integer
size
)
{
this
.
size
=
size
;
}
public
String
getKeyWord
()
{
return
keyWord
;
}
public
void
setKeyWord
(
String
keyWord
)
{
this
.
keyWord
=
keyWord
;
}
public
Boolean
getSortLike
()
{
return
sortLike
;
}
public
void
setSortLike
(
Boolean
sortLike
)
{
this
.
sortLike
=
sortLike
;
}
public
Boolean
getSortRank
()
{
return
sortRank
;
}
public
void
setSortRank
(
Boolean
sortRank
)
{
this
.
sortRank
=
sortRank
;
}
public
String
getContributer
()
{
return
contributer
;
}
public
void
setContributer
(
String
contributer
)
{
this
.
contributer
=
contributer
;
}
}
mobile/src/main/java/cn/garymb/ygomobile/deck_square/api_response/LoginRequest.java
View file @
1e1f6808
package
cn.garymb.ygomobile.deck_square.api_response
;
public
class
LoginRequest
{
public
Integer
account
;
public
String
account
;
public
String
password
;
public
LoginRequest
(
Integer
account
,
String
password
)
{
public
LoginRequest
(
String
account
,
String
password
)
{
this
.
account
=
account
;
this
.
password
=
password
;
}
...
...
mobile/src/main/java/cn/garymb/ygomobile/utils/OkhttpUtil.java
View file @
1e1f6808
...
...
@@ -114,12 +114,12 @@ public class OkhttpUtil {
client
.
newCall
(
request
.
build
()).
enqueue
(
callback
);
}
public
static
Response
synchronousGet
(
String
address
,
Map
<
String
,
Object
>
m
ap
,
Map
<
String
,
String
>
headers
)
throws
IOException
{
public
static
Response
synchronousGet
(
String
address
,
Map
<
String
,
Object
>
paramM
ap
,
Map
<
String
,
String
>
headers
)
throws
IOException
{
OkHttpClient
client
=
new
OkHttpClient
();
HttpUrl
.
Builder
httpBuilder
=
HttpUrl
.
parse
(
address
).
newBuilder
();
if
(
m
ap
!=
null
)
{
for
(
Map
.
Entry
<
String
,
Object
>
param
:
m
ap
.
entrySet
())
{
if
(
paramM
ap
!=
null
)
{
for
(
Map
.
Entry
<
String
,
Object
>
param
:
paramM
ap
.
entrySet
())
{
httpBuilder
.
addQueryParameter
(
param
.
getKey
(),
param
.
getValue
().
toString
());
}
}
...
...
@@ -202,10 +202,11 @@ public class OkhttpUtil {
/**
* 阻塞方法,POST推送json
*
* @param url
* @param json
可以传入null或空字符串,均代表不需要发送json
* @param headers
可以传入null
* @param timeout
可以为0,为0代表使用默认值
* @param json 可以传入null或空字符串,均代表不需要发送json
* @param headers 可以传入null
* @param timeout 可以为0,为0代表使用默认值
*/
public
static
Response
postJson
(
String
url
,
String
json
,
Map
<
String
,
String
>
headers
,
int
timeout
)
throws
IOException
{
okHttpClient
=
new
OkHttpClient
();
...
...
mobile/src/main/res/layout/dialog_deck_manager.xml
View file @
1e1f6808
...
...
@@ -22,5 +22,5 @@
<androidx.viewpager2.widget.ViewPager2
android:id=
"@+id/deck_view_pager"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_cont
ent"
/>
android:layout_height=
"
match_par
ent"
/>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/dialog_privacy.xml
0 → 100644
View file @
1e1f6808
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:orientation=
"vertical"
android:padding=
"16dp"
>
<!-- 标题 -->
<TextView
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"隐私政策协议"
android:textSize=
"20sp"
android:textStyle=
"bold"
/>
<!-- 协议内容(可滚动) -->
<ScrollView
android:layout_width=
"match_parent"
android:layout_height=
"0dp"
android:layout_weight=
"1"
android:layout_marginVertical=
"16dp"
>
<TextView
android:id=
"@+id/tv_content"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:text=
"@string/privacy_policy_content"
/>
</ScrollView>
<!-- 操作按钮 -->
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:gravity=
"end"
android:layout_marginTop=
"8dp"
>
<Button
android:id=
"@+id/btn_disagree"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"不同意"
android:background=
"?selectableItemBackgroundBorderless"
/>
<Button
android:id=
"@+id/btn_agree"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"同意并继续"
android:layout_marginStart=
"16dp"
android:background=
"?selectableItemBackgroundBorderless"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/fragment_deck_square.xml
View file @
1e1f6808
...
...
@@ -32,6 +32,18 @@
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:text=
"下一页"
></Button>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"页"
android:textSize=
"14sp"
/>
<TextView
android:id=
"@+id/tv_page_info"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"1"
android:textSize=
"14sp"
/>
<Button
android:id=
"@+id/former_page_btn"
...
...
@@ -40,6 +52,21 @@
android:layout_weight=
"1"
android:text=
"上一页"
></Button>
<!-- <Spinner-->
<!-- android:id="@+id/spinner_items_per_page"-->
<!-- android:layout_width="80dp"-->
<!-- android:layout_height="32dp" />-->
<EditText
android:id=
"@+id/et_go_to_page"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:hint=
"Go to"
android:inputType=
"number"
android:maxLines=
"1"
android:textSize=
"14sp"
/>
<Button
android:id=
"@+id/refresh_data"
android:layout_width=
"match_parent"
...
...
mobile/src/main/res/layout/fragment_mc_online_manage.xml
View file @
1e1f6808
...
...
@@ -14,41 +14,6 @@
android:paddingTop=
"2dp"
android:paddingRight=
"5dp"
>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"4dp"
android:orientation=
"horizontal"
android:paddingLeft=
"10dp"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:text=
"@string/label_limitlist"
android:textColor=
"@color/holo_blue_light"
/>
<androidx.appcompat.widget.AppCompatSpinner
android:id=
"@+id/sp_limit_list"
android:layout_width=
"wrap_content"
android:layout_height=
"@dimen/item_height"
android:layout_weight=
"1"
android:ellipsize=
"end"
android:gravity=
"fill_horizontal"
/>
<TextView
android:id=
"@+id/result_count"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginRight=
"10dp"
android:background=
"@drawable/radius"
android:gravity=
"center_horizontal"
android:text=
"0"
android:textColor=
"@color/gold"
android:textStyle=
"bold"
/>
</LinearLayout>
<Button
android:id=
"@+id/mc_login_btn"
...
...
mobile/src/main/res/layout/item_deck_info.xml
View file @
1e1f6808
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/holo_blue_bright"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<ImageView
...
...
@@ -44,26 +43,5 @@
android:layout_weight=
"1"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:id=
"@+id/text_download_precard"
android:layout_width=
"30dp"
android:layout_height=
"30dp"
android:background=
"@drawable/ic_like"
android:clickable=
"false"
android:gravity=
"center"
android:textAlignment=
"center"
android:textColor=
"@color/gold"
android:textSize=
"10sp"
/>
<TextView
android:id=
"@+id/deck_like"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/layout/item_my_deck.xml
View file @
1e1f6808
...
...
@@ -2,24 +2,18 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@color/holo_blue_bright"
android:orientation=
"vertical"
>
<
!-- <
ImageView
android:id="@+id/deck_info_image"
android:layout_width="@dimen/card_width_middle"
android:layout_height="@dimen/card_height_middle" />--
>
<ImageView
android:id=
"@+id/deck_info_image"
android:layout_width=
"@dimen/card_width_middle"
android:layout_height=
"@dimen/card_height_middle"
/
>
<TextView
android:id=
"@+id/my_deck_id"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/deck_type_text"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
/>
<TextView
android:id=
"@+id/my_deck_name"
android:layout_width=
"match_parent"
...
...
@@ -32,76 +26,57 @@
<LinearLayout
android:layout_width=
"
match_par
ent"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:text=
"更新时间"
/>
<TextView
android:id=
"@+id/deck_update_date"
android:layout_width=
"
match_par
ent"
android:layout_width=
"
wrap_cont
ent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:text=
"上传时间"
/>
<TextView
android:id=
"@+id/deck_upload_date"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
/>
android:layout_gravity=
"left"
android:text=
"更新"
/>
</LinearLayout>
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/deck_upload_state_img"
android:layout_width=
"40dp"
android:layout_height=
"40dp"
/>
<TextView
android:id=
"@+id/upload_state"
<!-- <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="上传时间" />
<TextView
android:id="@+id/deck_upload_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>-->
<!--
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=
"1"
/>
</LinearLayout>
android:orientation="horizontal">
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
>
<ImageView
android:id="@+id/deck_upload_state_img"
android:layout_width="40dp"
android:layout_height="40dp" />
<TextView
android:id="@+id/upload_state"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>-->
<!-- <TextView-->
<!-- android:id="@+id/text_download_precard"-->
<!-- android:layout_width="30dp"-->
<!-- android:layout_height="30dp"-->
<!-- android:clickable="false"-->
<!-- android:gravity="center"-->
<!-- android:textAlignment="center"-->
<!-- android:textColor="@color/gold"-->
<!-- android:text="点赞数"-->
<!-- android:textSize="10sp" />-->
<TextView
android:id=
"@+id/deck_like"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
/>
</LinearLayout>
</LinearLayout>
\ No newline at end of file
mobile/src/main/res/values/strings.xml
View file @
1e1f6808
<?xml version="1.0" encoding="utf-8"?>
<resources
xmlns:tools=
"http://schemas.android.com/tools"
tools:ignore=
"StringFormatInvalid"
>
<string
name=
"privacy_policy_content"
>
privacy content
</string>
<!--string name="app_name">YGOMobile</string-->
<string
name=
"action_settings"
>
Settings
</string>
<string
name=
"action_game"
>
Single Game
</string>
...
...
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