mirror of
https://github.com/moparisthebest/open-keychain
synced 2025-02-17 07:30:14 -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.HashMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.Constants;
|
import org.sufficientlysecure.keychain.Constants;
|
||||||
import org.sufficientlysecure.keychain.Id;
|
import org.sufficientlysecure.keychain.Id;
|
||||||
@ -473,6 +472,7 @@ public class KeyListFragment extends Fragment implements AdapterView.OnItemClick
|
|||||||
holder = new HeaderViewHolder();
|
holder = new HeaderViewHolder();
|
||||||
convertView = mInflater.inflate(R.layout.key_list_header, parent, false);
|
convertView = mInflater.inflate(R.layout.key_list_header, parent, false);
|
||||||
holder.text = (TextView) convertView.findViewById(R.id.stickylist_header_text);
|
holder.text = (TextView) convertView.findViewById(R.id.stickylist_header_text);
|
||||||
|
holder.count = (TextView) convertView.findViewById(R.id.contacts_num);
|
||||||
convertView.setTag(holder);
|
convertView.setTag(holder);
|
||||||
} else {
|
} else {
|
||||||
holder = (HeaderViewHolder) convertView.getTag();
|
holder = (HeaderViewHolder) convertView.getTag();
|
||||||
@ -489,6 +489,13 @@ public class KeyListFragment extends Fragment implements AdapterView.OnItemClick
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(mCursor.getInt(KeyListFragment.INDEX_TYPE) == KeyTypes.SECRET) {
|
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));
|
holder.text.setText(convertView.getResources().getString(R.string.my_keys));
|
||||||
return convertView;
|
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);
|
headerText = "" + mCursor.getString(KeyListFragment.INDEX_UID).subSequence(0, 1).charAt(0);
|
||||||
}
|
}
|
||||||
holder.text.setText(headerText);
|
holder.text.setText(headerText);
|
||||||
|
holder.count.setVisibility(View.GONE);
|
||||||
return convertView;
|
return convertView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -533,6 +541,7 @@ public class KeyListFragment extends Fragment implements AdapterView.OnItemClick
|
|||||||
|
|
||||||
class HeaderViewHolder {
|
class HeaderViewHolder {
|
||||||
TextView text;
|
TextView text;
|
||||||
|
TextView count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -11,6 +11,20 @@
|
|||||||
android:padding="8dp"
|
android:padding="8dp"
|
||||||
android:textColor="@color/emphasis"
|
android:textColor="@color/emphasis"
|
||||||
android:textSize="17sp"
|
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>
|
</RelativeLayout>
|
@ -145,6 +145,11 @@
|
|||||||
<string name="expired">expired</string>
|
<string name="expired">expired</string>
|
||||||
<string name="revoked">revoked</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">
|
<plurals name="n_key_servers">
|
||||||
<item quantity="one">%d keyserver</item>
|
<item quantity="one">%d keyserver</item>
|
||||||
<item quantity="other">%d keyservers</item>
|
<item quantity="other">%d keyservers</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user