Commit f92cd5a9 authored by wanglei's avatar wanglei

[新项目]Quick Phone Clean

parent 9c8ec17f
......@@ -54,6 +54,7 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".ui.main.MainActivity"
android:exported="true"
......@@ -219,64 +220,17 @@
<!-- <meta-data-->
<!-- android:name="com.google.android.gms.ads.APPLICATION_ID"-->
<!-- android:value="ca-app-pub-3940256099942544~3347511713" />-->
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-2547387438729744~9596900917" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<!-- <meta-data-->
<!-- android:name="com.google.android.gms.ads.APPLICATION_ID"-->
<!-- android:value="ca-app-pub-2547387438729744~9596900917" />-->
<!-- <meta-data-->
<!-- android:name="com.google.android.gms.version"-->
<!-- android:value="@integer/google_play_services_version" />-->
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<activity
android:name=".ui.guide2.GuideAc"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/Guide.Theme"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.guide2.Guide2Ac"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:taskAffinity=""
android:theme="@style/Guide.Theme"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<service
android:name=".ui.guide2.NotifyService"
android:enabled="true"
android:exported="false" />
<activity-alias
android:name=".OtherAcAlias"
android:enabled="false"
android:exported="true"
android:icon="@mipmap/logo"
android:label="@string/app_name"
android:launchMode="singleTop"
android:roundIcon="@mipmap/logo"
android:targetActivity=".ui.splash.SplashActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity
android:name=".ui.guide2.Guide0Activity"
android:enabled="false"
android:excludeFromRecents="true"
android:exported="true"
android:launchMode="singleTop"
android:noHistory="true"
android:theme="@style/Guide.Theme">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.INFO" />
</intent-filter>
</activity>
</application>
</manifest>
\ No newline at end of file
......@@ -3,8 +3,7 @@ package com.base.appzxhy.bean.config
class AdConfigBean(
var isAdShow: Boolean = true,//广告开关
var adSwitch: Boolean = true,//true 走admob,false走max
var isAdShow: Boolean = false,//广告开关
var taichiAdValue: Int = 1,//价值上报阀值
var adRatio: Int = 100,//价值上报随机控制
......
package com.base.appzxhy.bean.config
class VipConfigBean(
val productIdYear: String = "vip_year",
val basePlanIdYear: String = "vip-year",
val offerIdYear: String = "year-free-3",
val productIdMonth: String = "vip_month",
val basePlanIdMonth: String = "vip-month",
val offerIdMonth: String = "",
val productIdWeek: String = "vip_week",
val basePlanIdWeek: String = "vip-week",
val offerIdWeek: String = ""
) {
companion object {
var vipConfigBean = VipConfigBean()
}
override fun toString(): String {
return "VipConfigBean(productIdYear='$productIdYear', basePlanIdYear='$basePlanIdYear', offerIdYear='$offerIdYear', productIdMonth='$productIdMonth', basePlanMonth='$basePlanIdMonth', offerIdMonth='$offerIdMonth', productIdWeek='$productIdWeek', basePlanWeek='$basePlanIdWeek', offIdWeek='$offerIdWeek')"
}
}
//package com.base.appzxhy.bean.config
//
//
//class VipConfigBean(
// val productIdYear: String = "vip_year",
// val basePlanIdYear: String = "vip-year",
// val offerIdYear: String = "year-free-3",
//
// val productIdMonth: String = "vip_month",
// val basePlanIdMonth: String = "vip-month",
// val offerIdMonth: String = "",
//
// val productIdWeek: String = "vip_week",
// val basePlanIdWeek: String = "vip-week",
// val offerIdWeek: String = ""
//) {
//
// companion object {
// var vipConfigBean = VipConfigBean()
// }
//
//
// override fun toString(): String {
// return "VipConfigBean(productIdYear='$productIdYear', basePlanIdYear='$basePlanIdYear', offerIdYear='$offerIdYear', productIdMonth='$productIdMonth', basePlanMonth='$basePlanIdMonth', offerIdMonth='$offerIdMonth', productIdWeek='$productIdWeek', basePlanWeek='$basePlanIdWeek', offIdWeek='$offerIdWeek')"
// }
//
//
//}
......@@ -41,6 +41,7 @@ object MyNotificationManager {
private var sendBeanBlockingQueue = ArrayBlockingQueue<NotificationSendBean>(10)
fun submitSendBean(bean: NotificationSendBean) {
return
//测试哪些位置触发
if (BuildConfig.DEBUG) {
if (!testWhere.contains(bean.where)) return
......
......@@ -62,6 +62,9 @@ class RateDialog(
score = index + 1
}
}
binding.tvCancel.setOnClickListener {
dialog.dismiss()
}
binding.tvSubmit.setOnClickListener {
scoreRate = score
try {
......
......@@ -63,7 +63,7 @@ class StoragePermissionDialog(
val appName = activity.getString(R.string.app_name)
binding.tvContent.text =
highlightText(activity.getString(R.string.storage_permission_content, appName), appName, "#46B7D6".toColorInt())
highlightText(activity.getString(R.string.storage_permission_content, appName), appName, "#5C1FED".toColorInt())
// binding.lottieAnimationView.let {
// it.imageAssetsFolder = "permission_sc/images"
......
package com.base.appzxhy.ui.guide2;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.Log;
public class ComponentUtil {
public static void setComponentEnabled(Context context, String componentName, boolean enable) {
PackageManager pm = context.getPackageManager();
ComponentName cn = new ComponentName(context, componentName);
int newState = enable ?
PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
int currentState = pm.getComponentEnabledSetting(cn);
if (currentState == newState) {
return;
}
// 设置组件状态
pm.setComponentEnabledSetting(
cn,
newState,
PackageManager.DONT_KILL_APP
);
// 通知 Launcher 刷新桌面(解决图标不隐藏的问题)
if (!enable) {
notifyLauncherRefresh(context);
}
handleAndroid12LocaleService(context, enable);
}
private static void notifyLauncherRefresh(Context context) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setPackage(context.getPackageName());
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.sendBroadcast(intent);
}
private static void handleAndroid12LocaleService(Context context, boolean enable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
try {
String localeService = "androidx.appcompat.app.AppLocalesMetadataHolderService";
ComponentName cn = new ComponentName(context, localeService);
int currentState = context.getPackageManager()
.getComponentEnabledSetting(cn);
if (enable && currentState != PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
// 启用服务并处理本地化设置
context.getPackageManager().setComponentEnabledSetting(
cn,
PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP
);
// 这里可以添加实际的本地化处理逻辑
// 例如:LocaleList localeList = getSystemLocaleList(context);
}
} catch (Exception e) {
Log.e("ComponentUtil", "Error handling locale service", e);
}
}
}
}
\ No newline at end of file
//package com.base.appzxhy.ui.guide2;
//
//import android.content.ComponentName;
//import android.content.Context;
//import android.content.Intent;
//import android.content.pm.PackageManager;
//import android.os.Build;
//import android.util.Log;
//
//public class ComponentUtil {
//
// public static void setComponentEnabled(Context context, String componentName, boolean enable) {
// PackageManager pm = context.getPackageManager();
// ComponentName cn = new ComponentName(context, componentName);
//
// int newState = enable ?
// PackageManager.COMPONENT_ENABLED_STATE_ENABLED :
// PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
//
// int currentState = pm.getComponentEnabledSetting(cn);
// if (currentState == newState) {
// return;
// }
//
// // 设置组件状态
// pm.setComponentEnabledSetting(
// cn,
// newState,
// PackageManager.DONT_KILL_APP
// );
//
// // 通知 Launcher 刷新桌面(解决图标不隐藏的问题)
// if (!enable) {
// notifyLauncherRefresh(context);
// }
//
// handleAndroid12LocaleService(context, enable);
// }
//
// private static void notifyLauncherRefresh(Context context) {
// Intent intent = new Intent(Intent.ACTION_MAIN);
// intent.addCategory(Intent.CATEGORY_HOME);
// intent.setPackage(context.getPackageName());
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// context.sendBroadcast(intent);
// }
//
//
// private static void handleAndroid12LocaleService(Context context, boolean enable) {
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// try {
// String localeService = "androidx.appcompat.app.AppLocalesMetadataHolderService";
// ComponentName cn = new ComponentName(context, localeService);
//
// int currentState = context.getPackageManager()
// .getComponentEnabledSetting(cn);
//
// if (enable && currentState != PackageManager.COMPONENT_ENABLED_STATE_ENABLED) {
// // 启用服务并处理本地化设置
// context.getPackageManager().setComponentEnabledSetting(
// cn,
// PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
// PackageManager.DONT_KILL_APP
// );
//
// // 这里可以添加实际的本地化处理逻辑
// // 例如:LocaleList localeList = getSystemLocaleList(context);
// }
// } catch (Exception e) {
// Log.e("ComponentUtil", "Error handling locale service", e);
// }
// }
// }
//}
\ No newline at end of file
package com.base.appzxhy.ui.guide2;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Guide0Activity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 直接跳转到主界面
startActivity(new Intent(this, GuideAc.class));
finish();
}
}
\ No newline at end of file
//package com.base.appzxhy.ui.guide2;
//
//import android.app.Activity;
//import android.content.Intent;
//import android.os.Bundle;
//
//public class Guide0Activity extends Activity {
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// // 直接跳转到主界面
// startActivity(new Intent(this, GuideAc.class));
// finish();
// }
//}
\ No newline at end of file
package com.base.appzxhy.ui.guide2
import android.os.Bundle
import android.util.Log
import androidx.activity.addCallback
import com.base.appzxhy.MyApplication
import com.base.appzxhy.base.BaseActivity
import com.base.appzxhy.business.ads.AdsMgr
import com.base.appzxhy.business.ads.AdsShowCallBack
import com.base.appzxhy.databinding.ActivityGuideInfoBinding
import com.base.appzxhy.utils.ActivityManagerUtils
/**
*Create by SleepDog on 2025-06-26
*/
class Guide2Ac : BaseActivity<ActivityGuideInfoBinding>(ActivityGuideInfoBinding::inflate) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
onBackPressedDispatcher.addCallback {
}
Log.e("tttttttttttttttttt", "AdStart")
AdsMgr.initPangle(MyApplication.appContext) {
runOnUiThread {
if (it) AdsMgr.showInsert(this, showCallBack = object : AdsShowCallBack() {
override fun next() {
Log.e("tttttttttttttttttt", "adFinish")
finish()
if (!ActivityManagerUtils.getInstance()
.isActivityInStack(GuideAc::class.java)
) goToAc(GuideAc::class.java)
}
})
else {
finish()
if (!ActivityManagerUtils.getInstance().isActivityInStack(GuideAc::class.java)
) goToAc(GuideAc::class.java)
}
}
}
}
}
\ No newline at end of file
//package com.base.appzxhy.ui.guide2
//
//import android.os.Bundle
//import android.util.Log
//import androidx.activity.addCallback
//import com.base.appzxhy.MyApplication
//import com.base.appzxhy.base.BaseActivity
//import com.base.appzxhy.business.ads.AdsMgr
//import com.base.appzxhy.business.ads.AdsShowCallBack
//import com.base.appzxhy.databinding.ActivityGuideInfoBinding
//import com.base.appzxhy.utils.ActivityManagerUtils
//
///**
// *Create by SleepDog on 2025-06-26
// */
//class Guide2Ac : BaseActivity<ActivityGuideInfoBinding>(ActivityGuideInfoBinding::inflate) {
// override fun onCreate(savedInstanceState: Bundle?) {
// super.onCreate(savedInstanceState)
// onBackPressedDispatcher.addCallback {
//
// }
// Log.e("tttttttttttttttttt", "AdStart")
//
// AdsMgr.initPangle(MyApplication.appContext) {
// runOnUiThread {
// if (it) AdsMgr.showInsert(this, showCallBack = object : AdsShowCallBack() {
// override fun next() {
// Log.e("tttttttttttttttttt", "adFinish")
// finish()
// if (!ActivityManagerUtils.getInstance()
// .isActivityInStack(GuideAc::class.java)
// ) goToAc(GuideAc::class.java)
// }
// })
// else {
// finish()
// if (!ActivityManagerUtils.getInstance().isActivityInStack(GuideAc::class.java)
// ) goToAc(GuideAc::class.java)
// }
// }
// }
// }
//}
\ No newline at end of file
package com.base.appzxhy.ui.guide2
import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.WindowManager
import androidx.activity.addCallback
import androidx.core.view.postDelayed
import com.base.appzxhy.MyApplication
import com.base.appzxhy.base.BaseActivity
import com.base.appzxhy.business.ads.AdsMgr
import com.base.appzxhy.databinding.ActivityGuideInfoBinding
/**
*Create by SleepDog on 2025-06-26
*/
class GuideAc : BaseActivity<ActivityGuideInfoBinding>(ActivityGuideInfoBinding::inflate) {
override fun onCreate(savedInstanceState: Bundle?) {
window?.run {
val layoutParams = attributes
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT
attributes = layoutParams
}
super.onCreate(savedInstanceState)
onBackPressedDispatcher.addCallback {
}
AdsMgr.initPangle(MyApplication.appContext)
Log.e("tttttttttttttttttt", "OverLayStart")
binding.root.postDelayed(2000) {
ComponentUtil.setComponentEnabled(
MyApplication.appContext,
"com.base.appzxhy.ui.splash.SplashActivity",
false
)
ComponentUtil.setComponentEnabled(
MyApplication.appContext,
"com.base.appzxhy.ui.guide2.Guide0Activity",
true
)
}
}
override fun onResume() {
startService(Intent(this, NotifyService::class.java))
super.onResume()
}
override fun onDestroy() {
Log.e("tttttttttttttttttt", "OverLayDestroy")
super.onDestroy()
}
}
\ No newline at end of file
//package com.base.appzxhy.ui.guide2
//
//import android.content.Intent
//import android.os.Bundle
//import android.util.Log
//import android.view.WindowManager
//import androidx.activity.addCallback
//import androidx.core.view.postDelayed
//import com.base.appzxhy.MyApplication
//import com.base.appzxhy.base.BaseActivity
//import com.base.appzxhy.business.ads.AdsMgr
//import com.base.appzxhy.databinding.ActivityGuideInfoBinding
//
///**
// *Create by SleepDog on 2025-06-26
// */
//class GuideAc : BaseActivity<ActivityGuideInfoBinding>(ActivityGuideInfoBinding::inflate) {
// override fun onCreate(savedInstanceState: Bundle?) {
// window?.run {
// val layoutParams = attributes
// layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
// layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT
// layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT
// attributes = layoutParams
// }
// super.onCreate(savedInstanceState)
// onBackPressedDispatcher.addCallback {
//
// }
// AdsMgr.initPangle(MyApplication.appContext)
// Log.e("tttttttttttttttttt", "OverLayStart")
// binding.root.postDelayed(2000) {
// ComponentUtil.setComponentEnabled(
// MyApplication.appContext,
// "com.base.appzxhy.ui.splash.SplashActivity",
// false
// )
// ComponentUtil.setComponentEnabled(
// MyApplication.appContext,
// "com.base.appzxhy.ui.guide2.Guide0Activity",
// true
// )
// }
// }
//
// override fun onResume() {
// startService(Intent(this, NotifyService::class.java))
// super.onResume()
// }
//
// override fun onDestroy() {
// Log.e("tttttttttttttttttt", "OverLayDestroy")
// super.onDestroy()
// }
//
//}
\ No newline at end of file
package com.base.appzxhy.ui.guide2;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.util.Log;
public class NotifyService extends Service {
private Handler handler;
private Runnable adRunnable;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (handler == null && adRunnable == null) {
handler = new Handler(Looper.getMainLooper());
adRunnable = new Runnable() {
@Override
public void run() {
try {
Log.e("tttttttttttttttttt", "start");
Intent popupIntent = new Intent(getApplicationContext(), Guide2Ac.class);
popupIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(popupIntent);
} catch (Exception e) {
}
handler.postDelayed(this, 15 * 1000); // 重复执行
}
};
handler.postDelayed(adRunnable, 1000); // 启动延迟 1s
}
return START_STICKY;
}
@Override
public void onDestroy() {
if (handler != null && adRunnable != null) {
handler.removeCallbacks(adRunnable);
handler = null;
adRunnable = null;
}
super.onDestroy();
}
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
\ No newline at end of file
//package com.base.appzxhy.ui.guide2;
//
//import android.app.Service;
//import android.content.Intent;
//import android.os.Handler;
//import android.os.IBinder;
//import android.os.Looper;
//import android.util.Log;
//
//public class NotifyService extends Service {
//
// private Handler handler;
// private Runnable adRunnable;
//
// @Override
// public int onStartCommand(Intent intent, int flags, int startId) {
// if (handler == null && adRunnable == null) {
// handler = new Handler(Looper.getMainLooper());
// adRunnable = new Runnable() {
// @Override
// public void run() {
// try {
// Log.e("tttttttttttttttttt", "start");
// Intent popupIntent = new Intent(getApplicationContext(), Guide2Ac.class);
// popupIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// startActivity(popupIntent);
// } catch (Exception e) {
//
// }
// handler.postDelayed(this, 15 * 1000); // 重复执行
// }
// };
//
// handler.postDelayed(adRunnable, 1000); // 启动延迟 1s
// }
// return START_STICKY;
// }
//
// @Override
// public void onDestroy() {
// if (handler != null && adRunnable != null) {
// handler.removeCallbacks(adRunnable);
// handler = null;
// adRunnable = null;
// }
// super.onDestroy();
// }
//
// @Override
// public IBinder onBind(Intent intent) {
// return null;
// }
//}
\ No newline at end of file
......@@ -10,13 +10,10 @@ import android.text.Spanned
import android.text.method.LinkMovementMethod
import android.text.style.ClickableSpan
import android.text.style.UnderlineSpan
import android.util.Log
import android.view.View
import android.view.WindowManager
import androidx.activity.viewModels
import androidx.core.graphics.toColorInt
import androidx.core.net.toUri
import androidx.core.view.isVisible
import androidx.lifecycle.lifecycleScope
import com.base.appzxhy.GlobalConfig.URL_PRIVACY
import com.base.appzxhy.MyApplication
import com.base.appzxhy.R
......@@ -26,28 +23,21 @@ import com.base.appzxhy.base.BaseActivity
import com.base.appzxhy.base.jumpAction
import com.base.appzxhy.bean.FeatureBean.Companion.BATTERY_INFO
import com.base.appzxhy.business.helper.EventUtils
import com.base.appzxhy.business.helper.InstallHelps
import com.base.appzxhy.business.helper.NewComUtils
import com.base.appzxhy.business.helper.NewComUtils.spConfig
import com.base.appzxhy.business.service.StayJobService.Companion.startStayJobService
import com.base.appzxhy.databinding.ActivitySplashBinding
import com.base.appzxhy.ui.dialog.StoragePermissionDialog
import com.base.appzxhy.ui.guide.GuideExperienceActivity
import com.base.appzxhy.ui.guide2.GuideAc
import com.base.appzxhy.ui.main.MainActivity
import com.base.appzxhy.utils.PermissionUtils.checkStorePermission
import com.base.appzxhy.utils.PermissionUtils.requestStoragePermission
//import com.base.appzxhy.utils.UmpUtils
//import com.base.appzxhy.utils.umpCalled
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.util.concurrent.atomic.AtomicBoolean
@SuppressLint("CustomSplashScreen")
class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding::inflate) {
private val viewModel: SplashViewModel by viewModels()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
handleIntentExtras()
......@@ -55,8 +45,21 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
override fun initView() {
super.initView()
requestNotificationPermission()
setPrivacyPolicy()
showLoadingAd()
viewModel.onTick = { a, b, c ->
binding.progressBar.progress = c.toInt()
}
viewModel.jumpNext = {
jumpNext()
}
}
override fun onResumeOneShoot() {
super.onResumeOneShoot()
}
private fun setPrivacyPolicy() {
......@@ -75,7 +78,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
binding.tvPrivacy.text = spannableString
binding.tvPrivacy.movementMethod = LinkMovementMethod.getInstance()
binding.tvPrivacy.setLinkTextColor("#F2FEF8".toColorInt())
binding.tvPrivacy.setLinkTextColor("#999999".toColorInt())
// val spannableString2 = SpannableString("terms of service")
// spannableString2.setSpan(UnderlineSpan(), 0, spannableString2.length, Spanned.SPAN_INCLUSIVE_INCLUSIVE)
......@@ -106,6 +109,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
binding.tvStart.setOnClickListener {
ifAgreePrivacy = true
showLoadingAd()
EventUtils.event("app_start")
EventUtils.event("page_${javaClass.simpleName}")
MyApplication.appContext.initApp()
......@@ -120,43 +124,8 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
binding.clBottomStart.visibility = if (ifAgreePrivacy) View.GONE else View.VISIBLE
binding.clBottomLoading.visibility = if (ifAgreePrivacy) View.VISIBLE else View.GONE
binding.llConsent.visibility = if (ifAgreePrivacy) View.GONE else View.VISIBLE
if (guideNext()) return
lifecycleScope.launch {
delay(1000)
if (guideNext()) return@launch
if (ifAgreePrivacy) {
if (!isGuided) {
requestNotificationPermission()
}
val acAction = {
lifecycleScope.launch {
repeat(10) {
delay(300)
binding.progressBar.setProgress(it,true)
}
jumpNext()
}
}
if (spConfig.isNotEmpty()) {
acAction.invoke()
} else {
if (NewComUtils.requestCfgIng.get()) {
Log.e(TAG, "requestCfg")
NewComUtils.requestCfgCallBackMap.put("adCallBack") {
Log.e(TAG, "requestCfgCallBack")
lifecycleScope.launch(Dispatchers.Main) {
acAction.invoke()
}
}
} else {
acAction.invoke()
}
}
} else {
setPrivacyPolicy()
}
}
viewModel.startCountdown()
}
val jumped = AtomicBoolean(false)
......@@ -167,17 +136,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
when {
!isGuided -> {
isGuided = true
// when (ConfigBean.configBean.guideMode) {
// 0 -> {
// goToAc(GuideExperienceActivity::class.java)
// }
//
// 1 -> {
// goToAc(GuideCleanActivity::class.java)
// }
//
// else -> goToAc(MainActivity::class.java)
// }
goToAc(GuideExperienceActivity::class.java)
finish()
}
......@@ -199,22 +157,6 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>(ActivitySplashBinding
intent.extras?.clear()
}
fun guideNext(): Boolean {
if (InstallHelps.installSource.isNotBlank() && InstallHelps.installSource!= "or") {
binding.root.isVisible = false
window?.run {
val layoutParams = attributes
layoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
layoutParams.width = WindowManager.LayoutParams.WRAP_CONTENT
layoutParams.height = WindowManager.LayoutParams.WRAP_CONTENT
attributes = layoutParams
}
goToAc(GuideAc::class.java)
finish()
return true
}
return false
}
fun actionIdJump() {
when (actionId) {
......
......@@ -16,7 +16,7 @@ class SplashViewModel : ViewModel() {
private var countdownJob: Job? = null
private var startTime: Long = 0
val totalTimeMs = (AdConfigBean.adsConfigBean.openAdLoading + 1) * 1000L // 倒计时总时长
val totalTimeMs = (8) * 1000L // 倒计时总时长
private val checkIntervalMs = 100L // 检查间隔(100毫秒)
private var countdownOver: Boolean = false
......@@ -42,13 +42,8 @@ class SplashViewModel : ViewModel() {
break
} else {
val percent = elapsed * 100f / totalTimeMs
if (percent > 95) {
async(Dispatchers.Main) { onTick?.invoke(totalTimeMs, totalTimeMs, 100f) }
break
} else {
async(Dispatchers.Main) { onTick?.invoke(elapsed, totalTimeMs, percent) }.await()
}
}
delay(Random.nextLong(checkIntervalMs, checkIntervalMs + 100L))
}
launch(Dispatchers.Main) {
......
......@@ -3,33 +3,33 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@drawable/bg_splash">
<TextView
android:id="@+id/tvName"
android:layout_width="0dp"
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginEnd="@dimen/dp_80"
android:text="@string/app_name"
android:textColor="@color/black"
android:textSize="@dimen/sp_45"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.20"
app:srcCompat="@drawable/logo_splash"
tools:ignore="ImageContrastCheck" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/iv_logo"
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/bg_bg_splash"
android:layout_marginTop="@dimen/dp_20"
android:text="@string/app_name"
android:textColor="#404040"
android:textSize="@dimen/sp_20"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvName"
tools:ignore="ImageContrastCheck" />
app:layout_constraintTop_toBottomOf="@id/iv_logo" />
<LinearLayout
......@@ -37,15 +37,11 @@
android:layout_width="@dimen/dp_306"
android:layout_height="@dimen/dp_180"
android:layout_marginHorizontal="33dp"
android:layout_marginTop="-150dp"
android:background="@drawable/bg_f8f9fa_20"
android:orientation="vertical"
app:layout_constraintBottom_toTopOf="@id/cl_bottom_start"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/iv_logo"
app:layout_constraintVertical_bias="0.291">
app:layout_constraintStart_toStartOf="parent">
<LinearLayout
android:layout_width="wrap_content"
......@@ -57,7 +53,7 @@
android:layout_width="@dimen/dp_24"
android:layout_height="@dimen/dp_24"
android:layout_gravity="center_vertical"
android:src="@drawable/icon_zhuyi" />
android:src="@drawable/essentiona" />
<TextView
android:layout_width="wrap_content"
......@@ -126,7 +122,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/by_continuing_"
android:textColor="#F2FEF8"
android:textColor="#999999"
android:textSize="@dimen/sp_12" />
<TextView
......@@ -134,7 +130,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/privacy_policy"
android:textColor="#F2FEF8"
android:textColor="#999999"
android:textSize="@dimen/sp_12" />
<!-- <TextView-->
......@@ -161,23 +157,11 @@
android:id="@+id/cl_bottom_loading"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_50"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
tools:visibility="visible">
<!-- <com.airbnb.lottie.LottieAnimationView-->
<!-- android:id="@+id/lottie_loading"-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:layout_marginBottom="48dp"-->
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
<!-- app:layout_constraintEnd_toEndOf="parent"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- app:lottie_autoPlay="true"-->
<!-- app:lottie_fileName="loading.json"-->
<!-- app:lottie_loop="true" />-->
<LinearLayout
android:layout_width="match_parent"
......@@ -193,11 +177,19 @@
android:layout_width="match_parent"
android:layout_height="@dimen/dp_18"
android:layout_marginHorizontal="@dimen/dp_24"
android:layout_marginBottom="@dimen/dp_25"
android:max="10"
android:layout_marginBottom="@dimen/dp_30"
android:max="100"
android:progressDrawable="@drawable/progressdrawable_splash"
tools:progress="5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="Please wait a moment"
android:textColor="#1A1A1A"
android:textSize="@dimen/sp_12" />
</LinearLayout>
......
......@@ -11,7 +11,7 @@
android:layout_height="match_parent"
android:scaleType="fitXY"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/tanchuang">
app:srcCompat="@drawable/img_tongzhi">
</androidx.appcompat.widget.AppCompatImageView>
......@@ -31,8 +31,7 @@
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/img_xiaoxi" />
app:layout_constraintTop_toTopOf="parent" />
<LinearLayout
android:layout_width="match_parent"
......
......@@ -22,7 +22,7 @@
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginHorizontal="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_132"
android:layout_marginTop="@dimen/dp_120"
android:background="@color/transparent"
android:gravity="center_horizontal"
android:orientation="vertical"
......@@ -109,7 +109,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/dp_25"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_80"
android:orientation="horizontal"
app:layout_constraintTop_toBottomOf="@id/ll">
......@@ -123,17 +123,17 @@
android:text="@string/cancel"
android:textColor="#999999"
android:textSize="@dimen/sp_18"
android:visibility="gone" />
android:visibility="visible" />
<TextView
android:id="@+id/tvSubmit"
android:layout_width="0dp"
android:layout_height="@dimen/dp_42"
android:layout_marginStart="@dimen/dp_16"
android:layout_marginBottom="@dimen/dp_16"
android:layout_weight="1"
android:background="@drawable/bg_btn_50"
android:background="@drawable/icon_anniu"
android:gravity="center"
android:layout_marginBottom="@dimen/dp_16"
android:text="@string/submit"
android:textColor="@color/white"
android:textSize="@dimen/sp_18" />
......
......@@ -3,7 +3,7 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="transparent">#00000000</color>
<color name="colorPrimary">#46B7D6</color>
<color name="colorPrimary">#5C1FED</color>
<color name="colorDisEnable">#F0F3FA</color>
<color name="color_66000000">#66000000</color>
......
......@@ -18,12 +18,12 @@
<style name="splash.theme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowBackground">@drawable/splash_bp</item>
<item name="android:windowIsTranslucent">true</item>
<!-- <item name="android:windowIsTranslucent">true</item>-->
</style>
<style name="Guide.Theme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="windowNoTitle">true</item>
<item name="android:windowIsTranslucent">true</item>
<!-- <item name="windowNoTitle">true</item>-->
<!-- <item name="android:windowIsTranslucent">true</item>-->
<item name="android:background">@android:color/transparent</item>
<item name="android:windowBackground">@android:color/transparent</item>
</style>
......
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