Cleanup in SelectKeyCursorAdapter

This commit is contained in:
Dominik Schürmann 2014-04-09 01:11:33 +02:00
parent 9fb493418e
commit 27eb7c0f1b
2 changed files with 3 additions and 9 deletions

View File

@ -244,7 +244,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T
Vector<String> userIds = new Vector<String>(); Vector<String> userIds = new Vector<String>();
for (int i = 0; i < getListView().getCount(); ++i) { for (int i = 0; i < getListView().getCount(); ++i) {
if (getListView().isItemChecked(i)) { if (getListView().isItemChecked(i)) {
userIds.add((String) mAdapter.getUserId(i)); userIds.add(mAdapter.getUserId(i));
} }
} }

View File

@ -25,6 +25,7 @@ import android.view.ViewGroup;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.ListView; import android.widget.ListView;
import android.widget.TextView; import android.widget.TextView;
import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.Id;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
@ -91,8 +92,6 @@ public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter {
@Override @Override
public void bindView(View view, Context context, Cursor cursor) { public void bindView(View view, Context context, Cursor cursor) {
boolean valid = cursor.getInt(mIndexProjectionValid) > 0;
TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId); TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId);
TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest);
TextView keyId = (TextView) view.findViewById(R.id.keyId); TextView keyId = (TextView) view.findViewById(R.id.keyId);
@ -112,13 +111,10 @@ public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter {
mainUserIdRest.setText(""); mainUserIdRest.setText("");
} }
// TODO: needed to key id to no?
keyId.setText(R.string.no_key);
long masterKeyId = cursor.getLong(mIndexMasterKeyId); long masterKeyId = cursor.getLong(mIndexMasterKeyId);
keyId.setText(PgpKeyHelper.convertKeyIdToHexShort(masterKeyId)); keyId.setText(PgpKeyHelper.convertKeyIdToHexShort(masterKeyId));
// TODO: needed to set unknown_status? boolean valid = cursor.getInt(mIndexProjectionValid) > 0;
status.setText(R.string.unknown_status);
if (valid) { if (valid) {
if (mKeyType == Id.type.public_key) { if (mKeyType == Id.type.public_key) {
status.setText(R.string.can_encrypt); status.setText(R.string.can_encrypt);
@ -149,8 +145,6 @@ public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter {
selected.setVisibility(View.GONE); selected.setVisibility(View.GONE);
} }
status.setText(status.getText() + " ");
view.setEnabled(valid); view.setEnabled(valid);
mainUserId.setEnabled(valid); mainUserId.setEnabled(valid);
mainUserIdRest.setEnabled(valid); mainUserIdRest.setEnabled(valid);