mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-03-11 14:10:06 +01:00
Added option to keep screen on while viewing photos (#365)
This commit is contained in:
parent
c58f9f6752
commit
b2b30035a8
7 changed files with 41 additions and 1 deletions
|
@ -76,6 +76,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
setupAppPasswordProtection()
|
setupAppPasswordProtection()
|
||||||
setupFileDeletionPasswordProtection()
|
setupFileDeletionPasswordProtection()
|
||||||
setupDeleteEmptyFolders()
|
setupDeleteEmptyFolders()
|
||||||
|
setupKeepScreenOn()
|
||||||
setupAllowPhotoGestures()
|
setupAllowPhotoGestures()
|
||||||
setupAllowVideoGestures()
|
setupAllowVideoGestures()
|
||||||
setupAllowDownGesture()
|
setupAllowDownGesture()
|
||||||
|
@ -446,6 +447,14 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setupKeepScreenOn() {
|
||||||
|
binding.settingsKeepScreenOnFullscreenPhotos.isChecked = config.keepScreenOn
|
||||||
|
binding.settingsKeepScreenOnFullscreenPhotosHolder.setOnClickListener {
|
||||||
|
binding.settingsKeepScreenOnFullscreenPhotos.toggle()
|
||||||
|
config.keepScreenOn = binding.settingsKeepScreenOnFullscreenPhotos.isChecked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupAllowPhotoGestures() {
|
private fun setupAllowPhotoGestures() {
|
||||||
binding.settingsAllowPhotoGestures.isChecked = config.allowPhotoGestures
|
binding.settingsAllowPhotoGestures.isChecked = config.allowPhotoGestures
|
||||||
binding.settingsAllowPhotoGesturesHolder.setOnClickListener {
|
binding.settingsAllowPhotoGesturesHolder.setOnClickListener {
|
||||||
|
@ -884,6 +893,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
put(BLACK_BACKGROUND, config.blackBackground)
|
put(BLACK_BACKGROUND, config.blackBackground)
|
||||||
put(HIDE_SYSTEM_UI, config.hideSystemUI)
|
put(HIDE_SYSTEM_UI, config.hideSystemUI)
|
||||||
put(ALLOW_INSTANT_CHANGE, config.allowInstantChange)
|
put(ALLOW_INSTANT_CHANGE, config.allowInstantChange)
|
||||||
|
put(KEEP_SCREEN_ON, config.keepScreenOn)
|
||||||
put(ALLOW_PHOTO_GESTURES, config.allowPhotoGestures)
|
put(ALLOW_PHOTO_GESTURES, config.allowPhotoGestures)
|
||||||
put(ALLOW_DOWN_GESTURE, config.allowDownGesture)
|
put(ALLOW_DOWN_GESTURE, config.allowDownGesture)
|
||||||
put(ALLOW_ROTATING_WITH_GESTURES, config.allowRotatingWithGestures)
|
put(ALLOW_ROTATING_WITH_GESTURES, config.allowRotatingWithGestures)
|
||||||
|
@ -1027,6 +1037,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
BLACK_BACKGROUND -> config.blackBackground = value.toBoolean()
|
BLACK_BACKGROUND -> config.blackBackground = value.toBoolean()
|
||||||
HIDE_SYSTEM_UI -> config.hideSystemUI = value.toBoolean()
|
HIDE_SYSTEM_UI -> config.hideSystemUI = value.toBoolean()
|
||||||
ALLOW_INSTANT_CHANGE -> config.allowInstantChange = value.toBoolean()
|
ALLOW_INSTANT_CHANGE -> config.allowInstantChange = value.toBoolean()
|
||||||
|
KEEP_SCREEN_ON -> config.keepScreenOn = value.toBoolean()
|
||||||
ALLOW_PHOTO_GESTURES -> config.allowPhotoGestures = value.toBoolean()
|
ALLOW_PHOTO_GESTURES -> config.allowPhotoGestures = value.toBoolean()
|
||||||
ALLOW_DOWN_GESTURE -> config.allowDownGesture = value.toBoolean()
|
ALLOW_DOWN_GESTURE -> config.allowDownGesture = value.toBoolean()
|
||||||
ALLOW_ROTATING_WITH_GESTURES -> config.allowRotatingWithGestures = value.toBoolean()
|
ALLOW_ROTATING_WITH_GESTURES -> config.allowRotatingWithGestures = value.toBoolean()
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.WindowManager
|
||||||
import android.widget.RelativeLayout
|
import android.widget.RelativeLayout
|
||||||
import androidx.exifinterface.media.ExifInterface.*
|
import androidx.exifinterface.media.ExifInterface.*
|
||||||
import com.alexvasilkov.gestures.GestureController
|
import com.alexvasilkov.gestures.GestureController
|
||||||
|
@ -220,6 +221,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
|
activity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
storeStateVariables()
|
storeStateVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,6 +247,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
mShouldResetImage = false
|
mShouldResetImage = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val keepScreenOn = config.keepScreenOn
|
||||||
val allowPhotoGestures = config.allowPhotoGestures
|
val allowPhotoGestures = config.allowPhotoGestures
|
||||||
val allowInstantChange = config.allowInstantChange
|
val allowInstantChange = config.allowInstantChange
|
||||||
|
|
||||||
|
@ -254,6 +257,10 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
instantNextItem.beVisibleIf(allowInstantChange)
|
instantNextItem.beVisibleIf(allowInstantChange)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (keepScreenOn) {
|
||||||
|
activity?.window?.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
|
}
|
||||||
|
|
||||||
storeStateVariables()
|
storeStateVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -308,6 +308,10 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
get() = prefs.getBoolean(DELETE_EMPTY_FOLDERS, false)
|
get() = prefs.getBoolean(DELETE_EMPTY_FOLDERS, false)
|
||||||
set(deleteEmptyFolders) = prefs.edit().putBoolean(DELETE_EMPTY_FOLDERS, deleteEmptyFolders).apply()
|
set(deleteEmptyFolders) = prefs.edit().putBoolean(DELETE_EMPTY_FOLDERS, deleteEmptyFolders).apply()
|
||||||
|
|
||||||
|
var keepScreenOn: Boolean
|
||||||
|
get() = prefs.getBoolean(KEEP_SCREEN_ON, true)
|
||||||
|
set(keepScreenOn) = prefs.edit().putBoolean(KEEP_SCREEN_ON, keepScreenOn).apply()
|
||||||
|
|
||||||
var allowPhotoGestures: Boolean
|
var allowPhotoGestures: Boolean
|
||||||
get() = prefs.getBoolean(ALLOW_PHOTO_GESTURES, false)
|
get() = prefs.getBoolean(ALLOW_PHOTO_GESTURES, false)
|
||||||
set(allowPhotoGestures) = prefs.edit().putBoolean(ALLOW_PHOTO_GESTURES, allowPhotoGestures).apply()
|
set(allowPhotoGestures) = prefs.edit().putBoolean(ALLOW_PHOTO_GESTURES, allowPhotoGestures).apply()
|
||||||
|
|
|
@ -45,6 +45,7 @@ const val INCLUDED_FOLDERS = "included_folders"
|
||||||
const val ALBUM_COVERS = "album_covers"
|
const val ALBUM_COVERS = "album_covers"
|
||||||
const val HIDE_SYSTEM_UI = "hide_system_ui"
|
const val HIDE_SYSTEM_UI = "hide_system_ui"
|
||||||
const val DELETE_EMPTY_FOLDERS = "delete_empty_folders"
|
const val DELETE_EMPTY_FOLDERS = "delete_empty_folders"
|
||||||
|
const val KEEP_SCREEN_ON = "keep_screen_on"
|
||||||
const val ALLOW_PHOTO_GESTURES = "allow_photo_gestures"
|
const val ALLOW_PHOTO_GESTURES = "allow_photo_gestures"
|
||||||
const val ALLOW_VIDEO_GESTURES = "allow_video_gestures"
|
const val ALLOW_VIDEO_GESTURES = "allow_video_gestures"
|
||||||
const val TEMP_FOLDER_PATH = "temp_folder_path"
|
const val TEMP_FOLDER_PATH = "temp_folder_path"
|
||||||
|
|
|
@ -491,6 +491,21 @@
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_keep_screen_on_fullscreen_photos_holder"
|
||||||
|
style="@style/SettingsHolderSwitchStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<org.fossify.commons.views.MyMaterialSwitch
|
||||||
|
android:id="@+id/settings_keep_screen_on_fullscreen_photos"
|
||||||
|
style="@style/SettingsSwitchStyle"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@string/keep_screen_on_fullscreen_photos" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_allow_photo_gestures_holder"
|
android:id="@+id/settings_allow_photo_gestures_holder"
|
||||||
style="@style/SettingsHolderSwitchStyle"
|
style="@style/SettingsHolderSwitchStyle"
|
||||||
|
|
|
@ -162,6 +162,7 @@
|
||||||
<string name="scroll_thumbnails_horizontally">Przewijaj miniaturki w poziomie</string>
|
<string name="scroll_thumbnails_horizontally">Przewijaj miniaturki w poziomie</string>
|
||||||
<string name="hide_system_ui_at_fullscreen">Automatycznie ukrywaj interfejs systemu dla multimediów na pełnym ekranie</string>
|
<string name="hide_system_ui_at_fullscreen">Automatycznie ukrywaj interfejs systemu dla multimediów na pełnym ekranie</string>
|
||||||
<string name="delete_empty_folders">Usuwaj puste foldery po usunięciu ich zawartości</string>
|
<string name="delete_empty_folders">Usuwaj puste foldery po usunięciu ich zawartości</string>
|
||||||
|
<string name="keep_screen_on_fullscreen_photos">Pozostawiaj ekran włączony podczas oglądania obrazów na pełnym ekranie</string>
|
||||||
<string name="allow_photo_gestures">Zezwalaj na kontrolowanie jasności obrazów pionowymi gestami</string>
|
<string name="allow_photo_gestures">Zezwalaj na kontrolowanie jasności obrazów pionowymi gestami</string>
|
||||||
<string name="allow_video_gestures">Zezwalaj na kontrolowanie głośności i jasności wideo pionowymi gestami</string>
|
<string name="allow_video_gestures">Zezwalaj na kontrolowanie głośności i jasności wideo pionowymi gestami</string>
|
||||||
<string name="show_media_count">Pokazuj liczbę multimediów w folderze w widoku głównym</string>
|
<string name="show_media_count">Pokazuj liczbę multimediów w folderze w widoku głównym</string>
|
||||||
|
|
|
@ -180,6 +180,7 @@
|
||||||
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
<string name="scroll_thumbnails_horizontally">Scroll thumbnails horizontally</string>
|
||||||
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
<string name="hide_system_ui_at_fullscreen">Automatically hide system UI at fullscreen media</string>
|
||||||
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
<string name="delete_empty_folders">Delete empty folders after deleting their content</string>
|
||||||
|
<string name="keep_screen_on_fullscreen_photos">Keep the screen on while viewing fullscreen photos</string>
|
||||||
<string name="allow_photo_gestures">Allow controlling photo brightness with vertical gestures</string>
|
<string name="allow_photo_gestures">Allow controlling photo brightness with vertical gestures</string>
|
||||||
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
|
<string name="allow_video_gestures">Allow controlling video volume and brightness with vertical gestures</string>
|
||||||
<string name="playback_speed">Playback speed</string>
|
<string name="playback_speed">Playback speed</string>
|
||||||
|
|
Loading…
Add table
Reference in a new issue