android-sliding-layer-lib icon indicating copy to clipboard operation
android-sliding-layer-lib copied to clipboard

implementing onBackPressed for SlidingLayer

Open pishguy opened this issue 7 years ago • 2 comments

i have a big problem with this library such as implementing onBackPressed for opened SlidingLayers on fragments or activities, how can i do that without implementing android listeners to detect that?

pishguy avatar Apr 12 '18 06:04 pishguy

What I did to prevent back navigation when SlidingLayer is open is to simple override onBackPressed() and check if the layer is open. Was this your question?

    @Override
    public void onBackPressed() {
        if (slidingLayer.isOpened()) {
            slidingLayer.closeLayer(true);
        } else {
            super.onBackPressed();
        }
    }

Mr-Krabbe avatar Jan 03 '19 09:01 Mr-Krabbe

Right, that's left at your complete control and will. Where you able to find a similar solution to apply to your navigation patterns @MahdiPishguy ?

JlUgia avatar Jan 03 '19 22:01 JlUgia