Fix strings.

* Changes
  + Remove "Up time:" from ongoing event display.
  + Add hint in disconnected notification.
This commit is contained in:
Hung-ying Tyan
2009-07-04 00:24:48 +08:00
parent 116d890aea
commit 0102dc6b22
2 changed files with 12 additions and 15 deletions

View File

@@ -3,9 +3,8 @@
<!-- Title for the VPN Services activity. -->
<string name="app_label">VPN Services</string>
<string name="vpn_notification_title">%s VPN %s</string>
<string name="vpn_notification_connected">connected</string>
<string name="vpn_notification_disconnected">disconnected</string>
<string name="vpn_notification_connected_message">Up time: %s</string>
<string name="vpn_notification_title_connected">%s VPN connected</string>
<string name="vpn_notification_title_disconnected">%s VPN disconnected</string>
<string name="vpn_notification_hint_disconnected">Touch to reconnect to a VPN.</string>
</resources>

View File

@@ -490,16 +490,15 @@ abstract class VpnService<E extends VpnProfile> {
}
private String getNotificationTitle(boolean connected) {
String connectedOrNot = connected
? mContext.getString(R.string.vpn_notification_connected)
String formatString = connected
? mContext.getString(
R.string.vpn_notification_title_connected)
: mContext.getString(
R.string.vpn_notification_disconnected);
return String.format(
mContext.getString(R.string.vpn_notification_title),
mProfile.getName(), connectedOrNot);
R.string.vpn_notification_title_disconnected);
return String.format(formatString, mProfile.getName());
}
private String getTimeFormat(long duration) {
private String getFormattedTime(long duration) {
long hours = duration / 3600;
StringBuilder sb = new StringBuilder();
if (hours > 0) sb.append(hours).append(':');
@@ -511,11 +510,10 @@ abstract class VpnService<E extends VpnProfile> {
private String getNotificationMessage(boolean connected) {
if (connected) {
long time = (System.currentTimeMillis() - mStartTime) / 1000;
return String.format(mContext.getString(
R.string.vpn_notification_connected_message),
getTimeFormat(time));
return getFormattedTime(time);
} else {
return "";
return mContext.getString(
R.string.vpn_notification_hint_disconnected);
}
}
}