Commit 5db1a1dc authored by mengcuiguang's avatar mengcuiguang

添加掌阅

parent d1d60c39
......@@ -92,6 +92,7 @@ object Constant {
const val CARRIER_WALK_BUBBLE = "WALK_BUBBLE" //走路汽泡
const val CARRIER_NEW_USER = "CARRIER_NEW_USER" //新用户红包
const val CARRIER_GAME_ONLINE = "GAME_ONLINE" //跳转猎豹
const val CARRIER_ZHANGYUE = "ZHANGYUE" //跳转猎豹
const val CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE = "CHALLENGE_SHAREFRIEND_DOUBLE" //邀请好友翻倍
const val SHAREFRIEND_COMPLETE_1 = "SHAREFRIEND_COMPLETE_1" //邀请任务1
......
package com.mints.goodmoney.mvp.presenters
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.common.Constant
import com.mints.goodmoney.common.DeviceInfo
import com.google.gson.JsonObject
import com.mints.goodmoney.manager.AppHttpManager
import com.mints.goodmoney.manager.ShumeiManager
import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.BaseResponse
import com.mints.goodmoney.mvp.model.MainVedioMsgBean
import com.mints.goodmoney.mvp.model.UserBean
import com.mints.goodmoney.mvp.model.UserTaskMsgBean
import com.mints.goodmoney.mvp.views.BookView
import com.mints.goodmoney.mvp.views.HomeView
import com.mints.goodmoney.utils.DeviceUuidFactory
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import net.grandcentrix.tray.AppPreferences
import java.util.*
class BookPresenter : BasePresenter<BookView>() {
......@@ -25,22 +15,24 @@ class BookPresenter : BasePresenter<BookView>() {
vo["seconds"] = seconds
AppHttpManager.getInstance(loanApplication)
.call(loanService.addReadSeconds(vo),
object : BaseSubscriber<BaseResponse<UserBean>>() {
object : BaseSubscriber<BaseResponse<JsonObject>>() {
override fun onCompleted() {
}
override fun onError(e: Throwable) {
}
override fun onNext(baseResponse: BaseResponse<UserBean>) {
override fun onNext(baseResponse: BaseResponse<JsonObject>) {
val code = baseResponse.getStatus()
val message = baseResponse.getMessage()
val data: UserBean? = baseResponse.getData()
val data = baseResponse.data
when (code) {
200 -> {
view.readSecondsSuc(12)
if (data != null) {
val coin = data["coin"].asInt
view.readSecondsSuc(coin)
}
}
else -> view.showToast(message)
else -> view.showToast(baseResponse.getMessage())
}
}
})
......
......@@ -326,7 +326,7 @@ public interface LoanService {
* @return
*/
@POST("api/addReadSeconds")
Observable<BaseResponse<Object>> addReadSeconds(@Body Map<String, Object> vo);
Observable<BaseResponse<JsonObject>> addReadSeconds(@Body Map<String, Object> vo);
/**
* 默认http工厂
......
......@@ -98,6 +98,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
Constant.CARRIER_OFFLINE_DOUBLE -> {
tvAwardContent.setText("离线收益奖励" + curCoin + "金币")
}
Constant.CARRIER_ZHANGYUE -> {
tvAwardContent.setText("阅读奖励" + curCoin + "金币")
}
Constant.CARRIER_SIGNIN_HOMEPAGE_AWARD -> {
tvAwardContent.setText("签到奖励" + curCoin + "金币")
}
......
......@@ -73,6 +73,7 @@ class ZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChan
override fun readSecondsSuc(coin: Int) {
if (coin > 0) {
val bundle = Bundle()
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_ZHANGYUE)
bundle.putInt(Constant.MAIN_CUR_COIN, coin)
readyGo(AwardActivity::class.java, bundle)
}
......
......@@ -18,8 +18,8 @@ class PowerDialog(context: Context, private val listener: DialogListener) :
private val lp: WindowManager.LayoutParams
private val tv_dialogper_agreement: TextView
private val tv_dialogper_policy: TextView
private val btn_dialogper_back: AppCompatButton
private val btn_dialogper_next: AppCompatButton
private val btn_dialogper_back: TextView
private val btn_dialogper_next: TextView
init {
setContentView(R.layout.dialog_power)
......@@ -45,9 +45,9 @@ class PowerDialog(context: Context, private val listener: DialogListener) :
tv_dialogper_policy =
findViewById<View>(R.id.tv_dialogper_policy) as TextView
btn_dialogper_back =
findViewById<View>(R.id.btn_dialogper_back) as AppCompatButton
findViewById<View>(R.id.btn_dialogper_back) as TextView
btn_dialogper_next =
findViewById<View>(R.id.btn_dialogper_next) as AppCompatButton
findViewById<View>(R.id.btn_dialogper_next) as TextView
tv_dialogper_policy.setOnClickListener(listener)
tv_dialogper_agreement.setOnClickListener(listener)
btn_dialogper_back.setOnClickListener(listener)
......
......@@ -177,13 +177,14 @@
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.appcompat.widget.AppCompatButton
<TextView
android:id="@+id/btn_dialogper_back"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
......@@ -191,13 +192,14 @@
android:text="不同意"
android:textColor="@color/white" />
<androidx.appcompat.widget.AppCompatButton
<TextView
android:id="@+id/btn_dialogper_next"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:gravity="center"
android:layout_marginRight="20dp"
android:layout_marginBottom="10dp"
android:layout_weight="1"
......
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