Commit 1bc7e205 authored by wangxuewei's avatar wangxuewei

[提交人]:王雪伟

[提交简述] :幸运农场
[实现方案] :1.0.7发布 替换广告预加载
新闻页面退出弹窗样式修改
parent a732f2f9
......@@ -255,7 +255,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
override fun onError(errorMsg: String?) {
loadAdCache()
// loadAdCache()
flyBoxIsClick = true
}
......@@ -296,7 +296,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
override fun onError(errorMsg: String?) {
loadAdCache()
// loadAdCache()
flyBoxIsClick2 = true
}
......@@ -410,7 +410,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
override fun onError(errorMsg: String?) {
loadAdCache()
// loadAdCache()
}
override fun onSuccess() {
......@@ -586,7 +586,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
override fun onError(errorMsg: String?) {
loadAdCache()
// loadAdCache()
videoSeedClick = true
}
......@@ -659,7 +659,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
override fun onError(errorMsg: String?) {
loadAdCache()
// loadAdCache()
videoJiasuClick = true
}
......@@ -811,7 +811,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}
override fun onError(errorMsg: String?) {
loadAdCache()
// loadAdCache()
}
override fun onSuccess() {
......
......@@ -13,6 +13,7 @@ import com.tencent.bugly.crashreport.CrashReport
import com.umeng.commonsdk.UMConfigure
import com.umeng.socialize.PlatformConfig
import com.ym.admodule.config.AdManager
import com.ym.admodule.config.ZXADConfig
import com.ym.library.AppliContext
import com.ym.library.Constant
import com.ym.modulecommon.net.NetConfig
......@@ -27,8 +28,8 @@ class BaseApplication : MultiDexApplication() {
//第一步初始化 application
AppliContext.init(this)
// Config.init(this)
NetConfig.setBase_Url(NetConfig.Environment.DEV)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
AdManager.init(this,"a03d5320d905cf3b")
NetConfig.setBase_Url(NetConfig.Environment.PRODUCT)// TODO 上线之后提成成 NetConfig.Environment.PRODUCT
AdManager.init(this, "a03d5320d905cf3b")
// Constant.appLs = "a03d5320d905cf3b"//applsq
// AdManager.init(this)
// AdManager.init(//替换id
......
......@@ -130,54 +130,6 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View,
}
4 -> {
EventUtils.onEvent("click_receive_coin_task_video_btn", "领金币任务视频")
// mPresenter?.getRrchardDailyTask()
//看广告
// ToponManager.loadReward(
// (mContext as Activity), object : ToponRewardListener {
// override fun onRewardedVideoAdPlayClicked(entity: ATAdInfo) {
// EventUtils.onEvent(
// "ad_click",
// Utils.obj2Str(
// AdEntity(
// entity.networkFirmId,
// AdID.mPlacementId_Reward_video_luck_farm,
// "每日水滴激励视频"
// )
// )
// )
// }
//
// override fun onRewardedVideoAdClosed(entity: ATAdInfo) {
// mPresenter?.getRrchardDailyTask()
// }
//
// override fun onRewardedVideoAdFailed(errorCode: AdError) {
//
// }
//
// override fun onRewardedVideoAdPlayEnd(entity: ATAdInfo) {
// EventUtils.onEvent(
// "ad_ended",
// Utils.obj2Str(AdEntity("ad_ended", "ad_ended", "每日水滴激励视频"))
// )
// }
//
// override fun onRewardedVideoAdPlayStart(entity: ATAdInfo) {
// EventUtils.onEvent(
// "ad_show",
// Utils.obj2Str(
// AdEntity(
// entity.networkFirmId,
// AdID.mPlacementId_Reward_video_luck_farm,
// "每日水滴激励视频"
// )
// )
// )
// }
//
// },
// AdID.mPlacementId_Reward_video_luck_farm
// )
AdManager.playRewardAd(
ADConfig.AD_REWARD_VIDIO,
"receive_coin_task_video",
......@@ -198,10 +150,10 @@ class SiginDropsPopupwindow : PopupWindow(), WateringRewardContract.View,
}
override fun onError(errorMsg: String?) {
AdManager.loadNextCacheRewardVideoAd(
ADConfig.AD_REWARD_VIDIO,
mContext as Activity
)
// AdManager.loadNextCacheRewardVideoAd(
// ADConfig.AD_REWARD_VIDIO,
// mContext as Activity
// )
}
override fun onSuccess() {
......
......@@ -210,7 +210,7 @@ object TurntableDialog : TurntableUtils(), TurntableContract.View {
}
override fun onError(errorMsg: String?) {
AdManager.loadNextCacheRewardVideoAd(ADConfig.AD_REWARD_VIDIO, context as Activity)
// AdManager.loadNextCacheRewardVideoAd(ADConfig.AD_REWARD_VIDIO, context as Activity)
reset()
btnTurntableLottery?.isEnabled = false
isStartAnim = true
......
......@@ -112,7 +112,7 @@ dependencies {
// exclude group: 'com.mintegral.msdk'
// exclude group: 'cn.vlion.inlandsh'
// }
api 'com.ym.admodule:admodule:1.0.1.10'
api 'com.ym.admodule:admodule:1.0.1.21'
api ("com.bx:adsdk:1.3.3"){
exclude group: 'com.google.code.gson'
}
......
package com.ym.library.activity
import a.b.a.a.j.d.b.A
import android.app.Activity
import android.app.AlertDialog
import android.app.DownloadManager
......@@ -24,10 +25,13 @@ import android.widget.Toast
import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.FileProvider
import com.ym.admodule.config.AdManager
import com.ym.admodule.listener.ZXADVideoListener
import com.ym.library.AppliContext
import com.ym.library.Constant
import com.ym.library.module.NewsEntity
import com.ym.library.net.ApiClient
import com.ym.library.net.BaseObserver
import com.ym.library.net.RxSchedulers
import com.ym.library.rxbus.RxBusConstant
import com.ym.library.rxbus.RxBusUtil
......@@ -35,6 +39,7 @@ import com.ym.library.utils.*
import io.reactivex.Observer
import io.reactivex.disposables.Disposable
import okhttp3.ResponseBody
import org.jetbrains.anko.act
import org.jetbrains.anko.runOnUiThread
import org.json.JSONArray
import org.json.JSONObject
......@@ -879,7 +884,9 @@ abstract class JavaInterface {
@JavascriptInterface
fun jumpWebActivity(json: String) {
act?.runOnUiThread(Runnable {
Log.d("JavaInfterface","json = " + json)
val newsEntity: NewsEntity = Utils.str2Obj(json, NewsEntity::class.java) as NewsEntity
JumpUtils.setWebView(mWebView)
JumpUtils.adJump(newsEntity, act)
/*JumpUtils.webH5Jump(
newsEntity.title,
......
......@@ -8,6 +8,7 @@ import android.graphics.Color
import android.net.http.SslError
import android.os.Build
import android.text.TextUtils
import android.util.Log
import android.view.KeyEvent
import android.view.MotionEvent
import android.view.View
......@@ -140,6 +141,7 @@ class NewWebActivity : BaseActivity(), NewWebContract.View, ScrollWebView.OnScro
private var isOpen = true
private var showNewCoinsDialog: Dialog? = null
@RequiresApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
override fun showCoinsDialog(coins: Int, value: String) {
// showCoins(coins)
......@@ -185,11 +187,14 @@ class NewWebActivity : BaseActivity(), NewWebContract.View, ScrollWebView.OnScro
id_activity_web_bottom_progress?.visibility = View.VISIBLE
}
override fun setCurrentNum(num: Int,title: String) {
override fun setCurrentNum(award: Int, num: Int, title: String) {
if (award > 0 && num >= award) {//奖励目标数大于0 且 已看数量大于目标数量,不展示退出挽留弹窗
isAdds = true
}
if (!title.equals("")) {
tv_newweb_title.text = "${title.split(" ")[0]}"
} else {
tv_newweb_title.text = "看4篇可得2000金币"
tv_newweb_title.text = "看4篇可得2钻石"
}
if (num == 0) {
id_read_round_1.setBackgroundResource(R.drawable.shape_c9c9c9_r)
......@@ -362,7 +367,10 @@ class NewWebActivity : BaseActivity(), NewWebContract.View, ScrollWebView.OnScro
if (webview != null) {
webview?.loadUrl("javascript:onResume()")
}
EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "NewWebActivity", "onResume")))
EventUtils.onEvent(
"page_status",
Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "NewWebActivity", "onResume"))
)
MobclickAgent.onResume(this)
}
......@@ -371,7 +379,10 @@ class NewWebActivity : BaseActivity(), NewWebContract.View, ScrollWebView.OnScro
RxBusUtil.getDefault()
.send(RxBusConstant.RX_MAIN_HIGH_WATER_DROP_UPDATE)
MobclickAgent.onPause(this)
EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "NewWebActivity", "onPause")))
EventUtils.onEvent(
"page_status",
Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "NewWebActivity", "onPause"))
)
if (webview != null) {
// webview?.loadUrl("javascript:onPause()")
}
......
......@@ -38,7 +38,7 @@ class NewWebContract {
fun setBottomDesc(desc: String)
fun setCurrentNum(num: Int,title: String)
fun setCurrentNum(award: Int,num: Int,title: String)
fun setBottomVisibity(visibility: Int)
......
......@@ -43,7 +43,12 @@ class NewWebPresenter : NewWebContract.Presenter {
private var STATUS: Int = INIT
private var mPageUrl: String = ""
constructor(mView: NewWebContract.View, mActivity: Activity, intent: Intent, webview: ScrollWebView) {
constructor(
mView: NewWebContract.View,
mActivity: Activity,
intent: Intent,
webview: ScrollWebView
) {
this.mView = mView
this.mActivity = mActivity
this.intent = intent
......@@ -168,7 +173,8 @@ class NewWebPresenter : NewWebContract.Presenter {
private fun getAdStatus(sUrl: String/*, url: String*/) {
Log.d("glc", "sUrl" + sUrl)
ApiClient.adApi.getAdStatus(slot_id, sid, sUrl, Utils.md5(sUrl)).compose(RxSchedulers.observableIO2Main())
ApiClient.adApi.getAdStatus(slot_id, sid, sUrl, Utils.md5(sUrl))
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<AdStatusEntity>() {
override fun onSuccess(result: AdStatusEntity?) {
if (result != null) {
......@@ -187,7 +193,11 @@ class NewWebPresenter : NewWebContract.Presenter {
// mView.setBottomProgressVisibity(View.VISIBLE)
STATUS = INIT
}
mView.setCurrentNum(result.current_nums ?: 0,result?.alert?:"")
mView.setCurrentNum(
result.award_limit ?: 0,
result.current_nums ?: 0,
result?.alert ?: ""
)
}
if (result.delay == 0) {
//加金币
......@@ -318,7 +328,8 @@ class NewWebPresenter : NewWebContract.Presenter {
private var videoSrc: String = ""
inner class NewWebJavaScriptInterface(context: Activity, mWebView: WebView) : JavaInterface(context, mWebView) {
inner class NewWebJavaScriptInterface(context: Activity, mWebView: WebView) :
JavaInterface(context, mWebView) {
@android.webkit.JavascriptInterface
fun getVideoSrc(): String {
......
......@@ -14,4 +14,5 @@ class AdStatusEntity {
var time_trigger: Int? = 0
var progressStatus: Int? = 0
var current_nums: Int? = 0
var award_limit: Int? = 0
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.ym.library.net
import io.reactivex.Observable
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Query
import retrofit2.http.Url
......@@ -15,4 +16,21 @@ interface IHomeDataApi {
Observable<Response<NovelInitEntity>>
/**
* 看视频上报
* @param
* @paramq
* @return
*/
@POST(NetConfig.Game.URL_GAME_AD_VIDEO_REPORT)
fun adVideoReport(): Observable<Response<Any>>
/**
* 看视频上报
* @param
* @paramq
* @return
*/
@POST(NetConfig.Game.URL_GAME_AD_WELFARE_VIDEO_REPORT)
fun adWelfareVideoReport(@Query("sid") sid: Int): Observable<Response<Any>>
}
\ No newline at end of file
......@@ -216,6 +216,7 @@ public class NetConfig {
public static class Game{
public static final String URL_GAME_AD_VIDEO_REPORT="app/v1/game/report";//看视频上报
public static final String URL_GAME_AD_WELFARE_VIDEO_REPORT="app/v1/game/welfare_video_report";//福利任务视频上报
public static final String URL_GAME_BUY_SEED="app/v1/game/farm/buy_seed";//金币购买种子
public static final String URL_GAME_CLOUD_SPEED="app/v1/game/farm/cloud_speed";//云朵加速
......
......@@ -4,10 +4,17 @@ import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebView;
import com.ym.admodule.config.AdManager;
import com.ym.admodule.listener.ZXADVideoListener;
import com.ym.library.AppliContext;
import com.ym.library.module.NewsEntity;
import com.ym.library.module.ShaveListEntity;
import com.ym.library.net.ApiClient;
import com.ym.library.net.BaseAdOberver;
import com.ym.library.net.Response;
import com.ym.library.net.RxSchedulers;
import com.ym.library.router.RounterApi;
import com.ym.library.router.RounterBus;
import com.ym.library.rxbus.BusData;
......@@ -15,6 +22,8 @@ import com.ym.library.rxbus.RxBusConstant;
import com.ym.library.rxbus.RxBusUtil;
import com.ym.modulecommon.module.UserInfoEntity;
import org.jetbrains.annotations.Nullable;
/**
* Created by gaoleichao on 2019/3/12
......@@ -30,12 +39,12 @@ public class JumpUtils {
}
}
public static void h5Jump(String title, String url,boolean showToolbar,Activity activity) {
public static void h5Jump(String title, String url, boolean showToolbar, Activity activity) {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityWeb(title, url,showToolbar);
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentActivityWeb(title, url, showToolbar);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
if (activity!=null){
if (activity != null) {
activity.startActivity(intent);
}
} catch (Exception e) {
......@@ -250,7 +259,7 @@ public class JumpUtils {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentScratchCard();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra("json",entity);
intent.putExtra("json", entity);
AppliContext.get().startActivity(intent);
} catch (Exception e) {
}
......@@ -309,7 +318,7 @@ public class JumpUtils {
}
//广告跳转
public static void adJump(NewsEntity data,Activity activity) {
public static void adJump(NewsEntity data, Activity activity) {
String sid = String.valueOf(data.getSid());
int incentiveLevel = data.getIncentive_level();
int appmodelId = data.getAppmodel_id();
......@@ -351,7 +360,7 @@ public class JumpUtils {
data.getDeep_url_re()
);
} else {
h5Jump(data.getTitle(), data.getUrl(),false,activity);
h5Jump(data.getTitle(), data.getUrl(), false, activity);
}
} else if (data.getOpentype() == NewsEntity.AD_TYPE_APPMODEL && data.getStatus() != 2) {
if (appmodelId == 59) {
......@@ -390,9 +399,85 @@ public class JumpUtils {
if (TextUtils.equals(sid, "2077")) {
//看视频加金币
}
showAd(activity, data.getSid());
}
}
private static WebView mWebView;
public static void setWebView(WebView webView) {
mWebView = webView;
}
private static void showAd(Activity activity, int sid) {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
AdManager.INSTANCE.playRewardAd(
"common_video",
"task_ad",
activity, new ZXADVideoListener() {
@Override
public void onSuccess() {
}
@Override
public void onError(@Nullable String s) {
}
@Override
public void onAdShow() {
}
@Override
public void onAdVideoBarClick() {
}
@Override
public void onAdClose() {
getVideoAcceleratorsReceive(sid);
AdManager.INSTANCE.loadNextCacheRewardVideoAd("common_video", activity);
if (mWebView != null) {
mWebView.loadUrl("javascript:onResume()");
}
}
}
);
}
});
}
//看视频领上报
private static void getVideoAcceleratorsReceive(int sid) {
ApiClient.INSTANCE.getHomeDataApi().adVideoReport()
.compose(RxSchedulers.observableIO2Main())
.subscribe(new BaseAdOberver<Response<Object>>() {
@Override
public void onSuccess(Response<Object> result) {
}
@Override
public void onFailure(Throwable e, String code, String errorMsg) {
}
});
ApiClient.INSTANCE.getHomeDataApi(). adWelfareVideoReport(sid)
.compose(RxSchedulers.observableIO2Main())
.subscribe(new BaseAdOberver<Response<Object>>() {
@Override
public void onSuccess(Response<Object> result) {
}
@Override
public void onFailure(Throwable e, String code, String errorMsg) {
}
});
}
public static void jumpPage(String pageName) {
switch (pageName) {
case "GuessFragment"://猜歌
......
......@@ -74,7 +74,7 @@
android:id="@+id/tv_newweb_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="看4篇可得2000金币"
android:text="看4篇可得2钻石"
android:textColor="#ff222222"
android:textSize="12sp"
android:layout_marginBottom="8dp"/>
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/id_dialog_water_fail_layout"
android:layout_width="310dp"
android:layout_height="230dp"
android:layout_marginTop="70dp"
android:layout_centerInParent="true"
android:background="@drawable/shape_white_r10">
android:id="@+id/id_dialog_water_fail_layout"
android:layout_width="310dp"
android:layout_height="230dp"
android:layout_centerInParent="true"
android:layout_marginTop="70dp"
android:background="@drawable/shape_white_r10">
<ImageView
android:id="@+id/dialog_scratch_dialog_close_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_margin="16dp"
android:src="@drawable/scratch_dialog_close_img"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:text="温馨提示"
android:textColor="#333333"
android:textSize="22sp" />
android:id="@+id/dialog_scratch_dialog_close_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_margin="16dp"
android:src="@drawable/receive_close" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="任务还未完成,现在退出将无法\n获得奖励,确认要退出么"
android:gravity="center"
android:textColor="#333333"
android:textSize="18sp" />
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="39dp"
android:text="温馨提示"
android:textColor="#333333"
android:textSize="22sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:gravity="center"
android:text="任务还未完成,现在退出将无法\n获得奖励,确认要退出么"
android:textColor="#333333"
android:textSize="18sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp"
android:orientation="horizontal">
<TextView
android:id="@+id/dialog_scratch_dialog_cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginBottom="30dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:background="@drawable/dialog_sign_out_cancel_bg"
android:gravity="center"
android:text="仍要退出"
android:layout_marginLeft="15dp"
android:textColor="#0090FF"
android:textSize="19sp" />
<TextView
<TextView
android:id="@+id/dialog_scratch_dialog_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="30dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:background="@drawable/dialog_sign_out_conform_bg"
android:gravity="center"
android:text="继续任务"
android:textColor="#FFFFFF"
android:textSize="19sp" />
</LinearLayout>
</RelativeLayout>
......
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