Skip to content

Commit c62d737

Browse files
committed
输入法硬编码调整
1 parent 1b9d7d9 commit c62d737

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

BaseAdbInput/src/main/java/com/bihe0832/android/base/adb/input/ZixieIME.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
public class ZixieIME extends InputMethodService {
2020

2121
public String IME_ADB_INPUT_ACTION = "ZIXIE_ADB_INPUT";
22-
public static final String IME_NAME = "com.bihe0832.adb.input/com.bihe0832.android.base.adb.input.ZixieIME";
23-
22+
2423
public static final String TAG = "InputService";
2524
private InputServiceActionListener mInputServiceActionListener = null;
2625

BaseAdbInput/src/main/java/com/bihe0832/android/base/adb/input/switcher/InputSwitchTools.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,20 @@ object InputSwitchTools {
3030
fun hasInstall(context: Context?): Boolean {
3131
(context?.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager)?.let {
3232
it.enabledInputMethodList.forEach { inputMethodInfo ->
33-
if (inputMethodInfo.id.equals(ZixieIME.IME_NAME)) {
33+
if (inputMethodInfo.id.equals(getIMEName(context))) {
3434
return true
3535
}
3636
}
3737
}
3838
return false
3939
}
4040

41+
private fun getIMEName(context: Context?): String {
42+
return context?.packageName + "/" + ZixieIME::class.java.name
43+
}
44+
4145
fun isSelected(context: Context?): Boolean {
42-
return Settings.Secure.getString(context?.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD).equals(ZixieIME.IME_NAME)
46+
return Settings.Secure.getString(context?.getContentResolver(), Settings.Secure.DEFAULT_INPUT_METHOD).equals(getIMEName(context))
4347

4448
}
4549

0 commit comments

Comments
 (0)