Commit 4fd3243f authored by mengcuiguang's avatar mengcuiguang

代码优化

parent e87cb222
......@@ -81,9 +81,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="is_launcher"
android:value="true" />
</activity>
<activity
......
package com.duben.miniplaylet.ui.activitys
import android.annotation.SuppressLint
import android.content.pm.PackageManager
import android.os.Bundle
import android.view.KeyEvent
import android.view.View
......@@ -51,22 +50,6 @@ class SplashActivity : BaseActivity() {
mProgressBar = findViewById(R.id.progressBar)
showPowerDialog()
val isLaunchedFromLauncher = isLaunchedFromLauncher()
if (isLaunchedFromLauncher) {
println("mcg -->>>应用是通过点击桌面图标启动的")
// 应用是通过点击桌面图标启动的
} else {
println("mcg -->>>应用是从后台恢复的")
// 应用是从后台恢复的
}
}
private fun isLaunchedFromLauncher(): Boolean {
val activityInfo = packageManager.getActivityInfo(componentName, PackageManager.GET_META_DATA)
val bundle = activityInfo.metaData
return bundle != null && bundle.getBoolean("is_launcher", false)
}
override fun finish() {
......
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