properly handle exporting and importing thumbnail style related values

This commit is contained in:
tibbi 2020-11-08 20:04:39 +01:00
parent b613ab02ab
commit 042e50d8de
5 changed files with 8 additions and 20 deletions

View file

@ -82,7 +82,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private var mStoredAnimateGifs = true
private var mStoredCropThumbnails = true
private var mStoredScrollHorizontally = true
private var mStoredShowMediaCount = true
private var mStoredTextColor = 0
private var mStoredPrimaryColor = 0
@ -174,10 +173,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
getRecyclerAdapter()?.updateCropThumbnails(config.cropThumbnails)
}
if (mStoredShowMediaCount != config.showMediaCount) {
getRecyclerAdapter()?.updateShowMediaCount(config.showMediaCount)
}
if (mStoredScrollHorizontally != config.scrollHorizontally) {
mLoadedInitialPhotos = false
directories_grid.adapter = null
@ -332,7 +327,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
mStoredAnimateGifs = animateGifs
mStoredCropThumbnails = cropThumbnails
mStoredScrollHorizontally = scrollHorizontally
mStoredShowMediaCount = showMediaCount
mStoredTextColor = textColor
mStoredPrimaryColor = primaryColor
}

View file

@ -650,7 +650,6 @@ class SettingsActivity : SimpleActivity() {
put(ANIMATE_GIFS, config.animateGifs)
put(CROP_THUMBNAILS, config.cropThumbnails)
put(SHOW_THUMBNAIL_VIDEO_DURATION, config.showThumbnailVideoDuration)
put(SHOW_MEDIA_COUNT, config.showMediaCount)
put(SCROLL_HORIZONTALLY, config.scrollHorizontally)
put(ENABLE_PULL_TO_REFRESH, config.enablePullToRefresh)
put(MAX_BRIGHTNESS, config.maxBrightness)
@ -704,6 +703,9 @@ class SettingsActivity : SimpleActivity() {
put(EDITOR_BRUSH_HARDNESS, config.editorBrushHardness)
put(EDITOR_BRUSH_SIZE, config.editorBrushSize)
put(ALBUM_COVERS, config.albumCovers)
put(FOLDER_THUMBNAIL_STYLE, config.folderStyle)
put(FOLDER_MEDIA_COUNT, config.showFolderMediaCount)
put(LIMIT_FOLDER_TITLE, config.limitFolderTitle)
}
exportSettings(configItems)
@ -785,7 +787,6 @@ class SettingsActivity : SimpleActivity() {
ANIMATE_GIFS -> config.animateGifs = value.toBoolean()
CROP_THUMBNAILS -> config.cropThumbnails = value.toBoolean()
SHOW_THUMBNAIL_VIDEO_DURATION -> config.showThumbnailVideoDuration = value.toBoolean()
SHOW_MEDIA_COUNT -> config.showMediaCount = value.toBoolean()
SCROLL_HORIZONTALLY -> config.scrollHorizontally = value.toBoolean()
ENABLE_PULL_TO_REFRESH -> config.enablePullToRefresh = value.toBoolean()
MAX_BRIGHTNESS -> config.maxBrightness = value.toBoolean()
@ -838,6 +839,9 @@ class SettingsActivity : SimpleActivity() {
EDITOR_BRUSH_COLOR -> config.editorBrushColor = value.toInt()
EDITOR_BRUSH_HARDNESS -> config.editorBrushHardness = value.toString().toFloat()
EDITOR_BRUSH_SIZE -> config.editorBrushSize = value.toString().toFloat()
FOLDER_THUMBNAIL_STYLE -> config.folderStyle = value.toInt()
FOLDER_MEDIA_COUNT -> config.showFolderMediaCount = value.toInt()
LIMIT_FOLDER_TITLE -> config.limitFolderTitle = value.toBoolean()
ALBUM_COVERS -> {
val existingCovers = config.parseAlbumCovers()
val existingCoverPaths = existingCovers.map { it.path }.toMutableList() as ArrayList<String>

View file

@ -46,7 +46,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST
private var pinnedFolders = config.pinnedFolders
private var scrollHorizontally = config.scrollHorizontally
private var showMediaCount = config.showMediaCount
private var showMediaCount = config.showFolderMediaCount
private var animateGifs = config.animateGifs
private var cropThumbnails = config.cropThumbnails
private var groupDirectSubfolders = config.groupDirectSubfolders
@ -653,11 +653,6 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
notifyDataSetChanged()
}
fun updateShowMediaCount(showMediaCount: Boolean) {
this.showMediaCount = showMediaCount
notifyDataSetChanged()
}
private fun setupView(view: View, directory: Directory) {
val isSelected = selectedKeys.contains(directory.path.hashCode())
view.apply {
@ -693,7 +688,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
dir_location.setImageResource(if (directory.location == LOCATION_SD) R.drawable.ic_sd_card_vector else R.drawable.ic_usb_vector)
}
photo_cnt.beVisibleIf(showMediaCount)
photo_cnt.beVisibleIf(showMediaCount == FOLDER_MEDIA_CNT_LINE)
if (isListViewType) {
dir_name.setTextColor(textColor)

View file

@ -272,10 +272,6 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(ALLOW_VIDEO_GESTURES, true)
set(allowVideoGestures) = prefs.edit().putBoolean(ALLOW_VIDEO_GESTURES, allowVideoGestures).apply()
var showMediaCount: Boolean
get() = prefs.getBoolean(SHOW_MEDIA_COUNT, true)
set(showMediaCount) = prefs.edit().putBoolean(SHOW_MEDIA_COUNT, showMediaCount).apply()
var slideshowInterval: Int
get() = prefs.getInt(SLIDESHOW_INTERVAL, SLIDESHOW_DEFAULT_INTERVAL)
set(slideshowInterval) = prefs.edit().putInt(SLIDESHOW_INTERVAL, slideshowInterval).apply()

View file

@ -40,7 +40,6 @@ const val HIDE_SYSTEM_UI = "hide_system_ui"
const val DELETE_EMPTY_FOLDERS = "delete_empty_folders"
const val ALLOW_PHOTO_GESTURES = "allow_photo_gestures"
const val ALLOW_VIDEO_GESTURES = "allow_video_gestures"
const val SHOW_MEDIA_COUNT = "show_media_count"
const val TEMP_FOLDER_PATH = "temp_folder_path"
const val VIEW_TYPE_FOLDERS = "view_type_folders"
const val VIEW_TYPE_FILES = "view_type_files"