Commit 65845eb0 authored by wanglei's avatar wanglei

...适配Android12启动页

parent 806b8ef9
......@@ -18,6 +18,8 @@ android {
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "pdf-v$versionName-$versionCode")
signingConfigs {
create("release") {
//E6:A2:DD:0A:E6:73:22:32:4E:98:08:78:73:29:01:C4:8D:A0:38:DB:D8:B2:DD:B9:AC:55:69:B2:6B:DF:B0:B4
......@@ -132,4 +134,6 @@ dependencies {
//mintegral
implementation("com.reyun.solar.engine.oversea:solar-engine-core:1.2.8.3")
implementation("androidx.core:core-splashscreen:1.0.0-beta02")
}
\ No newline at end of file
......@@ -29,12 +29,15 @@
android:roundIcon="@mipmap/logo"
android:supportsRtl="true"
android:theme="@style/Theme.PdfReaderAllPdfReader"
tools:targetApi="31">
tools:targetApi="34">
<activity
android:theme="@style/splash.theme"
android:name=".ui.splash.SplashActivity"
android:exported="true">
android:name=".ui.splash.SystemStartActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/Theme.App.Starting"
tools:ignore="DiscouragedApi,LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
......@@ -42,17 +45,28 @@
</intent-filter>
</activity>
<activity
android:name=".ui.splash.MyStartActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="@style/splash.theme"
tools:ignore="DiscouragedApi,LockedOrientationActivity">
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
</activity>
<activity
android:name=".ui.main.MainActivity"
android:exported="false"
android:theme="@style/Theme.PdfReaderAllPdfReader.NoActionBar" />
<activity
android:name=".ui.language.LanguageActivity"
android:exported="false"
android:screenOrientation="portrait"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.pdf.PdfActivity"
android:exported="false"
......@@ -88,7 +102,6 @@
android:exported="false"
android:launchMode="singleTop"
tools:ignore="DiscouragedApi,LockedOrientationActivity" />
<activity
android:name=".ui.pdf.PdfSelectActivity"
android:exported="false"
......@@ -127,7 +140,6 @@
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service
android:name=".service.StayJobService"
android:exported="false"
......
......@@ -34,7 +34,7 @@ import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_status
import com.base.pdfreaderallpdfreader.fcm.PopupConstObject.popup_timer_interval
import com.base.pdfreaderallpdfreader.helper.EventUtils
import com.base.pdfreaderallpdfreader.helper.MyApplication
import com.base.pdfreaderallpdfreader.ui.splash.SplashActivity
import com.base.pdfreaderallpdfreader.ui.splash.MyStartActivity
import com.base.pdfreaderallpdfreader.utils.AppPreferences
import com.base.pdfreaderallpdfreader.utils.LogEx
import java.text.SimpleDateFormat
......@@ -150,7 +150,7 @@ object NotificationUiUtil {
fun setActionNotification(context: Context, actionId: String) {
val bigRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_message)
val smallRemoteViews = RemoteViews(MyApplication.context.packageName, R.layout.notification_message)
val intent = Intent(context, SplashActivity::class.java)
val intent = Intent(context, MyStartActivity::class.java)
intent.putExtra("actionId", actionId)
when (actionId) {
......
package com.base.pdfreaderallpdfreader.helper
import com.base.pdfreaderallpdfreader.ui.splash.SplashActivity
import com.base.pdfreaderallpdfreader.ui.splash.MyStartActivity
object ConfigHelper {
......@@ -32,7 +32,7 @@ object ConfigHelper {
"adActivity",
"AdActivity",
"AppLovinFullscreenActivity",
SplashActivity::class.java.simpleName,
MyStartActivity::class.java.simpleName,
"GmsDocumentScanningDelegateActivity",
// 返回前台时不跳转启动页的 activity
)
......
......@@ -10,7 +10,7 @@ import com.base.pdfreaderallpdfreader.fcm.FCMManager
import com.base.pdfreaderallpdfreader.fcm.ScreenStatusReceiver
import com.base.pdfreaderallpdfreader.helper.WeatherUtils.requestWeatherData
import com.base.pdfreaderallpdfreader.service.StayJobService.Companion.startJob
import com.base.pdfreaderallpdfreader.ui.splash.SplashActivity
import com.base.pdfreaderallpdfreader.ui.splash.MyStartActivity
import com.base.pdfreaderallpdfreader.utils.ActivityManagerUtils
import com.base.pdfreaderallpdfreader.utils.AppPreferences
import com.base.pdfreaderallpdfreader.utils.LogEx
......@@ -167,7 +167,7 @@ class MyApplication : Application() {
if (flag) {
topActivity?.startActivity(
Intent(
topActivity, SplashActivity::class.java
topActivity, MyStartActivity::class.java
).apply {
putExtra("isHotLaunch", true)
putExtra("type", -1)
......
......@@ -65,7 +65,11 @@ class DocumentFragment() : Fragment() {
}
}
adapter?.moreAction = { item: DocumentBean ->
requireContext().showDocumentHomeMoreDialog(item, this)
if (item.type == TYPE_PDF) {
} else {
requireContext().showDocumentHomeMoreDialog(item, this)
}
}
binding.rv.adapter = adapter
......
......@@ -22,13 +22,11 @@ import com.base.pdfreaderallpdfreader.bean.ConstObject.isFirstStart
import com.base.pdfreaderallpdfreader.databinding.ActivitySplashBinding
import com.base.pdfreaderallpdfreader.fcm.NotificationHoverUtils
import com.base.pdfreaderallpdfreader.helper.EventUtils
import com.base.pdfreaderallpdfreader.helper.MyApplication
import com.base.pdfreaderallpdfreader.helper.UmpUtils
import com.base.pdfreaderallpdfreader.helper.UmpUtils.requestUMP
import com.base.pdfreaderallpdfreader.helper.UmpUtils.umpCalled
import com.base.pdfreaderallpdfreader.helper.UmpUtils.umpCanAd
import com.base.pdfreaderallpdfreader.helper.WeatherUtils
import com.base.pdfreaderallpdfreader.ui.language.LanguageActivity
import com.base.pdfreaderallpdfreader.ui.main.MainActivity
import com.base.pdfreaderallpdfreader.utils.BarUtils
import com.base.pdfreaderallpdfreader.utils.LogEx
......@@ -39,8 +37,7 @@ import java.util.Calendar
import java.util.Locale
import java.util.concurrent.atomic.AtomicBoolean
@SuppressLint("CustomSplashScreen")
class SplashActivity : BaseActivity<ActivitySplashBinding>() {
class MyStartActivity : BaseActivity<ActivitySplashBinding>() {
private val TAG = "SplashActivity"
private lateinit var splashViewModel: SplashViewModel
......@@ -61,9 +58,7 @@ class SplashActivity : BaseActivity<ActivitySplashBinding>() {
Manifest.permission.POST_NOTIFICATIONS
)
} else {
registerForActivityResult(ActivityResultContracts.RequestPermission()) {}.launch(
Manifest.permission.POST_NOTIFICATIONS
)
}
actionId = intent.extras?.getString("actionId") ?: ""
......
package com.base.pdfreaderallpdfreader.ui.splash
import android.content.ContentValues.TAG
import androidx.lifecycle.LifecycleCoroutineScope
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.base.pdfreaderallpdfreader.ads.AdmobHelper.open_ad_loading
......@@ -22,7 +21,7 @@ class SplashViewModel : ViewModel() {
/**
* 超时跳转
*/
fun startJumpJob(splashActivity: SplashActivity) {
fun startJumpJob(splashActivity: MyStartActivity) {
if (ConstObject.ifAgreePrivacy && startJumpJob) {
if (jumpJob == null) {
val startTime = System.currentTimeMillis()
......
package com.base.pdfreaderallpdfreader.ui.splash
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.splashscreen.SplashScreenViewProvider
import java.util.concurrent.atomic.AtomicBoolean
/**
* 适配官方启动页
* https://cloud.tencent.com/developer/ask/sof/915280
*/
class SystemStartActivity : AppCompatActivity() {
// 数据
private var mKeepOnAtomicBool = AtomicBoolean(true)
override fun onCreate(savedInstanceState: Bundle?) {
// 初始化操作(必须放在setContentView()之前)
val splashScreen = installSplashScreen()
super.onCreate(savedInstanceState)
// setContentView(可以省略)
// setContentView(R.layout.activity_system_start)
// 每次UI绘制前,会判断 Splash 是否有必要继续展示在屏幕上;直到不再满足条件时,隐藏Splash。
splashScreen.setKeepOnScreenCondition {
mKeepOnAtomicBool.get()
}
// Splash展示完毕的监听方法
splashScreen.setOnExitAnimationListener(object : SplashScreen.OnExitAnimationListener {
override fun onSplashScreenExit(splashScreenViewProvider: SplashScreenViewProvider) {
startActivity(Intent(this@SystemStartActivity, MyStartActivity::class.java))
this@SystemStartActivity.finish()
overridePendingTransition(0, 0)
mKeepOnAtomicBool.compareAndSet(true, false)
}
})
}
}
\ No newline at end of file
......@@ -8,7 +8,7 @@ import android.graphics.drawable.Icon
import android.os.Build
import com.base.pdfreaderallpdfreader.R
import com.base.pdfreaderallpdfreader.bean.ConstObject
import com.base.pdfreaderallpdfreader.ui.splash.SplashActivity
import com.base.pdfreaderallpdfreader.ui.splash.MyStartActivity
object ShortcutUtils {
......@@ -23,7 +23,7 @@ object ShortcutUtils {
val shortcut1 = ShortcutInfo.Builder(this, "11111")
.setShortLabel("Scan Pdf")
.setIcon(Icon.createWithResource(this, R.mipmap.pdf_scan_short))
.setIntent(Intent(Intent.ACTION_MAIN, null, this, SplashActivity::class.java).apply {
.setIntent(Intent(Intent.ACTION_MAIN, null, this, MyStartActivity::class.java).apply {
putExtra("actionId", ConstObject.SHORTCUT_SCAN_PDF)
})
.build()
......@@ -31,7 +31,7 @@ object ShortcutUtils {
val shortcut2 = ShortcutInfo.Builder(this, "22222")
.setShortLabel("Split Pdf")
.setIcon(Icon.createWithResource(this, R.mipmap.pdf_split_short))
.setIntent(Intent(Intent.ACTION_MAIN, null, this, SplashActivity::class.java).apply {
.setIntent(Intent(Intent.ACTION_MAIN, null, this, MyStartActivity::class.java).apply {
putExtra("actionId", ConstObject.SHORTCUT_SPLIT_PDF)
})
.build()
......@@ -39,7 +39,7 @@ object ShortcutUtils {
val shortcut3 = ShortcutInfo.Builder(this, "33333")
.setShortLabel("Merge Pdf")
.setIcon(Icon.createWithResource(this, R.mipmap.pdf_merge_short))
.setIntent(Intent(Intent.ACTION_MAIN, null, this, SplashActivity::class.java).apply {
.setIntent(Intent(Intent.ACTION_MAIN, null, this, MyStartActivity::class.java).apply {
putExtra("actionId", ConstObject.SHORTCUT_MERGE_PDF)
})
.build()
......
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/qdyebg" />
<!-- <item-->
<!-- android:gravity="top|center_horizontal"-->
<!-- android:top="220dp">-->
<!-- <bitmap android:src="" />-->
<!-- </item>-->
<item android:drawable="@color/white" />
<item android:gravity="top|center_horizontal">
<bitmap android:src="@mipmap/qdyebg" />
</item>
</layer-list>
\ No newline at end of file
......@@ -6,7 +6,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/splash_bp"
tools:context=".ui.splash.SplashActivity">
tools:context=".ui.splash.MyStartActivity">
<ImageView
android:id="@+id/iv_logo"
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.splash.SystemStartActivity">
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="splash.theme" parent="Theme.AppCompat.DayNight.NoActionBar">
<item name="android:windowBackground">@drawable/splash_bp</item>
<item name="android:windowFullscreen">false</item>
<item name="android:forceDarkAllowed">false</item>
</style>
</resources>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- <style name="Theme.App.Starting" parent="Theme.SplashScreen">-->
<!-- &lt;!&ndash;启动画面背景颜色&ndash;&gt;-->
<!-- <item name="windowSplashScreenBackground">@color/black</item>-->
<!-- &lt;!&ndash; 启动画面icon图标:这里可以是图片、帧动画等&ndash;&gt;-->
<!-- <item name="windowSplashScreenAnimatedIcon">@drawable/logo_corners</item>-->
<!-- &lt;!&ndash; <item name="windowSplashScreenIconBackgroundColor">@color/splashscreen_icon_bg</item>&ndash;&gt;-->
<!-- &lt;!&ndash; icon动画在关闭之前显示的时长:最长时间为1000毫秒&ndash;&gt;-->
<!-- <item name="windowSplashScreenAnimationDuration">1000</item>-->
<!-- &lt;!&ndash; 启动画面底部的 Brand 图片&ndash;&gt;-->
<!-- <item name="android:windowSplashScreenBrandingImage">@drawable/logo_corners</item>-->
<!-- &lt;!&ndash; Splash退出后的主题&ndash;&gt;-->
<!-- <item name="postSplashScreenTheme">@style/Theme.PdfReaderAllPdfReader</item>-->
<!-- </style>-->
</resources>
\ No newline at end of file
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Base.Theme.PdfReaderAllPdfReader" parent="Theme.Material3.DayNight.NoActionBar">
<style name="Base.Theme.PdfReaderAllPdfReader" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your light theme here. -->
<!-- <item name="colorPrimary">@color/my_light_primary</item> -->
</style>
......@@ -22,7 +22,7 @@
</style>
<style name="Theme.PdfReaderAllPdfReader.PopupOverlay" parent="ThemeOverlay.AppCompat.Light"/>
<style name="Theme.PdfReaderAllPdfReader.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="BottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/bottomSheetStyleWrapper</item>
......@@ -32,5 +32,19 @@
<item name="android:background">@android:color/transparent</item>
</style>
<style name="Theme.App.Starting" parent="Theme.SplashScreen">
<!--启动画面背景颜色-->
<item name="windowSplashScreenBackground">@color/white</item>
<!-- <item name="android:windowBackground">@drawable/splash_bp</item>-->
<!-- 启动画面icon图标:这里可以是图片、帧动画等-->
<item name="windowSplashScreenAnimatedIcon">@drawable/logo</item>
<item name="splashScreenIconSize">50dp</item>
<item name="windowSplashScreenIconBackgroundColor">@android:color/transparent</item>
<!-- icon动画在关闭之前显示的时长:最长时间为1000毫秒-->
<item name="windowSplashScreenAnimationDuration">100</item>
<!-- Splash退出后的主题-->
<item name="postSplashScreenTheme">@style/Theme.PdfReaderAllPdfReader</item>
</style>
</resources>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment