Commit 698de6d3 authored by jyx's avatar jyx

代码优化

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