Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Discard back button presses to exit the app in WaveVR and Daydream #1002

Merged
merged 1 commit into from
Mar 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}