mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-24 01:32:16 -05:00
add contact count to My Keys header
This commit is contained in:
parent
de6daf5c30
commit
be558944b5
@ -19,7 +19,6 @@ package org.sufficientlysecure.keychain.ui;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Set;
|
||||
|
||||
import org.sufficientlysecure.keychain.Constants;
|
||||
import org.sufficientlysecure.keychain.Id;
|
||||
@ -473,6 +472,7 @@ public class KeyListFragment extends Fragment implements AdapterView.OnItemClick
|
||||
holder = new HeaderViewHolder();
|
||||
convertView = mInflater.inflate(R.layout.key_list_header, parent, false);
|
||||
holder.text = (TextView) convertView.findViewById(R.id.stickylist_header_text);
|
||||
holder.count = (TextView) convertView.findViewById(R.id.contacts_num);
|
||||
convertView.setTag(holder);
|
||||
} else {
|
||||
holder = (HeaderViewHolder) convertView.getTag();
|
||||
@ -489,6 +489,13 @@ public class KeyListFragment extends Fragment implements AdapterView.OnItemClick
|
||||
}
|
||||
|
||||
if(mCursor.getInt(KeyListFragment.INDEX_TYPE) == KeyTypes.SECRET) {
|
||||
{ // set contact count
|
||||
int num = mCursor.getCount();
|
||||
String contactsTotal = getResources().getQuantityString(R.plurals.n_contacts, num, num);
|
||||
holder.count.setText(contactsTotal);
|
||||
holder.count.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
holder.text.setText(convertView.getResources().getString(R.string.my_keys));
|
||||
return convertView;
|
||||
}
|
||||
@ -500,6 +507,7 @@ public class KeyListFragment extends Fragment implements AdapterView.OnItemClick
|
||||
headerText = "" + mCursor.getString(KeyListFragment.INDEX_UID).subSequence(0, 1).charAt(0);
|
||||
}
|
||||
holder.text.setText(headerText);
|
||||
holder.count.setVisibility(View.GONE);
|
||||
return convertView;
|
||||
}
|
||||
|
||||
@ -533,6 +541,7 @@ public class KeyListFragment extends Fragment implements AdapterView.OnItemClick
|
||||
|
||||
class HeaderViewHolder {
|
||||
TextView text;
|
||||
TextView count;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -11,6 +11,20 @@
|
||||
android:padding="8dp"
|
||||
android:textColor="@color/emphasis"
|
||||
android:textSize="17sp"
|
||||
android:textStyle="bold" />
|
||||
android:textStyle="bold"
|
||||
android:text="header text" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
||||
android:text="contact count"
|
||||
android:id="@+id/contacts_num"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_marginRight="10px"
|
||||
android:visibility="visible"
|
||||
android:textColor="@android:color/darker_gray" />
|
||||
|
||||
</RelativeLayout>
|
@ -145,6 +145,11 @@
|
||||
<string name="expired">expired</string>
|
||||
<string name="revoked">revoked</string>
|
||||
|
||||
<plurals name="n_contacts">
|
||||
<item quantity="one">1 contact</item>
|
||||
<item quantity="other">%d contacts</item>
|
||||
</plurals>
|
||||
|
||||
<plurals name="n_key_servers">
|
||||
<item quantity="one">%d keyserver</item>
|
||||
<item quantity="other">%d keyservers</item>
|
||||
|
Loading…
Reference in New Issue
Block a user