From ad9c35f522645ccf551767bf4bbc15d7b73d48ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 15 Mar 2015 22:05:12 +0100 Subject: [PATCH] Allow selection of none in SelectSignKeyIdActivity --- .../remote/ui/SelectSignKeyIdActivity.java | 17 ++++++++++++-- .../layout/api_select_sign_key_activity.xml | 22 +++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectSignKeyIdActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectSignKeyIdActivity.java index 5ec47f4c9..b3096ef99 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectSignKeyIdActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/ui/SelectSignKeyIdActivity.java @@ -42,9 +42,11 @@ public class SelectSignKeyIdActivity extends BaseActivity { private Uri mAppUri; private String mPreferredUserId; + private Intent mData; private SelectSignKeyIdListFragment mListFragment; private TextView mActionCreateKey; + private TextView mNone; @Override protected void onCreate(Bundle savedInstanceState) { @@ -67,18 +69,29 @@ public class SelectSignKeyIdActivity extends BaseActivity { createKey(mPreferredUserId); } }); + mNone = (TextView) findViewById(R.id.api_select_sign_key_none); + mNone.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + // 0 is "none" + mData.putExtra(OpenPgpApi.EXTRA_SIGN_KEY_ID, 0); + + setResult(Activity.RESULT_OK, mData); + finish(); + } + }); Intent intent = getIntent(); mAppUri = intent.getData(); mPreferredUserId = intent.getStringExtra(EXTRA_USER_ID); - Intent data = intent.getParcelableExtra(EXTRA_DATA); + mData = intent.getParcelableExtra(EXTRA_DATA); if (mAppUri == null) { Log.e(Constants.TAG, "Intent data missing. Should be Uri of app!"); finish(); return; } else { Log.d(Constants.TAG, "uri: " + mAppUri); - startListFragments(savedInstanceState, mAppUri, data); + startListFragments(savedInstanceState, mAppUri, mData); } } diff --git a/OpenKeychain/src/main/res/layout/api_select_sign_key_activity.xml b/OpenKeychain/src/main/res/layout/api_select_sign_key_activity.xml index 0528fc11e..981e01dd1 100644 --- a/OpenKeychain/src/main/res/layout/api_select_sign_key_activity.xml +++ b/OpenKeychain/src/main/res/layout/api_select_sign_key_activity.xml @@ -35,6 +35,28 @@ android:text="@string/api_select_sign_key_text" android:textAppearance="?android:attr/textAppearanceMedium" /> + + + + + +