Commit b9070f1d authored by jyx's avatar jyx

更新UI

parent 4b959344
......@@ -265,4 +265,7 @@ dependencies {
implementation(name: 'net_native-v3.1.3.22-release', ext: 'aar')
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'androidx.core:core-ktx:1.1.0'
// switchbutton
implementation 'com.github.iielse:switchbutton:1.0.4'
}
......@@ -158,6 +158,19 @@
android:excludeFromRecents="true"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.appswitch.AppSwitchActivity"
android:excludeFromRecents="true"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.appswitch.BoostWhiteActivity"
android:excludeFromRecents="true"
android:screenOrientation="portrait" />
<activity
android:name=".ui.activitys.ScoreTestActivity"
android:excludeFromRecents="true"
android:screenOrientation="portrait" />
<activity
android:name="com.mints.fiveworld.ui.activitys.anim.ResultActivity"
android:excludeFromRecents="true"
......
......@@ -3,9 +3,11 @@ package com.mints.fiveworld.clean;
import android.app.usage.StorageStats;
import android.app.usage.StorageStatsManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.storage.StorageManager;
......@@ -18,7 +20,9 @@ import com.mints.fiveworld.utils.LogUtil;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
public class CleanUtils {
......@@ -164,4 +168,51 @@ public class CleanUtils {
return "" + size + "B";
}
/**
* 获取全部可以打开的APP packageName
*/
public static List<CacheListItem> getAllApp(Context context) {
PackageManager pm = context.getPackageManager();
// 查询所有已经安装的应用程序
List<ApplicationInfo> appInfos = pm.getInstalledApplications(PackageManager.GET_UNINSTALLED_PACKAGES);// GET_UNINSTALLED_PACKAGES代表已删除,但还有安装目录的
List<CacheListItem> allList = new ArrayList<>();
// 创建一个类别为CATEGORY_LAUNCHER的该包名的Intent
Intent resolveIntent = new Intent(Intent.ACTION_MAIN, null);
resolveIntent.addCategory(Intent.CATEGORY_LAUNCHER);
// 通过getPackageManager()的queryIntentActivities方法遍历,得到所有能打开的app的packageName
List<ResolveInfo> resolveinfoList = context.getPackageManager()
.queryIntentActivities(resolveIntent, 0);
Set<String> allowPackages = new HashSet();
for (ResolveInfo resolveInfo : resolveinfoList) {
allowPackages.add(resolveInfo.activityInfo.packageName);
}
for (ApplicationInfo app : appInfos) {
//通过flag排除系统应用,会将电话、短信也排除掉
// if ((app.flags & ApplicationInfo.FLAG_SYSTEM) <= 0) {
// applicationInfos.add(app);
// }
// if(app.uid > 10000){//通过uid排除系统应用,在一些手机上效果不好
// applicationInfos.add(app);
// }
if (allowPackages.contains(app.packageName)) {
if (app.packageName.equals(context.getPackageName()))
continue;
// 应用名称
String label = app.loadLabel(pm).toString();
// 应用图标
Drawable icon = app.loadIcon(pm);
CacheListItem cacheListItem = new CacheListItem(app.packageName, label, icon, 0);
allList.add(cacheListItem);
}
}
return allList;
}
}
......@@ -50,4 +50,10 @@ public class AppConfig {
public static boolean isRiskFlag=false;//是否命中风控
/* 上次网络测速数值 */
public static String lastSpeedType = "";
public static String lastSpeedData = "";
/* 降温数据 */
public static String lastCoolData = "";
}
......@@ -41,8 +41,8 @@ object Constant {
// 协议地址
var REGISTER_URL = BuildConfig.MainIp + "ds/register.html"//服务协议
var PRIVACY_URL = BuildConfig.MainIp + "ds/privacy.html"//隐私协议
var REGISTER_URL = BuildConfig.MainIp + "fiveworld/register.html"//服务协议
var PRIVACY_URL = BuildConfig.MainIp + "fiveworld/privacy.html"//隐私协议
// 载体
/*******************************************************/
......
......@@ -22,55 +22,43 @@ object CsjGroMoreManager {
private val TAG = CsjGroMoreManager::class.java.simpleName
//-------------------------广告位 start-----------------------------
private const val OUT_COMMON_INTERSTITIAL_CODE = "947204630" // 应用外 普通 插屏
private const val OUT_COMMON_NEW_INTERSTITIAL_CODE = "947383652" // 应用外 普通 新插屏(半屏)
private const val OUT_COMMON_INTERSTITIAL_CODE = "947512541" // 应用外 普通 插屏
private const val OUT_COMMON_FULL_CODE = "947383645" // 应用外 普通 新插屏(全屏)
private const val OUT_COMMON_EXPRESS_CODE = "947383660" // 应用外 普通 信息流
private const val OUT_LOCK_EXPRESS_CODE = "947383657" // 应用外 锁屏 信息流
private const val OUT_TIMER_FULL_CODE = "947383654" // 应用外 定时 新插屏(全屏)
private const val OUT_TIMER_INTERSTITIAL_CODE = "" // 应用外 定时 插屏
private const val OUT_TIMER_NEW_INTERSTITIAL_CODE = "947383655" // 应用外 定时 新插屏(半屏)
private const val OUT_TIMER_INTERSTITIAL_CODE = "947512544" // 应用外 定时 插屏
private const val IN_COMMON_FULL_CODE = "947383649" // 应用内 普通 新插屏(全屏)
private const val IN_COMMON_INTERSTITIAL_CODE = "" // 应用内 普通 插屏
private const val IN_COMMON_NEW_INTERSTITIAL_CODE = "947383661" // 应用内 普通 新插屏(半屏)
private const val IN_COMMON_INTERSTITIAL_CODE = "947512543" // 应用内 普通 插屏
private const val IN_COMMON_EXPRESS_CODE = "947383658" // 应用内 普通 信息流
private const val IN_MONEY_SPLASH_CODE = "887645925" // 应用内 网赚 开屏
private const val IN_MONEY_SPLASH_AD_CODE = "" // 应用内 网赚 开屏 兜底(代码位)
//-------------------------广告位 end-----------------------------
//-------------------------广告id标识 start-----------------------------
private const val IN_MONEY_SPLASH_ID = "IN_MONEY_SPLASH_ID"// 应用内 网赚 开屏
private const val IN_MONEY_SPLASH_ID_AD_CODE = "IN_MONEY_SPLASH_ID_AD_CODE"// 应用内 网赚 开屏 兜底
private const val IN_COMMON_EXPRESS_ID = "IN_COMMON_EXPRESS_ID"// 应用内 普通 信息流
private const val IN_COMMON_FULL_ID = "IN_COMMON_FULL_ID"// 应用内 普通 新插屏(全屏)
private const val IN_COMMON_INTERSTITIALID = "IN_COMMON_INTERSTITIALID"// 应用内 普通 插屏
private const val IN_COMMON_NEW_INTERSTITIALID = "IN_COMMON_NEW_INTERSTITIALID"// 应用内 普通 新插屏(半屏)
private const val OUT_LOCK_EXPRESS_ID = "OUT_LOCK_EXPRESS_ID"// 应用外 锁屏 信息流
private const val OUT_COMMON_EXPRESS_ID = "OUT_COMMON_EXPRESS_ID"// 应用外 普通 信息流
private const val OUT_TIMER_FULL_ID = "OUT_TIMER_FULL_ID"// 应用外 定时 新插屏(全屏)
private const val OUT_TIMER_INTERSTITIALID = "OUT_TIMER_INTERSTITIALID"// 应用外 定时 插屏
private const val OUT_TIMER_NEW_INTERSTITIALID = "OUT_TIMER_NEW_INTERSTITIALID"// 应用外 定时 新插屏(半屏)
private const val OUT_COMMON_FULL_ID = "OUT_COMMON_FULL_ID"// 应用外 普通 新插屏(全屏)
private const val OUT_COMMON_INTERSTITIALID = "OUT_COMMON_INTERSTITIALID"// 应用外 普通 插屏
private const val OUT_COMMON_NEW_INTERSTITIALID = "OUT_COMMON_NEW_INTERSTITIALID"// 应用外 普通 新插屏(半屏)
// 云控第二套代码标识
private const val NEW_IN_MONEY_SPLASH_ID = "NEW_IN_MONEY_SPLASH_ID"// 应用内 网赚 开屏
private const val NEW_IN_MONEY_SPLASH_ID_AD_CODE = "NEW_IN_MONEY_SPLASH_ID_AD_CODE"// 应用内 网赚 开屏 兜底
private const val NEW_IN_COMMON_EXPRESS_ID = "NEW_IN_COMMON_EXPRESS_ID"// 应用内 普通 信息流
private const val NEW_IN_COMMON_FULL_ID = "NEW_IN_COMMON_FULL_ID"// 应用内 普通 新插屏(全屏)
private const val NEW_IN_COMMON_INTERSTITIALID = "NEW_IN_COMMON_INTERSTITIALID"// 应用内 普通 插屏
private const val NEW_IN_COMMON_NEW_INTERSTITIALID = "NEW_IN_COMMON_NEW_INTERSTITIALID"// 应用内 普通 新插屏(半屏)
private const val NEW_OUT_LOCK_EXPRESS_ID = "NEW_OUT_LOCK_EXPRESS_ID"// 应用外 锁屏 信息流
private const val NEW_OUT_COMMON_EXPRESS_ID = "NEW_OUT_COMMON_EXPRESS_ID"// 应用外 普通 信息流
private const val NEW_OUT_TIMER_FULL_ID = "NEW_OUT_TIMER_FULL_ID"// 应用外 定时 新插屏(全屏)
private const val NEW_OUT_TIMER_INTERSTITIALID = "NEW_OUT_TIMER_INTERSTITIALID"// 应用外 定时 插屏
private const val NEW_OUT_TIMER_NEW_INTERSTITIALID = "NEW_OUT_TIMER_NEW_INTERSTITIALID"// 应用外 定时 新插屏(半屏)
private const val NEW_OUT_COMMON_FULL_ID = "NEW_OUT_COMMON_FULL_ID"// 应用外 普通 新插屏(全屏)
private const val NEW_OUT_COMMON_INTERSTITIALID = "NEW_OUT_COMMON_INTERSTITIALID"// 应用外 普通 插屏
private const val NEW_OUT_COMMON_NEW_INTERSTITIALID = "NEW_OUT_COMMON_NEW_INTERSTITIALID"// 应用外 普通 新插屏(半屏)
private const val SERVER_TT_AD_ID = "SERVER_TT_AD_ID"
private const val IS_USE_NEW_ID = "IS_USE_NEW_ID"//是否使用新的代码位
......@@ -131,10 +119,6 @@ object CsjGroMoreManager {
// 应用内 网赚 开屏
setInMoneySplashId(it.gromoreAdcodes_main.groSplash, _isUseNewId)
}
if (!TextUtils.isEmpty(it.gromoreAdcodes_main.groSplashAdcode)) {
// 应用内 网赚 开屏(兜底)
setInMoneySplashIdAdCode(it.gromoreAdcodes_main.groSplashAdcode, _isUseNewId)
}
}
if (it.gromoreAdcodes_ordinary != null) { // 应用内普通
......@@ -149,8 +133,8 @@ object CsjGroMoreManager {
if (!TextUtils.isEmpty(it.gromoreAdcodes_ordinary.groNewInterstitialHalf)) {
// 应用内 普通 插屏
setInCommonInterstitialId(
it.gromoreAdcodes_ordinary.groNewInterstitialHalf,
_isUseNewId
it.gromoreAdcodes_ordinary.groNewInterstitialHalf,
_isUseNewId
)
}
}
......@@ -163,29 +147,29 @@ object CsjGroMoreManager {
if (!TextUtils.isEmpty(it.gromoreAdcodes_outer_ordinary.groNewInterstitial)) {
// 应用外 定时 新插屏(全屏)
setOutTimerFullId(
it.gromoreAdcodes_outer_ordinary.groNewInterstitial,
_isUseNewId
it.gromoreAdcodes_outer_ordinary.groNewInterstitial,
_isUseNewId
)
}
if (!TextUtils.isEmpty(it.gromoreAdcodes_outer_ordinary.groNewInterstitialHalf)) {
// 应用外 定时 插屏
setOutTimerInterstitialId(
it.gromoreAdcodes_outer_ordinary.groNewInterstitialHalf,
_isUseNewId
it.gromoreAdcodes_outer_ordinary.groNewInterstitialHalf,
_isUseNewId
)
}
if (!TextUtils.isEmpty(it.gromoreAdcodes_outer_ordinary.groNewInterstitial_sence)) {
// 应用外场景 全屏
setOutCommonFullId(
it.gromoreAdcodes_outer_ordinary.groNewInterstitial_sence,
_isUseNewId
it.gromoreAdcodes_outer_ordinary.groNewInterstitial_sence,
_isUseNewId
)
}
if (!TextUtils.isEmpty(it.gromoreAdcodes_outer_ordinary.groNewInterstitialHalf_sence)) {
// 应用外场景 插屏
setOutCommonInterstitialId(
it.gromoreAdcodes_outer_ordinary.groNewInterstitialHalf_sence,
_isUseNewId
it.gromoreAdcodes_outer_ordinary.groNewInterstitialHalf_sence,
_isUseNewId
)
}
}
......@@ -200,19 +184,19 @@ object CsjGroMoreManager {
UmengManager.onEvent(AdReportManager.EventType.EVENT_TYPE_KILL_MAIN_PROGRESS.name)
TrackManager.getInstance().addCallImp(
AdReportManager.INNER_IN,
AdReportManager.AD_TYPE_SPLASH,
"",
"",
"",
"",
"",
"",
"",
"",
System.currentTimeMillis(),
"ONE_KILL",
"第一次杀死主进程"
AdReportManager.INNER_IN,
AdReportManager.AD_TYPE_SPLASH,
"",
"",
"",
"",
"",
"",
"",
"",
System.currentTimeMillis(),
"ONE_KILL",
"第一次杀死主进程"
)
setSecondKillMySelf(true)
......@@ -231,19 +215,19 @@ object CsjGroMoreManager {
UmengManager.onEvent(AdReportManager.EventType.EVENT_TYPE_KILL_MAIN_PROGRESS_TWICE.name)
TrackManager.getInstance().addCallImp(
AdReportManager.INNER_IN,
AdReportManager.AD_TYPE_SPLASH,
"",
"",
"",
"",
"",
"",
"",
"",
System.currentTimeMillis(),
"DOUBLE_KILL",
"第二次杀死主进程"
AdReportManager.INNER_IN,
AdReportManager.AD_TYPE_SPLASH,
"",
"",
"",
"",
"",
"",
"",
"",
System.currentTimeMillis(),
"DOUBLE_KILL",
"第二次杀死主进程"
)
setSecondKillMySelf(false)
......@@ -280,10 +264,10 @@ object CsjGroMoreManager {
fun getInCommonExpressId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get().getString(NEW_IN_COMMON_EXPRESS_ID, IN_COMMON_EXPRESS_CODE)
?: IN_COMMON_EXPRESS_CODE
?: IN_COMMON_EXPRESS_CODE
} else {
AppPreferencesManager.get().getString(IN_COMMON_EXPRESS_ID, IN_COMMON_EXPRESS_CODE)
?: IN_COMMON_EXPRESS_CODE
?: IN_COMMON_EXPRESS_CODE
}
}
......@@ -304,10 +288,10 @@ object CsjGroMoreManager {
fun getInCommonFullId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get().getString(NEW_IN_COMMON_FULL_ID, IN_COMMON_FULL_CODE)
?: IN_COMMON_FULL_CODE
?: IN_COMMON_FULL_CODE
} else {
AppPreferencesManager.get().getString(IN_COMMON_FULL_ID, IN_COMMON_FULL_CODE)
?: IN_COMMON_FULL_CODE
?: IN_COMMON_FULL_CODE
}
}
......@@ -322,48 +306,21 @@ object CsjGroMoreManager {
}
}
/**
* 应用内 普通 新插屏(半屏)
*/
private fun setInCommonNewInterstitialId(vale: String, _isUseNewId: Boolean) {
if (_isUseNewId) {
AppPreferencesManager.get().put(NEW_IN_COMMON_NEW_INTERSTITIALID, vale)
} else {
AppPreferencesManager.get().put(IN_COMMON_NEW_INTERSTITIALID, vale)
}
}
/**
* 应用内 普通 插屏
*/
fun getInCommonInterstitialId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get()
.getString(NEW_IN_COMMON_INTERSTITIALID, IN_COMMON_INTERSTITIAL_CODE)
?: IN_COMMON_INTERSTITIAL_CODE
} else {
AppPreferencesManager.get()
.getString(IN_COMMON_INTERSTITIALID, IN_COMMON_INTERSTITIAL_CODE)
?: IN_COMMON_INTERSTITIAL_CODE
}
}
/**
* 应用内 普通 新插屏(半屏)
*/
fun getInCommonNewInterstitialId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get()
.getString(NEW_IN_COMMON_NEW_INTERSTITIALID, IN_COMMON_NEW_INTERSTITIAL_CODE)
?: IN_COMMON_NEW_INTERSTITIAL_CODE
.getString(NEW_IN_COMMON_INTERSTITIALID, IN_COMMON_INTERSTITIAL_CODE)
?: IN_COMMON_INTERSTITIAL_CODE
} else {
AppPreferencesManager.get()
.getString(IN_COMMON_NEW_INTERSTITIALID, IN_COMMON_NEW_INTERSTITIAL_CODE)
?: IN_COMMON_NEW_INTERSTITIAL_CODE
.getString(IN_COMMON_INTERSTITIALID, IN_COMMON_INTERSTITIAL_CODE)
?: IN_COMMON_INTERSTITIAL_CODE
}
}
/**
* 应用外 锁屏 信息流
*/
......@@ -381,10 +338,10 @@ object CsjGroMoreManager {
fun getOutLockExpressId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get().getString(NEW_OUT_LOCK_EXPRESS_ID, OUT_LOCK_EXPRESS_CODE)
?: OUT_LOCK_EXPRESS_CODE
?: OUT_LOCK_EXPRESS_CODE
} else {
AppPreferencesManager.get().getString(OUT_LOCK_EXPRESS_ID, OUT_LOCK_EXPRESS_CODE)
?: OUT_LOCK_EXPRESS_CODE
?: OUT_LOCK_EXPRESS_CODE
}
}
......@@ -405,11 +362,11 @@ object CsjGroMoreManager {
fun getOutCommonExpressId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get()
.getString(NEW_OUT_COMMON_EXPRESS_ID, OUT_COMMON_EXPRESS_CODE)
?: OUT_COMMON_EXPRESS_CODE
.getString(NEW_OUT_COMMON_EXPRESS_ID, OUT_COMMON_EXPRESS_CODE)
?: OUT_COMMON_EXPRESS_CODE
} else {
AppPreferencesManager.get().getString(OUT_COMMON_EXPRESS_ID, OUT_COMMON_EXPRESS_CODE)
?: OUT_COMMON_EXPRESS_CODE
?: OUT_COMMON_EXPRESS_CODE
}
}
......@@ -430,10 +387,10 @@ object CsjGroMoreManager {
fun getOutTimerFullId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get().getString(NEW_OUT_TIMER_FULL_ID, OUT_TIMER_FULL_CODE)
?: OUT_TIMER_FULL_CODE
?: OUT_TIMER_FULL_CODE
} else {
AppPreferencesManager.get().getString(OUT_TIMER_FULL_ID, OUT_TIMER_FULL_CODE)
?: OUT_TIMER_FULL_CODE
?: OUT_TIMER_FULL_CODE
}
}
......@@ -448,44 +405,18 @@ object CsjGroMoreManager {
}
}
/**
* 应用外 定时 新插屏(全屏)
*/
private fun setOutTimerNewInterstitialId(vale: String, _isUseNewId: Boolean) {
if (_isUseNewId) {
AppPreferencesManager.get().put(NEW_OUT_TIMER_NEW_INTERSTITIALID, vale)
} else {
AppPreferencesManager.get().put(OUT_TIMER_NEW_INTERSTITIALID, vale)
}
}
/**
* 应用外 定时 插屏
*/
fun getOutTimerInterstitialId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get()
.getString(NEW_OUT_TIMER_INTERSTITIALID, OUT_TIMER_INTERSTITIAL_CODE)
?: OUT_TIMER_INTERSTITIAL_CODE
} else {
AppPreferencesManager.get()
.getString(OUT_TIMER_INTERSTITIALID, OUT_TIMER_INTERSTITIAL_CODE)
?: OUT_TIMER_INTERSTITIAL_CODE
}
}
/**
* 应用外 定时 新插屏(半屏)
*/
fun getOutTimerNewInterstitialId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get()
.getString(NEW_OUT_TIMER_NEW_INTERSTITIALID, OUT_TIMER_NEW_INTERSTITIAL_CODE)
?: OUT_TIMER_NEW_INTERSTITIAL_CODE
.getString(NEW_OUT_TIMER_INTERSTITIALID, OUT_TIMER_INTERSTITIAL_CODE)
?: OUT_TIMER_INTERSTITIAL_CODE
} else {
AppPreferencesManager.get()
.getString(OUT_TIMER_NEW_INTERSTITIALID, OUT_TIMER_NEW_INTERSTITIAL_CODE)
?: OUT_TIMER_NEW_INTERSTITIAL_CODE
.getString(OUT_TIMER_INTERSTITIALID, OUT_TIMER_INTERSTITIAL_CODE)
?: OUT_TIMER_INTERSTITIAL_CODE
}
}
......@@ -506,10 +437,10 @@ object CsjGroMoreManager {
fun getOutCommonFullId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get().getString(NEW_OUT_COMMON_FULL_ID, OUT_COMMON_FULL_CODE)
?: OUT_COMMON_FULL_CODE
?: OUT_COMMON_FULL_CODE
} else {
AppPreferencesManager.get().getString(OUT_COMMON_FULL_ID, OUT_COMMON_FULL_CODE)
?: OUT_COMMON_FULL_CODE
?: OUT_COMMON_FULL_CODE
}
}
......@@ -524,44 +455,18 @@ object CsjGroMoreManager {
}
}
/**
* 应用外 普通 新插屏(全屏)
*/
private fun setOutCommonNewInterstitialId(vale: String, _isUseNewId: Boolean) {
if (_isUseNewId) {
AppPreferencesManager.get().put(NEW_OUT_COMMON_NEW_INTERSTITIALID, vale)
} else {
AppPreferencesManager.get().put(OUT_COMMON_NEW_INTERSTITIALID, vale)
}
}
/**
* 应用外 普通 插屏
*/
fun getOutCommonInterstitialId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get()
.getString(NEW_OUT_COMMON_INTERSTITIALID, OUT_COMMON_INTERSTITIAL_CODE)
?: OUT_COMMON_INTERSTITIAL_CODE
} else {
AppPreferencesManager.get()
.getString(OUT_COMMON_INTERSTITIALID, OUT_COMMON_INTERSTITIAL_CODE)
?: OUT_COMMON_INTERSTITIAL_CODE
}
}
/**
* 应用外 普通 新插屏(半屏)
*/
fun getOutCommonNewInterstitialId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get()
.getString(NEW_OUT_COMMON_NEW_INTERSTITIALID, OUT_COMMON_NEW_INTERSTITIAL_CODE)
?: OUT_COMMON_NEW_INTERSTITIAL_CODE
.getString(NEW_OUT_COMMON_INTERSTITIALID, OUT_COMMON_INTERSTITIAL_CODE)
?: OUT_COMMON_INTERSTITIAL_CODE
} else {
AppPreferencesManager.get()
.getString(OUT_COMMON_NEW_INTERSTITIALID, OUT_COMMON_NEW_INTERSTITIAL_CODE)
?: OUT_COMMON_NEW_INTERSTITIAL_CODE
.getString(OUT_COMMON_INTERSTITIALID, OUT_COMMON_INTERSTITIAL_CODE)
?: OUT_COMMON_INTERSTITIAL_CODE
}
}
......@@ -582,36 +487,10 @@ object CsjGroMoreManager {
fun getInMoneySplashId(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get().getString(NEW_IN_MONEY_SPLASH_ID, IN_MONEY_SPLASH_CODE)
?: IN_MONEY_SPLASH_CODE
?: IN_MONEY_SPLASH_CODE
} else {
AppPreferencesManager.get().getString(IN_MONEY_SPLASH_ID, IN_MONEY_SPLASH_CODE)
?: IN_MONEY_SPLASH_CODE
}
}
/**
* 应用内 网赚 开屏 兜底
*/
private fun setInMoneySplashIdAdCode(vale: String, _isUseNewId: Boolean) {
if (_isUseNewId) {
AppPreferencesManager.get().put(NEW_IN_MONEY_SPLASH_ID_AD_CODE, vale)
} else {
AppPreferencesManager.get().put(IN_MONEY_SPLASH_ID_AD_CODE, vale)
}
}
/**
* 应用内 网赚 开屏 兜底
*/
fun getInMoneySplashIdAdCode(): String {
return if (getIsUseNewId()) {
AppPreferencesManager.get()
.getString(NEW_IN_MONEY_SPLASH_ID_AD_CODE, IN_MONEY_SPLASH_AD_CODE)
?: IN_MONEY_SPLASH_AD_CODE
} else {
AppPreferencesManager.get()
.getString(IN_MONEY_SPLASH_ID_AD_CODE, IN_MONEY_SPLASH_AD_CODE)
?: IN_MONEY_SPLASH_AD_CODE
?: IN_MONEY_SPLASH_CODE
}
}
......@@ -626,9 +505,9 @@ object CsjGroMoreManager {
* 获取 服务器云控id
*/
fun getServerTTAdId() =
AppPreferencesManager.get()
.getString(SERVER_TT_AD_ID, TTGroMoreAdManagerHolder.TT_AD_APPID)
?: TTGroMoreAdManagerHolder.TT_AD_APPID
AppPreferencesManager.get()
.getString(SERVER_TT_AD_ID, TTGroMoreAdManagerHolder.TT_AD_APPID)
?: TTGroMoreAdManagerHolder.TT_AD_APPID
fun setIsUseNewId(isUseNewId: Boolean = false) {
AppPreferencesManager.get().put(IS_USE_NEW_ID, isUseNewId)
......
......@@ -86,6 +86,26 @@ object WifiDataManager {
// 总开关
const val APP_OUT_SWITCH = "APP_OUT_SWITCH"
// 上次加速操作时间
const val FAKE_BOOST_TIME = "FAKE_BOOST_TIME"
// 上次清理操作时间
const val FAKE_CLEAN_TIME = "FAKE_CLEAN_TIME"
// 上次省电操作时间
const val FAKE_SAVE_BATTERY_TIME = "FAKE_SAVE_BATTERY_TIME"
// 上次安全检测操作时间
const val FAKE_SAFE_CHECK_TIME = "FAKE_SAFE_CHECK_TIME"
// 上次网络测速操作时间
const val FAKE_SPEED_TEST_TIME = "FAKE_SPEED_TEST_TIME"
// 上次Wifi提速操作时间
const val FAKE_SPEED_FAST_TIME = "FAKE_SPEED_FAST_TIME"
// 上次W测分分值
const val LAST_SCORE = "LAST_SCORE"
// 锁屏 单位:次数
var LOCK_TIMES = 120
......@@ -2086,5 +2106,46 @@ object WifiDataManager {
// fun getTimingShowWhenScreenOnPercentage() =
// sp.getInt(LOCAL_TIMING_SHOW_WHEN_SCREEN_ON_PERCENTAGE, 0)
fun getFakeBoostTime() = sp.getLong(FAKE_BOOST_TIME, 0L)
fun setFakeBoostTime(value: Long) {
sp.put(FAKE_BOOST_TIME, value)
}
fun getFakeCleanTime() = sp.getLong(FAKE_CLEAN_TIME, 0L)
fun setFakeCleanTime(value: Long) {
sp.put(FAKE_CLEAN_TIME, value)
}
fun getFakeSaveBatteryTime() = sp.getLong(FAKE_SAVE_BATTERY_TIME, 0L)
fun setFakeSaveBatteryTime(value: Long) {
sp.put(FAKE_SAVE_BATTERY_TIME, value)
}
fun getFakeSaveCheckTime() = sp.getLong(FAKE_SAFE_CHECK_TIME, 0L)
fun setFakeSaveCheckTime(value: Long) {
sp.put(FAKE_SAFE_CHECK_TIME, value)
}
fun getFakeSpeedTestTime() = sp.getLong(FAKE_SPEED_TEST_TIME, 0L)
fun setFakeSpeedTestTime(value: Long) {
sp.put(FAKE_SPEED_TEST_TIME, value)
}
fun getFakeSpeedFastTime() = sp.getLong(FAKE_SPEED_FAST_TIME, 0L)
fun setFakeSpeedFastTime(value: Long) {
sp.put(FAKE_SPEED_FAST_TIME, value)
}
fun getFakeLastScore() = sp.getString(LAST_SCORE, "")
fun setFakeLastScore(value: String) {
sp.put(LAST_SCORE, value)
}
}
\ No newline at end of file
......@@ -82,7 +82,7 @@ class MainPresenter : BasePresenter<MainView>() {
Handler(Looper.getMainLooper()).postDelayed({
val intent = Intent(forwardActivity, HintActivity::class.java)
intent.putExtra(HintActivity.HINT_TEXT, baseResponse.data.msg)
forwardActivity.startActivity(intent)
// forwardActivity.startActivity(intent)
}, 200)
}
}
......
......@@ -25,6 +25,7 @@ import com.mints.fiveworld.ad.wifi.WifiAdManager
import com.mints.fiveworld.ad.wifi.WifiAdStatusListener
import com.mints.fiveworld.common.AppConfig
import com.mints.fiveworld.common.Constant
import com.mints.fiveworld.manager.wifi.WifiDataManager
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.ui.adapter.CleanListAdapter
import com.mints.fiveworld.ui.adapter.listener.OnItemClickListener
......@@ -339,10 +340,11 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
if (AppConfig.fakeSaveBatteryMinter == 0) {
AppConfig.fakeSaveBatteryMinter = 20 + Random.nextInt(40)
}
headTitleStr = "超强省电"
AppConfig.lastCoolData = "" + (2 + Random.nextInt(5))
headTitleStr = "电池降温"
titleStr = SpanUtils()
.append("延长待机时间")
.append("${AppConfig.fakeSaveBatteryMinter}分钟")
.append("电池成功降温")
.append("${AppConfig.lastCoolData}℃")
.setForegroundColor(ContextCompat.getColor(this, R.color.color_FFDD0C))
.create()
infoStr = "电池已达到最佳状态"
......@@ -635,13 +637,22 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
private fun resetTime() {
when (mIncreaseType) {
INCREASE_BOOST -> {
AppConfig.fakeBoostTime = System.currentTimeMillis()
// AppConfig.fakeBoostTime = System.currentTimeMillis()
if (TimeRender.isOverspedMin2(WifiDataManager.getFakeBoostTime(), 3)) {
WifiDataManager.setFakeBoostTime(System.currentTimeMillis())
}
}
INCREASE_CLEAN -> {
AppConfig.fakeCleanTime = System.currentTimeMillis()
// AppConfig.fakeCleanTime = System.currentTimeMillis()
if (TimeRender.isOverspedMin2(WifiDataManager.getFakeCleanTime(), 3)) {
WifiDataManager.setFakeCleanTime(System.currentTimeMillis())
}
}
INCREASE_SAVE_ELECTRICITY -> {
AppConfig.fakeSaveBatteryTime = System.currentTimeMillis()
// AppConfig.fakeSaveBatteryTime = System.currentTimeMillis()
if (TimeRender.isOverspedMin2(WifiDataManager.getFakeSaveBatteryTime(), 3)) {
WifiDataManager.setFakeSaveBatteryTime(System.currentTimeMillis())
}
}
}
}
......
......@@ -21,7 +21,7 @@ import com.mints.fiveworld.mvp.model.UserTaskMsgBean
import com.mints.fiveworld.mvp.presenters.MainPresenter
import com.mints.fiveworld.mvp.views.MainView
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.ui.fragment.WifiFragment
import com.mints.fiveworld.ui.fragment.MainFragment
import com.mints.fiveworld.utils.WifiUtils
import com.permissionx.guolindev.PermissionX
......@@ -45,7 +45,7 @@ class MainActivity : BaseActivity(), MainView {
mainPresenter.attachView(this)
if (threeFragment == null) {
threeFragment = WifiFragment()
threeFragment = MainFragment()
}
if (!threeFragment!!.isAdded) {
......@@ -110,7 +110,7 @@ class MainActivity : BaseActivity(), MainView {
if (AppPreferencesManager.get().getBoolean(Constant.IS_ONE_PERMISSIONS, true)) {
AppPreferencesManager.get().put(Constant.IS_ONE_PERMISSIONS, false)
checkPermission()
(threeFragment as WifiFragment).setIsFirstEnter(true)
(threeFragment as MainFragment).setIsFirstEnter(true)
}
}
......
......@@ -16,14 +16,18 @@ import com.mints.fiveworld.ad.express.OutSceneExpress
import com.mints.fiveworld.ad.express.ExpressManager
import com.mints.fiveworld.ad.wifi.WifiAdManager
import com.mints.fiveworld.ad.wifi.WifiAdStatusListener
import com.mints.fiveworld.common.AppConfig
import com.mints.fiveworld.common.Constant
import com.mints.fiveworld.manager.DownloadApkManager
import com.mints.fiveworld.manager.wifi.NetSpeed
import com.mints.fiveworld.manager.wifi.WifiDataManager
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.ui.widgets.dialog.DialogListener
import com.mints.fiveworld.ui.widgets.dialog.DialogUtils
import com.mints.fiveworld.utils.PingNet
import com.mints.fiveworld.utils.TimeRender
import com.mints.fiveworld.utils.Utils
import com.mints.fiveworld.utils.WifiUtils
import kotlinx.android.synthetic.main.activity_net_testing.*
import kotlinx.android.synthetic.main.header_layout.*
import java.util.*
......@@ -281,6 +285,12 @@ class NetTestingActivity : BaseActivity(), View.OnClickListener {
// tvRxSpeed.text = NetSpeed.getShowStr(averageRx)
// tvTxSpeed.text = NetSpeed.getShowStr(averageTx)
if (TimeRender.isOverspedMin2(WifiDataManager.getFakeSpeedTestTime(), 3)) {
WifiDataManager.setFakeSpeedTestTime(System.currentTimeMillis())
}
val speedStr = NetSpeed.getShowStr(averageRx)
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
......@@ -288,8 +298,16 @@ class NetTestingActivity : BaseActivity(), View.OnClickListener {
)
bundle.putString(
IncreasespeedActivity.INCREASE_WIFI_SPEED,
NetSpeed.getShowStr(averageRx)
speedStr
)
if (WifiUtils.getInstance(this).isWifiEnable) {
AppConfig.lastSpeedType = "WIFI"
} else {
AppConfig.lastSpeedType = "数据"
}
AppConfig.lastSpeedData = speedStr
if (mIsFromAppOut) {
bundle.putBoolean(IncreasespeedActivity.ROUTER_FROM_OUT, true)
}
......
......@@ -23,6 +23,7 @@ import com.mints.fiveworld.ad.wifi.WifiAdManager
import com.mints.fiveworld.ad.wifi.WifiAdStatusListener
import com.mints.fiveworld.common.AppConfig
import com.mints.fiveworld.common.Constant
import com.mints.fiveworld.manager.wifi.WifiDataManager
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.ui.adapter.CleanListAdapter
import com.mints.fiveworld.ui.adapter.IncreaseAdapter
......@@ -196,6 +197,10 @@ class SafeTestingActivity : BaseActivity(), View.OnClickListener {
}
}
if (TimeRender.isOverspedMin2(WifiDataManager.getFakeSaveCheckTime(), 3)) {
WifiDataManager.setFakeSaveCheckTime(System.currentTimeMillis())
}
startAnim()
}
......
package com.mints.fiveworld.ui.activitys
import android.annotation.SuppressLint
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.view.View
import android.view.animation.Animation
import android.view.animation.AnimationUtils
import android.view.animation.LayoutAnimationController
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.mints.fiveworld.R
import com.mints.fiveworld.manager.wifi.WifiDataManager
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.ui.adapter.ScoreAdapter
import com.mints.fiveworld.ui.widgets.NumAnimUtil
import com.mints.fiveworld.ui.widgets.RecyItemDecoration
import kotlinx.android.synthetic.main.activity_safe_testing.recycleView
import kotlinx.android.synthetic.main.activity_score_test.*
import kotlinx.android.synthetic.main.header_layout.*
import kotlin.random.Random
/**
* 描述:关于我们
* 作者:孟崔广
* 时间:2020/9/23 18:39
*/
@SuppressLint("SetTextI18n")
class ScoreTestActivity : BaseActivity(), View.OnClickListener {
private var mScoreAdapter: ScoreAdapter? = null
override fun getContentViewLayoutID() = R.layout.activity_score_test
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
tv_title.text = "一键测分"
tv_title.setTextColor(Color.WHITE)
headerContainer.setBackgroundColor(ContextCompat.getColor(this, R.color.color_00072D))
line.setBackgroundColor(ContextCompat.getColor(this, R.color.color_00F6FF))
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back_white)
val mPlaceStr = mutableListOf(
"" + (1500 + Random.nextInt(1500)),
"" + (800 + Random.nextInt(700)),
"" + (300 + Random.nextInt(200)),
"" + (800 + Random.nextInt(700)),
"" + (300 + Random.nextInt(500)),
"" + (800 + Random.nextInt(400)),
"" + (500 + Random.nextInt(1000))
)
var allScore = 0
for (s in mPlaceStr) {
allScore += s.toInt()
}
mScoreAdapter = ScoreAdapter(this, mPlaceStr)
val loadAnimation = AnimationUtils.loadAnimation(this, R.anim.layout_right_in)
val lac = LayoutAnimationController(loadAnimation)
lac.delay = 1f
lac.order = LayoutAnimationController.ORDER_NORMAL
var flag = true
loadAnimation.setAnimationListener(object : Animation.AnimationListener {
override fun onAnimationStart(animation: Animation?) {
}
override fun onAnimationEnd(animation: Animation?) {
// tvAllScore.text = "" + allScore
if (flag) {
NumAnimUtil.startAnim2(tvAllScore, allScore.toFloat(), 3000)
WifiDataManager.setFakeLastScore("" + allScore)
flag = false
}
}
override fun onAnimationRepeat(animation: Animation?) {
}
})
val dividerItemDecoration = DividerItemDecoration(this, 1)
dividerItemDecoration.setDrawable(ColorDrawable(Color.WHITE))
recycleView.addItemDecoration(dividerItemDecoration)
recycleView.layoutManager = LinearLayoutManager(this)
recycleView.layoutAnimation = lac
recycleView.addItemDecoration(RecyItemDecoration(this, DividerItemDecoration.VERTICAL))
recycleView.adapter = mScoreAdapter
initListener()
}
override fun onClick(v: View?) {
when (v?.id) {
R.id.iv_left_icon -> finish()
}
}
private fun initListener() {
iv_left_icon.setOnClickListener(this)
}
}
......@@ -61,7 +61,7 @@ class SettingsActivity : BaseActivity(), View.OnClickListener {
item_invitedCode.findViewById<TextView>(R.id.tv_right).visibility = View.VISIBLE
item_invitedCode.findViewById<ImageView>(R.id.iv_right).visibility = View.GONE
item_invitedCode.findViewById<TextView>(R.id.tv_right).text =
"CL-${UserManager.getInstance().codeID}"
"5G-${UserManager.getInstance().codeID}"
item_cleanCache.findViewById<TextView>(R.id.tv_title).text = "清理缓存"
val cleanCache = ContextCompat.getDrawable(this, R.mipmap.icon_settings_clean)
......
......@@ -15,7 +15,9 @@ import com.mints.fiveworld.ad.express.ExpressManager
import com.mints.fiveworld.ad.express.InSceneExpress
import com.mints.fiveworld.ad.wifi.WifiAdManager
import com.mints.fiveworld.common.Constant
import com.mints.fiveworld.manager.wifi.WifiDataManager
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.utils.TimeRender
import com.mints.fiveworld.utils.Utils
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_signal_strength.*
......@@ -119,6 +121,11 @@ class SignalStrengthActivity : BaseActivity(), View.OnClickListener {
}
showAd()
if (TimeRender.isOverspedMin2(WifiDataManager.getFakeSpeedFastTime(), 3)) {
WifiDataManager.setFakeSpeedFastTime(System.currentTimeMillis())
}
mTimer?.cancel()
return@runOnUiThread
} else if (mStep == 2) {
......
package com.mints.fiveworld.ui.activitys.appswitch
import com.mints.fiveworld.R
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.ui.widgets.applock.GestureViewGroup
import kotlinx.android.synthetic.main.activity_app_lock.*
import kotlin.properties.Delegates
/**
*
* @author jyx
* @date 2021/9/1
* @des 加速白名单页面
*/
class AppSwitchActivity : BaseActivity() {
private var settingStep = 0
private var isAppLockActive by Delegates.notNull<Boolean>()
override fun initViewsAndEvents() {
ivBack.setOnClickListener { finish() }
isAppLockActive = AppSwitchUtil.getAppLockActive(applicationContext)
val appLockPassword = AppSwitchUtil.getAppLockPassword(applicationContext)
if (isAppLockActive && appLockPassword != null) {
tvLockHint.text = "请输入手势密码解锁"
unlock(appLockPassword)
} else {
tvLockHint.text = "请先设置手势密码"
settingLock()
}
}
private fun settingLock() {
gestureLockViewGroup.apply {
setGestureLockSet(true)
setOnGestureLockViewListener(object :
GestureViewGroup.OnGestureViewListener {
override fun onBlockSelected(cId: Int) {}
override fun onGestureEvent(matched: Boolean) {
val password = answer
if (settingStep == 0) {
if (password.size < 4) {
tvLockHint.text = "请至少连接4个点"
showToast("请至少连接4个点")
} else {
tvLockHint.text = "请再次绘制手势密码"
answer = password
settingStep = 1
}
clear()
} else if (settingStep == 1) {
if (matched) {
settingStep = 1
AppSwitchUtil.setAppLockPassword(applicationContext, password)
AppSwitchUtil.setAppLockActive(applicationContext, true)
showToast("密码设置成功")
readyGoThenKill(BoostWhiteActivity::class.java)
} else {
tvLockHint.text = "两次密码不一致,请重新设置"
settingStep = 0
answer = null
clear()
}
}
}
override fun onUnmatchedExceedBoundary() {}
})
}
}
private fun unlock(appLockPassword: IntArray) {
gestureLockViewGroup.apply {
answer = appLockPassword
setOnGestureLockViewListener(object :
GestureViewGroup.OnGestureViewListener {
override fun onBlockSelected(cId: Int) {}
override fun onGestureEvent(matched: Boolean) {
if (matched) {
readyGoThenKill(BoostWhiteActivity::class.java)
} else {
showToast("密码错误")
clear()
}
}
override fun onUnmatchedExceedBoundary() {}
})
}
}
override fun isApplyKitKatTranslucency() = false
override fun getContentViewLayoutID() = R.layout.activity_app_lock
}
\ No newline at end of file
package com.mints.fiveworld.ui.activitys.appswitch
import android.content.Context
import android.content.SharedPreferences
/**
*
* @author jyx
* @date 2021/9/1
* @des app lock
*/
object AppSwitchUtil {
private const val SP_Name_AppLock = "SP_Name_AppLock"
private const val SP_Field_LockPassword = "SP_Field_LockPassword"
private const val SP_Field_LockActive = "SP_Field_LockActive"
private const val SP_Field_WhiteApp = "SP_Field_WhiteApp"
fun setAppLockActive(context: Context, isActive: Boolean): Boolean {
val sp = context.getSharedPreferences(SP_Name_AppLock, Context.MODE_PRIVATE)
val editor = sp.edit()
editor.putBoolean(SP_Field_LockActive, isActive)
editor.apply()
return true
}
fun getAppLockActive(context: Context): Boolean {
val sp = context.getSharedPreferences(SP_Name_AppLock, Context.MODE_PRIVATE)
return sp.getBoolean(SP_Field_LockActive, false) //default not active lock
}
fun getAppLockPassword(ctx: Context): IntArray? {
val sp: SharedPreferences = ctx.getSharedPreferences(SP_Name_AppLock, Context.MODE_PRIVATE)
var password: String? = ""
password = sp.getString(SP_Field_LockPassword, password)
val values = password!!.split(",").toTypedArray()
var appLockPassword: IntArray? = IntArray(values.size)
try {
for (i in values.indices) {
appLockPassword!![i] = values[i].toInt()
}
} catch (e: Exception) {
e.printStackTrace()
appLockPassword = null
}
return appLockPassword
}
fun setAppLockPassword(ctx: Context, password: IntArray?): Boolean {
if (password == null) return false
val sp: SharedPreferences =
ctx.getSharedPreferences(SP_Name_AppLock, Context.MODE_PRIVATE)
var sb = ""
for (value in password) {
sb += "$value," //can't add other char except ',';
}
if (sb.endsWith(",")) {
sb =
sb.substring(0, sb.length - 1) // remove the last char ',' in the end.
}
val editor = sp.edit()
editor.putString(SP_Field_LockPassword, sb)
editor.apply()
return true
}
fun setAppWhite(ctx: Context, whiteApp: MutableList<String>?): Boolean {
if (whiteApp == null) return false
val sp: SharedPreferences = ctx.getSharedPreferences(SP_Name_AppLock, Context.MODE_PRIVATE)
var sb = ""
for (value in whiteApp) {
sb += "$value," //can't add other char except ',';
}
if (sb.endsWith(",")) {
sb = sb.substring(0, sb.length - 1) // remove the last char ',' in the end.
}
val editor = sp.edit()
editor.putString(SP_Field_WhiteApp, sb)
editor.apply()
return true
}
fun getAppWhite(ctx: Context): MutableList<String> {
val sp: SharedPreferences = ctx.getSharedPreferences(SP_Name_AppLock, Context.MODE_PRIVATE)
var sb: String? = ""
sb = sp.getString(SP_Field_WhiteApp, sb)
val values = sb!!.split(",").toTypedArray()
var appWhite: MutableList<String> = mutableListOf()
try {
for (i in values.indices) {
appWhite.add(values[i])
}
} catch (e: Exception) {
e.printStackTrace()
appWhite = mutableListOf()
}
return appWhite
}
}
\ No newline at end of file
package com.mints.fiveworld.ui.activitys.appswitch
import android.view.View
import androidx.core.widget.NestedScrollView
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.mints.fiveworld.R
import com.mints.fiveworld.clean.CleanUtils
import com.mints.fiveworld.ui.activitys.base.BaseActivity
import com.mints.fiveworld.ui.adapter.clean.ExpandInfo
import com.mints.fiveworld.ui.widgets.RecyItemDecoration
import kotlinx.android.synthetic.main.activity_boost_white.*
import kotlinx.android.synthetic.main.header_layout.*
/**
*
* @author jyx
* @date 2021/9/1
* @des 加速白名单页面
*/
class BoostWhiteActivity : BaseActivity(), BoostWhiteAdapter.OnStateChangedListener {
private var mWhiteAdapter: BoostWhiteAdapter? = null
private var mBlackAdapter: BoostWhiteAdapter? = null
private var mBlackData: MutableList<ExpandInfo.ChildInfo> = mutableListOf()
private var mWhiteData: MutableList<ExpandInfo.ChildInfo> = mutableListOf()
private lateinit var appWhite: MutableList<String>
override fun initViewsAndEvents() {
tv_title.text = "应用保险柜"
iv_left_icon.visibility = View.VISIBLE
iv_left_icon.setImageResource(R.mipmap.ic_arrow_back)
iv_left_icon.setOnClickListener { finish() }
appWhite = AppSwitchUtil.getAppWhite(applicationContext)
val allApp = CleanUtils.getAllApp(applicationContext)
for (i in 0 until allApp.size) {
val cacheListItem = allApp[i]
val childInfo = ExpandInfo.ChildInfo()
childInfo.headId = cacheListItem.applicationIcon
childInfo.name = cacheListItem.applicationName
childInfo.pkgName = cacheListItem.packageName
if (appWhite.size > 0 && appWhite.contains(cacheListItem.packageName)) {
childInfo.tint = "已加入白名单"
childInfo.isLock = true
mWhiteData.add(childInfo)
} else {
childInfo.tint = "上锁后清理时不在清理当前应用"
childInfo.isLock = false
mBlackData.add(childInfo)
}
}
tvBlackCount.text = "${mBlackData.size}个应用"
tvWhiteCount.text = "${mWhiteData.size}个应用"
mBlackAdapter = BoostWhiteAdapter(this, mBlackData, false)
mWhiteAdapter = BoostWhiteAdapter(this, mWhiteData, true)
val linearLayoutManager = LinearLayoutManager(this)
val linearLayoutManager2 = LinearLayoutManager(this)
recyclerBlack.addItemDecoration(RecyItemDecoration(this, DividerItemDecoration.VERTICAL))
recyclerWhite.addItemDecoration(RecyItemDecoration(this, DividerItemDecoration.VERTICAL))
recyclerBlack.layoutManager = linearLayoutManager
recyclerWhite.layoutManager = linearLayoutManager2
recyclerBlack.adapter = mBlackAdapter
recyclerWhite.adapter = mWhiteAdapter
mBlackAdapter?.setOnStateChangedListener(this)
mWhiteAdapter?.setOnStateChangedListener(this)
nestedScrollView.setOnScrollChangeListener(NestedScrollView.OnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
if (scrollY > whiteContainer.height) {
fakeContainer.visibility = View.VISIBLE
fakeTitle.text = "已上锁"
fakeCount.text = "${mWhiteData.size}个应用"
} else {
fakeContainer.visibility = View.GONE
}
if (scrollY > whiteContainer.height + recyclerWhite.measuredHeight + blackContainer.height) {
fakeContainer.visibility = View.VISIBLE
fakeTitle.text = "未上锁"
fakeCount.text = "${mBlackData.size}个应用"
}
})
}
override fun toggleToOn(position: Int, isWhite: Boolean) {
if (!isWhite) {
val blackData = mBlackData[position]
if (!appWhite.contains(blackData.pkgName)) {
appWhite.add(blackData.pkgName)
}
blackData.isLock = true
blackData.tint = "已加入白名单"
mBlackData.remove(blackData)
mWhiteData.add(0, blackData)
tvBlackCount.text = "${mBlackData.size}个应用"
tvWhiteCount.text = "${mWhiteData.size}个应用"
if (fakeContainer.visibility == View.VISIBLE) {
if (fakeTitle.text.equals("已上锁")) {
fakeCount.text = "${mWhiteData.size}个应用"
} else {
fakeCount.text = "${mBlackData.size}个应用"
}
}
mBlackAdapter?.notifyDataSetChanged()
mWhiteAdapter?.notifyDataSetChanged()
AppSwitchUtil.setAppWhite(applicationContext, appWhite)
}
}
override fun toggleToOff(position: Int, isWhite: Boolean) {
if (isWhite) {
val whiteData = mWhiteData[position]
if (appWhite.contains(whiteData.pkgName)) {
appWhite.remove(whiteData.pkgName)
}
whiteData.isLock = false
whiteData.tint = "上锁后清理时不在清理当前应用"
mWhiteData.remove(whiteData)
mBlackData.add(0, whiteData)
tvBlackCount.text = "${mBlackData.size}个应用"
tvWhiteCount.text = "${mWhiteData.size}个应用"
if (fakeContainer.visibility == View.VISIBLE) {
if (fakeTitle.text.equals("已上锁")) {
fakeCount.text = "${mWhiteData.size}个应用"
} else {
fakeCount.text = "${mBlackData.size}个应用"
}
}
mBlackAdapter?.notifyDataSetChanged()
mWhiteAdapter?.notifyDataSetChanged()
AppSwitchUtil.setAppWhite(applicationContext, appWhite)
}
}
override fun isApplyKitKatTranslucency() = false
override fun getContentViewLayoutID() = R.layout.activity_boost_white
}
\ No newline at end of file
package com.mints.fiveworld.ui.activitys.appswitch
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
import android.widget.ImageView
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.github.iielse.switchbutton.SwitchView
import com.mints.fiveworld.R
import com.mints.fiveworld.ui.adapter.clean.ExpandInfo
import com.mints.library.utils.GlideUtils
/**
*
* @author jyx
* @date 2021/9/1
* @des 加速应用白名单
*/
class BoostWhiteAdapter(
val context: Context,
val lockData: MutableList<ExpandInfo.ChildInfo>,
val isWhite: Boolean
) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var mOnStateChangedListener: OnStateChangedListener? = null
fun setOnStateChangedListener(onStateChangedListener: OnStateChangedListener) {
mOnStateChangedListener = onStateChangedListener
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val view =
LayoutInflater.from(context).inflate(R.layout.item_clean_child, parent, false)
return SwitchHolder(view)
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
if (holder is SwitchHolder) {
val childInfo = lockData[position]
holder.cb.visibility = View.GONE
// holder.tint.visibility = View.GONE
holder.size.visibility = View.GONE
holder.swv.visibility = View.VISIBLE
GlideUtils.loadImageView(context, childInfo.headId, holder.img)
holder.name.text = childInfo.name
holder.tint.text = childInfo.tint
holder.swv.isOpened = childInfo.isLock
holder.swv.setOnStateChangedListener(object : SwitchView.OnStateChangedListener {
override fun toggleToOn(view: SwitchView?) {
mOnStateChangedListener?.toggleToOn(position, isWhite)
}
override fun toggleToOff(view: SwitchView?) {
mOnStateChangedListener?.toggleToOff(position, isWhite)
}
})
}
}
override fun getItemCount() = lockData.size
private class SwitchHolder(view: View) : RecyclerView.ViewHolder(view) {
val img: ImageView = view.findViewById(R.id.ivChildImg)
val name: TextView = view.findViewById(R.id.tvChildName)
val tint: TextView = view.findViewById(R.id.tvChildInfo)
val size: TextView = view.findViewById(R.id.tvChildSize)
val cb: CheckBox = view.findViewById(R.id.cbChild)
val swv: SwitchView = view.findViewById(R.id.swv)
}
interface OnStateChangedListener {
fun toggleToOn(position: Int, isWhite: Boolean)
fun toggleToOff(position: Int, isWhite: Boolean)
}
}
\ No newline at end of file
package com.mints.fiveworld.ui.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.mints.fiveworld.R
import com.mints.fiveworld.ui.adapter.listener.OnItemClickListener
class ScoreAdapter(val context: Context, val taskData: MutableList<String>) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
companion object {
const val HOLDER_TYPE_SIMPLE = 0
}
private var mOnItemClickListener: OnItemClickListener? = null
fun setOnItemClickListener(onItemClickListener: OnItemClickListener?) {
mOnItemClickListener = onItemClickListener
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val inflater: LayoutInflater = LayoutInflater.from(context)
return ScoreHolder(inflater.inflate(R.layout.item_recyclerview_score, parent, false))
}
override fun getItemCount() = taskData.size
override fun getItemViewType(position: Int): Int {
return HOLDER_TYPE_SIMPLE
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
val increaseHolder = holder as ScoreHolder
when (position) {
0 -> {
increaseHolder.tv1.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(context, R.mipmap.ic_score_basic),
null,
null,
null
)
increaseHolder.tv1.text = "基础得分"
increaseHolder.tv2.text = taskData[position]
}
1 -> {
increaseHolder.tv1.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(context, R.mipmap.ic_score_cpu),
null,
null,
null
)
increaseHolder.tv1.text = "处理器"
increaseHolder.tv2.text = taskData[position]
}
2 -> {
increaseHolder.tv1.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(context, R.mipmap.ic_score_memory),
null,
null,
null
)
increaseHolder.tv1.text = "内存"
increaseHolder.tv2.text = taskData[position]
}
3 -> {
increaseHolder.tv1.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(context, R.mipmap.ic_score_battery),
null,
null,
null
)
increaseHolder.tv1.text = "电池"
increaseHolder.tv2.text = taskData[position]
}
4 -> {
increaseHolder.tv1.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(context, R.mipmap.ic_score_storage),
null,
null,
null
)
increaseHolder.tv1.text = "存储"
increaseHolder.tv2.text = taskData[position]
}
5 -> {
increaseHolder.tv1.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(context, R.mipmap.ic_score_screen),
null,
null,
null
)
increaseHolder.tv1.text = "显示"
increaseHolder.tv2.text = taskData[position]
}
6 -> {
increaseHolder.tv1.setCompoundDrawablesWithIntrinsicBounds(
ContextCompat.getDrawable(context, R.mipmap.ic_score_system),
null,
null,
null
)
increaseHolder.tv1.text = "系统"
increaseHolder.tv2.text = taskData[position]
// increaseHolder.line.visibility = View.INVISIBLE
return
}
else -> {
}
}
// increaseHolder.line.visibility = View.VISIBLE
}
private inner class ScoreHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val tv1: TextView = itemView.findViewById(R.id.tv1)
val tv2: TextView = itemView.findViewById(R.id.tv2)
// val line: View = itemView.findViewById(R.id.line)
}
}
\ No newline at end of file
......@@ -48,6 +48,15 @@ public class ExpandInfo {
public String filePath; // 路径
public boolean isChecked; // 是否选中
public String pkgName; // 包名
public boolean isLock; // 是否锁定
public boolean isLock() {
return isLock;
}
public void setLock(boolean lock) {
isLock = lock;
}
public String isPkgName() {
return pkgName;
......
package com.mints.fiveworld.ui.fragment
import android.Manifest
import android.content.Intent
import android.graphics.Color
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import android.widget.FrameLayout
import androidx.core.content.ContextCompat
import com.mints.fiveworld.R
import com.mints.fiveworld.ad.AdReportManager
import com.mints.fiveworld.ad.express.ExpressAdCallback
import com.mints.fiveworld.ad.express.ExpressManager
import com.mints.fiveworld.ad.express.InHomeWifiExpress
import com.mints.fiveworld.ad.inscreen.InSceneInterstitial
import com.mints.fiveworld.common.AppConfig
import com.mints.fiveworld.common.Constant
import com.mints.fiveworld.common.DeviceInfo
import com.mints.fiveworld.common.random.HitChanceKeeper
import com.mints.fiveworld.manager.UserManager
import com.mints.fiveworld.manager.wifi.WifiDataManager
import com.mints.fiveworld.mreceiver.appswitch.AntiAuditManager
import com.mints.fiveworld.ui.activitys.*
import com.mints.fiveworld.ui.activitys.appswitch.AppSwitchActivity
import com.mints.fiveworld.ui.activitys.appswitch.AppSwitchUtil
import com.mints.fiveworld.ui.fragment.base.BaseFragment
import com.mints.fiveworld.utils.*
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.nodoubleclick.AntiShake
import com.permissionx.guolindev.PermissionX
import kotlinx.android.synthetic.main.fragment_main.*
/**
*
* @author jyx
* @date 2021/11/10
* @des 测分主页
*/
class MainFragment : BaseFragment(), View.OnClickListener {
private var isFirstEnter = false
private var frameLayout: FrameLayout? = null
private val TAG = MainFragment::class.java.simpleName
override fun initViewsAndEvents() {
btnScore.setOnClickListener(this)
ivSetting.setOnClickListener(this)
btnBoost.setOnClickListener(this)
btnClean.setOnClickListener(this)
btnCool.setOnClickListener(this)
tvSafeCheck.setOnClickListener(this)
tvSpeedTest.setOnClickListener(this)
tvSark.setOnClickListener(this)
tvCool.setOnClickListener(this)
tvMemory.text = SystemUtils.getTotalMemory()
tvStorage.text = SystemUtils.getTotalInternalMemorySize()
tvBrand.text = DeviceInfo.instance.newModel
tvBattery.text = Utils.getBatteryCapacity()
}
override fun getContentViewLayoutID() = R.layout.fragment_main
override fun onResume() {
super.onResume()
if (isFirstEnter) {
isFirstEnter = false
return
}
if (AntiShake.check(null)) return
loadAd()
updateUiState()
if (!TextUtils.isEmpty(UserManager.getInstance().userID)) {
(requireActivity() as MainActivity).refreshHall()
} else {
(requireActivity() as MainActivity).userLogin()
}
}
/** 更新UI页面数据 */
private fun updateUiState() {
if(AntiAuditManager.instance.isBlack()){
//拉黑
main_bottom.visibility=View.GONE
constraintLayout.visibility=View.GONE
}else{
main_bottom.visibility=View.VISIBLE
constraintLayout.visibility=View.VISIBLE
}
val fakeLastScore = WifiDataManager.getFakeLastScore()
if (!TextUtils.isEmpty(fakeLastScore)) {
val char = fakeLastScore?.toCharArray()
char?.let {
try {
tvScore1.text = it[0].toString()
tvScore2.text = it[1].toString()
tvScore3.text = it[2].toString()
tvScore4.text = it[3].toString()
} catch (e: Exception) {
tvScore1.text = "?"
tvScore2.text = "?"
tvScore3.text = "?"
tvScore4.text = "?"
}
}
} else {
tvScore1.text = "?"
tvScore2.text = "?"
tvScore3.text = "?"
tvScore4.text = "?"
}
val appWhite = AppSwitchUtil.getAppWhite(requireContext())
LogUtil.d(appWhite.toString())
if (appWhite.isNotEmpty() && appWhite.size > 1) {
tvSark.text = SpanUtils()
.append("已上锁\n")
.setFontSize(BubbleUtils.sp2px(12))
.setForegroundColor(Color.WHITE)
.append("" + appWhite.size + "个")
.setForegroundColor(ContextCompat.getColor(requireContext(),R.color.color_FE3B77))
.setFontSize(BubbleUtils.sp2px(12))
.create()
} else {
tvSark.text = SpanUtils()
.append("保险柜")
.setForegroundColor(ContextCompat.getColor(requireContext(),R.color.color_FE3B77))
.create()
}
if (!TimeRender.isOverspedMin2(WifiDataManager.getFakeSpeedTestTime(), 3)) {
if (!TextUtils.isEmpty(AppConfig.lastSpeedType)) {
tvSpeedTest.text = SpanUtils()
.append(AppConfig.lastSpeedType + "\n")
.setForegroundColor(Color.WHITE)
.setFontSize(BubbleUtils.sp2px(12))
.append(AppConfig.lastSpeedData)
.setForegroundColor(ContextCompat.getColor(requireContext(),R.color.color_FE3B77))
.setFontSize(BubbleUtils.sp2px(12))
.create()
}
} else {
tvSpeedTest.text = SpanUtils()
.append("待测速")
.setForegroundColor(ContextCompat.getColor(requireContext(),R.color.color_FE3B77))
.create()
}
if (!TimeRender.isOverspedMin2(WifiDataManager.getFakeSaveBatteryTime(), 3)) {
if (!TextUtils.isEmpty(AppConfig.lastCoolData)) {
tvCool.text = SpanUtils()
.append("已降温\n")
.setForegroundColor(Color.WHITE)
.setFontSize(BubbleUtils.sp2px(12))
.append("${AppConfig.lastCoolData}℃")
.setForegroundColor(ContextCompat.getColor(requireContext(),R.color.color_FE3B77))
.setFontSize(BubbleUtils.sp2px(12))
.create()
}
} else {
tvCool.text = SpanUtils()
.append("待降温")
.setForegroundColor(ContextCompat.getColor(requireContext(),R.color.color_FE3B77))
.create()
}
if (TimeRender.isOverspedMin2(WifiDataManager.getFakeSaveCheckTime(), 3)) {
tvSafeCheck.text = SpanUtils()
.append("待检测")
.setForegroundColor(ContextCompat.getColor(requireContext(),R.color.color_FE3B77))
.create()
} else {
tvSafeCheck.text = SpanUtils()
.append("安全")
.setForegroundColor(Color.WHITE)
.setFontSize(BubbleUtils.sp2px(12))
.create()
}
}
/**初始化信息iyc*/
private fun loadAd() {
if (Utils.canLoadAd()) {
InHomeWifiExpress.instance.loadADFrameLayout(Constant.CARRIER_WIFI)
InHomeWifiExpress.instance.getAdView(
expressAdCallback,
Constant.CARRIER_WIFI
)
startTime()
InSceneInterstitial.getInstance().preloadInsertScreenAd(requireActivity(), Constant.CARRIER_WIFI)
}
}
private val expressAdCallback = object : ExpressAdCallback {
override fun loadSuccess(adView: FrameLayout?) {
if (activity == null || requireActivity().isFinishing || isHidden || !isAdded) return
adView?.let {
Utils.removeFromParent(it)
frameLayout?.removeAllViews()
frameLayout?.addView(it)
}
}
override fun renderSuccess(adView: FrameLayout?): Boolean {
if (activity == null || requireActivity().isFinishing || isHidden) return false
adView?.let {
Utils.removeFromParent(it)
frameLayout?.removeAllViews()
frameLayout?.addView(it)
}
return true
}
override fun loadFail() {}
}
fun setIsFirstEnter(isFirstEnter: Boolean) {
this.isFirstEnter = isFirstEnter
}
/**
* 倒计时展示插屏
*/
private fun startTime() {
if (isFirstEnter) return
val serverTimes = WifiDataManager.getHomeInscreenAllTimes()
// 若自动场景总次数为0则返回
if (serverTimes <= 0) {
LogUtil.d(TAG, "若自动场景总次数为0则返回=${serverTimes}")
return
}
val homeInscreenTimes = WifiDataManager.getHomeInscreenTimes()
// 若本地场景次数 > 服务器返回数次 则返回
if (homeInscreenTimes >= serverTimes) {
LogUtil.d(
TAG,
"若本地场景次数 本地次数=${homeInscreenTimes} 服务器次数=${serverTimes}"
)
return
}
val serverPercentage = WifiDataManager.getHomeInscreenPercentage()
// 若服务器返回的百分比大于100 则返回(一般不会出现这种情况)
if (serverPercentage > 100) {
LogUtil.d(
TAG,
"若服务器返回的百分比大于100 则返回(一般不会出现这种情况) 服务器百分比=${serverPercentage}"
)
return
}
// 进行百分比随机
HitChanceKeeper.isHitChanceS(serverPercentage) {
activity?.let {
if (!it.isFinishing) {
val tempTimes = homeInscreenTimes + 1
AdReportManager.eventScene(
AdReportManager.INNER_IN,
System.currentTimeMillis(),
Constant.CARRIER_WIFI,
"自动展示插屏场景-> 后台返回总次数=${serverTimes} 后台返回百分比=${serverPercentage}" +
"本地次数=${tempTimes}",
AdReportManager.EVENT_TYPE_SCENCE_CLOSE
)
InSceneInterstitial.getInstance()
.showInteractionAd(requireActivity(), null, Constant.CARRIER_WIFI)
WifiDataManager.setHomeInscreenTimes(tempTimes)
}
}
}
}
override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return
btnBoost.setOnClickListener(this)
btnClean.setOnClickListener(this)
btnCool.setOnClickListener(this)
tvSafeCheck.setOnClickListener(this)
tvSpeedTest.setOnClickListener(this)
tvSark.setOnClickListener(this)
tvCool.setOnClickListener(this)
when (v?.id) {
R.id.btnScore -> {
startActivity(Intent(requireContext(), ScoreTestActivity::class.java))
}
R.id.ivSetting -> {
startActivity(Intent(requireContext(), SettingsActivity::class.java))
}
R.id.btnBoost -> { // 一键加速
if (Utils.canLoadAd()) {
// 预加载信息流
ExpressManager.loadExpress(false, Constant.CARRIER_BOOST)
}
AppConfig.isCanBoost = true
// AppConfig.inAdShowing = true
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
}
R.id.btnClean -> {// 一键清理
PermissionX.init(this)
.permissions(Manifest.permission.WRITE_EXTERNAL_STORAGE)
.request { allGranted, _, _ ->
if (allGranted) {
if (Utils.canLoadAd()) {
// 预加载信息流
ExpressManager.loadExpress(false, Constant.CARRIER_CLEAN)
}
AppConfig.isCanClean = true
// AppConfig.inAdShowing = true
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_CLEAN
)
readyGo(IncreasespeedActivity::class.java, bundle)
} else {
showMissingPermissionDialog("存储")
}
}
}
R.id.btnCool -> { // 超强省电
if (Utils.canLoadAd()) {
// 预加载信息流
ExpressManager.loadExpress(false, Constant.CARRIER_SAVE_POWER)
}
AppConfig.isCanSaveBattery = true
// AppConfig.inAdShowing = true
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_SAVE_ELECTRICITY
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
R.id.tvSafeCheck -> { // 安全检测
if (!NetUtils.isNetworkConnected(context)) {
showToast("网络异常,请检测网络")
return
}
if (Utils.canLoadAd()) {
// 预加载信息流
ExpressManager.loadExpress(false, Constant.CARRIER_SAFE_CHECK)
}
// AppConfig.inAdShowing = true
val bundle = Bundle()
bundle.putString(
SafeTestingActivity.INCREASE2_TYPE,
SafeTestingActivity.INCREASE2_SAFE_CHECK
)
readyGo(SafeTestingActivity::class.java, bundle)
}
R.id.tvSpeedTest -> { // 网络测速
if (!NetUtils.isNetworkConnected(context)) {
showToast("网络异常,请检测网络")
return
}
if (Utils.canLoadAd()) {
// 预加载信息流
ExpressManager.loadExpress(false, Constant.CARRIER_SPEED_TEST)
}
// AppConfig.inAdShowing = true
readyGo(NetTestingActivity::class.java)
}
R.id.tvSark -> {
// 应用保险柜
readyGo(AppSwitchActivity::class.java)
}
R.id.tvCool -> { // 超强省电
if (Utils.canLoadAd()) {
// 预加载信息流
ExpressManager.loadExpress(false, Constant.CARRIER_SAVE_POWER)
}
AppConfig.isCanSaveBattery = true
// AppConfig.inAdShowing = true
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_SAVE_ELECTRICITY
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
else -> {
}
}
}
}
\ No newline at end of file
......@@ -105,4 +105,50 @@ public class NumAnimUtil {
String strfloat = NumberFormat(f, m);
return Float.parseFloat(strfloat);
}
/**
* 进度随意 时间随意
*
* @param textV
*/
public static void startAnim2(TextView textV, float num, long time) {
if (num == 0) {
textV.setText(NumAnimUtil.NumberFormat(num, 2));
return;
}
Float[] nums = splitnum(num, (int) ((time / 1000f) * COUNTPERS));
Counter2 counter = new Counter2(textV, nums, time);
textV.removeCallbacks(counter);
textV.post(counter);
}
static class Counter2 implements Runnable {
private final TextView view;
private Float[] nums;
private long pertime;
private int i = 0;
Counter2(TextView view, Float[] nums, long time) {
this.view = view;
this.nums = nums;
this.pertime = time / nums.length;
}
@Override
public void run() {
if (i > nums.length - 1) {
view.removeCallbacks(Counter2.this);
return;
}
view.setText(NumAnimUtil.NumberFormat(nums[i++], 2));
view.removeCallbacks(Counter2.this);
view.postDelayed(Counter2.this, pertime);
}
}
}
package com.mints.fiveworld.ui.widgets.applock;
import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.graphics.Path;
import android.view.View;
import com.mints.fiveworld.utils.BubbleUtils;
@SuppressLint("ViewConstructor")
public class GestureView extends View {
private static final String TAG = GestureView.class.getName();
/**
* GestureLockView的三种状态
*/
enum Mode {
STATUS_NO_FINGER, STATUS_FINGER_ON, STATUS_FINGER_UP;
}
/**
* GestureLockView的当前状态
*/
private Mode mCurrentStatus = Mode.STATUS_NO_FINGER;
/**
* 宽度
*/
private int mWidth;
/**
* 高度
*/
private int mHeight;
/**
* 外圆半径
*/
private int mRadius;
/**
* 画笔的宽度
*/
private int mStrokeWidth = 2;
/**
* 圆心坐标
*/
private int mCenterX;
private int mCenterY;
private Paint mPaint;
/**
* 箭头(小三角最长边的一半长度 = mArrawRate * mWidth / 2 )
*/
private float mArrowRate = 0.333f;
private int mArrowDegree = -1;
private Path mArrowPath;
/**
* 内圆的半径 = mInnerCircleRadiusRate * mRadus
*/
private float mInnerCircleRadiusRate = 0.25f;
/**
* 四个颜色,可由用户自定义,初始化时由GestureLockViewGroup传入
*/
private int mColorNoFingerInner;
private int mColorNoFingerOutter;
private int mColorFingerOn;
private int mColorFingerUpMatched;
private int mColorFingerUpNotMatched;
private boolean matched;
public GestureView(Context context, int colorNoFingerInner, int colorNoFingerOutter, int colorFingerOn, int colorFingerUpMatched, int colorFingerUpNotMatched) {
super(context);
this.mColorNoFingerInner = colorNoFingerInner;
this.mColorNoFingerOutter = colorNoFingerOutter;
this.mColorFingerOn = colorFingerOn;
this.mColorFingerUpMatched = colorFingerUpMatched;
this.mColorFingerUpNotMatched = colorFingerUpNotMatched;
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mArrowPath = new Path();
mStrokeWidth = BubbleUtils.dp2px(1);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mWidth = MeasureSpec.getSize(widthMeasureSpec);
mHeight = MeasureSpec.getSize(heightMeasureSpec);
// 取长和宽中的小值
mWidth = Math.min(mWidth, mHeight);
mCenterX = mCenterY = mWidth / 2;
mRadius = mWidth / 3;
mRadius -= mStrokeWidth / 2;
// 绘制三角形,初始时是个默认箭头朝上的一个等腰三角形,用户绘制结束后,根据由两个GestureLockView决定需要旋转多少度
float mArrowLength = mWidth / 2 * mArrowRate;
mArrowPath.moveTo(mWidth / 2, mStrokeWidth + 2);
mArrowPath.lineTo(mWidth / 2 - mArrowLength, mStrokeWidth + 2
+ mArrowLength);
mArrowPath.lineTo(mWidth / 2 + mArrowLength, mStrokeWidth + 2
+ mArrowLength);
mArrowPath.close();
mArrowPath.setFillType(Path.FillType.WINDING);
}
@Override
protected void onDraw(Canvas canvas) {
switch (mCurrentStatus) {
case STATUS_FINGER_ON:
// 绘制外圆
mPaint.setStyle(Style.FILL); //
mPaint.setColor(0x33ffffff);
mPaint.setStrokeWidth(mStrokeWidth);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
// 绘制外圆环
mPaint.setStyle(Style.STROKE);
mPaint.setColor(0x99fdfdfd);
mPaint.setStrokeWidth(mStrokeWidth);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
// 绘制内圆
mPaint.setStyle(Style.FILL);
mPaint.setColor(mColorFingerOn);
canvas.drawCircle(mCenterX, mCenterY, mRadius
* mInnerCircleRadiusRate, mPaint);
break;
case STATUS_FINGER_UP:
if (matched) {
// 绘制外圆环
mPaint.setColor(mColorFingerUpMatched);
mPaint.setStyle(Style.STROKE);
mPaint.setStrokeWidth(mStrokeWidth);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
} else {
// 外圆
mPaint.setStyle(Style.FILL);
mPaint.setColor(0x33ff5c5c);
mPaint.setStrokeWidth(mStrokeWidth);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
// 外圆环
mPaint.setColor(0x99e3362d);
mPaint.setStyle(Style.STROKE);
mPaint.setStrokeWidth(mStrokeWidth);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
mPaint.setColor(mColorFingerUpNotMatched);
}
// 绘制内圆
mPaint.setStyle(Style.FILL);
canvas.drawCircle(mCenterX, mCenterY, mRadius
* mInnerCircleRadiusRate, mPaint);
// drawArrow(canvas);
break;
case STATUS_NO_FINGER:
// 绘制外圆
mPaint.setStyle(Style.STROKE);
mPaint.setStrokeWidth(mStrokeWidth);
mPaint.setColor(mColorNoFingerOutter);
canvas.drawCircle(mCenterX, mCenterY, mRadius, mPaint);
// 绘制内圆
mPaint.setStyle(Style.FILL);
mPaint.setColor(mColorNoFingerInner);
canvas.drawCircle(mCenterX, mCenterY, mRadius
* mInnerCircleRadiusRate, mPaint);
break;
}
}
/**
* 绘制箭头
*
* @param canvas
*/
private void drawArrow(Canvas canvas) {
if (mArrowDegree != -1) {
mPaint.setStyle(Style.FILL);
canvas.save();
canvas.rotate(mArrowDegree, mCenterX, mCenterY);
canvas.drawPath(mArrowPath, mPaint);
canvas.restore();
}
}
public void setMatched(boolean matched) {
this.matched = matched;
}
/**
* 设置当前模式并重绘界面
*
* @param mode
*/
public void setMode(Mode mode) {
this.mCurrentStatus = mode;
invalidate();
}
public void setArrowDegree(int degree) {
this.mArrowDegree = degree;
}
public int getArrowDegree() {
return this.mArrowDegree;
}
}
package com.mints.fiveworld.ui.widgets.applock;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Point;
import android.os.Handler;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.RelativeLayout;
import com.mints.fiveworld.R;
import com.mints.fiveworld.utils.BubbleUtils;
import java.util.ArrayList;
import java.util.List;
/**
* 整体包含n*n个GestureLockView,每个GestureLockView间间隔mMarginBetweenLockView,
* 最外层的GestureLockView与容器存在mMarginBetweenLockView的外边距
*
* 关于GestureLockView的边长(n*n): n * mGestureLockViewWidth + ( n + 1 ) *
* mMarginBetweenLockView = mWidth ; 得:mGestureLockViewWidth = 4 * mWidth / ( 5
* * mCount + 1 ) 注:mMarginBetweenLockView = mGestureLockViewWidth * 0.25 ;
*
* @author
*
*/
public class GestureViewGroup extends RelativeLayout {
private static final String TAG = GestureViewGroup.class.getName();
/**
* 保存所有的GestureLockView
*/
private GestureView[] mGestureLockViews;
/**
* 每个边上的GestureLockView的个数
*/
private int mCount = 3;
/**
* 存储答案
*/
private int[] mAnswer = new int[0];
/**
* 保存用户选中的GestureLockView的id
*/
private final List<Integer> mChoose = new ArrayList<>();
private Paint mPaint;
/**
* 每个GestureLockView中间的间距 设置为:mGestureLockViewWidth * 25%
*/
private int mMarginBetweenLockView = 0;
/**
* GestureLockView的边长 4 * mWidth / ( 5 * mCount + 1 )
*/
private int mGestureLockViewWidth = 0;
/**
* GestureLockView无手指触摸的状态下内圆的颜色
*/
private int mNoFingerInnerCircleColor = 0xffffffff;
/**
* GestureLockView无手指触摸的状态下外圆的颜色
*/
private int mNoFingerOuterCircleColor = 0xfffdfdfd;
/**
* GestureLockView手指触摸的状态下内圆和外圆的颜色
*/
private int mFingerOnColor = 0xffffffff;
/**
* GestureLockView手指抬起的状态下内圆和外圆的颜色
*/
private int mFingerUpMatchedColor = 0xffffffff;
private int mFingerUpNotMatchedColor = 0xffe3362d;
/**
* 宽度
*/
private int mWidth;
/**
* 高度
*/
private int mHeight;
private Path mPath;
/**
* 指引线的开始位置x
*/
private int mLastPathX;
/**
* 指引线的开始位置y
*/
private int mLastPathY;
/**
* 指引下的结束位置
*/
private final Point mTmpTarget = new Point();
/**
* 最大尝试次数
*/
private int mTryTimes = 4;
/**
* 回调接口
*/
private OnGestureViewListener mOnGestureLockViewListener;
// set password or verify password, verify password: if not matched, show red color; set password: first,show green, second(confirm the first ),show red if not match first
private boolean setPasswordMode = false;
private int inputCorrectPasswordCount = 0;
public GestureViewGroup(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public GestureViewGroup(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
/**
* 获得所有自定义的参数的值
*/
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.GestureLockViewGroup, defStyle, 0);
int n = a.getIndexCount();
for (int i = 0; i < n; i++) {
int attr = a.getIndex(i);
switch (attr) {
case R.styleable.GestureLockViewGroup_color_no_finger_inner_circle:
mNoFingerInnerCircleColor = a.getColor(attr, mNoFingerInnerCircleColor);
break;
case R.styleable.GestureLockViewGroup_color_no_finger_outer_circle:
mNoFingerOuterCircleColor = a.getColor(attr, mNoFingerOuterCircleColor);
break;
case R.styleable.GestureLockViewGroup_outer_circle_width:
mGestureLockViewWidth = (int)a.getDimension(attr, mGestureLockViewWidth);
break;
case R.styleable.GestureLockViewGroup_margin_between_vircle:
mMarginBetweenLockView = (int)a.getDimension(attr, mMarginBetweenLockView);
break;
case R.styleable.GestureLockViewGroup_color_finger_on:
mFingerOnColor = a.getColor(attr, mFingerOnColor);
break;
case R.styleable.GestureLockViewGroup_color_finger_up:
mFingerUpMatchedColor = a.getColor(attr, mFingerUpMatchedColor);
break;
case R.styleable.GestureLockViewGroup_count:
mCount = a.getInt(attr, 3);
break;
case R.styleable.GestureLockViewGroup_tryTimes:
mTryTimes = a.getInt(attr, 5);
default:
break;
}
}
a.recycle();
// 初始化画笔
mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeWidth(BubbleUtils.dp2px(3));
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeJoin(Paint.Join.ROUND);
// mPaint.setColor(Color.parseColor("#aaffffff"));
mPath = new Path();
setPasswordMode = false;
inputCorrectPasswordCount = 0;
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
mWidth = MeasureSpec.getSize(widthMeasureSpec);
mHeight = MeasureSpec.getSize(heightMeasureSpec);
mHeight = mWidth = mWidth < mHeight ? mWidth : mHeight;
// setMeasuredDimension(mWidth, mHeight);
// 初始化mGestureLockViews
if (mGestureLockViews == null) {
mGestureLockViews = new GestureView[mCount * mCount];
// 计算每个GestureLockView的宽度
if(mGestureLockViewWidth == 0) {
// mGestureLockViewWidth = (int) (4 * mWidth * 1.0f / (5 * mCount + 1));
mGestureLockViewWidth = (int) ( mWidth * 1.0f / 4f);
}
// 计算每个GestureLockView的间距
if(mMarginBetweenLockView == 0) {
// mMarginBetweenLockView = mGestureLockViewWidth / 4;
mMarginBetweenLockView = mWidth / 8;
}
// 设置画笔的宽度为GestureLockView的内圆直径稍微小点(不喜欢的话,随便设)
// mPaint.setStrokeWidth(mGestureLockViewWidth * 0.29f);
for (int i = 0; i < mGestureLockViews.length; i++) {
// 初始化每个GestureLockView
mGestureLockViews[i] = new GestureView(getContext(), mNoFingerInnerCircleColor,
mNoFingerOuterCircleColor, mFingerOnColor, mFingerUpMatchedColor, mFingerUpNotMatchedColor);
mGestureLockViews[i].setId(i + 1);
// 设置参数,主要是定位GestureLockView间的位置
LayoutParams lockerParams = new LayoutParams(mGestureLockViewWidth, mGestureLockViewWidth);
// 不是每行的第一个,则设置位置为前一个的右边
if (i % mCount != 0) {
lockerParams.addRule(RelativeLayout.RIGHT_OF, mGestureLockViews[i - 1].getId());
}
// 从第二行开始,设置为上一行同一位置View的下面
if (i > mCount - 1) {
lockerParams.addRule(RelativeLayout.BELOW, mGestureLockViews[i - mCount].getId());
}
// 设置右下左上的边距
int rightMargin = 0;
int bottomMargin = 0;
int leftMagin = mMarginBetweenLockView;
int topMargin = mMarginBetweenLockView;
/**
* 每个View都有右外边距和底外边距 第一行的有上外边距 第一列的有左外边距
*/
if (i >= 0 && i < mCount)// 第一行
{
topMargin = 0;
}
if (i % mCount == 0)// 第一列
{
leftMagin = 0;
}
lockerParams.setMargins(leftMagin, topMargin, rightMargin, bottomMargin);
mGestureLockViews[i].setMode(GestureView.Mode.STATUS_NO_FINGER);
addView(mGestureLockViews[i], lockerParams);
}
}
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int action = event.getAction();
int x = (int) event.getX();
int y = (int) event.getY();
switch (action) {
case MotionEvent.ACTION_DOWN:
// 重置
reset();
// going through
case MotionEvent.ACTION_MOVE:
mPaint.setColor(mFingerOnColor);
mPaint.setAlpha(50);
GestureView child = getChildIdByPos(x, y);
if (child != null) {
int cId = child.getId();
if (!mChoose.contains(cId)) {
mChoose.add(cId);
child.setMode( GestureView.Mode.STATUS_FINGER_ON);
if (mOnGestureLockViewListener != null)
mOnGestureLockViewListener.onBlockSelected(cId);
// 设置指引线的起点
mLastPathX = child.getLeft() / 2 + child.getRight() / 2;
mLastPathY = child.getTop() / 2 + child.getBottom() / 2;
if (mChoose.size() == 1)// 当前添加为第一个
{
mPath.moveTo(mLastPathX, mLastPathY);
} else
// 非第一个,将两者使用线连上
{
mPath.lineTo(mLastPathX, mLastPathY);
}
}
}
// 指引线的终点
mTmpTarget.x = x;
mTmpTarget.y = y;
break;
case MotionEvent.ACTION_UP:
// first input password and >= 4 dot
// Log.e(TAG, "inputCorrectPasswordCount:"+inputCorrectPasswordCount);
boolean fistInputCorrectPassword = setPasswordMode && ((inputCorrectPasswordCount & 1)==0) && mChoose.size() >= 4;
//if first input dot >=4 or the second input(confirm step)
if(fistInputCorrectPassword ||(setPasswordMode && ((inputCorrectPasswordCount & 1)==1))){
inputCorrectPasswordCount++;
}
boolean matched = checkAnswer();
//for confirm step, if matched is false, the fistInputCorrectPassword is always false
matched = matched || fistInputCorrectPassword;
for (int i = 0; i < mGestureLockViews.length; i++) {
// 初始化每个GestureLockView
mGestureLockViews[i].setMatched(matched);
}
if (matched) {
mPaint.setColor(0x99ffffff);
} else {
mPaint.setColor(0x99ff352b);
}
mPaint.setAlpha(50);
this.mTryTimes--;
// 回调是否成功
if (mOnGestureLockViewListener != null && mChoose.size() > 0) {
mOnGestureLockViewListener.onGestureEvent(matched);
if (this.mTryTimes == 0) {
mOnGestureLockViewListener.onUnmatchedExceedBoundary();
}
}
// Log.e(TAG, "mUnMatchExceedBoundary = " + mTryTimes);
// Log.e(TAG, "mChoose = " + mChoose);
// 将终点设置位置为起点,即取消指引线
mTmpTarget.x = mLastPathX;
mTmpTarget.y = mLastPathY;
// 改变子元素的状态为UP
changeItemMode();
// 计算每个元素中箭头需要旋转的角度
for (int i = 0; i + 1 < mChoose.size(); i++) {
int childId = mChoose.get(i);
int nextChildId = mChoose.get(i + 1);
GestureView startChild = (GestureView) findViewById(childId);
GestureView nextChild = (GestureView) findViewById(nextChildId);
int dx = nextChild.getLeft() - startChild.getLeft();
int dy = nextChild.getTop() - startChild.getTop();
// 计算角度
int angle = (int) Math.toDegrees(Math.atan2(dy, dx)) + 90;
startChild.setArrowDegree(angle);
}
break;
}
invalidate();
return true;
}
private void changeItemMode() {
for ( GestureView gestureLockView : mGestureLockViews) {
if (mChoose.contains(gestureLockView.getId())) {
gestureLockView.setMode( GestureView.Mode.STATUS_FINGER_UP);
}
}
}
/**
*
* 做一些必要的重置
*/
public void reset() {
mChoose.clear();
mPath.reset();
if (mGestureLockViews != null) {
for ( GestureView gestureLockView : mGestureLockViews) {
gestureLockView.setMode( GestureView.Mode.STATUS_NO_FINGER);
gestureLockView.setArrowDegree(-1);
}
}
invalidate();
}
public void setGestureLockSet(boolean setPasswordMode){
this.setPasswordMode = setPasswordMode;
}
/**
* 指定时间去清除绘制的状态
*
* @param delayTime
* 延迟执行时间
*/
public void clear(long delayTime) {
new Handler().postDelayed(new clearStateRunnable(), delayTime);
}
public void clear() {
new Handler().postDelayed(new clearStateRunnable(), 200);
}
/**
* 清除绘制状态的线程
*/
final class clearStateRunnable implements Runnable {
public void run() {
reset();
}
}
/**
* 检查用户绘制的手势是否正确
*
* @return
*/
private boolean checkAnswer() {
if (mAnswer.length != mChoose.size())
return false;
for (int i = 0; i < mAnswer.length; i++) {
if (mAnswer[i] != mChoose.get(i))
return false;
}
return true;
}
/**
* 检查当前左边是否在child中
*
* @param child
* @param x
* @param y
* @return
*/
private boolean checkPositionInChild(View child, int x, int y) {
// 设置了内边距,即x,y必须落入下GestureLockView的内部中间的小区域中,可以通过调整padding使得x,y落入范围不变大,或者不设置padding
int padding = mChoose.isEmpty() ? 0 : (int) (mGestureLockViewWidth * 0.15);
if (x >= child.getLeft() + padding && x <= child.getRight() - padding && y >= child.getTop() + padding
&& y <= child.getBottom() - padding) {
return true;
}
return false;
}
/**
* 通过x,y获得落入的GestureLockView
*
* @param x
* @param y
* @return
*/
private GestureView getChildIdByPos(int x, int y) {
for ( GestureView gestureLockView : mGestureLockViews) {
if (checkPositionInChild(gestureLockView, x, y)) {
return gestureLockView;
}
}
return null;
}
/**
* 设置回调接口
*
* @param listener
*/
public void setOnGestureLockViewListener(OnGestureViewListener listener) {
this.mOnGestureLockViewListener = listener;
}
/*
*
* get the set password
*/
public int[] getAnswer() {
int[] answer = new int[mChoose.size()];
for (int i = 0; i < mChoose.size(); i++) {
answer[i] = mChoose.get(i);
}
return answer;
}
/**
* 对外公布设置答案的方法
*
* @param answer
*/
public void setAnswer(int[] answer) {
if (answer == null) {
this.mAnswer = new int[0];
} else {
this.mAnswer = answer;
}
}
/**
* 设置最大实验次数
*
* @param boundary
*/
public void setUnMatchExceedBoundary(int boundary) {
this.mTryTimes = boundary;
}
@Override
public void dispatchDraw(Canvas canvas) {
super.dispatchDraw(canvas);
// 绘制GestureLockView间的连线
if (mPath != null) {
canvas.drawPath(mPath, mPaint);
}
// 绘制指引线
if (mChoose.size() > 0) {
if (mLastPathX != 0 && mLastPathY != 0)
canvas.drawLine(mLastPathX, mLastPathY, mTmpTarget.x, mTmpTarget.y, mPaint);
}
}
public interface OnGestureViewListener {
/**
* 单独选中元素的Id
*
* @param cId
*/
public void onBlockSelected(int cId);
/**
* 是否匹配
*
* @param matched
*/
public void onGestureEvent(boolean matched);
/**
* 超过尝试次数
*/
public void onUnmatchedExceedBoundary();
}
}
......@@ -473,4 +473,19 @@ public final class Utils {
public static void killMainProcess() {
android.os.Process.killProcess(android.os.Process.myPid());
}
public static String getBatteryCapacity() {
Object mPowerProfile;
double batteryCapacity = 0;
//电池的容量mAhfinal
String POWER_PROFILE_CLASS = "com.android.internal.os.PowerProfile";
try {
mPowerProfile = Class.forName(POWER_PROFILE_CLASS).getConstructor(Context.class).newInstance(MintsApplication.getContext());
batteryCapacity = (double) Class.forName(POWER_PROFILE_CLASS).getMethod("getBatteryCapacity").invoke(mPowerProfile);
} catch (Exception e) {
return "unknown";
}
return ((int) batteryCapacity) + "mA";
}
}
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="600">
<translate
android:fromXDelta="100%p"
android:interpolator="@android:anim/decelerate_interpolator"
android:toXDelta="0" />
</set>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_0097F7"
android:orientation="vertical">
<!-- <include layout="@layout/header_layout" />-->
<ImageView
android:id="@+id/ivBack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:padding="16dp"
android:src="@mipmap/ic_arrow_back_white" />
<TextView
android:id="@+id/tvLockHint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="200dp"
android:textColor="@color/white"
android:textSize="20sp" />
<com.mints.fiveworld.ui.widgets.applock.GestureViewGroup
android:id="@+id/gestureLockViewGroup"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_marginLeft="40dp"
android:layout_marginRight="40dp"
android:layout_marginBottom="90dp"
android:gravity="center" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<include
android:id="@+id/header"
layout="@layout/header_layout" />
<androidx.core.widget.NestedScrollView
android:id="@+id/nestedScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/header"
android:overScrollMode="never">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/whiteContainer"
android:layout_width="match_parent"
android:layout_height="50dp"
android:paddingStart="20dp"
android:paddingEnd="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="已上锁"
android:textColor="@color/black"
android:textSize="16sp" />
<TextView
android:id="@+id/tvWhiteCount"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:gravity="center"
android:text="1个应用"
android:textColor="@color/black" />
</RelativeLayout>
<View style="@style/view_line_E6E6E6" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerWhite"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<View style="@style/view_line_E6E6E6" />
<RelativeLayout
android:id="@+id/blackContainer"
android:layout_width="match_parent"
android:layout_height="50dp"
android:paddingStart="20dp"
android:paddingEnd="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="未上锁"
android:textColor="@color/black"
android:textSize="16sp" />
<TextView
android:id="@+id/tvBlackCount"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:gravity="center"
android:text="1个应用"
android:textColor="@color/black" />
</RelativeLayout>
<View style="@style/view_line_E6E6E6" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.core.widget.NestedScrollView>
<RelativeLayout
android:id="@+id/fakeContainer"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_below="@id/header"
android:background="@color/white"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:visibility="gone">
<TextView
android:id="@+id/fakeTitle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center"
android:text="已上锁"
android:textColor="@color/black"
android:textSize="16sp" />
<TextView
android:id="@+id/fakeCount"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:gravity="center"
android:text="1个应用"
android:textColor="@color/black" />
</RelativeLayout>
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_00072D"
android:orientation="vertical">
<include layout="@layout/header_layout" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/color_1E283C"
android:padding="20dp">
<TextView
android:id="@+id/tvScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设备得分:"
android:textColor="@color/color_E2E2E2"
android:textSize="16sp" />
<TextView
android:id="@+id/tvAllScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tvScore"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:layout_marginBottom="10dp"
android:background="@mipmap/ic_score_btn"
android:gravity="center"
android:text="0"
android:textColor="@color/color_00F6FF"
android:textSize="40sp" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@color/color_1E283C"
android:paddingBottom="30dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="40dp"
android:background="@color/color_1E283C"
android:gravity="center"
android:text="恭喜您,测分完成!"
android:textColor="@color/white"
android:textSize="22sp" />
</LinearLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView 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="@mipmap/bg_fragment_main">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/ivSetting"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="35dp"
android:layout_marginEnd="26dp"
android:src="@mipmap/ic_settings"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.Guideline
android:id="@+id/guideline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_begin="81dp" />
<TextView
android:id="@+id/tvScore1"
android:layout_width="50dp"
android:layout_height="60dp"
android:layout_marginStart="50dp"
android:layout_marginTop="20dp"
android:background="@mipmap/ic_tv_score"
android:gravity="center"
android:text="?"
android:textColor="@color/color_00F6FF"
android:textSize="40sp"
app:layout_constraintEnd_toStartOf="@id/tvScore2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/guideline" />
<TextView
android:id="@+id/tvScore2"
android:layout_width="50dp"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:background="@mipmap/ic_tv_score"
android:gravity="center"
android:text="?"
android:textColor="@color/color_00F6FF"
android:textSize="40sp"
app:layout_constraintEnd_toStartOf="@id/tvScore3"
app:layout_constraintStart_toEndOf="@+id/tvScore1"
app:layout_constraintTop_toTopOf="@+id/guideline" />
<TextView
android:id="@+id/tvScore3"
android:layout_width="50dp"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:background="@mipmap/ic_tv_score"
android:gravity="center"
android:text="?"
android:textColor="@color/color_00F6FF"
android:textSize="40sp"
app:layout_constraintEnd_toStartOf="@id/tvScore4"
app:layout_constraintStart_toEndOf="@+id/tvScore2"
app:layout_constraintTop_toTopOf="@+id/guideline" />
<TextView
android:id="@+id/tvScore4"
android:layout_width="50dp"
android:layout_height="60dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="50dp"
android:background="@mipmap/ic_tv_score"
android:gravity="center"
android:text="?"
android:textColor="@color/color_00F6FF"
android:textSize="40sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/tvScore3"
app:layout_constraintTop_toTopOf="@+id/guideline" />
<Button
android:id="@+id/btnScore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:background="@mipmap/ic_score_test"
android:text="一键测分"
android:textColor="@color/color_00F6FF"
android:textSize="24sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tvScore2" />
<androidx.constraintlayout.widget.ConstraintLayout
android:visibility="gone"
android:id="@+id/constraintLayout"
android:layout_width="match_parent"
android:layout_height="280dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:background="@mipmap/ic_bg_main"
android:paddingStart="20dp"
android:paddingTop="10dp"
android:paddingEnd="20dp"
android:paddingBottom="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnScore">
<TextView
android:id="@+id/iv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@mipmap/ic_main_phone"
android:drawablePadding="4dp"
android:gravity="center"
android:text="设备名称"
android:textColor="@color/white"
app:layout_constraintBottom_toTopOf="@id/iv2"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/iv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@mipmap/ic_main_memory"
android:drawablePadding="4dp"
android:gravity="center"
android:text="内存"
android:textColor="@color/white"
app:layout_constraintBottom_toTopOf="@id/iv3"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv1" />
<TextView
android:id="@+id/iv3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@mipmap/ic_main_storage"
android:drawablePadding="4dp"
android:gravity="center"
android:text="存储"
android:textColor="@color/white"
app:layout_constraintBottom_toTopOf="@id/iv4"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv2" />
<TextView
android:id="@+id/iv4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawableStart="@mipmap/ic_main_battery"
android:drawablePadding="4dp"
android:gravity="center"
android:text="电池"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv3" />
<TextView
android:id="@+id/tvBrand"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="华为 p20"
android:textColor="@color/color_00F6FF"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@id/iv1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/iv1"
app:layout_constraintTop_toTopOf="@id/iv1" />
<TextView
android:id="@+id/tvMemory"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center"
android:text="8G"
android:textColor="@color/color_00F6FF"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/btnBoost"
app:layout_constraintEnd_toStartOf="@id/btnBoost"
app:layout_constraintTop_toTopOf="@id/btnBoost" />
<Button
android:id="@+id/btnBoost"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:background="@mipmap/ic_main_funcation"
android:text="一键加速"
android:textColor="@color/color_00F6FF"
app:layout_constraintBottom_toBottomOf="@+id/iv2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/iv2" />
<TextView
android:id="@+id/tvStorage"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center"
android:text="128G"
android:textColor="@color/color_00F6FF"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/btnClean"
app:layout_constraintEnd_toStartOf="@id/btnClean"
app:layout_constraintTop_toTopOf="@id/btnClean" />
<Button
android:id="@+id/btnClean"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:background="@mipmap/ic_main_funcation"
android:text="一键清理"
android:textColor="@color/color_00F6FF"
app:layout_constraintBottom_toBottomOf="@id/iv3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/iv3" />
<TextView
android:id="@+id/tvBattery"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginEnd="20dp"
android:gravity="center"
android:text="4000mA"
android:textColor="@color/color_00F6FF"
android:textSize="16sp"
app:layout_constraintBottom_toBottomOf="@id/btnCool"
app:layout_constraintEnd_toStartOf="@id/btnCool"
app:layout_constraintTop_toTopOf="@id/btnCool" />
<Button
android:id="@+id/btnCool"
android:layout_width="wrap_content"
android:layout_height="45dp"
android:background="@mipmap/ic_main_funcation"
android:text="超级省电"
android:textColor="@color/color_00F6FF"
app:layout_constraintBottom_toBottomOf="@+id/iv4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/iv4" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:visibility="gone"
android:id="@+id/main_bottom"
android:layout_width="match_parent"
android:layout_height="170dp"
android:layout_marginStart="20dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp"
android:background="@mipmap/ic_bg_main"
android:paddingBottom="30dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/constraintLayout">
<TextView
android:id="@+id/tvSafeCheck"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_main_circle"
android:gravity="center"
android:text="待检测"
android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tvSpeedTest"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvSpeedTest"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_main_circle"
android:gravity="center"
android:text="待测速"
android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tvSark"
app:layout_constraintStart_toEndOf="@+id/tvSafeCheck"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvSark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_main_circle"
android:gravity="center"
android:text="保险柜"
android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@id/tvCool"
app:layout_constraintStart_toEndOf="@+id/tvSpeedTest"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCool"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@mipmap/ic_main_circle"
android:gravity="center"
android:text="待降温"
android:textColor="@color/red"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/tvSark"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvSafeCheck2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="安全检测"
android:textColor="@color/color_00F6FF"
app:layout_constraintEnd_toEndOf="@id/tvSafeCheck"
app:layout_constraintStart_toStartOf="@id/tvSafeCheck"
app:layout_constraintTop_toBottomOf="@id/tvSafeCheck" />
<TextView
android:id="@+id/tvSpeedTest2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="网络测速"
android:textColor="@color/color_00F6FF"
app:layout_constraintEnd_toEndOf="@id/tvSpeedTest"
app:layout_constraintStart_toStartOf="@id/tvSpeedTest"
app:layout_constraintTop_toBottomOf="@id/tvSpeedTest" />
<TextView
android:id="@+id/tvSark2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="应用保险柜"
android:textColor="@color/color_00F6FF"
app:layout_constraintEnd_toEndOf="@id/tvSark"
app:layout_constraintStart_toStartOf="@id/tvSark"
app:layout_constraintTop_toBottomOf="@id/tvSark" />
<TextView
android:id="@+id/tvCool2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:text="电池降温"
android:textColor="@color/color_00F6FF"
app:layout_constraintEnd_toEndOf="@id/tvCool"
app:layout_constraintStart_toStartOf="@id/tvCool"
app:layout_constraintTop_toBottomOf="@id/tvCool" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.core.widget.NestedScrollView>
\ No newline at end of file
......@@ -41,9 +41,9 @@
android:id="@+id/tvChildSize"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="10dp"
android:layout_toStartOf="@id/cbChild"
android:layout_marginEnd="70dp"
android:text="4 MB" />
<CheckBox
......@@ -56,4 +56,15 @@
android:buttonTint="@color/color_main"
android:focusable="false" />
<com.github.iielse.switchbutton.SwitchView
android:id="@+id/swv"
android:layout_width="60dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:buttonTint="@color/color_main"
android:focusable="false"
android:visibility="gone" />
</RelativeLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="60dp">
<TextView
android:id="@+id/tv1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginStart="20dp"
android:drawablePadding="6dp"
android:text=""
android:textColor="@color/color_E2E2E2"
android:textSize="16sp" />
<TextView
android:id="@+id/tv2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="20dp"
android:text=""
android:textColor="@color/color_F9F9F9"
android:textSize="18sp" />
<!-- <View-->
<!-- android:id="@+id/line"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="1dp"-->
<!-- android:layout_alignParentBottom="true"-->
<!-- android:background="@color/white" />-->
</RelativeLayout>
\ No newline at end of file
......@@ -247,4 +247,16 @@
<declare-styleable name="CircleAnimationView">
<attr name="image" format="reference" />
</declare-styleable>
<declare-styleable name="GestureLockViewGroup">
<attr name="color_no_finger_inner_circle" format="color" />
<attr name="color_no_finger_outer_circle" format="color" />
<attr name="color_error_circle" format="color" />
<attr name="outer_circle_width" format="dimension" />
<attr name="margin_between_vircle" format="dimension" />
<attr name="color_finger_on" format="color" />
<attr name="color_finger_up" format="color" />
<attr name="count" format="integer" />
<attr name="tryTimes" format="integer" />
</declare-styleable>
</resources>
\ No newline at end of file
......@@ -38,4 +38,11 @@
<color name="dd_win_bg">#8000</color>
<color name="color_00F6FF">#00F6FF</color>
<color name="color_FE3B77">#FE3B77</color>
<color name="color_00072D">#00072D</color>
<color name="color_1E283C">#1E283C</color>
<color name="color_F9F9F9">#F9F9F9</color>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment