Apply project's code style to api version checks

This commit is contained in:
Ebrahim Byagowi 2021-12-06 01:32:45 +03:30
parent 0e1a1cfb90
commit dd8cd61450
3 changed files with 9 additions and 3 deletions

View file

@ -716,7 +716,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun createShortcut() { private fun createShortcut() {
if (!isOreoPlus()) return if (!isOreoPlus()) {
return
}
val manager = getSystemService(ShortcutManager::class.java) val manager = getSystemService(ShortcutManager::class.java)
if (manager.isRequestPinShortcutSupported) { if (manager.isRequestPinShortcutSupported) {
val medium = getCurrentMedium() ?: return val medium = getCurrentMedium() ?: return

View file

@ -549,7 +549,9 @@ class DirectoryAdapter(
} }
private fun createShortcut() { private fun createShortcut() {
if (!isOreoPlus()) return if (!isOreoPlus()) {
return
}
val manager = activity.getSystemService(ShortcutManager::class.java) val manager = activity.getSystemService(ShortcutManager::class.java)
if (manager.isRequestPinShortcutSupported) { if (manager.isRequestPinShortcutSupported) {
val dir = getFirstSelectedItem() ?: return val dir = getFirstSelectedItem() ?: return

View file

@ -386,7 +386,9 @@ class MediaAdapter(
} }
private fun createShortcut() { private fun createShortcut() {
if (!isOreoPlus()) return if (!isOreoPlus()) {
return
}
val manager = activity.getSystemService(ShortcutManager::class.java) val manager = activity.getSystemService(ShortcutManager::class.java)
if (manager.isRequestPinShortcutSupported) { if (manager.isRequestPinShortcutSupported) {
val path = getSelectedPaths().first() val path = getSelectedPaths().first()