Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added warning on accidental exit #201

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,13 @@ public void databaseUnavailable() {
// we assume the service connection is mocked and does not require any of these calls
}

@Override
public void onBackPressed() {
if (ODKWebView.canGoBack()) {
ODKWebView.goBack();
} else {
super.onBackPressed();
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.opendatakit.tables.activities;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Intent;
import android.net.Uri;
Expand Down Expand Up @@ -83,7 +84,7 @@ public abstract class AbsBaseWebActivity extends AbsTableActivity implements IOd
// no need to preserve
private PropertyManager mPropertyManager;

public abstract String getInstanceId();
public abstract String getInstanceId();

/**
* Gets the active webkit view
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentManager.BackStackEntry;
import androidx.fragment.app.FragmentTransaction;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
Expand Down Expand Up @@ -265,7 +267,20 @@ private void popBackStack() {
if (idxLast < 0) {
Intent result = new Intent();
this.setResult(RESULT_OK, result);
finish();
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle("Closing Application")
.setMessage("Are you sure you want to close this application?")
.setPositiveButton("Yes", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which) {
finish();
}

})
.setNegativeButton("No", null)
.show();
} else {
BackStackEntry entry = mgr.getBackStackEntryAt(idxLast);
swapScreens(ScreenType.valueOf(entry.getName()));
Expand Down