aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2013-02-04 15:59:59 -0800
committerTadashi G. Takaoka <takaoka@google.com>2013-02-04 16:06:38 -0800
commit298b4240f84344bbcd70b72dfb20806ba93ffd22 (patch)
treec45675c64b2f9e644051fbaaa086594de5ef18dc
parent70c63049d3635220ccda6923b3333c5e72451192 (diff)
downloadlatinime-298b4240f84344bbcd70b72dfb20806ba93ffd22.tar.gz
latinime-298b4240f84344bbcd70b72dfb20806ba93ffd22.tar.xz
latinime-298b4240f84344bbcd70b72dfb20806ba93ffd22.zip
Separate IntentUtils from CompatUtils
Change-Id: I373ae7ad26eee44cc8e9720314f6a53b811d0021
-rw-r--r--java/src/com/android/inputmethod/compat/CompatUtils.java19
-rw-r--r--java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java4
-rw-r--r--java/src/com/android/inputmethod/latin/IntentUtils.java45
-rw-r--r--java/src/com/android/inputmethod/latin/LatinIME.java3
4 files changed, 49 insertions, 22 deletions
diff --git a/java/src/com/android/inputmethod/compat/CompatUtils.java b/java/src/com/android/inputmethod/compat/CompatUtils.java
index a82103ab3..5a2b6bd2b 100644
--- a/java/src/com/android/inputmethod/compat/CompatUtils.java
+++ b/java/src/com/android/inputmethod/compat/CompatUtils.java
@@ -16,7 +16,6 @@
package com.android.inputmethod.compat;
-import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
@@ -26,23 +25,9 @@ import java.lang.reflect.Method;
public final class CompatUtils {
private static final String TAG = CompatUtils.class.getSimpleName();
- private static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
- // TODO: Can these be constants instead of literal String constants?
- private static final String INPUT_METHOD_SUBTYPE_SETTINGS =
- "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
- public static Intent getInputLanguageSelectionIntent(final String inputMethodId,
- final int flagsForSubtypeSettings) {
- // Refer to android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS
- final String action = INPUT_METHOD_SUBTYPE_SETTINGS;
- final Intent intent = new Intent(action);
- if (!TextUtils.isEmpty(inputMethodId)) {
- intent.putExtra(EXTRA_INPUT_METHOD_ID, inputMethodId);
- }
- if (flagsForSubtypeSettings > 0) {
- intent.setFlags(flagsForSubtypeSettings);
- }
- return intent;
+ private CompatUtils() {
+ // This utility class is not publicly instantiable.
}
public static Class<?> getClass(final String className) {
diff --git a/java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java b/java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java
index f7877226d..ff5e33949 100644
--- a/java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java
+++ b/java/src/com/android/inputmethod/latin/AdditionalSubtypeSettings.java
@@ -44,8 +44,6 @@ import android.widget.Spinner;
import android.widget.SpinnerAdapter;
import android.widget.Toast;
-import com.android.inputmethod.compat.CompatUtils;
-
import java.util.ArrayList;
import java.util.TreeSet;
@@ -519,7 +517,7 @@ public final class AdditionalSubtypeSettings extends PreferenceFragment {
.setPositiveButton(R.string.enable, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
- final Intent intent = CompatUtils.getInputLanguageSelectionIntent(
+ final Intent intent = IntentUtils.getInputLanguageSelectionIntent(
mRichImm.getInputMethodIdOfThisIme(),
Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
diff --git a/java/src/com/android/inputmethod/latin/IntentUtils.java b/java/src/com/android/inputmethod/latin/IntentUtils.java
new file mode 100644
index 000000000..d175af504
--- /dev/null
+++ b/java/src/com/android/inputmethod/latin/IntentUtils.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2013 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.
+ */
+
+package com.android.inputmethod.latin;
+
+import android.content.Intent;
+import android.text.TextUtils;
+
+public final class IntentUtils {
+ private static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
+ // TODO: Can these be constants instead of literal String constants?
+ private static final String INPUT_METHOD_SUBTYPE_SETTINGS =
+ "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
+
+ private IntentUtils() {
+ // This utility class is not publicly instantiable.
+ }
+
+ public static Intent getInputLanguageSelectionIntent(final String inputMethodId,
+ final int flagsForSubtypeSettings) {
+ // Refer to android.provider.Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS
+ final String action = INPUT_METHOD_SUBTYPE_SETTINGS;
+ final Intent intent = new Intent(action);
+ if (!TextUtils.isEmpty(inputMethodId)) {
+ intent.putExtra(EXTRA_INPUT_METHOD_ID, inputMethodId);
+ }
+ if (flagsForSubtypeSettings > 0) {
+ intent.setFlags(flagsForSubtypeSettings);
+ }
+ return intent;
+ }
+}
diff --git a/java/src/com/android/inputmethod/latin/LatinIME.java b/java/src/com/android/inputmethod/latin/LatinIME.java
index 08217326a..1c49bb0cc 100644
--- a/java/src/com/android/inputmethod/latin/LatinIME.java
+++ b/java/src/com/android/inputmethod/latin/LatinIME.java
@@ -62,7 +62,6 @@ import android.view.inputmethod.InputMethodSubtype;
import com.android.inputmethod.accessibility.AccessibilityUtils;
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
import com.android.inputmethod.annotations.UsedForTesting;
-import com.android.inputmethod.compat.CompatUtils;
import com.android.inputmethod.compat.InputMethodServiceCompatUtils;
import com.android.inputmethod.compat.SuggestionSpanUtils;
import com.android.inputmethod.event.EventInterpreter;
@@ -2512,7 +2511,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
di.dismiss();
switch (position) {
case 0:
- Intent intent = CompatUtils.getInputLanguageSelectionIntent(
+ final Intent intent = IntentUtils.getInputLanguageSelectionIntent(
mRichImm.getInputMethodIdOfThisIme(),
Intent.FLAG_ACTIVITY_NEW_TASK
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED