Open ghost opened 8 years ago
I am also facing this problem
sir try to comment setSheetTranslation(newSheetViewHeight) that's what I did. Everytime the softkeyboard pops up setSheetTranslation(newSheetViewHeight) is executed. So far I have not experienced other bugs and it fixes the aforementioned problem. Just post if ever there's a new bug you might encounter after commenting it.
@lFaustus What is the purpose of this entire onLayoutChange code for the library?
I am facing a similar problem with an EditText
in the sheet's layout. After closing the soft keyboard (pressing the back button), the sheet appears to be EXPANDED
but it actually is in the PEEKED
state; it's just that the graphical interface is not updated with the sheet's actual position after dismissing the soft keyboard. If I manually drag the sheet to change its state, it shows a little jump in the translation then acts normal again.
It seems Google has provided a new BottomSheet component as part of their libraries: http://android-developers.blogspot.co.il/2016/02/android-support-library-232.html I wonder how good it works, if it has all important features and if it doesn't have issues.
Thanks for the heads-up @AndroidDeveloperLB, I'll give it a look.
@mohanadmohie You're welcomed. I can't find any samples though.
This is in fact a bug and has something to do with activity windowSoftInputMode
modes. PRs welcome on this, but haven't had time to look at this
Same issue here. This is a serious bug if you are working with any kind of text input/soft keyboard.
What is the use-case for that made you add it?
if (state != State.HIDDEN && newSheetViewHeight < currentSheetViewHeight) {
// The sheet can no longer be in the expanded state if it has shrunk
if (state == State.EXPANDED) {
setState(State.PEEKED);
}
setSheetTranslation(newSheetViewHeight);
}
Can you give me some input?
@meierjan sir did u try to set the input method to adjustpan? adjustpan fixed the problem
@lFaustus thanks for the hint but this is not desired in my case
This still seems to be an issue
same problem, contains EditText items in bottomsheet I have an idea:
//screenHeight
private int screenHeight = 0;
//The height of the bottomsheet sliding up
private int keyHeight = 0;
screenHeight = this.getWindowManager().getDefaultDisplay().getHeight();
//if keyHeight is 1 / 3 of screenHeight ,we think it pop-ups
keyHeight = screenHeight / 3;
bottomsheet.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right,
int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
//The height of the sliding up more than one-third of the screen,we think it pop-ups
if (oldBottom != 0 && bottom != 0 && (oldBottom - bottom > keyHeight)) {
Log.d("keyboard ","showing");
} else if (oldBottom != 0 && bottom != 0 && (bottom - oldBottom > keyHeight)) {
Log.d("keyboard ","dismiss");
//return PEEK state
bottomsheet.peekSheet();
}
}
});
hope a better idea
Step 1: open bottom sheet and expanded it to top. There is a recyclerView which contains EditText items in bottom sheet; Step 2: click any EditText then soft keyboard shows; Step 3: fold the soft keyboard. And now bottom sheet keeps peeked state. Step 4: click top item of recyclerView, the bug is bottom sheet auto hides. Even if I touch the item at bottom position, the bottom sheet doesn't work normally.
After reading source code, I think the problem happens here:(BottomSheetLayout.class line 669)
When soft keyboard is fold, the code "setSheetTranslation(newSheetViewHeight);" isn't execute. This makes onTouchEvent works abnormally.