Commit 109a17d0 authored by maxiaoliang's avatar maxiaoliang

修改问题

parent 8288ab8e
......@@ -3,6 +3,7 @@ package com.test.easy.easycleanerjunk.activity
import android.app.Activity
import android.content.Intent
import android.graphics.Color
import androidx.activity.OnBackPressedCallback
import androidx.core.view.updatePadding
import com.test.easy.easycleanerjunk.R
import com.test.easy.easycleanerjunk.activity.appmanager.AppManagerAnimationActivity
......@@ -50,25 +51,25 @@ class BackRelsutAt:BaseActivity<AtLayoutBackRelustBinding>() {
val index = listOf(
AFunOb.JUNK_CLEANER,
AFunOb.WHATSAPP_CLEANER,
AFunOb.BATTERY_INFO,
AFunOb.APP_MANAGER,
AFunOb.LARGE_FILE_CLEANER,
AFunOb.BATTERY_INFO,
AFunOb.PHOTO_COMPRESS,
AFunOb.APP_MANAGER,
AFunOb.SIMILAR_PHOTOS,
AFunOb.SCREENSHOT_CLEANER
AFunOb.SCREENSHOT_CLEANER,
AFunOb.SIMILAR_PHOTOS
).indexOf(type)
listOf(
listOf(R.mipmap.b_cleanjunk, "Clean up remaining junk files to free up space", "Clean Up", PrepareScanActivity::class.java),
listOf(R.mipmap.b_whatsapp, "Free up space by cleaning up WhatsApp junk files", "View", WhatsAppCleanerAnimationActivity::class.java),
listOf(R.mipmap.b_battery, "Power consumption too fast? Check your phone's battery status", "View", BatteryInfoAnimationActivity::class.java),
listOf(R.mipmap.b_appguanli, "Low on storage space? Free up space on your device by managing unused apps!", "View", AppManagerAnimationActivity::class.java),
listOf(R.mipmap.b_large, "Free up storage space by cleaning up big files", "Clean Up", LargeFileAnimationActivity::class.java),
listOf(R.mipmap.b_battery, "Power consumption too fast? Check your phone's battery status", "View", BatteryInfoAnimationActivity::class.java),
listOf(R.mipmap.b_photocompress, "Compress images to save storage space", "Compress", StartCompressionPhotoActivity::class.java),
listOf(R.mipmap.b_appguanli, "Low on storage space? Free up space on your device by managing unused apps!", "View", AppManagerAnimationActivity::class.java),
listOf(R.mipmap.b_screenshot, "Free up storage space by cleaning up screenshots", "View", ScreenShotAnimationActivity::class.java),
listOf(R.mipmap.b_similar, "Check similar photos and free up space", "Clean Up", RepeatPhotoAnimationActivity::class.java),
listOf(R.mipmap.b_screenshot, "Free up storage space by cleaning up screenshots", "View", ScreenShotAnimationActivity::class.java)
).let {
// val item = it[(index + 1) % it.size]
val item = it[hp % it.size]
val item = it[(index + 1) % it.size]
// val item = it[hp % it.size]
binding.idImg.setImageResource(item[0] as Int)
binding.idTvDesc.text = item[1] as String
binding.idBtn.text = item[2] as String
......@@ -83,17 +84,20 @@ class BackRelsutAt:BaseActivity<AtLayoutBackRelustBinding>() {
override fun initListener() {
binding.idClose.setOnClickListener {
if(ConfigHelper.admobTrueMaxFlase==0){
MaxAdUtils.showInterstitialAd(this){
finishToMain()
}
}else{
AdmobUtils.showInterstitialAd(this){
finishToMain()
onBackPressedDispatcher.onBackPressed()
}
onBackPressedDispatcher.addCallback(object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
if(ConfigHelper.admobTrueMaxFlase==0){
MaxAdUtils.showInterstitialAd(this@BackRelsutAt){
finishToMain()
}
}else{
AdmobUtils.showInterstitialAd(this@BackRelsutAt){
finishToMain()
}
}
}
}
})
}
}
\ No newline at end of file
......@@ -135,7 +135,7 @@ class ResultActivity : BaseActivity<ActivityLayoutResultBinding>() {
SPUtils.getInstance().put("localCount", localCount + 1)
val n = SPUtils.getInstance().getInt("outcomeReturnHomeCount", 0)
if (localCount < n) {
startActivity(Intent(this@ResultActivity, BackRelsutAt::class.java))
BackRelsutAt.launch(this@ResultActivity,from)
finish()
}else{
finishToMain()
......
......@@ -3,7 +3,6 @@ package com.test.easy.easycleanerjunk.activity.home
import android.graphics.Color
import android.graphics.Typeface
import android.os.Build
import android.util.Log
import androidx.activity.OnBackPressedCallback
import androidx.annotation.RequiresApi
import androidx.fragment.app.Fragment
......@@ -82,42 +81,6 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
PopExitWindow.show(this@NewMainActivity)
}
})
Log.e("MXL", "initView: " + "第一天安装")
// Log.e("MXL", "initView: " + ConfigHelper.enterHomeTimes)
// if(!ConfigHelper.isfirstInstall){
// if ((ConfigHelper.enterHomeTimes % 1000).toInt() == 2 || (ConfigHelper.enterHomeTimes % 1000).toInt() == 3) {
// //第二次进入首页
// val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
// if (s == 1) {
// startActivity(Intent(this, BackRelsutAt::class.java))
// }
// }
// }else{
// if ((ConfigHelper.enterHomeTimes % 1000).toInt() == 1 || (ConfigHelper.enterHomeTimes % 1000).toInt() == 2) {
// val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
// if (s == 1) {
// startActivity(Intent(this, BackRelsutAt::class.java))
// }
// }
// }
// if ((ConfigHelper.isfirstInstall % 1000).toInt() ==1) {
//
// } else {
// Log.e("MXL", "initView: " + "第二天安装")
// Log.e("MXL", "initView: "+ConfigHelper.enterHomeTimes )
// Log.e("MXL", "initView: "+ConfigHelper.enterHomeTimes % 1000 )
//
// if ((ConfigHelper.enterHomeTimes % 1000).toInt() == 1 || (ConfigHelper.enterHomeTimes % 1000).toInt() == 2) {
// //第二次进入首页
// val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
// if (s == 1) {
// startActivity(Intent(this, BackRelsutAt::class.java))
// }
// }
// }
}
private fun setPage(p: Int) {
......
......@@ -8,6 +8,9 @@ import androidx.activity.addCallback
import androidx.lifecycle.lifecycleScope
import com.test.easy.easycleanerjunk.databinding.ActivityRepeatPhotoAnimationBinding
import com.test.easy.easycleanerjunk.helps.BaseActivity
import com.test.easy.easycleanerjunk.helps.ConfigHelper
import com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
import com.test.easy.easycleanerjunk.helps.ads.MaxAdUtils
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
......@@ -31,8 +34,18 @@ class RepeatPhotoAnimationActivity : BaseActivity<ActivityRepeatPhotoAnimationBi
binding.lottieCompleted.playAnimation()
binding.tv.text = "Completed!"
delay(1000)
startActivity(Intent(this@RepeatPhotoAnimationActivity, RepeatPhotoActivity::class.java))
finish()
if(ConfigHelper.admobTrueMaxFlase==0){
MaxAdUtils.showInterstitialAd(this@RepeatPhotoAnimationActivity){
startActivity(Intent(this@RepeatPhotoAnimationActivity, RepeatPhotoActivity::class.java))
finish()
}
}else{
AdmobUtils.showInterstitialAd(this@RepeatPhotoAnimationActivity){
startActivity(Intent(this@RepeatPhotoAnimationActivity, RepeatPhotoActivity::class.java))
finish()
}
}
}
}
......
......@@ -22,7 +22,7 @@ class ConfigBean() {
var outcomeReturnCount: Int = 0//每次从结果页面关闭到首页时
var outcomeReturnHomeCount: Int = 0//返回主页弹几次
var dayoutcomeHomePage: Int = 0 //第二次打开到首页开关
var maxShowNotificationCount: Int = 0
var maxShowNotificationCount: String = ""
var admobTrueMaxFlase: Int = 0
}
......@@ -42,7 +42,7 @@ public class ActionBroadcast extends BroadcastReceiver {
if (mIsScreenOn && !isLock) {
int locks = SPUtils.getInstance().getInt("lockS", 1);
if (locks == 1) {
NotificationUtil.sendNotification(MyApplication.context);
NotificationUtil.sendNotification(MyApplication.context,"lock");
}
}
break;
......
......@@ -54,7 +54,7 @@ public class FcmService extends FirebaseMessagingService {
EventUtils.INSTANCE.event("FCM_Received",null,null,false);
NotificationUtil.sendNotification(MyApplication.context);
NotificationUtil.sendNotification(MyApplication.context,"FCM");
Log.d("FcmService", remoteMessage.getData().toString());
......
......@@ -36,7 +36,7 @@ public class MyTimerManager {
Log.d("glc", "定时器执行");
if (ActionBroadcast.mIsScreenOn && !ActionBroadcast.isLock && MyApplication.PAUSED_VALUE != 1) {
Log.d("glc", "定时器执行条件满足");
NotificationUtil.sendNotification(MyApplication.context);
NotificationUtil.sendNotification(MyApplication.context,"timer");
}
}
};
......
......@@ -89,7 +89,7 @@ public class NotificationUtil {
SPUtils.getInstance().put(key, s);
}
public static void sendNotification(Context context) {
public static void sendNotification(Context context,String type) {
int currentNum = SPUtils.getInstance().getInt("showNotificationCount_" + AdDisplayUtils.getInstance().getCurrentDate(), 0);
int maxNum = Integer.parseInt(SPUtils.getInstance().getString("maxShowNotificationCount", "156"));
if (currentNum >= maxNum) {
......@@ -98,7 +98,7 @@ public class NotificationUtil {
}
int actionId = getNextNotificationId();
EventUtils.INSTANCE.event("showNotification",null,null,false);
EventUtils.INSTANCE.event("showNotification",type,null,false);
if (MyApplication.PAUSED_VALUE == 1) {
return;
......
......@@ -19,7 +19,6 @@ import com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import com.test.easy.easycleanerjunk.utils.BarUtils
import com.test.easy.easycleanerjunk.utils.PermissionUtils
import com.test.easy.easycleanerjunk.utils.PermissionUtils.STORAGE
import com.test.easy.easycleanerjunk.view.DialogViews
import com.test.easy.easycleanerjunk.view.DialogViews.showGerPermission
import org.json.JSONObject
......@@ -42,6 +41,7 @@ abstract class BaseActivity<T : ViewBinding> : AppCompatActivity() {
ActivityManagerUtils.getInstance().addActivity(this)
initView()
initListener()
EventUtils.event("page_${javaClass.simpleName}")
}
protected abstract fun initView()
......
package com.test.easy.easycleanerjunk.helps
import android.util.Log
import com.google.gson.Gson
import com.test.easy.easycleanerjunk.BuildConfig
import com.test.easy.easycleanerjunk.bean.ConfigBean
......@@ -53,7 +52,6 @@ object ComUtils {
val str = AESHelper.decrypt(it)
val gson = Gson()
val bean = gson.fromJson(str, ConfigBean::class.java)
Log.e("MXL", str)
SPUtils.getInstance().put("actionS", bean.actionS);
SPUtils.getInstance().put("open", bean.open);
SPUtils.getInstance().put("num", bean.num);
......
......@@ -4,6 +4,10 @@ import android.content.SharedPreferences;
import android.util.Log;
import com.test.easy.easycleanerjunk.helps.BaseApplication;
import com.test.easy.easycleanerjunk.helps.EventUtils;
import org.json.JSONException;
import org.json.JSONObject;
import java.text.SimpleDateFormat;
import java.util.Calendar;
......@@ -71,7 +75,45 @@ public class AdDisplayUtils {
}
public boolean shouldShowAd() {
return shouldDisplayAd() && shouldIncrementClickCount() && shouldIncrementRequestFailAd()&&shouldSendAdRequest();
boolean a = shouldDisplayAd();
boolean a1 = shouldIncrementClickCount();
boolean a2 = shouldIncrementRequestFailAd();
boolean a3 = shouldSendAdRequest();
if (!a) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("reason", "shouldDisplayAd");
EventUtils.INSTANCE.event("ad_show_errron", "", jsonObject, false);
} catch (JSONException e) {
}
}
if (!a1) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("reason", "shouldIncrementClickCount");
EventUtils.INSTANCE.event("ad_show_errron", "", jsonObject, false);
} catch (JSONException e) {
}
}
if (!a2) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("reason", "shouldIncrementClickCount");
EventUtils.INSTANCE.event("ad_show_errron", "", jsonObject, false);
} catch (JSONException e) {
}
}
if (!a3) {
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("reason", "shouldSendAdRequest");
EventUtils.INSTANCE.event("ad_show_errron", "", jsonObject, false);
} catch (JSONException e) {
}
}
return shouldDisplayAd() && shouldIncrementClickCount() && shouldIncrementRequestFailAd() && shouldSendAdRequest();
}
public void incrementAdDisplayCount() {
......@@ -99,7 +141,7 @@ public class AdDisplayUtils {
}
adRequestFailCount++;
saveAdRequestFailCount();
Log.d("glc","广告请求失败:"+adRequestFailCount);
Log.d("glc", "广告请求失败:" + adRequestFailCount);
}
......@@ -152,6 +194,7 @@ public class AdDisplayUtils {
public int getMaxAdClickCount() {
return maxAdClickCount;
}
public int getMaxAdRequestCount() {
return maxAdRequestCount;
}
......
......@@ -150,7 +150,7 @@ object AdmobUtils {
fun showNativeAd(activity: Activity?, parent: ViewGroup) {
val obj = JSONObject()
obj.put("ad_unit", "NativeAd")
EventUtils.event("ad_prepare_show", ext = obj)
EventUtils.event("big_img_ad_prepare_show", ext = obj)
if (!AdDisplayUtils.getInstance().shouldShowAd()) {
return
}
......@@ -175,7 +175,7 @@ object AdmobUtils {
val obj2 = JSONObject()
obj2.put("reason", "no_ad")
obj2.put("ad_unit", "nativeAd")
EventUtils.event("ad_show_error", ext = obj2)
EventUtils.event("big_img_ad_show_error", ext = obj2)
} else {
loadingListener?.invoke()
}
......
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