|
@@ -41,8 +41,6 @@ class GroupInvitePaymentListFragment : BaseFragment<FragmentGroupInvitePaymentLi
|
|
|
|
|
|
private var inviteOfficialList = ArrayList<InviteOfficialListItem>()
|
|
|
|
|
|
- private var listInit = false
|
|
|
-
|
|
|
private lateinit var inviteOfficialListRequest: InviteOfficialListRequest
|
|
|
|
|
|
private var pageIndex = 1
|
|
@@ -100,6 +98,18 @@ class GroupInvitePaymentListFragment : BaseFragment<FragmentGroupInvitePaymentLi
|
|
|
initInviteOfficialList(1)
|
|
|
}
|
|
|
|
|
|
+ override fun onStart() {
|
|
|
+ super.onStart()
|
|
|
+
|
|
|
+ if (OASystem.needRefresh) {
|
|
|
+ pageIndex = 1
|
|
|
+ inviteOfficialListRequest.pageIndex = pageIndex
|
|
|
+ inviteOfficialList.clear()
|
|
|
+ OASystem.needRefresh = false
|
|
|
+ initInviteOfficialList(2)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
override fun initEvents() {
|
|
|
binding.baseInfoSwitch.setOnClickListener {
|
|
|
if (isShow) {
|
|
@@ -166,8 +176,6 @@ class GroupInvitePaymentListFragment : BaseFragment<FragmentGroupInvitePaymentLi
|
|
|
|
|
|
inviteOfficialList.clear()
|
|
|
|
|
|
- listInit = false
|
|
|
-
|
|
|
initInviteOfficialList(1)
|
|
|
}
|
|
|
}
|
|
@@ -179,78 +187,64 @@ class GroupInvitePaymentListFragment : BaseFragment<FragmentGroupInvitePaymentLi
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if (!listInit) {
|
|
|
- apiService.getInviteOfficialListItem(inviteOfficialListRequest)
|
|
|
- .enqueue(object : Callback<InviteOfficialListResponse> {
|
|
|
- override fun onResponse(
|
|
|
- call: Call<InviteOfficialListResponse>,
|
|
|
- response: Response<InviteOfficialListResponse>
|
|
|
- ) {
|
|
|
- val inviteOfficialListResponse = response.body()
|
|
|
+ apiService.getInviteOfficialListItem(inviteOfficialListRequest)
|
|
|
+ .enqueue(object : Callback<InviteOfficialListResponse> {
|
|
|
+ override fun onResponse(
|
|
|
+ call: Call<InviteOfficialListResponse>,
|
|
|
+ response: Response<InviteOfficialListResponse>
|
|
|
+ ) {
|
|
|
+ val inviteOfficialListResponse = response.body()
|
|
|
+
|
|
|
+ if (inviteOfficialListResponse != null) {
|
|
|
+ if (inviteOfficialListResponse.code == 200) {
|
|
|
|
|
|
- if (inviteOfficialListResponse != null) {
|
|
|
- if (inviteOfficialListResponse.code == 200) {
|
|
|
+ for (item in inviteOfficialListResponse.data.dataList) {
|
|
|
+ inviteOfficialList.add(item)
|
|
|
+ }
|
|
|
+
|
|
|
+ if (inviteOfficialList.size == 0) {
|
|
|
+ showMessage(resources.getString(R.string.no_data))
|
|
|
+ }
|
|
|
|
|
|
- for (item in inviteOfficialListResponse.data.dataList) {
|
|
|
- inviteOfficialList.add(item)
|
|
|
+ when (type) {
|
|
|
+ 1 -> {
|
|
|
+ totalPage = getTotalPage(
|
|
|
+ inviteOfficialListResponse.data.dataCount,
|
|
|
+ inviteOfficialListResponse.data.currPageSize
|
|
|
+ )
|
|
|
+ binding.invitePaymentContainer.setEnableLoadMore(pageIndex < totalPage)
|
|
|
+ initList()
|
|
|
}
|
|
|
|
|
|
- if (inviteOfficialList.size == 0) {
|
|
|
- showMessage(resources.getString(R.string.no_data))
|
|
|
+ 2 -> {
|
|
|
+ binding.invitePaymentContainer.finishRefresh()
|
|
|
+ totalPage = getTotalPage(
|
|
|
+ inviteOfficialListResponse.data.dataCount,
|
|
|
+ inviteOfficialListResponse.data.currPageSize
|
|
|
+ )
|
|
|
+ binding.invitePaymentContainer.setEnableLoadMore(pageIndex < totalPage)
|
|
|
+ initList()
|
|
|
}
|
|
|
|
|
|
- when (type) {
|
|
|
- 1 -> {
|
|
|
- totalPage = getTotalPage(
|
|
|
- inviteOfficialListResponse.data.dataCount,
|
|
|
- inviteOfficialListResponse.data.currPageSize
|
|
|
- )
|
|
|
- binding.invitePaymentContainer.setEnableLoadMore(pageIndex < totalPage)
|
|
|
- initList()
|
|
|
- listInit = true
|
|
|
- }
|
|
|
-
|
|
|
- 2 -> {
|
|
|
- binding.invitePaymentContainer.finishRefresh()
|
|
|
- totalPage = getTotalPage(
|
|
|
- inviteOfficialListResponse.data.dataCount,
|
|
|
- inviteOfficialListResponse.data.currPageSize
|
|
|
- )
|
|
|
- binding.invitePaymentContainer.setEnableLoadMore(pageIndex < totalPage)
|
|
|
- initList()
|
|
|
- listInit = true
|
|
|
- }
|
|
|
-
|
|
|
- 3 -> {
|
|
|
- binding.invitePaymentContainer.finishLoadMore()
|
|
|
- binding.invitePaymentContainer.setEnableLoadMore(pageIndex < totalPage)
|
|
|
- binding.invitePaymentList.adapter!!.notifyItemInserted(
|
|
|
- inviteOfficialList.size
|
|
|
- )
|
|
|
- listInit = true
|
|
|
- }
|
|
|
+ 3 -> {
|
|
|
+ binding.invitePaymentContainer.finishLoadMore()
|
|
|
+ binding.invitePaymentContainer.setEnableLoadMore(pageIndex < totalPage)
|
|
|
+ binding.invitePaymentList.adapter!!.notifyItemInserted(
|
|
|
+ inviteOfficialList.size
|
|
|
+ )
|
|
|
}
|
|
|
- } else {
|
|
|
- showMessage(inviteOfficialListResponse.msg)
|
|
|
}
|
|
|
+ } else {
|
|
|
+ showMessage(inviteOfficialListResponse.msg)
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- override fun onFailure(call: Call<InviteOfficialListResponse>, t: Throwable) {
|
|
|
- showErrorInfo(R.string.invite_official_payment_list_get_failed)
|
|
|
- }
|
|
|
-
|
|
|
- })
|
|
|
+ override fun onFailure(call: Call<InviteOfficialListResponse>, t: Throwable) {
|
|
|
+ showErrorInfo(R.string.invite_official_payment_list_get_failed)
|
|
|
+ }
|
|
|
|
|
|
- } else {
|
|
|
- if (OASystem.needRefresh) {
|
|
|
- pageIndex = 1
|
|
|
- inviteOfficialListRequest.pageIndex = pageIndex
|
|
|
- inviteOfficialList.clear()
|
|
|
- listInit = false
|
|
|
- initInviteOfficialList(2)
|
|
|
- }
|
|
|
- }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
private fun getTotalPage(dataCount: Int, pageSize: Int): Int {
|
|
@@ -290,12 +284,12 @@ class GroupInvitePaymentListFragment : BaseFragment<FragmentGroupInvitePaymentLi
|
|
|
data.translateCurrency
|
|
|
)
|
|
|
itemView.findViewById<TextView>(R.id.activity_payment).text = String.format(
|
|
|
- resources.getString(R.string.currency_name_code_format),
|
|
|
+ resources.getString(R.string.price_and_currency_format),
|
|
|
data.eventsCost,
|
|
|
data.eventsCurrency
|
|
|
)
|
|
|
itemView.findViewById<TextView>(R.id.payment_total).text = String.format(
|
|
|
- resources.getString(R.string.currency_name_code_format),
|
|
|
+ resources.getString(R.string.price_and_currency_format),
|
|
|
data.payMoney,
|
|
|
data.paymentCurrency
|
|
|
)
|
|
@@ -393,7 +387,6 @@ class GroupInvitePaymentListFragment : BaseFragment<FragmentGroupInvitePaymentLi
|
|
|
inviteOfficialListRequest.pageIndex = pageIndex
|
|
|
binding.invitePaymentList.adapter!!.notifyItemRangeRemoved(0, inviteOfficialList.size)
|
|
|
inviteOfficialList.clear()
|
|
|
- listInit = false
|
|
|
initInviteOfficialList(2)
|
|
|
}
|
|
|
|
|
@@ -401,7 +394,6 @@ class GroupInvitePaymentListFragment : BaseFragment<FragmentGroupInvitePaymentLi
|
|
|
if (pageIndex < totalPage) {
|
|
|
pageIndex += 1
|
|
|
inviteOfficialListRequest.pageIndex = pageIndex
|
|
|
- listInit = false
|
|
|
initInviteOfficialList(3)
|
|
|
}
|
|
|
}
|