Skip to content

Commit

Permalink
Discard back button presses to exit the app in WaveVR and Daydream
Browse files Browse the repository at this point in the history
  • Loading branch information
MortimerGoro committed Mar 13, 2019
1 parent a626f1d commit c01bca6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
26 changes: 13 additions & 13 deletions app/src/googlevr/java/org/mozilla/vrbrowser/PlatformActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,19 +107,12 @@ public void onDrawFrame(GL10 gl) {

mLayout.setAsyncReprojectionEnabled(true);
mLayout.setPresentationView(mView);

try {
final Class flatActivityClass = Class.forName(FLAT_ACTIVITY_CLASSNAME);
mLayout.getUiLayout().setCloseButtonListener(new Runnable() {
@Override
public void run() {
startActivity(new Intent(PlatformActivity.this, flatActivityClass));
}
});
}
catch (ClassNotFoundException e) {
Log.e(LOGTAG,"Class not found: " + e.toString());
}
mLayout.getUiLayout().setCloseButtonListener(new Runnable() {
@Override
public void run() {
finish();
}
});

setImmersiveSticky();
setContentView(mLayout);
Expand Down Expand Up @@ -200,6 +193,13 @@ private void notifyPendingEvents() {
}
}

@Override
public void onBackPressed() {
// Discard back button presses that would otherwise exit the app,
// as the UI standard on this platform is to require the use of
// the Daydream button to exit application.
}

private native void activityCreated(Object aAssetManager, final long aContext);
private native void activityPaused();
private native void activityResumed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ public void run() {
});
}

@Override
public void onBackPressed() {
// Discard back button presses that would otherwise exit the app,
// as the UI standard on this platform is to require the use of
// the system menu to exit applications.
}

protected native void queueRunnable(Runnable aRunnable);
protected native void initializeJava(AssetManager aAssets);
}

0 comments on commit c01bca6

Please sign in to comment.