游戏上传接口更改
This commit is contained in:
@ -56,7 +56,7 @@ class GameUploadFragment : NormalFragment() {
|
||||
private var mDisposable: Disposable? = null
|
||||
private var mUploadFileDisposable: Disposable? = null
|
||||
private val mPathMap = LinkedHashMap<String, String>()
|
||||
private lateinit var mIsOnline: AtomicBoolean//是否需要联网
|
||||
private var mIsOnline: String = ""//是否需要联网
|
||||
private var mGameLanguage: String = ""//游戏语言
|
||||
private var mGameType: String = ""//游戏类型
|
||||
private val mTags = arrayListOf<String>()//游戏标签
|
||||
@ -164,11 +164,11 @@ class GameUploadFragment : NormalFragment() {
|
||||
gameIsNetworkingRg.setOnCheckedChangeListener { group, checkedId ->
|
||||
when (checkedId) {
|
||||
R.id.gameNetworkingRb -> {
|
||||
mIsOnline = AtomicBoolean(true)
|
||||
mIsOnline = "yes"
|
||||
MtaHelper.onEvent("游戏上传", "是否联网", "需要联网")
|
||||
}
|
||||
R.id.gameNoNetworkingRb -> {
|
||||
mIsOnline = AtomicBoolean(false)
|
||||
mIsOnline = "no"
|
||||
MtaHelper.onEvent("游戏上传", "是否联网", "无需联网")
|
||||
}
|
||||
}
|
||||
@ -364,18 +364,16 @@ class GameUploadFragment : NormalFragment() {
|
||||
requestMap["des"] = et_game_intro.text.toString()
|
||||
requestMap["images"] = imageList
|
||||
requestMap["video"] = gameVideoPathEt.text.toString()
|
||||
if(::mIsOnline.isInitialized) {
|
||||
requestMap["is_online"] = mIsOnline.get()
|
||||
requestMap["developer_say"] = gameDeveloperWordsEt.text.toString()
|
||||
if (mIsOnline.isNotEmpty()) {
|
||||
requestMap["is_online"] = mIsOnline
|
||||
}
|
||||
if(mGameLanguage.isNotEmpty()) {
|
||||
if (mGameLanguage.isNotEmpty()) {
|
||||
requestMap["language"] = mGameLanguage
|
||||
}
|
||||
if(mGameType.isNotEmpty()) {
|
||||
if (mGameType.isNotEmpty()) {
|
||||
requestMap["type"] = mGameType
|
||||
}
|
||||
if(gameDeveloperWordsEt.text.toString().isNotEmpty()) {
|
||||
requestMap["developer_say"] = gameDeveloperWordsEt.text.toString()
|
||||
}
|
||||
|
||||
val body = RequestBody.create(MediaType.parse("application/json"),
|
||||
GsonUtils.toJson(requestMap))
|
||||
@ -384,18 +382,18 @@ class GameUploadFragment : NormalFragment() {
|
||||
|
||||
|
||||
private fun showSelectDialog() {
|
||||
val view = View.inflate(context, R.layout.dialog_suggest_game, null)
|
||||
val view = View.inflate(requireContext(), R.layout.dialog_suggest_game, null)
|
||||
val recyclerView = view.findViewById<RecyclerView>(R.id.dialog_suggest_game_rv)
|
||||
val back = view.findViewById<View>(R.id.dialog_suggest_game_back)
|
||||
val pb = view.findViewById<ProgressBar>(R.id.dialog_suggest_game_load)
|
||||
val manualBtn = view.findViewById<TextView>(R.id.dialog_suggest_manual)
|
||||
val titleTv = view.findViewById<TextView>(R.id.titleTv)
|
||||
recyclerView.layoutManager = GridLayoutManager(context, 4)
|
||||
recyclerView.layoutManager = GridLayoutManager(requireContext(), 4)
|
||||
recyclerView.adapter = SuggestSelectGameAdapter(this@GameUploadFragment, pb)
|
||||
titleTv.text = "请选择你要上传的游戏"
|
||||
manualBtn.text = "从设备上选择"
|
||||
|
||||
mSelectGameDialog = Dialog(context)
|
||||
mSelectGameDialog = Dialog(requireContext())
|
||||
mSelectGameDialog?.apply {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
setCanceledOnTouchOutside(false)
|
||||
@ -500,13 +498,13 @@ class GameUploadFragment : NormalFragment() {
|
||||
!TextUtils.isEmpty(et_game_intro.text.toString()) ||
|
||||
!TextUtils.isEmpty(gameDeveloperWordsEt.text.toString()) ||
|
||||
!TextUtils.isEmpty(gameVideoPathEt.text.toString()) ||
|
||||
::mIsOnline.isInitialized ||
|
||||
mIsOnline.isNotEmpty() ||
|
||||
mGameLanguage.isNotEmpty() ||
|
||||
mGameType.isNotEmpty() ||
|
||||
mIconAdapter!!.fileList.size > 0 ||
|
||||
mTags.size > 0 ||
|
||||
mAdapter!!.fileList.size > 0) {
|
||||
DialogUtils.showAlertDialog(context, "提示",
|
||||
DialogUtils.showAlertDialog(requireContext(), "提示",
|
||||
"确定要退出吗?已保存的内容将会消失", "不了", "确定",
|
||||
null, DialogUtils.CancelListener { activity?.finish() })
|
||||
return true
|
||||
@ -516,7 +514,7 @@ class GameUploadFragment : NormalFragment() {
|
||||
|
||||
private fun showAddTagDialog() {
|
||||
val dialog = Dialog(requireContext())
|
||||
val view = View.inflate(context, R.layout.dialog_modify_nickname, null)
|
||||
val view = View.inflate(requireContext(), R.layout.dialog_modify_nickname, null)
|
||||
val title = view.findViewById<TextView>(R.id.dialog_nickname_title)
|
||||
val input = view.findViewById<EditText>(R.id.dialog_nickname_input)
|
||||
title.text = "新建标签"
|
||||
@ -529,7 +527,7 @@ class GameUploadFragment : NormalFragment() {
|
||||
view.findViewById<TextView>(R.id.dialog_nickname_confirm).setOnClickListener {
|
||||
if (!TextUtils.isEmpty(input.text.toString().trim())) {
|
||||
addTag(input.text.toString().trim())
|
||||
Util_System_Keyboard.hideSoftKeyboard(context, input)
|
||||
Util_System_Keyboard.hideSoftKeyboard(requireContext(), input)
|
||||
dialog.dismiss()
|
||||
} else {
|
||||
ToastUtils.showToast(getString(R.string.vote_empty_hint))
|
||||
@ -542,7 +540,7 @@ class GameUploadFragment : NormalFragment() {
|
||||
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE)
|
||||
dialog.setContentView(view)
|
||||
dialog.show()
|
||||
mBaseHandler.postDelayed({ Util_System_Keyboard.showSoftKeyboard(context, input) }, 300)
|
||||
mBaseHandler.postDelayed({ Util_System_Keyboard.showSoftKeyboard(requireContext(), input) }, 300)
|
||||
}
|
||||
|
||||
private fun addTag(tag: String) {
|
||||
|
||||
Reference in New Issue
Block a user