Comments (6)
Until this is fixed, you can do the following to prevent this behaviour:
final SlidingUpPanelLayout layout = (SlidingUpPanelLayout) findViewById(R.id.sliding_layout);
layout.setPanelSlideListener(new SlidingUpPanelLayout.PanelSlideListener() {
private AtomicBoolean mPanelCollapsed = new AtomicBoolean(true);
@Override
public void onPanelSlide(final View panel, final float slideOffset) {
}
@Override
public void onPanelExpanded(final View panel) {
if (mPanelCollapsed.compareAndSet(true, false)) {
LOG.trace("onPanelExpanded");
}
}
@Override
public void onPanelCollapsed(final View panel) {
if (mPanelCollapsed.compareAndSet(false, true)) {
LOG.trace("onPanelCollapsed");
}
}
});
from androidslidinguppanel.
Good call! I implemented your solution in my personal dev branch.
from androidslidinguppanel.
The first thing you mention is actually working as intended. onPanelExpanded
is supposed to get called every time the panel is full expanded (i.e. even after it snaps back). The second thing is probably a bug.
from androidslidinguppanel.
About the second problem (with the two calls initialState -> finalState), from what I've seen in the debugger, I think what happens is:
public boolean onTouchEvent(MotionEvent ev) {
....
mDragHelper.processTouchEvent(ev);
.....
case MotionEvent.ACTION_UP: {
// if isDragViewHit, expand/anchor/collapse the panel
}
The ACTION_UP part is OK, leading to the desired final state. I guess the mDragHelper.processTouchEvent triggers onViewDragStateChanged with STATE_IDLE for the initial state, this dispatching the associated callback for the initial state. I've tried not calling mDragHelper.processTouchEvent(ev) for the ACTION_UP + isDragViewHit case (since it's a case the library gets to handle explicitly) and, at first sight, it seems to work. Yet, I'm not completely sure if it's OK not to let the DragHelper process that event. Maybe it needs to for some specific case in dragging that I might have missed while testing.
from androidslidinguppanel.
Hi Irina, thanks for having a look. I'll check it out myself this week, when I have time. But this definitely helps!
from androidslidinguppanel.
Fixed in 532a926
from androidslidinguppanel.
Related Issues (20)
- Cause: org/gradle/api/tasks/testing/AbstractTestTask
- java.lang.IllegalArgumentException happened occasionally
- Very Good HOT 1
- Scroll RecyclerView when panel is at Anchored Point HOT 2
- Slideable view - margin left and right
- Question: Is there an easy way to dismiss panel when user taps on main content? HOT 1
- DrawerLayout with SlidingUpPanel doesn't fit system windows HOT 1
- Ridiculous bug. Panel refuses to expand!
- default grey line on top of sliding panel which needs to expand or collapsed HOT 1
- 🔴🔴🔴 IMP Repo seems dead, New commits at https://github.com/hannesa2/AndroidSlidingUpPanel/
- Black space between main and draggable content on new Samsung devices
- mLastMotionY 数组越界问题
- Change position of a specific view in SlidingUpPanel Layout. HOT 1
- Rounded Corners at the top
- SlidingUpPanel with BottomNavigation Help ....
- never recalculate the layout height after replace it programmatically
- com.sothree.slidinguppanel.SlidingUpPanelLayout.onMeasure (SlidingUpPanelLayout.java:803)
- Build Analyzer found problems for update to AndroidX (Jetifier)
- Avoid panel collapsewhen click in screen. HOT 2
- Drawable drawable/above_shadow has unresolved theme attributes! Consider using Resources.getDrawable(int, Theme) or Context.getDrawable(int). HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from androidslidinguppanel.