Commit 698de6d3 authored by jyx's avatar jyx

代码优化

parent 6fe62a9c
...@@ -203,7 +203,7 @@ ...@@ -203,7 +203,7 @@
android:name=".ui.activitys.TaskActivity" android:name=".ui.activitys.TaskActivity"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
<activity <activity
android:name=".ui.activitys.KylVedioActivity" android:name=".ui.activitys.KylVideoActivity"
android:configChanges="orientation|screenSize|keyboardHidden" android:configChanges="orientation|screenSize|keyboardHidden"
android:screenOrientation="portrait" /> android:screenOrientation="portrait" />
......
...@@ -172,7 +172,9 @@ public final class CoralDownload { ...@@ -172,7 +172,9 @@ public final class CoralDownload {
*/ */
@Override @Override
public boolean onAppDownloading(@Nullable CoralAD ad, @Nullable String downloadUrl) { public boolean onAppDownloading(@Nullable CoralAD ad, @Nullable String downloadUrl) {
// i = false; if (mOnAdLoadListener != null) {
mOnAdLoadListener.onSDKDownloadStart();
}
return false; return false;
} }
...@@ -188,6 +190,9 @@ public final class CoralDownload { ...@@ -188,6 +190,9 @@ public final class CoralDownload {
*/ */
@Override @Override
public boolean onAppDownloaded(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) { public boolean onAppDownloaded(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) {
if (mOnAdLoadListener != null) {
mOnAdLoadListener.onSDKDownloaded();
}
return false; return false;
} }
...@@ -203,6 +208,9 @@ public final class CoralDownload { ...@@ -203,6 +208,9 @@ public final class CoralDownload {
*/ */
@Override @Override
public boolean onAppInstalled(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) { public boolean onAppInstalled(@Nullable CoralAD ad, @Nullable String downloadUrl, @Nullable String localFile) {
if (mOnAdLoadListener != null) {
mOnAdLoadListener.onSDKInstalled();
}
return false; return false;
} }
...@@ -239,6 +247,12 @@ public final class CoralDownload { ...@@ -239,6 +247,12 @@ public final class CoralDownload {
void onLoadFail(); void onLoadFail();
void onSDKDownloadStart();
void onSDKDownloaded();
void onSDKInstalled();
void onGetDownloadProcess(DownloadProcess downloadProcess); void onGetDownloadProcess(DownloadProcess downloadProcess);
} }
......
...@@ -235,7 +235,7 @@ public class VideoAdingManager { ...@@ -235,7 +235,7 @@ public class VideoAdingManager {
LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight); LogUtil.d(TAG, "权重值:sdhzWeight:" + wnWeight);
} }
if (AppConfig.shVideoAdCount > 0) { if (AppConfig.shVideoAdCount > 0) {
weightList.add(new WeightBean(wnWeight, Constant.SH_VEDIO_AD)); weightList.add(new WeightBean(shVideoWeight, Constant.SH_VEDIO_AD));
weight = weight + shVideoWeight; weight = weight + shVideoWeight;
LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight); LogUtil.d(TAG, "权重值:shWeight:" + shVideoWeight);
} }
...@@ -248,6 +248,7 @@ public class VideoAdingManager { ...@@ -248,6 +248,7 @@ public class VideoAdingManager {
LogUtil.d(TAG, "2、权重随机值:" + randomWeight); LogUtil.d(TAG, "2、权重随机值:" + randomWeight);
for (WeightBean weightBean : weightList) { for (WeightBean weightBean : weightList) {
LogUtil.d(TAG, weightBean.getType() + " -> " + weightBean.getWeight());
randomWeight -= weightBean.getWeight(); randomWeight -= weightBean.getWeight();
if (randomWeight <= 0) { if (randomWeight <= 0) {
LogUtil.d(TAG, "3、权重结果:" + weightBean.getType()); LogUtil.d(TAG, "3、权重结果:" + weightBean.getType());
......
...@@ -23,7 +23,6 @@ object TzManager { ...@@ -23,7 +23,6 @@ object TzManager {
.appSecret("1c00e59f2257bdfdd4ad9363b41621b5") .appSecret("1c00e59f2257bdfdd4ad9363b41621b5")
.appChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME")) .appChannel(CommonUtils.getAppMetaData(MintsApplication.getContext(), "CHANNEL_NAME"))
.forTest(BuildConfig.DEBUG) .forTest(BuildConfig.DEBUG)
.verbose(BuildConfig.DEBUG)
.build(), .build(),
object : IADEngineState { object : IADEngineState {
override fun onIdle() {} override fun onIdle() {}
......
...@@ -23,6 +23,7 @@ import com.mints.goodmoney.ui.widgets.DialogListener ...@@ -23,6 +23,7 @@ import com.mints.goodmoney.ui.widgets.DialogListener
import com.mints.goodmoney.ui.widgets.TaskDialog import com.mints.goodmoney.ui.widgets.TaskDialog
import com.mints.goodmoney.utils.AppUtil import com.mints.goodmoney.utils.AppUtil
import com.mints.goodmoney.utils.CacheUtil import com.mints.goodmoney.utils.CacheUtil
import com.mints.goodmoney.utils.LogUtil
import com.mints.goodmoney.utils.SpacesItemDecoration import com.mints.goodmoney.utils.SpacesItemDecoration
import com.scwang.smartrefresh.layout.api.RefreshLayout import com.scwang.smartrefresh.layout.api.RefreshLayout
import com.scwang.smartrefresh.layout.listener.OnRefreshListener import com.scwang.smartrefresh.layout.listener.OnRefreshListener
...@@ -109,7 +110,11 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor ...@@ -109,7 +110,11 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
DownloadApkManager.tryOnceInstallApk() DownloadApkManager.tryOnceInstallApk()
try {
refreshDemoTask() refreshDemoTask()
} catch (e: Exception) {
LogUtil.e(e.printStackTrace())
}
} }
/** /**
...@@ -199,6 +204,24 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor ...@@ -199,6 +204,24 @@ class TaskActivity : BaseActivity(), OnItemClickListener, OnRefreshListener, Cor
srl_task.finishRefresh(false) srl_task.finishRefresh(false)
} }
override fun onSDKDownloadStart() {
taskDialog?.dismiss()
// SDK上报开始下载
mDownloadProcess?.reportDownloadStart(false)
registerBroad()
}
override fun onSDKDownloaded() {
// SDK上报下载完成
mDownloadProcess?.reportInstallSuccess(false)
}
override fun onSDKInstalled() {
// SDK上报安装完成
mDownloadProcess?.reportInstallSuccess(false)
}
override fun onGetDownloadProcess(downloadProcess: DownloadProcess?) { override fun onGetDownloadProcess(downloadProcess: DownloadProcess?) {
// 点击之后回调下载数据 // 点击之后回调下载数据
mDownloadProcess = downloadProcess mDownloadProcess = downloadProcess
......
...@@ -23,7 +23,7 @@ class TaskDialog(context: Context) : ...@@ -23,7 +23,7 @@ class TaskDialog(context: Context) :
private val tvInfo: TextView private val tvInfo: TextView
private val ivAvatar: ImageView private val ivAvatar: ImageView
private val textView: TextView private val textView: TextView
private val adContainer: ADContainer private var adContainer: ADContainer? = null
init { init {
setContentView(R.layout.dialog_task) setContentView(R.layout.dialog_task)
...@@ -52,6 +52,7 @@ class TaskDialog(context: Context) : ...@@ -52,6 +52,7 @@ class TaskDialog(context: Context) :
// tvTitle.setOnClickListener(listener) // tvTitle.setOnClickListener(listener)
// tvInfo.setOnClickListener(listener) // tvInfo.setOnClickListener(listener)
// btnDownload.setOnClickListener(listener) // btnDownload.setOnClickListener(listener)
} }
fun setData(data: CoralAD, seconds: Int, coin: Int) { fun setData(data: CoralAD, seconds: Int, coin: Int) {
...@@ -61,6 +62,12 @@ class TaskDialog(context: Context) : ...@@ -61,6 +62,12 @@ class TaskDialog(context: Context) :
GlideUtils.loadImageView(context, data.icon, ivAvatar) GlideUtils.loadImageView(context, data.icon, ivAvatar)
tvInfo.text = data.title tvInfo.text = data.title
adContainer.setAdModel(data) adContainer?.setAdModel(data)
}
override fun dismiss() {
super.dismiss()
adContainer?.removeAllViews()
adContainer = null
} }
} }
\ No newline at end of file
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="60dp" android:layout_marginTop="60dp"
android:src="@mipmap/ic_font_water" /> android:src="@mipmap/ic_font_walk" />
<com.mints.goodmoney.ui.widgets.StepView <com.mints.goodmoney.ui.widgets.StepView
android:id="@+id/svWalk" android:id="@+id/svWalk"
......
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