Skip to content

Commit b402434

Browse files
committed
Cosmetic
1 parent 749e9fd commit b402434

File tree

2 files changed

+19
-59
lines changed

2 files changed

+19
-59
lines changed

app/src/androidTest/kotlin/info/hannes/slidingup/demo/tools/Matcher.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ fun setValue(value: PanelState): ViewAction {
3535
}
3636

3737
override fun perform(uiController: UiController?, view: View) {
38-
val seekBar = view as SlidingUpPanelLayout
39-
seekBar.setPanelState(value)
38+
val slidingUpPanelLayout = view as SlidingUpPanelLayout
39+
slidingUpPanelLayout.setPanelState(value)
4040
}
4141
}
4242
}

library/src/main/kotlin/com/sothree/slidinguppanel/SlidingUpPanelLayout.kt

+17-57
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import android.view.animation.AnimationUtils
1717
import android.view.animation.Interpolator
1818
import androidx.annotation.IdRes
1919
import androidx.core.content.ContextCompat
20-
import androidx.core.view.ViewCompat
2120
import com.sothree.slidinguppanel.ViewDragHelper.Companion.create
2221
import com.sothree.slidinguppanel.canvasSaveProxy.CanvasSaveProxy
2322
import com.sothree.slidinguppanel.canvasSaveProxy.CanvasSaveProxyFactory
@@ -212,8 +211,7 @@ open class SlidingUpPanelLayout @JvmOverloads constructor(
212211
PanelState.COLLAPSED -> smoothSlideTo(0f, 0)
213212
PanelState.EXPANDED -> smoothSlideTo(maxSlideOffset, 0)
214213
PanelState.HIDDEN -> {
215-
val newTop =
216-
computePanelTopPosition(0.0f) + if (isSlidingUp) +panelHeight else -panelHeight
214+
val newTop = computePanelTopPosition(0.0f) + if (isSlidingUp) +panelHeight else -panelHeight
217215
smoothSlideTo(computeSlideOffset(newTop), 0)
218216
}
219217

@@ -329,61 +327,23 @@ open class SlidingUpPanelLayout @JvmOverloads constructor(
329327
val ta = context.obtainStyledAttributes(attrs, R.styleable.SlidingUpPanelLayout)
330328
var scrollerInterpolator: Interpolator? = null
331329
try {
332-
panelHeight = ta.getDimensionPixelSize(
333-
R.styleable.SlidingUpPanelLayout_umanoPanelHeight,
334-
-1
335-
)
336-
shadowHeight = ta.getDimensionPixelSize(
337-
R.styleable.SlidingUpPanelLayout_umanoShadowHeight,
338-
-1
339-
)
340-
parallaxOffset = ta.getDimensionPixelSize(
341-
R.styleable.SlidingUpPanelLayout_umanoParallaxOffset,
342-
-1
343-
)
344-
minFlingVelocity = ta.getInt(
345-
R.styleable.SlidingUpPanelLayout_umanoFlingVelocity,
346-
DEFAULT_MIN_FLING_VELOCITY
347-
)
348-
coveredFadeColor = ta.getColor(
349-
R.styleable.SlidingUpPanelLayout_umanoFadeColor,
350-
DEFAULT_FADE_COLOR
351-
)
352-
dragViewResId =
353-
ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoDragView, -1)
354-
scrollableViewResId =
355-
ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoScrollableView, -1)
356-
aboveShadowResId =
357-
ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoAboveShadowStyle, -1)
358-
belowShadowResId =
359-
ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoBelowShadowStyle, -1)
360-
overlayContent = ta.getBoolean(
361-
R.styleable.SlidingUpPanelLayout_umanoOverlay,
362-
DEFAULT_OVERLAY_FLAG
363-
)
364-
clipPanel = ta.getBoolean(
365-
R.styleable.SlidingUpPanelLayout_umanoClipPanel,
366-
DEFAULT_CLIP_PANEL_FLAG
367-
)
368-
anchorPoint = ta.getFloat(
369-
R.styleable.SlidingUpPanelLayout_umanoAnchorPoint,
370-
DEFAULT_ANCHOR_POINT
371-
)
372-
maxSlideOffset = ta.getFloat(
373-
R.styleable.SlidingUpPanelLayout_umanoMaxSlidingOffset,
374-
DEFAULT_MAX_SLIDING_OFFSET
375-
)
376-
slideState = PanelState.entries.toTypedArray()[ta.getInt(
377-
R.styleable.SlidingUpPanelLayout_umanoInitialState,
378-
DEFAULT_SLIDE_STATE.ordinal
379-
)]
380-
val interpolatorResId = ta.getResourceId(
381-
R.styleable.SlidingUpPanelLayout_umanoScrollInterpolator,
382-
-1
383-
)
330+
panelHeight = ta.getDimensionPixelSize(R.styleable.SlidingUpPanelLayout_umanoPanelHeight, -1)
331+
shadowHeight = ta.getDimensionPixelSize(R.styleable.SlidingUpPanelLayout_umanoShadowHeight, -1)
332+
parallaxOffset = ta.getDimensionPixelSize(R.styleable.SlidingUpPanelLayout_umanoParallaxOffset, -1)
333+
minFlingVelocity = ta.getInt(R.styleable.SlidingUpPanelLayout_umanoFlingVelocity, DEFAULT_MIN_FLING_VELOCITY)
334+
coveredFadeColor = ta.getColor(R.styleable.SlidingUpPanelLayout_umanoFadeColor, DEFAULT_FADE_COLOR)
335+
dragViewResId = ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoDragView, -1)
336+
scrollableViewResId = ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoScrollableView, -1)
337+
aboveShadowResId = ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoAboveShadowStyle, -1)
338+
belowShadowResId = ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoBelowShadowStyle, -1)
339+
overlayContent = ta.getBoolean(R.styleable.SlidingUpPanelLayout_umanoOverlay, DEFAULT_OVERLAY_FLAG)
340+
clipPanel = ta.getBoolean(R.styleable.SlidingUpPanelLayout_umanoClipPanel, DEFAULT_CLIP_PANEL_FLAG)
341+
anchorPoint = ta.getFloat(R.styleable.SlidingUpPanelLayout_umanoAnchorPoint, DEFAULT_ANCHOR_POINT)
342+
maxSlideOffset = ta.getFloat(R.styleable.SlidingUpPanelLayout_umanoMaxSlidingOffset, DEFAULT_MAX_SLIDING_OFFSET)
343+
slideState = PanelState.entries.toTypedArray()[ta.getInt(R.styleable.SlidingUpPanelLayout_umanoInitialState, DEFAULT_SLIDE_STATE.ordinal)]
344+
val interpolatorResId = ta.getResourceId(R.styleable.SlidingUpPanelLayout_umanoScrollInterpolator, -1)
384345
if (interpolatorResId != -1) {
385-
scrollerInterpolator =
386-
AnimationUtils.loadInterpolator(context, interpolatorResId)
346+
scrollerInterpolator = AnimationUtils.loadInterpolator(context, interpolatorResId)
387347
}
388348
} finally {
389349
ta.recycle()

0 commit comments

Comments
 (0)