Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: ui/base/l10n/l10n_util_android.cc

Issue 147443007: Add support for localized time strings with two units, eg. "2 hours 17 minutes" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Bartosz' 3rd round of comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/base/l10n/l10n_util_android.h" 5 #include "ui/base/l10n/l10n_util_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 env, 96 env,
97 java_locale.obj(), 97 java_locale.obj(),
98 java_display_locale.obj())); 98 java_display_locale.obj()));
99 return ConvertJavaStringToUTF16(java_result); 99 return ConvertJavaStringToUTF16(java_result);
100 } 100 }
101 101
102 jstring GetDurationString(JNIEnv* env, jclass clazz, jlong timeInMillis) { 102 jstring GetDurationString(JNIEnv* env, jclass clazz, jlong timeInMillis) {
103 ScopedJavaLocalRef<jstring> jtime_remaining = 103 ScopedJavaLocalRef<jstring> jtime_remaining =
104 base::android::ConvertUTF16ToJavaString( 104 base::android::ConvertUTF16ToJavaString(
105 env, 105 env,
106 ui::TimeFormat::TimeRemaining( 106 ui::TimeFormat::Simple(
107 ui::TimeFormat::FORMAT_REMAINING, ui::TimeFormat::LENGTH_SHORT,
107 base::TimeDelta::FromMilliseconds(timeInMillis))); 108 base::TimeDelta::FromMilliseconds(timeInMillis)));
108 return jtime_remaining.Release(); 109 return jtime_remaining.Release();
109 } 110 }
110 111
111 bool RegisterLocalizationUtil(JNIEnv* env) { 112 bool RegisterLocalizationUtil(JNIEnv* env) {
112 return RegisterNativesImpl(env); 113 return RegisterNativesImpl(env);
113 } 114 }
114 115
115 } // namespace l10n_util 116 } // namespace l10n_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698