Commit 2c72efec authored by xw's avatar xw

[提交人]:王雪伟

[提交简述] :多多花园
[实现方案] :1. 广告内部竞价
        2. 拼图红包换成大富翁
        3. 除虫支持按概率决定是否需要看视频
        4. 福利任务加入15秒时间间隔
parent 0be7fc44
...@@ -53,6 +53,19 @@ ...@@ -53,6 +53,19 @@
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name="com.ym.game.activity.MonopolyWebActivity"
android:exported="true"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="nomal_web"
android:scheme="ddhy" />
</intent-filter>
</activity>
<meta-data <meta-data
android:name="android.max_aspect" android:name="android.max_aspect"
android:value="2.4" /> <!-- 适配华为(huawei)刘海屏 --> android:value="2.4" /> <!-- 适配华为(huawei)刘海屏 -->
......
{"v":"5.7.4","fr":25,"ip":0,"op":38,"w":298,"h":240,"nm":"编组 2","ddd":0,"assets":[{"id":"image_0","w":28,"h":26,"u":"images/","p":"img_0.png","e":0},{"id":"image_1","w":28,"h":26,"u":"images/","p":"img_1.png","e":0},{"id":"image_2","w":26,"h":28,"u":"images/","p":"img_2.png","e":0},{"id":"image_3","w":38,"h":40,"u":"images/","p":"img_3.png","e":0},{"id":"image_4","w":186,"h":150,"u":"images/","p":"img_4.png","e":0},{"id":"image_5","w":298,"h":68,"u":"images/","p":"img_5.png","e":0}],"layers":[{"ddd":0,"ind":1,"ty":2,"nm":"路径 7备份.png","cl":"png","refId":"image_0","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":25,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":28,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":31,"s":[100]},{"t":34,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[206,34,0],"ix":2,"l":2},"a":{"a":0,"k":[14,13,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":25,"s":[80,80,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":30,"s":[80,80,100]},{"t":34,"s":[80,80,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":750,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":2,"nm":"路径 7备份 2.png","cl":"png","refId":"image_1","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":18,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":21,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":24,"s":[100]},{"t":27,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[22,49,0],"ix":2,"l":2},"a":{"a":0,"k":[14,13,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":18,"s":[66,66,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":23,"s":[90,90,100]},{"t":27,"s":[66,66,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":750,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":2,"nm":"路径 7.png","cl":"png","refId":"image_2","sr":1,"ks":{"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":13,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":16,"s":[100]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":19,"s":[100]},{"t":22,"s":[0]}],"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[249,95,0],"ix":2,"l":2},"a":{"a":0,"k":[13,14,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":13,"s":[66,66,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":18,"s":[100,100,100]},{"t":22,"s":[66,66,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":750,"st":0,"bm":0},{"ddd":0,"ind":4,"ty":2,"nm":"金币备份 5.png","cl":"png","refId":"image_3","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.833,"y":0.833},"o":{"x":0.167,"y":0.167},"t":0,"s":[137.5,-24.5,0],"to":[0,14.167,0],"ti":[0,-14.167,0]},{"t":6,"s":[137.5,60.5,0]}],"ix":2,"l":2},"a":{"a":0,"k":[19,20,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":7,"st":0,"bm":0},{"ddd":0,"ind":5,"ty":2,"nm":"4dc98b69-914d-4182-99e6-d80ccf347e23.png","cl":"png","refId":"image_4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[128.5,219.75,0],"ix":2,"l":2},"a":{"a":0,"k":[97,149,0],"ix":1,"l":2},"s":{"a":1,"k":[{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":8,"s":[100,100,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":10,"s":[100,90,100]},{"i":{"x":[0.833,0.833,0.833],"y":[0.833,0.833,0.833]},"o":{"x":[0.167,0.167,0.167],"y":[0.167,0.167,0.167]},"t":12,"s":[100,104,100]},{"t":14,"s":[100,100,100]}],"ix":6,"l":2}},"ao":0,"ip":0,"op":750,"st":0,"bm":0},{"ddd":0,"ind":6,"ty":2,"nm":"编组 2.png","cl":"png","refId":"image_5","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[149,206.25,0],"ix":2,"l":2},"a":{"a":0,"k":[149,34,0],"ix":1,"l":2},"s":{"a":0,"k":[100,100,100],"ix":6,"l":2}},"ao":0,"ip":0,"op":750,"st":0,"bm":0}],"markers":[]}
\ No newline at end of file
...@@ -21,10 +21,8 @@ import com.ym.library.MyConstant ...@@ -21,10 +21,8 @@ import com.ym.library.MyConstant
import com.ym.library.down.UpdateVersionManager import com.ym.library.down.UpdateVersionManager
import com.ym.library.listener.IAdVideoListener import com.ym.library.listener.IAdVideoListener
import com.ym.library.module.* import com.ym.library.module.*
import com.ym.library.net.ApiClient import com.ym.library.net.*
import com.ym.library.net.BaseObserver import com.ym.library.net.NetConfig.H5.mDFWType
import com.ym.library.net.GameApiClient
import com.ym.library.net.RxSchedulers
import com.ym.library.utils.* import com.ym.library.utils.*
import com.ym.modulecommon.AppliContext import com.ym.modulecommon.AppliContext
import com.ym.modulecommon.utils.AdPreference import com.ym.modulecommon.utils.AdPreference
...@@ -72,7 +70,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -72,7 +70,7 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
openNotif() openNotif()
} }
"close_notif" -> { "close_notif" -> {
if(scc!=null){ if (scc != null) {
unbindService(scc) unbindService(scc)
} }
} }
...@@ -207,25 +205,34 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -207,25 +205,34 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
} }
/** /**
* 拼图红包 * 大富翁
*/ */
fun onPuzzleClick() { fun onMonopolyClick() {
MainLooper.get()?.post(Runnable { MainLooper.get()?.post(Runnable {
if (Utils.isFastClick2()) { if (Utils.isFastClick2()) {
JumpUtils.h5NormalJump(
"大富翁",
NetConfig.H5.CONFIRMURL + "?is_popup1=" + mDFWType,
false,
act
)
Log.d("wxw","大富翁"+NetConfig.H5.CONFIRMURL + "?is_popup1=" + mDFWType);
//CashExchangeDialog.showCashExchage(this, this) //CashExchangeDialog.showCashExchage(this, this)
PuzzleDialog.showPuzzleDialog(this, this) // PuzzleDialog.showPuzzleDialog(this, this)
} }
}) })
} }
/** /**
* 拼图红包 * 拼图红包
*/ */
fun onMonopolyClick() { fun onPuzzleClick() {
MainLooper.get()?.post(Runnable { MainLooper.get()?.post(Runnable {
if (Utils.isFastClick2()) { if (Utils.isFastClick2()) {
//CashExchangeDialog.showCashExchage(this, this) //CashExchangeDialog.showCashExchage(this, this)
// PuzzleDialog.showPuzzleDialog(this, this) PuzzleDialog.showPuzzleDialog(this, this)
} }
}) })
} }
...@@ -333,6 +340,9 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -333,6 +340,9 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
GameApiClient.gameApi.getGameHomeInfo().compose(RxSchedulers.observableIO2Main()) GameApiClient.gameApi.getGameHomeInfo().compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<HomeInfoEntity>() { .subscribe(object : BaseObserver<HomeInfoEntity>() {
override fun onSuccess(result: HomeInfoEntity?) { override fun onSuccess(result: HomeInfoEntity?) {
if (result != null) {
mDFWType = result.isPopup;
}
Log.d("wxw", "获取首页信息" + Utils.obj2Str(result)) Log.d("wxw", "获取首页信息" + Utils.obj2Str(result))
callback?.onHomeSuccess(true, Utils.obj2Str(result)) callback?.onHomeSuccess(true, Utils.obj2Str(result))
} }
...@@ -374,6 +384,9 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -374,6 +384,9 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
.subscribe(object : BaseObserver<NewLandListEntity>() { .subscribe(object : BaseObserver<NewLandListEntity>() {
override fun onSuccess(result: NewLandListEntity?) { override fun onSuccess(result: NewLandListEntity?) {
var json = Utils.obj2Str(result) var json = Utils.obj2Str(result)
if (result?.videoRate != null) {
// MyConstant.isShowCleanWormVideo = result.videoRate
}
Log.d("Wxw", "初始化地块列表成功$from$json") Log.d("Wxw", "初始化地块列表成功$from$json")
if (from == 1) { if (from == 1) {
callUnity("Canvas", "loadLandListSuccess", json) callUnity("Canvas", "loadLandListSuccess", json)
...@@ -577,11 +590,11 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -577,11 +590,11 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
}) })
} }
//看视频除虫 fun lookAdVideoCleanWorm(id: Int, isShow: Boolean) {
fun lookAdVideoCleanWorm(id: Int) {
this.runOnUiThread(object : Runnable { this.runOnUiThread(object : Runnable {
override fun run() { override fun run() {
MainDialog.showDialogWorm(this@GameActivity, View.OnClickListener { MainDialog.showDialogWorm(this@GameActivity, isShow, View.OnClickListener {
//需要看视频除虫
AdUtils.playRewardAd( AdUtils.playRewardAd(
this@GameActivity, this@GameActivity,
"CleanWorm", "CleanWorm",
...@@ -594,12 +607,12 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback { ...@@ -594,12 +607,12 @@ class GameActivity : UnityPlayerActivity(), IDialogViewCloseCallback {
} }
}) })
}, View.OnClickListener {
//不用看视频 直接除虫
getUnlockLandNew(id, 4, 0)
}) })
} }
}) })
} }
......
package com.ym.game.activity;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.WindowManager;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.airbnb.lottie.LottieAnimationView;
import com.ym.ddhy.R;
import com.ym.game.monopoly.LollipopFixedWebView;
import com.ym.library.activity.JavaInterface;
import com.ym.library.net.MyBaseActivity;
import com.ym.modulecommon.utils.LogUtils;
import com.ym.modulecommon.utils.StatusBarUtil;
import org.jetbrains.annotations.NotNull;
/**
* @author (wangXuewei)
* @datetime 2020-12-11 20:42 GMT+8
* @detail :
*/
public class MonopolyWebActivity extends MyBaseActivity {
private String url;
private String title;
private LollipopFixedWebView webView;
private ProgressBar pg;
private RelativeLayout rl_anim;
private LinearLayout ll_web;
@Override
public int layoutID() {
return R.layout.activity_monopoly_webview;
}
@Override
public void init() {
StatusBarUtil.transportStatus(this, getResources().getColor(com.ym.library.R.color.transparent));
title = getIntent().getData().getQueryParameter("title");
if (title.equals("分红")) {
getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
url = getIntent().getData().getQueryParameter("url");
title = getIntent().getData().getQueryParameter("title");
LogUtils.e("huang url:"+url);
LottieAnimationView id_lottie_dreams_come_true = findViewById(R.id.id_lottie_dreams_come_true);
ll_web = findViewById(R.id.ll_web);
rl_anim = findViewById(R.id.rl_anim);
rl_anim.setVisibility(View.VISIBLE);
id_lottie_dreams_come_true.setImageAssetsFolder("hloading/images/");
id_lottie_dreams_come_true.setAnimation("hloading/data.json");
id_lottie_dreams_come_true.setRepeatCount(-1);
id_lottie_dreams_come_true.playAnimation();
initWebView();
initTitle();
}
private void initWebView() {
pg = findViewById(R.id.progressBar);
webView = findViewById(R.id.activity_webview);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.setLayerType(View.LAYER_TYPE_HARDWARE,null);//开启硬件加速
// webView.getSettings().setDefaultFontSize(56);
// webView.getSettings().setMinimumFontSize(40);//设置最小字体
// 建议禁止缓存加载,以确保在攻击发生时可快速获取最新的滑动验证组件进行对抗。
webView.getSettings().setCacheMode(WebSettings.LOAD_DEFAULT);
webView.getSettings().setAppCacheEnabled(true);
// 设置不使用默认浏览器,而直接使用WebView组件加载页面。
// 设置WebView组件支持加载JavaScript。
webView.getSettings().setJavaScriptEnabled(true);
// 建立JavaScript调用Java接口的桥梁。
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
webView.setWebContentsDebuggingEnabled(true);
// 解决对某些标签的不支持出现白屏
webView.getSettings().setDomStorageEnabled(true);
webView.addJavascriptInterface(new WebJavaInterface(this, webView), "android");
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
webView.setWebChromeClient(new android.webkit.WebChromeClient() {
@Override
public void onProgressChanged(WebView view, int newProgress) {
if (newProgress == 100) {
pg.setVisibility(View.GONE);//加载完网页进度条消失
ll_web.setVisibility(View.VISIBLE);
rl_anim.setVisibility(View.GONE);
} else {
pg.setVisibility(View.VISIBLE);//开始加载网页时显示进度条
pg.setProgress(newProgress);//设置进度值
}
}
});
webView.loadUrl(url);
// webView.loadDataWithBaseURL(null, url, "text/html", "utf-8", null);//解决乱码问题
}
private void initTitle() {
RelativeLayout id_rl_toolbar = findViewById(com.ym.library.R.id.id_rl_toolbar);
if (getIntent().getData().getBooleanQueryParameter("showToolbar", true)) {
id_rl_toolbar.setVisibility(View.VISIBLE);
} else {
id_rl_toolbar.setVisibility(View.GONE);
}
findViewById(com.ym.library.R.id.id_iv_back).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
finish();
}
});
TextView tv_title = findViewById(com.ym.library.R.id.tv_user_toolbar_title);
tv_title.setText(title);
}
@Override
protected void onResume() {
super.onResume();
if (webView != null) {
webView.loadUrl("javascript:onResume()");
}
}
@Override
protected void onPause() {
super.onPause();
if (webView != null) {
webView.loadUrl("javascript:onPause()");
}
}
@Override
protected void onDestroy() {
super.onDestroy();
if (webView != null) {
ViewParent parent = webView.getParent();
if (parent != null) {
((ViewGroup) parent).removeView(webView);
}
webView.removeAllViews();
webView.destroy();
webView = null;
}
}
class WebJavaInterface extends JavaInterface {
public WebJavaInterface(@NotNull Activity act, @NotNull WebView web) {
super(act, web);
}
}
}
...@@ -98,7 +98,7 @@ class WelfareActivity : MyBaseActivity(), WelfareContract.View, ...@@ -98,7 +98,7 @@ class WelfareActivity : MyBaseActivity(), WelfareContract.View,
recycler_welfare_task?.adapter = taskAdapter recycler_welfare_task?.adapter = taskAdapter
} }
private var mSid: Int? = 0
override fun onItemClick(view: View, position: Int, data: NewsEntity) { override fun onItemClick(view: View, position: Int, data: NewsEntity) {
mData = data mData = data
if (!isClick) { if (!isClick) {
...@@ -109,7 +109,10 @@ class WelfareActivity : MyBaseActivity(), WelfareContract.View, ...@@ -109,7 +109,10 @@ class WelfareActivity : MyBaseActivity(), WelfareContract.View,
EventUtils.onEvent("welfare_task_undone_click_${data.sid}") EventUtils.onEvent("welfare_task_undone_click_${data.sid}")
if (data.opentype == NewsEntity.AD_TYPE_SDK) { if (data.opentype == NewsEntity.AD_TYPE_SDK) {
if (data.sid != null) { if (data.sid != null) {
showAd(data.sid)
mSid = data.sid
// showAd(data.sid)
mPresenter?.getADShowTimer()
EventUtils.onEvent("welfare_task_undone_click_total") EventUtils.onEvent("welfare_task_undone_click_total")
} }
} else { } else {
...@@ -251,6 +254,14 @@ class WelfareActivity : MyBaseActivity(), WelfareContract.View, ...@@ -251,6 +254,14 @@ class WelfareActivity : MyBaseActivity(), WelfareContract.View,
} }
} }
override fun taskTimeCd(time: Int?) {
if (time == 0 && mSid != null && mSid != 0) {
showAd(mSid!!)
} else {
Utils.showToast(this, "手速太快啦,${time}秒后再来吧")
}
}
fun showAd(sId: Int) { fun showAd(sId: Int) {
AdUtils.playRewardAd(this, "welfare_task", object : IAdVideoListener { AdUtils.playRewardAd(this, "welfare_task", object : IAdVideoListener {
override fun onAdClose() { override fun onAdClose() {
......
...@@ -9,6 +9,7 @@ class WelfareContract { ...@@ -9,6 +9,7 @@ class WelfareContract {
fun taskReceiveListResult(result: TaskCompleteEntity?) fun taskReceiveListResult(result: TaskCompleteEntity?)
fun taskCashResult(result: List<FlyBoxEntity>?) fun taskCashResult(result: List<FlyBoxEntity>?)
fun welfareTaskCashResult(result: ExchangeEntity?) fun welfareTaskCashResult(result: ExchangeEntity?)
fun taskTimeCd(time: Int?)
} }
interface Presenter { interface Presenter {
......
package com.ym.game.monopoly;
import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.Configuration;
import android.os.Build;
import android.util.AttributeSet;
import android.webkit.WebView;
/**
* Craeted by ${junqi.li}
* Craeted by 2020/10/26
*/
public class LollipopFixedWebView extends WebView {
public LollipopFixedWebView(Context context) {
super(getFixedContext(context));
}
public LollipopFixedWebView(Context context, AttributeSet attrs) {
super(getFixedContext(context), attrs);
}
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr) {
super(getFixedContext(context), attrs, defStyleAttr);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(getFixedContext(context), attrs, defStyleAttr, defStyleRes);
}
public LollipopFixedWebView(Context context, AttributeSet attrs, int defStyleAttr, boolean privateBrowsing) {
super(getFixedContext(context), attrs, defStyleAttr, privateBrowsing);
}
public static Context getFixedContext(Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return context.createConfigurationContext(new Configuration());
}
} else {
return context;
}
return null;
}
}
...@@ -99,4 +99,23 @@ class WelfarePresenter : WelfareContract.Presenter { ...@@ -99,4 +99,23 @@ class WelfarePresenter : WelfareContract.Presenter {
} }
}) })
} }
fun getADShowTimer(){
GameApiClient.gameApi.getAdTimeCD().compose(
RxSchedulers.observableIO2Main()
).subscribe(object : BaseObserver<StatusEntity>() {
override fun onSuccess(result: StatusEntity?) {
mView?.taskTimeCd(result?.cd)
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
mView?.taskTimeCd(0)
}
})
}
} }
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.ym.game.view ...@@ -3,6 +3,7 @@ package com.ym.game.view
import android.app.Activity import android.app.Activity
import android.app.Dialog import android.app.Dialog
import android.content.Context import android.content.Context
import android.content.DialogInterface
import android.view.Gravity import android.view.Gravity
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View
...@@ -597,7 +598,9 @@ object MainDialog { ...@@ -597,7 +598,9 @@ object MainDialog {
//生虫弹窗 //生虫弹窗
fun showDialogWorm( fun showDialogWorm(
activity: Activity?, activity: Activity?,
onClickListener: View.OnClickListener isShow: Boolean,
onClickListener: View.OnClickListener,
onClickNoVideoListener: View.OnClickListener
) { ) {
if (activity == null) return if (activity == null) return
val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme) val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme)
...@@ -614,13 +617,34 @@ object MainDialog { ...@@ -614,13 +617,34 @@ object MainDialog {
mDialogView.findViewById<ImageView>(R.id.id_img_close_clean_worm).setOnClickListener { mDialogView.findViewById<ImageView>(R.id.id_img_close_clean_worm).setOnClickListener {
mDialog.dismiss() mDialog.dismiss()
} }
var cleanWormBtn = mDialogView.findViewById<ImageView>(R.id.id_img_clean_worm)
mDialogView.findViewById<ImageView>(R.id.id_img_clean_worm).setOnClickListener { cleanWormBtn.setOnClickListener {
EventUtils.onEvent("click_clean_worm_video_btn", "除虫看视频点击") EventUtils.onEvent("click_clean_worm_video_btn", "除虫看视频点击")
onClickListener.onClick(it) onClickListener.onClick(it)
mDialog.dismiss() mDialog.dismiss()
} }
var cleanWormBtnNoVideo = mDialogView.findViewById<ImageView>(R.id.id_img_clean_worm_no_video)
cleanWormBtnNoVideo.setOnClickListener {
EventUtils.onEvent("click_clean_worm_btn", "除虫点击")
onClickNoVideoListener.onClick(it)
mDialog.dismiss()
}
//需要看视频
if (isShow){
cleanWormBtn.visibility=View.VISIBLE
cleanWormBtnNoVideo.visibility=View.GONE
}else{
cleanWormBtn.visibility=View.GONE
cleanWormBtnNoVideo.visibility=View.VISIBLE
}
mDialog.setOnDismissListener(object : DialogInterface.OnDismissListener {
override fun onDismiss(p0: DialogInterface?) {
// onDestroy()
AdUtils.loadFeedCacheAdToCache(activity)
}
})
mDialog?.setCanceledOnTouchOutside(false) mDialog?.setCanceledOnTouchOutside(false)
mDialog?.setCancelable(false) mDialog?.setCancelable(false)
if(activity.isFinishing){ if(activity.isFinishing){
...@@ -629,7 +653,6 @@ object MainDialog { ...@@ -629,7 +653,6 @@ object MainDialog {
mDialog?.show() mDialog?.show()
} }
//种子不足弹窗 //种子不足弹窗
fun showDialogSeedNotEnough( fun showDialogSeedNotEnough(
activity: Activity?, activity: Activity?,
......
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/worm_btn_press_no_video" android:state_pressed="true"/>
<item android:drawable="@drawable/worm_btn_no_video" android:state_pressed="false"/>
</selector>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/id_rl_toolbar"
android:layout_width="match_parent"
android:layout_height="90dp"
android:background="@color/white">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_alignParentBottom="true">
<ImageView
android:id="@+id/id_iv_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="14dp"
android:src="@drawable/back_img" />
<TextView
android:id="@+id/tv_user_toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="#000000"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="@+id/ll_web"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ProgressBar
android:id="@+id/progressBar"
style="@style/crowd_item_progressBar"
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="@color/white" />
<com.ym.game.monopoly.LollipopFixedWebView
android:id="@+id/activity_webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_FEDA83" />
</LinearLayout>
<RelativeLayout
android:id="@+id/rl_anim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:visibility="visible">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
<com.airbnb.lottie.LottieAnimationView
android:id="@+id/id_lottie_dreams_come_true"
android:layout_width="161dp"
android:layout_height="128dp"
android:layout_marginBottom="-2dp"
app:lottie_autoPlay="true"
android:visibility="gone"
app:lottie_loop="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/id_lottie_dreams_come_true"
android:layout_centerHorizontal="true"
android:layout_marginTop="19dp"
android:text="努力加载中…"
android:textColor="#ff999999"
android:textSize="14sp" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
...@@ -74,9 +74,19 @@ ...@@ -74,9 +74,19 @@
android:layout_marginBottom="@dimen/dp_20" android:layout_marginBottom="@dimen/dp_20"
android:src="@drawable/select_clean_worm" /> android:src="@drawable/select_clean_worm" />
<ImageView
android:id="@+id/id_img_clean_worm_no_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="@dimen/dp_20"
android:src="@drawable/select_clean_worm_no_video"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>
</RelativeLayout> </RelativeLayout>
<include layout="@layout/layout_base_feed_ad"/> <include layout="@layout/layout_base_feed_ad" />
</LinearLayout> </LinearLayout>
...@@ -11,4 +11,12 @@ ...@@ -11,4 +11,12 @@
<item name="android:windowEnterAnimation">@anim/main_popup_enter_anim</item> <item name="android:windowEnterAnimation">@anim/main_popup_enter_anim</item>
<item name="android:windowExitAnimation">@anim/main_popup_exit_anim</item> <item name="android:windowExitAnimation">@anim/main_popup_exit_anim</item>
</style> </style>
<style name="crowd_item_progressBar">
<item name="android:indeterminateOnly">false</item>
<item name="android:progressDrawable">@color/color_ffffff</item>
<item name="android:minHeight">10dp</item>
<item name="android:maxHeight">10dp</item>
</style>
</resources> </resources>
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<activity <activity
android:name="com.game.luckyfarm.UnityPlayerActivity" android:name="com.game.luckyfarm.UnityPlayerActivity"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density"
android:hardwareAccelerated="false" android:hardwareAccelerated="true"
android:label="@string/app_name" android:label="@string/app_name"
android:launchMode="singleTask" android:launchMode="singleTask"
android:screenOrientation="portrait"> android:screenOrientation="portrait">
......
...@@ -64,10 +64,10 @@ dependencies { ...@@ -64,10 +64,10 @@ dependencies {
api 'com.android.support:recyclerview-v7:28.0.0' api 'com.android.support:recyclerview-v7:28.0.0'
api 'com.tencent.bugly:crashreport:latest.release' api 'com.tencent.bugly:crashreport:latest.release'
api 'com.tencent.bugly:nativecrashreport:latest.release' api 'com.tencent.bugly:nativecrashreport:latest.release'
api ("com.bx:adsdk:1.3.3"){ // api ("com.bx:adsdk:1.3.3"){
exclude group: 'com.google.code.gson' // exclude group: 'com.google.code.gson'
} // }
api 'com.ym.admodule:admodule:1.0.3.14' api 'com.ym.admodule:admodule:1.0.3.15'
api 'com.airbnb.android:lottie:3.1.0' api 'com.airbnb.android:lottie:3.1.0'
/* api 'androidx.appcompat:appcompat:1.2.0-alpha02' /* api 'androidx.appcompat:appcompat:1.2.0-alpha02'
api 'com.android.support:design:28.0.0' api 'com.android.support:design:28.0.0'
......
...@@ -5,6 +5,9 @@ import android.os.Build; ...@@ -5,6 +5,9 @@ import android.os.Build;
import com.ym.library.net.LatestLoginInfo; import com.ym.library.net.LatestLoginInfo;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List; import java.util.List;
/** /**
...@@ -157,6 +160,16 @@ public class MyConstant { ...@@ -157,6 +160,16 @@ public class MyConstant {
public static int kkz_award_render_type = 0; public static int kkz_award_render_type = 0;
public static int qq = 0;// public static int qq = 0;//
@Nullable
public static int videoNumber = 0;
public static int videoCount = 15;
public static long videoTime = 0;
public static long videoTimeOut = 0;
@NotNull
public static int[] animationLocation;
public static int isopenranking;
public static boolean hasWishGood =false;
public static class Permission { public static class Permission {
public static final String PERMISSION_CAMERA = Manifest.permission.CAMERA; public static final String PERMISSION_CAMERA = Manifest.permission.CAMERA;
......
...@@ -16,23 +16,36 @@ import android.os.Build ...@@ -16,23 +16,36 @@ import android.os.Build
import android.os.Environment import android.os.Environment
import android.os.PowerManager import android.os.PowerManager
import android.provider.Settings import android.provider.Settings
import android.text.TextUtils
import android.util.Base64 import android.util.Base64
import android.util.Log import android.util.Log
import android.view.View
import android.view.WindowManager
import android.webkit.JavascriptInterface import android.webkit.JavascriptInterface
import android.webkit.WebView import android.webkit.WebView
import android.widget.Toast import android.widget.Toast
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import androidx.core.app.NotificationManagerCompat import androidx.core.app.NotificationManagerCompat
import androidx.core.content.FileProvider import androidx.core.content.FileProvider
import com.ym.admodule.config.AdManager
import com.ym.admodule.listener.ZXADVideoListener
import com.ym.library.MyConstant import com.ym.library.MyConstant
import com.ym.library.R
import com.ym.library.listener.H5Listener
import com.ym.library.listener.IAdVideoListener
import com.ym.library.module.BubbleOrBoxReceiveEntity
import com.ym.library.module.NewsEntity import com.ym.library.module.NewsEntity
import com.ym.library.net.ApiClient import com.ym.library.net.ApiClient
import com.ym.library.net.BaseObserver
import com.ym.library.net.GameApiClient
import com.ym.library.net.RxSchedulers import com.ym.library.net.RxSchedulers
import com.ym.library.presenter.ReportPresenter
import com.ym.library.rxbus.RxBusConstant import com.ym.library.rxbus.RxBusConstant
import com.ym.library.rxbus.RxBusUtil import com.ym.library.rxbus.RxBusUtil
import com.ym.library.utils.* import com.ym.library.utils.*
import com.ym.modulecommon.AppliContext import com.ym.modulecommon.AppliContext
import com.ym.modulecommon.utils.AdPreference import com.ym.modulecommon.utils.AdPreference
import com.ym.modulecommon.utils.LogUtils
import com.ym.modulecommon.utils.PhoneUtils import com.ym.modulecommon.utils.PhoneUtils
import io.reactivex.Observer import io.reactivex.Observer
import io.reactivex.disposables.Disposable import io.reactivex.disposables.Disposable
...@@ -950,5 +963,307 @@ abstract class JavaInterface { ...@@ -950,5 +963,307 @@ abstract class JavaInterface {
} }
} }
} }
//=======================大富翁START============================
/**
* 获得金币 翻倍 之后弹大图广告
*
* 刮刮卡
*
* type:2:大富翁
* 1:刮刮卡
*
*
*
*/
@JavascriptInterface
fun showGetCoinsDialog(type: Int, id: String, coins: String) {
if (TextUtils.isEmpty(coins)) return
LogUtils.e(
"huang -----h5",
"showGetCoinsDialog type:" + type + " id:" + id + " coins:" + coins
)
mWebView.context.runOnUiThread {
if(act==null){
return@runOnUiThread
}
if (act?.isFinishing!!)return@runOnUiThread
CenterDialog.showH5Dialog(act!!,coins.toDouble(),1,2,object :H5Listener{
override fun onDialogClose(type: String, shutdownType: Int) {
mWebView.loadUrl("javascript:closeWindows('$type','$shutdownType')")
}
})
/* CenterDialog.showHomeDialogStyle1(
act, 3, View.OnClickListener {
if (type == 2 && it.id.equals(R.id.id_iv_dismiss)) {
var type = "2"
mWebView.loadUrl("javascript:closeWindows('$type')")
} else {
if (VideoTimeUtils.isCanShowReward()) {
var action = ""
if (type == 1) {
action = "scraping_card_doubling_video"
} else {
action = "rich_man_doubling_video"
}
Toast.makeText(act, "看完福利视频后奖励即可翻倍", Toast.LENGTH_SHORT).show()
AdUtils.playRewardAd(act!!, "", object : IAdVideoListener {
override fun onAdClose() {
if (type == 1) {
EventUtils.onEvent(
"close_scraping_card_doubling_video",
"刮刮卡翻倍激励视频完成"
)
} else {
EventUtils.onEvent(
"close_rich_man_doubling_video",
"大富翁翻倍激励视频完成"
)
}
GameApiClient.gameApi.h5Receive(id)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object :
BaseObserver<BubbleOrBoxReceiveEntity?>() {
override fun onSuccess(result: BubbleOrBoxReceiveEntity?) {}
override fun onFailure(
e: Throwable?,
code: String?,
errorMsg: String?
) {
}
})
ReportPresenter.report()
*//* if (com.ym.library.Constant.videoNumber < com.ym.library.Constant.videoCount - 1) {
ToastUtils.showTextToast("再观看${(com.ym.library.Constant.videoCount - com.ym.library.Constant.videoNumber - 1)}个视频即可完成今日打卡")
}*//*
VideoNumberUtils.setVideoNumber()
VideoTimeUtils.setVideoTime()
CenterDialog.showH5Dialog(
act!!,
(coins.toDouble() * 2),
1,
type,
object :
H5Listener {
override fun onDialogClose(type: String) {
var type = "2"
mWebView.loadUrl("javascript:closeWindows('$type')")
}
})
LogUtils.e("huang1", "h5page:" + type + " type:" + 1)
}
override fun onError(errorMsg: String?) {
}
})
AdManager.playRewardAd(
ADConfig.AD_VIDEO,
action,
act!!,
object : ZXADVideoListener {
//看激励视频金币翻倍
override fun onAdClose() {//视频关闭
}
override fun onAdShow() {
AdManager.loadNextCacheRewardVideoAd(
ADConfig.AD_VIDEO,
act!!
)
}
override fun onAdVideoBarClick() {}
override fun onError(errorMsg: String?) {//视频播放错误
// AppClient.appApi.h5Receive(id)
// .compose(RxSchedulers.observableIO2Main())
// .subscribe(object : BaseObserver<BubbleOrBoxReceiveEntity?>() {
// override fun onSuccess(result: BubbleOrBoxReceiveEntity?) {}
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {} })
//
// CenterDialog.showH5Dialog(act!!, (coins.toDouble()*2), 0,type,object:H5Listener{
// override fun onDialogClose(type: String) {
// var type = "2"
// mWebView.loadUrl("javascript:closeWindows('$type')")
//
// }
//
// })
// LogUtils.e("huang2","h5page:"+type+" type:"+0)
}
override fun onSuccess() {}
})
}
}
}, coins.toInt(), if (type == 1) {
"H5_Dismiss"
} else {
"H5_Not_Dimiss"
}, "0"
)*/
}
}
/**
* 返回上一级
*/
@JavascriptInterface
fun goBack() {
mWebView.context.runOnUiThread {
if (mWebView.canGoBack()) mWebView.goBack()
}
}
/**
* 展示激励视频
*showReward(1) // 1:刮刮卡, 2:大富翁 3:每日分红
*/
@JavascriptInterface
fun showReward(type: Int, type2: String) {
LogUtils.e("huang -----h5", "showReward " + "type: = ====== $type" + " type2:" + type2)
mWebView.context.runOnUiThread {
if (VideoTimeUtils.isCanShowReward()) {
if (type == 1) {
//Toast.makeText(act, "看完福利视频即可继续刮卡", Toast.LENGTH_SHORT).show()
} else if (type == 2) {
//Toast.makeText(act, "观看完激励视频即可继续获取心愿值", Toast.LENGTH_SHORT).show()
} else if (type == 3) {
//TODO 每日分红
}
var action = ""
if (type == 1) {
action = "scraping_card_nomal_video"
} else if (type == 2) {
// action = "rich_man_nomal_video"
action = type2
} else if (type == 3) {
action = "everyday_dividend_video"
}
if (act!=null){
AdUtils.playRewardAd(act!!,action,object :IAdVideoListener{
override fun onAdClose() {
if (type == 1) {
EventUtils.onEvent("close_scraping_card_nomal_video", "刮刮卡激励视频完成")
} else if (type == 2) {
EventUtils.onEvent("close_rich_man_nomal_video", "大富翁激励视频完成")
} else if (type == 3) {
EventUtils.onEvent("close_everyday_dividend_video", "每日分红激励视频完成")
}
ReportPresenter.report()
VideoNumberUtils.setVideoNumber()
VideoTimeUtils.setVideoTime()
mWebView.context.runOnUiThread {
mWebView?.loadUrl("javascript:videoSucc('$type','$type2')")
}
}
override fun onError(errorMsg: String?) {
mWebView.context.runOnUiThread {
mWebView?.loadUrl("javascript:videoFail()")
}
}
})
}
}
}
}
/**
* 展示大图广告 大富翁
* 0:心愿值
* 1.金币
* 2,红包
*
* h5page:2:大富翁
* 1:刮刮卡
*/
@JavascriptInterface
fun showBigImgDialog(h5Page: Int, number: Int) {
LogUtils.e("huang -----h5", "showBigImgDialog 0 $number")
mWebView.context.runOnUiThread {
CenterDialog.showH5Dialog(act!!, number.toDouble(), 1, h5Page, object : H5Listener {
override fun onDialogClose(type: String, shutdownType: Int) {
mWebView.loadUrl("javascript:closeWindows('$type','$shutdownType')")
}
})
LogUtils.e("huang3", "h5page:" + h5Page + " type:" + 1)
}
}
/**
* 0:心愿值
* 1.金币
* 2,红包
*/
@JavascriptInterface
fun showBigImgDialog(h5Page: Int, type: Int, number: String) {
LogUtils.e("huang -----h5", "showBigImgDialog 1 $number" + " $type" + " $h5Page")
mWebView.context.runOnUiThread {
CenterDialog.showH5Dialog(
act!!,
DateUtils.numbToDoule(number),
type,
h5Page,
object : H5Listener {
override fun onDialogClose(type: String, shutdownType: Int) {
mWebView.loadUrl("javascript:closeWindows('$type','$shutdownType')")
}
})
LogUtils.e("huang4", "h5page:" + h5Page + " type:" + type)
}
}
/**
* 1:金币
* 10:红包
* 没有大图的dialog
*/
@JavascriptInterface
fun showRedAndCoinDialog(type: Int, number: Int) {
mWebView.context.runOnUiThread {
CenterDialog.showRedCoinDialog(act!!, type, number)
}
}
@JavascriptInterface
fun showRedAndCoinDialog(type: Int) {
mWebView.context.runOnUiThread {
CenterDialog.showRedCoinDialog(act!!, type, 1)
}
}
@JavascriptInterface
fun hiddenStatusBar() {
act?.window?.setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN
)
}
@JavascriptInterface
fun showToast(string: String) {
ToastUtils.showTextToast(string)
}
//=======================大富翁END============================
} }
\ No newline at end of file
package com.ym.library.activity package com.ym.library.activity
import android.os.SystemClock
import com.bx.adsdk.CampaignCallback
import com.bx.adsdk.CampaignFragment
import com.bytedance.sdk.openadsdk.*
import com.google.gson.Gson
import com.qq.e.ads.rewardvideo.RewardVideoAD
import com.qq.e.ads.rewardvideo.RewardVideoADListener
import com.qq.e.comm.managers.GDTADManager
import com.qq.e.comm.util.AdError
import com.umeng.analytics.MobclickAgent
import com.ym.library.R import com.ym.library.R
import com.ym.library.net.* import com.ym.library.net.*
import com.ym.library.utils.EventUtils
import com.ym.modulecommon.utils.AdPreference
import kotlinx.android.synthetic.main.activity_xiaoman.*
class XiaoManActivity : MyBaseActivity() { class XiaoManActivity : MyBaseActivity() {
override fun layoutID(): Int = R.layout.activity_xiaoman override fun layoutID(): Int = R.layout.activity_xiaoman
private var campaignFragment: CampaignFragment? = null
private var rewardVideoAD: RewardVideoAD? = null
override fun init() { override fun init() {
id_tv_title.text = intent.data?.getQueryParameter("title")
/**
* @param userId 用户id,必传,不能为空,不能为0
* @param placeId 资源位id:必传
* @param callback CampaignCallback 回调
*/
campaignFragment = CampaignFragment.newInstance(AdPreference.getToken())
campaignFragment?.setPlaceId("2773")
campaignFragment?.setCallback(object : CampaignCallback() {
override fun showAd(params: String) {
super.showAd(params)
val bridgeBean: XiaoManEntity = Gson().fromJson(params, XiaoManEntity::class.java)
val adType: String = bridgeBean.adType.toString()
val pId: String = bridgeBean.pid.toString()
val requestId: String = bridgeBean.requestId.toString()
if (adType.equals("1")) {
showTTAd("5116010", pId, requestId)
} else {
showGDTAd("1111153326", pId, requestId)
}
}
})
// campaignFragment?.canGoBack()//webview 是否可以返回上一页
// campaignFragment?.goBack()//webview 返回上一页
supportFragmentManager.beginTransaction().add(R.id.id_activity_fragment_content, campaignFragment!!).commitAllowingStateLoss()
id_iv_back.setOnClickListener {
finish()
}
} }
/** // private var campaignFragment: CampaignFragment? = null
* 穿山甲广告 // private var rewardVideoAD: RewardVideoAD? = null
*/ //
fun showTTAd(appId: String, pId: String, requestId: String) { // override fun init() {
//强烈建议在应用对应的Application#onCreate()方法中调用,避免出现content为null的异常 // id_tv_title.text = intent.data?.getQueryParameter("title")
TTAdSdk.init( //
this@XiaoManActivity, // /**
TTAdConfig.Builder() // * @param userId 用户id,必传,不能为空,不能为0
.appId(appId) // * @param placeId 资源位id:必传
.useTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView // * @param callback CampaignCallback 回调
.appName(this@XiaoManActivity.getString(R.string.app_name)) // */
.titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK) // campaignFragment = CampaignFragment.newInstance(AdPreference.getToken())
.allowShowNotify(true) //是否允许sdk展示通知栏提示 // campaignFragment?.setPlaceId("2773")
.allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页 // campaignFragment?.setCallback(object : CampaignCallback() {
.debug(false) //测试阶段打开,可以通过日志排查问题,上线时去除该调用 // override fun showAd(params: String) {
.directDownloadNetworkType( // super.showAd(params)
TTAdConstant.NETWORK_STATE_WIFI, // val bridgeBean: XiaoManEntity = Gson().fromJson(params, XiaoManEntity::class.java)
TTAdConstant.NETWORK_STATE_3G // val adType: String = bridgeBean.adType.toString()
) //允许直接下载的网络状态集合 // val pId: String = bridgeBean.pid.toString()
.supportMultiProcess(false) //是否支持多进程,true支持 // val requestId: String = bridgeBean.requestId.toString()
//.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。 // if (adType.equals("1")) {
.build() // showTTAd("5116010", pId, requestId)
) // } else {
// showGDTAd("1111153326", pId, requestId)
val mTTAdNative = TTAdSdk.getAdManager().createAdNative(this@XiaoManActivity) // }
val adSlot = AdSlot.Builder() // }
.setCodeId(pId) // })
.setSupportDeepLink(true) //// campaignFragment?.canGoBack()//webview 是否可以返回上一页
.setAdCount(2) //个性化模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可 //// campaignFragment?.goBack()//webview 返回上一页
.setExpressViewAcceptedSize(500f, 500f) // supportFragmentManager.beginTransaction().add(R.id.id_activity_fragment_content, campaignFragment!!).commitAllowingStateLoss()
.setImageAcceptedSize(1080, 1920) //
.setRewardName("金币") //奖励的名称 // id_iv_back.setOnClickListener {
.setRewardAmount(0) //奖励的数量 // finish()
//必传参数,表来标识应用侧唯一用户;若非服务器回调模式或不需sdk透传 // }
//可设置为空字符串 // }
.setUserID("")//userId //
.setOrientation(TTAdConstant.VERTICAL) //设置期望视频播放的方向,为TTAdConstant.HORIZONTAL或TTAdConstant.VERTICAL
// .setMediaExtra("media_extra") //用户透传的信息,可不传
.build()
mTTAdNative.loadRewardVideoAd(adSlot, object : TTAdNative.RewardVideoAdListener {
override fun onError(code: Int, message: String) {
campaignFragment?.setVideoError(requestId)
}
//视频广告加载后的视频文件资源缓存到本地的回调
override fun onRewardVideoCached() {}
//视频广告素材加载到,如title,视频url等,不包括视频文件
override fun onRewardVideoAdLoad(ad: TTRewardVideoAd) {
ad.setRewardAdInteractionListener(object :
TTRewardVideoAd.RewardAdInteractionListener {
override fun onAdShow() {
campaignFragment?.setVideoLoad(requestId)
EventUtils.onEvent("XIAO_MAN_CSJ_SHOW","小满穿山甲广告展示")
}
override fun onAdVideoBarClick() {
EventUtils.onEvent("XIAO_MAN_CSJ_CLICK","小满穿山甲广告点击")
}
override fun onAdClose() {
EventUtils.onEvent("XIAO_MAN_CSJ_CLOSE_CLICK","小满穿山甲广告关闭点击")
campaignFragment?.setVideoClose(requestId)
}
override fun onVideoError() {
campaignFragment?.setVideoError(requestId)
}
override fun onVideoComplete() {
campaignFragment?.setVideoComplete(requestId)
}
override fun onRewardVerify(rewardVerify: Boolean, rewardAmount: Int, rewardName: String?) {}
override fun onSkippedVideo() {}
})
ad.setDownloadListener(object : TTAppDownloadListener {
override fun onIdle() {}
override fun onDownloadActive(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
override fun onDownloadPaused(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
override fun onDownloadFailed(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
override fun onDownloadFinished(totalBytes: Long, fileName: String, appName: String) {}
override fun onInstalled(fileName: String, appName: String) {}
})
ad.showRewardVideoAd(this@XiaoManActivity)
}
})
}
/**
* 广点通广告
*/
fun showGDTAd(appID: String, pId: String, requestId: String) {
GDTADManager.getInstance().initWith(this@XiaoManActivity, appID)
rewardVideoAD = RewardVideoAD(this@XiaoManActivity, pId, object : RewardVideoADListener {
override fun onADExpose() {
}
override fun onADClick() {
EventUtils.onEvent("XIAO_MAN_GDT_CLICK","小满广点通广告点击")
}
override fun onVideoCached() {
if (!rewardVideoAD?.hasShown()!!) { //广告展示检查2:当前广告数据还没有展示过
val delta: Long = 1000 //建议给广告过期时间加个buffer,单位ms,这里demo采用1000ms的buffer
//广告展示检查3:展示广告前判断广告数据未过期
if (SystemClock.elapsedRealtime() < rewardVideoAD!!.getExpireTimestamp() - delta) {
rewardVideoAD?.showAD()
} else {//激励视频广告已过期,请再次请求广告后进行广告展示!
}
} else {//此条广告已经展示过,请再次请求广告后进行广告展示!
}
}
override fun onReward() {
}
override fun onADClose() {
EventUtils.onEvent("XIAO_MAN_GDT_CLOSE_CLICK","小满广点通广告关闭点击")
campaignFragment?.setVideoClose(requestId)
}
override fun onADLoad() {
campaignFragment?.setVideoLoad(requestId)
}
override fun onVideoComplete() {
campaignFragment?.setVideoComplete(requestId)
}
override fun onError(p0: AdError?) {
campaignFragment?.setVideoError(requestId)
}
override fun onADShow() {
EventUtils.onEvent("XIAO_MAN_GDT_SHOW","小满广点通广告展示")
}
})
rewardVideoAD?.loadAD()
}
// /** // /**
// * 广点通广告 // * 穿山甲广告
// */ // */
// fun showGDTAd(appID: String, pId: String, requestId: String) { // fun showTTAd(appId: String, pId: String, requestId: String) {
// GDTADManager.getInstance().initWith(this@XiaoManActivity, requestId) // //强烈建议在应用对应的Application#onCreate()方法中调用,避免出现content为null的异常
//// rewardVideoAD = RewardVideoAD(this, appID, pId, object : RewardVideoADListener { // TTAdSdk.init(
//// override fun onADLoad() { // this@XiaoManActivity,
//// if (rewardVideoAD != null) rewardVideoAD?.showAD() // TTAdConfig.Builder()
//// campaignFragment?.setVideoLoad(requestId) // .appId(appId)
//// } // .useTextureView(true) //使用TextureView控件播放视频,默认为SurfaceView,当有SurfaceView冲突的场景,可以使用TextureView
//// override fun onVideoCached() {} // .appName(this@XiaoManActivity.getString(R.string.app_name))
//// override fun onADShow() { // .titleBarTheme(TTAdConstant.TITLE_BAR_THEME_DARK)
//// EventUtils.onEvent("XIAO_MAN_GDT_SHOW","小满广点通广告展示") // .allowShowNotify(true) //是否允许sdk展示通知栏提示
//// } // .allowShowPageWhenScreenLock(true) //是否在锁屏场景支持展示广告落地页
//// override fun onADExpose() {} // .debug(false) //测试阶段打开,可以通过日志排查问题,上线时去除该调用
//// override fun onReward() {} // .directDownloadNetworkType(
//// override fun onADClick() { // TTAdConstant.NETWORK_STATE_WIFI,
//// EventUtils.onEvent("XIAO_MAN_GDT_CLICK","小满广点通广告点击") // TTAdConstant.NETWORK_STATE_3G
//// } // ) //允许直接下载的网络状态集合
//// override fun onVideoComplete() { // .supportMultiProcess(false) //是否支持多进程,true支持
//// campaignFragment?.setVideoComplete(requestId) // //.httpStack(new MyOkStack3())//自定义网络库,demo中给出了okhttp3版本的样例,其余请自行开发或者咨询工作人员。
//// } // .build()
//// override fun onADClose() { // )
//// EventUtils.onEvent("XIAO_MAN_GDT_CLOSE_CLICK","小满广点通广告关闭点击")
//// campaignFragment?.setVideoClose(requestId)
//// }
//// override fun onError(adError: AdError) {
//// campaignFragment?.setVideoError(requestId)
//// }
//// })
//// rewardVideoAD?.loadAD()
// //
// val mTTAdNative = TTAdSdk.getAdManager().createAdNative(this@XiaoManActivity)
// val adSlot = AdSlot.Builder()
// .setCodeId(pId)
// .setSupportDeepLink(true)
// .setAdCount(2) //个性化模板广告需要设置期望个性化模板广告的大小,单位dp,激励视频场景,只要设置的值大于0即可
// .setExpressViewAcceptedSize(500f, 500f)
// .setImageAcceptedSize(1080, 1920)
// .setRewardName("金币") //奖励的名称
// .setRewardAmount(0) //奖励的数量
// //必传参数,表来标识应用侧唯一用户;若非服务器回调模式或不需sdk透传
// //可设置为空字符串
// .setUserID("")//userId
// .setOrientation(TTAdConstant.VERTICAL) //设置期望视频播放的方向,为TTAdConstant.HORIZONTAL或TTAdConstant.VERTICAL
//// .setMediaExtra("media_extra") //用户透传的信息,可不传
// .build()
// //
// var rewardVideoAD = RewardVideoAD(this, pId, object : RewardVideoADListener { // mTTAdNative.loadRewardVideoAd(adSlot, object : TTAdNative.RewardVideoAdListener {
// override fun onADExpose() { // override fun onError(code: Int, message: String) {
//// listener.onAdShow() // campaignFragment?.setVideoError(requestId)
// } // }
// //
// //视频广告加载后的视频文件资源缓存到本地的回调
// override fun onRewardVideoCached() {}
//
// //视频广告素材加载到,如title,视频url等,不包括视频文件
// override fun onRewardVideoAdLoad(ad: TTRewardVideoAd) {
// ad.setRewardAdInteractionListener(object :
// TTRewardVideoAd.RewardAdInteractionListener {
// override fun onAdShow() {
// campaignFragment?.setVideoLoad(requestId)
// EventUtils.onEvent("XIAO_MAN_CSJ_SHOW","小满穿山甲广告展示")
// }
// override fun onAdVideoBarClick() {
// EventUtils.onEvent("XIAO_MAN_CSJ_CLICK","小满穿山甲广告点击")
// }
// override fun onAdClose() {
// EventUtils.onEvent("XIAO_MAN_CSJ_CLOSE_CLICK","小满穿山甲广告关闭点击")
// campaignFragment?.setVideoClose(requestId)
// }
// override fun onVideoError() {
// campaignFragment?.setVideoError(requestId)
// }
// override fun onVideoComplete() {
// campaignFragment?.setVideoComplete(requestId)
// }
// override fun onRewardVerify(rewardVerify: Boolean, rewardAmount: Int, rewardName: String?) {}
// override fun onSkippedVideo() {}
// })
// ad.setDownloadListener(object : TTAppDownloadListener {
// override fun onIdle() {}
// override fun onDownloadActive(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
// override fun onDownloadPaused(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
// override fun onDownloadFailed(totalBytes: Long, currBytes: Long, fileName: String, appName: String) {}
// override fun onDownloadFinished(totalBytes: Long, fileName: String, appName: String) {}
// override fun onInstalled(fileName: String, appName: String) {}
// })
// ad.showRewardVideoAd(this@XiaoManActivity)
// }
// })
// }
// /**
// * 广点通广告
// */
// fun showGDTAd(appID: String, pId: String, requestId: String) {
// GDTADManager.getInstance().initWith(this@XiaoManActivity, appID)
// rewardVideoAD = RewardVideoAD(this@XiaoManActivity, pId, object : RewardVideoADListener {
// override fun onADExpose() {
// }
// override fun onADClick() { // override fun onADClick() {
// EventUtils.onEvent("XIAO_MAN_GDT_CLICK","小满广点通广告点击") // EventUtils.onEvent("XIAO_MAN_GDT_CLICK","小满广点通广告点击")
// } // }
//
// override fun onVideoCached() { // override fun onVideoCached() {
// if (!rewardVideoAD?.hasShown()!!) { //广告展示检查2:当前广告数据还没有展示过
// val delta: Long = 1000 //建议给广告过期时间加个buffer,单位ms,这里demo采用1000ms的buffer
// //广告展示检查3:展示广告前判断广告数据未过期
// if (SystemClock.elapsedRealtime() < rewardVideoAD!!.getExpireTimestamp() - delta) {
// rewardVideoAD?.showAD()
// } else {//激励视频广告已过期,请再次请求广告后进行广告展示!
// }
// } else {//此条广告已经展示过,请再次请求广告后进行广告展示!
// }
// } // }
//
// override fun onReward() { // override fun onReward() {
//
// } // }
//
// override fun onADClose() { // override fun onADClose() {
// EventUtils.onEvent("XIAO_MAN_GDT_CLOSE_CLICK","小满广点通广告关闭点击") // EventUtils.onEvent("XIAO_MAN_GDT_CLOSE_CLICK","小满广点通广告关闭点击")
// campaignFragment?.setVideoClose(requestId) // campaignFragment?.setVideoClose(requestId)
// } // }
//
//
// //如果这里
// override fun onADLoad() { // override fun onADLoad() {
// if (rewardVideoAD != null) rewardVideoAD?.showAD()
// campaignFragment?.setVideoLoad(requestId) // campaignFragment?.setVideoLoad(requestId)
// } // }
//
// override fun onVideoComplete() { // override fun onVideoComplete() {
// campaignFragment?.setVideoComplete(requestId) // campaignFragment?.setVideoComplete(requestId)
// } // }
//
// override fun onError(p0: AdError?) { // override fun onError(p0: AdError?) {
// campaignFragment?.setVideoError(requestId) // campaignFragment?.setVideoError(requestId)
// } // }
//
// override fun onADShow() { // override fun onADShow() {
// EventUtils.onEvent("XIAO_MAN_GDT_SHOW","小满广点通广告展示") // EventUtils.onEvent("XIAO_MAN_GDT_SHOW","小满广点通广告展示")
// } // }
// })
// rewardVideoAD?.loadAD()
// }
//// /**
//// * 广点通广告
//// */
//// fun showGDTAd(appID: String, pId: String, requestId: String) {
//// GDTADManager.getInstance().initWith(this@XiaoManActivity, requestId)
////// rewardVideoAD = RewardVideoAD(this, appID, pId, object : RewardVideoADListener {
////// override fun onADLoad() {
////// if (rewardVideoAD != null) rewardVideoAD?.showAD()
////// campaignFragment?.setVideoLoad(requestId)
////// }
////// override fun onVideoCached() {}
////// override fun onADShow() {
////// EventUtils.onEvent("XIAO_MAN_GDT_SHOW","小满广点通广告展示")
////// }
////// override fun onADExpose() {}
////// override fun onReward() {}
////// override fun onADClick() {
////// EventUtils.onEvent("XIAO_MAN_GDT_CLICK","小满广点通广告点击")
////// }
////// override fun onVideoComplete() {
////// campaignFragment?.setVideoComplete(requestId)
////// }
////// override fun onADClose() {
////// EventUtils.onEvent("XIAO_MAN_GDT_CLOSE_CLICK","小满广点通广告关闭点击")
////// campaignFragment?.setVideoClose(requestId)
////// }
////// override fun onError(adError: AdError) {
////// campaignFragment?.setVideoError(requestId)
////// }
////// })
////// rewardVideoAD?.loadAD()
////
////
//// var rewardVideoAD = RewardVideoAD(this, pId, object : RewardVideoADListener {
//// override fun onADExpose() {
////// listener.onAdShow()
//// }
////
//// override fun onADClick() {
//// EventUtils.onEvent("XIAO_MAN_GDT_CLICK","小满广点通广告点击")
//// }
////
//// override fun onVideoCached() {
//// }
////
//// override fun onReward() {
////
//// }
////
//// override fun onADClose() {
//// EventUtils.onEvent("XIAO_MAN_GDT_CLOSE_CLICK","小满广点通广告关闭点击")
//// campaignFragment?.setVideoClose(requestId)
//// }
////
////
//// //如果这里
//// override fun onADLoad() {
//// if (rewardVideoAD != null) rewardVideoAD?.showAD()
//// campaignFragment?.setVideoLoad(requestId)
//// }
////
//// override fun onVideoComplete() {
//// campaignFragment?.setVideoComplete(requestId)
//// }
////
//// override fun onError(p0: AdError?) {
//// campaignFragment?.setVideoError(requestId)
//// }
////
//// override fun onADShow() {
//// EventUtils.onEvent("XIAO_MAN_GDT_SHOW","小满广点通广告展示")
//// }
////
//// }) // 有声播放
//// rewardVideoAD.loadAD()
//// }
//
// override fun onResume() {
// super.onResume()
//// EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "XiaoManActivity", "onResume")))
// MobclickAgent.onResume(this)
// }
//
// override fun onPause() {
// super.onPause()
//// EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "XiaoManActivity", "onPause")))
// MobclickAgent.onPause(this)
// }
//
// class XiaoManEntity {
// var adType: String? = ""
// var requestId: String? = ""
// var pid: String? = ""
// }
//
// /**
// * 看视频上报
// */
// fun videoClick() {
//// ApiClient.userApi.videoReport().compose(
//// RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<String>() {
//// override fun onSuccess(result: String?) {}
//// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
//// })
//
//
// }
//
// fun videoShow(){
//
//
// }
//
// fun videoCloseClick(){
//
// //
// }) // 有声播放
// rewardVideoAD.loadAD()
// } // }
override fun onResume() {
super.onResume()
// EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "XiaoManActivity", "onResume")))
MobclickAgent.onResume(this)
}
override fun onPause() {
super.onPause()
// EventUtils.onEvent("page_status", Utils.obj2Str(ReportEntity(Constant.ReportSessionId, "XiaoManActivity", "onPause")))
MobclickAgent.onPause(this)
}
class XiaoManEntity {
var adType: String? = ""
var requestId: String? = ""
var pid: String? = ""
}
/**
* 看视频上报
*/
fun videoClick() {
// ApiClient.userApi.videoReport().compose(
// RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<String>() {
// override fun onSuccess(result: String?) {}
// override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {}
// })
}
fun videoShow(){
}
fun videoCloseClick(){
}
} }
\ No newline at end of file
package com.ym.library.listener
/**
* Created by erwin on 2020/11/23
*
*/
interface H5Listener {
fun onDialogClose(type: String,shutdownType:Int)
}
\ No newline at end of file
package com.ym.library.module
class BubbleOrBoxReceiveEntity {
var balance: Int? = 0
}
\ No newline at end of file
...@@ -31,6 +31,15 @@ public class HomeInfoEntity { ...@@ -31,6 +31,15 @@ public class HomeInfoEntity {
private int subSeedVideoNum;//看种子不足视频剩余次数 private int subSeedVideoNum;//看种子不足视频剩余次数
private int acceleratorsVideoNum;//看视频给加速剂的个数 private int acceleratorsVideoNum;//看视频给加速剂的个数
private int lotteryNum;//转盘剩余次数 private int lotteryNum;//转盘剩余次数
private int isPopup;//是否选过商品
public int getIsPopup() {
return isPopup;
}
public void setIsPopup(int isPopup) {
this.isPopup = isPopup;
}
public int getLotteryNum() { public int getLotteryNum() {
return lotteryNum; return lotteryNum;
......
...@@ -19,7 +19,33 @@ public class NewLandListEntity { ...@@ -19,7 +19,33 @@ public class NewLandListEntity {
private int rate; private int rate;
private int configNum; private int configNum;
private float timeRate; private float timeRate;
private int videoRate;
private int stopConfigNum;
private int currentWormNum;
private List<LandListEntity> landList; private List<LandListEntity> landList;
public int getCurrentWormNum() {
return currentWormNum;
}
public void setCurrentWormNum(int currentWormNum) {
this.currentWormNum = currentWormNum;
}
public int getStopConfigNum() {
return stopConfigNum;
}
public void setStopConfigNum(int stopConfigNum) {
this.stopConfigNum = stopConfigNum;
}
public int getVideoRate() {
return videoRate;
}
public void setVideoRate(int videoRate) {
this.videoRate = videoRate;
}
public float getTimeRate() { public float getTimeRate() {
return timeRate; return timeRate;
......
...@@ -17,6 +17,15 @@ public class StatusEntity { ...@@ -17,6 +17,15 @@ public class StatusEntity {
private int videoNum; private int videoNum;
private int awardNum; private int awardNum;
private int acceleratorsNum; private int acceleratorsNum;
private int cd;
public int getCd() {
return cd;
}
public void setCd(int cd) {
this.cd = cd;
}
public int getAcceleratorsNum() { public int getAcceleratorsNum() {
return acceleratorsNum; return acceleratorsNum;
......
package com.ym.library.net package com.ym.library.net
import android.text.TextUtils import android.text.TextUtils
import com.ym.library.BuildConfig import com.ym.admodule.BuildConfig
import com.ym.library.MyConstant import com.ym.library.MyConstant
import com.ym.modulecommon.net.NetConfig import com.ym.modulecommon.net.NetConfig
import com.ym.modulecommon.utils.AdPreference import com.ym.modulecommon.utils.AdPreference
......
...@@ -69,5 +69,5 @@ object GameApiClient { ...@@ -69,5 +69,5 @@ object GameApiClient {
.build() .build()
val gameApi by lazy { retrofit.create(IGameApi::class.java) } val gameApi by lazy { retrofit.create(IGameApi::class.java) }
val report by lazy { retrofit.create(IReportApi::class.java) }
} }
\ No newline at end of file
...@@ -351,4 +351,19 @@ interface IGameApi { ...@@ -351,4 +351,19 @@ interface IGameApi {
*/ */
@GET(NetConfig.Game.URL_GAME_WAREHOUSEDATA) @GET(NetConfig.Game.URL_GAME_WAREHOUSEDATA)
fun getWarehouseData(): Observable<Response<List<FlyBoxEntity>>> fun getWarehouseData(): Observable<Response<List<FlyBoxEntity>>>
@POST("app/v3/common/award/multiple")
fun h5Receive(
@Query("sid") id: String
): Observable<Response<BubbleOrBoxReceiveEntity?>>
@GET(NetConfig.Game.URL_GAME_AD_TIME_CD)
fun getAdTimeCD():Observable<Response<StatusEntity?>>
@POST(NetConfig.Game.URL_GAME_AD_VIDEO_REPORT)
fun adVideoReport(@Query("slot") slot:String): Observable<Response<Any>>
} }
\ No newline at end of file
package com.ym.library.net
import com.ym.modulecommon.net.Response
import io.reactivex.Observable
import retrofit2.http.GET
interface IReportApi {
@GET("app/v1/pigbox/reporting")
fun report(): Observable<Response<Any?>>
}
\ No newline at end of file
...@@ -133,6 +133,9 @@ public class NetConfig { ...@@ -133,6 +133,9 @@ public class NetConfig {
public static String WEB_URL_REVENUERANKINGURL; //收益排行 public static String WEB_URL_REVENUERANKINGURL; //收益排行
public static String WEB_URL_PURSEURL; //十万金币跳转 public static String WEB_URL_PURSEURL; //十万金币跳转
public static String CONFIRMURL = "http://h5v2test.zhangxinzhixun.com/monopoly/Confirm";//梦想成真
public static int mDFWType = 1;//大富翁type
} }
public static class Novel { public static class Novel {
...@@ -242,5 +245,7 @@ public class NetConfig { ...@@ -242,5 +245,7 @@ public class NetConfig {
public static final String URL_GAME_ORDER_LIST = "app/v1/game/ddhy/list_order";//花园 订单列表 public static final String URL_GAME_ORDER_LIST = "app/v1/game/ddhy/list_order";//花园 订单列表
public static final String URL_GAME_WITHDRAW_LIST = "app/v1/game/ddhy/withdraw_list";//兑换列表 public static final String URL_GAME_WITHDRAW_LIST = "app/v1/game/ddhy/withdraw_list";//兑换列表
public static final String URL_GAME_DOWD = "app/v1/game/ddhy/do_wd";//兑换接口 public static final String URL_GAME_DOWD = "app/v1/game/ddhy/do_wd";//兑换接口
//看广告间隔
public static final String URL_GAME_AD_TIME_CD = "app/v1/game/video_cd";
} }
} }
...@@ -131,6 +131,7 @@ class NovelInitEntity { ...@@ -131,6 +131,7 @@ class NovelInitEntity {
var clockInzurl:String?=""//打卡提现 var clockInzurl:String?=""//打卡提现
var rankingurl:String?=""//排行榜 var rankingurl:String?=""//排行榜
var withdrawurl:String?=""//提现页面 var withdrawurl:String?=""//提现页面
var Confirmurl:String?=""//大富翁
} }
class WxConfig { class WxConfig {
......
...@@ -305,7 +305,7 @@ class SplashPresenter : SplashContract.Presenter { ...@@ -305,7 +305,7 @@ class SplashPresenter : SplashContract.Presenter {
MyConstant.Param.PunchRecord = mNovelInitEntity.h5_url?.clockInzurl MyConstant.Param.PunchRecord = mNovelInitEntity.h5_url?.clockInzurl
MyConstant.Param.RankList = mNovelInitEntity.h5_url?.rankingurl MyConstant.Param.RankList = mNovelInitEntity.h5_url?.rankingurl
MyConstant.Param.WithDraw = mNovelInitEntity.h5_url?.withdrawurl MyConstant.Param.WithDraw = mNovelInitEntity.h5_url?.withdrawurl
NetConfig.H5.CONFIRMURL = mNovelInitEntity.h5_url?.Confirmurl
} }
......
package com.ym.library.presenter
import com.ym.library.net.GameApiClient
import com.ym.modulecommon.net.BaseObserver
import com.ym.modulecommon.net.RxSchedulers
object ReportPresenter {
fun report() {
GameApiClient.report.report().compose(RxSchedulers.observableIO2Main()).subscribe(object : BaseObserver<Any?>() {
override fun onSuccess(result: Any?) {
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
}
})
}
}
\ No newline at end of file
...@@ -29,6 +29,13 @@ interface RounterApi { ...@@ -29,6 +29,13 @@ interface RounterApi {
@RounterParam("showToolbar") showToolbar: Boolean @RounterParam("showToolbar") showToolbar: Boolean
): Intent ): Intent
@RounterUri(MyConstant.scheme + "://nomal_web")
fun getIntentNomalActivityWeb(
@RounterParam("title") title: String,
@RounterParam("url") url: String,
@RounterParam("showToolbar") showToolbar: Boolean
): Intent
@RounterUri(MyConstant.scheme + "://adshare") @RounterUri(MyConstant.scheme + "://adshare")
fun getIntentActivityAdShare(@RounterParam("data") data: String): Intent fun getIntentActivityAdShare(@RounterParam("data") data: String): Intent
......
...@@ -46,11 +46,21 @@ object AdUtils { ...@@ -46,11 +46,21 @@ object AdUtils {
//预加载 //预加载
// loadNextCacheRewardVideoAd(activity) // loadNextCacheRewardVideoAd(activity)
//看视频上报 //看视频上报
getVideoAcceleratorsReceive(); if ("welfare_task".equals(actionName)) {
getVideoAcceleratorsReceive("center_video_cd")
} else {
getVideoAcceleratorsReceive()
}
handler?.removeCallbacksAndMessages(null) handler?.removeCallbacksAndMessages(null)
} }
override fun onAdShow() { override fun onAdShow() {
if (actionName.equals("jiacishu")){
EventUtils.onEvent("dfw_touzi_video_show", "大富翁骰子视频曝光");
}
if (actionName.equals("kengwei")){
EventUtils.onEvent("dfw_qipan_video_show", "大富翁棋盘视频曝光");
}
Utils.showToast(activity, "看完视频可获得奖励") Utils.showToast(activity, "看完视频可获得奖励")
handler?.sendEmptyMessageDelayed(0, 2000) handler?.sendEmptyMessageDelayed(0, 2000)
} }
...@@ -100,11 +110,26 @@ object AdUtils { ...@@ -100,11 +110,26 @@ object AdUtils {
.compose(RxSchedulers.observableIO2Main()) .compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<StatusEntity>() { .subscribe(object : BaseObserver<StatusEntity>() {
override fun onSuccess(result: StatusEntity?) { override fun onSuccess(result: StatusEntity?) {
Log.d("wxw", "看视频上报 Success")
} }
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) { override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
Log.d("wxw", "看视频上报 error")
}
})
}
//看视频复活上报
fun getVideoAcceleratorsReceive(slot: String) {
GameApiClient.gameApi.adVideoReport(slot)
.compose(RxSchedulers.observableIO2Main())
.subscribe(object : BaseObserver<Any>() {
override fun onSuccess(result: Any?) {
}
override fun onFailure(e: Throwable?, code: String?, errorMsg: String?) {
} }
}) })
} }
......
...@@ -12,12 +12,20 @@ import android.view.View ...@@ -12,12 +12,20 @@ import android.view.View
import android.webkit.WebView import android.webkit.WebView
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.ImageView import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.bitmap.CircleCrop
import com.bumptech.glide.request.RequestOptions
import com.ym.library.MyConstant import com.ym.library.MyConstant
import com.ym.library.R import com.ym.library.R
import com.ym.library.base.BaseDialog import com.ym.library.base.BaseDialog
import com.ym.library.listener.AdCallback import com.ym.library.listener.AdCallback
import com.ym.library.listener.H5Listener
import com.ym.modulecommon.AppliContext
import com.ym.modulecommon.base.NoDoubleClickListener
import com.ym.modulecommon.utils.LogUtils
/** /**
* Created by gaoleichao on 2018/8/17. * Created by gaoleichao on 2018/8/17.
...@@ -536,6 +544,52 @@ object CenterDialog : BaseDialog() { ...@@ -536,6 +544,52 @@ object CenterDialog : BaseDialog() {
countDownTimer?.start() countDownTimer?.start()
} }
private fun countDown(time: Long, textView: TextView, type: Int) {
var countDownTimer: CountDownTimer? = null
//时间 倒计时 入参long类型
countDownTimer = object : CountDownTimer(time, 1000) {
@SuppressLint("SetTextI18n")
override fun onTick(millisUntilFinished: Long) {
val day = millisUntilFinished / (1000 * 24 * 60 * 60) //单位天
val hour =
(millisUntilFinished - day * (1000 * 24 * 60 * 60)) / (1000 * 60 * 60) //单位时
val minute =
(millisUntilFinished - day * (1000 * 24 * 60 * 60) - hour * (1000 * 60 * 60)) / (1000 * 60) //单位分
val second =
(millisUntilFinished - day * (1000 * 24 * 60 * 60) - hour * (1000 * 60 * 60) - minute * (1000 * 60)) / 1000 //单位秒
var hours = hour.toString()
if (hours.length < 2) {//如果是 1 2 3 4 5 6 7 8 9 前边加0
hours = "0$hours"
}
var minutes = minute.toString()
if (minutes.length < 2) {//如果是 1 2 3 4 5 6 7 8 9 前边加0
minutes = "0$minutes"
}
var seconds = second.toString()
if (seconds.length < 2) {//如果是 1 2 3 4 5 6 7 8 9 前边加0
seconds = "0$seconds"
}
when (type) {
0 -> textView?.text = "离本场结束还有${hours}:${minutes}:${seconds}"
1, 2 -> textView?.text = "剩余${hours}:${minutes}:${seconds}"
}
}
override fun onFinish() {
countDownTimer?.cancel()
countDownTimer = null
when (type) {
0, 1 -> textView?.visibility = View.GONE
2 -> textView?.text = "剩余00:00:00"
}
}
}
countDownTimer?.start()
}
fun showPermission( fun showPermission(
activity: Activity, activity: Activity,
title: String, title: String,
...@@ -570,4 +624,309 @@ object CenterDialog : BaseDialog() { ...@@ -570,4 +624,309 @@ object CenterDialog : BaseDialog() {
mDialog?.show() mDialog?.show()
} }
/**
* 首页弹窗风格1,使用时查看布局
*/
fun showHomeDialogStyle1(
activity: Activity?,
type: Int,
onClickListener: View.OnClickListener,
int1: Int,
string1: String,
string2: String
) {
if (activity == null) return
val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme)
val view =
showBottomDialog(R.layout.dialog_home_style_1, activity, mDialog, 0, Gravity.CENTER)
val id_tv_title = view?.findViewById<TextView>(R.id.id_tv_title)
view.findViewById<View>(R.id.id_iv_dismiss).setOnClickListener {
mDialog.dismiss()
if (string1.equals("H5_Dismiss")) {
activity.finish()
}
if (string1.equals("H5_Not_Dimiss")) {
onClickListener?.onClick(it)
}
if (string1.equals("0.3")) {
onClickListener?.onClick(it)
}
}
when (type) {
0 -> {
id_tv_title?.text = "猪财神助力"
view?.findViewById<View>(R.id.id_ll_help).visibility = View.VISIBLE
view?.findViewById<TextView>(R.id.id_tv_time_0)?.text = string1
val iv_pig_upgrade = view?.findViewById<ImageView>(R.id.iv_pig_upgrade)
view?.findViewById<View>(R.id.id_iv_btn_0).setOnClickListener {
val animationLocation = IntArray(2)
iv_pig_upgrade?.getLocationOnScreen(animationLocation)
MyConstant.animationLocation = animationLocation
onClickListener.onClick(it)
mDialog.dismiss()
}
}
1 -> {
id_tv_title?.text = "金币卡"
view?.findViewById<View>(R.id.id_ll_pig_card).visibility = View.VISIBLE
val id_iv_btn_1 = view?.findViewById<ImageView>(R.id.id_iv_btn_1)
id_iv_btn_1.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(view: View?) {
onClickListener.onClick(id_iv_btn_1)
mDialog.dismiss()
}
})
}
2 -> {
id_tv_title?.text = "领取奖励"
view?.findViewById<View>(R.id.id_ll_upgrade).visibility = View.VISIBLE
val tv_number = view?.findViewById<TextView>(R.id.tv_number)
val tv_title = view?.findViewById<TextView>(R.id.tv_title)
tv_title.text = string1 + "元"
tv_number.text = string1
val iv_ok = view?.findViewById<ImageView>(R.id.iv_ok)
iv_ok.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(view: View?) {
onClickListener.onClick(iv_ok)
mDialog.dismiss()
}
})
}
3 -> {
id_tv_title?.text = "恭喜获得"
view?.findViewById<View>(R.id.id_ll_congratulations).visibility = View.VISIBLE
view?.findViewById<TextView>(R.id.id_tv_number)?.text = "${int1}金币"
val id_iv_double = view?.findViewById<ImageView>(R.id.id_iv_double)
if (string1.equals("0") || string1.equals("H5_Dismiss") || string1.equals("H5_Not_Dimiss")) {//奖励翻倍
id_iv_double.setImageResource(R.drawable.bg_dialog_home_double)
} else {//开心收下
id_iv_double.setImageResource(R.drawable.bg_dialog_home_accept)
}
id_iv_double.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(view: View?) {
if (string1.equals("0") || string1.equals("H5_Dismiss") || string1.equals("H5_Not_Dimiss")) {
onClickListener.onClick(view)
}
mDialog.dismiss()
}
})
val id_tv_close_button = view.findViewById<TextView>(R.id.id_tv_close_button)
val id_iv_dismiss = view.findViewById<ImageView>(R.id.id_iv_dismiss)
DialogCloseUtils.setTimes(id_tv_close_button, id_iv_dismiss)
val ad_framelayout = view?.findViewById<FrameLayout>(R.id.ad_framelayout)
ad_framelayout.removeAllViews()
AdUtils.showFeedAd(activity,"happy_receiver_bigimg",ad_framelayout)
// AdManager.showFeedAd(
// ADConfig.AD_IMG_FADE,
// "happy_receiver_bigimg",
// ZXADSizeConfig(
// Utils.px2dip(PhoneUtils.getScreenWidth(activity).toFloat()) - 36,
// 244
// ),
// activity,
// ad_framelayout
// )
// ad_framelayout.postDelayed(Runnable {
// AdManager.loadFeedAdToCache(
// ADConfig.AD_COMMOM_BIGIMAGE,
// activity,
// ZXADSizeConfig(
// Utils.px2dip(
// PhoneUtils.getScreenWidth(activity).toFloat()
// ) - 36, 244
// )
// )
// }, 1500)
}
4 -> {
id_tv_title?.text = "好友"
view?.findViewById<View>(R.id.id_ll_friend).visibility = View.VISIBLE
Glide.with(AppliContext.get()).load(string1)
.apply(RequestOptions.bitmapTransform(CircleCrop()))
.into(view?.findViewById(R.id.id_iv_avatar_4))
view?.findViewById<TextView>(R.id.id_iv_name_4)?.text = string2
val id_tv_time_4 = view?.findViewById<TextView>(R.id.id_tv_time_4)
countDown((int1 * 1000).toLong(), id_tv_time_4, 2)
}
5 -> {
id_tv_title?.text = "猪财神"
view?.findViewById<View>(R.id.id_ll_delete).visibility = View.VISIBLE
val id_tv_time = view?.findViewById<TextView>(R.id.id_tv_time)
view?.findViewById<ImageView>(R.id.id_iv_delete)
.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(view: View?) {
onClickListener.onClick(view)
mDialog.dismiss()
}
})
countDown((int1 * 1000).toLong(), id_tv_time, 2)
}
6 -> {
id_tv_title?.text = "幸运转盘规则"
view?.findViewById<View>(R.id.id_ll_rule).visibility = View.VISIBLE
view?.findViewById<View>(R.id.id_iv_confirm).setOnClickListener {
mDialog.dismiss()
}
}
7 -> {
id_tv_title?.text = "梦想成真"
view?.findViewById<View>(R.id.id_ll_dream).visibility = View.VISIBLE
view?.findViewById<View>(R.id.id_iv_to_wish).setOnClickListener {
onClickListener.onClick(it)
mDialog.dismiss()
}
}
}
mDialog.setCanceledOnTouchOutside(true)
mDialog.setOnDismissListener {}
mDialog.show()
}
/**
*
* h5Page: 1:刮刮卡
* h5Page:2:大富翁
*
*
*/
fun showH5Dialog(
activity: Activity,
number: Double,
type: Int,
h5Page: Int,
listener: H5Listener
) {
LogUtils.e("huang", "h5page:" + h5Page + "type:" + type)
if (activity == null) return
val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme)
val view =
showBottomDialog(R.layout.dialog_home_style_3, activity, mDialog, 0, Gravity.CENTER)
val id_ll_congratulations = view.findViewById<LinearLayout>(R.id.id_ll_congratulations)
val ll_big_money = view.findViewById<LinearLayout>(R.id.ll_big_money)
val id_ll_upgrade = view.findViewById<LinearLayout>(R.id.id_ll_upgrade)
val iv_ok = mDialog.findViewById<ImageView>(R.id.iv_ok)
val id_tv_close_button = view.findViewById<TextView>(R.id.id_tv_close_button)
val id_iv_dismiss = view.findViewById<ImageView>(R.id.id_iv_dismiss)
DialogCloseUtils.setTimes(id_tv_close_button, id_iv_dismiss)
id_iv_dismiss?.setOnClickListener {
mDialog.dismiss()
if ((type == 1 || type == 2) && h5Page == 1) {
activity.finish()
}
if (type == 1) {
listener.onDialogClose("2",0)
} else if (type == 0) {
listener.onDialogClose("1",0)
}
}
iv_ok.setOnClickListener {
mDialog.dismiss()
if ((type == 1 || type == 2) && h5Page == 1) {
activity.finish()
}
if (type == 1) {
listener.onDialogClose("2",1)
} else if (type == 0) {
listener.onDialogClose("1",1)
}
}
when (type) {
1 -> {//金币
id_ll_congratulations.visibility = View.VISIBLE
iv_ok.visibility = View.VISIBLE
val id_tv_number = view.findViewById<TextView>(R.id.id_tv_number)
id_tv_number.text = "" + number.toInt() + "金币"
}
0 -> {//心愿值
ll_big_money.visibility = View.VISIBLE
iv_ok.visibility = View.VISIBLE
val tv_number = view.findViewById<TextView>(R.id.tv_number)
tv_number.setText("" + number.toInt() + "个心愿值")
}
2 -> {//红包
id_ll_upgrade.visibility = View.VISIBLE
val tv_red_title = view.findViewById<TextView>(R.id.tv_red_title)
val tv_red_number = view.findViewById<TextView>(R.id.tv_red_number)
val iv_red_ok = view.findViewById<ImageView>(R.id.iv_red_ok)
tv_red_title.text = "" + number + "元"
tv_red_number.text = "" + number
iv_red_ok.setOnClickListener {
mDialog.dismiss()
if ((type == 1 || type == 2) && h5Page == 1) {
activity.finish()
}
}
}
}
val ad_framelayout = mDialog.findViewById<FrameLayout>(R.id.ad_framelayout)
AdUtils.showFeedAd(activity,"h5_bigimg",ad_framelayout)
// AdManager.showFeedAd(
// ADConfig.AD_COMMOM_BIGIMAGE,
// "h5_bigimg",
// ZXADSizeConfig(Utils.px2dip(PhoneUtils.getScreenWidth(activity).toFloat()) - 38, 250),
// activity,
// ad_framelayout
// )
mDialog.setCanceledOnTouchOutside(true)
mDialog.setOnDismissListener {}
mDialog.show()
}
//h5弹窗 红包和金币
fun showRedCoinDialog(activity: Activity, type: Int, number: Int?) {
if (activity == null) return
val mDialog = Dialog(activity, R.style.UpdateVersionCompatDialogTheme)
val view =
showBottomDialog(R.layout.dialog_home_style_1, activity, mDialog, 0, Gravity.CENTER)
val id_tv_title = view?.findViewById<TextView>(R.id.id_tv_title)
view.findViewById<View>(R.id.id_iv_dismiss).setOnClickListener {
mDialog.dismiss()
}
when (type) {
10 -> {//红包
id_tv_title?.text = "恭喜获得"
view?.findViewById<View>(R.id.id_ll_upgrade).visibility = View.VISIBLE
val tv_number = view?.findViewById<TextView>(R.id.tv_number)
val tv_title = view?.findViewById<TextView>(R.id.tv_title)
tv_title.text = "" + number + "元"
tv_number.text = "" + number
view?.findViewById<ImageView>(R.id.iv_ok).setOnClickListener {
mDialog.dismiss()
}
}
1 -> {// 金币
id_tv_title?.text = "恭喜获得"
view?.findViewById<View>(R.id.id_ll_congratulations).visibility = View.VISIBLE
view?.findViewById<TextView>(R.id.id_tv_number)?.text = "${number}金币"
val id_iv_double = view?.findViewById<ImageView>(R.id.id_iv_double)
id_iv_double.setImageResource(R.drawable.bg_dialog_home_accept)
id_iv_double.setOnClickListener(object : NoDoubleClickListener() {
override fun onNoDoubleClick(view: View?) {
mDialog.dismiss()
}
})
}
}
mDialog.setCanceledOnTouchOutside(true)
mDialog.setOnDismissListener {}
mDialog.show()
}
} }
\ No newline at end of file
...@@ -2,6 +2,8 @@ package com.ym.library.utils; ...@@ -2,6 +2,8 @@ package com.ym.library.utils;
import android.text.TextUtils; import android.text.TextUtils;
import org.jetbrains.annotations.Nullable;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -666,5 +668,18 @@ public class DateUtils { ...@@ -666,5 +668,18 @@ public class DateUtils {
return time ; return time ;
} }
public static double numbToDoule(String number) {
if(number!=null){
return Double.parseDouble(number);
}else {
return 0.0;
}
}
@Nullable
public static Object doubleToInt(double number) {
return Integer.parseInt(""+number);
}
} }
package com.ym.library.utils
import android.view.View
import android.widget.ImageView
import android.widget.TextView
import com.ym.library.utils.MainLooper
import com.ym.modulecommon.AppliContext
/**
* Created by erwin on 2020/11/26
*
*/
object DialogCloseUtils {
fun setTimes(tv:TextView,iv:ImageView){
tv.visibility = View.VISIBLE
iv.visibility = View.GONE
tv.text = "3"
LJButtonCountTimer(AppliContext.get(), 3000, 1000, tv,iv).start()
}
}
\ No newline at end of file
...@@ -11,6 +11,7 @@ import com.ym.library.listener.IAdVideoListener; ...@@ -11,6 +11,7 @@ import com.ym.library.listener.IAdVideoListener;
import com.ym.library.module.NewsEntity; import com.ym.library.module.NewsEntity;
import com.ym.library.module.ShaveListEntity; import com.ym.library.module.ShaveListEntity;
import com.ym.library.net.NetConfig;
import com.ym.library.router.RounterApi; import com.ym.library.router.RounterApi;
import com.ym.library.router.RounterBus; import com.ym.library.router.RounterBus;
import com.ym.library.rxbus.BusData; import com.ym.library.rxbus.BusData;
...@@ -48,6 +49,18 @@ public class JumpUtils { ...@@ -48,6 +49,18 @@ public class JumpUtils {
Utils.showToast(AppliContext.get(), "该版本暂不支持,请更新版本!"); Utils.showToast(AppliContext.get(), "该版本暂不支持,请更新版本!");
} }
} }
public static void h5NormalJump(String title, String url,boolean showToolbar,Activity activity) {
try {
Intent intent = RounterBus.getRounter(RounterApi.class).getIntentNomalActivityWeb(title, url,showToolbar);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
if (activity!=null){
activity.startActivity(intent);
}
} catch (Exception e) {
Utils.showToast(AppliContext.get(), "该版本暂不支持,请更新版本!");
}
}
public static void gatherJump(String CChannel, String pid, String albumId, String description, String area, String tvYear, public static void gatherJump(String CChannel, String pid, String albumId, String description, String area, String tvYear,
String score, String contentType, String name, String image, boolean topVisibleFlag, String score, String contentType, String name, String image, boolean topVisibleFlag,
...@@ -359,6 +372,14 @@ public class JumpUtils { ...@@ -359,6 +372,14 @@ public class JumpUtils {
//绑定微信号跳转 //绑定微信号跳转
} else if (TextUtils.equals("2080", sid + "")) { } else if (TextUtils.equals("2080", sid + "")) {
//签到提现任务 //签到提现任务
} else if (TextUtils.equals("2497", sid + "")) {
//掷骰子
JumpUtils.h5NormalJump(
"大富翁",
NetConfig.H5.CONFIRMURL + "?is_popup1=" + NetConfig.H5.mDFWType,
false,
activity
);
} else if (incentiveLevel > 0) { } else if (incentiveLevel > 0) {
if (sid.equals("2325")) { if (sid.equals("2325")) {
//成就殿堂 //成就殿堂
......
package com.ym.library.utils;
import android.content.Context;
import android.graphics.Color;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
/**
* 按钮倒计时
* @author lbm
*
*/
public class LJButtonCountTimer extends CountDownTimer {
TextView mButton;
ImageView close;
Context mContext;
public LJButtonCountTimer(Context ctx, long millisInFuture, long countDownInterval, TextView button, ImageView close) {
super(millisInFuture, countDownInterval);
this.mButton = button;
this.mContext = ctx;
this.close = close;
}
@Override
public void onFinish() {
mButton.setTextColor(Color.parseColor("#EED685"));
mButton.setVisibility(View.GONE);
close.setVisibility(View.VISIBLE);
mButton.setEnabled(true);
cancel();
}
@Override
public void onTick(long arg0) {
mButton.setTextColor(Color.parseColor("#EED685"));
mButton.setText(((arg0/1000)+1)+"");
mButton.setEnabled(false);
}
}
package com.ym.library.utils
import android.content.Context
import android.text.Html
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
import android.widget.Toast
import com.ym.library.R
import com.ym.modulecommon.AppliContext
/**
* Created by erwin on 2020/11/5
*
*/
object ToastUtils {
/**
* 弹出文字
*/
fun showTextToast(s: String) {
val context: Context = AppliContext.get()
val view: View = LayoutInflater.from(context).inflate(R.layout.toast_text_layout, null)
val title: TextView = view.findViewById(R.id.toast_tv) as TextView
title.setText(s)
showToast(context, view)
}
private fun showToast(context: Context, view: View) {
val toast = Toast(context)
toast.setGravity(Gravity.CENTER_HORIZONTAL or Gravity.CENTER, 0, 0)
toast.setDuration(Toast.LENGTH_LONG)
toast.setView(view)
toast.show()
}
}
\ No newline at end of file
package com.ym.library.utils
import com.ym.library.MyConstant
/**
* Created by erwin on 2020/11/23
*
*/
object VideoNumberUtils {
fun setVideoNumber(){
MyConstant.videoNumber = MyConstant.videoNumber+1
if (MyConstant.videoNumber < MyConstant.videoCount) {
//ToastUtils.showTextToast("再观看${(MyConstant.videoCount - MyConstant.videoNumber)}个视频即可完成今日打卡")
}
}
}
\ No newline at end of file
package com.ym.library.utils
import com.ym.library.MyConstant
/**
* Created by erwin on 2020/11/20
*
* 视频20秒才能观看的utils
*
*/
object VideoTimeUtils {
fun isCanShowReward():Boolean{
return true
// if(System.currentTimeMillis()- Constant.videoTime< Constant.videoTimeOut){
// Toast.makeText(
// AppliContext.get(),"${(Constant.videoTimeOut-(System.currentTimeMillis()- Constant.videoTime))/1000}秒后再来领取吧",
// Toast.LENGTH_SHORT).show()
// }else{
// return true
// }
// return false
}
fun setVideoTime() {
MyConstant.videoTime = System.currentTimeMillis()
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="10dp" />
<stroke android:color="#fae18a" android:width="5dp"/>
<solid android:color="@color/white"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="10dp"/>
<solid android:color="#80000000"/>
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="@+id/ad_framelayout"
android:layout_below="@+id/rl_content"
android:layout_margin="10dp"
android:padding="8dp"
android:background="@drawable/shape_ad_r10"
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="260dp"
xmlns:android="http://schemas.android.com/apk/res/android" />
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:layout_width="50dp"
android:layout_marginRight="6dp"
android:layout_alignParentRight="true"
android:layout_height="50dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:textSize="18sp"
android:text="3"
android:gravity="center"
android:layout_centerInParent="true"
android:textColor="@color/white"
android:visibility="gone"
android:background="@drawable/close_text_button"
android:layout_width="30dp"
android:id="@+id/id_tv_close_button"
android:layout_height="30dp"/>
<ImageView
android:id="@+id/id_iv_dismiss"
android:layout_width="wrap_content"
android:visibility="visible"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:src="@drawable/icon_dialog_home_dismiss"
/>
</RelativeLayout>
\ No newline at end of file
<?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">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<RelativeLayout
android:layout_width="289dp"
android:layout_height="289dp"
android:layout_centerInParent="true"
android:background="@drawable/bg_dialog_home_style_1">
<TextView
android:id="@+id/id_tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"
android:textColor="#ffa26a3b"
android:textSize="20sp"
android:textStyle="bold" />
<include layout="@layout/dialog_close_style" />
<!--0 助力-->
<LinearLayout
android:id="@+id/id_ll_help"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:id="@+id/iv_pig_upgrade"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:src="@drawable/icon_dialog_god" />
<TextView
android:id="@+id/id_tv_time_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp"
android:layout_marginBottom="14dp"
android:text="5分钟"
android:textColor="#ffa26a3b"
android:textSize="18sp" />
<ImageView
android:id="@+id/id_iv_btn_0"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog_home_ok" />
</LinearLayout>
<!--1 猪猪卡-->
<LinearLayout
android:id="@+id/id_ll_pig_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:src="@drawable/icon_dialog_home_pig_card" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:text="刮卡最高得万元现金"
android:textColor="#ffa26a3b"
android:textSize="18sp" />
<ImageView
android:id="@+id/id_iv_btn_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog_home_try" />
</LinearLayout>
<!--2 升级奖励-->
<LinearLayout
android:id="@+id/id_ll_upgrade"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="-20dp">
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0.3元"
android:textColor="#ffa26a3b"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="秒到账"
android:textColor="#f73737"
android:textSize="18sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="红包"
android:textColor="#ffa26a3b"
android:textSize="18sp" />
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_dialog_home_red_paper" />
<TextView
android:id="@+id/tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android:text="0.3"
android:textColor="@color/white"
android:textSize="18sp" />
</RelativeLayout>
<ImageView
android:id="@+id/iv_ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-20dp"
android:layout_marginBottom="8dp"
android:background="@drawable/bg_dialog_home_ok" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="奖励已发送到您的微信"
android:textColor="#ffa26a3b"
android:textSize="15sp" />
</LinearLayout>
<!--3 恭喜获得 按钮奖励翻倍 和 开心收下 两种状态-->
<LinearLayout
android:id="@+id/id_ll_congratulations"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="22dp"
android:layout_marginBottom="20dp"
android:src="@drawable/icon_dialog_home_gold" />
<TextView
android:id="@+id/id_tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="0金币币"
android:textColor="#ffa26a3b"
android:textSize="20sp" />
<ImageView
android:id="@+id/id_iv_double"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog_home_double" />
</LinearLayout>
<!--4 好友-->
<LinearLayout
android:id="@+id/id_ll_friend"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:id="@+id/id_iv_avatar_4"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="45dp"
android:src="@drawable/icon_dialog_home_friend_avatar" />
<TextView
android:id="@+id/id_iv_name_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:text="名字"
android:textColor="#ffa26a3b"
android:textSize="20sp" />
<TextView
android:id="@+id/id_tv_time_4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余00:00:00"
android:textColor="#ffa26a3b"
android:textSize="15sp" />
</LinearLayout>
<!--5 删除-->
<LinearLayout
android:id="@+id/id_ll_delete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:src="@drawable/icon_dialog_god" />
<ImageView
android:id="@+id/id_iv_delete"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_dialog_home_delete" />
<TextView
android:id="@+id/id_tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="剩余03:30:19"
android:textColor="#ffa26a3b"
android:textSize="15sp" />
</LinearLayout>
<!--6 幸运转盘规则-->
<LinearLayout
android:id="@+id/id_ll_rule"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="猪财神规则"
android:textColor="#ffd14d25"
android:textSize="15sp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="28dp"
android:layout_marginTop="10dp"
android:layout_marginRight="28dp"
android:layout_marginBottom="10dp"
android:text="1、每次转转盘都可100%获得奖励\n2、抽取的猪财神会在其描述的时间内为你加速获取金币\n3、无限期猪财神视作一个真人,可以一起参与猪猪大抽奖\n4、每10分钟生成一次转转盘机会,需看一个视频来启动转盘"
android:textColor="#ffa26a3b"
android:textSize="13sp" />
<ImageView
android:id="@+id/id_iv_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bg_dialog_btn_confirm" />
</LinearLayout>
<!--7 梦想成真-->
<LinearLayout
android:id="@+id/id_ll_dream"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:gravity="center_horizontal"
android:orientation="vertical"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="86dp"
android:layout_marginTop="30dp"
android:layout_marginBottom="15dp"
android:src="@drawable/flay_heart" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="你来许愿,帮你买单!"
android:textColor="#ffa26a3b"
android:textSize="17sp" />
<ImageView
android:id="@+id/id_iv_to_wish"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bg_to_wish" />
</LinearLayout>
</RelativeLayout>
<include layout="@layout/ad_layout_framelayout" />
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<?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">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:gravity="center"
android:layout_centerInParent="true"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="289dp"
android:layout_height="288dp"
android:id="@+id/rl_content"
android:background="@drawable/bg_dialog_home_style_1"
android:layout_centerInParent="true">
<TextView
android:id="@+id/id_tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffa26a3b"
android:textSize="20sp"
android:text="恭喜获得"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:layout_marginTop="14dp"/>
<include layout="@layout/dialog_close_style"/>
<LinearLayout
android:id="@+id/id_ll_congratulations"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:orientation="vertical"
android:gravity="center_horizontal"
android:visibility="gone">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_dialog_home_gold"
android:layout_marginBottom="20dp"
android:layout_marginTop="22dp"/>
<TextView
android:id="@+id/id_tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0金币"
android:textColor="#ffa26a3b"
android:textSize="20sp"
android:layout_marginBottom="15dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_below="@+id/id_tv_title"
android:layout_marginTop="45dp"
android:visibility="gone"
android:id="@+id/ll_big_money"
android:gravity="center_horizontal"
android:layout_centerHorizontal="true"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/heart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/tv_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3个心愿值"
android:textColor="#ffa26a3b"
android:layout_marginTop="20dp"
android:textSize="20sp"
/>
</LinearLayout>
<!--2 升级奖励-->
<LinearLayout
android:id="@+id/id_ll_upgrade"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="54dp"
android:orientation="vertical"
android:gravity="center_horizontal"
android:visibility="gone">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="-20dp"
android:layout_marginTop="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="0.3元"
android:id="@+id/tv_red_title"
android:textColor="#ffa26a3b"
android:textSize="18sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="秒到账"
android:textColor="#f73737"
android:textSize="18sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="红包"
android:textColor="#ffa26a3b"
android:textSize="18sp"/>
</LinearLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon_dialog_home_red_paper"/>
<TextView
android:layout_centerHorizontal="true"
android:text="0.3"
android:id="@+id/tv_red_number"
android:textColor="@color/white"
android:textSize="18sp"
android:layout_marginTop="50dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/iv_red_ok"
android:background="@drawable/bg_dialog_home_ok"
android:layout_marginTop="-20dp"
android:layout_marginBottom="8dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="奖励已发送到您的微信"
android:textColor="#ffa26a3b"
android:textSize="15sp"/>
</LinearLayout>
<ImageView
android:layout_marginTop="17dp"
android:id="@+id/iv_ok"
android:visibility="gone"
android:layout_marginBottom="20dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:src="@drawable/bg_dialog_home_accept"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
<include layout="@layout/ad_layout_framelayout"
/>
</LinearLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="26dp"
android:paddingTop="22dp"
android:gravity="center"
android:id="@+id/toast_tv"
android:background="@drawable/toast_bg"
android:paddingBottom="28dp"
android:paddingRight="26dp"
android:text="再观看x个视频即可完成今日打卡"
android:textColor="#ffffffff"
android:textSize="18sp"
/>
</LinearLayout>
\ 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