mirror of
https://github.com/TwidereProject/Twidere-Android
synced 2025-01-05 13:09:48 +01:00
fixed media viewer background
This commit is contained in:
parent
2aec3a3c88
commit
7840478571
@ -280,7 +280,7 @@ open class BaseActivity : ChameleonActivity(), IExtendedActivity<BaseActivity>,
|
||||
override val themeBackgroundOption: String
|
||||
get() = ThemeUtils.getThemeBackgroundOption(this)
|
||||
|
||||
protected val shouldApplyWindowBackground: Boolean
|
||||
protected open val shouldApplyWindowBackground: Boolean
|
||||
get() {
|
||||
return true
|
||||
}
|
||||
|
@ -67,10 +67,10 @@ import android.Manifest.permission as AndroidPermissions
|
||||
|
||||
class MediaViewerActivity : BaseActivity(), IMediaViewerActivity, MediaSwipeCloseContainer.Listener {
|
||||
@Inject
|
||||
lateinit var mediaFileCache: FileCache
|
||||
|
||||
internal lateinit var mediaFileCache: FileCache
|
||||
@Inject
|
||||
lateinit var mediaDownloader: MediaDownloader
|
||||
internal lateinit var mediaDownloader: MediaDownloader
|
||||
|
||||
private var saveToStoragePosition = -1
|
||||
|
||||
private var shareMediaPosition = -1
|
||||
@ -89,6 +89,38 @@ class MediaViewerActivity : BaseActivity(), IMediaViewerActivity, MediaSwipeClos
|
||||
intent.getParcelableArrayExtra(EXTRA_MEDIA).toTypedArray(ParcelableMedia.CREATOR)
|
||||
}
|
||||
|
||||
override val shouldApplyWindowBackground: Boolean = false
|
||||
|
||||
override val controlBarHeight: Int
|
||||
get() {
|
||||
return supportActionBar?.height ?: 0
|
||||
}
|
||||
|
||||
override var controlBarOffset: Float
|
||||
get() {
|
||||
val actionBar = supportActionBar
|
||||
if (actionBar != null) {
|
||||
return 1 - actionBar.hideOffset / controlBarHeight.toFloat()
|
||||
}
|
||||
return 0f
|
||||
}
|
||||
set(offset) {
|
||||
val actionBar = supportActionBar
|
||||
if (actionBar != null && !hideOffsetNotSupported) {
|
||||
if (actionBar is WindowDecorActionBar) {
|
||||
val toolbar = actionBar.containerView
|
||||
toolbar.alpha = offset
|
||||
}
|
||||
try {
|
||||
actionBar.hideOffset = Math.round(controlBarHeight * (1f - offset))
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
// Some device will throw this exception
|
||||
hideOffsetNotSupported = true
|
||||
}
|
||||
}
|
||||
notifyControlBarOffsetChanged()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
|
||||
@ -337,37 +369,6 @@ class MediaViewerActivity : BaseActivity(), IMediaViewerActivity, MediaSwipeClos
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override val controlBarHeight: Int
|
||||
get() {
|
||||
return supportActionBar?.height ?: 0
|
||||
}
|
||||
|
||||
override var controlBarOffset: Float
|
||||
get() {
|
||||
val actionBar = supportActionBar
|
||||
if (actionBar != null) {
|
||||
return 1 - actionBar.hideOffset / controlBarHeight.toFloat()
|
||||
}
|
||||
return 0f
|
||||
}
|
||||
set(offset) {
|
||||
val actionBar = supportActionBar
|
||||
if (actionBar != null && !hideOffsetNotSupported) {
|
||||
if (actionBar is WindowDecorActionBar) {
|
||||
val toolbar = actionBar.containerView
|
||||
toolbar.alpha = offset
|
||||
}
|
||||
try {
|
||||
actionBar.hideOffset = Math.round(controlBarHeight * (1f - offset))
|
||||
} catch (e: UnsupportedOperationException) {
|
||||
// Some device will throw this exception
|
||||
hideOffsetNotSupported = true
|
||||
}
|
||||
}
|
||||
notifyControlBarOffsetChanged()
|
||||
}
|
||||
|
||||
override fun setControlBarVisibleAnimate(visible: Boolean, listener: ControlBarShowHideHelper.ControlBarAnimationListener?) {
|
||||
controlBarShowHideHelper.setControlBarVisibleAnimate(visible, listener)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user