Commit f92cd5a9 authored by wanglei's avatar wanglei

[新项目]Quick Phone Clean

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