Commit 5afcef23 authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 376cf367
......@@ -206,8 +206,6 @@ public class CsjVideoAdManager extends BaseVideoAd {
public void onAdClose() {
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_CSJ, Constant.EVENT_TYPE_THREE, "", "");
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_CSJ, extraId, curCoin));
if (csjVideoAdListener != null) {
csjVideoAdListener.csjVideoAdSuccess();
}
......
......@@ -166,8 +166,6 @@ class ShVideoAdManager private constructor(activity: Activity) :
override fun onVideoClosed(@Nullable coralAD: CoralAD?, @Nullable s: String?): Boolean {
LogUtil.d(TAG, "onVideoClosed")
TrackManager.getInstance().reportAddCoinMsg(activity, getAdMapVO(carrierType, Constant.AD_SOURCE_SH, extraId, curCoin))
TrackManager.getInstance().addCallImp(Constant.AD_SOURCE_SH, Constant.EVENT_TYPE_THREE, "", "")
if (shVideoAdListener != null) {
......
......@@ -128,7 +128,7 @@ object DownloadApkManager {
override fun onError(error: Error) {
if (activity != null && !activity!!.isFinishing()) {
downloadProgressDialog?.dismiss()
CacheUtil.clearAllCache(context)
CacheUtil.clearAllCache()
}
}
})
......
......@@ -114,6 +114,12 @@ public class TrackManager {
}
}
/**
* 穿山甲和珊瑚由回调发放奖励
*
* @param activity
* @param vo
*/
public void reportAddCoinMsg(Activity activity, HashMap<String, Object> vo) {
if (trackPresenter != null) {
trackPresenter.reportAddCoinMsg(activity, vo);
......
......@@ -266,7 +266,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener, OnLoginListener,
when (v?.id) {
R.id.dialog_btn_right -> {
CacheUtil.clearAllCache(context)
CacheUtil.clearAllCache()
item_cleanCache.findViewById<TextView>(R.id.tv_right).text = "0KB"
}
}
......
......@@ -32,7 +32,7 @@ class TaskCpdActivity : BaseActivity(), View.OnClickListener {
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
CacheUtil.clearAllCache(context)
CacheUtil.clearAllCache()
initViewAndData()
initListener()
......
......@@ -104,7 +104,7 @@ class WebActivity : BaseActivity(), View.OnClickListener {
super.onDestroy()
CacheUtil.clearAllCache(context)
CacheUtil.clearAllCache()
if (browser_layout != null) {
browser_layout.destroyDrawingCache()
......
......@@ -88,7 +88,7 @@ class TaskCpdFragment : BaseFragment(), TaskView,
mCoralDownload = CoralDownload().setOnAdLoadListener(this)
CacheUtil.clearAllCache(context)
CacheUtil.clearAllCache()
initView()
initListener()
......
......@@ -10,6 +10,7 @@ import android.widget.ImageView
import android.widget.TextView
import com.downloader.PRDownloader
import com.downloader.Progress
import com.mints.goodmoney.MintsApplication
import com.mints.goodmoney.R
import com.mints.goodmoney.utils.CacheUtil
import com.mints.goodmoney.utils.Utils
......@@ -47,10 +48,10 @@ class DownloadProgressDialog(context: Context) :
if (AntiShake.check(v?.id)) return
when (v.id) {
R.id.iv_download_quit -> {
dismiss()
PRDownloader.cancelAll()
CacheUtil.clearAllCache(context)
CacheUtil.clearAllCache()
dismiss()
}
}
}
......
......@@ -3,6 +3,8 @@ package com.mints.goodmoney.utils;
import android.content.Context;
import android.os.Environment;
import com.mints.goodmoney.MintsApplication;
import java.io.File;
import java.math.BigDecimal;
......@@ -24,10 +26,10 @@ public class CacheUtil {
/***
* 清理所有缓存
* @param context
*/
public static void clearAllCache(Context context) {
public static void clearAllCache() {
try {
Context context= MintsApplication.getContext();
deleteDir(context.getCacheDir());
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
deleteDir(context.getExternalCacheDir());
......@@ -90,7 +92,7 @@ public class CacheUtil {
// 小于1023返回0KB
if (result1.intValue() < 1023) {
return "OKB";
return "0KB";
}
return result1.setScale(2, BigDecimal.ROUND_HALF_UP)
......
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