diff options
author | 2014-06-03 17:40:24 +0900 | |
---|---|---|
committer | 2014-06-04 13:02:42 +0900 | |
commit | 28c7b262aa5d81675e1d28a37d9e54f93c67fb0d (patch) | |
tree | e5d2c60d73b12ad93320d6134728306dfd7ab0e3 /java | |
parent | d427d3b0fac9eef066976c30281eab5aa79d4f5b (diff) | |
download | latinime-28c7b262aa5d81675e1d28a37d9e54f93c67fb0d.tar.gz latinime-28c7b262aa5d81675e1d28a37d9e54f93c67fb0d.tar.xz latinime-28c7b262aa5d81675e1d28a37d9e54f93c67fb0d.zip |
Add a preference item for metrics logging
BUG: 14324207
Change-Id: Idc8582655bc73cb24e416e8ba78470209b2ff702
Diffstat (limited to 'java')
-rw-r--r-- | java/res/values/strings-production.xml | 24 | ||||
-rw-r--r-- | java/res/values/strings.xml | 3 | ||||
-rw-r--r-- | java/res/xml/prefs.xml | 6 | ||||
-rw-r--r-- | java/src/com/android/inputmethod/latin/settings/SettingsFragment.java | 15 |
4 files changed, 48 insertions, 0 deletions
diff --git a/java/res/values/strings-production.xml b/java/res/values/strings-production.xml new file mode 100644 index 000000000..8064b9949 --- /dev/null +++ b/java/res/values/strings-production.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- +/* +** +** Copyright 2014, The Android Open Source Project +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ +--> + +<resources> + <!-- Description for option to enable sending usage statistics --> + <string name="enable_metrics_logging_summary" translatable="false"></string> +</resources> diff --git a/java/res/values/strings.xml b/java/res/values/strings.xml index 2ad7ce592..3f5980dfd 100644 --- a/java/res/values/strings.xml +++ b/java/res/values/strings.xml @@ -87,6 +87,9 @@ <!-- Option name for enabling the use by the keyboards of sent/received messages, e-mail and typing history to improve suggestion accuracy [CHAR LIMIT=25] --> <string name="use_personalized_dicts">Personalized suggestions</string> + <!-- Option to enable sending usage statistics --> + <string name="enable_metrics_logging">"Improve <xliff:g id="APPLICATION_NAME" example="Android Keyboard">%s</xliff:g>"</string> + <!-- Option name for enabling or disabling the double-space period feature that lets double tap on spacebar insert a period followed by a space [CHAR LIMIT=30] --> <string name="use_double_space_period">Double-space period</string> <!-- Description for option enabling or disabling the double-space period feature that lets double tap on spacebar insert a period followed by a space [CHAR LIMIT=65] --> diff --git a/java/res/xml/prefs.xml b/java/res/xml/prefs.xml index a62986228..0e9c16190 100644 --- a/java/res/xml/prefs.xml +++ b/java/res/xml/prefs.xml @@ -95,6 +95,12 @@ android:summary="@string/use_personalized_dicts_summary" android:persistent="true" android:defaultValue="true" /> + <!-- title will be set programmatically to embed application name --> + <CheckBoxPreference + android:key="pref_enable_metrics_logging" + android:summary="@string/enable_metrics_logging_summary" + android:persistent="true" + android:defaultValue="true" /> </PreferenceCategory> <PreferenceCategory android:title="@string/gesture_typing_category" diff --git a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java index af46aad96..5eb0377c7 100644 --- a/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java +++ b/java/src/com/android/inputmethod/latin/settings/SettingsFragment.java @@ -41,6 +41,7 @@ import com.android.inputmethod.keyboard.KeyboardTheme; import com.android.inputmethod.latin.AudioAndHapticFeedbackManager; import com.android.inputmethod.latin.R; import com.android.inputmethod.latin.SubtypeSwitcher; +import com.android.inputmethod.latin.define.ProductionFlag; import com.android.inputmethod.latin.setup.LauncherIconVisibilityManager; import com.android.inputmethod.latin.userdictionary.UserDictionaryList; import com.android.inputmethod.latin.userdictionary.UserDictionarySettings; @@ -212,6 +213,20 @@ public final class SettingsFragment extends InputMethodSettingsFragment textCorrectionGroup.removePreference(dictionaryLink); } + if (ProductionFlag.IS_METRICS_LOGGING_SUPPORTED) { + final Preference enableMetricsLogging = + findPreference(Settings.PREF_ENABLE_METRICS_LOGGING); + if (enableMetricsLogging != null) { + final int applicationLabelRes = context.getApplicationInfo().labelRes; + final String applicationName = res.getString(applicationLabelRes); + final String enableMetricsLoggingTitle = res.getString( + R.string.enable_metrics_logging, applicationName); + enableMetricsLogging.setTitle(enableMetricsLoggingTitle); + } + } else { + removePreference(Settings.PREF_ENABLE_METRICS_LOGGING, textCorrectionGroup); + } + final Preference editPersonalDictionary = findPreference(Settings.PREF_EDIT_PERSONAL_DICTIONARY); final Intent editPersonalDictionaryIntent = editPersonalDictionary.getIntent(); |