Commit 954bb67e authored by jyx's avatar jyx

清理结果页添加曝光入口

parent 7de8c1d9
......@@ -11,7 +11,6 @@
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.SYSTEM_OVERLAY_WINDOW" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.INTERNET" />
......@@ -43,7 +42,6 @@
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" /> <!-- 蘑菇星球 -->
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<permission
android:name="com.mints.flowbox.permission"
......
......@@ -50,8 +50,8 @@ class AppOutScreenGroMoreCarrierExpressManager : TTSettingConfigCallback {
fun loadADFrameLayout() {
if (AntiShake.check(Random.nextInt(1234)) || AntiAuditManager.instance.isBlack()) return
val isOversped = TimeRender.isOversped45Min(adLoadTime, 45)
val isPreingOversped = TimeRender.isOversped45Min(adPreingTime, 2)
val isOversped = TimeRender.isOverspedMin(adLoadTime, 45)
val isPreingOversped = TimeRender.isOverspedMin(adPreingTime, 2)
if ((isLoadSuccess == 0 // 加载失败
|| adLoadTime > 0 && isOversped // 超过45分钟
......@@ -125,7 +125,7 @@ class AppOutScreenGroMoreCarrierExpressManager : TTSettingConfigCallback {
.setTTVideoOption(videoOption) //视频声音相关的配置
.setAdmobNativeAdOptions(admobNativeAdOptions)
.setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
.setImageAdSize(340, 0) // 必选参数 单位dp ,详情见上面备注解释
.setImageAdSize(330, 0) // 必选参数 单位dp ,详情见上面备注解释
.setAdCount(1) //请求广告数量为1到3条
.setGdtNativeAdLogoParams(gdtNativeAdLogUtiloParams) // 设置gdt logo布局参数。
.build()
......@@ -178,7 +178,7 @@ class AppOutScreenGroMoreCarrierExpressManager : TTSettingConfigCallback {
}
fun getAdView(callback: ExpressAdCallback) {
val isOversped = TimeRender.isOversped45Min(adLoadTime, 45)
val isOversped = TimeRender.isOverspedMin(adLoadTime, 45)
// 若上一个广告还在加载中则返回
if (isLoadSuccess == 1) {
return
......
......@@ -50,8 +50,8 @@ class AppOutSimpleGroMoreCarrierExpressManager : TTSettingConfigCallback {
fun loadADFrameLayout() {
if (AntiShake.check(Random.nextInt(1234)) || AntiAuditManager.instance.isBlack()) return
val isOversped = TimeRender.isOversped45Min(adLoadTime, 45)
val isPreingOversped = TimeRender.isOversped45Min(adPreingTime, 2)
val isOversped = TimeRender.isOverspedMin(adLoadTime, 45)
val isPreingOversped = TimeRender.isOverspedMin(adPreingTime, 2)
if ((isLoadSuccess == 0 // 加载失败
|| adLoadTime > 0 && isOversped // 超过45分钟
......@@ -123,7 +123,7 @@ class AppOutSimpleGroMoreCarrierExpressManager : TTSettingConfigCallback {
.setTTVideoOption(videoOption) //视频声音相关的配置
.setAdmobNativeAdOptions(admobNativeAdOptions)
.setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
.setImageAdSize(340, 0) // 必选参数 单位dp ,详情见上面备注解释
.setImageAdSize(330, 0) // 必选参数 单位dp ,详情见上面备注解释
.setAdCount(1) //请求广告数量为1到3条
.setGdtNativeAdLogoParams(gdtNativeAdLogUtiloParams) // 设置gdt logo布局参数。
.build()
......@@ -178,7 +178,7 @@ class AppOutSimpleGroMoreCarrierExpressManager : TTSettingConfigCallback {
}
fun getAdView(callback: ExpressAdCallback) {
val isOversped = TimeRender.isOversped45Min(adLoadTime, 45)
val isOversped = TimeRender.isOverspedMin(adLoadTime, 45)
// 若上一个广告还在加载中则返回
if (isLoadSuccess == 1) {
return
......
......@@ -130,7 +130,7 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
.setTTVideoOption(videoOption) //视频声音相关的配置
.setAdmobNativeAdOptions(admobNativeAdOptions)
.setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
.setImageAdSize(340, 0) // 必选参数 单位dp ,详情见上面备注解释
.setImageAdSize(330, 0) // 必选参数 单位dp ,详情见上面备注解释
.setAdCount(1) //请求广告数量为1到3条
.setGdtNativeAdLogoParams(gdtNativeAdLogUtiloParams) // 设置gdt logo布局参数。
.build()
......
package com.mints.flowbox.ad.express
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.RelativeLayout
import com.mints.flowbox.common.AppConfig
/**
......@@ -43,13 +41,4 @@ object ExpressManager {
fun getAppOutExpressFrameLayout(): FrameLayout? {
return AppOutGroMoreCarrierExpressManager.instance.getADFrameLayout()
}
val lp = RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT
)
init {
lp.addRule(RelativeLayout.CENTER_HORIZONTAL)
}
}
\ No newline at end of file
......@@ -114,6 +114,8 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
Gravity.END or Gravity.TOP
) // 例如,放在右上角
val adWidth =
BubbleUtils.getScreenWidthDp(MintsApplication.getContext()) - BubbleUtils.dp2px(30)
/**
* 创建feed广告请求类型参数AdSlot,具体参数含义参考文档
* 备注
......@@ -130,7 +132,7 @@ class GroMoreCarrierExpressManager : TTSettingConfigCallback {
.setTTVideoOption(videoOption) //视频声音相关的配置
.setAdmobNativeAdOptions(admobNativeAdOptions)
.setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
.setImageAdSize(340, 0) // 必选参数 单位dp ,详情见上面备注解释
.setImageAdSize(330, 0) // 必选参数 单位dp ,详情见上面备注解释
.setAdCount(1) //请求广告数量为1到3条
.setGdtNativeAdLogoParams(gdtNativeAdLogUtiloParams) // 设置gdt logo布局参数。
.build()
......
......@@ -107,7 +107,7 @@ class GroMoreExpressManager : TTSettingConfigCallback {
.setTTVideoOption(videoOption) //视频声音相关的配置
.setAdmobNativeAdOptions(admobNativeAdOptions)
.setAdStyleType(mAdStyle) //必传,表示请求的模板广告还是原生广告,AdSlot.TYPE_EXPRESS_AD:模板广告 ; AdSlot.TYPE_NATIVE_AD:原生广告
.setImageAdSize(340, 0) // 必选参数 单位dp ,详情见上面备注解释
.setImageAdSize(330, 0) // 必选参数 单位dp ,详情见上面备注解释
.setAdCount(1) //请求广告数量为1到3条
.setGdtNativeAdLogoParams(gdtNativeAdLogUtiloParams) // 设置gdt logo布局参数。
.build()
......
......@@ -21,8 +21,8 @@ class PreOutExpressManager {
private var isLoadSuccess = 0 //0-加载失败/未加载 1-加载中 2-加载成功
fun preloadExpress() {
val isOversped = TimeRender.isOversped45Min(adLoadTime, 45)
val isPreingOversped = TimeRender.isOversped45Min(adPreingTime, 2)
val isOversped = TimeRender.isOverspedMin(adLoadTime, 45)
val isPreingOversped = TimeRender.isOverspedMin(adPreingTime, 2)
if (BuildConfig.DEBUG) {
LogUtil.d(
......
......@@ -82,8 +82,8 @@ public class PreCsjGroMoreVideoAdManager extends BaseVideoAd {
*/
public void preLoadAd(Activity activity) {
this.activity = new WeakReference<>(activity);
boolean isOversped = TimeRender.isOversped45Min(adLoadTime, 45);
boolean isPreingOversped = TimeRender.isOversped45Min(adPreingTime, 2);
boolean isOversped = TimeRender.isOverspedMin(adLoadTime, 45);
boolean isPreingOversped = TimeRender.isOverspedMin(adPreingTime, 2);
if (BuildConfig.DEBUG) {
LogUtil.d(TAG, "1、进入预加载 isLoadSuccess=" + isLoadSuccess + " isOversped=" + isOversped + " activity=" + this.activity.get() + " isPreingOversped=" + isPreingOversped);
}
......@@ -117,7 +117,7 @@ public class PreCsjGroMoreVideoAdManager extends BaseVideoAd {
*/
public void showAd(Activity activity, int curCoin, String carrierType, String extraId) {
this.activity = new WeakReference<>(activity);
boolean isOversped = TimeRender.isOversped45Min(adLoadTime, 45);
boolean isOversped = TimeRender.isOverspedMin(adLoadTime, 45);
// 若上一个广告还在加载中则返回
if (isLoadSuccess == 1) {
ToastUtil.show(this.activity.get(), "加载太快了,请休息一下吧");
......
......@@ -194,6 +194,13 @@ public class AppConfig {
/* 当前耗电应用数 */
public static int fakeSaveBatteryMinter = 0;
/* 上次加速操作时间 */
public static long fakeBoostTime = 0L;
/* 上次清理操作时间 */
public static long fakeCleanTime = 0L;
/* 上次省电操作时间 */
public static long fakeSaveBatteryTime = 0L;
/*是否可以 一键加速 */
public static boolean isCanBoost = true;
/*是否可以 一键清理 */
......
......@@ -97,7 +97,7 @@ class FoodSubsidyActivity : BaseActivity(), View.OnClickListener, FoodSubsidyVie
try {
if (fl_ad != null && ExpressManager.getExpressFrameLayout() != null) {
fl_ad?.removeAllViews()
fl_ad?.addView(ExpressManager.getExpressFrameLayout(), ExpressManager.lp)
fl_ad?.addView(ExpressManager.getExpressFrameLayout())
} else {
fl_ad?.removeAllViews()
ExpressManager.loadExpress(true, fl_ad)
......
......@@ -3,8 +3,6 @@ package com.mints.flowbox.ui.activitys
import android.graphics.Color
import android.os.Bundle
import android.view.View
import android.view.animation.AnimationUtils
import android.view.animation.LayoutAnimationController
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
......@@ -12,22 +10,22 @@ import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.wifi.WifiAdManager
import com.mints.flowbox.ad.wifi.WifiAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.adapter.CleanListAdapter
import com.mints.flowbox.ui.adapter.IncreaseAdapter
import com.mints.flowbox.ui.adapter.listener.OnItemClickListener
import com.mints.flowbox.ui.widgets.NumAnimUtil
import com.mints.flowbox.utils.SpanUtils
import com.mints.flowbox.ui.widgets.RecyItemDecoration
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_increasespeed.*
import kotlinx.android.synthetic.main.activity_increasespeed2.*
import kotlinx.android.synthetic.main.activity_increasespeed2.container
import kotlinx.android.synthetic.main.activity_increasespeed2.containerAnim
import kotlinx.android.synthetic.main.activity_increasespeed2.fl_ad
import kotlinx.android.synthetic.main.activity_increasespeed2.iv_gif
import kotlinx.android.synthetic.main.activity_increasespeed2.tv_progress
import kotlinx.android.synthetic.main.activity_increasespeed2.tv_title_1
import kotlinx.android.synthetic.main.header_layout.*
import java.util.*
import kotlin.random.Random
/**
* 安全检测结果页
......@@ -43,6 +41,11 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
const val STEP_Interval = 300L
}
private val mPlaceStr = mutableListOf(
"加强WiFi加密安全性",
"检测无ARP网络攻击异常"
)
private val mStringArr1 = mutableListOf(
"加强WiFi加密安全性",
"检测无ARP网络攻击异常",
......@@ -86,7 +89,6 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
WifiAdManager.instance.loadWifiAd(this)
initView()
startTimer()
}
......@@ -141,36 +143,47 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
line.visibility = View.GONE
when (mIncreaseType) {
INCREASE2_WIFI_BOOST -> {
header.visibility = View.VISIBLE
// when (mIncreaseType) {
// INCREASE2_WIFI_BOOST -> {
// header.visibility = View.VISIBLE
//
// tv_title.text = "一键提速"
//
// tv_title_1.text = SpanUtils()
// .append("网速已经提升")
// .append("${2 + Random.nextInt(6)}%")
// .setForegroundColor(ContextCompat.getColor(this, R.color.color_FFDD0C))
// .create()
//
// mIncreaseAdapter = IncreaseAdapter(this, mStringArr2)
// }
// INCREASE2_SAFE_CHECK -> {
tv_title.text = "安全检测"
mIncreaseAdapter = IncreaseAdapter(this, mPlaceStr)
// }
// }
// val lac =
// LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.layout_left_in))
// lac.delay = 1f
// lac.order = LayoutAnimationController.ORDER_NORMAL
tv_title.text = "一键提速"
tv_title_1.text = SpanUtils()
.append("网速已经提升")
.append("${2 + Random.nextInt(6)}%")
.setForegroundColor(ContextCompat.getColor(this, R.color.color_FFDD0C))
.create()
mIncreaseAdapter = IncreaseAdapter(this, mStringArr2)
}
INCREASE2_SAFE_CHECK -> {
tv_title.text = "安全检测"
mIncreaseAdapter = IncreaseAdapter(this, mStringArr1)
recycleView.layoutManager = LinearLayoutManager(this)
// recycleView.layoutAnimation = lac
recycleView.addItemDecoration(RecyItemDecoration(this, DividerItemDecoration.VERTICAL))
recycleView.adapter = mIncreaseAdapter
mIncreaseAdapter?.setOnItemClickListener(object : OnItemClickListener {
override fun onItemClick(view: View?, position: Int) {
mPlaceStr.clear()
mPlaceStr.addAll(mStringArr1)
mIncreaseAdapter?.notifyDataSetChanged()
mIncreaseAdapter?.setOnItemClickListener(null)
}
}
val lac =
LayoutAnimationController(AnimationUtils.loadAnimation(this, R.anim.layout_left_in))
lac.delay = 1f
lac.order = LayoutAnimationController.ORDER_NORMAL
})
recycleView.layoutManager = LinearLayoutManager(this)
recycleView.layoutAnimation = lac
recycleView.addItemDecoration(DividerItemDecoration(this, DividerItemDecoration.VERTICAL))
recycleView.adapter = mIncreaseAdapter
cleanData()
}
override fun getBundleExtras(extras: Bundle?) {
......@@ -183,14 +196,14 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
}
}
override fun isApplyKitKatTranslucency() = false
override fun onResume() {
super.onResume()
initExpress()
}
override fun isApplyKitKatTranslucency() = false
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_left_icon -> {
......@@ -214,7 +227,7 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
try {
if (fl_ad != null && ExpressManager.getExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout(), ExpressManager.lp)
fl_ad.addView(ExpressManager.getExpressFrameLayout())
} else {
fl_ad.removeAllViews()
ExpressManager.loadExpress(false, fl_ad)
......@@ -223,4 +236,54 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
e.printStackTrace()
}
}
private fun cleanData() {
val cleanData = mutableListOf(
IncreasespeedActivity.INCREASE_BOOST,
IncreasespeedActivity.INCREASE_CLEAN,
IncreasespeedActivity.INCREASE_SAVE_ELECTRICITY
)
recy_clean.layoutManager = LinearLayoutManager(this)
val cleanAdapter = CleanListAdapter(this, cleanData)
recy_clean.adapter = cleanAdapter
cleanAdapter.setOnItemClickListener(object : OnItemClickListener {
override fun onItemClick(view: View?, position: Int) {
// 预加载信息流
ExpressManager.loadExpress(false)
when (cleanData[position]) {
IncreasespeedActivity.INCREASE_BOOST -> {
AppConfig.isCanBoost = true
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
}
IncreasespeedActivity.INCREASE_CLEAN -> {
AppConfig.isCanClean = true
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_CLEAN
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
IncreasespeedActivity.INCREASE_SAVE_ELECTRICITY -> {
AppConfig.isCanSaveBattery = true
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_SAVE_ELECTRICITY
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
}
}
})
}
}
......@@ -5,8 +5,10 @@ import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.text.Spannable
import android.text.TextUtils
import android.view.View
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.LinearLayoutManager
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.wifi.WifiAdManager
......@@ -14,8 +16,11 @@ import com.mints.flowbox.ad.wifi.WifiAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.adapter.CleanListAdapter
import com.mints.flowbox.ui.adapter.listener.OnItemClickListener
import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import com.mints.flowbox.utils.SpanUtils
import com.mints.flowbox.utils.TimeRender
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_boost_fast.*
import kotlinx.android.synthetic.main.activity_increasespeed.*
......@@ -23,7 +28,10 @@ import kotlinx.android.synthetic.main.activity_increasespeed.container
import kotlinx.android.synthetic.main.activity_increasespeed.containerAnim
import kotlinx.android.synthetic.main.activity_increasespeed.fl_ad
import kotlinx.android.synthetic.main.activity_increasespeed.iv_gif
import kotlinx.android.synthetic.main.activity_increasespeed.recy_clean
import kotlinx.android.synthetic.main.activity_increasespeed.tv_progress
import kotlinx.android.synthetic.main.activity_increasespeed.tv_title_1
import kotlinx.android.synthetic.main.activity_increasespeed2.*
import kotlinx.android.synthetic.main.header_layout.*
import java.util.*
import kotlin.random.Random
......@@ -171,6 +179,8 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
containerAnim.visibility = View.GONE
container.visibility = View.VISIBLE
initView()
cleanData()
resetTime()
}
private fun initView() {
......@@ -256,7 +266,6 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
override fun onResume() {
super.onResume()
initExpress()
}
......@@ -274,7 +283,7 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
try {
if (fl_ad != null && ExpressManager.getExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout(), ExpressManager.lp)
fl_ad.addView(ExpressManager.getExpressFrameLayout())
} else {
fl_ad.removeAllViews()
ExpressManager.loadExpress(false, fl_ad)
......@@ -283,4 +292,87 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
e.printStackTrace()
}
}
private fun cleanData() {
val cleanData = mutableListOf<String>()
// 是否超过两分钟
if (TimeRender.isOverspedMin(AppConfig.fakeBoostTime, 2)) {
cleanData.add(INCREASE_BOOST)
}
if (TimeRender.isOverspedMin(AppConfig.fakeCleanTime, 2)) {
cleanData.add(INCREASE_CLEAN)
}
if (TimeRender.isOverspedMin(AppConfig.fakeSaveBatteryTime, 2)) {
cleanData.add(INCREASE_SAVE_ELECTRICITY)
}
if (cleanData.size == 0) return
for (cleanDatum in cleanData) {
if (TextUtils.equals(cleanDatum, mIncreaseType)) {
cleanData.remove(cleanDatum)
}
}
if (cleanData.size == 0) return
recy_clean.layoutManager = LinearLayoutManager(this)
val cleanAdapter = CleanListAdapter(this, cleanData)
recy_clean.adapter = cleanAdapter
cleanAdapter.setOnItemClickListener(object : OnItemClickListener {
override fun onItemClick(view: View?, position: Int) {
// 预加载信息流
ExpressManager.loadExpress(false)
when (cleanData[position]) {
INCREASE_BOOST -> {
AppConfig.isCanBoost = true
val bundle = Bundle()
bundle.putString(
INCREASE_TYPE,
INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
}
INCREASE_CLEAN -> {
AppConfig.isCanClean = true
val bundle = Bundle()
bundle.putString(
INCREASE_TYPE,
INCREASE_CLEAN
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
INCREASE_SAVE_ELECTRICITY -> {
AppConfig.isCanSaveBattery = true
val bundle = Bundle()
bundle.putString(
INCREASE_TYPE,
INCREASE_SAVE_ELECTRICITY
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
}
}
})
}
private fun resetTime() {
when (mIncreaseType) {
INCREASE_BOOST -> {
AppConfig.fakeBoostTime = System.currentTimeMillis()
}
INCREASE_CLEAN -> {
AppConfig.fakeCleanTime = System.currentTimeMillis()
}
INCREASE_SAVE_ELECTRICITY -> {
AppConfig.fakeSaveBatteryTime = System.currentTimeMillis()
}
}
}
}
......@@ -106,7 +106,7 @@ class WalkActivity : BaseActivity(), View.OnClickListener, WalkView, StepView.St
try {
if (fl_ad != null && ExpressManager.getExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout(), ExpressManager.lp)
fl_ad.addView(ExpressManager.getExpressFrameLayout())
} else {
fl_ad.removeAllViews()
ExpressManager.loadExpress(true, fl_ad)
......
......@@ -111,7 +111,7 @@ class WaterActivity : BaseActivity(), View.OnClickListener, WaterView.WaterViewL
try {
if (fl_ad != null && ExpressManager.getExpressFrameLayout() != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout(), ExpressManager.lp)
fl_ad.addView(ExpressManager.getExpressFrameLayout())
} else {
fl_ad.removeAllViews()
ExpressManager.loadExpress(true, fl_ad)
......
......@@ -10,7 +10,6 @@ import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R
import com.mints.flowbox.ad.AppOutSimpleGroMoreCarrierExpressManager
import com.mints.flowbox.ad.ExpressAdCallback
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.Constant
import com.mints.flowbox.ui.activitys.CleanActivity
import com.mints.flowbox.ui.activitys.base.BaseActivity
......@@ -122,7 +121,7 @@ class ApkActivity : BaseActivity() {
AppOutSimpleGroMoreCarrierExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
fl_ad.removeAllViews()
fl_ad.addView(adView, ExpressManager.lp)
fl_ad.addView(adView)
}
override fun loadingFail() {
......
......@@ -136,7 +136,7 @@ class BoostFastActivity : Activity() {
AppOutSimpleGroMoreCarrierExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
fl_ad.removeAllViews()
fl_ad.addView(adView, ExpressManager.lp)
fl_ad.addView(adView)
}
override fun loadingFail() {
......
......@@ -98,7 +98,7 @@ class ScreenActivity : OutAppActivity(), View.OnClickListener {
AppOutScreenGroMoreCarrierExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
fl_ad.removeAllViews()
fl_ad.addView(adView, ExpressManager.lp)
fl_ad.addView(adView)
}
override fun loadingFail() {
......
......@@ -237,7 +237,7 @@ class TriggerActivity : BaseActivity() {
AppOutSimpleGroMoreCarrierExpressManager.instance.getAdView(object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
fl_ad.removeAllViews()
fl_ad.addView(adView, ExpressManager.lp)
fl_ad.addView(adView)
}
override fun loadingFail() {
......
package com.mints.flowbox.ui.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.mints.flowbox.R
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.ui.activitys.IncreasespeedActivity
import com.mints.flowbox.ui.adapter.listener.OnItemClickListener
import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import com.mints.flowbox.utils.SpanUtils
import com.mints.flowbox.utils.SystemUtils
class CleanListAdapter(
private val context: Context,
private val dataList: MutableList<String>
) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var mOnItemClickListener: OnItemClickListener? = null
fun setOnItemClickListener(onItemClickListener: OnItemClickListener) {
mOnItemClickListener = onItemClickListener
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val inflater: LayoutInflater = LayoutInflater.from(context)
return TaskHolder(inflater.inflate(R.layout.item_recy_clean, parent, false))
}
override fun getItemCount(): Int {
return dataList.size
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
holder.itemView.setOnClickListener {
mOnItemClickListener?.onItemClick(it, position)
}
val data = dataList[position]
if (holder is TaskHolder) {
when (data) {
IncreasespeedActivity.INCREASE_BOOST -> {
val usedPercentValue = SystemUtils.getUsedPercentValue(context)
holder.itemTaskTitle.text = SpanUtils()
.append("当前内存占用")
.setForegroundColor(ContextCompat.getColor(context, R.color.gray))
.append("${usedPercentValue}%")
.setForegroundColor(ContextCompat.getColor(context, R.color.red))
.create()
holder.itemTaskInfo.text = "优化手机内存,加速手机"
holder.itemTaskClick.text = "立即加速"
holder.itemTaskImg.setImageResource(R.mipmap.ic_main_jiasu)
}
IncreasespeedActivity.INCREASE_CLEAN -> {
holder.itemTaskTitle.text = SpanUtils()
.append("大量文件")
.setForegroundColor(ContextCompat.getColor(context, R.color.red))
.append("待清理")
.setForegroundColor(ContextCompat.getColor(context, R.color.gray))
.create()
holder.itemTaskInfo.text = "存储空间即将不足"
holder.itemTaskClick.text = "立即清理"
holder.itemTaskImg.setImageResource(R.mipmap.ic_main_clean)
}
IncreasespeedActivity.INCREASE_SAVE_ELECTRICITY -> {
holder.itemTaskTitle.text = SpanUtils()
.append("${AppConfig.fakeSaveBatteryCount}个")
.setForegroundColor(ContextCompat.getColor(context, R.color.red))
.append("耗电应用")
.setForegroundColor(ContextCompat.getColor(context, R.color.gray))
.create()
holder.itemTaskInfo.text = "当前手机电量消耗较快"
holder.itemTaskClick.text = "立即省电"
holder.itemTaskImg.setImageResource(R.mipmap.ic_main_shengdian)
}
}
}
}
private inner class TaskHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val itemTaskImg: ImageView = itemView.findViewById(R.id.item_title_img)
val itemTaskTitle: TextView = itemView.findViewById(R.id.item_task_title)
val itemTaskInfo: TextView = itemView.findViewById(R.id.item_task_info)
val itemTaskClick: TextView = itemView.findViewById(R.id.item_task_click)
}
}
\ No newline at end of file
......@@ -14,24 +14,50 @@ import com.mints.flowbox.ui.adapter.listener.OnItemClickListener
class IncreaseAdapter(val context: Context, val taskData: MutableList<String>) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
companion object {
const val HOLDER_TYPE_SIMPLE = 0
const val HOLDER_TYPE_MORE = 1
}
private var mOnItemClickListener: OnItemClickListener? = null
fun setOnItemClickListener(onItemClickListener: OnItemClickListener) {
fun setOnItemClickListener(onItemClickListener: OnItemClickListener?) {
mOnItemClickListener = onItemClickListener
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if (viewType == HOLDER_TYPE_MORE) {
val emptyView =
LayoutInflater.from(parent.context)
.inflate(R.layout.item_recyclerview_more, parent, false)
return MoreHolder(emptyView)
}
val inflater: LayoutInflater = LayoutInflater.from(context)
return IncreaseHolder(inflater.inflate(R.layout.item_recyclerview_increase, parent, false))
}
override fun getItemCount(): Int {
return taskData.size
return if (taskData.size == 2) {
3
} else {
taskData.size
}
}
override fun getItemViewType(position: Int): Int {
if (taskData.size == 2 && position == 2) {
return HOLDER_TYPE_MORE
}
return HOLDER_TYPE_SIMPLE
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
holder.itemView.setOnClickListener {
mOnItemClickListener?.onItemClick(it, position)
if (holder is MoreHolder) {
holder.itemView.setOnClickListener {
mOnItemClickListener?.onItemClick(it, position)
}
return
}
val increaseHolder = holder as IncreaseHolder
......@@ -49,4 +75,6 @@ class IncreaseAdapter(val context: Context, val taskData: MutableList<String>) :
val tv1: TextView = itemView.findViewById(R.id.tv1)
val iv1: ImageView = itemView.findViewById(R.id.iv1)
}
private inner class MoreHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {}
}
\ No newline at end of file
......@@ -31,6 +31,7 @@ import com.mints.flowbox.ui.adapter.MainTurnAdapter
import com.mints.flowbox.ui.adapter.ViewPagerAdapter
import com.mints.flowbox.ui.adapter.listener.OnItemChildClickListener
import com.mints.flowbox.ui.fragment.base.BaseFragment
import com.mints.flowbox.ui.widgets.RecyItemDecoration
import com.mints.flowbox.ui.widgets.WifiView
import com.mints.flowbox.utils.WifiUtils
import com.mints.library.net.netstatus.NetUtils
......@@ -83,7 +84,7 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
private fun initRecy() {
recy_task.addItemDecoration(
DividerItemDecoration(
RecyItemDecoration(
requireContext(),
DividerItemDecoration.VERTICAL
)
......
......@@ -36,6 +36,7 @@ import com.mints.flowbox.ui.activitys.*
import com.mints.flowbox.ui.adapter.MainMyAdapter
import com.mints.flowbox.ui.adapter.listener.OnItemChildClickListener
import com.mints.flowbox.ui.fragment.base.BaseFragment
import com.mints.flowbox.ui.widgets.RecyItemDecoration
import com.mints.flowbox.ui.widgets.dialog.DialogListener
import com.mints.flowbox.ui.widgets.dialog.DialogUtils
import com.mints.flowbox.ui.widgets.dialog.ShareDialog
......@@ -770,7 +771,7 @@ class MyFragment : BaseFragment(),
/** 初始化任务列表 */
private fun initRecy() {
recy_my.addItemDecoration(DividerItemDecoration(mContext, DividerItemDecoration.VERTICAL))
recy_my.addItemDecoration(RecyItemDecoration(mContext, DividerItemDecoration.VERTICAL))
recy_my.setItemViewCacheSize(10)
mainMyAdapter = MainMyAdapter(mContext, dataList)
recy_my.adapter = mainMyAdapter
......
......@@ -148,6 +148,7 @@ public class WifiView extends FrameLayout implements View.OnClickListener {
}
setTitle("WIFI已连接");
tvInfo.setText("每5分钟可领取一次补贴金币");
for (int i = 0; i < mCount; i++) {
if (i <= 4) {
......
package com.mints.flowbox.ui.widgets.seekbar;
import android.content.Context;
import android.content.res.Resources;
import android.os.Environment;
import android.util.DisplayMetrics;
import android.util.TypedValue;
import android.view.WindowManager;
import java.io.File;
import java.io.FileInputStream;
......@@ -42,4 +45,26 @@ public class BubbleUtils {
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp,
Resources.getSystem().getDisplayMetrics());
}
public static int[] getScreenDpSize(Context context) {
WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics dm = new DisplayMetrics();
wm.getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;// 屏幕宽度(像素)
int height = dm.heightPixels; // 屏幕高度(像素)
float density = dm.density;//屏幕密度(0.75 / 1.0 / 1.5)
int densityDpi = dm.densityDpi;//屏幕密度dpi(120 / 160 / 240)
//屏幕宽度算法:屏幕宽度(像素)/屏幕密度
int screenWidth = (int) (width / density);//屏幕宽度(dp)
int screenHeight = (int) (height / density);//屏幕高度(dp)
return new int[]{screenWidth, screenHeight};
}
public static int getScreenWidthDp(Context context) {
return getScreenDpSize(context)[0];
}
public static int getScreenHeightDp(Context context) {
return getScreenDpSize(context)[1];
}
}
\ No newline at end of file
......@@ -297,13 +297,13 @@ public class TimeRender {
* @param adPreLoadTime 广告预加载时间
* @return true-超过outMin分钟
*/
public static boolean isOversped45Min(long adPreLoadTime,int outMin) {
long time= (System.currentTimeMillis() - adPreLoadTime) / (1000 * 60);
public static boolean isOverspedMin(long adPreLoadTime, int outMin) {
long time = (System.currentTimeMillis() - adPreLoadTime) / (1000 * 60);
// LogUtil.d("PreCsjGroMoreVideoAdManager","adPreLoadTime="+adPreLoadTime+"time="+time);
if(time>outMin&&adPreLoadTime>0){
return true;
}
return false;
if (time > outMin && adPreLoadTime > 0) {
return true;
}
return false;
}
......
......@@ -3,6 +3,7 @@
android:shape="rectangle">
<solid android:color="#ffffffff" />
<!-- <solid android:color="#ff0" />-->
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
......@@ -95,6 +95,13 @@
android:background="@drawable/shape_gold_card"
android:elevation="2dip" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy_clean"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp" />
</LinearLayout>
</FrameLayout>
......
......@@ -102,7 +102,7 @@
android:paddingStart="10dp"
android:paddingTop="20dp"
android:paddingEnd="10dp"
android:paddingBottom="30dp" />
android:paddingBottom="10dp" />
<com.mints.flowbox.ui.widgets.RoundRectLayout
android:id="@+id/fl_ad"
......@@ -113,10 +113,16 @@
android:background="@drawable/shape_gold_card"
android:elevation="2dip" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recy_clean"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@drawable/shape_gold_card"
android:elevation="2dip"
android:padding="10dp">
<ImageView
android:id="@+id/item_title_img"
android:layout_width="40dp"
android:layout_height="40dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_task_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_marginBottom="8dp"
android:textSize="14sp"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/item_task_info"
app:layout_constraintStart_toEndOf="@+id/item_title_img"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/item_task_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="10dp"
android:layout_marginBottom="8dp"
android:textSize="12sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/item_title_img"
app:layout_constraintTop_toBottomOf="@id/item_task_title" />
<TextView
android:id="@+id/item_task_click"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_btn_clean"
android:gravity="center"
android:paddingStart="12dp"
android:paddingTop="4dp"
android:paddingEnd="12dp"
android:paddingBottom="4dp"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
......@@ -2,7 +2,6 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:padding="10dp">
<TextView
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/itemMore"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:drawableStart="@mipmap/ic_down_green"
android:drawablePadding="10dp"
android:text="更多"
android:textColor="@color/black" />
</RelativeLayout>
\ No newline at end of file
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