Commit 5b700b08 authored by jyx's avatar jyx

邀好友返回结果处理

parent 3dd5e131
......@@ -98,7 +98,7 @@ object Constant {
const val CARRIER_NEW_USER = "CARRIER_NEW_USER" //新用户红包
const val CARRIER_FRIENDS = "CARRIER_FRIENDS" //邀请好友
// 邀请好友
// 邀请好友
const val CHALLENGE_SHAREFRIEND = "CHALLENGE_SHAREFRIEND" //邀请好友
......
......@@ -57,6 +57,8 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, Platform
initView()
initRecy()
initBanner()
friendsPresenter.getFriendsMsg()
}
private fun initView() {
......@@ -155,7 +157,7 @@ class FriendsFragment : BaseFragment(), FriendsView, OnRefreshListener, Platform
// friendsPresenter.getFriendsMsg()
// }
friendsPresenter.getFriendsMsg()
}
// bv_friends_task.startAutoScroll()
......
......@@ -6,6 +6,8 @@ import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.TextUtils
import android.view.View
import android.widget.AdapterView
......@@ -13,7 +15,6 @@ import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import cn.sharesdk.framework.Platform
import cn.sharesdk.framework.Platform.ShareParams
import cn.sharesdk.framework.PlatformActionListener
import cn.sharesdk.framework.ShareSDK
import cn.sharesdk.wechat.friends.Wechat
import com.mints.goodmoney.BuildConfig
......@@ -52,7 +53,7 @@ import java.util.*
* 时间:2020/6/4 17:30
*/
@SuppressLint("SetTextI18n")
class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListener, OnRefreshListener, View.OnClickListener, AdapterView.OnItemClickListener, PlatformActionListener {
class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListener, OnRefreshListener, View.OnClickListener, AdapterView.OnItemClickListener {
private val ps by lazy { AppPreferences(context) }
private val myPresenter by lazy { MyPresenter() }
......@@ -79,6 +80,15 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
initView()
initRecy()
if (!TextUtils.isEmpty(userManager.userID)) {
myPresenter.getUserHallBaseMsg()
} else {
// 游客登录
myPresenter.userLogin(ps)
}
}
private fun initView() {
......@@ -120,12 +130,7 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
override fun onResume() {
super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_MY) {
if (!TextUtils.isEmpty(userManager.userID)) {
myPresenter.getUserHallBaseMsg()
} else {
// 游客登录
myPresenter.userLogin(ps)
}
}
}
......@@ -418,6 +423,11 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
bundle.putInt(Constant.MAIN_CUR_COIN, 50)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CHALLENGE_SHAREFRIEND)
readyGo(AwardActivity::class.java, bundle)
userConfig?.taskShareFriend!!.complete += 1
dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
dataList[1].btnStr = "去邀请"
mainMyAdapter?.notifyItemChanged(1)
}
} else {
val wechatSp = ShareParams()
......@@ -429,9 +439,17 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
val wechat = ShareSDK.getPlatform(Wechat.NAME)
if (wechat.isClientValid) {
myPresenter.cmtShareStatus()
wechat.platformActionListener = this // 设置分享事件回调
// 执行图文分享
wechat.share(wechatSp)
Handler(Looper.getMainLooper())
.postDelayed({
userConfig?.taskShareFriend!!.complete
dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
dataList[1].btnStr = "立即领取"
mainMyAdapter?.notifyItemChanged(1)
}, 1000)
} else {
showToast("请先安装微信")
}
......@@ -536,16 +554,4 @@ class MyFragment : BaseFragment(), MyView, MainMyAdapter.OnItemChildClickListene
}
}
override fun onComplete(p0: Platform?, p1: Int, p2: HashMap<String, Any>?) {
userConfig?.taskShareFriend!!.complete += 1
dataList[1].progressStr = "(" + userConfig!!.taskShareFriend.complete + "/" + userConfig!!.taskShareFriend.max + ")"
dataList[1].btnStr = "立即领取"
mainMyAdapter?.notifyItemChanged(1)
}
override fun onError(p0: Platform?, p1: Int, p2: Throwable?) = showToast("邀请取消")
override fun onCancel(p0: Platform?, p1: Int) = showToast("邀请取消")
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment