add the dialog for customizing extended details

This commit is contained in:
tibbi 2017-10-18 23:38:35 +02:00
parent 3fffe1eef1
commit 3f008960de
25 changed files with 255 additions and 1 deletions

View file

@ -6,12 +6,14 @@ import android.os.Bundle
import com.simplemobiletools.commons.dialogs.ConfirmationDialog
import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.dialogs.SecurityDialog
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.handleHiddenFolderPasswordProtection
import com.simplemobiletools.commons.extensions.updateTextColors
import com.simplemobiletools.commons.helpers.PROTECTION_FINGERPRINT
import com.simplemobiletools.commons.helpers.SHOW_ALL_TABS
import com.simplemobiletools.commons.models.RadioItem
import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.dialogs.ManageExtendedDetailsDialog
import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.helpers.ROTATE_BY_ASPECT_RATIO
import com.simplemobiletools.gallery.helpers.ROTATE_BY_DEVICE_ROTATION
@ -48,6 +50,7 @@ class SettingsActivity : SimpleActivity() {
setupDeleteEmptyFolders()
setupAllowVideoGestures()
setupShowExtendedDetails()
setupManageExtendedDetails()
updateTextColors(settings_holder)
}
@ -221,6 +224,18 @@ class SettingsActivity : SimpleActivity() {
settings_show_extended_details_holder.setOnClickListener {
settings_show_extended_details.toggle()
config.showExtendedDetails = settings_show_extended_details.isChecked
settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails)
}
}
private fun setupManageExtendedDetails() {
settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails)
settings_manage_extended_details_holder.setOnClickListener {
ManageExtendedDetailsDialog(this) {
if (config.extendedDetails == 0) {
settings_show_extended_details_holder.callOnClick()
}
}
}
}
}

View file

@ -0,0 +1,70 @@
package com.simplemobiletools.gallery.dialogs
import android.support.v7.app.AlertDialog
import android.view.LayoutInflater
import android.view.View
import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.gallery.R
import com.simplemobiletools.gallery.activities.SimpleActivity
import com.simplemobiletools.gallery.extensions.config
import com.simplemobiletools.gallery.helpers.*
import kotlinx.android.synthetic.main.dialog_manage_extended_details.view.*
class ManageExtendedDetailsDialog(val activity: SimpleActivity, val callback: (result: Int) -> Unit) {
private var view: View = LayoutInflater.from(activity).inflate(R.layout.dialog_manage_extended_details, null)
init {
val details = activity.config.extendedDetails
view.apply {
manage_extended_details_name.isChecked = details and EXT_NAME != 0
manage_extended_details_path.isChecked = details and EXT_PATH != 0
manage_extended_details_size.isChecked = details and EXT_SIZE != 0
manage_extended_details_resolution.isChecked = details and EXT_RESOLUTION != 0
manage_extended_details_last_modified.isChecked = details and EXT_LAST_MODIFIED != 0
manage_extended_details_date_taken.isChecked = details and EXT_DATE_TAKEN != 0
manage_extended_details_camera.isChecked = details and EXT_CAMERA_MODEL != 0
manage_extended_details_exif.isChecked = details and EXT_EXIF_PROPERTIES != 0
manage_extended_details_duration.isChecked = details and EXT_DURATION != 0
manage_extended_details_artist.isChecked = details and EXT_ARTIST != 0
manage_extended_details_album.isChecked = details and EXT_ALBUM != 0
}
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed() })
.setNegativeButton(R.string.cancel, null)
.create().apply {
activity.setupDialogStuff(view, this)
}
}
private fun dialogConfirmed() {
var result = 0
view.apply {
if (manage_extended_details_name.isChecked)
result += EXT_NAME
if (manage_extended_details_path.isChecked)
result += EXT_PATH
if (manage_extended_details_size.isChecked)
result += EXT_SIZE
if (manage_extended_details_resolution.isChecked)
result += EXT_RESOLUTION
if (manage_extended_details_last_modified.isChecked)
result += EXT_LAST_MODIFIED
if (manage_extended_details_date_taken.isChecked)
result += EXT_DATE_TAKEN
if (manage_extended_details_camera.isChecked)
result += EXT_CAMERA_MODEL
if (manage_extended_details_exif.isChecked)
result += EXT_EXIF_PROPERTIES
if (manage_extended_details_duration.isChecked)
result += EXT_DURATION
if (manage_extended_details_artist.isChecked)
result += EXT_ARTIST
if (manage_extended_details_album.isChecked)
result += EXT_ALBUM
}
activity.config.extendedDetails = result
callback(result)
}
}

