Check for api version at the target instead marking with RequiresApi
This commit is contained in:
parent
55499815c3
commit
0e1a1cfb90
|
@ -27,7 +27,6 @@ import android.view.View
|
|||
import android.view.WindowManager
|
||||
import android.view.animation.DecelerateInterpolator
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.exifinterface.media.ExifInterface
|
||||
import androidx.print.PrintHelper
|
||||
import androidx.viewpager.widget.ViewPager
|
||||
|
@ -239,7 +238,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
R.id.menu_force_landscape -> toggleOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)
|
||||
R.id.menu_default_orientation -> toggleOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED)
|
||||
R.id.menu_save_as -> saveImageAs()
|
||||
R.id.menu_create_shortcut -> if (isOreoPlus()) createShortcut()
|
||||
R.id.menu_create_shortcut -> createShortcut()
|
||||
R.id.menu_resize -> resizeImage()
|
||||
R.id.menu_settings -> launchSettings()
|
||||
else -> return super.onOptionsItemSelected(item)
|
||||
|
@ -716,8 +715,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun createShortcut() {
|
||||
if (!isOreoPlus()) return
|
||||
val manager = getSystemService(ShortcutManager::class.java)
|
||||
if (manager.isRequestPinShortcutSupported) {
|
||||
val medium = getCurrentMedium() ?: return
|
||||
|
|
|
@ -157,7 +157,7 @@ class DirectoryAdapter(
|
|||
R.id.cab_copy_to -> copyMoveTo(true)
|
||||
R.id.cab_move_to -> moveFilesTo()
|
||||
R.id.cab_select_all -> selectAll()
|
||||
R.id.cab_create_shortcut -> if (isOreoPlus()) tryCreateShortcut()
|
||||
R.id.cab_create_shortcut -> tryCreateShortcut()
|
||||
R.id.cab_delete -> askConfirmDelete()
|
||||
R.id.cab_select_photo -> tryChangeAlbumCover(false)
|
||||
R.id.cab_use_default -> tryChangeAlbumCover(true)
|
||||
|
@ -540,7 +540,6 @@ class DirectoryAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun tryCreateShortcut() {
|
||||
activity.handleLockedFolderOpening(getFirstSelectedItemPath() ?: "") { success ->
|
||||
if (success) {
|
||||
|
@ -549,8 +548,8 @@ class DirectoryAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun createShortcut() {
|
||||
if (!isOreoPlus()) return
|
||||
val manager = activity.getSystemService(ShortcutManager::class.java)
|
||||
if (manager.isRequestPinShortcutSupported) {
|
||||
val dir = getFirstSelectedItem() ?: return
|
||||
|
|
|
@ -4,14 +4,12 @@ import android.content.Intent
|
|||
import android.content.pm.ShortcutInfo
|
||||
import android.content.pm.ShortcutManager
|
||||
import android.graphics.drawable.Icon
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.Menu
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.bumptech.glide.Glide
|
||||
import com.qtalk.recyclerviewfastscroller.RecyclerViewFastScroller
|
||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
|
@ -175,7 +173,7 @@ class MediaAdapter(
|
|||
R.id.cab_rotate_one_eighty -> rotateSelection(180)
|
||||
R.id.cab_copy_to -> copyMoveTo(true)
|
||||
R.id.cab_move_to -> moveFilesTo()
|
||||
R.id.cab_create_shortcut -> if (isOreoPlus()) createShortcut()
|
||||
R.id.cab_create_shortcut -> createShortcut()
|
||||
R.id.cab_select_all -> selectAll()
|
||||
R.id.cab_open_with -> openPath()
|
||||
R.id.cab_fix_date_taken -> fixDateTaken()
|
||||
|
@ -387,8 +385,8 @@ class MediaAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun createShortcut() {
|
||||
if (!isOreoPlus()) return
|
||||
val manager = activity.getSystemService(ShortcutManager::class.java)
|
||||
if (manager.isRequestPinShortcutSupported) {
|
||||
val path = getSelectedPaths().first()
|
||||
|
|
Loading…
Reference in New Issue