Commit 7a7f546e authored by jyx's avatar jyx

代码优化

parent 4c7c4645
......@@ -167,27 +167,30 @@
<activity
android:name=".ui.activitys.keepalive.ScreenActivity"
android:configChanges="keyboardHidden|orientation|screenSize|locale|density|fontScale|layoutDirection|navigation|uiMode|screenLayout|mcc|mnc"
android:excludeFromRecents="true"
android:immersive="true"
android:launchMode="singleTask"
android:showOnLockScreen="true"
android:taskAffinity="org.etron.dd1"
android:theme="@style/AppTheme.LockScreen" />
<activity
android:name=".ui.activitys.keepalive.ApkActivity"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:launchMode="singleTask"
android:theme="@style/CustomerTransparentTheme" />
<activity
android:name=".ui.activitys.keepalive.TriggerActivity"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:launchMode="singleTask"
android:theme="@style/CustomerTransparentTheme" />
<activity
android:name=".ui.activitys.keepalive.TransparentActivity"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:launchMode="singleTask"
android:theme="@style/CustomerTransparentTheme" />
<!-- <activity-->
......@@ -199,7 +202,7 @@
<activity
android:name=".ui.activitys.keepalive.BoostFastActivity"
android:excludeFromRecents="true"
android:launchMode="singleInstance"
android:launchMode="singleTask"
android:theme="@style/CustomerTransparentTheme" />
<service
......
......@@ -35,6 +35,7 @@ import com.mints.flowbox.manager.wifi.WifiDataManager;
import com.mints.flowbox.net.LoanService;
import com.mints.flowbox.ui.activitys.keepalive.TriggerActivity;
import com.mints.flowbox.utils.ForegroundOrBackground;
import com.mints.flowbox.utils.LogUtil;
import com.mints.flowbox.utils.SystemUtils;
import com.mints.flowbox.utils.keepalive.IntentUtils;
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils;
......@@ -178,20 +179,12 @@ public class MintsApplication extends BaseApp {
// TODO 这里可以初始化广告SDK
thirdConfig();
// AdHelper.getInstance().init(this);
// 这个用来在release版本出toast,方便测试
// if (TextUtils.isEmpty(channel) || "BUG".equalsIgnoreCase(channel)) {
// // release 模式下,无渠道号就弹这个TOAST,这样方便监测进程启动,可以去掉
// Toast.makeText(this, "测试:主进程重启成功", Toast.LENGTH_LONG).show();
// }
new ScreenLockerObserver(this).start(this);
CoreAdContext.Companion.setLockerResumeCallback(new Function1<Activity, Boolean>() {
@Override
public Boolean invoke(Activity activity) {
LogUtil.d(activity.getComponentName());
// TODO 这里利用activity实例,载入所有的体外广告,比如全屏视频、开屏等等
return true;
}
......
......@@ -18,7 +18,6 @@ class WifiAdManager private constructor() {
private val TAG = WifiAdManager::class.java.simpleName
companion object {
val instance: WifiAdManager by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
WifiAdManager()
......@@ -121,10 +120,21 @@ class WifiAdManager private constructor() {
fun showInterstitial(_activity: Activity) {
when (currentAdType) {
Constant.GROMORE_INSERTSCREEN_AD -> {
interstitialGroManager?.showInteractionAd(_activity, wifiAdStatusListener)
if (interstitialGroManager != null) {
interstitialGroManager?.showInteractionAd(_activity, wifiAdStatusListener)
} else {
this.wifiAdStatusListener?.adFail()
}
}
Constant.GROMORE_FULL_AD -> {
fullGroManager?.showFullAd(_activity, wifiAdStatusListener)
if (fullGroManager != null) {
fullGroManager?.showFullAd(_activity, wifiAdStatusListener)
} else {
this.wifiAdStatusListener?.adFail()
}
}
else -> {
this.wifiAdStatusListener?.adFail()
}
}
}
......
......@@ -77,7 +77,6 @@ class ScreenLockerObserver(private val context: Context) {
)
)
// context.startActivity(Intent(context.unwrap(), LockerActivity::class.java))
}
override fun onResult(succeed: Boolean) {
......
......@@ -26,7 +26,6 @@ import com.mints.flowbox.ui.adapter.clean.CleanExpandAdapter
import com.mints.flowbox.ui.adapter.clean.ExpandInfo
import com.mints.flowbox.ui.adapter.clean.ExpandInfo.ChildInfo
import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import com.mints.flowbox.utils.FileUtils
import com.mints.flowbox.utils.SpanUtils
import kotlinx.android.synthetic.main.activity_clean.*
import kotlinx.android.synthetic.main.header_layout.*
......@@ -94,7 +93,6 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
}
override fun initViewsAndEvents() {
WifiAdManager.instance.loadWifiAd(this)
WifiAdManager.instance.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {}
......@@ -106,6 +104,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
toResult()
}
})
WifiAdManager.instance.loadWifiAd(this)
initView()
initCleanData()
......@@ -248,7 +247,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
isCleanCompleted = true
mCleanTimer?.cancel()
if (scanMax == 4) {
if (scanMax == 3) {
toResult()
}
......@@ -260,7 +259,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
1 -> btnClean.text = "正在清理 系统缓存..."
2 -> btnClean.text = "正在清理 临时文件..."
3 -> btnClean.text = "正在清理 广告垃圾..."
4 -> btnClean.text = "正在清理 安装包..."
// 4 -> btnClean.text = "正在清理 安装包..."
}
mCleanExpandAdapter?.let {
......@@ -271,11 +270,9 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
if (taskType == 0) {
cleaningOperation(mContext, mCleanList[taskType].childList)
if (scanMax == 1) {
Handler(Looper.getMainLooper()).postDelayed({
WifiAdManager.instance.showInterstitial(this@CleanActivity)
}, 2000)
}
Handler(Looper.getMainLooper()).postDelayed({
WifiAdManager.instance.showInterstitial(this@CleanActivity)
}, 2000)
}
// if (taskType == 1) {
......@@ -285,14 +282,14 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
// }
// }
if (taskType == 4) {
for (childInfo in mCleanList[taskType].childList) {
if (childInfo.filePath != null) {
FileUtils.deleteFile(childInfo.filePath)
FileUtils.updateFile(childInfo.filePath, this@CleanActivity)
}
}
}
// if (taskType == 4) {
// for (childInfo in mCleanList[taskType].childList) {
// if (childInfo.filePath != null) {
// FileUtils.deleteFile(childInfo.filePath)
// FileUtils.updateFile(childInfo.filePath, this@CleanActivity)
// }
// }
// }
// 清理动画
for (i in 0 until mCleanList[taskType].childList.size) {
......@@ -309,10 +306,6 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
}
taskType++
// if (taskType == scanMax) {
// 防止下标越界
// taskType--
// }
}
}
}, 200, STEP_Interval)
......
......@@ -62,7 +62,6 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
private var mIncreaseAdapter: IncreaseAdapter? = null
private var mIncreaseType = INCREASE2_WIFI_BOOST
private var mTimer: Timer? = null
......@@ -72,7 +71,6 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
override fun getContentViewLayoutID() = R.layout.activity_increasespeed2
override fun initViewsAndEvents() {
WifiAdManager.instance.loadWifiAd(this)
WifiAdManager.instance.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {}
......@@ -84,6 +82,7 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
showUiStatus()
}
})
WifiAdManager.instance.loadWifiAd(this)
initView()
......@@ -99,7 +98,6 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
} else {
containerAnim.setBackgroundColor(Color.parseColor("#8278DC"))
GlideUtils.loadImageViewGif(this, R.drawable.safe_check, iv_gif)
mTimerMax = 9
NumAnimUtil.startAnim(tv_progress, 100f, ((mTimerMax - 6) * STEP_Interval))
}
......@@ -111,7 +109,6 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
step++
if (step == mTimerMax - 2) {
WifiAdManager.instance.showInterstitial(this@Increasespeed2Activity)
mTimer?.cancel()
}
}
}
......@@ -121,6 +118,7 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
private fun showUiStatus() {
containerAnim.visibility = View.GONE
container.visibility = View.VISIBLE
headerContainer.visibility = View.VISIBLE
if (mIncreaseType == INCREASE2_SAFE_CHECK) {
ivGif2.visibility = View.VISIBLE
tvInfo2.visibility = View.VISIBLE
......@@ -203,8 +201,6 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
mTimer?.cancel()
mTimer = null
WifiAdManager.instance.onDestroy()
fl_ad?.removeAllViews()
super.onDestroy()
}
......
......@@ -77,7 +77,6 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
containerAnim.visibility = View.VISIBLE
startTimer()
} else if (mIncreaseType == INCREASE_SAVE_ELECTRICITY && AppConfig.isCanSaveBattery) {
WifiAdManager.instance.loadWifiAd(this)
WifiAdManager.instance.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {}
......@@ -89,6 +88,7 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
showUiStatus()
}
})
WifiAdManager.instance.loadWifiAd(this)
container.visibility = View.GONE
containerAnim.visibility = View.VISIBLE
......@@ -137,13 +137,13 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
mTimer?.cancel()
// 一键清理
val bundle = Bundle()
bundle.putInt(Constant.SCAN_TYPE, 5)
bundle.putInt(Constant.SCAN_TYPE, 4)
readyGoThenKill(CleanActivity::class.java, bundle)
return@runOnUiThread
}
INCREASE_BOOST -> {
mTimer?.cancel()
// 一键清理
// 一键加速
val bundle = Bundle()
bundle.putInt(Constant.SCAN_TYPE, 1)
readyGoThenKill(CleanActivity::class.java, bundle)
......
......@@ -38,7 +38,6 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
initView()
// 动画结束后 展示插屏广告
WifiAdManager.instance.loadWifiAd(this)
WifiAdManager.instance.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {
}
......@@ -48,6 +47,7 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
override fun adClose() {}
})
WifiAdManager.instance.loadWifiAd(this)
}
fun startTimer() {
......
......@@ -49,7 +49,6 @@ class SpeedTestActivity : BaseActivity(), View.OnClickListener {
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
WifiAdManager.instance.loadWifiAd(this)
WifiAdManager.instance.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {
}
......@@ -62,6 +61,7 @@ class SpeedTestActivity : BaseActivity(), View.OnClickListener {
endTest()
}
})
WifiAdManager.instance.loadWifiAd(this)
initView()
......
......@@ -55,13 +55,13 @@ abstract class OutAppActivity : BaseSwipeBackCompatActivity(), ScreenMonitor.Lis
if (!useNewWay) {
window.setWindowAnimations(R.style.AppTheme_LockScreen_Animation)
val layoutParams = window.attributes
val isUsingShowWhenLockedFlag =
!ScreenLockerUtils.isLockScreenProtected(this) && !ScreenLockerObserver.shouldShowLockerAfterUserPresent()
ScreenLockerUtils.makeLockWindowFullScreen(
this,
layoutParams,
isUsingShowWhenLockedFlag
)
// val isUsingShowWhenLockedFlag =
// !ScreenLockerUtils.isLockScreenProtected(this) && !ScreenLockerObserver.shouldShowLockerAfterUserPresent()
// ScreenLockerUtils.makeLockWindowFullScreen(
// this,
// layoutParams,
// isUsingShowWhenLockedFlag
// )
window.attributes = layoutParams
window.statusBarColor = Color.TRANSPARENT
window.navigationBarColor = Color.TRANSPARENT
......
......@@ -87,7 +87,7 @@ class ApkActivity : BaseActivity() {
btnClean.setOnClickListener {
// 一键清理
val bundle = Bundle()
bundle.putInt(Constant.SCAN_TYPE, 5)
bundle.putInt(Constant.SCAN_TYPE, 4)
readyGoThenKill(CleanActivity::class.java, bundle)
}
}
......
......@@ -138,11 +138,6 @@ class BoostFastActivity : BaseActivity() {
}
}
override fun onDestroy() {
WifiAdManager.instance.onDestroy()
super.onDestroy()
}
override fun onResume() {
super.onResume()
initExpress()
......
......@@ -14,6 +14,10 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/header_layout"
android:visibility="gone" />
<RelativeLayout
android:id="@+id/containerAnim"
android:layout_width="match_parent"
......@@ -47,8 +51,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<RelativeLayout
android:id="@+id/header"
android:layout_width="wrap_content"
......@@ -56,11 +58,6 @@
android:layout_gravity="center_horizontal"
android:visibility="gone">
<!-- <com.mints.flowbox.ui.widgets.DrawHookView-->
<!-- android:id="@+id/dhv"-->
<!-- android:layout_width="50dp"-->
<!-- android:layout_height="50dp" />-->
<ImageView
android:id="@+id/ivGif"
android:layout_width="200dp"
......
......@@ -11,7 +11,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="15dp"
android:layout_marginTop="100dp"
android:layout_marginTop="80dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_bg_write"
android:orientation="vertical">
......
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