summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authornewt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 01:42:12 +0000
committernewt@chromium.org <newt@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-14 01:42:12 +0000
commit3f196ad12dde21cc5906cef5079ca82c4d0af9af (patch)
tree9228e1db394cae208234197089f760678757ee5f /ui
parentf0eda48a9694a79709f4545b9aaeea50e500cf90 (diff)
downloadchromium_src-3f196ad12dde21cc5906cef5079ca82c4d0af9af.zip
chromium_src-3f196ad12dde21cc5906cef5079ca82c4d0af9af.tar.gz
chromium_src-3f196ad12dde21cc5906cef5079ca82c4d0af9af.tar.bz2
[Android] Support Android resources in ui folder.
This adds support for Android-style resources in the ui folder and converts a few hard coded strings into proper localizable strings. BUG=165751 Review URL: https://chromiumcodereview.appspot.com/11554031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/android/java/res/values/strings.xml15
-rw-r--r--ui/android/java/src/org/chromium/ui/SelectFileDialog.java18
-rw-r--r--ui/ui.gyp3
3 files changed, 25 insertions, 11 deletions
diff --git a/ui/android/java/res/values/strings.xml b/ui/android/java/res/values/strings.xml
new file mode 100644
index 0000000..0ea768b
--- /dev/null
+++ b/ui/android/java/res/values/strings.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (c) 2012 The Chromium Authors. All rights reserved.
+
+ Use of this source code is governed by a BSD-style license that can be
+ found in the LICENSE file.
+-->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+ <!-- Error shown when the browser is restarted due to low memory during a
+ file picker operation. [CHAR-LIMIT=NONE] -->
+ <string name="low_memory_error">Unable to complete previous operation due to low memory</string>
+ <!-- Toast when the browser is unable to open a file for upload. [CHAR-LIMIT=32] -->
+ <string name="opening_file_error">Failed to open selected file</string>
+</resources>
diff --git a/ui/android/java/src/org/chromium/ui/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/SelectFileDialog.java
index 23319cb..a50a257 100644
--- a/ui/android/java/src/org/chromium/ui/SelectFileDialog.java
+++ b/ui/android/java/src/org/chromium/ui/SelectFileDialog.java
@@ -27,12 +27,6 @@ import org.chromium.ui.gfx.NativeWindow;
*/
@JNINamespace("ui")
class SelectFileDialog implements NativeWindow.IntentCallback{
- // TODO (aurimas): Move these constants into strings.xml within ui (after crbug.com/136704 is
- // fixed) to support internationalization.
- private static final String LOW_MEMORY_ERROR =
- "Unable to complete previous operation due to low memory";
- private static final String OPENING_FILE_ERROR = "Failed to open selected file";
-
private static final String IMAGE_TYPE = "image/";
private static final String VIDEO_TYPE = "video/";
private static final String AUDIO_TYPE = "audio/";
@@ -73,16 +67,17 @@ class SelectFileDialog implements NativeWindow.IntentCallback{
Intent camcorder = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
Intent soundRecorder = new Intent(
MediaStore.Audio.Media.RECORD_SOUND_ACTION);
+ String lowMemoryError = window.getContext().getString(R.string.low_memory_error);
// Quick check - if a capture parameter other than filesystem (the default) is specified we
// should just launch the appropriate intent. Otherwise build up a chooser based on the
// accept type and then display that to the user.
if (captureCamera()) {
- if (window.showIntent(camera, this, LOW_MEMORY_ERROR)) return;
+ if (window.showIntent(camera, this, lowMemoryError)) return;
} else if (captureCamcorder()) {
- if (window.showIntent(camcorder, this, LOW_MEMORY_ERROR)) return;
+ if (window.showIntent(camcorder, this, lowMemoryError)) return;
} else if (captureMicrophone()) {
- if (window.showIntent(soundRecorder, this, LOW_MEMORY_ERROR)) return;
+ if (window.showIntent(soundRecorder, this, lowMemoryError)) return;
}
Intent getContentIntent = new Intent(Intent.ACTION_GET_CONTENT);
@@ -117,7 +112,7 @@ class SelectFileDialog implements NativeWindow.IntentCallback{
chooser.putExtra(Intent.EXTRA_INTENT, getContentIntent);
- if (!window.showIntent(chooser, this, LOW_MEMORY_ERROR)) onFileNotSelected();
+ if (!window.showIntent(chooser, this, lowMemoryError)) onFileNotSelected();
}
/**
@@ -186,7 +181,8 @@ class SelectFileDialog implements NativeWindow.IntentCallback{
}
if (!success) {
onFileNotSelected();
- window.showError(OPENING_FILE_ERROR);
+ String openingFileError = window.getContext().getString(R.string.opening_file_error);
+ window.showError(openingFileError);
}
}
diff --git a/ui/ui.gyp b/ui/ui.gyp
index 28d4d56..d173184 100644
--- a/ui/ui.gyp
+++ b/ui/ui.gyp
@@ -887,6 +887,9 @@
'variables': {
'package_name': 'ui',
'java_in_dir': '../ui/android/java',
+ 'has_java_resources': 1,
+ 'R_package': 'org.chromium.ui',
+ 'R_package_relpath': 'org/chromium/ui',
},
'dependencies': [
'../base/base.gyp:base_java',