diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt index 46e609400..a56ca076a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SetWallpaperActivity.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.gallery.pro.activities -import android.annotation.SuppressLint import android.app.Activity import android.app.WallpaperManager import android.content.Intent @@ -100,7 +99,6 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete setupAspectRatio() } - @SuppressLint("InlinedApi") private fun confirmWallpaper() { if (isNougatPlus()) { val items = arrayListOf( @@ -118,7 +116,6 @@ class SetWallpaperActivity : SimpleActivity(), CropImageView.OnCropImageComplete } } - @SuppressLint("NewApi") override fun onCropImageComplete(view: CropImageView?, result: CropImageView.CropResult) { if (isDestroyed) return diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SimpleActivity.kt index 95b9f5841..6d02ad838 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SimpleActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SimpleActivity.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.gallery.pro.activities -import android.annotation.SuppressLint import android.database.ContentObserver import android.net.Uri import android.provider.MediaStore.Images @@ -56,7 +55,6 @@ open class SimpleActivity : BaseSimpleActivity() { override fun getAppLauncherName() = getString(R.string.app_launcher_name) - @SuppressLint("InlinedApi") protected fun checkNotchSupport() { if (isPiePlus()) { val cutoutMode = when { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 8a4bf4e63..04a2ac467 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -333,7 +333,6 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - @SuppressLint("NewApi") private fun initContinue() { if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) { if (isShowHiddenFlagNeeded()) { @@ -716,8 +715,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } - @SuppressLint("NewApi") private fun createShortcut() { + if (!isOreoPlus()) { + return + } + val manager = getSystemService(ShortcutManager::class.java) if (manager.isRequestPinShortcutSupported) { val medium = getCurrentMedium() ?: return diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index ed6a021cd..84e92b726 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -1,17 +1,18 @@ package com.simplemobiletools.gallery.pro.adapters -import android.annotation.SuppressLint import android.content.Intent import android.content.pm.ShortcutInfo import android.content.pm.ShortcutManager import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Icon +import android.os.Build import android.text.TextUtils import android.view.Menu import android.view.MotionEvent import android.view.View import android.view.ViewGroup import android.widget.RelativeLayout +import androidx.annotation.RequiresApi import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.RecyclerView import androidx.swiperefreshlayout.widget.SwipeRefreshLayout @@ -540,6 +541,10 @@ class DirectoryAdapter( } private fun tryCreateShortcut() { + if (!isOreoPlus()) { + return + } + activity.handleLockedFolderOpening(getFirstSelectedItemPath() ?: "") { success -> if (success) { createShortcut() @@ -547,7 +552,6 @@ class DirectoryAdapter( } } - @SuppressLint("NewApi") private fun createShortcut() { val manager = activity.getSystemService(ShortcutManager::class.java) if (manager.isRequestPinShortcutSupported) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index f9a0bd45d..6e3e0438f 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.gallery.pro.adapters -import android.annotation.SuppressLint import android.content.Intent import android.content.pm.ShortcutInfo import android.content.pm.ShortcutManager @@ -34,8 +33,8 @@ import com.simplemobiletools.gallery.pro.models.ThumbnailSection import kotlinx.android.synthetic.main.photo_item_grid.view.* import kotlinx.android.synthetic.main.thumbnail_section.view.* import kotlinx.android.synthetic.main.video_item_grid.view.* -import kotlinx.android.synthetic.main.video_item_grid.view.media_item_holder import kotlinx.android.synthetic.main.video_item_grid.view.favorite +import kotlinx.android.synthetic.main.video_item_grid.view.media_item_holder import kotlinx.android.synthetic.main.video_item_grid.view.medium_check import kotlinx.android.synthetic.main.video_item_grid.view.medium_name import kotlinx.android.synthetic.main.video_item_grid.view.medium_thumbnail @@ -386,8 +385,11 @@ class MediaAdapter( } } - @SuppressLint("NewApi") private fun createShortcut() { + if (!isOreoPlus()) { + return + } + val manager = activity.getSystemService(ShortcutManager::class.java) if (manager.isRequestPinShortcutSupported) { val path = getSelectedPaths().first() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt index a1cc62167..b0796a4ad 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/MediaFetcher.kt @@ -1,6 +1,5 @@ package com.simplemobiletools.gallery.pro.helpers -import android.annotation.SuppressLint import android.content.ContentResolver import android.content.Context import android.database.Cursor @@ -119,7 +118,6 @@ class MediaFetcher(val context: Context) { } } - @SuppressLint("NewApi") private fun getLatestFileFolders(): LinkedHashSet { val uri = Files.getContentUri("external") val projection = arrayOf(Images.ImageColumns.DATA) @@ -408,7 +406,6 @@ class MediaFetcher(val context: Context) { return media } - @SuppressLint("InlinedApi") fun getAndroid11FolderMedia( isPickImage: Boolean, isPickVideo: Boolean, favoritePaths: ArrayList ): HashMap> {