Skip to content

Commit

Permalink
Android: Bring Drawer on top of SDL Surface
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghabry committed Mar 9, 2023
1 parent 9f89d4e commit 27d58b5
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import android.util.Log;
import android.view.MenuItem;
import android.view.SurfaceView;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.RelativeLayout;
Expand Down Expand Up @@ -91,6 +92,30 @@ protected void onCreate(Bundle savedInstanceState) {
// Menu configuration
this.drawer = findViewById(R.id.drawer_layout);
drawer.setDrawerLockMode(DrawerLayout.LOCK_MODE_LOCKED_CLOSED);
drawer.addDrawerListener(new DrawerLayout.DrawerListener() {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
// Prevent drawer from rendering behind the SDL Surface
// via https://stackoverflow.com/q/20976149/
drawer.bringChildToFront(drawerView);
drawer.requestLayout();
}

@Override
public void onDrawerOpened(@NonNull View drawerView) {

}

@Override
public void onDrawerClosed(@NonNull View drawerView) {

}

@Override
public void onDrawerStateChanged(int newState) {

}
});

NavigationView navigationView = findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
Expand Down Expand Up @@ -266,8 +291,10 @@ public static void staticOpenOrCloseMenu(EasyRpgPlayerActivity activity) {

public void openOrCloseMenu() {
if (drawer.isDrawerOpen(GravityCompat.START)) {
//surface.setAlpha(0f);
drawer.closeDrawer(GravityCompat.START);
} else {
//surface.setAlpha(1f);
drawer.openDrawer(GravityCompat.START);
}
}
Expand Down

0 comments on commit 27d58b5

Please sign in to comment.