Commit ac2f1ffe authored by mengcuiguang2's avatar mengcuiguang2
parents ba1bed4e 72c45791
......@@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.PACKAGE_USAGE_STATS" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
<uses-permission android:name="android.permission.REORDER_TASKS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.CALL_PHONE" />
......@@ -193,9 +194,15 @@
<activity
android:name=".ui.activitys.keepalive.TransparentActivity"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:launchMode="singleInstance"
android:theme="@style/CustomerTransparentTheme" />
<!-- <activity-->
<!-- android:name=".ui.activitys.keepalive.TransPlaceActivity"-->
<!-- android:excludeFromRecents="true"-->
<!-- android:launchMode="singleTask"-->
<!-- android:theme="@style/CustomerTransparentTheme" />-->
<activity
android:name=".ui.activitys.keepalive.BoostFastActivity"
android:excludeFromRecents="true"
......
......@@ -36,6 +36,7 @@ import com.mints.flowbox.net.LoanService;
import com.mints.flowbox.ui.activitys.keepalive.TriggerActivity;
import com.mints.flowbox.utils.ForegroundOrBackground;
import com.mints.flowbox.utils.SystemUtils;
import com.mints.flowbox.utils.keepalive.IntentUtils;
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils;
import com.module.legacy.oreo.RegisterJobUtils;
import com.orhanobut.logger.AndroidLogAdapter;
......@@ -186,6 +187,8 @@ public class MintsApplication extends BaseApp {
// Toast.makeText(this, "测试:主进程重启成功", Toast.LENGTH_LONG).show();
// }
// OutAppRouter.INSTANCE.startTransPlace(this);
WifiStateWatch.getInstance(this).begin(new WifiStateWatch.WifiStateListener() {
@Override
public void onWifiOpen() {
......@@ -269,6 +272,9 @@ public class MintsApplication extends BaseApp {
BatteryWatch.getInstance(this).begin(new BatteryWatch.BatteryStateListener() {
@Override
public void onCharging() {
if (IntentUtils.isRunningForeground(MintsApplication.getContext())) {
return;
}
if (ScreenLockerUtils.INSTANCE.canShowScreenLocker(mContext)) {
return;
}
......
......@@ -142,6 +142,7 @@ public class AlarmManager implements WeakHandler.IHandler {
Intent intent = new Intent(MintsApplication.getContext(), TransparentActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_NO_ANIMATION);
intent.putExtra(TransparentActivity.TIMING_TYPE, currentType++);
if (PhoneBrandUtils.isLockScreenProtected()) {
IntentUtils.startActivity(intent);
} else {
......
package com.mints.flowbox.keepalive
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.net.Uri
import com.mints.flowbox.MintsApplication
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ui.activitys.keepalive.ApkActivity
import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity
import com.mints.flowbox.ui.activitys.keepalive.TransPlaceActivity
import com.mints.flowbox.ui.activitys.keepalive.TriggerActivity
import com.mints.flowbox.utils.ForegroundOrBackground
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.keepalive.IntentUtils
import com.mints.flowbox.utils.keepalive.ScreenLockerUtils.canShowScreenLocker
import net.phone.PhoneBrandUtils
......@@ -64,13 +67,6 @@ object OutAppRouter {
}
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_ANIMATION
// IntentUtils.startScreenActivity(intent)
if (PhoneBrandUtils.isHuaweiHonor()) {
IntentUtils.startActivity(intent)
return
}
if (PhoneBrandUtils.isLockScreenProtected()) {
IntentUtils.startActivity(intent)
} else {
......@@ -78,6 +74,16 @@ object OutAppRouter {
}
}
/**
* 跳转拨号
*/
fun startTransPlace(ctx: Context) {
val intent = Intent(ctx, TransPlaceActivity::class.java)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
ctx.startActivity(intent);
}
/**
* 跳转拨号
*/
......@@ -96,17 +102,6 @@ object OutAppRouter {
activity.startActivity(intent);
}
/**
* 展示加速页面
*/
// fun showBoostActivity() {
// // 预加载信息流
// ExpressManager.loadAppOutExpress()
// val intent = Intent(MintsApplication.getContext(), BoostActivity::class.java)
// intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_ANIMATION
// IntentUtils.startActivity2(intent)
// }
/**
* 展示弹出页面
*/
......@@ -124,12 +119,12 @@ object OutAppRouter {
intent.putExtra(TriggerActivity.CALL_PHONE_TIME, time)
intent.putExtra(TriggerActivity.CALL_PHONE_NUM, phone)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_NO_ANIMATION
if (PhoneBrandUtils.isLockScreenProtected()) {
IntentUtils.startActivity(intent)
} else {
IntentUtils.startActivity3(intent)
}
}
IntentUtils.startActivity2(intent)
} }
/**
* 展示弹出页面
......
package com.mints.flowbox.mvp.presenters
import android.app.Activity
import com.google.gson.JsonObject
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.AppHttpManager
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.mvp.model.BaseResponse
import com.mints.flowbox.mvp.model.SignRedbagsBean
import com.mints.flowbox.mvp.views.BonusView
......@@ -74,7 +76,7 @@ class BonusPresenter : BasePresenter<BonusView>() {
* 设置邀请成功
*
*/
fun cmtShareStatus() {
fun cmtShareStatus(activity: Activity) {
val vo = HashMap<String, Any>()
vo["carrierType"] = Constant.CHALLENGE_SHAREFRIEND
vo["value"] = "1"
......@@ -92,8 +94,10 @@ class BonusPresenter : BasePresenter<BonusView>() {
override fun onNext(baseResponse: BaseResponse<Any>) {
if (isLinkView) return
when (baseResponse.status) {
}
val vo2 = HashMap<String, Any>()
vo["carrierType"] = Constant.CHALLENGE_SHAREFRIEND
TrackManager.getInstance()
.reportAddCoinMsg(activity, vo)
}
})
}
......
......@@ -55,10 +55,11 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
const val STEP_Interval = 2000L
}
private val typeArr = arrayOf("运行程序", "系统缓存", "临时文件", "广告垃圾", "安装包")
// private val typeArr = arrayOf("运行程序", "系统缓存", "临时文件", "广告垃圾", "安装包")
private val typeArr = arrayOf("运行程序", "系统缓存", "临时文件", "广告垃圾")
// 扫描类型
private var scanMax = 5
private var scanMax = 4
private val mCleanList = mutableListOf<ExpandInfo>()
private var mCleanExpandAdapter: CleanExpandAdapter? = null
......@@ -79,7 +80,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
override fun getBundleExtras(extras: Bundle?) {
super.getBundleExtras(extras)
extras?.let {
scanMax = it.getInt(Constant.SCAN_TYPE, 5)
scanMax = it.getInt(Constant.SCAN_TYPE, 4)
}
}
......@@ -140,7 +141,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
1 -> btnClean.text = "正在扫描 系统缓存..."
2 -> btnClean.text = "正在扫描 临时文件..."
3 -> btnClean.text = "正在扫描 广告垃圾..."
4 -> btnClean.text = "正在扫描 安装包..."
// 4 -> btnClean.text = "正在扫描 安装包..."
}
elv_clean.setSelectedGroup(taskType)
......@@ -247,7 +248,7 @@ class CleanActivity : BaseActivity(), View.OnClickListener {
isCleanCompleted = true
mCleanTimer?.cancel()
if (scanMax == 5) {
if (scanMax == 4) {
toResult()
}
......
......@@ -67,10 +67,6 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
super.onCreate(savedInstanceState)
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
}
override fun getContentViewLayoutID() = R.layout.activity_increasespeed
override fun initViewsAndEvents() {
......@@ -96,7 +92,7 @@ class IncreasespeedActivity : BaseActivity(), View.OnClickListener {
container.visibility = View.GONE
containerAnim.visibility = View.VISIBLE
mTimerMax = 11
mTimerMax = 26
startTimer()
} else if (mIncreaseType == INCREASE_CLEAN && AppConfig.isCanClean) {
container.visibility = View.GONE
......
package com.mints.flowbox.ui.activitys
import android.Manifest
import android.content.Context
import android.media.AudioManager
import android.os.Build
import android.os.Bundle
import android.text.TextUtils
import android.view.KeyEvent
......@@ -29,10 +31,13 @@ import com.mints.flowbox.ui.activitys.base.BaseActivity
import com.mints.flowbox.ui.fragment.*
import com.mints.flowbox.ui.widgets.dialog.DialogListener
import com.mints.flowbox.ui.widgets.dialog.PowerDialog
import com.mints.flowbox.utils.LogUtil
import com.mints.flowbox.utils.WifiUtils
import com.mints.library.net.netstatus.NetUtils
import com.mints.library.utils.GlideUtils
import com.tbruyelle.rxpermissions.RxPermissions
import kotlinx.android.synthetic.main.activity_main.*
import rx.Observable
/**
* 描述:main
......@@ -103,6 +108,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
override fun onResume() {
super.onResume()
TrackManager.getInstance().getOuterAdConfig()
TrackManager.getInstance().getAdWeight()
}
......@@ -327,11 +333,6 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
currentFragment = fourFragment
}
override fun onNetworkConnected(type: NetUtils.NetType?) {
super.onNetworkConnected(type)
TrackManager.getInstance().getOuterAdConfig()
}
private var mRefreshType = -1
private var powerDialog: PowerDialog? = null
......@@ -383,15 +384,7 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
// 数美初始化
ShumeiManager.getInstance().initShumei()
// 预加载信息流
ExpressManager.loadExpress(false)
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
checkPermission()
}
}
}
......@@ -400,6 +393,40 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
powerDialog?.show()
}
/** 检测权限 */
private fun checkPermission() {
val request: Observable<Boolean> =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_BACKGROUND_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
} else {
RxPermissions(this)
.request(
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE
)
}
request.subscribe { granted: Boolean ->
if (granted) {
// 预加载信息流
ExpressManager.loadExpress(false)
val bundle = Bundle()
bundle.putString(
IncreasespeedActivity.INCREASE_TYPE,
IncreasespeedActivity.INCREASE_BOOST
)
readyGo(IncreasespeedActivity::class.java)
} else {
showMissingPermissionDialog("位置,存储")
}
}
}
/**
* 游客登录
* refreshType fragment传入的下标
......@@ -493,13 +520,4 @@ class MainActivity : BaseActivity(), MainView, View.OnClickListener {
)
}
override fun moveTaskToBack(nonRoot: Boolean): Boolean {
if (!nonRoot) {
if (!isTaskRoot) {
return false
}
}
return super.moveTaskToBack(nonRoot)
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import android.graphics.Color
import android.view.View
import androidx.core.content.ContextCompat
import com.bumptech.glide.load.resource.gif.GifDrawable
import com.hjq.toast.ToastUtils
import com.mints.flowbox.R
import com.mints.flowbox.ad.express.ExpressManager
import com.mints.flowbox.ad.wifi.WifiAdManager
......@@ -45,18 +46,13 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
override fun adFail() {
}
override fun adClose() {
}
override fun adClose() {}
})
}
fun startTimer() {
if (mTimer != null) {
mTimer?.cancel()
mTimer = null
mStep = 0
}
mStep = 0
mTimer = Timer()
mTimer?.schedule(object : TimerTask() {
override fun run() {
......@@ -64,11 +60,9 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
runOnUiThread {
mStep++
if (mStep == 2) {
if (mStep == 4) {
WifiAdManager.instance.showInterstitial(this@SpeedFastActivity)
}
if (mStep == 4) {
tv_tab.text = topStr[2]
btn.background = ContextCompat.getDrawable(
this@SpeedFastActivity,
......@@ -122,14 +116,22 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
finish()
}
R.id.btn -> {
if (mStep == 0) {
btn.visibility = View.INVISIBLE
tv_progress.visibility = View.VISIBLE
GlideUtils.loadImageViewGif(this, R.drawable.wifi_speed, iv_gif)
tv_tab.text = topStr[1]
} else if (mStep >= 4) {
finish()
when {
mStep == 0 -> {
startTimer()
btn.visibility = View.INVISIBLE
tv_progress.visibility = View.VISIBLE
GlideUtils.loadImageViewGif(this, R.drawable.wifi_speed, iv_gif)
tv_tab.text = topStr[1]
}
mStep >= 4 -> {
finish()
}
else -> {
ToastUtils.show("正在加速中...")
}
}
}
}
......@@ -156,8 +158,6 @@ class SpeedFastActivity : BaseActivity(), View.OnClickListener {
}
override fun onDestroy() {
WifiAdManager.instance.onDestroy()
fl_ad?.removeAllViews()
// 预加载信息流
ExpressManager.loadExpress(false)
......
......@@ -42,9 +42,10 @@ abstract class OutAppActivity : BaseSwipeBackCompatActivity() {
resetWindowTransparentBackground()
// 设置锁屏页全屏
val isUsingShowWhenLockedFlag = ScreenLockerUtils.isLockScreenProtected(this)
val isUsingShowWhenLockedFlag = !ScreenLockerUtils.isLockScreenProtected(this)
if (isUsingShowWhenLockedFlag) {
ScreenLockerUtils.updateWindowFlags(window.decorView)
ScreenLockerUtils.makeLockWindowFullScreen(this, window.attributes, true)
}
}
......@@ -56,7 +57,7 @@ abstract class OutAppActivity : BaseSwipeBackCompatActivity() {
Manifest.permission.WRITE_EXTERNAL_STORAGE
) != 0
) {
window.setBackgroundDrawable(ColorDrawable(Color.parseColor("40000000")))
window.setBackgroundDrawable(ColorDrawable(Color.parseColor("#20000000")))
} else {
try {
val wallpaperManager = WallpaperManager.getInstance(this)
......
package com.mints.flowbox.ui.activitys.keepalive
import android.os.Bundle
import android.view.Gravity
import com.mints.flowbox.R
import com.mints.flowbox.ui.activitys.base.BaseActivity
/**
*
* 描述:透明activity,用于后台启动activity
*/
class TransPlaceActivity : BaseActivity() {
override fun getContentViewLayoutID() = R.layout.activity_trans
override fun initViewsAndEvents() {}
override fun isApplyKitKatTranslucency() = true
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val window = window
window.setGravity(Gravity.START or Gravity.TOP)
val params = window.attributes
params.x = 0
params.y = 0
params.height = 1
params.width = 1
window.attributes = params
moveTaskToBack(true)
}
}
\ No newline at end of file
......@@ -7,13 +7,13 @@ import android.os.Looper
import android.text.TextUtils
import android.view.View
import androidx.core.content.ContextCompat
import com.hjq.toast.ToastUtils
import com.mints.flowbox.R
import com.mints.flowbox.ad.video.PreCsjGroMoreVideoAdManager
import com.mints.flowbox.ad.video.VideoAdingManager
import com.mints.flowbox.ad.video.base.VideoAdStatusListener
import com.mints.flowbox.common.AppConfig
import com.mints.flowbox.common.Constant
import com.mints.flowbox.manager.TrackManager
import com.mints.flowbox.manager.UserManager
import com.mints.flowbox.mvp.model.SignRedbagsBean
import com.mints.flowbox.mvp.model.VideoAdingBean
......@@ -62,6 +62,7 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
private var todayMoney = 0
private var allMoney = 0
private var isButtonCanClick = false
override fun onResume() {
super.onResume()
......@@ -170,14 +171,14 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
shareImgDialog()
}
1 -> {
val vo = HashMap<String, Any>()
vo["carrierType"] = Constant.CHALLENGE_SHAREFRIEND
TrackManager.getInstance()
.reportAddCoinMsg(requireActivity(), vo)
Handler(Looper.getMainLooper()).postDelayed({
refreshData()
}, 500);
// val vo = HashMap<String, Any>()
// vo["carrierType"] = Constant.CHALLENGE_SHAREFRIEND
// TrackManager.getInstance()
// .reportAddCoinMsg(requireActivity(), vo)
//
// Handler(Looper.getMainLooper()).postDelayed({
// refreshData()
// }, 500)
}
}
}
......@@ -203,7 +204,12 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
}
// 当天是否可签到
btn_sign.isEnabled = data.isButtonCanClick
this.isButtonCanClick = data.isButtonCanClick
if (this.isButtonCanClick) {
btn_sign.setBackgroundResource(R.mipmap.ic_bouns_sign)
} else {
btn_sign.setBackgroundResource(R.mipmap.ic_bonus_sign_unenable)
}
btn_sign.text = data.buttonText
......@@ -236,7 +242,7 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
val shareDialog = ShareDialog(requireActivity())
shareDialog.setOnShareOKListener(object : ShareDialog.OnShareOKListener {
override fun onShareOk() {
bonusPresenter.cmtShareStatus()
bonusPresenter.cmtShareStatus(requireActivity())
}
})
val userManager = UserManager.getInstance()
......@@ -283,8 +289,12 @@ class BonusFragment : BaseFragment(), OnItemChildClickListener, BonusView, View.
when (v?.id) {
R.id.btn_sign -> {
// 签到
bonusPresenter.sign()
if (isButtonCanClick) {
// 签到
bonusPresenter.sign()
} else {
ToastUtils.show("请先完成今日任务!")
}
}
else -> {
}
......
......@@ -859,6 +859,7 @@ class MyFragment : BaseFragment(),
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View?) {
AppUtil.openUsageStats(mContext)
dialog?.dismiss()
}
})
}
......@@ -936,26 +937,26 @@ class MyFragment : BaseFragment(),
// 新人福利
// 游客首次提示1500新人奖励 且 不是分享包
val channel = CommonUtils.getAppMetaData(
MintsApplication.getContext(),
"CHANNEL_NAME"
MintsApplication.getContext(),
"CHANNEL_NAME"
)
if (!TextUtils.equals(
channel,
Constant.CHANNEL_SHARE
) && AppPreferencesManager.get().getBoolean(
Constant.FIRST_VISITOR_FLAG,
true
)
channel,
Constant.CHANNEL_SHARE
) && AppPreferencesManager.get().getBoolean(
Constant.FIRST_VISITOR_FLAG,
true
)
) {
AppPreferencesManager.get().put(Constant.FIRST_VISITOR_FLAG, false)
val bundle = Bundle()
bundle.putInt(
Constant.MAIN_CUR_COIN,
AppConfig.firstGiveCoin
Constant.MAIN_CUR_COIN,
AppConfig.firstGiveCoin
)
bundle.putString(
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_NEW_VISITOR
Constant.MAIN_CARRIER_TYPE,
Constant.CARRIER_NEW_VISITOR
)
readyGo(AwardActivity::class.java, bundle)
}
......
......@@ -735,8 +735,8 @@ class TurnTableFragment : BaseFragment(), TurnTableView, AdapterView.OnItemClick
DialogUtils.showDialog(
requireActivity(),
"提示",
content,
"提示",
leftStr,
object : DialogListener() {
override fun onClick(dialog: Dialog?, v: View) {
......
......@@ -126,7 +126,7 @@ public abstract class BaseFragment extends BaseAppFragment {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setTitle(R.string.notifyTitle);
//当前应用缺少必要权限。\n\n请点击\"设置\"-\"权限\"-打开所需权限。
builder.setMessage("当前应用缺少 " + msg + "授权\n\n请点击 设置-权限-打开所需权限");
builder.setMessage("当前应用缺少 " + msg + " 授权\n\n请点击 设置-权限-打开所需权限");
// 拒绝, 退出应用
builder.setNegativeButton(R.string.cancel,
......
......@@ -67,7 +67,7 @@ public class DrawHookView extends View {
RectF rectF = new RectF(center - radius - 1, center - radius - 1, center + radius + 1, center + radius + 1);
//根据进度画圆弧
canvas.drawArc(rectF, -180, -360 * progress / 100, false, paint);
canvas.drawArc(rectF, -180, 360 * progress / 100, false, paint);
/*
* 绘制对勾
......
......@@ -29,6 +29,7 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
//获取当前最上层的activity
private static WeakReference<Activity> app_activity;
private static WeakReference<Activity> main_activity;
private static WeakReference<Activity> trans_activity;
private WeakReference<VersionUpdatePresenter> vupWeakReference;
private VersionUpdatePresenter vup;
private WeakReference<Activity> reference;
......@@ -59,10 +60,6 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
return instance;
}
public static Activity getApp_activity() {
return app_activity.get();
}
public static Activity getMain_activity() {
try {
if (main_activity.get() != null) {
......@@ -75,6 +72,30 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
}
}
public static Activity getApp_activity() {
try {
if (app_activity.get() != null) {
return app_activity.get();
}
return main_activity.get();
} catch (NullPointerException e) {
e.printStackTrace();
return null;
}
}
//
// public static Activity getTrans_activity() {
// try {
// if (trans_activity.get() != null) {
// return trans_activity.get();
// }
// return app_activity.get();
// } catch (NullPointerException e) {
// e.printStackTrace();
// return null;
// }
// }
@Override
public void onActivityResumed(Activity activity) {
if (activity == null)
......@@ -114,6 +135,10 @@ public class ForegroundOrBackground implements Application.ActivityLifecycleCall
if (TextUtils.equals(activity.getClass().getSimpleName(), "MainActivity")) {
main_activity = new WeakReference<>(activity);
}
if (TextUtils.equals(activity.getClass().getSimpleName(), "TransPlaceActivity")) {
trans_activity = new WeakReference<>(activity);
}
}
@Override
......
......@@ -4,7 +4,6 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.provider.Settings;
import com.activityutil.ActivityManagerProxy;
......@@ -13,6 +12,7 @@ import com.activityutil.ContextLike;
import com.mints.flowbox.MintsApplication;
import com.mints.flowbox.ui.activitys.keepalive.ScreenActivity;
import com.mints.flowbox.utils.ForegroundOrBackground;
import com.mints.flowbox.utils.LogUtil;
import net.phone.PhoneBrandUtils;
......@@ -30,8 +30,8 @@ public class IntentUtils {
public static final String TAG = "IntentUtils";
public static void startActivity2(Intent intent) {
if (PhoneBrandUtils.isHuaweiHonor() || (PhoneBrandUtils.isXiaomi() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)) {
if (ForegroundOrBackground.getMain_activity() != null) {
if ((PhoneBrandUtils.isHuaweiOriginal() || isHarmonyOs())) {
if (ForegroundOrBackground.getApp_activity() != null) {
startActivity(intent);
return;
}
......@@ -79,10 +79,10 @@ public class IntentUtils {
moveToFront(activity);
activity.startActivity(intent);
activity.moveTaskToBack(false);
activity.moveTaskToBack(true);
return;
}
startActivity3(intent);
// startActivity3(intent);
}
public static void startActivity3(Intent intent) {
......@@ -95,6 +95,10 @@ public class IntentUtils {
@Override
public void onResult(boolean b) {
if (!b) {
LogUtil.d("AAAAAAa");
startActivity(intent);
}
}
}, null);
} catch (Exception e) {
......@@ -102,12 +106,12 @@ public class IntentUtils {
}
}
public static Boolean isRunningForeground(Activity activity) {
ActivityManager activityManager = (ActivityManager) activity.getSystemService(Context.ACTIVITY_SERVICE);
public static Boolean isRunningForeground(Context context) {
ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningTaskInfo> taskInfoList = activityManager.getRunningTasks(10);
for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
if (taskInfo.baseActivity.getPackageName().equals(activity.getPackageName())) {
if (taskInfo.baseActivity.getPackageName().equals(context.getPackageName())) {
return true;
}
}
......@@ -121,7 +125,7 @@ public class IntentUtils {
for (ActivityManager.RunningTaskInfo taskInfo : taskInfoList) {
//遍历找到本应用的 task,并将它切换到前台
if (taskInfo.baseActivity.getPackageName().equals(context.getPackageName())) {
activityManager.moveTaskToFront(taskInfo.id, 0);
activityManager.moveTaskToFront(taskInfo.id, ActivityManager.MOVE_TASK_WITH_HOME);
return;
}
}
......@@ -135,4 +139,14 @@ public class IntentUtils {
context.startActivity(intent);
}
public static boolean isHarmonyOs() {
try {
Class<?> buildExClass = Class.forName("com.huawei.system.BuildEx");
Object osBrand = buildExClass.getMethod("getOsBrand").invoke(buildExClass);
return "harmony".equalsIgnoreCase(osBrand.toString());
} catch (Throwable e) {
return false;
}
}
}
......@@ -70,7 +70,8 @@ public class GlideUtils {
//加载Gif
public static void loadImageViewGif(Context mContext, int drawable, ImageView imageView) {
Glide.with(mContext).load(drawable).into(imageView);
Glide.with(mContext).clear(imageView);
Glide.with(mContext).load(drawable).skipMemoryCache(true).diskCacheStrategy(DiskCacheStrategy.NONE).into(imageView);
}
//加载Gif
......
......@@ -29,6 +29,7 @@
android:layout_gravity="end"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:text="@string/appName"
android:textColor="@color/color_40000000"
......
......@@ -12,7 +12,7 @@
<ImageView
android:id="@+id/iv_gif"
android:layout_width="250dp"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
......
......@@ -13,8 +13,8 @@
android:id="@+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="20dp"
android:layout_marginTop="40dp"
android:layout_centerHorizontal="true"
android:layout_marginTop="60dp"
android:text="-"
android:textColor="@color/white"
android:textSize="60sp" />
......@@ -24,6 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/tvTime"
android:layout_centerHorizontal="true"
android:layout_marginStart="30dp"
android:text="-"
android:textColor="@color/white"
......@@ -103,10 +104,12 @@
android:textSize="20sp" />
<TextView
android:layout_width="wrap_content"
android:layout_width="78dp"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginTop="10dp"
android:layout_gravity="top"
android:layout_marginStart="10dp"
android:layout_marginTop="30dp"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:text="@string/appName"
android:textColor="@color/color_40000000"
......
......@@ -28,6 +28,7 @@
android:layout_gravity="end"
android:layout_marginStart="10dp"
android:layout_weight="1"
android:drawablePadding="4dp"
android:gravity="center_vertical"
android:text="@string/appName"
android:textColor="@color/color_40000000"
......@@ -41,7 +42,7 @@
android:layout_alignParentEnd="true"
android:layout_gravity="end|center_vertical"
android:layout_marginEnd="10dp"
android:src="@mipmap/ic_close"
android:src="@mipmap/ic_activity_quit"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
......
......@@ -126,8 +126,7 @@
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:background="@drawable/btn_bonus_sign"
android:enabled="false"
android:background="@mipmap/ic_bouns_sign"
android:text="签到"
android:textColor="@color/white"
android:textSize="18sp" />
......
......@@ -24,7 +24,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="40dp"
android:layout_marginTop="50dp"
android:layout_marginBottom="10dp"
android:text="流量补贴"
android:textColor="@color/white"
......
......@@ -53,7 +53,7 @@
android:layout_marginTop="5dp"
android:text="每5分钟可领取一次补贴金币"
android:textColor="@color/white"
android:textSize="12sp" />
android:textSize="14sp" />
</androidx.appcompat.widget.LinearLayoutCompat>
......
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