#159 adding option to show video length in thumbnail

This commit is contained in:
dslivka1 2018-11-09 13:02:37 +01:00
parent 71091ed484
commit b480386e50
37 changed files with 97 additions and 0 deletions

View File

@ -57,6 +57,7 @@ class SettingsActivity : SimpleActivity() {
setupAllowVideoGestures()
setupAllowDownGesture()
setupBottomActions()
setupVideoLength()
setupShowMediaCount()
setupKeepLastModified()
setupShowInfoBubble()
@ -196,6 +197,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupVideoLength() {
settings_show_video_length.isChecked = config.videoLengthThumbnail
settings_show_video_length_holder.setOnClickListener {
settings_show_video_length.toggle()
config.videoLengthThumbnail = settings_show_video_length.isChecked
}
}
private fun setupDarkBackground() {
settings_black_background.isChecked = config.blackBackground
settings_black_background_holder.setOnClickListener {

View File

@ -451,6 +451,8 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
val isSelected = selectedKeys.contains(medium.path.hashCode())
view.apply {
play_outline.beVisibleIf(medium.isVideo())
video_duration.text = getFormatedVideoLength(medium)
video_duration.beVisibleIf(medium.isVideo() && config.videoLengthThumbnail)
photo_name.beVisibleIf(displayFilenames || isListViewType)
photo_name.text = medium.name
photo_name.tag = medium.path
@ -491,4 +493,13 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Thumbnai
thumbnail_section.setTextColor(textColor)
}
}
private fun getFormatedVideoLength(medium: Medium): String {
if (medium.isVideo()) {
val retriever = MediaMetadataRetriever()
retriever.setDataSource(medium.path)
return Math.round(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION).toInt() / 1000f).getFormattedDuration()
}
return ""
}
}

View File

@ -152,6 +152,10 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getBoolean(CROP_THUMBNAILS, true)
set(cropThumbnails) = prefs.edit().putBoolean(CROP_THUMBNAILS, cropThumbnails).apply()
var videoLengthThumbnail: Boolean
get() = prefs.getBoolean(VIDEO_LENGTH_THUMBNAIL, false)
set(videolengthThumbnail) = prefs.edit().putBoolean(VIDEO_LENGTH_THUMBNAIL, videolengthThumbnail).apply()
var screenRotation: Int
get() = prefs.getInt(SCREEN_ROTATION, ROTATE_BY_SYSTEM_SETTING)
set(screenRotation) = prefs.edit().putInt(SCREEN_ROTATION, screenRotation).apply()

View File

@ -15,6 +15,7 @@ const val LOOP_VIDEOS = "loop_videos"
const val ANIMATE_GIFS = "animate_gifs"
const val MAX_BRIGHTNESS = "max_brightness"
const val CROP_THUMBNAILS = "crop_thumbnails"
const val VIDEO_LENGTH_THUMBNAIL = "video_length_thumbnail"
const val SCREEN_ROTATION = "screen_rotation"
const val DISPLAY_FILE_NAMES = "display_file_names"
const val DARK_BACKGROUND = "dark_background"

View File

@ -370,6 +370,30 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_video_length_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingLeft="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_show_video_length"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:paddingLeft="@dimen/medium_margin"
android:text="@string/video_length_thumbnails"
app:switchPadding="@dimen/medium_margin"/>
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_show_media_count_holder"
android:layout_width="match_parent"

View File

@ -38,6 +38,23 @@
android:src="@drawable/img_play_outline"
android:visibility="gone"/>
<TextView
android:id="@+id/video_duration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:background="@drawable/gradient_background"
android:ellipsize="end"
android:gravity="right"
android:maxLines="1"
android:paddingBottom="@dimen/small_margin"
android:paddingLeft="@dimen/small_margin"
android:paddingRight="@dimen/small_margin"
android:textColor="@android:color/white"
android:textSize="@dimen/normal_text_size"
android:visibility="gone"/>
<TextView
android:id="@+id/photo_name"
android:layout_width="match_parent"

View File

