Commit 0b3c1526 authored by jyx's avatar jyx

更新应用外信息流展示,添加应用外弹窗权限

parent 030e7d21
...@@ -168,21 +168,28 @@ ...@@ -168,21 +168,28 @@
android:launchMode="singleInstance" /> android:launchMode="singleInstance" />
<activity <activity
android:name=".ui.activitys.ScreenActivity" android:name=".ui.activitys.keepalive.ScreenActivity"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:exported="false" android:exported="false"
android:finishOnTaskLaunch="false" android:finishOnTaskLaunch="false"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/CustomerTransparentTheme" /> android:theme="@style/CustomerTransparentTheme" />
<activity <activity
android:name=".ui.activitys.BoostActivity" android:name=".ui.activitys.keepalive.BoostActivity"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:exported="false" android:exported="false"
android:finishOnTaskLaunch="false" android:finishOnTaskLaunch="false"
android:launchMode="singleInstance" android:launchMode="singleInstance"
android:theme="@style/CustomerTransparentTheme" /> android:theme="@style/CustomerTransparentTheme" />
<activity <activity
android:name=".ui.activitys.ApkActivity" android:name=".ui.activitys.keepalive.ApkActivity"
android:excludeFromRecents="true"
android:exported="false"
android:finishOnTaskLaunch="false"
android:launchMode="singleInstance"
android:theme="@style/CustomerTransparentTheme" />
<activity
android:name=".ui.activitys.keepalive.TimingActivity"
android:excludeFromRecents="true" android:excludeFromRecents="true"
android:exported="false" android:exported="false"
android:finishOnTaskLaunch="false" android:finishOnTaskLaunch="false"
......
...@@ -20,11 +20,9 @@ import com.mints.flowbox.ad.express.ExpressManager; ...@@ -20,11 +20,9 @@ import com.mints.flowbox.ad.express.ExpressManager;
import com.mints.flowbox.common.Constant; import com.mints.flowbox.common.Constant;
import com.mints.flowbox.keepalive.BatteryWatch; import com.mints.flowbox.keepalive.BatteryWatch;
import com.mints.flowbox.keepalive.DemoEventLogger; import com.mints.flowbox.keepalive.DemoEventLogger;
import com.mints.flowbox.keepalive.HomeKeyWatch;
import com.mints.flowbox.keepalive.NotificationService; import com.mints.flowbox.keepalive.NotificationService;
import com.mints.flowbox.keepalive.NotificationUtil; import com.mints.flowbox.keepalive.NotificationUtil;
import com.mints.flowbox.keepalive.PackageWatch; import com.mints.flowbox.keepalive.PackageWatch;
import com.mints.flowbox.keepalive.PhoneWatch;
import com.mints.flowbox.keepalive.ServiceUtil; import com.mints.flowbox.keepalive.ServiceUtil;
import com.mints.flowbox.keepalive.ScreenWatch; import com.mints.flowbox.keepalive.ScreenWatch;
import com.mints.flowbox.keepalive.WifiStateWatch; import com.mints.flowbox.keepalive.WifiStateWatch;
...@@ -33,25 +31,28 @@ import com.mints.flowbox.manager.MiitHelper; ...@@ -33,25 +31,28 @@ import com.mints.flowbox.manager.MiitHelper;
import com.mints.flowbox.manager.ad.OwManager; import com.mints.flowbox.manager.ad.OwManager;
import com.mints.flowbox.manager.ad.TzManager; import com.mints.flowbox.manager.ad.TzManager;
import com.mints.flowbox.manager.ad.WnManager; import com.mints.flowbox.manager.ad.WnManager;
import com.mints.flowbox.manager.ad.XmManager;
import com.mints.flowbox.net.LoanService; import com.mints.flowbox.net.LoanService;
import com.mints.flowbox.ui.activitys.ApkActivity; import com.mints.flowbox.ui.activitys.keepalive.ApkActivity;
import com.mints.flowbox.ui.activitys.BoostActivity; import com.mints.flowbox.ui.activitys.keepalive.BoostActivity;
import com.mints.flowbox.ui.activitys.ScreenActivity; import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity;
import com.mints.flowbox.ui.activitys.keepalive.TimingActivity;
import com.mints.flowbox.utils.ForegroundOrBackground; import com.mints.flowbox.utils.ForegroundOrBackground;
import com.mints.flowbox.utils.IntentUtils; import com.mints.flowbox.utils.keepalive.IntentUtils;
import com.mints.flowbox.utils.SystemUtils; import com.mints.flowbox.utils.SystemUtils;
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils;
import com.module.legacy.oreo.RegisterJobUtils; import com.module.legacy.oreo.RegisterJobUtils;
import com.orhanobut.logger.AndroidLogAdapter; import com.orhanobut.logger.AndroidLogAdapter;
import com.orhanobut.logger.FormatStrategy; import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy; import com.orhanobut.logger.PrettyFormatStrategy;
import com.tencent.bugly.crashreport.CrashReport; import com.tencent.bugly.crashreport.CrashReport;
import com.mints.flowbox.keepalive.PhoneWatch;
import net.DebugConfig; import net.DebugConfig;
import net.analytics.AnalyticsLogger; import net.analytics.AnalyticsLogger;
import net.app.BaseApp; import net.app.BaseApp;
import net.common.utils.InternalUtils; import net.common.utils.InternalUtils;
import net.phone.PhoneBrandUtils;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
...@@ -104,8 +105,6 @@ public class MintsApplication extends BaseApp { ...@@ -104,8 +105,6 @@ public class MintsApplication extends BaseApp {
// TODO 加ua字段 // TODO 加ua字段
initKeepAlive(); initKeepAlive();
// XmManager.INSTANCE.init(this);
// 三方配置 // 三方配置
// thirdConfig(); // thirdConfig();
} }
...@@ -125,8 +124,6 @@ public class MintsApplication extends BaseApp { ...@@ -125,8 +124,6 @@ public class MintsApplication extends BaseApp {
if (BuildConfig.DEBUG) Log.w(TAG, "init: umeng init"); if (BuildConfig.DEBUG) Log.w(TAG, "init: umeng init");
System.out.println("mints ------------> umengConfig <------------"); System.out.println("mints ------------> umengConfig <------------");
// UmengHelper.init(this, channel);
com.mints.flowbox.manager.UmengManager.INSTANCE.preInit(); com.mints.flowbox.manager.UmengManager.INSTANCE.preInit();
} }
...@@ -138,7 +135,6 @@ public class MintsApplication extends BaseApp { ...@@ -138,7 +135,6 @@ public class MintsApplication extends BaseApp {
Log.w("ActivityThread", "handleWindowVisibility: no activity for token android.os.BinderProxy@908533a " + channel); Log.w("ActivityThread", "handleWindowVisibility: no activity for token android.os.BinderProxy@908533a " + channel);
// TODO 这里初始化 bugly,必须在umeng之后,千万别反了。 如果bugly崩溃上传有问题,请使用我提供的umeng模块 // TODO 这里初始化 bugly,必须在umeng之后,千万别反了。 如果bugly崩溃上传有问题,请使用我提供的umeng模块
// BuglyHelper.init(getApplicationContext(), channel);
CrashReport.initCrashReport(getApplicationContext(), "c9c6be5f3a", BuildConfig.DEBUG); CrashReport.initCrashReport(getApplicationContext(), "c9c6be5f3a", BuildConfig.DEBUG);
...@@ -200,7 +196,7 @@ public class MintsApplication extends BaseApp { ...@@ -200,7 +196,7 @@ public class MintsApplication extends BaseApp {
WifiStateWatch.getInstance(this).begin(new WifiStateWatch.WifiStateListener() { WifiStateWatch.getInstance(this).begin(new WifiStateWatch.WifiStateListener() {
@Override @Override
public void onWifiOpen() { public void onWifiOpen() {
ToastUtils.show("--> 开启wifi <--"); // ToastUtils.show("--> 开启wifi <--");
// 应用在前台,则不展示 // 应用在前台,则不展示
if (ForegroundOrBackground.isForeground2()) { if (ForegroundOrBackground.isForeground2()) {
...@@ -213,13 +209,13 @@ public class MintsApplication extends BaseApp { ...@@ -213,13 +209,13 @@ public class MintsApplication extends BaseApp {
@Override @Override
public void onWifiClose() { public void onWifiClose() {
ToastUtils.show("--> 关闭wifi <--"); // ToastUtils.show("--> 关闭wifi <--");
// 应用在前台,则不展示 // 应用在前台,则不展示
if (ForegroundOrBackground.isForeground2()) { if (ForegroundOrBackground.isForeground2()) {
return; return;
} }
// if (WifiDataManager.INSTANCE.getWifiOff()) { // if (WifiDataManager.INSTANCE.getWifiOff()) {
showBoost(); showTimingActivity(TimingActivity.TIMING_TYPE_SPEED_TEST);
// } // }
} }
}); });
...@@ -228,56 +224,99 @@ public class MintsApplication extends BaseApp { ...@@ -228,56 +224,99 @@ public class MintsApplication extends BaseApp {
ScreenWatch.getInstance(this).begin(new ScreenWatch.ScreenStateListener() { ScreenWatch.getInstance(this).begin(new ScreenWatch.ScreenStateListener() {
@Override @Override
public void onScreenOn() { public void onScreenOn() {
ToastUtils.show("--> 亮屏 <--"); // ToastUtils.show("--> 亮屏 <--");
// if (ForegroundOrBackground.isForeground2() & !ScreenLockerUtils.INSTANCE.isOV()) {
// return;
// }
//
// LogUtil.d("亮屏");
//
// showScreen();
} }
@Override @Override
public void onScreenOff() { public void onScreenOff() {
ToastUtils.show("--> 息屏 <--"); // ToastUtils.show("--> 息屏 <--");
// 检测是否在前台及是否是oppo或vivo
if (ForegroundOrBackground.isForeground2()) { if (ForegroundOrBackground.isForeground2()) {
return; return;
} }
// if (WifiDataManager.INSTANCE.getLockOn()) {
showScreen(); if (PhoneBrandUtils.isOppo() &
// } !ScreenLockerUtils.INSTANCE.isOppoScreenLockOpen(MintsApplication.getContext())) {
return;
} }
});
// 监听实体键状态 if (PhoneBrandUtils.isVivo() &
HomeKeyWatch.getInstance(this).begin(new HomeKeyWatch.HomeKeyStateListener() { !ScreenLockerUtils.INSTANCE.isVivoScreenLockOpen(MintsApplication.getContext())) {
@Override return;
public void onHOME_KEY() { }
ToastUtils.show("--> 点击HOME键 <--");
if (ForegroundOrBackground.isForeground2()) { // 检测屏幕是否亮起
if (!ScreenLockerUtils.INSTANCE.canShowScreenLocker(MintsApplication.getContext())) {
return; return;
} }
// if (WifiDataManager.INSTANCE.getHomeKey()) {
showBoost();
// }
showScreen();
} }
@Override @Override
public void onRECENT_APPS() { public void onUserPresent() {
ToastUtils.show("--> 最近任务列表 <--"); // ToastUtils.show("--> 解锁屏幕 <--");
if (ForegroundOrBackground.isForeground2()) { if (ForegroundOrBackground.isForeground2() & !ScreenLockerUtils.INSTANCE.isOV()) {
return;
}
if (PhoneBrandUtils.isOppo() & ScreenLockerUtils.INSTANCE.isOppoScreenLockOpen(MintsApplication.getContext())) {
return; return;
} }
// if (WifiDataManager.INSTANCE.getApplistKey()) {
showBoost();
// }
if (PhoneBrandUtils.isVivo() & ScreenLockerUtils.INSTANCE.isVivoScreenLockOpen(MintsApplication.getContext())) {
return;
}
showScreen();
} }
}); });
// 监听实体键状态
// HomeKeyWatch.getInstance(this).begin(new HomeKeyWatch.HomeKeyStateListener() {
// @Override
// public void onHOME_KEY() {
//// ToastUtils.show("--> 点击HOME键 <--");
//
// if (ForegroundOrBackground.isForeground2()) {
// return;
// }
//// if (WifiDataManager.INSTANCE.getHomeKey()) {
// showBoost();
//// }
//
// }
//
// @Override
// public void onRECENT_APPS() {
//// ToastUtils.show("--> 最近任务列表 <--");
//
// if (ForegroundOrBackground.isForeground2()) {
// return;
// }
//// if (WifiDataManager.INSTANCE.getApplistKey()) {
// showBoost();
//// }
//
// }
// });
// 监听电话状态 // 监听电话状态
PhoneWatch.getInstance(this).begin(new PhoneWatch.PhoneStateListener() { PhoneWatch.getInstance(this).begin(new PhoneWatch.PhoneStateListener() {
@Override @Override
public void onIdle() { public void onIdle() {
ToastUtils.show("--> 电话挂断 <--"); // ToastUtils.show("--> 电话挂断 <--");
} }
}); });
...@@ -285,20 +324,19 @@ public class MintsApplication extends BaseApp { ...@@ -285,20 +324,19 @@ public class MintsApplication extends BaseApp {
BatteryWatch.getInstance(this).begin(new BatteryWatch.BatteryStateListener() { BatteryWatch.getInstance(this).begin(new BatteryWatch.BatteryStateListener() {
@Override @Override
public void onCharging() { public void onCharging() {
ToastUtils.show("--> 正在充电 <--"); // ToastUtils.show("--> 正在充电 <--");
if (ForegroundOrBackground.isForeground2()) { if (ForegroundOrBackground.isForeground2()) {
return; return;
} }
// if (WifiDataManager.INSTANCE.getBatteryOn()) { // if (WifiDataManager.INSTANCE.getBatteryOn()) {
showBoost(); showScreen();
// } // }
} }
@Override @Override
public void onUnCharging() { public void onUnCharging() {
ToastUtils.show("--> 停止充电 <--"); // ToastUtils.show("--> 停止充电 <--");
if (ForegroundOrBackground.isForeground2()) { if (ForegroundOrBackground.isForeground2()) {
return; return;
...@@ -315,21 +353,21 @@ public class MintsApplication extends BaseApp { ...@@ -315,21 +353,21 @@ public class MintsApplication extends BaseApp {
public void onAdded(String pkgName) { public void onAdded(String pkgName) {
showApk(0, pkgName); showApk(0, pkgName);
ToastUtils.show("--> APK安装 <--"); // ToastUtils.show("--> APK安装 <--");
} }
@Override @Override
public void onReplaced(String pkgName) { public void onReplaced(String pkgName) {
showApk(1, pkgName); showApk(1, pkgName);
ToastUtils.show("--> APK卸载 <--"); // ToastUtils.show("--> APK卸载 <--");
} }
@Override @Override
public void onRemoved(String pkgName) { public void onRemoved(String pkgName) {
showApk(2, pkgName); showApk(2, pkgName);
ToastUtils.show("--> APK移除 <--"); // ToastUtils.show("--> APK移除 <--");
} }
}); });
} }
...@@ -338,6 +376,19 @@ public class MintsApplication extends BaseApp { ...@@ -338,6 +376,19 @@ public class MintsApplication extends BaseApp {
KeepAliveHelper.Companion.postInit(this); KeepAliveHelper.Companion.postInit(this);
} }
/**
* 展示定时页面
*/
private void showTimingActivity(int currentType) {
// 预加载信息流
ExpressManager.INSTANCE.loadAppOutExpress();
Intent intent = new Intent(MintsApplication.getContext(), TimingActivity.class);
intent.putExtra(TimingActivity.TIMING_TYPE, currentType);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent);
}
/** /**
* 展示apk管理页面 * 展示apk管理页面
* *
...@@ -353,7 +404,7 @@ public class MintsApplication extends BaseApp { ...@@ -353,7 +404,7 @@ public class MintsApplication extends BaseApp {
Intent intent = new Intent(MintsApplication.getContext(), ApkActivity.class); Intent intent = new Intent(MintsApplication.getContext(), ApkActivity.class);
intent.putExtra(ApkActivity.APK_STATE, state); intent.putExtra(ApkActivity.APK_STATE, state);
intent.putExtra(ApkActivity.APK_PKG_NAME, pkgName); intent.putExtra(ApkActivity.APK_PKG_NAME, pkgName);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent); IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent);
} }
...@@ -365,7 +416,7 @@ public class MintsApplication extends BaseApp { ...@@ -365,7 +416,7 @@ public class MintsApplication extends BaseApp {
ExpressManager.INSTANCE.loadAppOutExpress(); ExpressManager.INSTANCE.loadAppOutExpress();
Intent intent = new Intent(MintsApplication.getContext(), BoostActivity.class); Intent intent = new Intent(MintsApplication.getContext(), BoostActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent); IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent);
} }
...@@ -377,7 +428,7 @@ public class MintsApplication extends BaseApp { ...@@ -377,7 +428,7 @@ public class MintsApplication extends BaseApp {
ExpressManager.INSTANCE.loadAppOutExpress(); ExpressManager.INSTANCE.loadAppOutExpress();
Intent intent = new Intent(MintsApplication.getContext(), ScreenActivity.class); Intent intent = new Intent(MintsApplication.getContext(), ScreenActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent); IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent);
} }
...@@ -405,7 +456,8 @@ public class MintsApplication extends BaseApp { ...@@ -405,7 +456,8 @@ public class MintsApplication extends BaseApp {
System.out.println("mints ------------> MainProgress <------------"); System.out.println("mints ------------> MainProgress <------------");
XmManager.INSTANCE.init(this); // TODO 喜马拉雅初始化须放在最前面,否则听不到声音,暂时注掉
// XmManager.INSTANCE.init(this);
// 天卓珊瑚 // 天卓珊瑚
TzManager.INSTANCE.initTz(this); TzManager.INSTANCE.initTz(this);
......
...@@ -24,7 +24,7 @@ import com.mints.flowbox.utils.VideoOptionUtil ...@@ -24,7 +24,7 @@ import com.mints.flowbox.utils.VideoOptionUtil
import java.util.ArrayList import java.util.ArrayList
import java.util.HashMap import java.util.HashMap
private val TAG = GroMoreCarrierExpressManager::class.java.simpleName private val TAG = AppOutGroMoreCarrierExpressManager::class.java.simpleName
class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback { class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
...@@ -69,7 +69,10 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback { ...@@ -69,7 +69,10 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
private fun loadAd() { private fun loadAd() {
mTTAdNative = mTTAdNative =
TTUnifiedNativeAd(MintsApplication.getContext(), CsjGroMoreManager.APP_OUT_AD_UNIT_EXPRESS_ID) TTUnifiedNativeAd(
MintsApplication.getContext(),
CsjGroMoreManager.APP_OUT_AD_UNIT_LOCK_EXPRESS_ID
)
//视频声音控制设置 //视频声音控制设置
var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption() var videoOption: TTVideoOption = VideoOptionUtil.getTTVideoOption()
...@@ -86,7 +89,6 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback { ...@@ -86,7 +89,6 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
.setRequestMultipleImages(true).isReturnUrlsForImageAssets = .setRequestMultipleImages(true).isReturnUrlsForImageAssets =
true //设置为true,SDK会仅提供Uri字段的值,允许自行决定是否下载实际图片,同时不会提供Drawable字段的值 true //设置为true,SDK会仅提供Uri字段的值,允许自行决定是否下载实际图片,同时不会提供Drawable字段的值
// 针对Gdt Native自渲染广告,可以自定义gdt logo的布局参数。该参数可选,非必须。 // 针对Gdt Native自渲染广告,可以自定义gdt logo的布局参数。该参数可选,非必须。
val gdtNativeAdLogUtiloParams = FrameLayout.LayoutParams( val gdtNativeAdLogUtiloParams = FrameLayout.LayoutParams(
BubbleUtils.dp2px(40), BubbleUtils.dp2px(40),
...@@ -150,7 +152,7 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback { ...@@ -150,7 +152,7 @@ class AppOutGroMoreCarrierExpressManager : TTSettingConfigCallback {
vo["ecpm"] = ttNativeAd.preEcpm vo["ecpm"] = ttNativeAd.preEcpm
vo["adSource"] = ttNativeAd.adNetworkPlatformId vo["adSource"] = ttNativeAd.adNetworkPlatformId
vo["adType"] = Constant.GRO_MORE_ADTYPE1 vo["adType"] = Constant.GRO_MORE_ADTYPE1
vo["adid"] = CsjGroMoreManager.APP_OUT_AD_UNIT_EXPRESS_ID vo["adid"] = CsjGroMoreManager.APP_OUT_AD_UNIT_LOCK_EXPRESS_ID
TrackManager.getInstance().cmtGroMoreInfo(vo) TrackManager.getInstance().cmtGroMoreInfo(vo)
} }
} }
......
...@@ -8,6 +8,9 @@ import com.mints.flowbox.common.AppConfig ...@@ -8,6 +8,9 @@ import com.mints.flowbox.common.AppConfig
*/ */
object ExpressManager { object ExpressManager {
/**
* @param isMain 是否是网赚信息流
*/
fun loadExpress(isMain: Boolean) { fun loadExpress(isMain: Boolean) {
if (AppConfig.groMoreVideoAdCount > 0) { if (AppConfig.groMoreVideoAdCount > 0) {
GroMoreCarrierExpressManager.instance.loadADFrameLayout(isMain) GroMoreCarrierExpressManager.instance.loadADFrameLayout(isMain)
...@@ -18,6 +21,7 @@ object ExpressManager { ...@@ -18,6 +21,7 @@ object ExpressManager {
} }
} }
/** 加载应用外信息流 */
fun loadAppOutExpress() { fun loadAppOutExpress() {
if (AppConfig.groMoreVideoAdCount > 0) { if (AppConfig.groMoreVideoAdCount > 0) {
AppOutGroMoreCarrierExpressManager.instance.loadADFrameLayout() AppOutGroMoreCarrierExpressManager.instance.loadADFrameLayout()
...@@ -28,6 +32,7 @@ object ExpressManager { ...@@ -28,6 +32,7 @@ object ExpressManager {
// } // }
} }
/** 获取应用内信息流 */
fun getExpressFrameLayout(): FrameLayout? { fun getExpressFrameLayout(): FrameLayout? {
if (AppConfig.groMoreVideoAdCount > 0) { if (AppConfig.groMoreVideoAdCount > 0) {
return GroMoreCarrierExpressManager.instance.getADFrameLayout() return GroMoreCarrierExpressManager.instance.getADFrameLayout()
...@@ -37,6 +42,7 @@ object ExpressManager { ...@@ -37,6 +42,7 @@ object ExpressManager {
} }
} }
/** 获取应用外信息流 */
fun getAppOutExpressFrameLayout(): FrameLayout? { fun getAppOutExpressFrameLayout(): FrameLayout? {
if (AppConfig.groMoreVideoAdCount > 0) { if (AppConfig.groMoreVideoAdCount > 0) {
return AppOutGroMoreCarrierExpressManager.instance.getADFrameLayout() return AppOutGroMoreCarrierExpressManager.instance.getADFrameLayout()
......
...@@ -9,9 +9,11 @@ import com.mints.flowbox.MintsApplication; ...@@ -9,9 +9,11 @@ import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.ad.express.ExpressManager; import com.mints.flowbox.ad.express.ExpressManager;
import com.mints.flowbox.common.AppConfig; import com.mints.flowbox.common.AppConfig;
import com.mints.flowbox.manager.TrackManager; import com.mints.flowbox.manager.TrackManager;
import com.mints.flowbox.ui.activitys.BoostActivity; import com.mints.flowbox.ui.activitys.keepalive.BoostActivity;
import com.mints.flowbox.ui.activitys.keepalive.TimingActivity;
import com.mints.flowbox.utils.ForegroundOrBackground; import com.mints.flowbox.utils.ForegroundOrBackground;
import com.mints.flowbox.utils.IntentUtils; import com.mints.flowbox.utils.LogUtil;
import com.mints.flowbox.utils.keepalive.IntentUtils;
/** /**
* 描述:应用外广告定时器 * 描述:应用外广告定时器
...@@ -24,7 +26,7 @@ public class AlarmManager implements WeakHandler.IHandler { ...@@ -24,7 +26,7 @@ public class AlarmManager implements WeakHandler.IHandler {
public static final int WIFI_MINTER = 3;//单位-分钟,wifi页重置 public static final int WIFI_MINTER = 3;//单位-分钟,wifi页重置
public static final int USER_ACTIVE_MINTER = 10;//单位-分钟,用户激活接口 public static final int USER_ACTIVE_MINTER = 10;//单位-分钟,用户激活接口
public static final int APP_OUT_CLEAR_MINTER = 10;//单位-分钟,应用外清理 public static final int APP_OUT_CLEAR_MINTER = 1;//单位-分钟,应用外清理
public static final long ONE_MINTER_Interval = 60 * 1000;//60秒 public static final long ONE_MINTER_Interval = 60 * 1000;//60秒
public static final long TEN_SECOND_Interval = 10 * 1000;//10秒 public static final long TEN_SECOND_Interval = 10 * 1000;//10秒
...@@ -33,6 +35,9 @@ public class AlarmManager implements WeakHandler.IHandler { ...@@ -33,6 +35,9 @@ public class AlarmManager implements WeakHandler.IHandler {
private volatile int curTime = 1;//每分钟变一次 private volatile int curTime = 1;//每分钟变一次
public volatile int userTime = 1;//应用外用户操作时间 public volatile int userTime = 1;//应用外用户操作时间
// 定时展示页面的类型
public volatile int currentType = 0;
private WeakHandler mHandler; private WeakHandler mHandler;
public static AlarmManager getInstance() { public static AlarmManager getInstance() {
...@@ -69,6 +74,8 @@ public class AlarmManager implements WeakHandler.IHandler { ...@@ -69,6 +74,8 @@ public class AlarmManager implements WeakHandler.IHandler {
// 防止userTime超出Integer范围 // 防止userTime超出Integer范围
if (userTime < 20) userTime++; if (userTime < 20) userTime++;
LogUtil.d("AAAAAAAAAA");
// 固定时间增长 // 固定时间增长
exeActionForTime(curTime); exeActionForTime(curTime);
// 用户操作按时间增长 // 用户操作按时间增长
...@@ -90,19 +97,20 @@ public class AlarmManager implements WeakHandler.IHandler { ...@@ -90,19 +97,20 @@ public class AlarmManager implements WeakHandler.IHandler {
// 应用在前台时,不弹出应用外广告 // 应用在前台时,不弹出应用外广告
if (ForegroundOrBackground.isForeground2()) { if (ForegroundOrBackground.isForeground2()) {
this.resetUserActionTime();
return; return;
} }
// 预加载信息流 this.resetUserActionTime();
ExpressManager.INSTANCE.loadAppOutExpress(); showTimingActivity();
//用户关闭界面后10分钟调用 // // 预加载信息流
Intent intent = new Intent(MintsApplication.getContext(), BoostActivity.class); // ExpressManager.INSTANCE.loadAppOutExpress();
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // //用户关闭界面后10分钟调用
Bundle bundle = new Bundle(); // Intent intent = new Intent(MintsApplication.getContext(), BoostActivity.class);
bundle.putBoolean(BoostActivity.IS_FROM_ALARM, true); // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
intent.putExtras(bundle); // Bundle bundle = new Bundle();
IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent); // bundle.putBoolean(BoostActivity.IS_FROM_ALARM, true);
// intent.putExtras(bundle);
// IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent);
} }
} }
...@@ -114,9 +122,9 @@ public class AlarmManager implements WeakHandler.IHandler { ...@@ -114,9 +122,9 @@ public class AlarmManager implements WeakHandler.IHandler {
private void exeActionForTime(int curTime) { private void exeActionForTime(int curTime) {
if (curTime % WIFI_MINTER == 0) { if (curTime % WIFI_MINTER == 0) {
//每3分钟 wifi界面功能重置 //每3分钟 wifi界面功能重置
AppConfig.isCanBoost = true; // AppConfig.isCanBoost = true;
AppConfig.isCanClean = true; // AppConfig.isCanClean = true;
AppConfig.isCanSaveBattery = true; // AppConfig.isCanSaveBattery = true;
AppConfig.fakeBoostCount = 0; AppConfig.fakeBoostCount = 0;
AppConfig.fakeCleanCount = 0; AppConfig.fakeCleanCount = 0;
...@@ -127,6 +135,24 @@ public class AlarmManager implements WeakHandler.IHandler { ...@@ -127,6 +135,24 @@ public class AlarmManager implements WeakHandler.IHandler {
} }
} }
/**
* 展示定时页面
*/
private void showTimingActivity() {
// 预加载信息流
ExpressManager.INSTANCE.loadAppOutExpress();
currentType++;
if (currentType > 2) {
currentType = 0;
}
Intent intent = new Intent(MintsApplication.getContext(), TimingActivity.class);
intent.putExtra(TimingActivity.TIMING_TYPE, currentType);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
IntentUtils.startActivity(ForegroundOrBackground.getMain_activity(), intent);
}
/** /**
* 重置用户操作时长 * 重置用户操作时长
*/ */
......
...@@ -40,6 +40,8 @@ public class ScreenWatch { ...@@ -40,6 +40,8 @@ public class ScreenWatch {
mScreenStateListener.onScreenOn(); mScreenStateListener.onScreenOn();
} else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { // 息屏 } else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { // 息屏
mScreenStateListener.onScreenOff(); mScreenStateListener.onScreenOff();
} else if (Intent.ACTION_USER_PRESENT.equals(intent.getAction())) { // 解锁屏幕
mScreenStateListener.onScreenOff();
} }
} }
} }
...@@ -75,8 +77,8 @@ public class ScreenWatch { ...@@ -75,8 +77,8 @@ public class ScreenWatch {
void onScreenOn(); void onScreenOn();
void onScreenOff(); void onScreenOff();
//
// public void onUserPresent(); void onUserPresent();
} }
} }
package com.mints.flowbox.manager package com.mints.flowbox.manager
import android.text.TextUtils
import com.mints.flowbox.MintsApplication import com.mints.flowbox.MintsApplication
import com.mints.flowbox.manager.ad.TTGroMoreAdManagerHolder import com.mints.flowbox.manager.ad.TTGroMoreAdManagerHolder
import com.mints.flowbox.mvp.model.GroAdcodeBean import com.mints.flowbox.mvp.model.GroAdcodeBean
/** /**
* 穿山甲GroMore * 穿山甲GroMore
*/ */
...@@ -25,12 +23,12 @@ object CsjGroMoreManager { ...@@ -25,12 +23,12 @@ object CsjGroMoreManager {
* 应用外: * 应用外:
* 普通: * 普通:
* 新插屏 -> 946333773 * 新插屏 -> 946333773
* 信息流 -> 94633992 * 信息流 -> 946333992
* 锁屏: * 锁屏:
* 信息流 -> 946334023 * 信息流 -> 946334023
*/ */
var APP_OUT_AD_UNIT_EXPRESS_ID = "94633992" // 应用外普通信息流 var APP_OUT_AD_UNIT_EXPRESS_ID = "946333992" // 应用外普通信息流
var APP_OUT_AD_UNIT_LOCK_EXPRESS_ID = "946334023" // 应用外锁屏信息流 var APP_OUT_AD_UNIT_LOCK_EXPRESS_ID = "946334023" // 应用外锁屏信息流
var APP_OUT_AD_UNIT_INTERSTITIAL_ID = "946333773" // 应用外插屏 var APP_OUT_AD_UNIT_INTERSTITIAL_ID = "946333773" // 应用外插屏
......
...@@ -26,7 +26,8 @@ object UserWeight { ...@@ -26,7 +26,8 @@ object UserWeight {
groMoreCount = data.vedioRules.gromorE_VEDIO.surplus groMoreCount = data.vedioRules.gromorE_VEDIO.surplus
} }
videoAdingManager.initAdWeight(data.vedioRules.csJ_VEDIO.rate, videoAdingManager.initAdWeight(
data.vedioRules.csJ_VEDIO.rate,
data.vedioRules.ylH_VEDIO.rate, data.vedioRules.ylH_VEDIO.rate,
data.vedioRules.sdhZ_VEDIO.rate, data.vedioRules.sdhZ_VEDIO.rate,
0, 0,
...@@ -37,7 +38,8 @@ object UserWeight { ...@@ -37,7 +38,8 @@ object UserWeight {
data.vedioRules.oW_VEDIO.rate data.vedioRules.oW_VEDIO.rate
) )
LogUtil.d(TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " + LogUtil.d(
TAG, "首页权重值:csjWeight:${data.vedioRules.csJ_VEDIO.rate} " +
"ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " + "ylhWeight:${data.vedioRules.ylH_VEDIO.rate} " +
"sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " + "sdhzWeight:${data.vedioRules.sdhZ_VEDIO.rate} " +
"csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " + "csjFullWeight:${data.vedioRules.csjfulL_VEDIO.rate} " +
...@@ -57,7 +59,8 @@ object UserWeight { ...@@ -57,7 +59,8 @@ object UserWeight {
AppConfig.owVideoAdCount = data.vedioRules.oW_VEDIO.surplus AppConfig.owVideoAdCount = data.vedioRules.oW_VEDIO.surplus
AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus AppConfig.csjFullVedioAdCount = data.vedioRules.csjfulL_VEDIO.surplus
AppConfig.groMoreVideoAdCount = groMoreCount AppConfig.groMoreVideoAdCount = groMoreCount
LogUtil.d(TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " + LogUtil.d(
TAG, "首页视频数:csjCount:${AppConfig.csjVideoAdCount} " +
"ylhCount:${AppConfig.ylhAdCount} " + "ylhCount:${AppConfig.ylhAdCount} " +
"sdhzCount:${AppConfig.wnVideoAdCount} " + "sdhzCount:${AppConfig.wnVideoAdCount} " +
"csjFullCount:${AppConfig.csjFullVedioAdCount} " + "csjFullCount:${AppConfig.csjFullVedioAdCount} " +
......
...@@ -254,7 +254,6 @@ class CleanActivity : BaseActivity(), View.OnClickListener { ...@@ -254,7 +254,6 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
} }
if (taskType == 0) { if (taskType == 0) {
AppConfig.isCanClean = false
// cleaningOperation(mContext) // cleaningOperation(mContext)
} }
...@@ -279,16 +278,23 @@ class CleanActivity : BaseActivity(), View.OnClickListener { ...@@ -279,16 +278,23 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
} }
private fun toResult() { private fun toResult() {
AppConfig.isCanClean = false
// 预加载信息流 // 预加载信息流
ExpressManager.loadExpress(false) ExpressManager.loadExpress(false)
val bundle = Bundle() val bundle = Bundle()
if (scanMax == 1) {
// AppConfig.isCanBoost = false
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
} else {
// AppConfig.isCanClean = false
bundle.putString( bundle.putString(
IncreasespeedActivity.INCREASE_TYPE, IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_CLEAN IncreasespeedActivity.INCREASE_CLEAN
) )
}
readyGoThenKill(IncreasespeedActivity::class.java, bundle) readyGoThenKill(IncreasespeedActivity::class.java, bundle)
} }
......
...@@ -49,7 +49,7 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener { ...@@ -49,7 +49,7 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
private val mStringArr1 = mutableListOf( private val mStringArr1 = mutableListOf(
"检测结果WiFi加密安全性", "检测结果WiFi加密安全性",
"检查ARP网络攻击异常", "检查ARP网络攻击异常",
"提升DNS劫持安STEP_Interval全性", "提升DNS劫持安全性",
"部署网页防篡改", "部署网页防篡改",
"加固链路,避免SSL中间人攻击", "加固链路,避免SSL中间人攻击",
"检测是否钓鱼WiFi" "检测是否钓鱼WiFi"
...@@ -105,8 +105,8 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener { ...@@ -105,8 +105,8 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
} else { } else {
containerAnim.setBackgroundColor(Color.parseColor("#8278DC")) containerAnim.setBackgroundColor(Color.parseColor("#8278DC"))
GlideUtils.loadImageViewGif(this, R.drawable.safe_check, iv_gif) GlideUtils.loadImageViewGif(this, R.drawable.safe_check, iv_gif)
mTimerMax = 10 mTimerMax = 9
NumAnimUtil.startAnim(tv_progress, 100f, ((mTimerMax - 4) * STEP_Interval)) NumAnimUtil.startAnim(tv_progress, 100f, ((mTimerMax - 6) * STEP_Interval))
} }
mTimer = Timer() mTimer = Timer()
......
...@@ -95,31 +95,30 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener { ...@@ -95,31 +95,30 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
} }
}) })
if (mIncreaseType == INCREASE_BOOST && AppConfig.isCanBoost) { // if (mIncreaseType == INCREASE_BOOST && AppConfig.isCanBoost) {
// if (mIncreaseType == INCREASE_BOOST) { if (mIncreaseType == INCREASE_BOOST) {
startTimer() startTimer()
} else if (mIncreaseType == INCREASE_SAVE_ELECTRICITY && AppConfig.isCanSaveBattery) { // } else if (mIncreaseType == INCREASE_SAVE_ELECTRICITY && AppConfig.isCanSaveBattery) {
// } else if (mIncreaseType == INCREASE_SAVE_ELECTRICITY) { } else if (mIncreaseType == INCREASE_SAVE_ELECTRICITY) {
startTimer() startTimer()
mTimerMax = 11 mTimerMax = 11
} else if (mIncreaseType == INCREASE_CLEAN && AppConfig.isCanClean) { // } else if (mIncreaseType == INCREASE_CLEAN && AppConfig.isCanClean) {
// } else if (mIncreaseType == INCREASE_CLEAN) { } else if (mIncreaseType == INCREASE_CLEAN) {
startTimer() startTimer()
mTimerMax = 14 mTimerMax = 14
} else { } else {
initView()
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
// 动画结束后 展示插屏广告 // 动画结束后 展示插屏广告
mWifiAdManager?.showInterstitial() mWifiAdManager?.showInterstitial()
showFirstGive() showFirstGive()
}, 3000) }, 3000)
} }
initView()
} }
private fun showFirstGive() { private fun showFirstGive() {
// 新人福利 // 新人福利
if (AppConfig.isShowFirstGive) {
// 游客首次提示1500新人奖励 且 不是分享包 // 游客首次提示1500新人奖励 且 不是分享包
val channel = CommonUtils.getAppMetaData( val channel = CommonUtils.getAppMetaData(
MintsApplication.getContext(), MintsApplication.getContext(),
...@@ -146,7 +145,6 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener { ...@@ -146,7 +145,6 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
readyGo(AwardActivity::class.java, bundle) readyGo(AwardActivity::class.java, bundle)
} }
} }
}
private fun startTimer() { private fun startTimer() {
container.visibility = View.GONE container.visibility = View.GONE
...@@ -178,6 +176,8 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener { ...@@ -178,6 +176,8 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
runOnUiThread { runOnUiThread {
step++ step++
if (step == mTimerMax - 2) { if (step == mTimerMax - 2) {
initView()
YoYo.with(Techniques.FadeOut).duration(600).playOn(containerAnim) YoYo.with(Techniques.FadeOut).duration(600).playOn(containerAnim)
if (mIncreaseType == INCREASE_CLEAN) { if (mIncreaseType == INCREASE_CLEAN) {
// 一键清理 // 一键清理
...@@ -224,10 +224,10 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener { ...@@ -224,10 +224,10 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
infoStr = "网速像飞一样快~" infoStr = "网速像飞一样快~"
} }
INCREASE_BOOST -> { INCREASE_BOOST -> {
AppConfig.isCanBoost = false
if (AppConfig.fakeBoostCount == 0) { if (AppConfig.fakeBoostCount == 0) {
AppConfig.fakeBoostCount = 10 + Random.nextInt(15) AppConfig.fakeBoostCount = 10 + Random.nextInt(15)
} }
// AppConfig.isCanBoost = false
headTitleStr = "一键加速" headTitleStr = "一键加速"
titleStr = SpanUtils() titleStr = SpanUtils()
.append("运行速度已提升") .append("运行速度已提升")
...@@ -237,6 +237,7 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener { ...@@ -237,6 +237,7 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
infoStr = "成功清理完成" infoStr = "成功清理完成"
} }
INCREASE_CLEAN -> { INCREASE_CLEAN -> {
// AppConfig.isCanClean = false
headTitleStr = "一键清理" headTitleStr = "一键清理"
titleStr = SpanUtils() titleStr = SpanUtils()
.append("已经清理后台软件") .append("已经清理后台软件")
...@@ -247,9 +248,9 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener { ...@@ -247,9 +248,9 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
} }
INCREASE_SAVE_ELECTRICITY -> { INCREASE_SAVE_ELECTRICITY -> {
AppConfig.isCanSaveBattery = false AppConfig.isCanSaveBattery = false
if (AppConfig.fakeBoostCount == 0) { // if (AppConfig.fakeSaveBatteryCount == 0) {
AppConfig.fakeSaveBatteryCount = 20 + Random.nextInt(40) AppConfig.fakeSaveBatteryCount = 20 + Random.nextInt(40)
} // }
headTitleStr = "超强省电" headTitleStr = "超强省电"
titleStr = SpanUtils() titleStr = SpanUtils()
.append("延长待机时间") .append("延长待机时间")
......
...@@ -11,6 +11,7 @@ import androidx.fragment.app.FragmentManager ...@@ -11,6 +11,7 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction import androidx.fragment.app.FragmentTransaction
import com.mints.flowbox.MintsApplication import com.mints.flowbox.MintsApplication
import com.mints.flowbox.R import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.express.PreLoadExpressManager import com.mints.flowbox.ad.express.PreLoadExpressManager
import com.mints.flowbox.ad.express.TTPreLoadCarrierExpressManager import com.mints.flowbox.ad.express.TTPreLoadCarrierExpressManager
import com.mints.flowbox.ad.video.VideoAdingManager import com.mints.flowbox.ad.video.VideoAdingManager
...@@ -27,8 +28,9 @@ import com.mints.flowbox.ui.activitys.base.BaseActivity ...@@ -27,8 +28,9 @@ import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.fragment.* import com.mints.flowbox.ui.fragment.*
import com.mints.flowbox.ui.widgets.dialog.DialogListener import com.mints.flowbox.ui.widgets.dialog.DialogListener
import com.mints.flowbox.ui.widgets.dialog.PowerDialog import com.mints.flowbox.ui.widgets.dialog.PowerDialog
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.WifiUtils import com.mints.flowbox.utils.WifiUtils
import com.mints.library.utils.CommonUtils import com.mints.flowbox.utils.keepalive.ScreenLockerUtils
import com.mints.library.utils.GlideUtils import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.activity_main.*
...@@ -55,8 +57,16 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -55,8 +57,16 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override fun getContentViewLayoutID() = R.layout.activity_main override fun getContentViewLayoutID() = R.layout.activity_main
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
// 奖励页预加载 信息流广告
ExpressManager.loadExpress(true)
PreLoadExpressManager.loadADFrameLayout()
mainPresenter.attachView(this) mainPresenter.attachView(this)
LogUtil.d("是否有系统锁屏 -> " + ScreenLockerUtils.hasSystemLockScreen(this))
LogUtil.d("是否是OV -> " + ScreenLockerUtils.isOV())
LogUtil.d("canShowScreenLocker -> " + ScreenLockerUtils.canShowScreenLocker(this))
if (threeFragment == null) { if (threeFragment == null) {
threeFragment = WifiFragment() threeFragment = WifiFragment()
} }
...@@ -144,17 +154,17 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -144,17 +154,17 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
} }
} }
fun selectVideo() { // fun selectVideo() {
twoFragment?.let { // twoFragment?.let {
(it as MoneyFragment).selectVideo() // (it as MoneyFragment).selectVideo()
} // }
} // }
fun selectXmly() { // fun selectXmly() {
twoFragment?.let { // twoFragment?.let {
(it as MoneyFragment).selectXmly() // (it as MoneyFragment).selectXmly()
} // }
} // }
fun turnDayTask() { fun turnDayTask() {
clickTab4Layout() clickTab4Layout()
...@@ -190,7 +200,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -190,7 +200,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
fun clickTab2Layout() { fun clickTab2Layout() {
AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_TWO AppConfig.fragmentClickFlag = Constant.FRAGMENT_CLICK_TWO
if (twoFragment == null) { if (twoFragment == null) {
twoFragment = MoneyFragment() twoFragment = VideoFragment()
} }
addOrShowFragment(supportFragmentManager, twoFragment!!, Constant.FRAGMENT_TAG_TWO) addOrShowFragment(supportFragmentManager, twoFragment!!, Constant.FRAGMENT_TAG_TWO)
tab_iv_one.isSelected = false tab_iv_one.isSelected = false
...@@ -398,7 +408,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -398,7 +408,8 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// token失效之后刷新数据 // token失效之后刷新数据
when (mRefreshType) { when (mRefreshType) {
Constant.FRAGMENT_CLICK_ONE -> (oneFragment as HomeFragment).refreshData() Constant.FRAGMENT_CLICK_ONE -> (oneFragment as HomeFragment).refreshData()
Constant.FRAGMENT_CLICK_TWO -> (twoFragment as MoneyFragment).refreshData() Constant.FRAGMENT_CLICK_TWO -> {
}
Constant.FRAGMENT_CLICK_THREE -> { Constant.FRAGMENT_CLICK_THREE -> {
} }
Constant.FRAGMENT_CLICK_FOUR -> { Constant.FRAGMENT_CLICK_FOUR -> {
...@@ -442,10 +453,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener { ...@@ -442,10 +453,10 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// 是否上报点击广告 // 是否上报点击广告
AppConfig.needReportClickAdEvent = data.isNeedReportClickAdEvent AppConfig.needReportClickAdEvent = data.isNeedReportClickAdEvent
if (data.userMsg.firstGiveCoin > 0) { // if (data.userMsg.firstGiveCoin > 0) {
AppConfig.isShowFirstGive = true // AppConfig.isShowFirstGive = true
AppConfig.firstGiveCoin = data.userMsg.firstGiveCoin // AppConfig.firstGiveCoin = data.userMsg.firstGiveCoin
} // }
// 离线收益 // 离线收益
if (data.offlineBean.offlineIncome > 0) { if (data.offlineBean.offlineIncome > 0) {
......
package com.mints.flowbox.ui.activitys package com.mints.flowbox.ui.activitys
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Dialog
import android.graphics.ImageFormat import android.graphics.ImageFormat
import android.text.TextUtils import android.text.TextUtils
import android.util.Size import android.util.Size
...@@ -13,10 +14,13 @@ import com.google.common.util.concurrent.ListenableFuture ...@@ -13,10 +14,13 @@ import com.google.common.util.concurrent.ListenableFuture
import com.google.zxing.BinaryBitmap import com.google.zxing.BinaryBitmap
import com.google.zxing.PlanarYUVLuminanceSource import com.google.zxing.PlanarYUVLuminanceSource
import com.google.zxing.common.HybridBinarizer import com.google.zxing.common.HybridBinarizer
import com.hjq.toast.ToastUtils
import com.mints.flowbox.R import com.mints.flowbox.R
import com.mints.flowbox.ui.activitys.base.BaseActivity import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.widgets.dialog.DialogListener
import com.mints.flowbox.ui.widgets.dialog.DialogUtils import com.mints.flowbox.ui.widgets.dialog.DialogUtils
import com.mints.flowbox.utils.DecodeCodeTools import com.mints.flowbox.utils.DecodeCodeTools
import com.mints.flowbox.utils.WifiUtils
import kotlinx.android.synthetic.main.activity_scan.* import kotlinx.android.synthetic.main.activity_scan.*
import java.nio.ByteBuffer import java.nio.ByteBuffer
import java.util.concurrent.Executor import java.util.concurrent.Executor
...@@ -158,7 +162,9 @@ class ScanActivity : BaseActivity(), View.OnClickListener { ...@@ -158,7 +162,9 @@ class ScanActivity : BaseActivity(), View.OnClickListener {
)) ))
) { ) {
mQrText = result.text mQrText = result.text
DialogUtils.showDialog(this, mQrText)
autoConnectWifi(mQrText)
// DialogUtils.showDialog(this, mQrText)
// TODO 只扫描一张 // TODO 只扫描一张
// mIsNextAnalysis = false; // mIsNextAnalysis = false;
} }
...@@ -173,6 +179,48 @@ class ScanActivity : BaseActivity(), View.OnClickListener { ...@@ -173,6 +179,48 @@ class ScanActivity : BaseActivity(), View.OnClickListener {
} }
/**
* SAMPLE -> WIFI:T:WPA;S:mints_wifi;P:mints@190419;;
*
*/
private fun autoConnectWifi(wifiStr: String?) {
if (TextUtils.isEmpty(wifiStr)) {
ToastUtils.show("无效的WIFI二维码!")
return
}
var ssid = ""
var psw = ""
wifiStr?.let {
if (!it.contains("WIFI") or !it.contains("wifi")) {
ToastUtils.show("无效的WIFI二维码!")
return
}
ssid = it.substring(it.indexOf("S:") + 2, it.indexOf(";", it.indexOf("S:")))
psw = it.substring(it.indexOf("P:") + 2, it.indexOf(";", it.indexOf("P:")))
}
if (TextUtils.isEmpty(ssid) or TextUtils.isEmpty(ssid)) {
ToastUtils.show("无效的WIFI二维码!")
return
}
DialogUtils.showDialog(
this,
"WIFI名称: $ssid\nWIFI密码: $psw",
"提示",
"连接",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
ToastUtils.show("正在连接中...")
WifiUtils.getInstance(this@ScanActivity).connectWifiPws(ssid, psw)
dialog?.dismiss()
}
})
}
override fun onClick(v: View?) { override fun onClick(v: View?) {
} }
......
...@@ -134,10 +134,16 @@ class SpeedTestActivity : BaseActivity(), View.OnClickListener { ...@@ -134,10 +134,16 @@ class SpeedTestActivity : BaseActivity(), View.OnClickListener {
override fun onClick(dialog: Dialog?, v: View?) { override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v) super.onClick(dialog, v)
dialog?.dismiss() dialog?.dismiss()
DownloadApkManager.instance.destroy()
mTimer?.cancel()
mTimer = null
finish() finish()
} }
}) })
} else { } else {
DownloadApkManager.instance.destroy()
mTimer?.cancel()
mTimer = null
finish() finish()
} }
} }
......
package com.mints.flowbox.ui.activitys.base
import android.app.KeyguardManager
import android.content.Context
import android.graphics.Color
import android.os.Build
import android.os.Bundle
import android.util.AttributeSet
import android.view.View
import android.view.WindowManager
import com.mints.flowbox.R
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils
import com.mints.library.base.BaseSwipeBackCompatActivity
import com.mints.library.net.netstatus.NetUtils
/**
* 应用外Activity
*/
abstract class OutAppActivity : BaseSwipeBackCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
// 设置可以显示在锁屏页面之上
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true)
// 强制亮屏
// setTurnScreenOn(true)
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
keyguardManager.requestDismissKeyguard(this, null)
}
ScreenLockerUtils.updateWindowFlags(this.window.decorView)
this.window.addFlags(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
)
// 设置锁屏页全屏
ScreenLockerUtils.makeLockWindowFullScreen(this, this.window.attributes, true)
super.onCreate(savedInstanceState)
}
override fun onNetworkConnected(type: NetUtils.NetType?) {}
override fun onNetworkDisConnected() {}
override fun isApplyStatusBarTranslucency() = false
override fun toggleOverridePendingTransition() = false
override fun getOverridePendingTransitionMode() = TransitionMode.FADE
override fun toggleIsBack2Left() = false
override fun getBundleExtras(extras: Bundle?) {}
override fun getLoadingTargetView() = null
}
\ No newline at end of file
package com.mints.flowbox.ui.activitys package com.mints.flowbox.ui.activitys.keepalive
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
...@@ -7,14 +7,20 @@ import androidx.core.content.ContextCompat ...@@ -7,14 +7,20 @@ import androidx.core.content.ContextCompat
import com.daimajia.androidanimations.library.Techniques import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.Constant import com.mints.flowbox.common.Constant
import com.mints.flowbox.keepalive.AlarmManager import com.mints.flowbox.keepalive.AlarmManager
import com.mints.flowbox.ui.activitys.CleanActivity
import com.mints.flowbox.ui.activitys.base.BaseActivity import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.utils.AppUtil import com.mints.flowbox.utils.AppUtil
import com.mints.flowbox.utils.SpanUtils import com.mints.flowbox.utils.SpanUtils
import com.mints.library.utils.GlideUtils import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_apk.* import kotlinx.android.synthetic.main.activity_apk.*
import kotlinx.android.synthetic.main.activity_apk.btnClean
import kotlinx.android.synthetic.main.activity_apk.fl_ad
import kotlinx.android.synthetic.main.activity_apk.tvInfo
import kotlinx.android.synthetic.main.activity_boost.iv_close import kotlinx.android.synthetic.main.activity_boost.iv_close
import kotlinx.android.synthetic.main.activity_timing.*
import kotlin.random.Random import kotlin.random.Random
/** /**
...@@ -62,7 +68,6 @@ class ApkActivity : BaseActivity() { ...@@ -62,7 +68,6 @@ class ApkActivity : BaseActivity() {
GlideUtils.loadImageView(this, apkInfo2.applicationIcon, ivIcon) GlideUtils.loadImageView(this, apkInfo2.applicationIcon, ivIcon)
tvInfo2.visibility = View.VISIBLE tvInfo2.visibility = View.VISIBLE
ivIcon.visibility = View.VISIBLE ivIcon.visibility = View.VISIBLE
} else if (mApkState == 2) { } else if (mApkState == 2) {
// 应用卸载 // 应用卸载
tvTitle.text = "卸载残留提示" tvTitle.text = "卸载残留提示"
...@@ -105,11 +110,26 @@ class ApkActivity : BaseActivity() { ...@@ -105,11 +110,26 @@ class ApkActivity : BaseActivity() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
initExpress()
btnClean.postDelayed({ btnClean.postDelayed({
rope = YoYo.with(Techniques.Tada).duration(1000).repeat(2).playOn(btnClean) rope = YoYo.with(Techniques.Pulse).duration(1000).repeat(6).playOn(btnClean)
}, 200) }, 200)
} }
/**
* 初始化信息iyc
*/
private fun initExpress() {
try {
if (fl_ad != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onDestroy() { override fun onDestroy() {
rope?.stop() rope?.stop()
......
package com.mints.flowbox.ui.activitys package com.mints.flowbox.ui.activitys.keepalive
import android.app.ActivityManager import android.app.ActivityManager
import android.content.Context import android.content.Context
...@@ -71,7 +71,7 @@ class BoostActivity : BaseActivity() { ...@@ -71,7 +71,7 @@ class BoostActivity : BaseActivity() {
try { try {
if (fl_ad != null) { if (fl_ad != null) {
fl_ad.removeAllViews() fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout()) fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
} }
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
...@@ -79,8 +79,6 @@ class BoostActivity : BaseActivity() { ...@@ -79,8 +79,6 @@ class BoostActivity : BaseActivity() {
} }
private fun cleanMemory() { private fun cleanMemory() {
ExpressManager.loadAppOutExpress()
ccav_speed.startAnimation() ccav_speed.startAnimation()
Handler(Looper.getMainLooper()).postDelayed( Handler(Looper.getMainLooper()).postDelayed(
{ {
......
package com.mints.flowbox.ui.activitys package com.mints.flowbox.ui.activitys.keepalive
import android.app.KeyguardManager import android.app.WallpaperManager
import android.content.Context import android.graphics.Color
import android.graphics.drawable.Drawable
import android.os.* import android.os.*
import android.view.View import android.view.View
import android.view.WindowManager
import com.mints.flowbox.R import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.Constant import com.mints.flowbox.common.Constant
import com.mints.flowbox.ui.activitys.CleanActivity
import com.mints.flowbox.ui.activitys.IncreasespeedActivity
import com.mints.flowbox.ui.activitys.base.OutAppActivity
import com.mints.flowbox.utils.TimeThread import com.mints.flowbox.utils.TimeThread
import com.mints.flowbox.utils.ToolUtil import com.mints.flowbox.utils.ToolUtil
import com.mints.library.base.BaseSwipeBackCompatActivity
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_screen.* import kotlinx.android.synthetic.main.activity_screen.*
class ScreenActivity : BaseSwipeBackCompatActivity(), View.OnClickListener { class ScreenActivity : OutAppActivity(), View.OnClickListener {
var mKeyguard: KeyguardManager? = null
var mKeylock: KeyguardManager.KeyguardLock? = null
override fun onCreate(savedInstanceState: Bundle?) {
// 设置可以显示在锁屏页面之上
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true)
// 强制亮屏
// setTurnScreenOn(true)
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
keyguardManager.requestDismissKeyguard(this, null)
}
this.window.addFlags(
WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD or
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED or
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
)
super.onCreate(savedInstanceState)
}
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
ExpressManager.loadAppOutExpress() try {
val wallpaperManager = WallpaperManager.getInstance(this)
val wallpaperDrawable: Drawable = wallpaperManager.drawable
container.background = wallpaperDrawable
} catch (e: java.lang.Exception) {
e.printStackTrace()
container.setBackgroundColor(Color.BLACK)
}
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
mHelper.swipeBackLayout.setEdgeSize(ToolUtil.getScreenWidth(this)) mHelper.swipeBackLayout.setEdgeSize(ToolUtil.getScreenWidth(this))
...@@ -68,9 +54,6 @@ class ScreenActivity : BaseSwipeBackCompatActivity(), View.OnClickListener { ...@@ -68,9 +54,6 @@ class ScreenActivity : BaseSwipeBackCompatActivity(), View.OnClickListener {
override fun onClick(v: View?) { override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return if (AntiShake.check(v?.id)) return
// 预加载信息流
ExpressManager.loadExpress(false)
when (v?.id) { when (v?.id) {
R.id.tvBoost -> { R.id.tvBoost -> {
val bundle = Bundle() val bundle = Bundle()
...@@ -106,28 +89,13 @@ class ScreenActivity : BaseSwipeBackCompatActivity(), View.OnClickListener { ...@@ -106,28 +89,13 @@ class ScreenActivity : BaseSwipeBackCompatActivity(), View.OnClickListener {
try { try {
if (fl_ad != null) { if (fl_ad != null) {
fl_ad.removeAllViews() fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout()) fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
} }
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }
} }
override fun onNetworkConnected(type: NetUtils.NetType?) {}
override fun onNetworkDisConnected() {}
override fun isApplyStatusBarTranslucency() = false
override fun toggleOverridePendingTransition() = false
override fun getOverridePendingTransitionMode() = TransitionMode.FADE
override fun toggleIsBack2Left() = false
override fun getBundleExtras(extras: Bundle?) {}
override fun getContentViewLayoutID() = R.layout.activity_screen override fun getContentViewLayoutID() = R.layout.activity_screen
override fun getLoadingTargetView() = null
} }
\ No newline at end of file
package com.mints.flowbox.ui.activitys.keepalive
import android.os.Bundle
import androidx.core.content.ContextCompat
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.keepalive.AlarmManager
import com.mints.flowbox.ui.activitys.IncreasespeedActivity
import com.mints.flowbox.ui.activitys.SpeedFastActivity
import com.mints.flowbox.ui.activitys.SpeedTestActivity
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.utils.SpanUtils
import com.mints.flowbox.utils.SystemUtils
import kotlinx.android.synthetic.main.activity_timing.*
import kotlinx.android.synthetic.main.activity_timing.fl_ad
import kotlinx.android.synthetic.main.activity_timing.iv_close
import kotlin.random.Random
/**
*
* 描述:定时或具体操作弹出的activity
*/
class TimingActivity : BaseActivity() {
companion object {
const val TIMING_TYPE = "TIMING_TYPE"
const val TIMING_TYPE_BOOST = 0 // 加速
const val TIMING_TYPE_CLEAN = 1 // 清理
const val TIMING_TYPE_SAVE_ELE = 2 // 省电
const val TIMING_TYPE_WIFI_BOOST = 3 // 信号增强
const val TIMING_TYPE_SPEED_TEST = 4 // 网络测速
}
/**
* 0-加速 1-清理 2-省电
* 3-wifi加速 4-网络测速
*
*/
private var mType = 0
private var rope: YoYo.YoYoString? = null
override fun getContentViewLayoutID() = R.layout.activity_timing
override fun initViewsAndEvents() {
iv_close.setOnClickListener {
finish()
overridePendingTransition(0, 0)
}
initView()
}
private fun initView() {
when (mType) {
TIMING_TYPE_BOOST -> { // 加速
val usedPercentValue = SystemUtils.getUsedPercentValue(mContext)
tvInfo.text = SpanUtils()
.append("内存占用")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.gray))
.append("${usedPercentValue}%")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.red))
.create()
btnClean.text = "立即加速"
}
TIMING_TYPE_CLEAN -> { // 清理
tvInfo.text = SpanUtils()
.append("大量文件")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.red))
.append("待清理")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.gray))
.create()
btnClean.text = "立即清理"
}
TIMING_TYPE_SAVE_ELE -> { // 省电
if (AppConfig.fakeSaveBatteryCount == 0) {
AppConfig.fakeSaveBatteryCount = 1 + Random.nextInt(8)
}
tvInfo.text = SpanUtils()
.append("检测到")
.append("${AppConfig.fakeSaveBatteryCount}个")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.red))
.append("应用耗电")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.gray))
.create()
btnClean.text = "立即省电"
}
TIMING_TYPE_WIFI_BOOST -> { // 信号增强
tvInfo.text = SpanUtils()
.append("信号增强")
.create()
btnClean.text = "信号增强"
}
TIMING_TYPE_SPEED_TEST -> { // 网络测速
tvInfo.text = SpanUtils()
.append("网络测速")
.create()
btnClean.text = "网络测速"
}
}
btnClean.setOnClickListener {
val bundle = Bundle()
when (mType) {
TIMING_TYPE_BOOST -> { // 加速
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
}
TIMING_TYPE_CLEAN -> { // 清理
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_CLEAN
)
}
TIMING_TYPE_SAVE_ELE -> { // 省电
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_SAVE_ELECTRICITY
)
}
TIMING_TYPE_WIFI_BOOST -> { // 信号增强
readyGo(SpeedFastActivity::class.java)
return@setOnClickListener
}
TIMING_TYPE_SPEED_TEST -> { // 省电
readyGo(SpeedTestActivity::class.java)
return@setOnClickListener
}
}
readyGoThenKill(IncreasespeedActivity::class.java, bundle)
}
}
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
mType = it.getInt(TIMING_TYPE, 0)
}
}
/**
* 初始化信息iyc
*/
private fun initExpress() {
try {
if (fl_ad != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getAppOutExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun isApplyKitKatTranslucency() = true
override fun finish() {
super.finish()
AlarmManager.getInstance().resetUserActionTime()
}
override fun onResume() {
super.onResume()
initExpress()
btnClean.postDelayed({
rope = YoYo.with(Techniques.Pulse).duration(1000).repeat(6).playOn(btnClean)
}, 200)
}
override fun onDestroy() {
rope?.stop()
rope = null
super.onDestroy()
}
override fun onBackPressed() {
// 屏蔽返回键
// super.onBackPressed()
}
}
\ No newline at end of file
...@@ -58,7 +58,7 @@ class BonusTaskAdapter( ...@@ -58,7 +58,7 @@ class BonusTaskAdapter(
holder.itemTaskPb.progress = taskBean.complete holder.itemTaskPb.progress = taskBean.complete
holder.itemTaskPb.max = taskBean.need holder.itemTaskPb.max = taskBean.need
if (taskBean.otherConfig != null){ if (taskBean.otherConfig != null) {
} }
......
...@@ -74,6 +74,9 @@ public class GvSignAdapter extends BaseAdapter { ...@@ -74,6 +74,9 @@ public class GvSignAdapter extends BaseAdapter {
if (TextUtils.equals(itemData.getStatus(), "lock")) { if (TextUtils.equals(itemData.getStatus(), "lock")) {
viewHolder.ic_my_icon.setImageResource(R.mipmap.ic_bouns_redbox_lock); viewHolder.ic_my_icon.setImageResource(R.mipmap.ic_bouns_redbox_lock);
viewHolder.tv_day.setTextColor(ContextCompat.getColor(mContext, R.color.color_FF2326)); viewHolder.tv_day.setTextColor(ContextCompat.getColor(mContext, R.color.color_FF2326));
} else if (TextUtils.equals(itemData.getStatus(), "open")) {
viewHolder.ic_my_icon.setImageResource(R.mipmap.ic_bouns_redbox);
viewHolder.tv_day.setTextColor(ContextCompat.getColor(mContext, R.color.color_FF2326));
} else { } else {
viewHolder.ic_my_icon.setImageResource(R.mipmap.ic_bouns_redbox_normal); viewHolder.ic_my_icon.setImageResource(R.mipmap.ic_bouns_redbox_normal);
viewHolder.tv_day.setTextColor(ContextCompat.getColor(mContext, R.color.gray)); viewHolder.tv_day.setTextColor(ContextCompat.getColor(mContext, R.color.gray));
......
...@@ -29,6 +29,8 @@ class MainWifiAdapter(val context: Context, val taskData: MutableList<WifiListBe ...@@ -29,6 +29,8 @@ class MainWifiAdapter(val context: Context, val taskData: MutableList<WifiListBe
mOnItemClickListener = onItemClickListener mOnItemClickListener = onItemClickListener
} }
// fun set
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
if (viewType == FriendsInvitedAdapter.HOLDER_TYPE_EMPTY) { if (viewType == FriendsInvitedAdapter.HOLDER_TYPE_EMPTY) {
val emptyView = val emptyView =
......
...@@ -127,10 +127,14 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View. ...@@ -127,10 +127,14 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
return return
} }
if (dataList[position].complete >= dataList[position].need)
return
when (view?.id) { when (view?.id) {
R.id.item_task_click -> { R.id.item_task_click -> {
when (dataList[position].carrierType) { when (dataList[position].carrierType) {
BonusTaskAdapter.CHALLENGE_VEDIO -> { BonusTaskAdapter.CHALLENGE_VEDIO -> {
// 看视频 // 看视频
if (dataList[position].otherConfig != null) { if (dataList[position].otherConfig != null) {
awardVedio( awardVedio(
...@@ -150,7 +154,7 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View. ...@@ -150,7 +154,7 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
readyGo(WrapperActivity::class.java, bundle) readyGo(WrapperActivity::class.java, bundle)
} }
BonusTaskAdapter.CHALLENGE_SHAREFRIEND -> { BonusTaskAdapter.CHALLENGE_SHAREFRIEND -> {
// 邀请好友
if (dataList[position].otherConfig != null) { if (dataList[position].otherConfig != null) {
when (dataList[position].otherConfig.status) { when (dataList[position].otherConfig.status) {
0, 2 -> { 0, 2 -> {
...@@ -162,20 +166,6 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View. ...@@ -162,20 +166,6 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
shareImgDialog() shareImgDialog()
} }
1 -> { 1 -> {
val bundle = Bundle()
bundle.putInt(
Constant.MAIN_CUR_COIN,
dataList[position].otherConfig.coin
)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CHALLENGE_SHAREFRIEND
)
bundle.putString(
Constant.MAIN_EXTRA_ID,
dataList[position].otherConfig.doubleCoin.toString()
)
readyGo(AwardActivity::class.java, bundle)
} }
} }
} }
......
...@@ -78,7 +78,8 @@ class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener { ...@@ -78,7 +78,8 @@ class GetPacketFragment : BaseFragment(), GetPacketView, View.OnClickListener {
// 看视频 // 看视频
(requireActivity() as MainActivity).clickTab2Layout() (requireActivity() as MainActivity).clickTab2Layout()
Handler(Looper.getMainLooper()).postDelayed({ Handler(Looper.getMainLooper()).postDelayed({
(requireActivity() as MainActivity).selectVideo() // (requireActivity() as MainActivity).selectVideo()
(requireActivity() as MainActivity).clickTab2Layout()
}, 200) }, 200)
} }
R.id.btn_invite -> { R.id.btn_invite -> {
......
package com.mints.flowbox.ui.fragment package com.mints.flowbox.ui.fragment
import android.Manifest import android.Manifest
import android.app.Dialog
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import android.view.LayoutInflater import android.view.LayoutInflater
...@@ -10,7 +9,6 @@ import android.widget.AdapterView ...@@ -10,7 +9,6 @@ import android.widget.AdapterView
import android.widget.GridView import android.widget.GridView
import com.mints.flowbox.R import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.express.PreLoadExpressManager
import com.mints.flowbox.ad.video.VideoAdingManager import com.mints.flowbox.ad.video.VideoAdingManager
import com.mints.flowbox.common.AppConfig import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant import com.mints.flowbox.common.Constant
...@@ -24,9 +22,8 @@ import com.mints.flowbox.ui.adapter.GvMyAdapter ...@@ -24,9 +22,8 @@ import com.mints.flowbox.ui.adapter.GvMyAdapter
import com.mints.flowbox.ui.adapter.ViewPagerAdapter import com.mints.flowbox.ui.adapter.ViewPagerAdapter
import com.mints.flowbox.ui.fragment.base.BaseFragment import com.mints.flowbox.ui.fragment.base.BaseFragment
import com.mints.flowbox.ui.widgets.WifiView import com.mints.flowbox.ui.widgets.WifiView
import com.mints.flowbox.ui.widgets.dialog.DialogListener
import com.mints.flowbox.ui.widgets.dialog.DialogUtils
import com.mints.flowbox.utils.WifiUtils import com.mints.flowbox.utils.WifiUtils
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import com.rd.animation.type.AnimationType import com.rd.animation.type.AnimationType
import com.tbruyelle.rxpermissions.RxPermissions import com.tbruyelle.rxpermissions.RxPermissions
...@@ -71,9 +68,6 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback, ...@@ -71,9 +68,6 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
/** 初始化 */ /** 初始化 */
private fun init() { private fun init() {
// 奖励页预加载 信息流广告
PreLoadExpressManager.loadADFrameLayout()
// 打开激活 // 打开激活
uploadDeviceInfo() uploadDeviceInfo()
} }
...@@ -118,23 +112,15 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback, ...@@ -118,23 +112,15 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
super.onResume() super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) { if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_ONE) {
refreshData() refreshData()
if (bubbleCount == 0) {
wifi_view.wifiOnAndNoBonus()
} else {
wifi_view.wifiOn() wifi_view.wifiOn()
} tvContent.text = "连续签到可得${AppConfig.HOME_BANNER_SIGN_GIVECASH}元红包"
tvContent.text = "每天签到最高可得${AppConfig.HOME_BANNER_SIGN_GIVECASH}元红包"
} }
} }
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
if (bubbleCount == 0) {
wifi_view.wifiOnAndNoBonus()
} else {
wifi_view.wifiOff() wifi_view.wifiOff()
} }
}
/** 刷新数据 **/ /** 刷新数据 **/
fun refreshData() { fun refreshData() {
...@@ -159,20 +145,12 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback, ...@@ -159,20 +145,12 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
override fun getContentViewLayoutID() = R.layout.fragment_home override fun getContentViewLayoutID() = R.layout.fragment_home
override fun onWifiOpen() { override fun onWifiOpen() {
if (bubbleCount == 0) {
wifi_view.wifiOnAndNoBonus()
} else {
wifi_view.wifiOn() wifi_view.wifiOn()
}
bg_view.setBackgroundResource(R.mipmap.bg_home_enable) bg_view.setBackgroundResource(R.mipmap.bg_home_enable)
} }
override fun onWifiClose() { override fun onWifiClose() {
if (bubbleCount == 0) {
wifi_view.wifiOnAndNoBonus()
} else {
wifi_view.wifiOff() wifi_view.wifiOff()
}
bg_view.setBackgroundResource(R.mipmap.bg_home_unenable) bg_view.setBackgroundResource(R.mipmap.bg_home_unenable)
} }
...@@ -182,21 +160,11 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback, ...@@ -182,21 +160,11 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
when (v?.id) { when (v?.id) {
// 网络测速 // 网络测速
R.id.btn_speed_test -> { R.id.btn_speed_test -> {
if (wifiManager.isWifiEnable) { if (!NetUtils.isNetworkConnected(context)) {
readyGo(SpeedTestActivity::class.java) showToast("网络异常,请检测网络")
} else { return
DialogUtils.showDialog(
requireActivity(),
"当前不是Wifi网络,是否还需要进行网络测速?",
"提示",
"确定",
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
super.onClick(dialog, v)
}
})
} }
readyGo(SpeedTestActivity::class.java)
} }
// 内存清理 // 内存清理
R.id.btn_clean -> { R.id.btn_clean -> {
...@@ -206,12 +174,17 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback, ...@@ -206,12 +174,17 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
if (granted) { if (granted) {
readyGo(CleanActivity::class.java) readyGo(CleanActivity::class.java)
} else { } else {
showMissingPermissionDialog("定位") showMissingPermissionDialog("存储")
} }
} }
} }
// 扫一扫 // 扫一扫
R.id.btn_scan -> { R.id.btn_scan -> {
if (!NetUtils.isNetworkConnected(context)) {
showToast("网络异常,请检测网络")
return
}
RxPermissions(requireActivity()) RxPermissions(requireActivity())
.request(Manifest.permission.CAMERA) .request(Manifest.permission.CAMERA)
.subscribe { granted: Boolean -> .subscribe { granted: Boolean ->
...@@ -224,9 +197,13 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback, ...@@ -224,9 +197,13 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
} }
// wifi提速 // wifi提速
R.id.btn_speed_fast -> { R.id.btn_speed_fast -> {
if (!NetUtils.isNetworkConnected(context)) {
showToast("网络异常,请检测网络")
return
}
// 预加载信息流 // 预加载信息流
ExpressManager.loadExpress(false) ExpressManager.loadExpress(false)
readyGo(SpeedFastActivity::class.java) readyGo(SpeedFastActivity::class.java)
} }
// 跳转福利页面 // 跳转福利页面
...@@ -261,7 +238,7 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback, ...@@ -261,7 +238,7 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
override fun getBubbleSuc(count: Int, coin: Int) { override fun getBubbleSuc(count: Int, coin: Int) {
bubbleCount = count bubbleCount = count
bubbleCoin = coin bubbleCoin = coin
wifi_view.setCount(count) wifi_view.setCount(bubbleCount)
if (wifiManager.isWifiEnable) { if (wifiManager.isWifiEnable) {
bg_view.setBackgroundResource(R.mipmap.bg_home_enable) bg_view.setBackgroundResource(R.mipmap.bg_home_enable)
......
...@@ -377,7 +377,6 @@ class MyFragment : BaseFragment(), ...@@ -377,7 +377,6 @@ class MyFragment : BaseFragment(),
val activity: MainActivity? = activity as MainActivity? val activity: MainActivity? = activity as MainActivity?
activity?.let { activity?.let {
it.clickTab2Layout() it.clickTab2Layout()
it.selectVideo()
} }
} }
1 -> { 1 -> {
...@@ -459,29 +458,29 @@ class MyFragment : BaseFragment(), ...@@ -459,29 +458,29 @@ class MyFragment : BaseFragment(),
awardVedio(taskBean.otherConfig.coin, Constant.CARRIER_VERSUS_VIDEO) awardVedio(taskBean.otherConfig.coin, Constant.CARRIER_VERSUS_VIDEO)
} }
} }
MainMyAdapter.TO_XMLY -> { // MainMyAdapter.TO_XMLY -> {
if (taskBean.otherConfig != null) { // if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) { // when (taskBean.otherConfig.status) {
0, 2 -> { // 0, 2 -> {
val activity: MainActivity? = activity as MainActivity? // val activity: MainActivity? = activity as MainActivity?
activity?.let { // activity?.let {
it.clickTab1Layout() // it.clickTab1Layout()
it.selectXmly() // it.selectXmly()
} // }
} // }
1 -> { // 1 -> {
val bundle = Bundle() // val bundle = Bundle()
bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin) // bundle.putInt(Constant.MAIN_CUR_COIN, taskBean.otherConfig.coin)
bundle.putString( // bundle.putString(
Constant.MAIN_CARRIER_TYPE, // Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_XMLY_CHALLENGE // Constant.CARRIER_XMLY_CHALLENGE
) // )
readyGo(AwardActivity::class.java, bundle) // readyGo(AwardActivity::class.java, bundle)
} // }
} // }
} // }
//
} // }
MainMyAdapter.TO_DOWNLOADS -> { MainMyAdapter.TO_DOWNLOADS -> {
if (taskBean.otherConfig != null) { if (taskBean.otherConfig != null) {
when (taskBean.otherConfig.status) { when (taskBean.otherConfig.status) {
...@@ -698,6 +697,7 @@ class MyFragment : BaseFragment(), ...@@ -698,6 +697,7 @@ class MyFragment : BaseFragment(),
} }
private fun initManager() { private fun initManager() {
BannerManager.instance.init()
videoAdingManager = VideoAdingManager.getInstance(activity) videoAdingManager = VideoAdingManager.getInstance(activity)
} }
......
...@@ -33,7 +33,6 @@ import com.yilan.sdk.ui.little.YLLittleVideoFragment ...@@ -33,7 +33,6 @@ import com.yilan.sdk.ui.little.YLLittleVideoFragment
import com.yilan.sdk.ylad.YLAdListener import com.yilan.sdk.ylad.YLAdListener
import kotlinx.android.synthetic.main.layout_red_bag.* import kotlinx.android.synthetic.main.layout_red_bag.*
import kotlinx.android.synthetic.main.layout_red_box.* import kotlinx.android.synthetic.main.layout_red_box.*
import net.grandcentrix.tray.AppPreferences
private val TAG = VideoFragment::class.java.simpleName private val TAG = VideoFragment::class.java.simpleName
...@@ -301,14 +300,14 @@ class VideoFragment : BaseFragment(), VideoView, View.OnClickListener { ...@@ -301,14 +300,14 @@ class VideoFragment : BaseFragment(), VideoView, View.OnClickListener {
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT LinearLayout.LayoutParams.WRAP_CONTENT
) )
params.setMargins(0, 0, 0, BubbleUtils.dp2px(410)) params.setMargins(0, 0, 0, BubbleUtils.dp2px(280))
cdvvYilanTime.layoutParams = params cdvvYilanTime.layoutParams = params
val paramsRedBox = FrameLayout.LayoutParams( val paramsRedBox = FrameLayout.LayoutParams(
FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT,
FrameLayout.LayoutParams.WRAP_CONTENT FrameLayout.LayoutParams.WRAP_CONTENT
) )
paramsRedBox.setMargins(0, BubbleUtils.dp2px(40), BubbleUtils.dp2px(10), 0) paramsRedBox.setMargins(0, BubbleUtils.dp2px(120), BubbleUtils.dp2px(10), 0)
paramsRedBox.gravity = Gravity.END paramsRedBox.gravity = Gravity.END
rl_fragment_main_redbox.layoutParams = paramsRedBox rl_fragment_main_redbox.layoutParams = paramsRedBox
cdvvYilanTime.setOnClickListener(this) cdvvYilanTime.setOnClickListener(this)
......
...@@ -20,11 +20,9 @@ import com.daimajia.androidanimations.library.Techniques ...@@ -20,11 +20,9 @@ import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo import com.daimajia.androidanimations.library.YoYo
import com.hjq.toast.ToastUtils import com.hjq.toast.ToastUtils
import com.mints.flowbox.R import com.mints.flowbox.R
import com.mints.flowbox.ad.banner.BannerManager
import com.mints.flowbox.ad.express.ExpressManager import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.AppConfig import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.TtCsjAdManager
import com.mints.flowbox.manager.UserManager import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.manager.wifi.WifiStateManager import com.mints.flowbox.manager.wifi.WifiStateManager
import com.mints.flowbox.mvp.model.WifiListBean import com.mints.flowbox.mvp.model.WifiListBean
...@@ -37,6 +35,7 @@ import com.mints.flowbox.ui.widgets.dialog.DialogUtils ...@@ -37,6 +35,7 @@ import com.mints.flowbox.ui.widgets.dialog.DialogUtils
import com.mints.flowbox.ui.widgets.dialog.WifiConnectDialog import com.mints.flowbox.ui.widgets.dialog.WifiConnectDialog
import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import com.mints.flowbox.utils.* import com.mints.flowbox.utils.*
import com.mints.flowbox.utils.keepalive.IntentUtils
import com.mints.library.net.netstatus.NetUtils import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.nodoubleclick.AntiShake import com.mints.library.utils.nodoubleclick.AntiShake
import com.tbruyelle.rxpermissions.RxPermissions import com.tbruyelle.rxpermissions.RxPermissions
...@@ -79,6 +78,8 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -79,6 +78,8 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_THREE) { if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_THREE) {
// 校验是否开启定位信息开关
if (PermissionUtils.isOpenGps(requireContext())) { if (PermissionUtils.isOpenGps(requireContext())) {
loadWifiData() loadWifiData()
} else { } else {
...@@ -86,8 +87,8 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -86,8 +87,8 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
} }
// 防止banner刷新太快 // 防止banner刷新太快
if (AntiShake.check(fl_wifi_banner?.id)) return // if (AntiShake.check(fl_wifi_banner?.id)) return
BannerManager.instance.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_wifi_banner) // BannerManager.instance.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_wifi_banner)
if (!TextUtils.isEmpty(UserManager.getInstance().userID)) { if (!TextUtils.isEmpty(UserManager.getInstance().userID)) {
(requireActivity() as MainActivity).refreshHall() (requireActivity() as MainActivity).refreshHall()
...@@ -98,7 +99,8 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -98,7 +99,8 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
} }
override fun initViewsAndEvents() { override fun initViewsAndEvents() {
BannerManager.instance.init() // Banner信息流初始化
// BannerManager.instance.init()
initRecy() initRecy()
initView() initView()
...@@ -109,7 +111,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -109,7 +111,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun loadWifiData() { private fun loadWifiData() {
btn_signal.postDelayed({ btn_signal.postDelayed({
rope = YoYo.with(Techniques.Tada).duration(1000).repeat(-1).playOn(btn_signal) rope = YoYo.with(Techniques.Pulse).duration(1000).repeat(-1).playOn(btn_signal)
}, 200) }, 200)
if (wifiUtils.isWifiEnable) { if (wifiUtils.isWifiEnable) {
...@@ -240,7 +242,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -240,7 +242,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
} }
if (AppConfig.isCanSaveBattery) { if (AppConfig.isCanSaveBattery) {
if (AppConfig.fakeSaveBatteryCount == 0) {
AppConfig.fakeSaveBatteryCount = 1 + Random.nextInt(8) AppConfig.fakeSaveBatteryCount = 1 + Random.nextInt(8)
}
tv_save_battery.text = SpanUtils() tv_save_battery.text = SpanUtils()
.append("超强省电\n") .append("超强省电\n")
.append("${AppConfig.fakeSaveBatteryCount}个") .append("${AppConfig.fakeSaveBatteryCount}个")
...@@ -253,7 +257,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -253,7 +257,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
} else { } else {
tv_save_battery.text = SpanUtils() tv_save_battery.text = SpanUtils()
.append("超强省电\n") .append("超强省电\n")
.append("延长时间") .append("延长待机")
.setForegroundColor(ContextCompat.getColor(mContext, R.color.gray)) .setForegroundColor(ContextCompat.getColor(mContext, R.color.gray))
.setFontSize(BubbleUtils.sp2px(10)) .setFontSize(BubbleUtils.sp2px(10))
.append("${AppConfig.fakeSaveBatteryCount}分钟") .append("${AppConfig.fakeSaveBatteryCount}分钟")
...@@ -375,6 +379,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -375,6 +379,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
readyGo(IncreasespeedActivity::class.java) readyGo(IncreasespeedActivity::class.java)
} }
R.id.tv_clean -> { // 一键清理 R.id.tv_clean -> { // 一键清理
RxPermissions(requireActivity())
.request(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.subscribe { granted: Boolean ->
if (granted) {
// 预加载信息流 // 预加载信息流
ExpressManager.loadExpress(false) ExpressManager.loadExpress(false)
...@@ -384,6 +392,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -384,6 +392,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
IncreasespeedActivity.INCREASE_CLEAN IncreasespeedActivity.INCREASE_CLEAN
) )
readyGo(IncreasespeedActivity::class.java, bundle) readyGo(IncreasespeedActivity::class.java, bundle)
} else {
showMissingPermissionDialog("存储")
}
}
} }
R.id.tv_save_battery -> { // 超强省电 R.id.tv_save_battery -> { // 超强省电
// 预加载信息流 // 预加载信息流
...@@ -397,10 +409,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -397,10 +409,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
readyGo(IncreasespeedActivity::class.java, bundle) readyGo(IncreasespeedActivity::class.java, bundle)
} }
R.id.btn_signal -> { // 信号增强 R.id.btn_signal -> { // 信号增强
if (PermissionUtils.checkPermission( if (ActivityCompat.checkSelfPermission(
mContext, requireActivity(),
Manifest.permission.ACCESS_COARSE_LOCATION Manifest.permission.ACCESS_FINE_LOCATION
) ) != PackageManager.PERMISSION_GRANTED
) { ) {
checkPermission() checkPermission()
return return
...@@ -444,11 +456,15 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -444,11 +456,15 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
RxPermissions(activity!!) RxPermissions(activity!!)
.request( .request(
Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE
) )
} else { } else {
RxPermissions(activity!!) RxPermissions(activity!!)
.request(Manifest.permission.ACCESS_FINE_LOCATION) .request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
} }
request.subscribe { granted: Boolean -> request.subscribe { granted: Boolean ->
if (granted) { if (granted) {
...@@ -467,7 +483,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -467,7 +483,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
}, 1000) }, 1000)
} else { } else {
showMissingPermissionDialog("位置") showMissingPermissionDialog("位置,存储")
} }
} }
} }
...@@ -532,12 +548,13 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener, ...@@ -532,12 +548,13 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
loadWifiData() loadWifiData()
} }
/** wifi关闭 */
override fun onWifiClose() { override fun onWifiClose() {
loadWifiData() loadWifiData()
} }
override fun onDestroy() { override fun onDestroy() {
fl_wifi_banner?.removeAllViews() // fl_wifi_banner?.removeAllViews()
super.onDestroy() super.onDestroy()
} }
} }
\ No newline at end of file
...@@ -129,6 +129,11 @@ public class WifiView extends FrameLayout implements View.OnClickListener { ...@@ -129,6 +129,11 @@ public class WifiView extends FrameLayout implements View.OnClickListener {
} }
public void wifiOn() { public void wifiOn() {
if (mCount == 0) {
wifiOnAndNoBonus();
return;
}
progressBar.resumeAnim(); progressBar.resumeAnim();
setTitle("WIFI已连接"); setTitle("WIFI已连接");
...@@ -153,7 +158,7 @@ public class WifiView extends FrameLayout implements View.OnClickListener { ...@@ -153,7 +158,7 @@ public class WifiView extends FrameLayout implements View.OnClickListener {
setTitle("WIFI已连接"); setTitle("WIFI已连接");
tvInfo.setText("今日流量补贴金额已达到上限"); tvInfo.setText("今日流量补贴金额已达到上限");
progressBar.setComplete(); progressBar.post(() -> progressBar.setComplete());
} }
public void wifiOff() { public void wifiOff() {
......
...@@ -100,6 +100,9 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall ...@@ -100,6 +100,9 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
public void onActivityCreated(Activity activity, Bundle savedInstanceState) { public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
if (activity == null) if (activity == null)
return; return;
app_activity = new WeakReference<>(activity);
if (TextUtils.equals(activity.getClass().getSimpleName(), "MainActivity")) { if (TextUtils.equals(activity.getClass().getSimpleName(), "MainActivity")) {
main_activity = new WeakReference<>(activity); main_activity = new WeakReference<>(activity);
} }
......
package com.mints.flowbox.utils; package com.mints.flowbox.utils;
import android.os.Handler; import android.os.Handler;
import android.os.Looper;
import android.os.Message; import android.os.Message;
import android.widget.TextView; import android.widget.TextView;
...@@ -30,7 +31,7 @@ public class TimeThread extends Thread { ...@@ -30,7 +31,7 @@ public class TimeThread extends Thread {
} }
} }
private Handler mHandler = new Handler() { private Handler mHandler = new Handler(Looper.getMainLooper()) {
@Override @Override
public void handleMessage(Message msg) { public void handleMessage(Message msg) {
super.handleMessage(msg); super.handleMessage(msg);
......
...@@ -2,7 +2,6 @@ package com.mints.flowbox.utils; ...@@ -2,7 +2,6 @@ package com.mints.flowbox.utils;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.location.LocationManager;
import android.net.ConnectivityManager; import android.net.ConnectivityManager;
import android.net.NetworkInfo; import android.net.NetworkInfo;
import android.net.wifi.ScanResult; import android.net.wifi.ScanResult;
......
package com.mints.flowbox.utils.keepalive;
import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;
import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.utils.NotificationUtils;
import net.phone.PhoneBrandUtils;
import java.util.List;
/**
* @author jyx
* @date 2021/7/10
* @des
*/
public class IntentUtils {
public static final String TAG = "IntentUtils";
public static void startActivity(Activity activity, Intent intent) {
if (PhoneBrandUtils.isXiaomi() | PhoneBrandUtils.isVivo() | PhoneBrandUtils.isOppo()) {
if (!isRunningForeground(activity)) {
// if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
moveToFront(activity);
MintsApplication.getContext().startActivity(intent);
activity.moveTaskToBack(true);
// } else {
// NotificationUtils.INSTANCE.sendNotificationFullScreen(activity, "", "", intent);
// }
} else {
MintsApplication.getContext().startActivity(intent);
}
} else {
MintsApplication.getContext().startActivity(intent);
}
}
public static Boolean isRunningForeground(Activity activity) {
ActivityManager activityManager = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> taskInfoList = activityManager.getRunningTasks(1);
for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
if (taskInfo.baseActivity.getPackageName().equals(activity.getPackageName())) {
return true;
}
}
return false;
}
public static void moveToFront(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> taskInfoList = activityManager.getRunningTasks(1);
for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
//遍历找到本应用的 task,并将它切换到前台
if (taskInfo.baseActivity.getPackageName().equals(context.getPackageName())) {
activityManager.moveTaskToFront(taskInfo.id, 0);
return;
}
}
}
/**
* 跳转GPS设置
*/
public static void openGPSSettings(Context context) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
context.startActivity(intent);
}
}
package com.mints.flowbox.utils; package com.mints.flowbox.utils.keepalive;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.AppOpsManager; import android.app.AppOpsManager;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.os.Build; import android.os.Build;
import android.provider.Settings; import android.provider.Settings;
import android.util.Log; import android.util.Log;
import com.mints.flowbox.MintsApplication;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.List;
/** /**
* @author jyx * @author jyx
* @date 2021/7/10 * @date 2021/7/13
* @des * @des
*/ */
public class IntentUtils { public class LockPermissionUtils {
public static final String TAG = "IntentUtils"; public static final String TAG = "LockPermissionUtils";
/** /**
* 小米后台弹出界面权限检测 * 小米后台弹出界面权限检测
...@@ -35,7 +29,7 @@ public class IntentUtils { ...@@ -35,7 +29,7 @@ public class IntentUtils {
AppOpsManager ops = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); AppOpsManager ops = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
try { try {
int op = 10021; int op = 10021;
Method method = ops.getClass().getMethod("checkOpNoThrow", new Class[]{int.class, int.class, String.class}); Method method = ops.getClass().getMethod("checkOpNoThrow", int.class, int.class, String.class);
Integer result = (Integer) method.invoke(ops, op, android.os.Process.myUid(), context.getPackageName()); Integer result = (Integer) method.invoke(ops, op, android.os.Process.myUid(), context.getPackageName());
return result == AppOpsManager.MODE_ALLOWED; return result == AppOpsManager.MODE_ALLOWED;
...@@ -53,13 +47,14 @@ public class IntentUtils { ...@@ -53,13 +47,14 @@ public class IntentUtils {
*/ */
public static boolean canShowLockView(Context context) { public static boolean canShowLockView(Context context) {
AppOpsManager ops = null; AppOpsManager ops = null;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
ops = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE); ops = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
}
try { try {
int op = 10020; // >= 23 int op = 10020; // >= 23
// ops.checkOpNoThrow(op, uid, packageName) // ops.checkOpNoThrow(op, uid, packageName)
Method method = ops.getClass().getMethod("checkOpNoThrow", new Class[] Method method = ops.getClass().getMethod("checkOpNoThrow",
{int.class, int.class, String.class} int.class, int.class, String.class);
);
Integer result = (Integer) method.invoke(ops, op, android.os.Process.myUid(), context.getPackageName()); Integer result = (Integer) method.invoke(ops, op, android.os.Process.myUid(), context.getPackageName());
return result == AppOpsManager.MODE_ALLOWED; return result == AppOpsManager.MODE_ALLOWED;
...@@ -71,7 +66,7 @@ public class IntentUtils { ...@@ -71,7 +66,7 @@ public class IntentUtils {
} }
/** /**
* 判断vivo后台弹出界面 false未开启 true开启 * 判断vivo后台弹出界面 1未开启 0开启
* *
* @param context * @param context
* @return * @return
...@@ -102,12 +97,12 @@ public class IntentUtils { ...@@ -102,12 +97,12 @@ public class IntentUtils {
} }
/** /**
* 判断vivo锁屏显示 1未开启 0开启 * 判断vivo锁屏显示
* *
* @param context * @param context
* @return * @return
*/ */
public static int getVivoLockStatus(Context context) { public static boolean getVivoLockStatus(Context context) {
String packageName = context.getPackageName(); String packageName = context.getPackageName();
Uri uri2 = Uri.parse("content://com.vivo.permissionmanager.provider.permission/control_locked_screen_action"); Uri uri2 = Uri.parse("content://com.vivo.permissionmanager.provider.permission/control_locked_screen_action");
String selection = "pkgname = ?"; String selection = "pkgname = ?";
...@@ -120,67 +115,23 @@ public class IntentUtils { ...@@ -120,67 +115,23 @@ public class IntentUtils {
if (cursor.moveToFirst()) { if (cursor.moveToFirst()) {
int currentmode = cursor.getInt(cursor.getColumnIndex("currentstate")); int currentmode = cursor.getInt(cursor.getColumnIndex("currentstate"));
cursor.close(); cursor.close();
return currentmode; return currentmode == 0;
} else { } else {
cursor.close(); cursor.close();
return 1; return false;
} }
} }
} catch (Throwable throwable) { } catch (Throwable throwable) {
throwable.printStackTrace(); throwable.printStackTrace();
} }
return 1;
}
public static void startActivity(Activity activity, Intent intent) {
if (isAllowedBackPopPermission(activity) | getvivoBgStartActivityPermissionStatus(activity)) {
if (!isRunningForeground(activity)) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
moveToFront(activity);
MintsApplication.getContext().startActivity(intent);
activity.moveTaskToBack(true);
} else {
NotificationUtils.INSTANCE.sendNotificationFullScreen(activity, "", "", intent);
}
} else {
MintsApplication.getContext().startActivity(intent);
}
} else {
MintsApplication.getContext().startActivity(intent);
}
}
public static Boolean isRunningForeground(Activity activity) {
ActivityManager activityManager = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> taskInfoList = activityManager.getRunningTasks(1);
for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
if (taskInfo.baseActivity.getPackageName().equals(activity.getPackageName())) {
return true;
}
}
return false; return false;
} }
public static void moveToFront(Context context) { public static boolean getOppoLockStatus(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
List<ActivityManager.RunningTaskInfo> taskInfoList = activityManager.getRunningTasks(20); return Settings.canDrawOverlays(context);
for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
//遍历找到本应用的 task,并将它切换到前台
if (taskInfo.baseActivity.getPackageName().equals(context.getPackageName())) {
activityManager.moveTaskToFront(taskInfo.id, 0);
return;
}
}
} }
/** return true;
* 跳转GPS设置
*/
public static void openGPSSettings(Context context) {
Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
context.startActivity(intent);
} }
} }
package com.mints.flowbox.utils.keepalive
import android.annotation.SuppressLint
import android.app.KeyguardManager
import android.content.Context
import android.os.Build
import android.os.PowerManager
import android.provider.Settings
import android.view.Gravity
import android.view.View
import android.view.WindowManager
import net.DebugConfig
import net.common.utils.CommonUtils
import net.phone.PhoneBrandUtils
import net.utils.Log
import java.text.SimpleDateFormat
import java.util.*
private const val TAG = "screenlocker.utils"
@Suppress("DEPRECATION")
object ScreenLockerUtils {
fun canShowScreenLocker(context: Context): Boolean {
try {
val pm = context.getSystemService(Context.POWER_SERVICE) as PowerManager
val km = context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
if (DebugConfig.DEBUG) Log.d(
TAG, "canShowScreenLocker() called with: " +
"pm.isScreenOn = [${pm.isScreenOn}], km.isKeyguardLocked = ${km.isKeyguardLocked}"
)
!pm.isScreenOn || km.isKeyguardLocked
} else {
if (DebugConfig.DEBUG) Log.d(
TAG, "canShowScreenLocker() called with: " +
"pm.isScreenOn = [${pm.isScreenOn}]"
)
!pm.isScreenOn
}
} catch (e: java.lang.Exception) {
if (DebugConfig.DEBUG) Log.e(TAG, "isScreenOff: ERROR", e)
}
return false
}
fun hasSystemLockScreen(context: Context): Boolean {
return CommonUtils.hasSystemLockScreen(context)
}
fun updateWindowFlags(decorView: View) {
decorView.systemUiVisibility =
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY or
View.SYSTEM_UI_FLAG_IMMERSIVE or View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or
View.SYSTEM_UI_FLAG_FULLSCREEN or View.SYSTEM_UI_FLAG_LOW_PROFILE
}
fun makeLockWindowFullScreen(
context: Context,
layoutParams: WindowManager.LayoutParams,
addShowWhenLocked: Boolean = true
) {
// make window full screen
layoutParams.flags = layoutParams.flags or WindowManager.LayoutParams.FLAG_FULLSCREEN or
WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS or WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR or
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
val outMetrics = CommonUtils.getRealDisplayMetrics(context)
layoutParams.width = outMetrics.widthPixels
layoutParams.height = outMetrics.heightPixels
layoutParams.x = 0
layoutParams.y = 0
layoutParams.gravity = Gravity.TOP
if (addShowWhenLocked) {
layoutParams.flags =
layoutParams.flags or WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
layoutParams.flags =
layoutParams.flags or WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
}
layoutParams.flags =
layoutParams.flags or WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS
layoutParams.flags =
layoutParams.flags or WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS or WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION
}
@SuppressLint("ConstantLocale")
private val sHourFormat24 = SimpleDateFormat("HH:mm", Locale.getDefault())
@SuppressLint("ConstantLocale")
private val sHourFormat12 = SimpleDateFormat("hh:mm", Locale.getDefault())
fun getHourString(context: Context, time: Long): String? {
val strTimeFormat = Settings.System.getString(
context.contentResolver,
Settings.System.TIME_12_24
)
if ("12" == strTimeFormat) {
try {
return sHourFormat12.format(time)
} catch (e: Exception) {
}
}
return sHourFormat24.format(time)
}
/**
* 如果是禁用锁屏的系统,则使用非锁屏版本
*/
fun isLockScreenProtected(@Suppress("UNUSED_PARAMETER") context: Context): Boolean {
return PhoneBrandUtils.isLockScreenProtected()
}
//
// fun tryStartMoveTaskToFront(context: Context, reason: Int): Boolean {
// if (DebugConfig.DEBUG) Log.d(TAG, "moveTaskToFront() called with: context = [$context]", RuntimeException())
//
// doConfuse()
//
// val lastInstance = ScreenLockerContext.lastInstance()
// if (lastInstance?.isResumed == true) {
// if (DebugConfig.DEBUG) Log.w(TAG, "moveTaskToFront: already in front. ignored")
// return true
// }
//
// if (lastInstance?.taskId == null) {
// if (DebugConfig.DEBUG) Log.w(TAG, "moveTaskToFront: no instance found. ignored!")
// return false
// }
//
// val taskId = lastInstance.taskId!!
//
//
// Observable.intervalRange(1, 3, 3, 3, TimeUnit.SECONDS)
// .subscribe(object : Observer<Long> {
// lateinit var disposable: Disposable
//
// private fun shouldMoveTask(): Boolean {
// val activityObserver = ScreenLockerContext.lastInstance()
// return when (reason) {
// ScreenLockerConstants.SHOW_REASON_SCREEN_OFF,
// ScreenLockerConstants.SHOW_REASON_RESTART_SELF,
// ScreenLockerConstants.SHOW_REASON_CALL_IDLE -> {
// activityObserver?.isResumed != true
// }
// else -> {
// activityObserver?.isResumed != true && activityObserver?.isResumedSinceLastScreenOff != true
// }
// }
// }
//
// override fun onSubscribe(d: Disposable) {
// if (DebugConfig.DEBUG) Log.d(TAG, "onSubscribe() called with: d = [$d]")
//
// disposable = d
// if (shouldMoveTask()) {
// OONotify.performMoveTaskToFront(context, taskId)
// } else {
// disposable.dispose()
// }
// }
//
// override fun onNext(t: Long) {
// if (DebugConfig.DEBUG) Log.d(TAG, "onNext() called with: t = [$t]")
//
// if (shouldMoveTask()) {
// OONotify.performMoveTaskToFront(context, taskId)
// } else {
// if (DebugConfig.DEBUG) Log.w(TAG, "onNext: further call cancelled!")
// disposable.dispose()
// }
// }
//
// override fun onComplete() {
// if (DebugConfig.DEBUG) Log.d(TAG, "onComplete() called ")
// }
//
// override fun onError(e: Throwable) {
// if (DebugConfig.DEBUG) Log.e(TAG, "onError: ERROR", e)
//
// }
//
// })
//
// return true
// }
//
// @Suppress("SimplifyBooleanWithConstants", "JoinDeclarationAndAssignment", "UNUSED_VARIABLE", "NOTHING_TO_INLINE")
// private inline fun doConfuse() {
// do {
// var o: Any? = null
//
// try {
// o = System.out
// if (o != null) {
// break
// }
// } catch (ignored: Exception) {
// } finally {
// // ignore
// }
// //noinspection LoopStatementThatDoesntLoop,PointlessBooleanExpression,ConstantConditions
// while (false && o != null) {
// break
// }
//
// var fis: FileInputStream? = null
// try {
//
// fis = FileInputStream("/proc/self/cmdline")
//
// val buffer = ByteArray(256)
//
// var len = 0
// var b: Int
// b = fis.read()
// while (b > 0 && len < buffer.size) {
// buffer[len++] = b.toByte()
// }
// if (len > 0) {
// val s = String(buffer, 0, len)
// }
// } catch (ignored: Exception) {
// } finally {
// if (fis != null) {
// try {
// fis.close()
// } catch (ignored: Exception) {
// }
//
// }
// }
// try {
// throw NoSuchFieldException()
// } catch (e: NoSuchFieldException) {
// if (DebugConfig.DEBUG) Log.e("OOService", "ERROR", e)
// }
// } while (false)
// }
fun isOV(): Boolean {
return PhoneBrandUtils.isOppo() or PhoneBrandUtils.isVivo()
}
fun closeSystemLockView(context: Context) {
if (DebugConfig.DEBUG) Log.d(
TAG,
"closeSystemLockView() called with: context = [$context]",
RuntimeException()
)
try {
(context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).newKeyguardLock(
"IN"
)
} catch (e: Exception) {
if (DebugConfig.DEBUG) Log.e(TAG, "closeSystemLockView: ERROR", e)
}
try {
// 这个permission 太敏感了,拿掉了
(context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager).newKeyguardLock(
"unLock"
).disableKeyguard()
} catch (e: Exception) {
if (DebugConfig.DEBUG) Log.e(TAG, "closeSystemLockView: ERROR", e)
}
}
fun isOppoScreenLockOpen(context: Context): Boolean {
return LockPermissionUtils.getOppoLockStatus(context)
}
fun isVivoScreenLockOpen(context: Context): Boolean {
return LockPermissionUtils.getVivoLockStatus(context)
}
}
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient <gradient
android:angle="270" android:angle="90"
android:endColor="#C9C3FF" android:endColor="#C9C3FF"
android:startColor="#AFA6FF" /> android:startColor="#AFA6FF" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout 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_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white" android:background="@color/white"
...@@ -68,7 +67,7 @@ ...@@ -68,7 +67,7 @@
android:layout_marginRight="2dp" android:layout_marginRight="2dp"
android:padding="5dp" android:padding="5dp"
android:text="@string/register_name" android:text="@string/register_name"
android:textColor="@color/color_FF9837" android:textColor="@color/color_main"
android:textSize="14sp" /> android:textSize="14sp" />
<View <View
...@@ -76,7 +75,7 @@ ...@@ -76,7 +75,7 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_marginTop="5dp" android:layout_marginTop="5dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:background="@color/color_FF9837" /> android:background="@color/color_main" />
<TextView <TextView
android:id="@+id/tvAboutasPolicy" android:id="@+id/tvAboutasPolicy"
...@@ -85,7 +84,7 @@ ...@@ -85,7 +84,7 @@
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:padding="5dp" android:padding="5dp"
android:text="隐私政策" android:text="隐私政策"
android:textColor="@color/color_FF9837" android:textColor="@color/color_main"
android:textSize="14sp" /> android:textSize="14sp" />
</LinearLayout> </LinearLayout>
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/color_20000000"> android:background="@color/color_10000000"
android:orientation="vertical">
<androidx.appcompat.widget.LinearLayoutCompat <androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="300dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginStart="15dp"
android:layout_marginTop="120dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_bg_write" android:background="@drawable/shape_bg_write"
android:orientation="vertical" android:orientation="vertical"
android:visibility="visible"> android:visibility="visible">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:drawableStart="@drawable/ic_launcher_main_mini"
android:drawablePadding="5dp"
android:gravity="center_vertical"
android:padding="5dp"
android:text="@string/appName"
android:textColor="@color/black" />
<ImageView <ImageView
android:id="@+id/iv_close" android:id="@+id/iv_close"
android:layout_width="20dp" android:layout_width="22dp"
android:layout_height="20dp" android:layout_height="22dp"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_gravity="end" android:layout_gravity="end|center_vertical"
android:layout_margin="10dp" android:layout_marginEnd="10dp"
android:src="@mipmap/ic_close" android:src="@mipmap/ic_close"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
</androidx.appcompat.widget.LinearLayoutCompat>
<TextView <TextView
android:id="@+id/tvTitle" android:id="@+id/tvTitle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="-20dp"
android:text="安装包卸载" android:text="安装包卸载"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="18sp" android:textSize="18sp"
...@@ -89,7 +113,10 @@ ...@@ -89,7 +113,10 @@
android:id="@+id/btnClean" android:id="@+id/btnClean"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="40dp"
android:layout_margin="15dp" android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_green_light" android:background="@drawable/shape_green_light"
android:text="立即清理" android:text="立即清理"
android:textColor="@color/white" android:textColor="@color/white"
...@@ -101,4 +128,14 @@ ...@@ -101,4 +128,14 @@
</androidx.appcompat.widget.LinearLayoutCompat> </androidx.appcompat.widget.LinearLayoutCompat>
</FrameLayout> <com.mints.flowbox.ui.widgets.RoundRectLayout
\ No newline at end of file android:id="@+id/fl_ad"
android:layout_width="360dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dp"
android:background="@drawable/shape_gold_card"
android:elevation="2dip"
android:gravity="center" />
</LinearLayout>
\ No newline at end of file
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginTop="4dp"
android:background="@drawable/shape_btn_gold_left" android:background="@drawable/shape_btn_gold_left"
android:drawablePadding="4dp" android:drawablePadding="4dp"
android:gravity="center" android:gravity="center"
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/transparent"> android:background="@color/color_10000000">
<com.mints.flowbox.ui.widgets.CircleCleanAnimationView <com.mints.flowbox.ui.widgets.CircleCleanAnimationView
android:id="@+id/ccav_speed" android:id="@+id/ccav_speed"
...@@ -15,18 +15,18 @@ ...@@ -15,18 +15,18 @@
android:layout_width="360dp" android:layout_width="360dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@color/colorPrimaryDark" android:background="@color/color_main"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<ImageView <ImageView
android:id="@+id/iv_close" android:id="@+id/iv_close"
android:layout_width="30dp" android:layout_width="20dp"
android:layout_height="30dp" android:layout_height="20dp"
android:layout_gravity="right" android:layout_gravity="right"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_marginEnd="10dp" android:layout_marginEnd="10dp"
android:src="@mipmap/ic_activity_quit" /> android:src="@mipmap/ic_close" />
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
...@@ -55,6 +55,19 @@ ...@@ -55,6 +55,19 @@
android:elevation="2dip" android:elevation="2dip"
android:gravity="center" /> android:gravity="center" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="10dp"
android:background="@color/color_20000000"
android:drawableStart="@drawable/ic_launcher_main_mini"
android:drawablePadding="5dp"
android:padding="5dp"
android:text="@string/appName"
android:textColor="@color/white"
android:textSize="10sp" />
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/container"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/transparent"> android:background="@color/transparent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView <TextView
android:id="@+id/tvTime" android:id="@+id/tvTime"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="20dp" android:layout_marginStart="20dp"
android:layout_marginTop="30dp" android:layout_marginTop="50dp"
android:text="-" android:text="-"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="60sp" /> android:textSize="60sp" />
...@@ -75,20 +80,37 @@ ...@@ -75,20 +80,37 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/tvBoost" android:layout_below="@id/tvBoost"
android:layout_centerHorizontal="true" android:layout_centerHorizontal="true"
android:layout_marginStart="15dp"
android:layout_marginTop="20dp" android:layout_marginTop="20dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_gold_card" android:background="@drawable/shape_gold_card"
android:elevation="2dip" android:elevation="2dip"
android:gravity="center" /> android:gravity="center" />
</RelativeLayout>
<TextView <TextView
android:id="@+id/tv" android:id="@+id/tv"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="80dp" android:layout_height="80dp"
android:layout_alignParentBottom="true" android:layout_gravity="bottom"
android:background="@color/color_20000000" android:background="@color/color_20000000"
android:gravity="center" android:gravity="center"
android:text="右滑关闭" android:text="> > 右滑关闭"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="20sp" /> android:textSize="20sp" />
</RelativeLayout> <TextView
\ No newline at end of file android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right|bottom"
android:layout_marginTop="10dp"
android:layout_marginBottom="80dp"
android:background="@color/color_20000000"
android:drawableStart="@drawable/ic_launcher_main_mini"
android:drawablePadding="5dp"
android:padding="5dp"
android:text="@string/appName"
android:textColor="@color/white"
android:textSize="10sp" />
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="match_parent"
android:background="@color/color_10000000"
android:orientation="vertical">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="15dp"
android:layout_marginTop="120dp"
android:layout_marginEnd="15dp"
android:background="@drawable/shape_bg_write"
android:orientation="vertical">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:drawableStart="@drawable/ic_launcher_main_mini"
android:drawablePadding="6dp"
android:gravity="center_vertical"
android:padding="5dp"
android:text="@string/appName"
android:textColor="@color/black" />
<ImageView
android:id="@+id/iv_close"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_alignParentEnd="true"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="10dp"
android:src="@mipmap/ic_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.appcompat.widget.LinearLayoutCompat>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="10dp"
android:src="@mipmap/ic_launcher" />
<TextView
android:id="@+id/tvInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:gravity="center"
android:text="-"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/ivIcon"
app:layout_constraintTop_toBottomOf="@+id/tvTitle" />
<Button
android:id="@+id/btnClean"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginStart="20dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="20dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_green_light"
android:text="立即清理"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvInfo2" />
</androidx.appcompat.widget.LinearLayoutCompat>
<com.mints.flowbox.ui.widgets.RoundRectLayout
android:id="@+id/fl_ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_margin="15dp"
android:background="@drawable/shape_gold_card"
android:elevation="2dip"
android:gravity="center" />
</LinearLayout>
\ No newline at end of file
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
android:paddingRight="2dp" android:paddingRight="2dp"
android:paddingBottom="6dp" android:paddingBottom="6dp"
android:text="@string/register_name" android:text="@string/register_name"
android:textColor="@color/color_FF9837" android:textColor="@color/color_main"
android:textSize="12sp" /> android:textSize="12sp" />
<TextView <TextView
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
android:paddingRight="2dp" android:paddingRight="2dp"
android:paddingBottom="6dp" android:paddingBottom="6dp"
android:text="隐私政策" android:text="隐私政策"
android:textColor="@color/color_FF9837" android:textColor="@color/color_main"
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
...@@ -175,37 +175,34 @@ ...@@ -175,37 +175,34 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal"> android:orientation="vertical">
<TextView <TextView
android:id="@+id/btn_dialogper_back" android:id="@+id/btn_dialogper_next"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="36dp" android:layout_height="36dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:layout_weight="1" android:background="@color/color_main"
android:background="@color/color_ccc"
android:gravity="center" android:gravity="center"
android:text="同意" android:text="同意"
android:textColor="@color/white" /> android:textColor="@color/white" />
<TextView <TextView
android:id="@+id/btn_dialogper_next" android:id="@+id/btn_dialogper_back"
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="36dp" android:layout_height="36dp"
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginLeft="20dp" android:layout_marginLeft="20dp"
android:layout_marginTop="10dp"
android:layout_marginRight="20dp" android:layout_marginRight="20dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:layout_weight="1" android:background="@color/color_ccc"
android:background="@color/color_FF9837"
android:gravity="center" android:gravity="center"
android:text="同意" android:text="同意"
android:textColor="@color/white" /> android:textColor="@color/white" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</RelativeLayout> </RelativeLayout>
...@@ -86,7 +86,7 @@ ...@@ -86,7 +86,7 @@
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:text="WIFI未开启" android:text="WIFI未开启"
android:textColor="@color/black" android:textColor="@color/black"
android:textSize="22sp" android:textSize="20sp"
android:textStyle="bold" android:textStyle="bold"
app:layout_constraintStart_toEndOf="@+id/imageView2" app:layout_constraintStart_toEndOf="@+id/imageView2"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
......
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