Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8d85cf0c authored by Android (Google) Code Review's avatar Android (Google) Code Review Committed by The Android Open Source Project
Browse files

am 6b1ab257: Merge change 6187 into donut

Merge commit '6b1ab257'

* commit '6b1ab257':
  Fix strings.
parents 522ea0d6 6b1ab257
Loading
Loading
Loading
Loading
+3 −4
Original line number Original line Diff line number Diff line
@@ -3,9 +3,8 @@
    <!-- Title for the VPN Services activity. -->
    <!-- Title for the VPN Services activity. -->
    <string name="app_label">VPN Services</string>
    <string name="app_label">VPN Services</string>


    <string name="vpn_notification_title">%s VPN %s</string>
    <string name="vpn_notification_title_connected">%s VPN connected</string>
    <string name="vpn_notification_connected">connected</string>
    <string name="vpn_notification_title_disconnected">%s VPN disconnected</string>
    <string name="vpn_notification_disconnected">disconnected</string>
    <string name="vpn_notification_hint_disconnected">Touch to reconnect to a VPN.</string>
    <string name="vpn_notification_connected_message">Up time: %s</string>
</resources>
</resources>
+9 −11
Original line number Original line Diff line number Diff line
@@ -490,16 +490,15 @@ abstract class VpnService<E extends VpnProfile> {
        }
        }


        private String getNotificationTitle(boolean connected) {
        private String getNotificationTitle(boolean connected) {
            String connectedOrNot = connected
            String formatString = connected
                    ? mContext.getString(R.string.vpn_notification_connected)
                    ? mContext.getString(
                            R.string.vpn_notification_title_connected)
                    : mContext.getString(
                    : mContext.getString(
                            R.string.vpn_notification_disconnected);
                            R.string.vpn_notification_title_disconnected);
            return String.format(
            return String.format(formatString, mProfile.getName());
                    mContext.getString(R.string.vpn_notification_title),
                    mProfile.getName(), connectedOrNot);
        }
        }


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