diff options
author | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-09-08 16:08:36 +0200 |
---|---|---|
committer | Dominik Schürmann <dominik@dominikschuermann.de> | 2013-09-08 16:08:36 +0200 |
commit | 6fdae001cc5ee742cceaeea82c75f0e314a3449f (patch) | |
tree | c95c7fc90a1f542d97afb1d69a13dd8688a6d01e /OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SelectSecretKeyActivity.java | |
parent | a890ba5e4f33e5ac5c58d96a7ea04030fd763a0e (diff) | |
download | open-keychain-6fdae001cc5ee742cceaeea82c75f0e314a3449f.tar.gz open-keychain-6fdae001cc5ee742cceaeea82c75f0e314a3449f.tar.bz2 open-keychain-6fdae001cc5ee742cceaeea82c75f0e314a3449f.zip |
Make select fragments more reusable
Diffstat (limited to 'OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SelectSecretKeyActivity.java')
-rw-r--r-- | OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SelectSecretKeyActivity.java | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SelectSecretKeyActivity.java b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SelectSecretKeyActivity.java index 10acd38d9..624495925 100644 --- a/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SelectSecretKeyActivity.java +++ b/OpenPGP-Keychain/src/org/sufficientlysecure/keychain/ui/SelectSecretKeyActivity.java @@ -38,7 +38,9 @@ public class SelectSecretKeyActivity extends SherlockFragmentActivity { public static final String RESULT_EXTRA_MASTER_KEY_ID = "masterKeyId"; public static final String RESULT_EXTRA_USER_ID = "userId"; - public static boolean filterCertify = false; + + private boolean mFilterCertify = false; + private SelectSecretKeyFragment mSelectFragment; @Override protected void onCreate(Bundle savedInstanceState) { @@ -64,9 +66,28 @@ public class SelectSecretKeyActivity extends SherlockFragmentActivity { // } // }); - filterCertify = getIntent().getBooleanExtra(EXTRA_FILTER_CERTIFY, false); + mFilterCertify = getIntent().getBooleanExtra(EXTRA_FILTER_CERTIFY, false); handleIntent(getIntent()); + + // Check that the activity is using the layout version with + // the fragment_container FrameLayout + if (findViewById(R.id.select_secret_key_fragment_container) != null) { + + // However, if we're being restored from a previous state, + // then we don't need to do anything and should return or else + // we could end up with overlapping fragments. + if (savedInstanceState != null) { + return; + } + + // Create an instance of the fragment + mSelectFragment = SelectSecretKeyFragment.newInstance(mFilterCertify); + + // Add the fragment to the 'fragment_container' FrameLayout + getSupportFragmentManager().beginTransaction() + .add(R.id.select_secret_key_fragment_container, mSelectFragment).commit(); + } } /** |