adding some keyboard hiding

This commit is contained in:
tibbi 2022-02-12 12:06:29 +01:00
parent d671c4503a
commit 45c5ac9fe8
6 changed files with 17 additions and 4 deletions

View File

@ -485,6 +485,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
}
private fun launchSearchActivity() {
hideKeyboard()
Intent(this, SearchActivity::class.java).apply {
startActivity(this)
}
@ -522,6 +523,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (mIsThirdPartyIntent) {
handleMediaIntent(this)
} else {
hideKeyboard()
startActivity(this)
finish()
}
@ -835,6 +837,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
}
private fun handleMediaIntent(intent: Intent) {
hideKeyboard()
intent.apply {
if (mIsSetWallpaperIntent) {
putExtra(SET_WALLPAPER_INTENT, true)

View File

@ -288,6 +288,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
private fun startSlideshow() {
if (mMedia.isNotEmpty()) {
hideKeyboard()
Intent(this, ViewPagerActivity::class.java).apply {
val item = mMedia.firstOrNull { it is Medium } as? Medium ?: return
putExtra(SKIP_AUTHENTICATION, shouldSkipAuthentication())
@ -514,6 +515,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
}
private fun switchToFolderView() {
hideKeyboard()
config.showAll = false
startActivity(Intent(this, MainActivity::class.java))
finish()
@ -770,6 +772,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
}
private fun itemClicked(path: String) {
hideKeyboard()
if (isSetWallpaperIntent()) {
toast(R.string.setting_wallpaper)

View File

@ -72,6 +72,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
private fun checkIntent(savedInstanceState: Bundle? = null) {
if (intent.data == null && intent.action == Intent.ACTION_VIEW) {
hideKeyboard()
startActivity(Intent(this, MainActivity::class.java))
finish()
return
@ -198,6 +199,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
} catch (ignored: OutOfMemoryError) {
}
hideKeyboard()
if (isPanorama) {
Intent(applicationContext, PanoramaVideoActivity::class.java).apply {
putExtra(PATH, realPath)
@ -224,6 +226,7 @@ open class PhotoVideoActivity : SimpleActivity(), ViewPagerFragment.FragmentList
}
private fun sendViewPagerIntent(path: String) {
hideKeyboard()
Intent(this, ViewPagerActivity::class.java).apply {
putExtra(SKIP_AUTHENTICATION, intent.getBooleanExtra(SKIP_AUTHENTICATION, false))
putExtra(SHOW_FAVORITES, intent.getBooleanExtra(SHOW_FAVORITES, false))

View File

@ -1261,6 +1261,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
}
override fun launchViewVideoIntent(path: String) {
hideKeyboard()
ensureBackgroundThread {
val newUri = getFinalUriFromPath(path, BuildConfig.APPLICATION_ID) ?: return@ensureBackgroundThread
val mimeType = getUriMimeType(path, newUri)

View File

@ -31,6 +31,7 @@ import com.simplemobiletools.commons.models.FAQItem
import com.simplemobiletools.commons.models.FileDirItem
import com.simplemobiletools.gallery.pro.BuildConfig
import com.simplemobiletools.gallery.pro.R
import com.simplemobiletools.gallery.pro.activities.SettingsActivity
import com.simplemobiletools.gallery.pro.activities.SimpleActivity
import com.simplemobiletools.gallery.pro.dialogs.PickDirectoryDialog
import com.simplemobiletools.gallery.pro.helpers.RECYCLE_BIN
@ -77,6 +78,11 @@ fun Activity.launchCamera() {
launchActivityIntent(intent)
}
fun SimpleActivity.launchSettings() {
hideKeyboard()
startActivity(Intent(applicationContext, SettingsActivity::class.java))
}
fun SimpleActivity.launchAbout() {
val licenses = LICENSE_GLIDE or LICENSE_CROPPER or LICENSE_RTL or LICENSE_SUBSAMPLING or LICENSE_PATTERN or LICENSE_REPRINT or LICENSE_GIF_DRAWABLE or
LICENSE_PICASSO or LICENSE_EXOPLAYER or LICENSE_PANORAMA_VIEW or LICENSE_SANSELAN or LICENSE_FILTERS or LICENSE_GESTURE_VIEWS or

View File

@ -1,5 +1,6 @@
package com.simplemobiletools.gallery.pro.extensions
import android.app.Activity
import android.appwidget.AppWidgetManager
import android.content.ComponentName
import android.content.Context
@ -55,10 +56,6 @@ fun Context.getHumanizedFilename(path: String): String {
return humanized.substring(humanized.lastIndexOf("/") + 1)
}
fun Context.launchSettings() {
startActivity(Intent(applicationContext, SettingsActivity::class.java))
}
val Context.config: Config get() = Config.newInstance(applicationContext)
val Context.widgetsDB: WidgetsDao get() = GalleryDatabase.getInstance(applicationContext).WidgetsDao()