Commit 154bb8a9 authored by mengcuiguang's avatar mengcuiguang

添加视频逻辑,界面调整,解决冲突

parent fde0f721
......@@ -107,8 +107,8 @@ android {
}
productFlavors {
// goodmoneypkg {}
share_goodmoney {}
goodmoneypkg {}
// share_goodmoney {}
}
productFlavors.all {
......
......@@ -281,17 +281,6 @@
android:name="com.qq.e.ads.LandscapeADActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="landscape" />
<!-- 变现猫 -->
<!-- <provider-->
<!-- android:name="android.support.v4.content.FileProvider"-->
<!-- android:authorities="${applicationId}.fileprovider"-->
<!-- android:exported="false"-->
<!-- android:grantUriPermissions="true">-->
<!-- <meta-data-->
<!-- android:name="android.support.FILE_PROVIDER_PATHS"-->
<!-- android:resource="@xml/new_app_file_paths" />-->
<!-- </provider>-->
</application>
</manifest>
\ No newline at end of file
......@@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.text.TextUtils;
import android.webkit.WebView;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.multidex.MultiDex;
......@@ -85,12 +86,12 @@ public class MintsApplication extends MultiDexApplication {
initMiitHelper();
//Android 9 or above must be set
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
// String processName = getProcessName();
// if (!getPackageName().equals(processName)) {
// WebView.setDataDirectorySuffix(processName);
// }
// }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
String processName = getProcessName();
if (!getPackageName().equals(processName)) {
WebView.setDataDirectorySuffix(processName);
}
}
// 子线程初始化三方SDK
String processName = SystemUtils.INSTANCE.getProcessName(this, android.os.Process.myPid());
......
package com.mints.goodmoney.ad.video
import android.app.Activity
import android.content.DialogInterface
import android.text.TextUtils
import android.view.KeyEvent
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.mvp.views.BaseView
import com.mints.goodmoney.ui.widgets.LoadingDialog
import com.mints.goodmoney.utils.ToastUtil
open class BaseVideoAd(activity: Activity) : BaseView {
var activity: Activity
var progressDialog: LoadingDialog? = null
init {
this.activity = activity
}
override fun getBaseApplication(): MintsApplication {
return activity.getApplication() as MintsApplication
}
/**
* 显示加载进度条(自定义message)
*
* @param message
*/
override fun showLoading(message: String?) {
if (activity.getWindow() != null && !activity.isFinishing()) {
if (progressDialog == null) {
progressDialog = LoadingDialog(activity)
progressDialog!!.setLoadText(message)
}
progressDialog?.show()
setProgressOnTouchOutside(false)
setProgressNoDismiss()
}
}
/**
* 设置Progress是否手触消失
*
* @param onTouchOutside
*/
open fun setProgressOnTouchOutside(onTouchOutside: Boolean) {
if (progressDialog != null) progressDialog!!.setCanceledOnTouchOutside(onTouchOutside)
}
/**
* 设置点击返回是否消失加载进度条
*/
fun setProgressNoDismiss() {
if (progressDialog != null && progressDialog!!.isShowing()) {
progressDialog!!.setOnKeyListener(DialogInterface.OnKeyListener { dialog, keyCode, event ->
if (keyCode == KeyEvent.KEYCODE_BACK) {
true
} else false
})
}
}
/**
* 消失加载进度条
*/
override fun hideLoading() {
try {
if (activity.getWindow() != null && !activity.isFinishing()) {
if (progressDialog != null && progressDialog!!.isShowing()) {
progressDialog!!.dismiss()
progressDialog = null
}
}
} catch (e: Exception) {
e.printStackTrace()
} finally {
progressDialog = null
}
}
override fun showToast(msg: String?) {
if (!TextUtils.isEmpty(msg)) ToastUtil.show(MintsApplication.getContext(), msg)
}
open fun loadAd(activity: Activity, curCoin: Int, carrierType: String, extraId: String){}
open fun onDestory(){}
}
\ No newline at end of file
package com.mints.goodmoney.ad.video;
import android.app.Activity;
import android.content.DialogInterface;
import android.text.TextUtils;
import android.view.KeyEvent;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.bytedance.sdk.openadsdk.TTAdConstant;
import com.bytedance.sdk.openadsdk.TTAdNative;
import com.bytedance.sdk.openadsdk.TTRewardVideoAd;
import com.mints.goodmoney.BuildConfig;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TTNativeExpressManager;
import com.mints.goodmoney.manager.TrackManager;
......@@ -18,11 +14,9 @@ import com.mints.goodmoney.manager.TtCsjAdManager;
import com.mints.goodmoney.manager.UserManager;
import com.mints.goodmoney.mvp.presenters.CsjVedioAdPresenter;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.ui.widgets.LoadingDialog;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.MD5;
import com.mints.goodmoney.utils.SPUtil;
import com.mints.goodmoney.utils.ToastUtil;
import com.mints.library.utils.json.JsonUtil;
import java.util.HashMap;
......@@ -30,7 +24,7 @@ import java.util.HashMap;
/**
* 穿山甲激励视频广告
*/
public class CsjVedioAdManager implements VedioAdManagerView {
public class CsjVedioAdManager extends BaseVideoAd {
private static CsjVedioAdManager _inst;
private SPUtil spUtil;
......@@ -42,7 +36,6 @@ public class CsjVedioAdManager implements VedioAdManagerView {
Activity activity;
private TTAdNative ttAdNative;
private TTRewardVideoAd mttRewardVideoAd;
protected LoadingDialog progressDialog;
private UserManager userManager;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
......@@ -57,6 +50,7 @@ public class CsjVedioAdManager implements VedioAdManagerView {
}
private CsjVedioAdManager(Activity activity) {
super(activity);
init(activity);
return;
}
......@@ -69,19 +63,20 @@ public class CsjVedioAdManager implements VedioAdManagerView {
TTNativeExpressManager ttNativeExpressManager = new TTNativeExpressManager();
ttAdNative = ttNativeExpressManager.initTTAd(false);
csjVedioAdPresenter = new CsjVedioAdPresenter();
csjVedioAdPresenter.attachView(this);
// csjVedioAdPresenter = new CsjVedioAdPresenter();
// csjVedioAdPresenter.attachView(this);
}
public void destory() {
@Override
public void onDestory() {
if (mttRewardVideoAd != null) {
mttRewardVideoAd.setRewardAdInteractionListener(null);
}
if (csjVedioAdPresenter != null) {
csjVedioAdPresenter.dispose();
csjVedioAdPresenter.detachView();
}
// if (csjVedioAdPresenter != null) {
// csjVedioAdPresenter.dispose();
// csjVedioAdPresenter.detachView();
// }
activity = null;
}
......@@ -91,7 +86,8 @@ public class CsjVedioAdManager implements VedioAdManagerView {
*
* @param carrierType
*/
public void loadCsjAd(Activity activity,int curCoin, String carrierType, String extraId) {
@Override
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity;
isClickScreen = true;
this.curCoin = curCoin;
......@@ -145,7 +141,7 @@ public class CsjVedioAdManager implements VedioAdManagerView {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_ONE, String.valueOf(code), message);
LogUtil.d("CsjVedioAdManager","onError "+code +message);
LogUtil.d("CsjVedioAdManager", "onError " + code + message);
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdFail();
}
......@@ -225,13 +221,6 @@ public class CsjVedioAdManager implements VedioAdManagerView {
});
}
@Override
public void checkSuc(boolean lyCmtFlag) {
if (csjVedioAdListener != null) {
csjVedioAdListener.csjVedioAdSuccess();
}
}
/**
* 封装广告数据,请求服务器
*
......@@ -266,88 +255,10 @@ public class CsjVedioAdManager implements VedioAdManagerView {
return vo;
}
@Override
public MintsApplication getBaseApplication() {
return (MintsApplication) activity.getApplication();
}
/**
* 显示加载进度条(自定义message)
*
* @param message
*/
@Override
public void showLoading(String message) {
if (activity.getWindow() != null && !activity.isFinishing()) {
if (progressDialog == null) {
progressDialog = new LoadingDialog(activity);
progressDialog.setLoadText(message);
}
progressDialog.show();
setProgressOnTouchOutside(false);
setProgressNoDismiss();
}
}
/**
* 设置Progress是否手触消失
*
* @param onTouchOutside
*/
public void setProgressOnTouchOutside(boolean onTouchOutside) {
if (progressDialog != null)
progressDialog.setCanceledOnTouchOutside(onTouchOutside);
}
/**
* 设置点击返回是否消失加载进度条
*/
public final void setProgressNoDismiss() {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return false;
}
});
}
}
/**
* 消失加载进度条
*/
@Override
public void hideLoading() {
try {
if (activity.getWindow() != null && !activity.isFinishing()) {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
progressDialog = null;
}
}
@Override
public void showToast(String msg) {
if (!TextUtils.isEmpty(msg))
ToastUtil.show(MintsApplication.getContext(), msg);
}
public void setCsjVedioAdListener(CsjVedioAdListener csjVedioAdListener) {
this.csjVedioAdListener = csjVedioAdListener;
}
public interface CsjVedioAdListener {
void csjVedioAdFail();
......
......@@ -189,12 +189,12 @@ public class VedioAdingManager {
public void onDestory() {
if (csjVedioAdManager != null) {
csjVedioAdManager.setCsjVedioAdListener(null);
csjVedioAdManager.destory();
csjVedioAdManager.onDestory();
csjVedioAdManager = null;
}
if (ylhVedioAdManager != null) {
ylhVedioAdManager.setYlhVedioAdListener(null);
ylhVedioAdManager.destory();
ylhVedioAdManager.onDestory();
ylhVedioAdManager = null;
}
......@@ -210,7 +210,9 @@ public class VedioAdingManager {
*/
public interface VedioAdingListener {
void vedioAdingListenerError(String adType);
void vedioAdingListenerFail(String adType);
void vedioAdingListenerSuccess(String adType);
}
......@@ -255,7 +257,7 @@ public class VedioAdingManager {
isVedioAdDownload = true;
}
});
ylhVedioAdManager.loanYlhAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
ylhVedioAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
} else if (TextUtils.equals(vedioAdType, Constant.CSJ_VEDIO_AD)) {
// 穿山甲激励视频
if (csjVedioAdManager == null) {
......@@ -290,7 +292,7 @@ public class VedioAdingManager {
isVedioAdDownload = true;
}
});
csjVedioAdManager.loadCsjAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
csjVedioAdManager.loadAd(activity, bean.getCurCoin(), bean.getCarrierType(), bean.getExtraId());
}
} catch (Exception e) {
e.printStackTrace();
......
package com.mints.goodmoney.ad.video;
import android.app.Activity;
import android.content.DialogInterface;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.KeyEvent;
import com.mints.goodmoney.MintsApplication;
import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.manager.TrackManager;
import com.mints.goodmoney.manager.YlhAdManager;
import com.mints.goodmoney.mvp.presenters.YlhVedioAdPresenter;
import com.mints.goodmoney.mvp.views.VedioAdManagerView;
import com.mints.goodmoney.ui.widgets.LoadingDialog;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.ToastUtil;
import com.qq.e.ads.rewardvideo.RewardVideoAD;
import com.qq.e.ads.rewardvideo.RewardVideoADListener;
import com.qq.e.comm.util.AdError;
......@@ -24,7 +18,7 @@ import java.util.HashMap;
/**
* 优量汇视频
*/
public class YlhVedioAdManager implements VedioAdManagerView {
public class YlhVedioAdManager extends BaseVideoAd implements VedioAdManagerView {
private static YlhVedioAdManager _inst;
......@@ -38,8 +32,6 @@ public class YlhVedioAdManager implements VedioAdManagerView {
Activity activity;
protected LoadingDialog progressDialog;
private boolean isClickScreen = true; // 是否点击屏幕跳转广告
public static YlhVedioAdManager getInstance(Activity activity) {
......@@ -52,6 +44,7 @@ public class YlhVedioAdManager implements VedioAdManagerView {
}
private YlhVedioAdManager(Activity activity) {
super(activity);
init(activity);
return;
}
......@@ -63,7 +56,8 @@ public class YlhVedioAdManager implements VedioAdManagerView {
ylhVedioAdPresenter.attachView(this);
}
public void destory() {
@Override
public void onDestory() {
if (ylhVedioAdPresenter != null) {
ylhVedioAdPresenter.dispose();
ylhVedioAdPresenter.detachView();
......@@ -75,7 +69,8 @@ public class YlhVedioAdManager implements VedioAdManagerView {
/**
* 加载优量汇激励视频
*/
public void loanYlhAd(Activity activity, int curCoin, String carrierType, String extraId) {
@Override
public void loadAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = activity;
isClickScreen = true;
this.curCoin = curCoin;
......@@ -203,10 +198,6 @@ public class YlhVedioAdManager implements VedioAdManagerView {
rewardVideoAD.loadAD();
}
@Override
public void checkSuc(boolean lyCmtFlag) {
}
/**
* 第四步 封装广告数据,请求服务器
*
......@@ -236,83 +227,6 @@ public class YlhVedioAdManager implements VedioAdManagerView {
return vo;
}
@Override
public MintsApplication getBaseApplication() {
return (MintsApplication) activity.getApplication();
}
/**
* 显示加载进度条(自定义message)
*
* @param message
*/
@Override
public void showLoading(String message) {
if (activity.getWindow() != null && !activity.isFinishing()) {
if (progressDialog == null) {
progressDialog = new LoadingDialog(activity);
progressDialog.setLoadText(message);
}
progressDialog.show();
setProgressOnTouchOutside(false);
setProgressNoDismiss();
}
}
/**
* 设置Progress是否手触消失
*
* @param onTouchOutside
*/
public void setProgressOnTouchOutside(boolean onTouchOutside) {
if (progressDialog != null)
progressDialog.setCanceledOnTouchOutside(onTouchOutside);
}
/**
* 设置点击返回是否消失加载进度条
*/
public final void setProgressNoDismiss() {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
}
return false;
}
});
}
}
/**
* 消失加载进度条
*/
@Override
public void hideLoading() {
try {
if (activity.getWindow() != null && !activity.isFinishing()) {
if (progressDialog != null && progressDialog.isShowing()) {
progressDialog.dismiss();
progressDialog = null;
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
progressDialog = null;
}
}
@Override
public void showToast(String msg) {
if (!TextUtils.isEmpty(msg))
ToastUtil.show(MintsApplication.getContext(), msg);
}
public void setYlhVedioAdListener(YlhVedioAdListener ylhVedioAdListener) {
this.ylhVedioAdListener = ylhVedioAdListener;
}
......
......@@ -99,6 +99,10 @@ object Constant {
const val CARRIER_GAME_ONLINE = "GAME_ONLINE" //跳转猎豹
const val CARRIER_ZHANGYUE = "ZHANGYUE" //阅读书城
const val CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE = "CHALLENGE_SHAREFRIEND_DOUBLE" //邀请好友翻倍
const val CARRIER_HOMEVEDIO = "HOMEVEDIO" //首页红包
const val CARRIER_HOMEVEDIO_DOUBLE = "HOMEVEDIO_DOUBLE" //首页红包翻倍
const val CARRIER_SMALLHOMEVEDIO = "SMALLHOMEVEDIO" //首页红包
const val CARRIER_SMALLHOMEVEDIO_DOUBLE = "SMALLHOMEVEDIO_DOUBLE" //首页红包翻倍
const val SHAREFRIEND_COMPLETE_1 = "SHAREFRIEND_COMPLETE_1" //邀请任务1
const val SHAREFRIEND_COMPLETE_2 = "SHAREFRIEND_COMPLETE_2" //邀请任务2
......
......@@ -40,10 +40,14 @@ object BxmManager {
fun loadButtonAd(activity: Activity?, viewGroup: ViewGroup) {
if (activity == null) return
if (bdAdvanceButtonAd == null) {
bdAdvanceButtonAd = BDAdvanceButtonAd(activity, viewGroup, BUTTON_AD_SPOT_ID)
try {
if (bdAdvanceButtonAd == null) {
bdAdvanceButtonAd = BDAdvanceButtonAd(activity, viewGroup, BUTTON_AD_SPOT_ID)
}
bdAdvanceButtonAd?.loadAd()
} catch (e: Exception) {
e.printStackTrace()
}
bdAdvanceButtonAd?.loadAd()
}
fun onDestory() {
......
......@@ -5,20 +5,20 @@ import java.io.Serializable;
public class MainVedioMsgBean implements Serializable {
private boolean toCreateReward;
private int bigRewardCoin;
private int smallRewardCoin;
private int rewardDoubleCoin;
private int rewardCoin;
private int createRewardNeedTime;
public boolean isToCreateReward() {
return toCreateReward;
}
public int getBigRewardCoin() {
return bigRewardCoin;
public int getRewardDoubleCoin() {
return rewardDoubleCoin;
}
public int getSmallRewardCoin() {
return smallRewardCoin;
public int getRewardCoin() {
return rewardCoin;
}
public int getCreateRewardNeedTime() {
......
......@@ -117,28 +117,6 @@ class HomePresenter : BasePresenter<HomeView>() {
})
}
fun requestAddHomeVedioReward() {
AppHttpManager.getInstance(loanApplication)
.call(loanService.requestAddHomeVedioReward(),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
val code = baseResponse.getStatus()
when (code) {
200 -> getHomeVedioMsg()
}
}
})
}
/**
* 游客登录
*/
......
......@@ -2,5 +2,4 @@ package com.mints.goodmoney.mvp.views;
public interface VedioAdManagerView extends BaseView {
void checkSuc(boolean lyCmtFlag);
}
......@@ -310,17 +310,9 @@ public interface LoanService {
*
* @return
*/
@POST("api/getHomeVedioMsg")
@POST("api/getHomeVedioBaseMsg")
Observable<BaseResponse<MainVedioMsgBean>> getHomeVedioMsg();
/**
* 请求红包
*
* @return
*/
@POST("api/requestAddHomeVedioReward")
Observable<BaseResponse<Object>> requestAddHomeVedioReward();
/**
* 阅读时长
*
......
......@@ -33,7 +33,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
private var curCoin = 0 //传入金币
private var extraId = ""//传入key
private var carrierType = ""//传入载体
private var loadVedioFailCount = 0
private var loadVedioFailCount = 0 // 视频失败次数
override fun getContentViewLayoutID() = R.layout.activity_award
......@@ -66,11 +66,10 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
startTime()
when (carrierType) {
Constant.CHALLENGE_SHAREFRIEND,
Constant.SHAREFRIEND_COMPLETE_1, Constant.SHAREFRIEND_COMPLETE_2,
Constant.SHAREFRIEND_COMPLETE_3, Constant.SHAREFRIEND_COMPLETE_4,
Constant.SHAREFRIEND_COMPLETE_5, Constant.SHAREFRIEND_COMPLETE_6,
Constant.CARRIER_HOMEVEDIO_SMALL, Constant.CARRIER_GAME_ONLINE -> {
Constant.CARRIER_GAME_ONLINE -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
......@@ -78,16 +77,26 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardNext.setText("我知道了")
}
// Constant.CHALLENGE_SHAREFRIEND -> {
// val vo = HashMap<String, Any>()
// vo["carrierType"] = carrierType
// awardPresenter.reportAddCoinMsg(vo)
//
// tvAwardContent.setText(curCoin.toString() + "金币已到账")
// tvAwardNext.setText("金币翻倍")
//
// carrierType = Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE
// }
Constant.CARRIER_HOMEVEDIO -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardNext.setText("看视频赚${extraId}金币")
carrierType = Constant.CARRIER_HOMEVEDIO_DOUBLE
}
Constant.CHALLENGE_SHAREFRIEND -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
tvAwardContent.setText(curCoin.toString() + "金币已到账")
tvAwardNext.setText("金币翻倍")
carrierType = Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE
}
Constant.CARRIER_NEW_USER -> {
tvAwardContent.setText("新人红包")
tvAwardNext.setText("我知道了")
......@@ -112,8 +121,14 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
}
tvAwardNext.setText("我知道了")
}
Constant.CARRIER_SIGNIN_HOMEPAGE_CARD,
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_WALK_BUBBLE,
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER -> {
tvAwardContent.setText("看视频领取" + curCoin + "金币")
}
else -> {
tvAwardContent.setText("点击领取" + curCoin + "金币")
tvAwardContent.setText(curCoin.toString() + "金币已到账")
}
}
}
......@@ -171,10 +186,11 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
R.id.tvAwardNext -> {
when (carrierType) {
// 只有看视频才能领金币
Constant.CARRIER_CHALLENGE_SHAREFRIEND_DOUBLE,
Constant.CARRIER_OFFLINE_DOUBLE, Constant.CARRIER_SIGNIN_HOMEPAGE_CARD,
Constant.CARRIER_CHALLENGE_TURN, Constant.CARRIER_CHALLENGE_CARD,
Constant.CARRIER_WALK_BUBBLE,Constant.CARRIER_HOMEVEDIO_BIG,
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER-> {
Constant.CARRIER_WALK_BUBBLE, Constant.CARRIER_HOMEVEDIO_DOUBLE,
Constant.CARRIER_WALK, Constant.CARRIER_HOMEWATER -> {
awardVedio()
}
else -> {
......
......@@ -24,7 +24,7 @@ class CoinRecordActivity : BaseActivity(), View.OnClickListener, OnRefreshListen
override fun getContentViewLayoutID() = R.layout.activity_drawcash_record
override fun initViewsAndEvents() {
tv_title.text = "金币记录"
tv_title.text = "金币明细"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
iv_left_icon.setOnClickListener(this)
......
......@@ -90,7 +90,7 @@ class DrawcashActivity : BaseActivity(),
readyGo(DrawcashRecordActivity::class.java)
}
R.id.rl_coin -> {
readyGo(CoinRecordActivity::class.java)
// readyGo(CoinRecordActivity::class.java)
}
R.id.tvDrawcashWx -> {
if (!TextUtils.isEmpty(userConfig?.openid)) {
......
......@@ -22,9 +22,7 @@ import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.PowerDialog
import com.mints.goodmoney.utils.LogUtil
import com.yilan.sdk.player.ylplayer.YLPlayerConfig
import com.yilan.sdk.player.ylplayer.callback.OnPlayerCallBack
import com.yilan.sdk.ui.little.YLLittleVideoFragment
import com.yilan.sdk.ui.littlevideo.LittleVideoFragment
import kotlinx.android.synthetic.main.fragment_main_first.*
import net.grandcentrix.tray.AppPreferences
......@@ -43,9 +41,9 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
private var powerDialog: PowerDialog? = null
// 视频相关
private var bigRewardCoin = 0 // 大红包
private var smallRewardCoin = 0 // 小红包
private var littleVideoFragment: YLLittleVideoFragment? = null
private var rewardDoubleCoin = 0 // 大金币
private var rewardCoin = 0 // 小金币
private var littleVideoFragment: LittleVideoFragment? = null
private val VEDIO_MAX_COUNT = 12 // 当前缓存视频id最大数
private val vedioIdList by lazy { ArrayList<String>() }//记录播放的视频id
private var isFirstLoadVedio = true // 首次加载视频初始化
......@@ -76,7 +74,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
private fun initListener() {
ivMainBox.setOnClickListener(this)
cdvvYilanTime.setOnClickListener(this)
}
......@@ -133,8 +130,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
super.onDestroy()
cdvvYilanTime?.setCountDownVedioListener(null)
// littleVideoFragment?.setUserCallBack(null)
YLPlayerConfig.config().unRegisterPlayerCallback()
littleVideoFragment?.setUserCallBack(null)
// YLPlayerConfig.config().unRegisterPlayerCallback()
homePresenter.detachView()
}
......@@ -174,8 +171,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
}
override fun getHallBaseMsgFail() {
smallRewardCoin = 0
bigRewardCoin = 0
rewardCoin = 0
rewardDoubleCoin = 0
}
override fun getHomeVedioMsgSuc(data: MainVedioMsgBean) {
......@@ -185,10 +182,8 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
ps.put(Constant.MAIN_VEDIO_TIME, data.createRewardNeedTime)
smallRewardCoin = data.smallRewardCoin
bigRewardCoin = data.bigRewardCoin
ivMainBox.visibility = if (bigRewardCoin > 0) View.VISIBLE else View.GONE
rewardCoin = data.rewardCoin
rewardDoubleCoin = data.rewardDoubleCoin
if (data.isToCreateReward) {
// 防止界面切换 重置倒计时
......@@ -204,17 +199,12 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
override fun onClick(v: View) {
when (v.id) {
R.id.ivMainBox -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, bigRewardCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HOMEVEDIO_BIG)
readyGo(AwardActivity::class.java, bundle)
}
R.id.cdvvYilanTime -> {
if (smallRewardCoin > 0) {
if (rewardCoin > 0) {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, smallRewardCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HOMEVEDIO_SMALL)
bundle.putInt(Constant.MAIN_CUR_COIN, rewardCoin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HOMEVEDIO)
bundle.putString(Constant.MAIN_EXTRA_ID, rewardDoubleCoin.toString())
readyGo(AwardActivity::class.java, bundle)
}
}
......@@ -231,92 +221,92 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
* 一览视频初始化
*/
private fun showLittle() {
val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
if (littleVideoFragment == null) {
littleVideoFragment = YLLittleVideoFragment.newInstance()
transaction.add(R.id.yilan_fragment_frame_container, littleVideoFragment!!, YLLittleVideoFragment::class.java.simpleName)
// 设置点击的item播放状态,callback返回true标识用户已经处理了event,返回false,标识使用播放器内部逻辑处理event。
YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
override fun onStart(p0: String?, videoid: String, p2: String?) {
// 防止网络异常时, 第一次加载倒计时红包
if (isFirstLoadVedio) {
isFirstLoadVedio = false
initTimeview()
}
vedioId = videoid
}
override fun onPause(p0: String?, p1: String?, p2: String?) {
pauseDownloadTime()
}
override fun onResume(p0: String?, videoid: String, p2: String?) {
resumeDownloadTime(videoid)
}
override fun onComplete(p0: String?, videoid: String, p2: String?) {
addVedioIdList(videoid)
pauseDownloadTime()
}
override fun onLoopComplete(p0: String?, p1: String, p2: String?, p3: Int) {
}
override fun onStuckStart(p0: String?, p1: String?, p2: String?) {
}
override fun onStuckEnd(p0: String?, p1: String?, p2: String?) {
}
override fun onError(p0: String?, p1: String?, p2: String?) {
pauseDownloadTime()
}
override fun onStop(p0: String?, p1: String?, p2: String?) {
}
})
// littleVideoFragment!!.setUserCallBack { type, data, _ -> //播放状态 type
// //播放的数据,可能为null data
// //哪个播放器ß playerHash
// when (type) {
// com.yilan.sdk.player.utils.Constant.STATE_PREPARED -> {
// // 防止网络异常时, 第一次加载倒计时红包
// if (isFirstLoadVedio) {
// isFirstLoadVedio = false
// initTimeview()
// }
// val transaction: FragmentTransaction = supportFragmentManager.beginTransaction()
// if (littleVideoFragment == null) {
// littleVideoFragment = YLLittleVideoFragment.newInstance()
// transaction.add(R.id.yilan_fragment_frame_container, littleVideoFragment!!, YLLittleVideoFragment::class.java.simpleName)
// // 设置点击的item播放状态,callback返回true标识用户已经处理了event,返回false,标识使用播放器内部逻辑处理event。
//
// vedioId = data.videoId
// }
// com.yilan.sdk.player.utils.Constant.STATE_ERROR -> {
// YLPlayerConfig.config().registerPlayerCallBack(object : OnPlayerCallBack {
//
// pauseDownloadTime()
// override fun onStart(p0: String?, videoid: String, p2: String?) {
// // 防止网络异常时, 第一次加载倒计时红包
// if (isFirstLoadVedio) {
// isFirstLoadVedio = false
// initTimeview()
// }
// com.yilan.sdk.player.utils.Constant.STATE_PLAYING -> {
//
// resumeDownloadTime(data.videoId)
// }
// vedioId = videoid
// }
//
// com.yilan.sdk.player.utils.Constant.STATE_COMPLETE -> {
// override fun onPause(p0: String?, p1: String?, p2: String?) {
// pauseDownloadTime()
// }
//
// addVedioIdList(data.videoId)
// pauseDownloadTime()
// }
// com.yilan.sdk.player.utils.Constant.STATE_PAUSED -> {
// override fun onResume(p0: String?, videoid: String, p2: String?) {
// resumeDownloadTime(videoid)
// }
//
// pauseDownloadTime()
// }
// override fun onComplete(p0: String?, videoid: String, p2: String?) {
// addVedioIdList(videoid)
// pauseDownloadTime()
// }
// false
// }
} else {
transaction.show(littleVideoFragment!!)
}
transaction.commitAllowingStateLoss()
//
// override fun onLoopComplete(p0: String?, p1: String, p2: String?, p3: Int) {
// }
//
// override fun onStuckStart(p0: String?, p1: String?, p2: String?) {
// }
//
// override fun onStuckEnd(p0: String?, p1: String?, p2: String?) {
// }
//
// override fun onError(p0: String?, p1: String?, p2: String?) {
// pauseDownloadTime()
// }
//
// override fun onStop(p0: String?, p1: String?, p2: String?) {
// }
// })
//
//// littleVideoFragment!!.setUserCallBack { type, data, _ -> //播放状态 type
//// //播放的数据,可能为null data
//// //哪个播放器ß playerHash
//// when (type) {
//// com.yilan.sdk.player.utils.Constant.STATE_PREPARED -> {
//// // 防止网络异常时, 第一次加载倒计时红包
//// if (isFirstLoadVedio) {
//// isFirstLoadVedio = false
//// initTimeview()
//// }
////
//// vedioId = data.videoId
//// }
//// com.yilan.sdk.player.utils.Constant.STATE_ERROR -> {
////
//// pauseDownloadTime()
//// }
//// com.yilan.sdk.player.utils.Constant.STATE_PLAYING -> {
////
//// resumeDownloadTime(data.videoId)
//// }
////
//// com.yilan.sdk.player.utils.Constant.STATE_COMPLETE -> {
////
//// addVedioIdList(data.videoId)
//// pauseDownloadTime()
//// }
//// com.yilan.sdk.player.utils.Constant.STATE_PAUSED -> {
////
//// pauseDownloadTime()
//// }
//// }
//// false
//// }
// } else {
// transaction.show(littleVideoFragment!!)
// }
// transaction.commitAllowingStateLoss()
}
......@@ -381,8 +371,6 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
cdvvYilanTime?.showRedbox()
stopDownloadTime()
homePresenter.requestAddHomeVedioReward()
}
var vedioTime = ps.getInt(Constant.MAIN_VEDIO_TIME, 30)
cdvvYilanTime.setTime(vedioTime)
......
......@@ -110,6 +110,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
item_title_id.setOnClickListener(this)
iv_right_icon.setOnClickListener(this)
btn_withdraw.setOnClickListener(this)
btn_coinRecord.setOnClickListener(this)
item_title_invitecode.setOnClickListener(this)
item_title_invitecode_copy.setOnClickListener(this)
ll_my_login.setOnClickListener(this)
......@@ -577,6 +578,15 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
readyGo(DrawcashActivity::class.java)
}
R.id.btn_coinRecord -> {
if (userConfig == null) {
showToast("网络异常,请检测网络!")
myPresenter.getUserHallBaseMsg()
return
}
readyGo(CoinRecordActivity::class.java)
}
R.id.item_title_invitecode -> {
if (userConfig != null) {
val invitedCode = userConfig!!.userMsg.idcode
......
......@@ -39,21 +39,13 @@
android:id="@+id/tvDrawcashGold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@id/iv_coin"
android:gravity="center_vertical"
android:text="0"
android:layout_alignParentRight="true"
android:textColor="@color/main_mints"
android:textSize="22sp"
android:textStyle="bold" />
<ImageView
android:id="@+id/iv_coin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:padding="4dp"
android:src="@mipmap/ic_arrow_more" />
</RelativeLayout>
<View
......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_height="204dp"
android:orientation="vertical">
<LinearLayout
......@@ -78,7 +78,7 @@
<LinearLayout
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_height="90dp"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
......@@ -112,15 +112,32 @@
android:textColor="@color/my_color_orange"
android:textSize="28sp" />
<Button
android:id="@+id/btn_withdraw"
android:layout_width="60dp"
android:layout_height="32dp"
android:layout_marginStart="10dp"
android:background="@drawable/shape_btn_switch"
android:text="提现"
android:textColor="@color/white"
android:textSize="16sp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<Button
android:id="@+id/btn_coinRecord"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_marginStart="10dp"
android:background="@drawable/shape_btn_switch"
android:text="明细"
android:textColor="@color/white"
android:textSize="16sp" />
<Button
android:id="@+id/btn_withdraw"
android:layout_width="60dp"
android:layout_marginTop="10dp"
android:layout_height="30dp"
android:layout_marginStart="10dp"
android:background="@drawable/shape_btn_switch"
android:text="提现"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
......
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