mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
add the dialogs for changing the view type
This commit is contained in:
parent
33a4b81279
commit
fc3565129d
24 changed files with 138 additions and 0 deletions
|
@ -18,9 +18,11 @@ import android.widget.FrameLayout
|
|||
import com.google.gson.Gson
|
||||
import com.simplemobiletools.commons.dialogs.CreateNewFolderDialog
|
||||
import com.simplemobiletools.commons.dialogs.FilePickerDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.SORT_BY_DATE_MODIFIED
|
||||
import com.simplemobiletools.commons.helpers.SORT_BY_DATE_TAKEN
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.models.Release
|
||||
import com.simplemobiletools.commons.views.MyScalableRecyclerView
|
||||
import com.simplemobiletools.gallery.BuildConfig
|
||||
|
@ -107,6 +109,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
R.id.filter -> showFilterMediaDialog()
|
||||
R.id.open_camera -> launchCamera()
|
||||
R.id.show_all -> showAllMedia()
|
||||
R.id.change_view_type -> changeViewType()
|
||||
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
||||
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
||||
R.id.create_new_folder -> createNewFolder()
|
||||
|
@ -245,6 +248,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
finish()
|
||||
}
|
||||
|
||||
private fun changeViewType() {
|
||||
val items = arrayListOf(
|
||||
RadioItem(VIEW_TYPE_GRID, getString(R.string.grid)),
|
||||
RadioItem(VIEW_TYPE_LIST, getString(R.string.list)))
|
||||
|
||||
RadioGroupDialog(this, items, config.viewTypeFolders) {
|
||||
config.viewTypeFolders = it as Int
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryToggleTemporarilyShowHidden() {
|
||||
if (config.temporarilyShowHidden) {
|
||||
toggleTemporarilyShowHidden(false)
|
||||
|
|
|
@ -20,7 +20,9 @@ import com.bumptech.glide.request.transition.Transition
|
|||
import com.google.gson.Gson
|
||||
import com.google.gson.reflect.TypeToken
|
||||
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
|
||||
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.models.RadioItem
|
||||
import com.simplemobiletools.commons.views.MyScalableRecyclerView
|
||||
import com.simplemobiletools.gallery.R
|
||||
import com.simplemobiletools.gallery.adapters.MediaAdapter
|
||||
|
@ -223,6 +225,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
R.id.toggle_filename -> toggleFilenameVisibility()
|
||||
R.id.open_camera -> launchCamera()
|
||||
R.id.folder_view -> switchToFolderView()
|
||||
R.id.change_view_type -> changeViewType()
|
||||
R.id.hide_folder -> tryHideFolder()
|
||||
R.id.unhide_folder -> unhideFolder()
|
||||
R.id.exclude_folder -> tryExcludeFolder()
|
||||
|
@ -262,6 +265,16 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
|||
finish()
|
||||
}
|
||||
|
||||
private fun changeViewType() {
|
||||
val items = arrayListOf(
|
||||
RadioItem(VIEW_TYPE_GRID, getString(R.string.grid)),
|
||||
RadioItem(VIEW_TYPE_LIST, getString(R.string.list)))
|
||||
|
||||
RadioGroupDialog(this, items, config.viewTypeFiles) {
|
||||
config.viewTypeFiles = it as Int
|
||||
}
|
||||
}
|
||||
|
||||
private fun tryHideFolder() {
|
||||
if (config.wasHideFolderTooltipShown) {
|
||||
hideFolder()
|
||||
|
|
|
@ -280,4 +280,12 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
var tempFolderPath: String
|
||||
get() = prefs.getString(TEMP_FOLDER_PATH, "")
|
||||
set(tempFolderPath) = prefs.edit().putString(TEMP_FOLDER_PATH, tempFolderPath).apply()
|
||||
|
||||
var viewTypeFolders: Int
|
||||
get() = prefs.getInt(VIEW_TYPE_FOLDERS, VIEW_TYPE_GRID)
|
||||
set(viewTypeFolders) = prefs.edit().putInt(VIEW_TYPE_FOLDERS, viewTypeFolders).apply()
|
||||
|
||||
var viewTypeFiles: Int
|
||||
get() = prefs.getInt(VIEW_TYPE_FILES, VIEW_TYPE_GRID)
|
||||
set(viewTypeFiles) = prefs.edit().putInt(VIEW_TYPE_FILES, viewTypeFiles).apply()
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ val REPLACE_SHARE_WITH_ROTATE = "replace_share_with_rotate"
|
|||
val DELETE_EMPTY_FOLDERS = "delete_empty_folders"
|
||||
val ALLOW_VIDEO_GESTURES = "allow_video_gestures"
|
||||
val TEMP_FOLDER_PATH = "temp_folder_path"
|
||||
val VIEW_TYPE_FOLDERS = "view_type_folders"
|
||||
val VIEW_TYPE_FILES = "view_type_files"
|
||||
|
||||
// slideshow
|
||||
val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||
|
@ -77,3 +79,7 @@ val ORIENT_LANDSCAPE_RIGHT = 2
|
|||
val IMAGES = 1
|
||||
val VIDEOS = 2
|
||||
val GIFS = 4
|
||||
|
||||
// view types
|
||||
val VIEW_TYPE_GRID = 1
|
||||
val VIEW_TYPE_LIST = 2
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
android:icon="@drawable/ic_filter"
|
||||
android:title="@string/filter_media"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/change_view_type"
|
||||
android:title="@string/change_view_type"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/show_all"
|
||||
android:title="@string/show_all"
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
android:icon="@drawable/ic_camera"
|
||||
android:title="@string/open_camera"
|
||||
app:showAsAction="ifRoom"/>
|
||||
<item
|
||||
android:id="@+id/change_view_type"
|
||||
android:title="@string/change_view_type"
|
||||
app:showAsAction="never"/>
|
||||
<item
|
||||
android:id="@+id/hide_folder"
|
||||
android:title="@string/hide_folder"
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">The slideshow ended</string>
|
||||
<string name="no_media_for_slideshow">No media for the slideshow have been found</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Show hidden media</string>
|
||||
<string name="autoplay_videos">Play videos automatically</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">The slideshow ended</string>
|
||||
<string name="no_media_for_slideshow">No media for the slideshow have been found</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Zobrazit skryté média</string>
|
||||
<string name="autoplay_videos">Automaticky přehrávat videa</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">Diashow beendet</string>
|
||||
<string name="no_media_for_slideshow">Keine Medien für Diashow gefunden</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Versteckte Ordner zeigen</string>
|
||||
<string name="autoplay_videos">Videos automatisch abspielen</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">The slideshow ended</string>
|
||||
<string name="no_media_for_slideshow">No media for the slideshow have been found</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Mostrar carpetas ocultas</string>
|
||||
<string name="autoplay_videos">Reproducir vídeos automáticamente</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">Diaporama terminé</string>
|
||||
<string name="no_media_for_slideshow">Aucun média trouvé pour le diaporama</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Afficher les dossiers cachés</string>
|
||||
<string name="autoplay_videos">Lecture automatique des vidéos</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">The slideshow ended</string>
|
||||
<string name="no_media_for_slideshow">No media for the slideshow have been found</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Show hidden media</string>
|
||||
<string name="autoplay_videos">Play videos automatically</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">La presentazione è terminata</string>
|
||||
<string name="no_media_for_slideshow">Nessun media trovato per la presentazione</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Mostra cartelle nascoste</string>
|
||||
<string name="autoplay_videos">Riproduci video automaticamente</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">スライドショーが終了しました</string>
|
||||
<string name="no_media_for_slideshow">スライドショーに表示するメディアがありません</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">非表示フォルダーを表示</string>
|
||||
<string name="autoplay_videos">ビデオを自動再生する</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">Pokaz slajdów zakończony</string>
|
||||
<string name="no_media_for_slideshow">Nie znalazłem multimediów do pokazu slajdów</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Pokazuj ukryte foldery</string>
|
||||
<string name="autoplay_videos">Odtwarzaj filmy automatycznie</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">The slideshow ended</string>
|
||||
<string name="no_media_for_slideshow">No media for the slideshow have been found</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Mostrar pastas ocultas</string>
|
||||
<string name="autoplay_videos">Reproduzir vídeos automaticamente</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">Apresentação terminada</string>
|
||||
<string name="no_media_for_slideshow">Não foram encontrados ficheiros para a apresentação</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Mostrar pastas ocultas</string>
|
||||
<string name="autoplay_videos">Reproduzir vídeos automaticamente</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">Слайдшоу завершилось</string>
|
||||
<string name="no_media_for_slideshow">Никаких медиафайлов для слайдшоу не было найдено.</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Показать скрытые папки</string>
|
||||
<string name="autoplay_videos">Воспроизводить видео автоматически</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">Prezentácia skončila</string>
|
||||
<string name="no_media_for_slideshow">Pre prezentáciu sa nenašli žiadne vhodné súbory</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Zmeniť typ zobrazenia</string>
|
||||
<string name="grid">Mriežka</string>
|
||||
<string name="list">Zoznam</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Zobraziť skryté médiá</string>
|
||||
<string name="autoplay_videos">Spúšťať videá automaticky</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">Bildspelet har avslutats</string>
|
||||
<string name="no_media_for_slideshow">Ingen media hittades för bildspelet</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Visa dolda mappar</string>
|
||||
<string name="autoplay_videos">Spela upp videos automatiskt</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">The slideshow ended</string>
|
||||
<string name="no_media_for_slideshow">No media for the slideshow have been found</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Gizli klasörleri göster</string>
|
||||
<string name="autoplay_videos">Videoları otomatik olarak oynat</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">幻灯片结束</string>
|
||||
<string name="no_media_for_slideshow">未发现可用媒体</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">显示所有</string>
|
||||
<string name="autoplay_videos">自动播放</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">投影片結束</string>
|
||||
<string name="no_media_for_slideshow">找不到投影片的媒體檔案</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">顯示隱藏的媒體檔案</string>
|
||||
<string name="autoplay_videos">自動播放影片</string>
|
||||
|
|
|
@ -102,6 +102,11 @@
|
|||
<string name="slideshow_ended">The slideshow ended</string>
|
||||
<string name="no_media_for_slideshow">No media for the slideshow have been found</string>
|
||||
|
||||
<!-- View types -->
|
||||
<string name="change_view_type">Change view type</string>
|
||||
<string name="grid">Grid</string>
|
||||
<string name="list">List</string>
|
||||
|
||||
<!-- Settings -->
|
||||
<string name="show_hidden_media">Show hidden media</string>
|
||||
<string name="autoplay_videos">Play videos automatically</string>
|
||||
|
|
Loading…
Reference in a new issue