Separate IntentUtils from CompatUtils
Change-Id: I373ae7ad26eee44cc8e9720314f6a53b811d0021main
parent
70c63049d3
commit
298b4240f8
|
@ -16,7 +16,6 @@
|
||||||
|
|
||||||
package com.android.inputmethod.compat;
|
package com.android.inputmethod.compat;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
@ -26,23 +25,9 @@ import java.lang.reflect.Method;
|
||||||
|
|
||||||
public final class CompatUtils {
|
public final class CompatUtils {
|
||||||
private static final String TAG = CompatUtils.class.getSimpleName();
|
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,
|
private CompatUtils() {
|
||||||
final int flagsForSubtypeSettings) {
|
// This utility class is not publicly instantiable.
|
||||||
// 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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Class<?> getClass(final String className) {
|
public static Class<?> getClass(final String className) {
|
||||||
|
|
|
@ -44,8 +44,6 @@ import android.widget.Spinner;
|
||||||
import android.widget.SpinnerAdapter;
|
import android.widget.SpinnerAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import com.android.inputmethod.compat.CompatUtils;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
@ -519,7 +517,7 @@ public final class AdditionalSubtypeSettings extends PreferenceFragment {
|
||||||
.setPositiveButton(R.string.enable, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.enable, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
final Intent intent = CompatUtils.getInputLanguageSelectionIntent(
|
final Intent intent = IntentUtils.getInputLanguageSelectionIntent(
|
||||||
mRichImm.getInputMethodIdOfThisIme(),
|
mRichImm.getInputMethodIdOfThisIme(),
|
||||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -62,7 +62,6 @@ import android.view.inputmethod.InputMethodSubtype;
|
||||||
import com.android.inputmethod.accessibility.AccessibilityUtils;
|
import com.android.inputmethod.accessibility.AccessibilityUtils;
|
||||||
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
|
import com.android.inputmethod.accessibility.AccessibleKeyboardViewProxy;
|
||||||
import com.android.inputmethod.annotations.UsedForTesting;
|
import com.android.inputmethod.annotations.UsedForTesting;
|
||||||
import com.android.inputmethod.compat.CompatUtils;
|
|
||||||
import com.android.inputmethod.compat.InputMethodServiceCompatUtils;
|
import com.android.inputmethod.compat.InputMethodServiceCompatUtils;
|
||||||
import com.android.inputmethod.compat.SuggestionSpanUtils;
|
import com.android.inputmethod.compat.SuggestionSpanUtils;
|
||||||
import com.android.inputmethod.event.EventInterpreter;
|
import com.android.inputmethod.event.EventInterpreter;
|
||||||
|
@ -2512,7 +2511,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
|
||||||
di.dismiss();
|
di.dismiss();
|
||||||
switch (position) {
|
switch (position) {
|
||||||
case 0:
|
case 0:
|
||||||
Intent intent = CompatUtils.getInputLanguageSelectionIntent(
|
final Intent intent = IntentUtils.getInputLanguageSelectionIntent(
|
||||||
mRichImm.getInputMethodIdOfThisIme(),
|
mRichImm.getInputMethodIdOfThisIme(),
|
||||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
| Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
|
||||||
|
|
Loading…
Reference in New Issue