Commit 5b456924 authored by mengcuiguang's avatar mengcuiguang

修改视频策略,优化热门活动、每日任务等

parent fb6032f2
......@@ -8,6 +8,7 @@ import com.mints.goodmoney.common.Constant;
import com.mints.goodmoney.mvp.model.VedioAdingBean;
import com.mints.goodmoney.mvp.model.WeightBean;
import com.mints.goodmoney.utils.LogUtil;
import com.mints.goodmoney.utils.ToastUtil;
import java.util.ArrayList;
import java.util.Random;
......@@ -89,7 +90,40 @@ public class VedioAdingManager {
public void loadAding(Activity activity, VedioAdingBean bean) {
this.activity = activity;
isVedioAdDownload = false;
loadAdVedio(getVedioAdType(), bean);
if (AppConfig.flVideoFlag) {
// 先展示枫岚视频
firstLoadFlVideo(bean);
} else {
// 权重自有逻辑
loadAdVedio(getVedioAdType(), bean);
}
}
/**
* 根据载体优先加载枫岚
*
* @param bean
*/
private void firstLoadFlVideo(VedioAdingBean bean) {
String adType;
switch (bean.getCarrierType()) {
case Constant.CARRIER_VERSUS_VIDEO:
case Constant.CARRIER_HOMEWATER:
case Constant.CARRIER_WALK:
case Constant.CARRIER_WALK_BUBBLE:
case Constant.CARRIER_SIGNIN_HOMEPAGE_CARD:
case Constant.CARRIER_OFFLINE_DOUBLE:
case Constant.CARRIER_EATMEAL_SUBSIDY:
adType = Constant.FL_VEDIO_AD;
ToastUtil.showLong(activity, "载体优先类型:" + Constant.FL_VEDIO_AD);
break;
default:
adType = getVedioAdType();
break;
}
loadAdVedio(adType, bean);
}
/**
......@@ -139,29 +173,28 @@ public class VedioAdingManager {
weightList.clear();
}
int weight = 0;
// 若没有视频完成数,不加入权重计算范围内
if (AppConfig.wnVedioAdCount > 0) {
weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD));
weight = weight + wnWeight;
LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight);
}
if (AppConfig.csjVedioAdCount > 0) {
weightList.add(new WeightBean(csjVedioWeight, Constant.CSJ_VEDIO_AD));
weight = weight + csjVedioWeight;
LogUtil.d(TAG, "权重值:csjVedioWeight:" + csjVedioWeight);
}
if (AppConfig.ylhAdCount > 0) {
weightList.add(new WeightBean(ylhWeight, Constant.YLH_VEDIO_AD));
weight = weight + ylhWeight;
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
}
if (AppConfig.flVedioAdCount > 0) {
weightList.add(new WeightBean(flVedioWeight, Constant.FL_VEDIO_AD));
weight = weight + flVedioWeight;
LogUtil.d(TAG, "权重值:flVedioWeight:" + flVedioWeight);
}
if (AppConfig.ylhAdCount > 0) {
weightList.add(new WeightBean(ylhWeight, Constant.YLH_VEDIO_AD));
weight = weight + ylhWeight;
LogUtil.d(TAG, "权重值:ylhWeight:" + ylhWeight);
if (AppConfig.wnVedioAdCount > 0) {
weightList.add(new WeightBean(wnWeight, Constant.SDHZ_VEDIO_AD));
weight = weight + wnWeight;
LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight);
}
// 权重随机
if (weightList != null && weightList.size() > 0 && weight > 0) {
LogUtil.d(TAG, "1、权重总值:" + weight);
......@@ -169,7 +202,7 @@ public class VedioAdingManager {
int randomWeight = r.nextInt(weight) + 1;
LogUtil.d(TAG, "2、权重随机值:" + randomWeight);
// ToastUtil.showLong(activity,"权重随机值:" + randomWeight);
ToastUtil.showLong(activity, "权重随机值:" + randomWeight);
for (WeightBean weightBean : weightList) {
randomWeight -= weightBean.getWeight();
......
......@@ -14,10 +14,20 @@ public class AppConfig {
public static boolean app_updateing = false;
/**
* 名单
* 名单
*/
public static String app_black = "";
/**
* 黑名单校验
*/
public static boolean app_black_flag = false;
/**
* 先展示枫岚视频
*/
public static boolean flVideoFlag = false;
/**
* app应用首页 0-主页 1-大转盘 2-邀请好友 3-我
*/
......
......@@ -120,6 +120,9 @@ object Constant {
const val CARRIER_MORNING_CLOCK = "MORNING_CLOCK" //早上打卡
const val CARRIER_DRAWCASH = "DRAWCASH" //提现
const val CARRIER_BLACK = "BLACK" //黑名单
const val CARRIER_HOMEVEDIO_CHALLENGE = "HOMEVEDIO_CHALLENGE" //首页视频挑战
const val CARRIER_MINIVEDIO_CHALLENGE = "MINIVEDIO_CHALLENGE" //短视频挑战
const val CARRIER_ZHANGYUE_CHALLENGE = "ZHANGYUE_CHALLENGE" //看小说挑战
const val CHALLENGE_SHAREFRIEND = "CHALLENGE_SHAREFRIEND" //邀请好友
......
......@@ -220,6 +220,62 @@ class DeviceInfo private constructor() {
return versionName
}
/**
* 获取CPU核数
*
* @return
*/
val cupCount: Int
get() {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.GINGERBREAD_MR1) {
// Gingerbread doesn't support giving a single application access to both cores, but a
// handful of devices (Atrix 4G and Droid X2 for example) were released with a dual-core
// chipset and Gingerbread; that can let an app in the background run without impacting
// the foreground application. But for our purposes, it makes them single core.
return 1
}
val cores: Int
cores = try {
File("/sys/devices/system/cpu/").listFiles(CPU_FILTER).size
} catch (e: SecurityException) {
0
} catch (e: java.lang.NullPointerException) {
0
}
return cores
}
/**
* 获取CPU型号
*
* @return
*/
val cupInfo: String
get() {
val cpuInfo = arrayOf("", "") //0:型号 1:频率
try {
val str1 = "/proc/cpuinfo"
var str2 = ""
var arrayOfString: Array<String>
val fr = FileReader(str1)
if (fr != null) {
val localBufferedReader = BufferedReader(fr, 8192)
str2 = localBufferedReader.readLine()
arrayOfString = str2.split("\\s+".toRegex()).toTypedArray()
for (i in 2 until arrayOfString.size) {
cpuInfo[0] = cpuInfo[0] + arrayOfString[i] + " "
}
str2 = localBufferedReader.readLine()
arrayOfString = str2.split("\\s+".toRegex()).toTypedArray()
cpuInfo[1] += arrayOfString[2]
localBufferedReader.close()
}
} catch (e: IOException) {
cpuInfo[0] = "unknow"
}
return cpuInfo[0]
}
/**
* 获取versionCode
*
......@@ -753,6 +809,8 @@ class DeviceInfo private constructor() {
return "02:00:00:00:00:00"
}
companion object {
private var _inst: DeviceInfo? = null
val instance: DeviceInfo
......
......@@ -8,6 +8,7 @@ public class VedioRulesBean implements Serializable {
private YlhVedioBean YLH_VEDIO;
private SdhzVedioBean SDHZ_VEDIO;
private FLVedioBean FL_VEDIO;
private boolean flVideoFlag;
public class CsjVedioBean implements Serializable {
private int surplus;//剩余可看视频数
......@@ -76,4 +77,8 @@ public class VedioRulesBean implements Serializable {
public SdhzVedioBean getSDHZ_VEDIO() {
return SDHZ_VEDIO;
}
public boolean isFlVideoFlag() {
return flVideoFlag;
}
}
......@@ -301,7 +301,7 @@ public interface LoanService {
Observable<BaseResponse<MainVedioMsgBean>> getSmallHomeVedioBaseMsg();
/**
* 阅读时长
* 小说阅读时长
*
* @return
*/
......@@ -309,7 +309,7 @@ public interface LoanService {
Observable<BaseResponse<JsonObject>> addReadSeconds(@Body Map<String, Object> vo);
/**
* 阅读时长
* 新闻阅读时长
*
* @return
*/
......
......@@ -46,6 +46,7 @@ public class OkHttpInterceptor implements Interceptor {
String channel = CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME");
// try {
// // 穿山甲分包渠道 暂不开启
// String ttChannel = HumeSDK.getChannel(MintsApplication.getContext());
// if (!TextUtils.isEmpty(ttChannel)) {
// channel = ttChannel;
......
......@@ -63,7 +63,13 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
initExpress()
initListener()
initDataView()
judgeAppInfo()
if (!AppConfig.app_black_flag) {
// 首次进行黑名单校验
judgeAppInfo()
} else {
pushAward()
}
}
/**
......@@ -101,6 +107,7 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
awardPresenter.saveTerminalInfo()
carrierType = Constant.CARRIER_BLACK
}
AppConfig.app_black_flag = true
pushAward()
}
})
......@@ -125,8 +132,9 @@ class AwardActivity : BaseActivity(), AwardView, View.OnClickListener {
*/
private fun pushAward() {
when (carrierType) {
Constant.CARRIER_HOMEVEDIO_CHALLENGE, Constant.CARRIER_MINIVEDIO_CHALLENGE,
Constant.CARRIER_GAME_ONLINE, Constant.CARRIER_EATMEAL,
Constant.CARRIER_RUISHINEWS_CHALLANGE -> {
Constant.CARRIER_RUISHINEWS_CHALLANGE, Constant.CARRIER_ZHANGYUE_CHALLENGE -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = carrierType
awardPresenter.reportAddCoinMsg(vo)
......
......@@ -146,10 +146,16 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
}
}
fun selectBook() {
moneyFragment?.let {
(it as MoneyFragment).selectBook()
}
}
/**
* 点击第二个tab
*/
private fun clickTab2Layout() {
public fun clickTab2Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_CHANNEL
if (channelFragment == null) {
channelFragment = HorizChannelFragment()
......
......@@ -33,6 +33,12 @@ class MainMyAdapter(context: Context, taskData: MutableList<MyInfo.AutoListBean>
// 新闻
const val TO_RUISHI = "TO_RUISHI"
// 短视频
const val TO_MINI_VEDIO = "TO_MINI_VEDIO"
// 掌阅阅读
const val TO_ZHANGYUE = "TO_ZHANGYUE"
}
private var mContext: Context = context
......
......@@ -178,6 +178,7 @@ class MainFragment : BaseFragment(), HomeView, View.OnClickListener {
// 保存Ip,用于穿山甲回调校验
ps.put(Constant.CSJ_VEDIO_APPIP, data.ip)
AppConfig.app_black = data.userRiskApp
AppConfig.flVideoFlag = data.vedioRules.isFlVideoFlag
// 新人福利 放到个人中心展示 防止首页红包转动异常
......
......@@ -74,6 +74,10 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
vpFragmentMoney.currentItem = 0
}
fun selectBook() {
vpFragmentMoney.currentItem = 1
}
override fun onTabReselected(tab: XTabLayout.Tab) {
}
......
......@@ -211,6 +211,8 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
// 更新权重
initAdWeight(data)
AppConfig.app_black = data.userRiskApp
AppConfig.flVideoFlag = data.vedioRules.isFlVideoFlag
// 新人福利
if (data.userMsg.firstGiveCoin > 0) {
......@@ -403,15 +405,46 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
when (taskBean.baseConfig.taskId) {
// 跳转首页视频
MainMyAdapter.TO_HOME -> {
val activity: MainActivity? = activity as MainActivity?
activity?.clickTab1Layout()
activity?.selectVedio()
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0, 2 -> {
val activity: MainActivity? = activity as MainActivity?
activity?.let {
it.clickTab1Layout()
it.selectVedio()
}
}
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_HOMEVEDIO_CHALLENGE)
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
// 跳转短视频
MainMyAdapter.TO_MINI_VEDIO -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0, 2 -> {
val activity: MainActivity? = activity as MainActivity?
activity?.clickTab2Layout()
}
1 -> {
val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_MINIVEDIO_CHALLENGE)
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
// 邀好友赚金币
MainMyAdapter.APP_SHAREFRIEND -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0 -> {
0, 2 -> {
// 邀请好友
if (!UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity::class.java)
......@@ -432,20 +465,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
bundle.putString(Constant.MAIN_EXTRA_ID, taskBean.otherConfig.doubleCoin.toString())
readyGo(AwardActivity::class.java, bundle)
}
2 -> {
// 邀请好友
if (!UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
if (!ps.getBoolean(Constant.FIRST_SHARE_MY, false)) {
// 第一次邀请提示弹框
firstWeChatInvite()
} else {
shareImgDialog()
}
}
}
}
}
......@@ -465,7 +484,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
MainMyAdapter.TO_LIEBAO -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0 -> {
0, 2 -> {
readyGo(LiebaoGameActivity::class.java)
}
1 -> {
......@@ -474,9 +493,6 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_GAME_ONLINE)
readyGo(AwardActivity::class.java, bundle)
}
2 -> {
readyGo(LiebaoGameActivity::class.java)
}
}
}
}
......@@ -484,7 +500,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
MainMyAdapter.TO_RUISHI -> {
if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) {
0 -> {
0, 2 -> {
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
readyGo(WrapperActivity::class.java, bundle)
......@@ -495,17 +511,18 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_RUISHINEWS_CHALLANGE)
readyGo(AwardActivity::class.java, bundle)
}
2 -> {
val bundle = Bundle()
bundle.putInt(Constant.WRAPPER_TYPE, Constant.WRAPPER_TYPE_NEWS)
readyGo(WrapperActivity::class.java, bundle)
}
}
}
}
// 小说免费看,金币大家赚
// MainMyAdapter.TASK_TYPE_FICTION -> {
// }
// 小说
MainMyAdapter.TO_ZHANGYUE -> {
val activity: MainActivity? = activity as MainActivity?
activity?.let {
it.clickTab1Layout()
it.selectBook()
}
}
// 试玩平台
MainMyAdapter.TO_YWHZ -> {
if (!userManager.userIsLogin()) {
......
......@@ -16,7 +16,7 @@ import com.mints.goodmoney.utils.SpanUtils
import kotlinx.android.synthetic.main.fragment_main_zy.*
/**
* 描述:掌阅书城
* 描述:我的-掌阅书城
* 作者:孟崔广
*/
class MyZhangyueFragment : LazyLoadBaseFragment(), BookView, IreaderApi.OnReadChangeListener {
......
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