| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 package org.chromium.ui.base; | 5 package org.chromium.ui.base; |
| 6 | 6 |
| 7 import android.util.DisplayMetrics; | 7 import android.util.DisplayMetrics; |
| 8 import android.view.Display; | 8 import android.view.Display; |
| 9 | 9 |
| 10 import org.chromium.base.BuildConfig; | 10 import org.chromium.base.BuildConfig; |
| 11 import org.chromium.base.ContextUtils; | 11 import org.chromium.base.ContextUtils; |
| 12 import org.chromium.base.annotations.CalledByNative; | 12 import org.chromium.base.annotations.CalledByNative; |
| 13 import org.chromium.base.annotations.JNINamespace; | 13 import org.chromium.base.annotations.JNINamespace; |
| 14 import org.chromium.ui.display.DisplayAndroidManager; | 14 import org.chromium.ui.display.DisplayAndroidManager; |
| 15 | 15 |
| 16 import java.util.Arrays; | 16 import java.util.Arrays; |
| 17 | 17 |
| 18 /** | 18 /** |
| 19 * This class provides the resource bundle related methods for the native | 19 * This class provides the resource bundle related methods for the native |
| 20 * library. | 20 * library. |
| 21 */ | 21 */ |
| 22 @JNINamespace("ui") | 22 @JNINamespace("ui") |
| 23 final class ResourceBundle { | 23 final class ResourceBundle { |
| 24 private ResourceBundle() {} | 24 private ResourceBundle() {} |
| 25 | 25 |
| 26 @CalledByNative | 26 @CalledByNative |
| 27 private static String getLocalePakResourcePath(String locale) { | 27 private static String getLocalePakResourcePath(String locale) { |
| 28 if (Arrays.binarySearch(BuildConfig.UNCOMPRESSED_LOCALES, | 28 if (Arrays.binarySearch(BuildConfig.UNCOMPRESSED_LOCALES, locale) >= 0)
{ |
| 29 "stored-locales/" + locale) >= 0) { | 29 return "assets/" + locale + ".pak"; |
| 30 return "assets/stored-locales/" + locale + ".pak"; | |
| 31 } | 30 } |
| 32 return null; | 31 return null; |
| 33 } | 32 } |
| 34 | 33 |
| 35 @CalledByNative | 34 @CalledByNative |
| 36 private static float getPrimaryDisplayScale() { | 35 private static float getPrimaryDisplayScale() { |
| 37 Display primaryDisplay = DisplayAndroidManager.getDefaultDisplayForConte
xt( | 36 Display primaryDisplay = DisplayAndroidManager.getDefaultDisplayForConte
xt( |
| 38 ContextUtils.getApplicationContext()); | 37 ContextUtils.getApplicationContext()); |
| 39 DisplayMetrics displayMetrics = new DisplayMetrics(); | 38 DisplayMetrics displayMetrics = new DisplayMetrics(); |
| 40 primaryDisplay.getMetrics(displayMetrics); | 39 primaryDisplay.getMetrics(displayMetrics); |
| 41 return displayMetrics.density; | 40 return displayMetrics.density; |
| 42 } | 41 } |
| 43 } | 42 } |
| OLD | NEW |