mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-31 20:26:43 +01:00
add a toggle for hiding extended details when the statusbar is hidden
This commit is contained in:
parent
4e15f047c5
commit
c4c083b77f
6 changed files with 75 additions and 10 deletions
|
@ -58,6 +58,7 @@ class SettingsActivity : SimpleActivity() {
|
||||||
setupAllowInstantChange()
|
setupAllowInstantChange()
|
||||||
setupReplaceZoomableImages()
|
setupReplaceZoomableImages()
|
||||||
setupShowExtendedDetails()
|
setupShowExtendedDetails()
|
||||||
|
setupHideExtendedDetails()
|
||||||
setupManageExtendedDetails()
|
setupManageExtendedDetails()
|
||||||
updateTextColors(settings_holder)
|
updateTextColors(settings_holder)
|
||||||
setupSectionColors()
|
setupSectionColors()
|
||||||
|
@ -311,6 +312,16 @@ class SettingsActivity : SimpleActivity() {
|
||||||
settings_show_extended_details.toggle()
|
settings_show_extended_details.toggle()
|
||||||
config.showExtendedDetails = settings_show_extended_details.isChecked
|
config.showExtendedDetails = settings_show_extended_details.isChecked
|
||||||
settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails)
|
settings_manage_extended_details_holder.beVisibleIf(config.showExtendedDetails)
|
||||||
|
settings_hide_extended_details_holder.beVisibleIf(config.showExtendedDetails)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun setupHideExtendedDetails() {
|
||||||
|
settings_hide_extended_details_holder.beVisibleIf(config.showExtendedDetails)
|
||||||
|
settings_hide_extended_details.isChecked = config.hideExtendedDetails
|
||||||
|
settings_hide_extended_details_holder.setOnClickListener {
|
||||||
|
settings_hide_extended_details.toggle()
|
||||||
|
config.hideExtendedDetails = settings_hide_extended_details.isChecked
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,13 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
private var isFragmentVisible = false
|
private var isFragmentVisible = false
|
||||||
private var isFullscreen = false
|
private var isFullscreen = false
|
||||||
private var wasInit = false
|
private var wasInit = false
|
||||||
private var storedShowExtendedDetails = false
|
|
||||||
private var storedExtendedDetails = 0
|
|
||||||
private var imageOrientation = -1
|
private var imageOrientation = -1
|
||||||
private var gifDrawable: GifDrawable? = null
|
private var gifDrawable: GifDrawable? = null
|
||||||
|
|
||||||
|
private var storedShowExtendedDetails = false
|
||||||
|
private var storedHideExtendedDetails = false
|
||||||
|
private var storedExtendedDetails = 0
|
||||||
|
|
||||||
lateinit var view: ViewGroup
|
lateinit var view: ViewGroup
|
||||||
lateinit var medium: Medium
|
lateinit var medium: Medium
|
||||||
|
|
||||||
|
@ -58,6 +60,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
instant_next_item.setOnClickListener { listener?.goToNextItem() }
|
instant_next_item.setOnClickListener { listener?.goToNextItem() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storeStateVariables()
|
||||||
if (!isFragmentVisible && activity is PhotoActivity) {
|
if (!isFragmentVisible && activity is PhotoActivity) {
|
||||||
isFragmentVisible = true
|
isFragmentVisible = true
|
||||||
}
|
}
|
||||||
|
@ -104,8 +107,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
storedShowExtendedDetails = context!!.config.showExtendedDetails
|
storeStateVariables()
|
||||||
storedExtendedDetails = context!!.config.extendedDetails
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
|
@ -117,6 +119,7 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
val allowInstantChange = context!!.config.allowInstantChange
|
val allowInstantChange = context!!.config.allowInstantChange
|
||||||
view.instant_prev_item.beVisibleIf(allowInstantChange)
|
view.instant_prev_item.beVisibleIf(allowInstantChange)
|
||||||
view.instant_next_item.beVisibleIf(allowInstantChange)
|
view.instant_next_item.beVisibleIf(allowInstantChange)
|
||||||
|
storeStateVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun setMenuVisibility(menuVisible: Boolean) {
|
override fun setMenuVisibility(menuVisible: Boolean) {
|
||||||
|
@ -131,6 +134,14 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun storeStateVariables() {
|
||||||
|
context!!.config.apply {
|
||||||
|
storedShowExtendedDetails = showExtendedDetails
|
||||||
|
storedHideExtendedDetails = hideExtendedDetails
|
||||||
|
storedExtendedDetails = extendedDetails
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun gifFragmentVisibilityChanged(isVisible: Boolean) {
|
private fun gifFragmentVisibilityChanged(isVisible: Boolean) {
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
gifDrawable?.start()
|
gifDrawable?.start()
|
||||||
|
@ -362,8 +373,12 @@ class PhotoFragment : ViewPagerFragment() {
|
||||||
override fun fullscreenToggled(isFullscreen: Boolean) {
|
override fun fullscreenToggled(isFullscreen: Boolean) {
|
||||||
this.isFullscreen = isFullscreen
|
this.isFullscreen = isFullscreen
|
||||||
view.photo_details.apply {
|
view.photo_details.apply {
|
||||||
if (isVisible()) {
|
if (storedShowExtendedDetails) {
|
||||||
animate().y(getExtendedDetailsY(height))
|
animate().y(getExtendedDetailsY(height))
|
||||||
|
|
||||||
|
if (storedHideExtendedDetails) {
|
||||||
|
animate().alpha(if (isFullscreen) 0f else 1f).start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,9 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
private var mIsFullscreen = false
|
private var mIsFullscreen = false
|
||||||
private var mIsFragmentVisible = false
|
private var mIsFragmentVisible = false
|
||||||
private var mPlayOnPrepare = false
|
private var mPlayOnPrepare = false
|
||||||
private var mStoredShowExtendedDetails = false
|
|
||||||
private var wasEncoded = false
|
private var wasEncoded = false
|
||||||
private var wasInit = false
|
private var wasInit = false
|
||||||
private var isPrepared = false
|
private var isPrepared = false
|
||||||
private var mStoredExtendedDetails = 0
|
|
||||||
private var mCurrTime = 0
|
private var mCurrTime = 0
|
||||||
private var mDuration = 0
|
private var mDuration = 0
|
||||||
private var mEncodedPath = ""
|
private var mEncodedPath = ""
|
||||||
|
@ -63,6 +61,10 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
private var mSlideInfoText = ""
|
private var mSlideInfoText = ""
|
||||||
private var mSlideInfoFadeHandler = Handler()
|
private var mSlideInfoFadeHandler = Handler()
|
||||||
|
|
||||||
|
private var mStoredShowExtendedDetails = false
|
||||||
|
private var mStoredHideExtendedDetails = false
|
||||||
|
private var mStoredExtendedDetails = 0
|
||||||
|
|
||||||
lateinit var medium: Medium
|
lateinit var medium: Medium
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||||
|
@ -72,6 +74,7 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
mTimeHolder = video_time_holder
|
mTimeHolder = video_time_holder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storeStateVariables()
|
||||||
medium = arguments!!.getSerializable(MEDIUM) as Medium
|
medium = arguments!!.getSerializable(MEDIUM) as Medium
|
||||||
|
|
||||||
// setMenuVisibility is not called at VideoActivity (third party intent)
|
// setMenuVisibility is not called at VideoActivity (third party intent)
|
||||||
|
@ -107,13 +110,13 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
if (context!!.config.showExtendedDetails != mStoredShowExtendedDetails || context!!.config.extendedDetails != mStoredExtendedDetails) {
|
if (context!!.config.showExtendedDetails != mStoredShowExtendedDetails || context!!.config.extendedDetails != mStoredExtendedDetails) {
|
||||||
checkExtendedDetails()
|
checkExtendedDetails()
|
||||||
}
|
}
|
||||||
|
storeStateVariables()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onPause() {
|
override fun onPause() {
|
||||||
super.onPause()
|
super.onPause()
|
||||||
pauseVideo()
|
pauseVideo()
|
||||||
mStoredShowExtendedDetails = context!!.config.showExtendedDetails
|
storeStateVariables()
|
||||||
mStoredExtendedDetails = context!!.config.extendedDetails
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
@ -123,6 +126,14 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun storeStateVariables() {
|
||||||
|
context!!.config.apply {
|
||||||
|
mStoredShowExtendedDetails = showExtendedDetails
|
||||||
|
mStoredHideExtendedDetails = hideExtendedDetails
|
||||||
|
mStoredExtendedDetails = extendedDetails
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupPlayer() {
|
private fun setupPlayer() {
|
||||||
if (activity == null)
|
if (activity == null)
|
||||||
return
|
return
|
||||||
|
@ -614,8 +625,12 @@ class VideoFragment : ViewPagerFragment(), SurfaceHolder.Callback, SeekBar.OnSee
|
||||||
mIsFullscreen = isFullscreen
|
mIsFullscreen = isFullscreen
|
||||||
checkFullscreen()
|
checkFullscreen()
|
||||||
mView!!.video_details.apply {
|
mView!!.video_details.apply {
|
||||||
if (isVisible()) {
|
if (mStoredShowExtendedDetails) {
|
||||||
animate().y(getExtendedDetailsY(height))
|
animate().y(getExtendedDetailsY(height))
|
||||||
|
|
||||||
|
if (mStoredHideExtendedDetails) {
|
||||||
|
animate().alpha(if (isFullscreen) 0f else 1f).start()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,6 +309,10 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
get() = prefs.getBoolean(SHOW_EXTENDED_DETAILS, false)
|
get() = prefs.getBoolean(SHOW_EXTENDED_DETAILS, false)
|
||||||
set(showExtendedDetails) = prefs.edit().putBoolean(SHOW_EXTENDED_DETAILS, showExtendedDetails).apply()
|
set(showExtendedDetails) = prefs.edit().putBoolean(SHOW_EXTENDED_DETAILS, showExtendedDetails).apply()
|
||||||
|
|
||||||
|
var hideExtendedDetails: Boolean
|
||||||
|
get() = prefs.getBoolean(HIDE_EXTENDED_DETAILS, false)
|
||||||
|
set(hideExtendedDetails) = prefs.edit().putBoolean(HIDE_EXTENDED_DETAILS, hideExtendedDetails).apply()
|
||||||
|
|
||||||
var extendedDetails: Int
|
var extendedDetails: Int
|
||||||
get() = prefs.getInt(EXTENDED_DETAILS, EXT_RESOLUTION or EXT_LAST_MODIFIED or EXT_EXIF_PROPERTIES)
|
get() = prefs.getInt(EXTENDED_DETAILS, EXT_RESOLUTION or EXT_LAST_MODIFIED or EXT_EXIF_PROPERTIES)
|
||||||
set(extendedDetails) = prefs.edit().putInt(EXTENDED_DETAILS, extendedDetails).apply()
|
set(extendedDetails) = prefs.edit().putInt(EXTENDED_DETAILS, extendedDetails).apply()
|
||||||
|
|
|
@ -42,6 +42,7 @@ const val VIEW_TYPE_FOLDERS = "view_type_folders"
|
||||||
const val VIEW_TYPE_FILES = "view_type_files"
|
const val VIEW_TYPE_FILES = "view_type_files"
|
||||||
const val SHOW_EXTENDED_DETAILS = "show_extended_details"
|
const val SHOW_EXTENDED_DETAILS = "show_extended_details"
|
||||||
const val EXTENDED_DETAILS = "extended_details"
|
const val EXTENDED_DETAILS = "extended_details"
|
||||||
|
const val HIDE_EXTENDED_DETAILS = "hide_extended_details"
|
||||||
const val LAST_FILE_CLEANUP = "last_file_cleanup"
|
const val LAST_FILE_CLEANUP = "last_file_cleanup"
|
||||||
const val ONE_FINGER_ZOOM = "one_finger_zoom"
|
const val ONE_FINGER_ZOOM = "one_finger_zoom"
|
||||||
const val ALLOW_INSTANT_CHANGE = "allow_instant_change"
|
const val ALLOW_INSTANT_CHANGE = "allow_instant_change"
|
||||||
|
|
|
@ -589,6 +589,25 @@
|
||||||
android:text="@string/show_extended_details"/>
|
android:text="@string/show_extended_details"/>
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/settings_hide_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.MySwitchCompat
|
||||||
|
android:id="@+id/settings_hide_extended_details"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@null"
|
||||||
|
android:clickable="false"
|
||||||
|
android:paddingLeft="@dimen/medium_margin"
|
||||||
|
android:paddingStart="@dimen/medium_margin"
|
||||||
|
android:text="@string/hide_extended_details"/>
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:id="@+id/settings_manage_extended_details_holder"
|
android:id="@+id/settings_manage_extended_details_holder"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue