update the placeholder text appropriately if no media files are found
This commit is contained in:
parent
a9cf7f9d8c
commit
37a04d300b
6 changed files with 36 additions and 14 deletions
|
@ -61,7 +61,7 @@ android {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.simplemobiletools:commons:5.13.0'
|
implementation 'com.simplemobiletools:commons:5.13.1'
|
||||||
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
|
||||||
implementation 'androidx.multidex:multidex:2.0.1'
|
implementation 'androidx.multidex:multidex:2.0.1'
|
||||||
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
implementation 'it.sephiroth.android.exif:library:1.0.1'
|
||||||
|
|
|
@ -3,9 +3,7 @@ package com.simplemobiletools.gallery.pro.activities
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.Menu
|
import android.view.Menu
|
||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
|
||||||
import com.simplemobiletools.commons.extensions.beVisibleIf
|
import com.simplemobiletools.commons.extensions.beVisibleIf
|
||||||
import com.simplemobiletools.commons.extensions.scanPathRecursively
|
|
||||||
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
import com.simplemobiletools.commons.interfaces.RefreshRecyclerViewListener
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.adapters.ManageFoldersAdapter
|
import com.simplemobiletools.gallery.pro.adapters.ManageFoldersAdapter
|
||||||
|
@ -50,13 +48,8 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addFolder() {
|
private fun addFolder() {
|
||||||
FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true) {
|
showAddIncludedFolderDialog {
|
||||||
config.lastFilepickerPath = it
|
|
||||||
config.addIncludedFolder(it)
|
|
||||||
updateFolders()
|
updateFolders()
|
||||||
Thread {
|
|
||||||
scanPathRecursively(it)
|
|
||||||
}.start()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,10 +117,6 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
storeStateVariables()
|
storeStateVariables()
|
||||||
checkWhatsNewDialog()
|
checkWhatsNewDialog()
|
||||||
|
|
||||||
directories_empty_text.setOnClickListener {
|
|
||||||
showFilterMediaDialog()
|
|
||||||
}
|
|
||||||
|
|
||||||
mIsPasswordProtectionPending = config.isAppPasswordProtectionOn
|
mIsPasswordProtectionPending = config.isAppPasswordProtectionOn
|
||||||
setupLatestMediaId()
|
setupLatestMediaId()
|
||||||
|
|
||||||
|
@ -1003,6 +999,25 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
private fun checkPlaceholderVisibility(dirs: ArrayList<Directory>) {
|
private fun checkPlaceholderVisibility(dirs: ArrayList<Directory>) {
|
||||||
directories_empty_text_label.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos)
|
directories_empty_text_label.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos)
|
||||||
directories_empty_text.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos)
|
directories_empty_text.beVisibleIf(dirs.isEmpty() && mLoadedInitialPhotos)
|
||||||
|
|
||||||
|
if (dirs.isEmpty() && config.filterMedia == TYPE_DEFAULT_FILTER) {
|
||||||
|
directories_empty_text_label.text = getString(R.string.no_media_add_included)
|
||||||
|
directories_empty_text.text = getString(R.string.add_folder)
|
||||||
|
directories_empty_text.underlineText()
|
||||||
|
|
||||||
|
directories_empty_text.setOnClickListener {
|
||||||
|
showAddIncludedFolderDialog {
|
||||||
|
refreshItems()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
directories_empty_text_label.text = getString(R.string.no_media_with_filters)
|
||||||
|
directories_empty_text.text = getString(R.string.change_filters_underlined)
|
||||||
|
directories_empty_text.setOnClickListener {
|
||||||
|
showFilterMediaDialog()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
directories_grid.beVisibleIf(directories_empty_text_label.isGone())
|
directories_grid.beVisibleIf(directories_empty_text_label.isGone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,10 @@ import android.net.Uri
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||||
|
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||||
import com.simplemobiletools.commons.extensions.getParentPath
|
import com.simplemobiletools.commons.extensions.getParentPath
|
||||||
import com.simplemobiletools.commons.extensions.getRealPathFromURI
|
import com.simplemobiletools.commons.extensions.getRealPathFromURI
|
||||||
|
import com.simplemobiletools.commons.extensions.scanPathRecursively
|
||||||
import com.simplemobiletools.commons.helpers.isPiePlus
|
import com.simplemobiletools.commons.helpers.isPiePlus
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.extensions.addPathToDB
|
import com.simplemobiletools.gallery.pro.extensions.addPathToDB
|
||||||
|
@ -79,4 +81,15 @@ open class SimpleActivity : BaseSimpleActivity() {
|
||||||
} catch (ignored: Exception) {
|
} catch (ignored: Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected fun showAddIncludedFolderDialog(callback: () -> Unit) {
|
||||||
|
FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true) {
|
||||||
|
config.lastFilepickerPath = it
|
||||||
|
config.addIncludedFolder(it)
|
||||||
|
callback()
|
||||||
|
Thread {
|
||||||
|
scanPathRecursively(it)
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -203,7 +203,7 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
set(blackBackground) = prefs.edit().putBoolean(BLACK_BACKGROUND, blackBackground).apply()
|
set(blackBackground) = prefs.edit().putBoolean(BLACK_BACKGROUND, blackBackground).apply()
|
||||||
|
|
||||||
var filterMedia: Int
|
var filterMedia: Int
|
||||||
get() = prefs.getInt(FILTER_MEDIA, TYPE_IMAGES or TYPE_VIDEOS or TYPE_GIFS or TYPE_RAWS or TYPE_SVGS)
|
get() = prefs.getInt(FILTER_MEDIA, TYPE_DEFAULT_FILTER)
|
||||||
set(filterMedia) = prefs.edit().putInt(FILTER_MEDIA, filterMedia).apply()
|
set(filterMedia) = prefs.edit().putInt(FILTER_MEDIA, filterMedia).apply()
|
||||||
|
|
||||||
var dirColumnCnt: Int
|
var dirColumnCnt: Int
|
||||||
|
|
|
@ -154,6 +154,7 @@ const val TYPE_VIDEOS = 2
|
||||||
const val TYPE_GIFS = 4
|
const val TYPE_GIFS = 4
|
||||||
const val TYPE_RAWS = 8
|
const val TYPE_RAWS = 8
|
||||||
const val TYPE_SVGS = 16
|
const val TYPE_SVGS = 16
|
||||||
|
const val TYPE_DEFAULT_FILTER = TYPE_IMAGES or TYPE_VIDEOS or TYPE_GIFS or TYPE_RAWS or TYPE_SVGS
|
||||||
|
|
||||||
const val LOCATION_INTERNAL = 1
|
const val LOCATION_INTERNAL = 1
|
||||||
const val LOCATION_SD = 2
|
const val LOCATION_SD = 2
|
||||||
|
|
Loading…
Reference in a new issue