Commit d5213374 authored by jyx's avatar jyx

添加锁屏页,更新清理页动画

parent df5f72b2
......@@ -143,11 +143,11 @@ android {
doNotStrip "*/*/libt2.so"
}
sourceSets {
main {
jniLibs.srcDir 'libs'
}
}
// sourceSets {
// main {
// jniLibs.srcDir 'libs'
// }
// }
// TODO 这句需要把相关函数也挪过去
project.initApplicationScript(defaultConfig, sourceSets)
......@@ -156,12 +156,12 @@ android {
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.google.android.material:material:1.2.1'
// 网络请求
implementation 'com.squareup.retrofit2:retrofit:2.7.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.1.0'
// 异步
implementation "io.reactivex.rxjava2:rxjava:2.2.6"
......@@ -170,9 +170,9 @@ dependencies {
implementation 'com.readystatesoftware.systembartint:systembartint:1.0.3'
implementation 'com.gyf.immersionbar:immersionbar:2.3.3-beta15'
// okhttp3日志
implementation 'com.squareup.okhttp3:logging-interceptor:4.1.0'
// implementation 'com.squareup.okhttp3:okhttp:4.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.squareup.okhttp3:logging-interceptor:4.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
// implementation 'com.squareup.okhttp3:okhttp:3.11.0'
implementation 'com.orhanobut:logger:2.2.0'
// 权限
implementation 'com.tbruyelle.rxpermissions:rxpermissions:0.9.3@aar'
......@@ -267,9 +267,8 @@ dependencies {
// 枫岚
implementation(name: 'mh-adsdk', ext: 'aar')
implementation(name: 'mh-adsdk-ext', ext: 'aar')
// 喜马拉雅
implementation(name: 'TingPhoneOpenSDK-8.0.2', ext: 'aar')
implementation(name: 'windAd-3.1.1', ext: 'aar')
// 喜马拉雅 jar自动引入
implementation 'com.squareup.okio:okio:1.15.0'
// 微转阅读(接入h5方式)
//天卓SDK的珊瑚2.0组件
implementation(name: 'adapt-1.3.3', ext: 'aar')
......
......@@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.mints.flowbox">
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
......@@ -145,13 +146,25 @@
<activity android:name=".ui.activitys.SpeedFastActivity" />
<activity android:name=".ui.activitys.SpeedTestActivity" />
<activity android:name=".ui.activitys.ScanActivity" />
<activity android:name=".ui.activitys.CleanActivity" />
<activity android:name=".ui.activitys.Increasespeed2Activity" />
<activity android:name=".ui.activitys.IncreasespeedActivity" />
<activity android:name=".ui.activitys.BoostFastActivity" />
<activity android:name="com.mints.flowbox.ui.activitys.SplashGroMoreBackgroundActivity" />
<activity android:name="com.mints.flowbox.ui.activitys.RedboxEraseActivity" />
<activity
android:name=".ui.activitys.IncreasespeedActivity"
android:excludeFromRecents="true"
android:exported="false"
android:finishOnTaskLaunch="false"
android:launchMode="singleInstance" />
<activity
android:name=".ui.activitys.CleanActivity"
android:excludeFromRecents="true"
android:exported="false"
android:finishOnTaskLaunch="false"
android:launchMode="singleInstance" />
<activity
android:name=".ui.activitys.ScreenActivity"
android:excludeFromRecents="true"
......@@ -166,6 +179,13 @@
android:finishOnTaskLaunch="false"
android:launchMode="singleInstance"
android:theme="@style/CustomerTransparentTheme" />
<activity
android:name=".ui.activitys.ApkActivity"
android:excludeFromRecents="true"
android:exported="false"
android:finishOnTaskLaunch="false"
android:launchMode="singleInstance"
android:theme="@style/CustomerTransparentTheme" />
<service
android:name=".service.UpdateService"
......@@ -292,6 +312,7 @@
android:name="com.ximalaya.ting.android.opensdk.player.service.XmPlayerService"
android:exported="true"
android:process=":player" />
</application>
</manifest>
\ No newline at end of file
......@@ -7,7 +7,6 @@ import android.os.Build;
import android.text.TextUtils;
import android.util.Log;
import android.webkit.WebView;
import android.widget.Toast;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.multidex.MultiDex;
......@@ -17,6 +16,7 @@ import com.activityutil.ActivityManagerProxy;
import com.activityutil.ActivityManagerProxyImpl;
import com.ad.AdHelper;
import com.hjq.toast.ToastUtils;
import com.mints.flowbox.ad.express.ExpressManager;
import com.mints.flowbox.common.Constant;
import com.mints.flowbox.keepalive.BatteryWatch;
import com.mints.flowbox.keepalive.DemoEventLogger;
......@@ -27,12 +27,15 @@ import com.mints.flowbox.keepalive.PackageWatch;
import com.mints.flowbox.keepalive.PhoneWatch;
import com.mints.flowbox.keepalive.ServiceUtil;
import com.mints.flowbox.keepalive.ScreenWatch;
import com.mints.flowbox.keepalive.WifiStateWatch;
import com.mints.flowbox.manager.CsjGroMoreManager;
import com.mints.flowbox.manager.MiitHelper;
import com.mints.flowbox.manager.ad.OwManager;
import com.mints.flowbox.manager.ad.TzManager;
import com.mints.flowbox.manager.ad.WnManager;
import com.mints.flowbox.net.LoanService;
import com.mints.flowbox.ui.activitys.ApkActivity;
import com.mints.flowbox.ui.activitys.BoostActivity;
import com.mints.flowbox.ui.activitys.ScreenActivity;
import com.mints.flowbox.utils.ForegroundOrBackground;
import com.mints.flowbox.utils.SystemUtils;
......@@ -42,6 +45,7 @@ import com.orhanobut.logger.FormatStrategy;
import com.orhanobut.logger.Logger;
import com.orhanobut.logger.PrettyFormatStrategy;
import com.tencent.bugly.crashreport.CrashReport;
import net.DebugConfig;
import net.analytics.AnalyticsLogger;
import net.app.BaseApp;
......@@ -81,11 +85,11 @@ public class MintsApplication extends BaseApp {
MultiDex.install(base);
// 保活: 这句放在MultiDex后面,最后的Service一定要是一个常驻通知栏的主Service
KeepAliveHelper.Companion.preInit(base, this, NotificationService.class);
// 9.0之后不可多进程使用一个目录下的WebView,写在SDK初始化之前
androidPWebView();
// 保活: 这句放在MultiDex后面,最后的Service一定要是一个常驻通知栏的主Service
KeepAliveHelper.Companion.preInit(base, this, NotificationService.class);
}
@Override
......@@ -189,25 +193,51 @@ public class MintsApplication extends BaseApp {
// Toast.makeText(this, "测试:主进程重启成功", Toast.LENGTH_LONG).show();
// }
// 监听锁屏状态
ScreenWatch.getInstance(this).begin(() -> {
showScreen();
WifiStateWatch.getInstance(this).begin(new WifiStateWatch.WifiStateListener() {
@Override
public void onWifiOpen() {
ToastUtils.show("--> 开启wifi <--");
showBoost();
}
// ToastUtils.show("--> 唤醒屏幕 <--");
@Override
public void onWifiClose() {
ToastUtils.show("--> 关闭wifi <--");
showBoost();
}
});
// 监听锁屏状态
ScreenWatch.getInstance(this).begin(new ScreenWatch.ScreenStateListener() {
@Override
public void onScreenOn() {
ToastUtils.show("--> 亮屏 <--");
}
@Override
public void onScreenOff() {
ToastUtils.show("--> 息屏 <--");
showScreen();
}
});
// 监听实体键状态
HomeKeyWatch.getInstance(this).begin(new HomeKeyWatch.HomeKeyStateListener() {
@Override
public void onHOME_KEY() {
// ToastUtils.show("--> 点击HOME建 <--");
// showScreen();
showBoost();
ToastUtils.show("--> 点击HOME键 <--");
}
@Override
public void onRECENT_APPS() {
// ToastUtils.show("--> 最近任务列表 <--");
// showScreen();
showBoost();
ToastUtils.show("--> 最近任务列表 <--");
}
});
......@@ -215,7 +245,9 @@ public class MintsApplication extends BaseApp {
PhoneWatch.getInstance(this).begin(new PhoneWatch.PhoneStateListener() {
@Override
public void onIdle() {
// ToastUtils.show("--> 电话挂断 <--");
showBoost();
ToastUtils.show("--> 电话挂断 <--");
}
});
......@@ -223,48 +255,96 @@ public class MintsApplication extends BaseApp {
BatteryWatch.getInstance(this).begin(new BatteryWatch.BatteryStateListener() {
@Override
public void onCharging() {
showScreen();
showBoost();
// ToastUtils.show("--> 正在充电 <--");
ToastUtils.show("--> 正在充电 <--");
}
@Override
public void onUnCharging() {
showScreen();
// ToastUtils.show("--> 停止充电 <--");
showBoost();
ToastUtils.show("--> 停止充电 <--");
}
});
// 监听安包状态
// 监听安包状态
PackageWatch.getInstance(this).begin(new PackageWatch.InstallStateListener() {
@Override
public void onAdded() {
// ToastUtils.show("--> APK安装 <--");
public void onAdded(String pkgName) {
showApk(0, pkgName);
ToastUtils.show("--> APK安装 <--");
}
@Override
public void onReplaced() {
// ToastUtils.show("--> APK卸载 <--");
public void onReplaced(String pkgName) {
showApk(1, pkgName);
ToastUtils.show("--> APK卸载 <--");
}
@Override
public void onRemoved() {
// ToastUtils.show("--> APK移除 <--");
public void onRemoved(String pkgName) {
showApk(2, pkgName);
ToastUtils.show("--> APK移除 <--");
}
});
}
// 保活: 保活最后一步
KeepAliveHelper.Companion.postInit(this);
}
/**
* 展示apk管理页面
*
* @param state 0:安装 1:更新 2:卸载
* @param pkgName 包名
*/
private void showApk(int state, String pkgName) {
// 应用在前台,则不展示
if (ForegroundOrBackground.isForeground2() || state == 1) {
return;
}
Intent intent = new Intent(MintsApplication.getContext(), ApkActivity.class);
intent.putExtra(ApkActivity.APK_STATE, state);
intent.putExtra(ApkActivity.APK_PKG_NAME, pkgName);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MintsApplication.this.startActivity(intent);
}
/**
* 展示加速页面
*/
private void showBoost() {
// 应用在前台,则不展示
if (ForegroundOrBackground.isForeground2()) {
return;
}
// 预加载信息流
ExpressManager.INSTANCE.loadExpress();
Intent intent = new Intent(MintsApplication.getContext(), BoostActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MintsApplication.this.startActivity(intent);
}
/**
* 展示锁屏页面
*/
private void showScreen() {
if (ForegroundOrBackground.isForeground()) {
// 应用在前台,则不展示
if (ForegroundOrBackground.isForeground2()) {
return;
}
// 预加载信息流
ExpressManager.INSTANCE.loadExpress();
Intent intent = new Intent(MintsApplication.getContext(), ScreenActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
MintsApplication.this.startActivity(intent);
......
......@@ -150,7 +150,7 @@ public class InterstitialGroManager {
@Override
public void onInterstitialClosed() {
if (wifiAdStatusListener != null) {
wifiAdStatusListener.adSuccess();
wifiAdStatusListener.adClose();
}
AppConfig.isShowInsertScreen = false;
}
......
......@@ -4,9 +4,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import com.mints.flowbox.MintsApplication;
/**
* @author jyx
......@@ -37,10 +34,9 @@ public class BatteryWatch {
private class BatteryBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
if (status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL) {
if (intent.getAction().equals(Intent.ACTION_POWER_CONNECTED)) {
mStateListener.onCharging();
} else {
} else if (intent.getAction().equals(Intent.ACTION_POWER_DISCONNECTED)) {
mStateListener.onUnCharging();
}
}
......
......@@ -8,6 +8,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import android.os.Bundle;
import android.os.IBinder;
import android.widget.RemoteViews;
......@@ -16,6 +17,7 @@ import androidx.core.app.NotificationCompat;
import com.KeepAliveHelper;
import com.mints.flowbox.R;
import com.mints.flowbox.common.Constant;
import com.mints.flowbox.ui.activitys.CleanActivity;
import com.mints.flowbox.ui.activitys.MainActivity;
import com.mints.flowbox.ui.activitys.SpeedTestActivity;
......@@ -191,7 +193,11 @@ public class NotificationService extends Service {
mainPendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
break;
case CLICK_TYPE_CLEAN:
mainPendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, CleanActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
Bundle bundle = new Bundle();
bundle.putInt(Constant.SCAN_TYPE, 1);
Intent intent = new Intent(context, CleanActivity.class);
intent.putExtras(bundle);
mainPendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
break;
case CLICK_TYPE_TEST:
mainPendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, SpeedTestActivity.class), PendingIntent.FLAG_UPDATE_CURRENT);
......
......@@ -36,17 +36,16 @@ public class PackageWatch {
@Override
public void onReceive(Context context, Intent intent) {
PackageManager manager = context.getPackageManager();
if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) {
String packageName = intent.getData().getSchemeSpecificPart();
mStateListener.onAdded();
if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) {
mStateListener.onAdded(packageName);
}
if (intent.getAction().equals(Intent.ACTION_PACKAGE_REMOVED)) {
String packageName = intent.getData().getSchemeSpecificPart();
mStateListener.onRemoved();
mStateListener.onRemoved(packageName);
}
if (intent.getAction().equals(Intent.ACTION_PACKAGE_REPLACED)) {
String packageName = intent.getData().getSchemeSpecificPart();
mStateListener.onReplaced();
mStateListener.onReplaced(packageName);
}
}
}
......@@ -80,11 +79,11 @@ public class PackageWatch {
public interface InstallStateListener {
void onAdded();
void onAdded(String pkgName);
void onReplaced();
void onReplaced(String pkgName);
void onRemoved();
void onRemoved(String pkgName);
}
......
......@@ -38,6 +38,8 @@ public class ScreenWatch {
public void onReceive(Context context, Intent intent) {
if (Intent.ACTION_SCREEN_ON.equals(intent.getAction())) { // 开屏
mScreenStateListener.onScreenOn();
} else if (Intent.ACTION_SCREEN_OFF.equals(intent.getAction())) { // 息屏
mScreenStateListener.onScreenOff();
}
}
}
......@@ -72,7 +74,7 @@ public class ScreenWatch {
void onScreenOn();
// public void onScreenOff();
void onScreenOff();
//
// public void onUserPresent();
}
......
......@@ -4,7 +4,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.BatteryManager;
import android.net.wifi.WifiManager;
/**
* @author jyx
......@@ -35,13 +35,28 @@ public class WifiStateWatch {
private class WifiBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
int status = intent.getIntExtra(BatteryManager.EXTRA_STATUS, -1);
if (status == BatteryManager.BATTERY_STATUS_CHARGING || status == BatteryManager.BATTERY_STATUS_FULL) {
mStateListener.onWifiOpen();
} else {
switch (intent.getIntExtra(WifiManager.EXTRA_WIFI_STATE, 0)) {
case WifiManager.WIFI_STATE_DISABLED: {// wifi已经关闭
if (mStateListener != null) {
mStateListener.onWifiClose();
}
}
case WifiManager.WIFI_STATE_DISABLING: {// wifi正在关闭
}
case WifiManager.WIFI_STATE_ENABLED: {// wifi已经打开
if (mStateListener != null) {
mStateListener.onWifiOpen();
}
}
case WifiManager.WIFI_STATE_ENABLING: {// wifi正在打开
}
case WifiManager.WIFI_STATE_UNKNOWN: {// unknown
}
}
}
}
/**
......@@ -64,8 +79,7 @@ public class WifiStateWatch {
*/
private void registerListener() {
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_POWER_CONNECTED);
filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
mContext.registerReceiver(mReceiver, filter);
}
......
......@@ -6,6 +6,7 @@ import com.mints.flowbox.common.DeviceInfo
import com.mints.flowbox.net.CpdService
import com.mints.flowbox.utils.MD5
import com.mints.library.net.netstatus.NetUtils
import okhttp3.MediaType
import okhttp3.MediaType.Companion.toMediaTypeOrNull
import okhttp3.RequestBody
import org.json.JSONException
......@@ -80,6 +81,7 @@ object CpdManager {
}
return RequestBody.create("application/json".toMediaTypeOrNull(), param.toString())
// return RequestBody.create(MediaType.parse("application/json"), param.toString())
}
/**
......
......@@ -2,22 +2,27 @@ package com.mints.flowbox.manager.ad
import android.app.Application
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.common.Constant
import com.mints.library.utils.CommonUtils
import com.tz.sdk.core.engine.ADEngine
import com.tz.sdk.core.engine.ADEngineConfig
import com.ximalaya.ting.android.opensdk.player.service.XmPlayerConfig
/**
* 描述:天卓珊瑚激励视频
*/
object TzManager {
const val APP_KEY = "8aac19578f57b6d96f05eeedce75b99f"
const val APP_SECRET = "d54da9aa7a4de6b2688c58eac85b5761"
const val APP_KEY = "18a349f6ba2454010d9d151c479b602b\n"
const val APP_SECRET = "47c61fad0a5303851797728aa71d5eaa"
/**
* 初始化
*/
fun initTz(application: Application) {
XmPlayerConfig.getInstance(application)
.setDefualtNotificationNickNameAndInfo(Constant.MINTS_APP_NAME, Constant.MINTS_APP_NAME)
ADEngine.getInstance(application)
.start(
ADEngineConfig.Builder(application)
......@@ -29,7 +34,7 @@ object TzManager {
"CHANNEL_NAME"
)
)
.forTest(true)
.forTest(false)
.log(true)
.verbose(true)
.build()
......
......@@ -20,7 +20,10 @@ object XmManager {
*/
fun init(application: Application) {
XmPlayerConfig.getInstance(application)
.setDefualtNotificationNickNameAndInfo(Constant.MINTS_APP_NAME, Constant.MINTS_APP_NAME)
.setDefualtNotificationNickNameAndInfo(
Constant.MINTS_APP_NAME,
Constant.MINTS_APP_NAME
)
if (BaseUtil.isMainProcess(application)) {
ConstantsOpenSdk.isDebug = BuildConfig.DEBUG
val ximalaya = CommonRequest.getInstanse()
......
package com.mints.flowbox.mvp.presenters
import com.google.gson.JsonObject
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.AppHttpManager
import com.mints.flowbox.mvp.model.BaseResponse
import com.mints.flowbox.mvp.model.SignRedbagsBean
import com.mints.flowbox.mvp.views.BonusView
import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable
import java.util.HashMap
class BonusPresenter : BasePresenter<BonusView>() {
......@@ -67,4 +69,32 @@ class BonusPresenter : BasePresenter<BonusView>() {
}
})
}
/**
* 设置邀请成功
*
*/
fun cmtShareStatus() {
val vo = HashMap<String, Any>()
vo["carrierType"] = Constant.CHALLENGE_SHAREFRIEND
vo["value"] = "1"
AppHttpManager.getInstance(loanApplication)
.call(
loanService.setStatusInOneDayByCarrierType(vo),
object : BaseSubscriber<BaseResponse<Any>>() {
override fun onCompleted() {
if (isLinkView) return
}
override fun onError(e: Throwable) {
if (isLinkView) return
}
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
when (baseResponse.status) {
}
}
})
}
}
\ No newline at end of file
package com.mints.flowbox.ui.activitys
import android.os.Bundle
import android.text.TextUtils
import android.view.View
import androidx.core.content.ContextCompat
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R
import com.mints.flowbox.common.Constant
import com.mints.flowbox.keepalive.AlarmManager
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.utils.AppUtil
import com.mints.flowbox.utils.SpanUtils
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_apk.*
import kotlinx.android.synthetic.main.activity_boost.iv_close
import kotlin.random.Random
/**
*
* 描述:apk 安装、卸载、更新时调用
*/
class ApkActivity : BaseActivity() {
companion object {
const val APK_STATE = "APK_STATE"
const val APK_PKG_NAME = "APK_PKG_NAME"
}
private var mApkState = 0
private var mApkPkgName = ""
private var rope: YoYo.YoYoString? = null
override fun getContentViewLayoutID() = R.layout.activity_apk
override fun initViewsAndEvents() {
iv_close.setOnClickListener {
finish()
overridePendingTransition(0, 0)
}
if (TextUtils.isEmpty(mApkPkgName)) finish()
initView()
}
private fun initView() {
if (mApkState == 0) {
// 应用安装
val apkInfo2 = AppUtil.getApkInfo2(this, mApkPkgName)
tvTitle.text = "安装包残留提示"
tvInfo.text = SpanUtils()
.append(apkInfo2.applicationName)
.setForegroundColor(ContextCompat.getColor(this, R.color.color_28BA75))
.append(" 安装完成,清理安装包可节省")
.append("大量")
.setForegroundColor(ContextCompat.getColor(this, R.color.color_28BA75))
.append("空间")
.create()
GlideUtils.loadImageView(this, apkInfo2.applicationIcon, ivIcon)
tvInfo2.visibility = View.VISIBLE
ivIcon.visibility = View.VISIBLE
} else if (mApkState == 2) {
// 应用卸载
tvTitle.text = "卸载残留提示"
tvInfo.text = SpanUtils()
.append("发现来自")
.append("卸载应用")
.setForegroundColor(ContextCompat.getColor(this, R.color.color_28BA75))
.append("的")
.append("${50 + Random.nextInt(100)}MB")
.setForegroundColor(ContextCompat.getColor(this, R.color.color_28BA75))
.append("残余垃圾")
.create()
tvInfo2.visibility = View.GONE
ivIcon.visibility = View.GONE
}
btnClean.setOnClickListener {
// 一键清理
val bundle = Bundle()
bundle.putInt(Constant.SCAN_TYPE, 5)
readyGo(CleanActivity::class.java, bundle)
}
}
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
mApkState = it.getInt(APK_STATE, 0)
mApkPkgName = it.getString(APK_PKG_NAME, "")
}
}
override fun isApplyKitKatTranslucency() = true
override fun finish() {
super.finish()
AlarmManager.getInstance().resetUserActionTime()
}
override fun onResume() {
super.onResume()
btnClean.postDelayed({
rope = YoYo.with(Techniques.Tada).duration(1000).repeat(2).playOn(btnClean)
}, 200)
}
override fun onDestroy() {
rope?.stop()
rope = null
super.onDestroy()
}
override fun onBackPressed() {
// 屏蔽返回键
// super.onBackPressed()
}
}
\ No newline at end of file
......@@ -6,11 +6,15 @@ import android.os.Handler
import android.os.Looper
import android.view.View
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.keepalive.AlarmManager
import com.mints.flowbox.ui.activitys.base.BaseActivity
import kotlinx.android.synthetic.main.activity_boost.*
/**
*
* 描述:应用外加速
*/
class BoostActivity : BaseActivity() {
private var mActivityManager: ActivityManager? = null
......@@ -35,6 +39,28 @@ class BoostActivity : BaseActivity() {
override fun onResume() {
super.onResume()
cleanMemory()
initExpress()
}
/**
* 初始化信息iyc
*/
private fun initExpress() {
try {
if (fl_ad != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onDestroy() {
// 预加载信息流
ExpressManager.loadExpress()
super.onDestroy()
}
private fun cleanMemory() {
......
......@@ -7,13 +7,16 @@ import android.graphics.Color
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.WindowManager
import android.view.animation.Animation
import android.view.animation.TranslateAnimation
import androidx.core.content.ContextCompat
import com.hjq.toast.ToastUtils
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.clean.CacheListItem
import com.mints.flowbox.clean.TaskAsyncTack
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.adapter.clean.CleanExpandAdapter
......@@ -70,6 +73,18 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
}
}
override fun onCreate(savedInstanceState: Bundle?) {
// 锁屏上显示
window.addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
or WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
or WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
)
super.onCreate(savedInstanceState)
}
override fun initViewsAndEvents() {
initView()
initCleanData()
......@@ -144,6 +159,10 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
isScaning = false
if (tvClean.visibility == View.VISIBLE) {
if (AppConfig.fakeCleanCount == 0) {
AppConfig.fakeCleanCount = mCleanList[0].childList.size
}
tvClean.text =
SpanUtils()
.append("检测到您的后台软件共运行\n\n")
......@@ -199,6 +218,9 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
isCleaning = false
isCleanCompleted = true
mCleanTimer?.cancel()
toResult()
return@runOnUiThread
}
......@@ -229,7 +251,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
}
if (taskType == 0) {
// cleaningOperation(mContext)
cleaningOperation(mContext)
}
if (taskType == 4) {
......@@ -252,6 +274,20 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
}, 1000, 1000.toLong())
}
private fun toResult() {
AppConfig.isCanClean = false
// 预加载信息流
ExpressManager.loadExpress()
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_CLEAN
)
readyGoThenKill(IncreasespeedActivity::class.java, bundle)
}
/** 初始化清理数据 */
private fun initCleanData() {
for (i in 0 until scanMax) {
......
package com.mints.flowbox.ui.activitys
import android.graphics.Color
import android.os.Bundle
import android.os.Handler
import android.os.Looper
......@@ -9,16 +10,22 @@ import android.view.animation.LayoutAnimationController
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.inscreen.InsertScreenAdManager
import com.mints.flowbox.ad.wifi.WifiAdManager
import com.mints.flowbox.ad.wifi.WifiAdStatusListener
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.adapter.IncreaseAdapter
import com.mints.flowbox.utils.SpanUtils
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_increasespeed2.*
import kotlinx.android.synthetic.main.activity_increasespeed2.container
import kotlinx.android.synthetic.main.activity_increasespeed2.fl_ad
import kotlinx.android.synthetic.main.activity_increasespeed2.tv_title_1
import kotlinx.android.synthetic.main.header_layout.*
import java.util.*
import kotlin.random.Random
/**
......@@ -52,22 +59,65 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
private var mIncreaseAdapter: IncreaseAdapter? = null
private var insertScreenAdManager: InsertScreenAdManager? = null
private var mWifiAdManager: WifiAdManager? = null
private var mIncreaseType = INCREASE2_WIFI_BOOST
private var mTimer: Timer? = null
override fun getContentViewLayoutID() = R.layout.activity_increasespeed2
override fun initViewsAndEvents() {
insertScreenAdManager = InsertScreenAdManager()
insertScreenAdManager?.loadInterstitial(this)
mWifiAdManager = WifiAdManager()
mWifiAdManager?.loadWifiAd(this)
mWifiAdManager?.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {
}
override fun adFail() {
}
override fun adClose() {
finish()
}
})
initView()
startTimer()
}
private fun startTimer() {
var step = 0
if (mIncreaseType == INCREASE2_WIFI_BOOST) {
containerAnim.setBackgroundColor(ContextCompat.getColor(this, R.color.color_main))
GlideUtils.loadImageViewGif(this, R.drawable.wifi_speed, iv_gif)
} else {
containerAnim.setBackgroundColor(Color.parseColor("#8278DC"))
GlideUtils.loadImageViewGif(this, R.drawable.safe_check, iv_gif)
}
mTimer = Timer()
mTimer?.schedule(object : TimerTask() {
override fun run() {
runOnUiThread {
step++
if (step == 10) {
YoYo.with(Techniques.FadeOut).duration(600).playOn(containerAnim)
Handler(Looper.getMainLooper()).postDelayed({
// 动画结束后 展示插屏广告
insertScreenAdManager?.showInterstitial()
mWifiAdManager?.showInterstitial()
}, 3000)
container.visibility = View.VISIBLE
} else if (step == 12) {
containerAnim.visibility = View.GONE
mTimer?.cancel()
}
}
}
}, 100, 300)
}
private fun initView() {
......@@ -137,6 +187,12 @@ class Increasespeed2Activity : BaseActivity(), View.OnClickListener {
}
override fun onDestroy() {
mTimer?.cancel()
mTimer = null
mWifiAdManager?.onDestroy()
mWifiAdManager = null
fl_ad?.removeAllViews()
// 预加载信息流
ExpressManager.loadExpress()
......
package com.mints.flowbox.ui.activitys
import android.graphics.Color
import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.text.Spannable
import android.view.View
import android.view.WindowManager
import androidx.core.content.ContextCompat
import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.inscreen.InsertScreenAdManager
import com.mints.flowbox.ad.wifi.WifiAdManager
import com.mints.flowbox.ad.wifi.WifiAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.utils.SpanUtils
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_increasespeed.*
import kotlinx.android.synthetic.main.activity_increasespeed.container
import kotlinx.android.synthetic.main.activity_increasespeed.containerAnim
import kotlinx.android.synthetic.main.activity_increasespeed.fl_ad
import kotlinx.android.synthetic.main.activity_increasespeed.iv_gif
import kotlinx.android.synthetic.main.activity_increasespeed.tv_title_1
import kotlinx.android.synthetic.main.header_layout.*
import java.util.*
import kotlin.random.Random
/**
......@@ -26,35 +37,101 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
const val INCREASE_TYPE = "INCREASE_TYPE" // TYPE
const val INCREASE_WIFI_SPEED = "INCREASE_WIFI_SPEED" // 网速多少
const val INCREASE_SPEED_TEST = "SPEED_TEST" // 网络测速
const val INCREASE_JIASU = "JIASU" // 一键加速
const val INCREASE_BOOST = "BOOST" // 一键加速
const val INCREASE_CLEAN = "CLEAN" // 一键清理
const val INCREASE_SAVE_ELECTRICITY = "SAVE_ELECTRICITY" // 超强省电
}
private var mIncreaseType = INCREASE_JIASU
private var mWifiAdManager: WifiAdManager? = null
private var mIncreaseType = INCREASE_BOOST
private var mSpeed = "10Mbps"
private var insertScreenAdManager: InsertScreenAdManager? = null
private var mTimer: Timer? = null
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
mIncreaseType = it.getString(INCREASE_TYPE, INCREASE_JIASU)
mIncreaseType = it.getString(INCREASE_TYPE, INCREASE_BOOST)
mSpeed = it.getString(INCREASE_WIFI_SPEED, "10Mbps")
}
}
override fun onCreate(savedInstanceState: Bundle?) {
window.addFlags(
WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
or WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
or WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
or WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
)
super.onCreate(savedInstanceState)
}
override fun getContentViewLayoutID() = R.layout.activity_increasespeed
override fun initViewsAndEvents() {
insertScreenAdManager = InsertScreenAdManager()
insertScreenAdManager?.loadInterstitial(this)
mWifiAdManager = WifiAdManager()
mWifiAdManager?.loadWifiAd(this)
mWifiAdManager?.setWifiAdStatusListener(object : WifiAdStatusListener {
override fun adSuccess() {
}
override fun adFail() {
}
override fun adClose() {
finish()
}
})
if (mIncreaseType == INCREASE_BOOST && AppConfig.isCanBoost) {
startTimer()
} else if (mIncreaseType == INCREASE_SAVE_ELECTRICITY && AppConfig.isCanSaveBattery) {
startTimer()
} else {
Handler(Looper.getMainLooper()).postDelayed({
// 动画结束后 展示插屏广告
mWifiAdManager?.showInterstitial()
}, 3000)
}
initView()
}
private fun startTimer() {
container.visibility = View.GONE
containerAnim.visibility = View.VISIBLE
var step = 0
if (mIncreaseType == INCREASE_SAVE_ELECTRICITY) {
containerAnim.setBackgroundColor(ContextCompat.getColor(this, R.color.color_main))
GlideUtils.loadImageViewGif(this, R.drawable.battery, iv_gif)
} else {
containerAnim.setBackgroundColor(Color.parseColor("#906cf4"))
GlideUtils.loadImageViewGif(this, R.drawable.rocket_anim, iv_gif)
}
mTimer = Timer()
mTimer?.schedule(object : TimerTask() {
override fun run() {
runOnUiThread {
step++
if (step == 10) {
YoYo.with(Techniques.FadeOut).duration(600).playOn(containerAnim)
Handler(Looper.getMainLooper()).postDelayed({
// 动画结束后 展示插屏广告
insertScreenAdManager?.showInterstitial()
mWifiAdManager?.showInterstitial()
}, 3000)
container.visibility = View.VISIBLE
} else if (step == 12) {
containerAnim.visibility = View.GONE
mTimer?.cancel()
}
}
}
}, 100, 300)
}
private fun initView() {
......@@ -71,7 +148,7 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
.create()
infoStr = "网速像飞一样快~"
}
INCREASE_JIASU -> {
INCREASE_BOOST -> {
AppConfig.isCanBoost = false
if (AppConfig.fakeBoostCount == 0) {
AppConfig.fakeBoostCount = 10 + Random.nextInt(15)
......@@ -84,9 +161,19 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
.create()
infoStr = "成功清理完成"
}
INCREASE_CLEAN -> {
AppConfig.isCanClean = false
headTitleStr = "一键清理"
titleStr = SpanUtils()
.append("已经清理后台软件")
.append("${AppConfig.fakeCleanCount}个")
.setForegroundColor(ContextCompat.getColor(this, R.color.color_FFDD0C))
.create()
infoStr = "成功清理完成"
}
INCREASE_SAVE_ELECTRICITY -> {
AppConfig.isCanSaveBattery = false
if (AppConfig.fakeBoostCount != 0) {
if (AppConfig.fakeBoostCount == 0) {
AppConfig.fakeSaveBatteryCount = 20 + Random.nextInt(40)
}
headTitleStr = "超强省电"
......@@ -132,9 +219,15 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
}
override fun onDestroy() {
mTimer?.cancel()
mTimer = null
mWifiAdManager?.onDestroy()
mWifiAdManager = null
fl_ad?.removeAllViews()
// 预加载信息流
ExpressManager.loadExpress()
fl_ad?.removeAllViews()
super.onDestroy()
}
......
......@@ -78,7 +78,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
tab_rl_four.setOnClickListener(this)
tab_rl_five.setOnClickListener(this)
GlideUtils.loadImageViewGif(this, R.drawable.rockert, tab_iv_three)
GlideUtils.loadImageViewGif(this, R.drawable.rocket_main, tab_iv_three)
if (!TextUtils.isEmpty(UserManager.getInstance().userID)) {
mainPresenter.getNetWorkIp()
......
......@@ -2,20 +2,30 @@ package com.mints.flowbox.ui.activitys
import android.app.KeyguardManager
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.*
import android.view.View
import android.view.WindowManager
import com.mints.flowbox.R
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.Constant
import com.mints.flowbox.utils.TimeThread
import com.mints.flowbox.utils.ToolUtil
import com.mints.library.base.BaseSwipeBackCompatActivity
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.nodoubleclick.AntiShake
import kotlinx.android.synthetic.main.activity_screen.*
class ScreenActivity : BaseSwipeBackCompatActivity(), View.OnClickListener {
class ScreenActivity : BaseActivity() {
var mKeyguard: KeyguardManager? = null
var mKeylock: KeyguardManager.KeyguardLock? = null
override fun initViewsAndEvents() {
override fun onCreate(savedInstanceState: Bundle?) {
// 设置可以显示在锁屏页面之上
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
setShowWhenLocked(true)
setTurnScreenOn(true)
// 强制亮屏
// setTurnScreenOn(true)
val keyguardManager = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
keyguardManager.requestDismissKeyguard(this, null)
} else {
......@@ -25,9 +35,104 @@ class ScreenActivity : BaseActivity() {
WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
)
}
super.onCreate(savedInstanceState)
}
override fun initViewsAndEvents() {
Handler(Looper.getMainLooper()).postDelayed({
mHelper.swipeBackLayout.setEdgeSize(ToolUtil.getScreenWidth(this))
mHelper.swipeBackLayout.setTopEdgeSize(
ToolUtil.getScreenHeight(this) - ToolUtil.dp2px(
this,
80
)
)
}, 500)
val thread = TimeThread(tvDate, tvTime)
thread.start()
tvBoost.setOnClickListener(this)
tvClean.setOnClickListener(this)
tvSaveBattery.setOnClickListener(this)
}
override fun onResume() {
super.onResume()
initExpress()
}
override fun onClick(v: View?) {
if (AntiShake.check(v?.id)) return
// 预加载信息流
ExpressManager.loadExpress()
when (v?.id) {
R.id.tvBoost -> {
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
}
R.id.tvClean -> {
// 一键清理
val bundle = Bundle()
bundle.putInt(Constant.SCAN_TYPE, 1)
readyGo(CleanActivity::class.java, bundle)
}
R.id.tvSaveBattery -> {
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_SAVE_ELECTRICITY
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
else -> {
}
}
}
/**
* 初始化信息iyc
*/
private fun initExpress() {
try {
if (fl_ad != null) {
// fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onDestroy() {
// 预加载信息流
ExpressManager.loadExpress()
super.onDestroy()
}
override fun onNetworkConnected(type: NetUtils.NetType?) {}
override fun onNetworkDisConnected() {}
override fun isApplyStatusBarTranslucency() = false
override fun toggleOverridePendingTransition() = false
override fun getOverridePendingTransitionMode() = TransitionMode.FADE
override fun toggleIsBack2Left() = false
override fun getBundleExtras(extras: Bundle?) {}
override fun getContentViewLayoutID() = R.layout.activity_screen
override fun isApplyKitKatTranslucency() = false
override fun getLoadingTargetView() = null
}
\ No newline at end of file
......@@ -6,9 +6,12 @@ import android.view.View
import androidx.core.content.ContextCompat
import com.bumptech.glide.load.resource.gif.GifDrawable
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.inscreen.InsertScreenAdManager
import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.library.utils.GlideUtils
import kotlinx.android.synthetic.main.activity_speed_fast.*
import kotlinx.android.synthetic.main.activity_speed_fast.fl_ad
import kotlinx.android.synthetic.main.header_layout.*
import java.util.*
......@@ -25,12 +28,17 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
private var mTimer: Timer? = null
private var mStep = 0
private var insertScreenAdManager: InsertScreenAdManager? = null
override fun getContentViewLayoutID() = R.layout.activity_speed_fast
override fun isApplyKitKatTranslucency() = false
override fun initViewsAndEvents() {
initView()
insertScreenAdManager = InsertScreenAdManager()
insertScreenAdManager?.loadInterstitial(this)
}
fun startTimer() {
......@@ -62,6 +70,9 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
btn.visibility = View.VISIBLE
tv_progress.visibility = View.INVISIBLE
// 动画结束后 展示插屏广告
insertScreenAdManager?.showInterstitial()
if (iv_gif.drawable is GifDrawable) {
val drawable = iv_gif.drawable as GifDrawable
if (drawable.isRunning) {
......@@ -114,4 +125,34 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
}
}
}
override fun onResume() {
super.onResume()
initExpress()
}
/**
* 初始化信息iyc
*/
private fun initExpress() {
try {
if (fl_ad != null) {
fl_ad.removeAllViews()
fl_ad.addView(ExpressManager.getExpressFrameLayout())
}
} catch (e: Exception) {
e.printStackTrace()
}
}
override fun onDestroy() {
insertScreenAdManager?.onDestroy()
insertScreenAdManager = null
fl_ad?.removeAllViews()
// 预加载信息流
ExpressManager.loadExpress()
super.onDestroy()
}
}
......@@ -12,7 +12,6 @@ import android.view.animation.LinearInterpolator
import androidx.core.content.ContextCompat
import com.hjq.toast.ToastUtils
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.manager.DownloadApkManager
import com.mints.flowbox.manager.wifi.NetSpeed
import com.mints.flowbox.ui.activitys.base.BaseActivity
......@@ -210,9 +209,6 @@ class SpeedTestActivity : BaseActivity(), View.OnClickListener {
// tvRxSpeed.text = NetSpeed.getShowStr(averageRx)
// tvTxSpeed.text = NetSpeed.getShowStr(averageTx)
// 预加载信息流
ExpressManager.loadExpress()
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
......
......@@ -3,6 +3,7 @@ package com.mints.flowbox.ui.activitys
import android.os.Bundle
import android.view.View
import android.widget.SeekBar
import android.widget.Toast
import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.LinearLayoutManager
import com.mints.flowbox.MintsApplication
......@@ -48,7 +49,8 @@ import kotlinx.android.synthetic.main.header_layout.*
* 作者:孟崔广
* 时间:2020/9/23 18:39
*/
class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.OnItemClickListener, OnRefreshListener, OnLoadMoreListener, XmlyPlayView {
class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.OnItemClickListener,
OnRefreshListener, OnLoadMoreListener, XmlyPlayView {
private val xmlyPlayPresenter by lazy { XmlyPlayPresenter() }
......@@ -115,7 +117,7 @@ class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.O
mPlayerManager.removeOnConnectedListerner(this)
mPlayerManager.playMode = XmPlayListControl.PlayMode.PLAY_MODEL_SINGLE_LOOP
// Toast.makeText(this@XmlyPlayActivity, "播放器初始化成功", Toast.LENGTH_SHORT).show()
Toast.makeText(this@XmlyPlayActivity, "播放器初始化成功", Toast.LENGTH_SHORT).show()
loadUnlockMsg()
loadData()
......@@ -131,7 +133,11 @@ class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.O
}
private fun loadUnlockMsg() {
xmlyPlayPresenter.getXmlyUnlockMsg(userManager.userID, mCategoryId.toString(), mAlbumId.toString())
xmlyPlayPresenter.getXmlyUnlockMsg(
userManager.userID,
mCategoryId.toString(),
mAlbumId.toString()
)
}
private fun loadData() {
......@@ -150,10 +156,16 @@ class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.O
runOnUiThread {
if (xmlyPage == 1) {
message.text = p0.tracks[0].trackTitle
time.text = "[00.00/" + ToolUtil.formatTime(p0.tracks[0].duration.toLong()).toString() + "]"
time.text =
"[00.00/" + ToolUtil.formatTime(p0.tracks[0].duration.toLong())
.toString() + "]"
tv_title.text = p0.albumTitle
GlideUtils.loadImageView(this@XmlyPlayActivity, p0.coverUrlMiddle, sound_cover)
GlideUtils.loadImageView(
this@XmlyPlayActivity,
p0.coverUrlMiddle,
sound_cover
)
}
control_bar.visibility = View.VISIBLE
getDataSuc(p0.tracks)
......@@ -285,7 +297,10 @@ class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.O
}
}
message.text = title
time.text = "[" + ToolUtil.formatTime(currPos.toLong()).toString() + "/" + ToolUtil.formatTime(duration.toLong()).toString() + "]"
time.text =
"[" + ToolUtil.formatTime(currPos.toLong()).toString() + "/" + ToolUtil.formatTime(
duration.toLong()
).toString() + "]"
if (mUpdateProgress && duration != 0) {
seek_bar.progress = (100 * currPos / duration.toFloat()).toInt()
}
......@@ -384,16 +399,6 @@ class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.O
}
showToast("第" + (mCurrentPosition + 2) + "条尚未解锁,点击即可解锁")
// 广告解锁
// if (AppConfig.xmlyAdFlag) {
// readyGo(XmlyAwardActivity::class.java)
// xmlyPlayPresenter.pushXmlyUnlockMsg(userManager.userID, mCategoryId.toString(), mAlbumId.toString(), (mCurrentPosition + 2).toString())
// mUnlockList.add((mCurrentPosition + 2).toString())
// xmlyPlayAdapter.notifyItemChanged(mCurrentPosition + 1)
// } else {
// showToast("解锁失败,请重试")
// }
}
R.id.pre_sound -> {
// 上一首
......@@ -405,16 +410,6 @@ class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.O
}
showToast("第" + mCurrentPosition + "条尚未解锁,点击即可解锁")
// 广告解锁
// if (AppConfig.xmlyAdFlag) {
// readyGo(XmlyAwardActivity::class.java)
// xmlyPlayPresenter.pushXmlyUnlockMsg(userManager.userID, mCategoryId.toString(), mAlbumId.toString(), (mCurrentPosition).toString())
// mUnlockList.add((mCurrentPosition).toString())
// xmlyPlayAdapter.notifyItemChanged(mCurrentPosition)
// } else {
// showToast("解锁失败,请重试")
// }
}
}
}
......@@ -474,7 +469,12 @@ class XmlyPlayActivity : BaseActivity(), View.OnClickListener, XmlyPlayAdapter.O
// 广告解锁
if (AppConfig.xmlyAdFlag) {
readyGo(XmlyAwardActivity::class.java)
xmlyPlayPresenter.pushXmlyUnlockMsg(userManager.userID, mCategoryId.toString(), mAlbumId.toString(), (position + 1).toString())
xmlyPlayPresenter.pushXmlyUnlockMsg(
userManager.userID,
mCategoryId.toString(),
mAlbumId.toString(),
(position + 1).toString()
)
mUnlockList.add((position + 1).toString())
xmlyPlayAdapter.notifyItemChanged(position)
} else {
......
......@@ -59,7 +59,7 @@ class MainWifiAdapter(val context: Context, val taskData: MutableList<WifiListBe
if (holder is EmptyHolder) {
holder.itemView.findViewById<Button>(R.id.btn)
.setOnClickListener {
context.startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
mOnItemClickListener?.onItemClick(it, position)
}
return
}
......
......@@ -19,6 +19,7 @@ import com.mints.flowbox.mvp.views.BonusView
import com.mints.flowbox.ui.activitys.AwardActivity
import com.mints.flowbox.ui.activitys.MainActivity
import com.mints.flowbox.ui.activitys.WrapperActivity
import com.mints.flowbox.ui.activitys.WxLoginActivity
import com.mints.flowbox.ui.adapter.BonusTaskAdapter
import com.mints.flowbox.ui.adapter.GvSignAdapter
import com.mints.flowbox.ui.adapter.listener.OnItemChildClickListener
......@@ -150,9 +151,36 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
readyGo(WrapperActivity::class.java, bundle)
}
BonusTaskAdapter.CHALLENGE_SHAREFRIEND -> {
// 分享
if (dataList[position].otherConfig != null) {
when (dataList[position].otherConfig.status) {
0, 2 -> {
// 邀请好友
if (!UserManager.getInstance().userIsLogin()) {
readyGo(WxLoginActivity::class.java)
return
}
shareImgDialog()
}
1 -> {
val bundle = Bundle()
bundle.putInt(
Constant.MAIN_CUR_COIN,
dataList[position].otherConfig.coin
)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CHALLENGE_SHAREFRIEND
)
bundle.putString(
Constant.MAIN_EXTRA_ID,
dataList[position].otherConfig.doubleCoin.toString()
)
readyGo(AwardActivity::class.java, bundle)
}
}
}
}
}
}
}
......@@ -202,14 +230,18 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
bonusTaskAdapter?.notifyDataSetChanged()
}
/**
* 图片分享
*/
/** 图片分享 */
private fun shareImgDialog() {
val shareDialog = ShareDialog(requireActivity())
shareDialog.setOnShareOKListener(object : ShareDialog.OnShareOKListener {
override fun onShareOk() {
bonusPresenter.cmtShareStatus()
}
})
val userManager = UserManager.getInstance()
val title: String
if (UserManager.getInstance().wxName.isEmpty()) {
var mobile = UserManager.getInstance().mobile
if (userManager.wxName.isEmpty()) {
var mobile = userManager.mobile
if (mobile.isNotEmpty()) {
mobile = mobile.substring(0, 3) + "****" + mobile.substring(
mobile.length - 4,
......@@ -218,15 +250,13 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
}
title = "Hi,我是$mobile"
} else {
title = "Hi,我是" + UserManager.getInstance().wxName
title = "Hi,我是" + userManager.wxName
}
val content = "送你一个赚钱的新模式,\r\n快点加入跟我一起赚钱吧"
shareDialog.run {
setShareAvatar(UserManager.getInstance().wxHeader)
setShareTitle(title)
setShareContent(content)
show()
}
shareDialog.setShareAvatar(userManager.wxHeader)
shareDialog.setShareTitle(title)
shareDialog.setShareContent(content)
shareDialog.show()
}
override fun signSuc() {
......@@ -316,7 +346,6 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
private fun videoAdingSuccess() {
if (!requireActivity().isFinishing) {
val bundle = Bundle()
// bundle.putInt(Constant.MAIN_CUR_COIN, autoListBean.otherConfig.coin)
bundle.putString(Constant.MAIN_CARRIER_TYPE, Constant.CARRIER_VERSUS_VIDEO)
readyGo(AwardActivity::class.java, bundle)
}
......
......@@ -209,6 +209,9 @@ class HomeFragment : BaseFragment(), WifiStateManager.WifiStateCallback,
}
// wifi提速
R.id.btn_speed_fast -> {
// 预加载信息流
ExpressManager.loadExpress()
readyGo(SpeedFastActivity::class.java)
}
// 跳转福利页面
......
......@@ -5,6 +5,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentTransaction
import com.androidkun.xtablayout.XTabLayout
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.R
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
......@@ -38,9 +39,9 @@ class MoneyFragment : BaseFragment(), XTabLayout.OnTabSelectedListener {
override fun initViewsAndEvents() {
if (!AppConfig.isXmlyInit) {
XmManager.init(baseApplication)
XmManager.init(MintsApplication.getContext())
// 一览视频
YlVideoManager.init(baseApplication);
YlVideoManager.init(MintsApplication.getContext())
}
initView()
......
......@@ -145,7 +145,8 @@ class TaskCpdFragment : BaseFragment(), TaskView,
needUseTime = data.needSeconds
shCoin = data.coinSh
sydCoin = data.coinSyd
shMax = data.CPD
// shMax = data.CPD
shMax = 1
cpdMax = data.CPD_SYD
if ((shMax + cpdMax) <= 0) {
......
......@@ -141,6 +141,10 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
override fun adFail() {
}
override fun adClose() {
}
})
switchButton?.isOpened =
......
......@@ -19,9 +19,11 @@ import com.daimajia.androidanimations.library.Techniques
import com.daimajia.androidanimations.library.YoYo
import com.hjq.toast.ToastUtils
import com.mints.flowbox.R
import com.mints.flowbox.ad.banner.BannerManager
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.TtCsjAdManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.manager.wifi.WifiStateManager
import com.mints.flowbox.mvp.model.WifiListBean
......@@ -40,8 +42,8 @@ import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.nodoubleclick.AntiShake
import com.tbruyelle.rxpermissions.RxPermissions
import kotlinx.android.synthetic.main.fragment_wifi.*
import kotlin.random.Random
import rx.Observable
import kotlin.random.Random
private val TAG = WifiFragment::class.java.simpleName
......@@ -79,6 +81,10 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
if (AppConfig.fragmentClickFlag == Constant.FRAGMENT_CLICK_THREE) {
loadWifiData()
// 防止banner刷新太快
if (AntiShake.check(fl_wifi_banner?.id)) return
BannerManager.instance.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_wifi_banner)
if (!TextUtils.isEmpty(UserManager.getInstance().userID)) {
(requireActivity() as MainActivity).refreshHall()
}
......@@ -326,7 +332,7 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_JIASU
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
}
......@@ -337,19 +343,21 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
bundle.putInt(Constant.SCAN_TYPE, 1)
readyGo(CleanActivity::class.java, bundle)
} else {
// 一键清理
// val bundle = Bundle()
// bundle.putInt(Constant.SCAN_TYPE, 1)
// readyGo(CleanActivity::class.java, bundle)
// 预加载信息流
ExpressManager.loadExpress()
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_CLEAN
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
}
R.id.tv_save_battery -> { // 超强省电
// 预加载信息流
ExpressManager.loadExpress()
if (AppConfig.isCanSaveBattery) {
readyGo(BoostFastActivity::class.java)
} else {
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
......@@ -357,11 +365,35 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
)
readyGo(IncreasespeedActivity::class.java, bundle)
}
}
R.id.btn_signal -> { // 信号增强
checkPermisssion()
if (!wifiUtils.isWifiConnected(mContext) || !wifiUtils.isWifiEnable) {
wifiUtils.openWifi()
startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
}
// 预加载信息流
ExpressManager.loadExpress()
val bundle = Bundle()
bundle.putString(
Increasespeed2Activity.INCREASE2_TYPE,
Increasespeed2Activity.INCREASE2_WIFI_BOOST
)
readyGo(Increasespeed2Activity::class.java, bundle)
}
else -> {
}
}
}
private fun scrollToBottom() {
Handler(Looper.getMainLooper()).postDelayed({
container.scrollTo(0, container.height)
}, 100)
}
private fun checkPermisssion() {
if (ActivityCompat.checkSelfPermission(
requireContext(),
Manifest.permission.ACCESS_COARSE_LOCATION
......@@ -391,39 +423,17 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
return
}
if (!wifiUtils.isWifiConnected(mContext) || !wifiUtils.isWifiEnable) {
wifiUtils.openWifi()
startActivity(Intent(Settings.ACTION_WIFI_SETTINGS))
}
// 预加载信息流
ExpressManager.loadExpress()
val bundle = Bundle()
bundle.putString(
Increasespeed2Activity.INCREASE2_TYPE,
Increasespeed2Activity.INCREASE2_WIFI_BOOST
)
readyGo(Increasespeed2Activity::class.java, bundle)
}
else -> {
}
}
}
override fun onItemClick(view: View?, position: Int) {
if (!wifiUtils.isWifiConnected(mContext)) return
private fun scrollToBottom() {
Handler(Looper.getMainLooper()).postDelayed({
container.scrollTo(0, container.height)
}, 100)
if (view?.id == R.id.btn) {
checkPermisssion()
return
}
override fun onItemClick(view: View?, position: Int) {
val wifiListBean = mWifiList[position]
if (!TextUtils.equals(
wifiListBean.wifiName,
wifiUtils.connectionWifiInfo.ssid.replace("\"", "")
)
) {
if (wifiDialog == null) wifiDialog =
WifiConnectDialog(mContext, object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
......@@ -446,7 +456,6 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
it.show()
}
}
}
override fun onWifiOpen() {
loadWifiData()
......@@ -455,4 +464,9 @@ class WifiFragment : BaseFragment(), View.OnClickListener, OnItemClickListener,
override fun onWifiClose() {
loadWifiData()
}
override fun onDestroy() {
fl_wifi_banner?.removeAllViews()
super.onDestroy()
}
}
\ No newline at end of file
......@@ -35,8 +35,7 @@ class XmlyPageFragment(private val categoryId: Long) : LazyLoadBaseFragment(),
override fun getContentViewLayoutID() = R.layout.fragment_main_xmly_page
override fun initViewsAndEvents() {
}
override fun initViewsAndEvents() {}
private fun loadData() {
val vo = hashMapOf<String, String>()
......
......@@ -59,7 +59,7 @@ public class DrawHookView extends View {
//获取圆心的x坐标
int center = getWidth() / 2;
int center1 = center - getWidth() / 5;
int center1 = center - getWidth() / 4;
//圆弧半径
int radius = getWidth() / 2 - 5;
......@@ -69,7 +69,7 @@ public class DrawHookView extends View {
//根据进度画圆弧
canvas.drawArc(rectF, -180, -360 * progress / 100, false, paint);
/**
/*
* 绘制对勾
*/
//先等圆弧画完,才话对勾
......@@ -92,10 +92,10 @@ public class DrawHookView extends View {
line2_y--;
}
//画第二根线
canvas.drawLine(center1 + line1_x - 1, center + line1_y, center1 + line2_x, center + line2_y, paint);
canvas.drawLine(center1 + line1_x - 2, center + line1_y, center1 + line2_x, center + line2_y, paint);
}
//每隔10毫秒界面刷新
postInvalidateDelayed(10);
postInvalidateDelayed(5);
}
}
......@@ -24,6 +24,7 @@ import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.ui.adapter.SharePagerAdapter
import com.mints.flowbox.ui.widgets.seekbar.BubbleUtils
import com.mints.flowbox.utils.QRCodeUtil
import com.mints.flowbox.utils.ToolUtil
import com.mints.library.utils.GlideUtils
import java.util.*
import kotlin.collections.ArrayList
......@@ -74,8 +75,8 @@ class ShareDialog(context: Context) : Dialog(context, R.style.dialog) {
viewPager.pageMargin = BubbleUtils.dp2px(30)
val SHARE_URL: String =
BuildConfig.MainIp + "wxShare/toShare?shareId=" + UserManager.getInstance().getUserID()
val QRCode = QRCodeUtil.createQRCode(SHARE_URL, 46)
BuildConfig.MainIp + "wxShare/toShare?shareId=" + UserManager.getInstance().userID
val QRCode = QRCodeUtil.createQRCode(SHARE_URL, ToolUtil.dp2px(context, 50))
val inflater = LayoutInflater.from(context)
val view1 = inflater.inflate(R.layout.item_share_view, null)
// val view2 = inflater.inflate(R.layout.item_share_view, null)
......
......@@ -179,6 +179,35 @@ object AppUtil {
return false
}
/**
* 根据apk存储路径获取apk信息
*/
fun getApkInfo2(
context: Context, pkgName: String
): CacheListItem {
var apkIcon: Drawable = context.getDrawable(R.mipmap.ic_launcher)!!
var apkLabel = ""
var info: PackageInfo? = null
val pm: PackageManager = MintsApplication.getContext().packageManager
try {
info = pm.getPackageInfo(pkgName, PackageManager.GET_ACTIVITIES)
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
if (info != null) {
val appInfo = info.applicationInfo
try {
apkIcon = appInfo.loadIcon(pm)
apkLabel = appInfo.loadLabel(pm).toString()
} catch (e: OutOfMemoryError) {
LogUtil.e(e)
}
}
return CacheListItem(pkgName, apkLabel, apkIcon, 0)
}
/**
* 根据apk存储路径获取apk信息
*/
......
......@@ -19,12 +19,12 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
private long leaveTime = 0;//应用切后台时间
private static ForegroundOrBackground instance;
public int count = 0;
public static int count = 0;
private volatile boolean isYlhSplash = false;
private Intent ylhIntent;
private Intent groIntent;
private static boolean isForeground=false;
private static boolean isForeground = false;
//获取当前最上层的activity
private static WeakReference<Activity> app_activity;
......@@ -41,6 +41,15 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
return isForeground;
}
/**
* 是否在前台
*
* @return true-前台
*/
public static boolean isForeground2() {
return count != 0;
}
public static ForegroundOrBackground init(Application application) {
if (instance == null) {
instance = new ForegroundOrBackground();
......@@ -57,6 +66,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
public void onActivityResumed(Activity activity) {
if (activity == null)
return;
String simpleName = activity.getClass().getSimpleName();
if (TextUtils.equals(simpleName, "MainActivity")) {
......@@ -94,14 +104,14 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
return;
// 每次返回应用时 都展示开屏广告
String simpleName = activity.getClass().getSimpleName();
if (TextUtils.equals(simpleName, "SplashGroMoreActivity") ||
TextUtils.equals(simpleName, "GuideActivity") ||
TextUtils.equals(simpleName, "AwardActivity") ||
TextUtils.equals(simpleName, "DrawcashActivity")) {
count++;
return;
}
// String simpleName = activity.getClass().getSimpleName();
// if (TextUtils.equals(simpleName, "SplashGroMoreActivity") ||
// TextUtils.equals(simpleName, "GuideActivity") ||
// TextUtils.equals(simpleName, "AwardActivity") ||
// TextUtils.equals(simpleName, "DrawcashActivity")) {
// count++;
// return;
// }
if (count == 0) {
// LogUtil.d("ForegroundOrBackground", System.currentTimeMillis() - leaveTime + " onActivityStarted");
......@@ -112,8 +122,11 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
// }
// activity.startActivity(groIntent);
// }
isForeground=true;
isForeground = true;
} else {
isForeground = false;
}
count++;
}
......@@ -122,9 +135,11 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
count--;
if (count == 0) {
isForeground=false;
isForeground = true;
leaveTime = System.currentTimeMillis();
TrackManager.getInstance().offline();
} else {
isForeground = false;
}
}
......
......@@ -25,8 +25,8 @@ public class QRCodeUtil {
try {
Hashtable<EncodeHintType, Object> hints = new Hashtable<>();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
hints.put(EncodeHintType.MARGIN, 1);
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
hints.put(EncodeHintType.MARGIN, 0);
BitMatrix bitMatrix = new QRCodeWriter().encode(text,
BarcodeFormat.QR_CODE, size, size, hints);
......@@ -40,12 +40,11 @@ public class QRCodeUtil {
}
}
}
Bitmap bitmap = Bitmap.createBitmap(size, size,
Bitmap.Config.RGB_565);
Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.RGB_565);
bitmap.setPixels(pixels, 0, size, 0, 0, size, size);
// Bitmap zoomBitmap = zoomBitmap(bitmap, size, size);
// bitmap.recycle();
return bitmap;
Bitmap zoomBitmap = zoomBitmap(bitmap, size, size);
bitmap.recycle();
return zoomBitmap;
} catch (WriterException e) {
e.printStackTrace();
return null;
......
......@@ -12,6 +12,7 @@ import android.graphics.Shader;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import androidx.annotation.ColorInt;
import androidx.annotation.DrawableRes;
import androidx.annotation.FloatRange;
......@@ -19,6 +20,7 @@ import androidx.annotation.IntDef;
import androidx.annotation.IntRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.text.Layout;
import android.text.Layout.Alignment;
import android.text.SpannableStringBuilder;
......
......@@ -13,6 +13,7 @@ import java.util.Date;
import java.util.GregorianCalendar;
public class TimeRender {
/**
* 默认日期格式
*/
......@@ -20,8 +21,8 @@ public class TimeRender {
public static String DEFAULT_FORMAT_DAY = "dd";
public static String DEFAULT_FORMAT_MONTH_DAY = "MM月dd日";
public static String DEFAULT_FORMAT_LINE= "yyyy/MM/dd";
public static String DEFAULT_FORMAT_TIME= "HH:mm:ss";
public static String DEFAULT_FORMAT_LINE = "yyyy/MM/dd";
public static String DEFAULT_FORMAT_TIME = "HH:mm:ss";
/**
* 年月日时分秒加横杠
......@@ -278,11 +279,41 @@ public class TimeRender {
}
/**
* <<<<<<< Updated upstream
* 根据时间戳 计算分钟间隔
*
* @return
*/
public static long getMinForTimestamp(long lastTime,long curTime){
return (curTime-lastTime) / (1000*60);
public static long getMinForTimestamp(long lastTime, long curTime) {
return (curTime - lastTime) / (1000 * 60);
}
/**
* 获取今天星期几
*
* @return week
*/
public static String getWeek() {
Calendar cal = Calendar.getInstance();
int i = cal.get(Calendar.DAY_OF_WEEK);
switch (i) {
case 1:
return "周日";
case 2:
return "周一";
case 3:
return "周二";
case 4:
return "周三";
case 5:
return "周四";
case 6:
return "周五";
case 7:
return "周六";
default:
return "";
}
}
}
package com.mints.flowbox.utils;
import android.os.Handler;
import android.os.Message;
import android.widget.TextView;
import java.util.Date;
public class TimeThread extends Thread {
public TextView tvDate;
public TextView tvTime;
private static int WhatTime = 0x00002323;
public TimeThread(TextView tvDate, TextView tvTime) {
this.tvDate = tvDate;
this.tvTime = tvTime;
}
@Override
public void run() {
for (; ; ) {
try {
Thread.sleep(1000);
Message msg = new Message();
msg.what = WhatTime;
mHandler.sendMessage(msg);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private Handler mHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch (msg.what) {
case 0x00002323:
Date date = new Date();
String monthDay = TimeRender.formatDate(date, TimeRender.DEFAULT_FORMAT_MONTH_DAY);
String time = TimeRender.formatDate(date, TimeRender.DEFAULT_FORMAT_TIME);
tvDate.setText(TimeRender.getWeek() + " " + monthDay);
tvTime.setText(time);
break;
default:
break;
}
}
};
}
\ No newline at end of file
......@@ -15,7 +15,7 @@ import com.mints.library.swipeback.Utils;
* 邮箱:mengcga@163.com
*/
public abstract class BaseSwipeBackCompatActivity extends BaseAppCompatActivity implements SwipeBackActivityBase {
private SwipeBackActivityHelper mHelper;
protected SwipeBackActivityHelper mHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
......
......@@ -21,7 +21,9 @@ import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Rect;
import androidx.core.view.ViewCompat;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
......@@ -225,6 +227,18 @@ public class SwipeBackLayout extends FrameLayout {
mDragHelper.setEdgeSize(size);
}
/**
* top edge
* Set the size of an edge. This is the range in pixels along the edges of
* this view that will actively detect edge touches or drags if edge
* tracking is enabled.
*
* @param size The size of an edge in pixels
*/
public void setTopEdgeSize(int size) {
mDragHelper.setTopEdgeSize(size);
}
/**
* Register a callback to be invoked when a swipe event is sent to this
* view.
......
......@@ -17,10 +17,12 @@
package com.mints.library.swipeback;
import android.content.Context;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.VelocityTrackerCompat;
import androidx.core.view.ViewCompat;
import androidx.core.widget.ScrollerCompat;
import android.view.MotionEvent;
import android.view.VelocityTracker;
import android.view.View;
......@@ -140,6 +142,8 @@ public class ViewDragHelper {
private int mEdgeSize;
private int mTopEdgeSize;
private int mTrackingEdges;
private ScrollerCompat mScroller;
......@@ -525,6 +529,18 @@ public class ViewDragHelper {
mEdgeSize = size;
}
/**
* top edge
* Set the size of an edge. This is the range in pixels along the edges of
* this view that will actively detect edge touches or drags if edge
* tracking is enabled.
*
* @param size The size of an edge in pixels
*/
public void setTopEdgeSize(int size) {
mTopEdgeSize = size;
}
/**
* Capture a specific child view for dragging within the parent. The
* callback will be notified but
......@@ -1540,6 +1556,7 @@ public class ViewDragHelper {
/**
* Find the topmost child under the given point within the parent view's
* coordinate system. The child order is determined using
*
* @param x X position to test in the parent's coordinate system
* @param y Y position to test in the parent's coordinate system
* @return The topmost child view under (x, y) or null if none found.
......@@ -1561,12 +1578,12 @@ public class ViewDragHelper {
if (x < mParentView.getLeft() + mEdgeSize)
result = EDGE_LEFT;
if (y < mParentView.getTop() + mEdgeSize)
if (y < mParentView.getTop() + mTopEdgeSize)
result = EDGE_TOP;
if (x > mParentView.getRight() - mEdgeSize)
result = EDGE_RIGHT;
if (y > mParentView.getBottom() - mEdgeSize)
result = EDGE_BOTTOM;
// if (x > mParentView.getRight())
// result = EDGE_RIGHT;
// if (y > mParentView.getBottom())
// result = EDGE_BOTTOM;
return result;
}
......
......@@ -2,7 +2,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="@color/color_main" />
<solid android:color="@color/color_4BB93F" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="30dip" />
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<!-- 填充的颜色 -->
<solid android:color="@color/color_28BA75" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="5dip" />
</shape>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#20000000" />
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 边 -->
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="@color/color_10000000" />
<corners android:radius="10dp" />
</shape>
\ No newline at end of file
</shape>
</item>
<item>
<shape android:shape="rectangle">
<padding
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp" />
<solid android:color="@color/color_20000000" />
<corners android:radius="10dp" />
</shape>
</item>
</layer-list>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color_20000000">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/shape_bg_write"
android:orientation="vertical"
android:visibility="visible">
<ImageView
android:id="@+id/iv_close"
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_alignParentEnd="true"
android:layout_gravity="end"
android:layout_margin="10dp"
android:src="@mipmap/ic_close"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center_horizontal"
android:layout_marginTop="-20dp"
android:text="安装包卸载"
android:textColor="@color/black"
android:textSize="18sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/ivIcon"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginEnd="5dp"
android:src="@mipmap/ic_launcher"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/tvInfo"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/tvInfo" />
<TextView
android:id="@+id/tvInfo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:gravity="center"
android:text="欢迎使用更多清理功能"
android:textColor="@color/black"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/ivIcon"
app:layout_constraintTop_toBottomOf="@+id/tvTitle" />
</androidx.appcompat.widget.LinearLayoutCompat>
<TextView
android:id="@+id/tvInfo2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginTop="15dp"
android:text="清理后不影响正常使用"
android:textColor="@color/color_AAA"
android:textSize="14sp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivIcon" />
<Button
android:id="@+id/btnClean"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_margin="15dp"
android:background="@drawable/shape_green_light"
android:text="立即清理"
android:textColor="@color/white"
android:textSize="14sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvInfo2" />
</androidx.appcompat.widget.LinearLayoutCompat>
</FrameLayout>
\ No newline at end of file
......@@ -6,14 +6,14 @@
<com.mints.flowbox.ui.widgets.CircleCleanAnimationView
android:id="@+id/ccav_speed"
android:layout_width="140dp"
android:layout_height="160dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" />
<LinearLayout
android:id="@+id/ll_ad"
android:layout_width="360dp"
android:layout_height="400dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@color/colorPrimaryDark"
android:orientation="vertical"
......@@ -45,6 +45,16 @@
android:text="欢迎使用更多清理功能"
android:textColor="@color/white"
android:textSize="20sp" />
<com.mints.flowbox.ui.widgets.RoundRectLayout
android:id="@+id/fl_ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:background="@drawable/shape_gold_card"
android:elevation="2dip"
android:gravity="center" />
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/white">
<View
android:layout_width="match_parent"
android:layout_height="280dp"
android:background="@drawable/shape_bg_speed" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/containerAnim"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone">
<ImageView
android:id="@+id/iv_gif"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/llMyRoot"
android:layout_width="match_parent"
......@@ -58,9 +83,14 @@
android:layout_marginStart="15dp"
android:layout_marginTop="140dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="10dp"
android:background="@drawable/shape_gold_card"
android:elevation="2dip" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</FrameLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/white">
<View
android:layout_width="match_parent"
......@@ -9,7 +10,30 @@
android:background="@drawable/shape_bg_speed" />
<LinearLayout
android:id="@+id/llMyRoot"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/containerAnim"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/iv_gif"
android:layout_width="320dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
</RelativeLayout>
<androidx.core.widget.NestedScrollView
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
......@@ -65,5 +89,9 @@
android:elevation="2dip" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</FrameLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<RelativeLayout 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_walk"
android:orientation="vertical">
android:background="@color/color_20000000">
</LinearLayout>
\ No newline at end of file
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="30dp"
android:text="-"
android:textColor="@color/white"
android:textSize="60sp" />
<TextView
android:id="@+id/tvDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tvTime"
android:layout_marginStart="30dp"
android:text="-"
android:textColor="@color/white"
android:textSize="20sp" />
<TextView
android:id="@+id/tvBoost"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tvDate"
android:layout_marginStart="40dp"
android:layout_marginTop="20dp"
android:drawablePadding="6dp"
android:gravity="center_horizontal"
android:text="一键加速"
android:textColor="@color/white"
android:textSize="16sp"
app:drawableTopCompat="@mipmap/ic_main_jiasu" />
<TextView
android:id="@+id/tvClean"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tvDate"
android:layout_marginStart="40dp"
android:layout_marginTop="20dp"
android:layout_toEndOf="@id/tvBoost"
android:drawablePadding="6dp"
android:gravity="center_horizontal"
android:text="一键清理"
android:textColor="@color/white"
android:textSize="16sp"
app:drawableTopCompat="@mipmap/ic_main_clean" />
<TextView
android:id="@+id/tvSaveBattery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tvDate"
android:layout_marginStart="40dp"
android:layout_marginTop="20dp"
android:layout_toEndOf="@id/tvClean"
android:drawablePadding="6dp"
android:gravity="center_horizontal"
android:text="超强省电"
android:textColor="@color/white"
android:textSize="16sp"
app:drawableTopCompat="@mipmap/ic_main_shengdian" />
<com.mints.flowbox.ui.widgets.RoundRectLayout
android:id="@+id/fl_ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tvBoost"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:background="@drawable/shape_gold_card"
android:elevation="2dip"
android:gravity="center" />
<TextView
android:id="@+id/tv"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"
android:background="@color/color_20000000"
android:gravity="center"
android:text="》右滑关闭"
android:textColor="@color/white"
android:textSize="20sp" />
</RelativeLayout>
\ No newline at end of file
......@@ -79,14 +79,14 @@
</FrameLayout>
<FrameLayout
<com.mints.flowbox.ui.widgets.RoundRectLayout
android:id="@+id/fl_ad"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:background="@drawable/shape_bg_award"
android:visibility="gone" />
android:layout_margin="15dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/shape_gold_card"
android:elevation="2dip" />
</LinearLayout>
......
......@@ -7,16 +7,16 @@
<com.androidkun.xtablayout.XTabLayout
android:id="@+id/xtFragmentXmly"
android:visibility="invisible"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:xTabIndicatorColor="#F28335"
android:visibility="invisible"
app:xTabIndicatorColor="@color/color_main"
app:xTabIndicatorHeight="4dp"
app:xTabIndicatorRoundX="30dp"
app:xTabIndicatorRoundY="30dp"
app:xTabIndicatorWidth="20dp"
app:xTabMode="scrollable"
app:xTabSelectedTextColor="@color/color_FF9837"
app:xTabSelectedTextColor="@color/color_main"
app:xTabSelectedTextSize="18sp"
app:xTabTextColor="#000"
app:xTabTextSize="14sp" />
......
......@@ -20,32 +20,32 @@
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_marginBottom="30dp"
android:orientation="vertical">
android:layout_marginTop="70dp"
android:layout_marginBottom="30dp">
<TextView
android:id="@+id/tv_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_marginStart="40dp"
android:text="@string/appName"
android:textColor="@color/white"
android:textSize="22sp" />
android:textSize="26sp" />
<TextView
android:id="@+id/tv_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="30dp"
android:layout_below="@id/tv_1"
android:layout_alignStart="@id/tv_1"
android:text="您身边的网络专家"
android:textColor="@color/white"
android:textSize="16sp" />
</LinearLayout>
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
......@@ -153,9 +153,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:drawablePadding="6dp"
android:gravity="center_horizontal"
android:text="一键加速"
android:textColor="@color/black"
android:gravity="center_horizontal"
android:textSize="16sp"
app:drawableTopCompat="@mipmap/ic_main_jiasu"
app:layout_constraintEnd_toStartOf="@+id/tv_clean"
......@@ -180,8 +180,8 @@
android:id="@+id/tv_save_battery"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:drawablePadding="6dp"
android:gravity="center_horizontal"
android:text="超强省电"
android:textColor="@color/black"
android:textSize="16sp"
......@@ -193,7 +193,7 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<com.mints.flowbox.ui.widgets.RoundRectLayout
android:id="@+id/fl_my_banner"
android:id="@+id/fl_wifi_banner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
......
......@@ -47,7 +47,7 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:lines="1"
android:textColor="@color/black"
android:textColor="@color/white"
android:textSize="12sp" />
<TextView
......@@ -56,6 +56,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:textColor="@color/white"
android:textSize="8sp" />
</LinearLayout>
......
......@@ -17,5 +17,5 @@
<com.mints.library.swipeback.SwipeBackLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent" />
......@@ -10,6 +10,7 @@
<color name="gray">#808080</color>
<color name="red">#FF0000</color>
<color name="color_4BB93F">#4BB93F</color>
<color name="color_28BA75">#28BA75</color>
<color name="color_3D5AFE">#3D5AFE</color>
<color name="color_cb4a39">#cb4a39</color>
<color name="color_ccc">#cccccc</color>
......@@ -17,6 +18,8 @@
<color name="color_0000">#00000000</color>
<color name="color_10000000">#10000000</color>
<color name="color_20000000">#20000000</color>
<color name="color_30000000">#30000000</color>
<color name="color_40000000">#40000000</color>
<color name="color_60000000">#60000000</color>
<color name="transparent">#00000000</color>
<color name="color_2B3238">#2B3238</color>
......
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