View file

@ -292,4 +292,8 @@ class Config(context: Context) : BaseConfig(context) {
var showExtendedDetails: Boolean
get() = prefs.getBoolean(SHOW_EXTENDED_DETAILS, false)
set(showExtendedDetails) = prefs.edit().putBoolean(SHOW_EXTENDED_DETAILS, showExtendedDetails).apply()
var extendedDetails: Int
get() = prefs.getInt(EXTENDED_DETAILS, EXT_RESOLUTION or EXT_LAST_MODIFIED or EXT_EXIF_PROPERTIES)
set(extendedDetails) = prefs.edit().putInt(EXTENDED_DETAILS, extendedDetails).apply()
}

View file

@ -40,6 +40,7 @@ val TEMP_FOLDER_PATH = "temp_folder_path"
val VIEW_TYPE_FOLDERS = "view_type_folders"
val VIEW_TYPE_FILES = "view_type_files"
val SHOW_EXTENDED_DETAILS = "show_extended_details"
val EXTENDED_DETAILS = "extended_details"
// slideshow
val SLIDESHOW_INTERVAL = "slideshow_interval"
@ -86,3 +87,16 @@ val GIFS = 4
// view types
val VIEW_TYPE_GRID = 1
val VIEW_TYPE_LIST = 2
// extended details values
val EXT_NAME = 1
val EXT_PATH = 2
val EXT_SIZE = 4
val EXT_RESOLUTION = 8
val EXT_LAST_MODIFIED = 16
val EXT_DATE_TAKEN = 32
val EXT_CAMERA_MODEL = 64
val EXT_EXIF_PROPERTIES = 128
val EXT_DURATION = 256
val EXT_ARTIST = 512
val EXT_ALBUM = 1024

View file

@ -348,6 +348,25 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_manage_extended_details_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:padding="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/settings_manage_extended_details"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/manage_extended_details"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_screen_rotation_holder"
android:layout_width="match_parent"

View file