@ -143,6 +143,7 @@
<string name="animate_gifs">عرض صور GIF المتحركة في الصور المصغرة</string>
<string name="max_brightness">أقصى سطوع عند عرض الوسائط</string>
<string name="crop_thumbnails">قص الصور المصغرة الى مستطيلات</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">تدوير وسائط ملء الشاشة بواسطة</string>
<string name="screen_rotation_system_setting">اعدادات النظام</string>
<string name="screen_rotation_device_rotation">تدوير الجهاز</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animate GIFs at thumbnails</string>
<string name="max_brightness">Max brightness when viewing fullscreen media</string>
<string name="crop_thumbnails">Crop thumbnails into squares</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Rotate fullscreen media by</string>
<string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animar les miniatures dels GIFs</string>
<string name="max_brightness">Brillantor màxima quan es mostra multimèdia</string>
<string name="crop_thumbnails">Retallar miniatures en quadrats</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Gira els mitjans a pantalla completa segons</string>
<string name="screen_rotation_system_setting">Configuració del sistema</string>
<string name="screen_rotation_device_rotation">Rotació del dispositiu</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animovat náhledy souborů GIF</string>
<string name="max_brightness">Nastavit jas obrazovky na max při zobrazení médií</string>
<string name="crop_thumbnails">Oříznout náhledy na čtverce</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Otočit média podle</string>
<string name="screen_rotation_system_setting">Systémového nastavení</string>
<string name="screen_rotation_device_rotation">Otočení zařízení</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animér GIF\'er i miniaturer</string>
<string name="max_brightness">Maksimal lysstyrke ved fuldskærmsvisning af medier</string>
<string name="crop_thumbnails">Beskær miniaturer til kvadrater</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Roter fuldskærmsmedier efter</string>
<string name="screen_rotation_system_setting">Systemindstilling</string>
<string name="screen_rotation_device_rotation">Enhedens orientering</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Kacheln von GIFs animieren</string>
<string name="max_brightness">Helligkeit beim Betrachten maximieren</string>
<string name="crop_thumbnails">Kacheln quadratisch zuschneiden</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Im Vollbild ausrichten nach:</string>
<string name="screen_rotation_system_setting">Systemeinstellung</string>
<string name="screen_rotation_device_rotation">Gerätedrehung</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Εμφάνιση κινούμενων GIFs στα εικονίδια</string>
<string name="max_brightness">Μέγιστη φωτεινότητα κατά την προβολή πλήρους οθόνης</string>
<string name="crop_thumbnails">Κόψιμο εικονιδίων σε τετράγωνα</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Περιστροφή σε πλήρη οθόνη απο</string>
<string name="screen_rotation_system_setting">Ρυθμίσεις συστήματος</string>
<string name="screen_rotation_device_rotation">Περιστροφή συσκευής</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animar las miniaturas de GIFs</string>
<string name="max_brightness">Brillo máximo cuando se muestra multimedia</string>
<string name="crop_thumbnails">Recortar miniaturas en cuadrados</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Rotar multimedia en pantalla completa según</string>
<string name="screen_rotation_system_setting">Configuración del sistema</string>
<string name="screen_rotation_device_rotation">Rotación del dispositivo</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animoi GIFit pienoiskuvissa</string>
<string name="max_brightness">Täysi kirkkaus mediaa katsoessa</string>
<string name="crop_thumbnails">Leikkaa pienoiskuvat neliöiksi</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Käännä koko ruudun mediaa</string>
<string name="screen_rotation_system_setting">Järjestelmän asetukset</string>
<string name="screen_rotation_device_rotation">Laitteen kierto</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">GIFs animés sur les miniatures</string>
<string name="max_brightness">Luminosité maximale</string>
<string name="crop_thumbnails">Recadrer les miniatures en carrés</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Pivoter l\'affichage selon</string>
<string name="screen_rotation_system_setting">Paramètres système</string>
<string name="screen_rotation_device_rotation">Rotation de l\'appareil</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animar os GIFs na icona</string>
<string name="max_brightness">Brillo ao máximo cando mire medios</string>
<string name="crop_thumbnails">Recortar iconas a cadrados</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Rotar medios a pantalla completa a</string>
<string name="screen_rotation_system_setting">Axuste do sistema</string>
<string name="screen_rotation_device_rotation">Rotación do dispositivo</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Prikaz animacije GIF-ova na sličicama</string>
<string name="max_brightness">Maksimalna svjetlina pri pregledu datoteka</string>
<string name="crop_thumbnails">Izreži sličice u kvadrate</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Rotiraj datoteku u punom zaslonu za</string>
<string name="screen_rotation_system_setting">Postavke sustava</string>
<string name="screen_rotation_device_rotation">Rotacija uređaja</string>

