Remove obsolete API level checks
This commit is contained in:
@@ -3,7 +3,6 @@ package de.mm20.launcher2.activity;
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.pm.LauncherApps
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import de.mm20.launcher2.favorites.FavoritesRepository
|
||||
import de.mm20.launcher2.search.data.AppShortcut
|
||||
@@ -15,18 +14,16 @@ class AddItemActivity : Activity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val launcherApps = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||
val pinRequest = launcherApps.getPinItemRequest(intent) ?: return run { finish() }
|
||||
val shortcutInfo = pinRequest.shortcutInfo ?: return run { finish() }
|
||||
val shortcut = AppShortcut(
|
||||
this.applicationContext, shortcutInfo,
|
||||
packageManager.getApplicationInfo(shortcutInfo.`package`, 0)
|
||||
.loadLabel(packageManager).toString()
|
||||
)
|
||||
if (pinRequest.accept()) {
|
||||
favoritesRepository.pinItem(shortcut)
|
||||
}
|
||||
val launcherApps = getSystemService(Context.LAUNCHER_APPS_SERVICE) as LauncherApps
|
||||
val pinRequest = launcherApps.getPinItemRequest(intent) ?: return run { finish() }
|
||||
val shortcutInfo = pinRequest.shortcutInfo ?: return run { finish() }
|
||||
val shortcut = AppShortcut(
|
||||
this.applicationContext, shortcutInfo,
|
||||
packageManager.getApplicationInfo(shortcutInfo.`package`, 0)
|
||||
.loadLabel(packageManager).toString()
|
||||
)
|
||||
if (pinRequest.accept()) {
|
||||
favoritesRepository.pinItem(shortcut)
|
||||
}
|
||||
finish()
|
||||
}
|
||||
|
||||
@@ -96,11 +96,6 @@ class PreferencesAppearanceFragment : PreferenceFragmentCompat() {
|
||||
.show()
|
||||
true
|
||||
}
|
||||
|
||||
val systemBarsCategory = findPreference<PreferenceCategory>("system_bars")!!
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
||||
systemBarsCategory.removePreference(findPreference("light_nav_bar"))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user