add placeholders when no media is shown because of filters

This commit is contained in:
tibbi 2017-08-28 23:57:48 +02:00
parent ab35c970b9
commit 21a2e2a6b1
22 changed files with 99 additions and 1 deletions

View file

@ -78,6 +78,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
mStoredScrollHorizontally = config.scrollHorizontally
storeStoragePaths()
checkWhatsNewDialog()
directories_empty_text.setOnClickListener {
showFilterMediaDialog()
}
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
@ -130,6 +134,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
tryloadGallery()
invalidateOptionsMenu()
directories_empty_text_label.setTextColor(config.textColor)
directories_empty_text.setTextColor(config.primaryColor)
}
override fun onPause() {
@ -395,6 +401,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
directories_refresh_layout.isRefreshing = false
mIsGettingDirs = false
directories_empty_text_label.beVisibleIf(dirs.isEmpty() && !isFromCache)
directories_empty_text.beVisibleIf(dirs.isEmpty() && !isFromCache)
checkLastMediaChanged()
if (dirs.hashCode() == mDirs.hashCode())
return

View file

@ -75,6 +75,10 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mShowAll = config.showAll
if (mShowAll)
supportActionBar?.setDisplayHomeAsUpEnabled(false)
media_empty_text.setOnClickListener {
showFilterMediaDialog()
}
}
override fun onResume() {
@ -97,6 +101,8 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
tryloadGallery()
invalidateOptionsMenu()
media_empty_text_label.setTextColor(config.textColor)
media_empty_text.setTextColor(config.primaryColor)
}
override fun onPause() {
@ -317,7 +323,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
}
private fun isDirEmpty(): Boolean {
return if (mMedia.size <= 0) {
return if (mMedia.size <= 0 && config.filterMedia > 0) {
deleteDirectoryIfEmpty()
finish()
true
@ -459,6 +465,9 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
mIsGettingMedia = false
media_refresh_layout.isRefreshing = false
media_empty_text_label.beVisibleIf(media.isEmpty() && !isFromCache)
media_empty_text.beVisibleIf(media.isEmpty() && !isFromCache)
checkLastMediaChanged()
if (mLastDrawnHashCode == 0)
mLastDrawnHashCode = media.hashCode()

View file

@ -11,6 +11,28 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/directories_empty_text_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin"
android:paddingRight="@dimen/big_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/no_media_with_filters"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/directories_empty_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/directories_empty_text_label"
android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"
android:text="@string/change_filters_underlined"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyScalableRecyclerView
android:id="@+id/directories_grid"
android:layout_width="match_parent"

View file

@ -11,6 +11,28 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_empty_text_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:paddingLeft="@dimen/big_margin"
android:paddingRight="@dimen/big_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/no_media_with_filters"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/media_empty_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/media_empty_text_label"
android:layout_centerHorizontal="true"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin"
android:text="@string/change_filters_underlined"
android:visibility="gone"/>
<com.simplemobiletools.commons.views.MyScalableRecyclerView
android:id="@+id/media_grid"
android:layout_width="match_parent"

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Tato funkce skryje složku, včetně podsložek, přidáním souboru \'.nomedia\'. Zobrazíte je zvolením možnosti \'Zobrazit skryté složky\' v nastavení. Pokračovat?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Diese Funktion versteckt ausgewählte Ordner (auch für andere Apps), indem dort im Dateisystem eine \'.nomedia\'-Datei abgelegt wird. Dadurch werden auch deren Unterordner versteckt. Solche Ordner werden nur gezeigt, wenn die Einstellung \'Versteckte Ordner zeigen\' aktiv ist (auch andere Apps bieten üblicherweise eine solche Option). Fortfahren?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Esta función oculta la carpeta agregando un archivo \'.nomedia\' en ella, y ocultará también las subcarpetas. Puede mostrarlas cambiando la opción \'Mostrar carpetas ocultas\' en los Ajustes. ¿Continuar?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Cette option masque le dossier en ajoutant un fichier \'.nomedia\' à l\'intérieur, cela masquera aussi tous les sous-dossiers. Vous pouvez les voir en modifiant l\'option \'Afficher les dossiers cachés\' dans les Paramètres. Continuer ?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Questa funzione nasconde la cartella aggiungendo un file \'.nomedia\' all\'interno, nasconderà anche tutte le sottocartelle. Puoi vederle attivando l\'opzione \'Mostra cartelle nascoste\' nelle impostazioni. Continuare?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Ta funkcja ukrywa foldery dodając do nich pusty plik .nomedia. Aby móc je zobaczyć, należy włączyć opcję \'Pokazuj ukryte foldery\' w ustawieniach. Kontyntynuować?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Esta opção oculta uma pasta com a adição de um arquivo \'.nomedia\' dentro dela, e irá ocultar todas as subpastas que estejam dentro da mesma. Você poderá rever essas pastas com a opção \'Mostrar pastas ocultas\'. Continuar?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Esta opção oculta uma pasta com a adição de um ficheiro \'.nomedia\' na pasta, e irá ocultar todas as subpastas existentes. Pode ver as pastas com a opção \'Mostrar pastas ocultas\'. Continuar?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Эта опция скрывает папку, добавляя в неё файл \'.nomedia\'; будут скрыты все подпапки. Можно показывать их, переключая \'Показать скрытые папки\' в настройках. Продолжить?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Obrázky</string>
<string name="videos">Videá</string>
<string name="gifs">GIFká</string>
<string name="no_media_with_filters">So zvolenými filtrami sa nenašli žiadne média súbory.</string>
<string name="change_filters_underlined"><u>Zmeniť filtre</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Táto funkcia skryje priečinok pridaním súboru \'.nomedia\', skryté budú aj podpriečinky. Môžete ich vidieť zvolením možnosti \'Zobraziť skryté priečinky\' v nastaveniach. Pokračovať?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Denna funktion döljer mappen och alla dess undermappar genom att lägga till en \'.nomedia\'-fil i den. Du kan se dem genom att växla \'Visa dolda mappar\'-alternativet i Inställningar. Vill du fortsätta?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">Bu işlev, klasöre\'.medya yok\'dosyası ekleyerek gizler; tüm alt klasörleri de gizler. Bunları Ayarlar\'da\'Gizli klasörleri göster\'seçeneğine basarak görebilirsiniz. Devam et?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">通过添加文件 \'.nomedia\' 到目录,可以防止目录及其子目录下的所有媒体被扫描。您可以通过设置中的 \'显示隐藏目录\' 选项改变设置,是否继续?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">這功能藉由添加一個\'.nomedia\'檔案,來隱藏資料夾和所有子資料夾。您可以透過設定中的「顯示隱藏的資料夾」選項來查看。\n是否繼續?</string>

View file

@ -31,6 +31,8 @@
<string name="images">Images</string>
<string name="videos">Videos</string>
<string name="gifs">GIFs</string>
<string name="no_media_with_filters">No media files have been found with the selected filters.</string>
<string name="change_filters_underlined"><u>Change filters</u></string>
<!-- Hide / Exclude -->
<string name="hide_folder_description">This function hides the folder by adding a \'.nomedia\' file into it, it will hide all subfolders too. You can see them by toggling the \'Show hidden folders\' option in Settings. Continue?</string>