show Portrait photos by default only on Android 9+

This commit is contained in:
tibbi 2020-04-24 17:55:10 +02:00
parent 1b1fac9b56
commit 25177e6d3d
4 changed files with 12 additions and 4 deletions

View File

@ -1065,7 +1065,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (mIsSearchOpen) {
directories_empty_placeholder.text = getString(R.string.no_items_found)
directories_empty_placeholder_2.beGone()
} else if (dirs.isEmpty() && config.filterMedia == TYPE_DEFAULT_FILTER) {
} else if (dirs.isEmpty() && config.filterMedia == getDefaultFileFilter()) {
directories_empty_placeholder.text = getString(R.string.no_media_add_included)
directories_empty_placeholder_2.text = getString(R.string.add_folder)

View File

@ -46,7 +46,7 @@ class FilterMediaDialog(val activity: BaseSimpleActivity, val callback: (result:
result += TYPE_PORTRAITS
if (result == 0) {
result = TYPE_DEFAULT_FILTER
result = getDefaultFileFilter()
}
activity.config.filterMedia = result

View File

@ -191,7 +191,7 @@ class Config(context: Context) : BaseConfig(context) {
set(blackBackground) = prefs.edit().putBoolean(BLACK_BACKGROUND, blackBackground).apply()
var filterMedia: Int
get() = prefs.getInt(FILTER_MEDIA, TYPE_DEFAULT_FILTER)
get() = prefs.getInt(FILTER_MEDIA, getDefaultFileFilter())
set(filterMedia) = prefs.edit().putInt(FILTER_MEDIA, filterMedia).apply()
var dirColumnCnt: Int

View File

@ -1,6 +1,7 @@
package com.simplemobiletools.gallery.pro.helpers
import com.simplemobiletools.commons.helpers.MONTH_SECONDS
import com.simplemobiletools.commons.helpers.isPiePlus
// shared preferences
const val DIRECTORY_SORT_ORDER = "directory_sort_order"
@ -169,7 +170,14 @@ const val TYPE_GIFS = 4
const val TYPE_RAWS = 8
const val TYPE_SVGS = 16
const val TYPE_PORTRAITS = 32
const val TYPE_DEFAULT_FILTER = TYPE_IMAGES or TYPE_VIDEOS or TYPE_GIFS or TYPE_RAWS or TYPE_SVGS or TYPE_PORTRAITS
fun getDefaultFileFilter(): Int {
var types = TYPE_IMAGES or TYPE_VIDEOS or TYPE_GIFS or TYPE_RAWS or TYPE_SVGS
if (isPiePlus()) {
types += TYPE_PORTRAITS
}
return types
}
const val LOCATION_INTERNAL = 1
const val LOCATION_SD = 2