certs: green dots for verified status \o/

This commit is contained in:
Vincent Breitmoser 2014-03-15 19:58:17 +01:00
parent 5c28da44d6
commit f192c70179
2 changed files with 21 additions and 3 deletions

View File

@ -25,6 +25,7 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.TextView;
import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.PgpKeyHelper;
@ -90,18 +91,25 @@ public class ViewKeyUserIdsAdapter extends CursorAdapter {
TextView vRank = (TextView) view.findViewById(R.id.rank);
TextView vUserId = (TextView) view.findViewById(R.id.userId);
TextView vAddress = (TextView) view.findViewById(R.id.address);
ImageView vVerified = (ImageView) view.findViewById(R.id.certified);
vRank.setText(Integer.toString(cursor.getInt(mIndexRank)));
String[] userId = PgpKeyHelper.splitUserId(cursor.getString(mIndexUserId));
int verified = cursor.getInt(mVerifiedId);
if (userId[0] != null) {
vUserId.setText(userId[0] + (verified > 0 ? " (ok)" : "(nope)"));
vUserId.setText(userId[0]);
} else {
vUserId.setText(R.string.user_id_no_name);
}
vAddress.setText(userId[1]);
int verified = cursor.getInt(mVerifiedId);
// TODO introduce own resource for this :)
if(verified > 0)
vVerified.setImageResource(android.R.drawable.presence_online);
else
vVerified.setImageResource(android.R.drawable.presence_invisible);
// don't care further if checkboxes aren't shown
if(mCheckStates == null)
return;

View File

@ -24,7 +24,8 @@
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="@+id/userId"
@ -40,6 +41,15 @@
android:text="@string/label_email"
android:textAppearance="?android:attr/textAppearanceSmall"
android:paddingLeft="10dp" />
</LinearLayout>
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/certified"
android:src="@android:drawable/presence_invisible"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" />
</LinearLayout>