Commit 60f5e048 authored by jyx's avatar jyx

代码优化

parent a0b51d39
...@@ -95,8 +95,6 @@ public class VedioAdingManager { ...@@ -95,8 +95,6 @@ public class VedioAdingManager {
// 权重自有逻辑 // 权重自有逻辑
loadAdVedio(getVedioAdType(), bean); loadAdVedio(getVedioAdType(), bean);
} }
isHighWeight = false;
} }
/** /**
...@@ -159,10 +157,12 @@ public class VedioAdingManager { ...@@ -159,10 +157,12 @@ public class VedioAdingManager {
// 根据权重获取广告类型 // 根据权重获取广告类型
String adType; String adType;
if (isHighWeight) { if (isHighWeight) {
setVedioAdingListener(null);
adType = getHighWeight(); adType = getHighWeight();
} else { } else {
adType = getRandomWeight(); adType = getRandomWeight();
} }
isHighWeight = false;
LogUtil.d(TAG, "权重结果返回的广告类型:" + adType); LogUtil.d(TAG, "权重结果返回的广告类型:" + adType);
return adType; return adType;
...@@ -348,7 +348,7 @@ public class VedioAdingManager { ...@@ -348,7 +348,7 @@ public class VedioAdingManager {
// 优量汇 // 优量汇
if (ylhVedioAdManager == null) { if (ylhVedioAdManager == null) {
if (activity == null) { if (activity == null) {
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(Constant.YLH_VEDIO_AD); vedioAdingListener.vedioAdingListenerError(Constant.YLH_VEDIO_AD);
} }
return; return;
...@@ -359,7 +359,7 @@ public class VedioAdingManager { ...@@ -359,7 +359,7 @@ public class VedioAdingManager {
ylhVedioAdManager.setYlhVedioAdListener(new YlhVedioAdManager.YlhVedioAdListener() { ylhVedioAdManager.setYlhVedioAdListener(new YlhVedioAdManager.YlhVedioAdListener() {
@Override @Override
public void ylhVedioAdFail() { public void ylhVedioAdFail() {
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerFail(Constant.YLH_VEDIO_AD); vedioAdingListener.vedioAdingListenerFail(Constant.YLH_VEDIO_AD);
} }
} }
...@@ -367,7 +367,7 @@ public class VedioAdingManager { ...@@ -367,7 +367,7 @@ public class VedioAdingManager {
@Override @Override
public void ylhVedioAdSuccess() { public void ylhVedioAdSuccess() {
AppConfig.ylhAdCount--; AppConfig.ylhAdCount--;
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerSuccess(Constant.YLH_VEDIO_AD); vedioAdingListener.vedioAdingListenerSuccess(Constant.YLH_VEDIO_AD);
} }
} }
...@@ -382,7 +382,7 @@ public class VedioAdingManager { ...@@ -382,7 +382,7 @@ public class VedioAdingManager {
// 穿山甲激励视频 // 穿山甲激励视频
if (csjVedioAdManager == null) { if (csjVedioAdManager == null) {
if (activity == null) { if (activity == null) {
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(Constant.CSJ_VEDIO_AD); vedioAdingListener.vedioAdingListenerError(Constant.CSJ_VEDIO_AD);
} }
return; return;
...@@ -394,7 +394,7 @@ public class VedioAdingManager { ...@@ -394,7 +394,7 @@ public class VedioAdingManager {
csjVedioAdManager.setCsjVedioAdListener(new CsjVedioAdManager.CsjVedioAdListener() { csjVedioAdManager.setCsjVedioAdListener(new CsjVedioAdManager.CsjVedioAdListener() {
@Override @Override
public void csjVedioAdFail() { public void csjVedioAdFail() {
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerFail(Constant.CSJ_VEDIO_AD); vedioAdingListener.vedioAdingListenerFail(Constant.CSJ_VEDIO_AD);
} }
} }
...@@ -402,7 +402,7 @@ public class VedioAdingManager { ...@@ -402,7 +402,7 @@ public class VedioAdingManager {
@Override @Override
public void csjVedioAdSuccess() { public void csjVedioAdSuccess() {
AppConfig.csjVedioAdCount--; AppConfig.csjVedioAdCount--;
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerSuccess(Constant.CSJ_VEDIO_AD); vedioAdingListener.vedioAdingListenerSuccess(Constant.CSJ_VEDIO_AD);
} }
} }
...@@ -417,7 +417,7 @@ public class VedioAdingManager { ...@@ -417,7 +417,7 @@ public class VedioAdingManager {
// 闪电盒子激励视频 // 闪电盒子激励视频
if (wnVedioAdManager == null) { if (wnVedioAdManager == null) {
if (activity == null) { if (activity == null) {
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(Constant.SDHZ_VEDIO_AD); vedioAdingListener.vedioAdingListenerError(Constant.SDHZ_VEDIO_AD);
} }
return; return;
...@@ -428,14 +428,14 @@ public class VedioAdingManager { ...@@ -428,14 +428,14 @@ public class VedioAdingManager {
@Override @Override
public void wnVedioAdSuccess() { public void wnVedioAdSuccess() {
AppConfig.wnVedioAdCount--; AppConfig.wnVedioAdCount--;
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerSuccess(Constant.SDHZ_VEDIO_AD); vedioAdingListener.vedioAdingListenerSuccess(Constant.SDHZ_VEDIO_AD);
} }
} }
@Override @Override
public void wnVedioAdFail() { public void wnVedioAdFail() {
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerFail(Constant.SDHZ_VEDIO_AD); vedioAdingListener.vedioAdingListenerFail(Constant.SDHZ_VEDIO_AD);
} }
} }
...@@ -450,7 +450,7 @@ public class VedioAdingManager { ...@@ -450,7 +450,7 @@ public class VedioAdingManager {
// 枫岚广告激励视频 // 枫岚广告激励视频
if (mhVedioAdManager == null) { if (mhVedioAdManager == null) {
if (activity == null) { if (activity == null) {
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(Constant.FL_VEDIO_AD); vedioAdingListener.vedioAdingListenerError(Constant.FL_VEDIO_AD);
} }
return; return;
...@@ -461,14 +461,14 @@ public class VedioAdingManager { ...@@ -461,14 +461,14 @@ public class VedioAdingManager {
@Override @Override
public void mhVedioAdSuccess() { public void mhVedioAdSuccess() {
AppConfig.flVedioAdCount--; AppConfig.flVedioAdCount--;
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerSuccess(Constant.FL_VEDIO_AD); vedioAdingListener.vedioAdingListenerSuccess(Constant.FL_VEDIO_AD);
} }
} }
@Override @Override
public void mhVedioAdFail() { public void mhVedioAdFail() {
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerFail(Constant.FL_VEDIO_AD); vedioAdingListener.vedioAdingListenerFail(Constant.FL_VEDIO_AD);
} }
} }
...@@ -483,9 +483,9 @@ public class VedioAdingManager { ...@@ -483,9 +483,9 @@ public class VedioAdingManager {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
if (vedioAdingListener != null && !isHighWeight) { if (vedioAdingListener != null) {
vedioAdingListener.vedioAdingListenerError(bean.getCarrierType()); vedioAdingListener.vedioAdingListenerError(bean.getCarrierType());
} }
} }
} }
} }
\ No newline at end of file
...@@ -445,6 +445,11 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -445,6 +445,11 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
when (taskBean.baseConfig.taskId) { when (taskBean.baseConfig.taskId) {
// 跳转高额视频 // 跳转高额视频
MainMyAdapter.APP_HiGH_ACTIVITY -> { MainMyAdapter.APP_HiGH_ACTIVITY -> {
if (!UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
if (taskBean.otherConfig != null) { if (taskBean.otherConfig != null) {
if (taskBean.otherConfig.complete >= taskBean.otherConfig.max) { if (taskBean.otherConfig.complete >= taskBean.otherConfig.max) {
showToast("看高额视频赚金币任务已完成,请明日再来") showToast("看高额视频赚金币任务已完成,请明日再来")
...@@ -1057,7 +1062,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -1057,7 +1062,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
} }
when (v.id) { when (v.id) {
R.id.dialog_btn_left -> { R.id.dialog_btn_left -> {
cdaa!!.dismiss()
} }
R.id.dialog_btn_right -> { R.id.dialog_btn_right -> {
cdaa!!.dismiss() cdaa!!.dismiss()
...@@ -1081,6 +1086,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi ...@@ -1081,6 +1086,7 @@ class MyFragment : BaseFragment(), MyView, OnItemChildClickListener, OnRefreshLi
it.setTitle("任务步骤") it.setTitle("任务步骤")
it.setContent(ssb) it.setContent(ssb)
it.setContentGravity(Gravity.START) it.setContentGravity(Gravity.START)
it.setLeft("取消")
it.setRight("开始任务") it.setRight("开始任务")
it.show() it.show()
} }
......
...@@ -2,19 +2,21 @@ ...@@ -2,19 +2,21 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="4dp" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="6dp"
android:background="@color/white" android:background="@color/white"
android:orientation="vertical"> android:orientation="vertical">
<ImageView <com.shehuan.niv.NiceImageView
android:id="@+id/ivXmlyPage" android:id="@+id/ivKylPage"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="300dp" android:layout_height="180dp"
android:scaleType="fitXY" android:scaleType="fitXY"
android:src="@mipmap/bg_eat" /> android:src="@mipmap/bg_eat"
app:corner_radius="10dp"/>
<TextView <TextView
android:id="@+id/tvXmlyPageContent" android:id="@+id/tvKylPageContent"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="6dp" android:layout_margin="6dp"
...@@ -26,17 +28,4 @@ ...@@ -26,17 +28,4 @@
android:textSize="14sp" android:textSize="14sp"
android:textStyle="bold" /> android:textStyle="bold" />
<TextView
android:visibility="gone"
android:id="@+id/tvXmlyPagecount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginBottom="6dp"
android:drawableLeft="@mipmap/ic_headset"
android:drawablePadding="6dp"
android:gravity="center_vertical"
android:text="7.2亿"
android:textColor="@color/color_AAA"
android:textSize="12sp" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="4dp"
android:background="@color/white"
android:orientation="vertical">
<ImageView
android:id="@+id/ivXmlyPage"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="300dp"
android:scaleType="fitXY"
android:src="@mipmap/bg_eat" />
<TextView
android:id="@+id/tvXmlyPageContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_margin="6dp" android:layout_margin="6dp"
android:background="@color/white" android:ellipsize="end"
android:orientation="vertical"> android:lines="1"
android:singleLine="true"
<com.shehuan.niv.NiceImageView android:text="123213112321311232131123213112321311232131123213112321311232131123213112321311232131"
android:id="@+id/ivKylPage" android:textColor="@color/black"
android:layout_width="match_parent" android:textSize="14sp"
android:layout_height="180dp" android:textStyle="bold" />
android:scaleType="fitXY"
android:src="@mipmap/bg_eat"
app:corner_radius="10dp"/>
<TextView
android:id="@+id/tvKylPageContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="6dp"
android:ellipsize="end"
android:lines="1"
android:singleLine="true"
android:text="123213112321311232131123213112321311232131123213112321311232131123213112321311232131"
android:textColor="@color/black"
android:textSize="14sp"
android:textStyle="bold" />
<TextView
android:visibility="gone"
android:id="@+id/tvXmlyPagecount"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginBottom="6dp"
android:drawableLeft="@mipmap/ic_headset"
android:drawablePadding="6dp"
android:gravity="center_vertical"
android:text="7.2亿"
android:textColor="@color/color_AAA"
android:textSize="12sp" />
</LinearLayout> </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