@ -0,0 +1,113 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/manage_extended_details_scrollview"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="@+id/manage_extended_details_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="@dimen/activity_margin"
android:paddingRight="@dimen/activity_margin"
android:paddingTop="@dimen/medium_margin">
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/filename"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_path"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/path"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_size"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/size"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_resolution"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/resolution"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_last_modified"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/last_modified"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_date_taken"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/date_taken"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_camera"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/camera"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_exif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/exif"/>
<ImageView
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1px"
android:background="@color/divider_weak"
android:importantForAccessibility="no"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_duration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/duration"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_artist"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/artist"/>
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/manage_extended_details_album"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/activity_margin"
android:paddingTop="@dimen/activity_margin"
android:text="@string/album"/>
</LinearLayout>
</ScrollView>

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Gesten für Videolautstärke/Helligkeit</string>
<string name="replace_share_with_rotate">Teilen/Drehen im Vollbild-Menü vertauschen</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
<string name="replace_share_with_rotate">Reemplazar Compartir con Girar en el menú de pantalla completa</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Salli videon äänenvoimakkuuden ja kirkkauden säätö pystysuorilla eleillä</string>
<string name="replace_share_with_rotate">Korvaa jakaminen kääntämisellä koko näytön tilassa</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Permettre le contrôle du volume vidéo et de la luminosité avec des gestes verticaux</string>
<string name="replace_share_with_rotate">Remplacer Partager par Pivoter si menu en plein écran</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Gestisci il volume e la luminosità dei video con gesti verticali</string>
<string name="replace_share_with_rotate">Sostituisci Condividi con Ruota a schermo intero</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">ビデオ再生中に、音量と明るさを縦方向のジェスチャーで変更する</string>
<string name="replace_share_with_rotate">フルスクリーンメニューの「共有」を「回転」に置き換える</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Zezwalaj na kontrolę jasności i głośności filmów pionowymi gestami</string>
<string name="replace_share_with_rotate">Zamień funkcję udostępniania na obracanie w menu pełnoekranowym</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Permitir controlo do volume e brilho dos vídeos através de gestos verticais</string>
<string name="replace_share_with_rotate">Substituir a opção Partilhar pela opção Rodar se em ecrã completo</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Управлять громкостью и яркостью видео с помощью вертикальных жестов</string>
<string name="replace_share_with_rotate">Заменить \'Поделиться\' на \'Повернуть\' в меню полноэкранного режима</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,12 +126,13 @@
<string name="allow_video_gestures">Povoliť ovládanie hlasitosti a jasu videí vertikálnymi ťahmi</string>
<string name="replace_share_with_rotate">Nahradiť Zdieľanie s Otočením v celoobrazovkovom menu</string>
<string name="show_extended_details">Zobraziť rozšírené vlastnosti ponad celoobrazovkové médiá</string>
<string name="manage_extended_details">Spravovať rozšírené vlastnosti</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->
<string name="app_short_description">Galéria na prezeranie obrázkov a videí bez reklám.</string>
<string name="app_long_description">
Jednoduchá nástroj použiteľný na prezeranie obrázkov a videí. Položky môžu byť zoradené podľa dátumu, veľkosti, názvu oboma smermi, obrázky je možné aj priblížiť. Položky sú zobrazované vo viacerých stĺpcoch v závislosti od veľkosti displeja, počet stĺpcov je možné meniť pomocou gesta prstami. Súbory môžete premenovať, zdieľať, mazať, kopírovať, premiestňovaŤ. Obrázky môžete orezať, otočiť, alebo nastaviť ako tapeta priamo v aplikácií.
Jednoduchá nástroj použiteľný na prezeranie obrázkov a videí. Položky môžu byť zoradené podľa dátumu, veľkosti, názvu oboma smermi, obrázky je možné aj priblížiť. Položky sú zobrazované vo viacerých stĺpcoch v závislosti od veľkosti displeja, počet stĺpcov je možné meniť pomocou gesta prstami. Súbory môžete premenovať, zdieľať, mazať, kopírovať, premiestňovať. Obrázky môžete orezať, otočiť, alebo nastaviť ako tapeta priamo v aplikácií.
Galéria je tiež poskytovaná pre použitie treťou stranou pre prehliadanie fotiek a videí, pridávanie príloh v emailových klientoch. Je perfektná na každodenné použitie.

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Tillåt styrning av videovolym och videoljusstyrka med vertikala gester</string>
<string name="replace_share_with_rotate">Ersätt Dela med Rotera i helskärmsmenyn</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
<string name="replace_share_with_rotate">替换全屏时菜单栏的“分享”为“旋转”</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">允許用上下手勢來控制影片的音量和亮度</string>
<string name="replace_share_with_rotate">將全螢幕選單的分享取代為旋轉</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->

View file

@ -126,6 +126,7 @@
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
<string name="replace_share_with_rotate">Replace Share with Rotate at fullscreen menu</string>
<string name="show_extended_details">Show extended details over fullscreen media</string>
<string name="manage_extended_details">Manage extended details</string>
<!-- Strings displayed only on Google Playstore. Optional, but good to have -->
<!-- Short description has to have less than 80 chars -->