View File

@ -140,6 +140,7 @@
<string name="animate_gifs">Animált GIF miniatűr</string>
<string name="max_brightness">Maximális fényerő a teljes képernyős médiánál</string>
<string name="crop_thumbnails">Miniatűrök négyzet alakúra vágva</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Teljes képernyős média forgatása</string>
<string name="screen_rotation_system_setting">Rendszer beállítások</string>
<string name="screen_rotation_device_rotation">Eszköz elforgatás</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Anima le GIF in miniatura</string>
<string name="max_brightness">Luminosità max durante la visualizzazione</string>
<string name="crop_thumbnails">Ritaglia le miniature in quadrati</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Ruota schermo per</string>
<string name="screen_rotation_system_setting">Impostazione di sistema</string>
<string name="screen_rotation_device_rotation">Rotazione dispositivo</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">アニメーションGIFを動かす</string>
<string name="max_brightness">再生時には明るさを最大にする</string>
<string name="crop_thumbnails">サムネイルを正方形に切り取る</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">フルスクリーン再生の表示切り替え</string>
<string name="screen_rotation_system_setting">システム設定に従う</string>
<string name="screen_rotation_device_rotation">端末の向きに従う</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">섬네일에서 GIFs 애니메이션 활성화</string>
<string name="max_brightness">미디어 최대 밝기</string>
<string name="crop_thumbnails">미리보기 사각형으로 자름</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">전체화면으로 회전기준</string>
<string name="screen_rotation_system_setting">시스템 설정</string>
<string name="screen_rotation_device_rotation">디바이스 회전</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animuoti GIF\'us miniatiūrose</string>
<string name="max_brightness">Maksimalus ryškumas, kai medija peržiūrima viso ekrano rėžimu</string>
<string name="crop_thumbnails">Apkirpti miniatiūras kvadratu</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Sukti viso ekrano mediją pagal</string>
<string name="screen_rotation_system_setting">Sistemos nustatymai</string>
<string name="screen_rotation_device_rotation">Įrenginio sukimas</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animert GIF i minibildevisning</string>
<string name="max_brightness">Maks lysstyrke ved mediavisning</string>
<string name="crop_thumbnails">Beskjær minibilder i kvadrater</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Roter media etter</string>
<string name="screen_rotation_system_setting">Systeminnstilling</string>
<string name="screen_rotation_device_rotation">Enhetsrotasjon</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">GIF-bestanden afspelen in overzicht</string>
<string name="max_brightness">Maximale helderheid in volledig scherm</string>
<string name="crop_thumbnails">Miniatuurvoorbeelden bijsnijden</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Media in volledig scherm roteren volgens</string>
<string name="screen_rotation_system_setting">Systeeminstelling</string>
<string name="screen_rotation_device_rotation">Oriëntatie van apparaat</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animowane miniatury GIFów</string>
<string name="max_brightness">Maksymalna jasność podczas wyświetlania multimediów</string>
<string name="crop_thumbnails">Przycinaj miniatury do kwadratów</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Obracaj pełnoekranowe multimedia według</string>
<string name="screen_rotation_system_setting">Ustawień systemowych</string>
<string name="screen_rotation_device_rotation">Orientacji urządzenia</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animação de GIFs nas miniaturas</string>
<string name="max_brightness">Brilho máximo ao visualizar mídia</string>
<string name="crop_thumbnails">Recortar miniaturas em quadrados</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Critério para rotação de tela</string>
<string name="screen_rotation_system_setting">Padrão do sistema</string>
<string name="screen_rotation_device_rotation">Sensor do aparelho</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animação de GIF nas miniaturas</string>
<string name="max_brightness">Brilho máximo permitido</string>
<string name="crop_thumbnails">Recortar miniaturas em quadrados</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Rodar em ecrã completo por</string>
<string name="screen_rotation_system_setting">Definições do sistema</string>
<string name="screen_rotation_device_rotation">Rotação do dispositivo</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Анимировать эскизы GIF</string>
<string name="max_brightness">Максимальная яркость при просмотре файлов</string>
<string name="crop_thumbnails">Нарезать миниатюры в квадраты</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Поворот экрана при просмотре изображения</string>
<string name="screen_rotation_system_setting">Использовать системные настройки</string>
<string name="screen_rotation_device_rotation">При повороте устройства</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animovať GIF súbory pri náhľade</string>
<string name="max_brightness">Maximálny jas pri prezeraní médií</string>
<string name="crop_thumbnails">Orezať náhľady na štvorce</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Otáčať obrazovku podľa Rotate fullscreen media by</string>
<string name="screen_rotation_system_setting">Systémového nastavenia</string>
<string name="screen_rotation_device_rotation">Otočenia zariadenia</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animiraj GIFe v predogledu</string>
<string name="max_brightness">Najvišja svetlost pri celozaslonskem predvajanju</string>
<string name="crop_thumbnails">Obreži predoglede slik v kvadrate</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Zavrti celozaslonski medij za</string>
<string name="screen_rotation_system_setting">Sistemska nastavitev</string>
<string name="screen_rotation_device_rotation">Obračanje naprave</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animera GIF-bilders miniatyrer</string>
<string name="max_brightness">Maximal ljusstyrka när media visas i helskärmsläge</string>
<string name="crop_thumbnails">Beskär miniatyrer till kvadrater</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Rotera media i helskärmsläge</string>
<string name="screen_rotation_system_setting">Systeminställning</string>
<string name="screen_rotation_device_rotation">Enhetens rotation</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Küçük resimlerdeki GIF\'leri hareketlendir</string>
<string name="max_brightness">Tam ekran medya görüntülerken maksimum parlaklık</string>
<string name="crop_thumbnails">Küçük resimleri karelere kırp</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Tam ekran medyayı döndür</string>
<string name="screen_rotation_system_setting">Sistem ayarları</string>
<string name="screen_rotation_device_rotation">Cihaz yönü</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Анімувати ескізи GIF-файлів</string>
<string name="max_brightness">Максимальна яскравість екрану при повноекранному перегляді медіафайлу</string>
<string name="crop_thumbnails">Обрізати ескізи у квадрат</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">При повноекранному перегляді обертати за…</string>
<string name="screen_rotation_system_setting">системними налаштуваннями</string>
<string name="screen_rotation_device_rotation">поворотом пристрою</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">GIF 缩略图</string>
<string name="max_brightness">浏览时最大亮度</string>
<string name="crop_thumbnails">裁剪缩略图</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">全屏方向</string>
<string name="screen_rotation_system_setting">系统设置</string>
<string name="screen_rotation_device_rotation">设备方向</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">縮圖顯示GIF動畫</string>
<string name="max_brightness">瀏覽時最大亮度</string>
<string name="crop_thumbnails">縮圖裁剪成正方形</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">全螢幕時旋轉方向</string>
<string name="screen_rotation_system_setting">系統設定方向</string>
<string name="screen_rotation_device_rotation">裝置實際方向</string>

View File

@ -139,6 +139,7 @@
<string name="animate_gifs">Animate GIFs at thumbnails</string>
<string name="max_brightness">Max brightness when viewing fullscreen media</string>
<string name="crop_thumbnails">Crop thumbnails into squares</string>
<string name="video_length_thumbnails">Show length of the video</string>
<string name="screen_rotation_by">Rotate fullscreen media by</string>
<string name="screen_rotation_system_setting">System setting</string>
<string name="screen_rotation_device_rotation">Device rotation</string>