SB
Size: a a a
SB
SB
SB
SB
ДК
S
BL
AM
BL
AM
private fun openGalleryForImages() {
if (Build.VERSION.SDK_INT < 19) {
val intent = Intent()
intent.type = "image/*"
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
intent.action = Intent.ACTION_GET_CONTENT
startActivityForResult(
Intent.createChooser(intent, "Choose Pictures")
, REQUEST_CODE
)
}
else { // For latest versions API LEVEL 19+
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = "image/*"
startActivityForResult(intent, REQUEST_CODE);
}
}
AS
private fun openGalleryForImages() {
if (Build.VERSION.SDK_INT < 19) {
val intent = Intent()
intent.type = "image/*"
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
intent.action = Intent.ACTION_GET_CONTENT
startActivityForResult(
Intent.createChooser(intent, "Choose Pictures")
, REQUEST_CODE
)
}
else { // For latest versions API LEVEL 19+
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true)
intent.addCategory(Intent.CATEGORY_OPENABLE)
intent.type = "image/*"
startActivityForResult(intent, REQUEST_CODE);
}
}
AM
AS
AM
val pathToFile = context?.let { getRealPathFromURI_API19(it,data?.data) }
val image:File? = pathToFile?.let { File(it) }
СР
V
BL
val pathToFile = context?.let { getRealPathFromURI_API19(it,data?.data) }
val image:File? = pathToFile?.let { File(it) }
АМ
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
private fun onAppBackgrounded() {
Log.d("MainActivity", "App in background")
isAppInBackground = true
}
@OnLifecycleEvent(Lifecycle.Event.ON_START)
private fun onAppForegrounded() {
Log.d("MainActivity", "App in foreground")
isAppInBackground = false
}
СП
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
private fun onAppBackgrounded() {
Log.d("MainActivity", "App in background")
isAppInBackground = true
}
@OnLifecycleEvent(Lifecycle.Event.ON_START)
private fun onAppForegrounded() {
Log.d("MainActivity", "App in foreground")
isAppInBackground = false
}