Commit 5afcef23 authored by mengcuiguang's avatar mengcuiguang

代码优化

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