[Android] Nullability cleanup
Geoffrey Métais
git at videolan.org
Wed Feb 13 16:15:58 CET 2019
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Wed Feb 13 09:53:09 2019 +0100| [c1720ca57f08f35db16cea3a4a0023141388bab0] | committer: Geoffrey Métais
Nullability cleanup
> https://code.videolan.org/videolan/vlc-android/commit/c1720ca57f08f35db16cea3a4a0023141388bab0
---
.../src/org/videolan/vlc/gui/view/FastScroller.kt | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt b/vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt
index eb2143c94..61e5010b7 100644
--- a/vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/view/FastScroller.kt
@@ -215,9 +215,9 @@ class FastScroller : LinearLayout {
private fun setPosition(y: Float) {
val position = y / currentHeight
val handleHeight = handle.height
- handle?.y = getValueInRange(0, currentHeight - handleHeight, ((currentHeight - handleHeight) * position).toInt()).toFloat()
+ handle.y = getValueInRange(0, currentHeight - handleHeight, ((currentHeight - handleHeight) * position).toInt()).toFloat()
val bubbleHeight = bubble.height
- bubble?.y = getValueInRange(0, currentHeight - bubbleHeight, ((currentHeight - bubbleHeight) * position).toInt() - handleHeight).toFloat()
+ bubble.y = getValueInRange(0, currentHeight - bubbleHeight, ((currentHeight - bubbleHeight) * position).toInt() - handleHeight).toFloat()
}
/**
@@ -262,7 +262,7 @@ class FastScroller : LinearLayout {
* Scrolls in the [recyclerView]
*/
private fun setRecyclerViewPosition(y: Float) {
- if (recyclerView != null) {
+ if (this::recyclerView.isInitialized) {
val proportion: Float = y / currentHeight.toFloat()
val targetPos = getValueInRange(0, itemCount, Math.round(proportion * itemCount.toFloat()))
@@ -316,12 +316,12 @@ class FastScroller : LinearLayout {
override fun onScrolled(rv: RecyclerView, dx: Int, dy: Int) {
updatePositions()
//launch the collapse / expand animations if needed
- appbarLayout?.totalScrollRange?.let {
+ appbarLayout.totalScrollRange.let {
if (tryCollapseAppbarOnNextScroll && lastVerticalOffset != -it) {
if (!isAnimating.get()) {
- appbarLayout?.setExpanded(false)
- floatingActionButton?.hide()
+ appbarLayout.setExpanded(false)
+ floatingActionButton.hide()
isAnimating.set(true)
}
tryCollapseAppbarOnNextScroll = false
@@ -329,8 +329,8 @@ class FastScroller : LinearLayout {
if (tryExpandAppbarOnNextScroll && lastVerticalOffset == -it) {
if (!isAnimating.get()) {
- appbarLayout?.setExpanded(true)
- floatingActionButton?.show()
+ appbarLayout.setExpanded(true)
+ floatingActionButton.show()
isAnimating.set(true)
}
tryExpandAppbarOnNextScroll = false
More information about the Android
mailing list