android: Only close TrustedCertificatesActivity on click when selecting a certificate

This commit is contained in:
Tobias Brunner
2014-07-22 10:41:50 +02:00
parent 9c841b1f34
commit 1353f08fbc
@@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2012 Tobias Brunner * Copyright (C) 2012-2014 Tobias Brunner
* Hochschule fuer Technik Rapperswil * Hochschule fuer Technik Rapperswil
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@ import android.view.MenuItem;
public class TrustedCertificatesActivity extends Activity implements TrustedCertificateListFragment.OnTrustedCertificateSelectedListener public class TrustedCertificatesActivity extends Activity implements TrustedCertificateListFragment.OnTrustedCertificateSelectedListener
{ {
public static final String SELECT_CERTIFICATE = "org.strongswan.android.action.SELECT_CERTIFICATE"; public static final String SELECT_CERTIFICATE = "org.strongswan.android.action.SELECT_CERTIFICATE";
private boolean mSelect;
@Override @Override
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
@@ -60,6 +61,7 @@ public class TrustedCertificatesActivity extends Activity implements TrustedCert
{ {
actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0));
} }
mSelect = SELECT_CERTIFICATE.equals(getIntent().getAction());
} }
@Override @Override
@@ -83,6 +85,8 @@ public class TrustedCertificatesActivity extends Activity implements TrustedCert
@Override @Override
public void onTrustedCertificateSelected(TrustedCertificateEntry selected) public void onTrustedCertificateSelected(TrustedCertificateEntry selected)
{
if (mSelect)
{ {
/* the user selected a certificate, return to calling activity */ /* the user selected a certificate, return to calling activity */
Intent intent = new Intent(); Intent intent = new Intent();
@@ -90,6 +94,7 @@ public class TrustedCertificatesActivity extends Activity implements TrustedCert
setResult(Activity.RESULT_OK, intent); setResult(Activity.RESULT_OK, intent);
finish(); finish();
} }
}
public static class TrustedCertificatesTabListener implements ActionBar.TabListener public static class TrustedCertificatesTabListener implements ActionBar.TabListener
{ {