Merge "Use proper formatting strings for GAL lookup status"

This commit is contained in:
Andrew Stadler 2010-03-17 09:20:27 -07:00 committed by Android (Google) Code Review
commit d806749834
2 changed files with 34 additions and 6 deletions

View File

@ -676,4 +676,26 @@
automatically enabled for pre-existing Exchange accounts on upgrade -->
<string name="notification_exchange_calendar_added">Exchange calendar added</string>
<!-- Strings used for GAL access -->
<!-- Displayed in small separator in to/cc/bcc dropdowns, when searching GAL begins.
Example: "Searching bigcompany.com..." -->
<string name="gal_searching_fmt">Searching <xliff:g id="domain">%s</xliff:g>\u2026</string>
<!-- Displayed in small separator in to/cc/bcc dropdowns, when searching GAL completes,
and all of the server results are being displayed. Example:
"5 results from bigcompany.com..." -->
<plurals name="gal_completed_fmt">
<!-- Case of one result from server. -->
<item quantity="one"><xliff:g id="results" example="1">%d</xliff:g> result
from <xliff:g id="domain">%s</xliff:g></item>
<!-- Case of multiple results from server -->
<item quantity="other"><xliff:g id="results" example="20">%d</xliff:g> results
from <xliff:g id="domain">%s</xliff:g></item>
</plurals>
<!-- Displayed in small separator in to/cc/bcc dropdowns, when searching GAL completes,
and a limited amount (not all) of the server results are being displayed. This is
always a larger value because it represents the limit of displayed results. -->
<string name="gal_completed_limited_fmt">First <xliff:g id="results" example="20">%d</xliff:g>
results from <xliff:g id="domain">%s</xliff:g></string>
</resources>

View File

@ -35,7 +35,7 @@ import android.widget.ListView;
import android.widget.TextView;
/**
* TODO: Use real format strings, get rid of all hardcoded strings
* Email Address adapter that performs asynchronous GAL lookups.
*/
public class GalEmailAddressAdapter extends EmailAddressAdapter {
// STOPSHIP - DO NOT RELEASE AS 'TRUE'
@ -237,19 +237,25 @@ public class GalEmailAddressAdapter extends EmailAddressAdapter {
separator = mInflater.inflate(R.layout.recipient_dropdown_separator, parent, false);
TextView text1 = (TextView) separator.findViewById(R.id.text1);
View progress = separator.findViewById(R.id.progress);
// TODO replace this logic with proper formatting
String bannerText;
if (mSeparatorDisplayCount == -1) {
text1.setText("Searching " + mAccountEmailDomain);
// Display "Searching <account>..."
bannerText = mContext.getString(R.string.gal_searching_fmt, mAccountEmailDomain);
progress.setVisibility(View.VISIBLE);
} else {
if (mSeparatorDisplayCount == mSeparatorTotalCount) {
text1.setText(mSeparatorDisplayCount + " results from " + mAccountEmailDomain);
// Display "x results from <account>"
bannerText = mContext.getResources().getQuantityString(
R.plurals.gal_completed_fmt, mSeparatorDisplayCount,
mSeparatorDisplayCount, mAccountEmailDomain);
} else {
text1.setText("First " + mSeparatorDisplayCount + " results from " +
mAccountEmailDomain);
// Display "First x results from <account>"
bannerText = mContext.getString(R.string.gal_completed_limited_fmt,
mSeparatorDisplayCount, mAccountEmailDomain);
}
progress.setVisibility(View.GONE);
}
text1.setText(bannerText);
return separator;
}
return super.getView(getRealPosition(position), convertView, parent);