Allow selection of none in SelectSignKeyIdActivity

This commit is contained in:
Dominik Schürmann 2015-03-15 22:05:12 +01:00
parent 5cb22ece30
commit ad9c35f522
2 changed files with 37 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -35,6 +35,28 @@
android:text="@string/api_select_sign_key_text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
<TextView
android:id="@+id/api_select_sign_key_none"
android:background="?android:selectableItemBackground"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:text="@string/none"
android:layout_height="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
android:clickable="true" />
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="?android:attr/listDivider" />
<FrameLayout
android:id="@+id/api_select_sign_key_list_fragment"
android:layout_width="match_parent"