├── .gitignore
├── .idea
├── .gitignore
├── codeStyles
│ ├── Project.xml
│ └── codeStyleConfig.xml
├── compiler.xml
├── deploymentTargetDropDown.xml
├── deploymentTargetSelector.xml
├── gradle.xml
├── kotlinc.xml
├── migrations.xml
├── misc.xml
└── vcs.xml
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
└── src
│ ├── androidTest
│ └── java
│ │ └── moe
│ │ └── kooritea
│ │ └── gboardInputType
│ │ └── ExampleInstrumentedTest.kt
│ ├── main
│ ├── AndroidManifest.xml
│ ├── assets
│ │ └── xposed_init
│ ├── java
│ │ └── moe
│ │ │ └── kooritea
│ │ │ └── gboardInputType
│ │ │ ├── application
│ │ │ └── DefaultApplication.kt
│ │ │ ├── hook
│ │ │ └── HookEntry.kt
│ │ │ ├── ui
│ │ │ ├── activity
│ │ │ │ ├── MainActivity.kt
│ │ │ │ └── base
│ │ │ │ │ └── BaseActivity.kt
│ │ │ └── view
│ │ │ │ └── MaterialSwitch.kt
│ │ │ └── utils
│ │ │ └── factory
│ │ │ └── FunctionFactory.kt
│ └── res
│ │ ├── drawable-night
│ │ ├── bg_dark_round.xml
│ │ ├── bg_permotion_ripple.xml
│ │ └── bg_permotion_round.xml
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ ├── bg_dark_round.xml
│ │ ├── bg_green_round.xml
│ │ ├── bg_orange_round.xml
│ │ ├── bg_permotion_ripple.xml
│ │ ├── bg_permotion_round.xml
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_github.png
│ │ ├── ic_home.png
│ │ ├── ic_launcher.webp
│ │ ├── ic_launcher_round.webp
│ │ ├── ic_success.png
│ │ ├── ic_warn.png
│ │ └── ic_yukihookapi.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.webp
│ │ └── ic_launcher_round.webp
│ │ ├── values-night
│ │ ├── color.xml
│ │ └── themes.xml
│ │ ├── values-zh-rCN
│ │ └── strings.xml
│ │ └── values
│ │ ├── array.xml
│ │ ├── color.xml
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── themes.xml
│ └── test
│ └── java
│ └── moe
│ └── kooritea
│ └── gboardInputType
│ └── ExampleUnitTest.kt
├── build.gradle
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── md
├── 98098b32a3420d6660045315efc6c1e4.png
└── a3286cdeb41d6cdf54f2391bd740a32.jpg
├── readme.md
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/caches
5 | /.idea/libraries
6 | /.idea/modules.xml
7 | /.idea/workspace.xml
8 | /.idea/navEditor.xml
9 | /.idea/assetWizardSettings.xml
10 | .DS_Store
11 | /build
12 | /captures
13 | .externalNativeBuild
14 | .cxx
15 | local.properties
16 | /app/release
--------------------------------------------------------------------------------
/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | xmlns:android
18 |
19 | ^$
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 | xmlns:.*
29 |
30 | ^$
31 |
32 |
33 | BY_NAME
34 |
35 |
36 |
37 |
38 |
39 |
40 | .*:id
41 |
42 | http://schemas.android.com/apk/res/android
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 | .*:name
52 |
53 | http://schemas.android.com/apk/res/android
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | name
63 |
64 | ^$
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 | style
74 |
75 | ^$
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | .*
85 |
86 | ^$
87 |
88 |
89 | BY_NAME
90 |
91 |
92 |
93 |
94 |
95 |
96 | .*
97 |
98 | http://schemas.android.com/apk/res/android
99 |
100 |
101 | ANDROID_ATTRIBUTE_ORDER
102 |
103 |
104 |
105 |
106 |
107 |
108 | .*
109 |
110 | .*
111 |
112 |
113 | BY_NAME
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
--------------------------------------------------------------------------------
/.idea/codeStyles/codeStyleConfig.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/.idea/compiler.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/deploymentTargetDropDown.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.idea/deploymentTargetSelector.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/gradle.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
18 |
19 |
--------------------------------------------------------------------------------
/.idea/kotlinc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/.idea/migrations.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.idea/misc.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'org.jetbrains.kotlin.android'
4 | id 'com.google.devtools.ksp' version '1.7.10-1.0.6'
5 | }
6 |
7 | android {
8 | compileSdk 32
9 |
10 | defaultConfig {
11 | applicationId "moe.kooritea.gboardInputType"
12 | minSdk 27
13 | targetSdk 33
14 | versionCode rootProject.ext.appVersionCode
15 | versionName rootProject.ext.appVersionName
16 |
17 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18 | }
19 |
20 | buildTypes {
21 | release {
22 | minifyEnabled rootProject.ext.enableR8
23 | shrinkResources rootProject.ext.enableR8
24 | zipAlignEnabled rootProject.ext.enableR8
25 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
26 | }
27 | }
28 | compileOptions {
29 | sourceCompatibility JavaVersion.VERSION_11
30 | targetCompatibility JavaVersion.VERSION_11
31 | }
32 | kotlinOptions {
33 | jvmTarget = '11'
34 | freeCompilerArgs = [
35 | '-Xno-param-assertions',
36 | '-Xno-call-assertions',
37 | '-Xno-receiver-assertions'
38 | ]
39 | }
40 | buildFeatures {
41 | viewBinding true
42 | }
43 | lintOptions {
44 | checkReleaseBuilds false
45 | }
46 | }
47 |
48 | dependencies {
49 | compileOnly 'de.robv.android.xposed:api:82'
50 | implementation 'com.highcapable.yukihookapi:api:1.1.11'
51 | ksp 'com.highcapable.yukihookapi:ksp-xposed:1.1.11'
52 | implementation 'com.github.duanhong169:drawabletoolbox:1.0.7'
53 | implementation 'androidx.core:core-ktx:1.8.0'
54 | implementation 'androidx.appcompat:appcompat:1.4.2'
55 | implementation 'com.google.android.material:material:1.6.1'
56 | implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
57 | testImplementation 'junit:junit:4.13.2'
58 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
59 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
60 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
22 |
23 | -assumenosideeffects class kotlin.jvm.internal.Intrinsics {
24 | public static *** throwUninitializedProperty(...);
25 | public static *** throwUninitializedPropertyAccessException(...);
26 | }
27 |
28 | -keepclassmembers class * implements androidx.viewbinding.ViewBinding {
29 | *** inflate(android.view.LayoutInflater);
30 | }
--------------------------------------------------------------------------------
/app/src/androidTest/java/moe/kooritea/gboardInputType/ExampleInstrumentedTest.kt:
--------------------------------------------------------------------------------
1 | package moe.kooritea.gboardInputType
2 |
3 | import androidx.test.platform.app.InstrumentationRegistry
4 | import androidx.test.ext.junit.runners.AndroidJUnit4
5 |
6 | import org.junit.Test
7 | import org.junit.runner.RunWith
8 |
9 | import org.junit.Assert.*
10 |
11 | /**
12 | * Instrumented test, which will execute on an Android device.
13 | *
14 | * See [testing documentation](http://d.android.com/tools/testing).
15 | */
16 | @RunWith(AndroidJUnit4::class)
17 | class ExampleInstrumentedTest {
18 | @Test
19 | fun useAppContext() {
20 | // Context of the app under test.
21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext
22 | assertEquals("moe.kooritea.gboardInputType", appContext.packageName)
23 | }
24 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
18 |
19 |
22 |
25 |
28 |
31 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/app/src/main/assets/xposed_init:
--------------------------------------------------------------------------------
1 | moe.kooritea.gboardInputType.hook.HookEntry_YukiHookXposedInit
--------------------------------------------------------------------------------
/app/src/main/java/moe/kooritea/gboardInputType/application/DefaultApplication.kt:
--------------------------------------------------------------------------------
1 | package moe.kooritea.gboardInputType.application
2 |
3 | import androidx.appcompat.app.AppCompatDelegate
4 | import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication
5 |
6 | class DefaultApplication : ModuleApplication() {
7 |
8 | override fun onCreate() {
9 | super.onCreate()
10 | /**
11 | * 跟随系统夜间模式
12 | * Follow system night mode
13 | */
14 | AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
15 | // Your code here.
16 | }
17 | }
--------------------------------------------------------------------------------
/app/src/main/java/moe/kooritea/gboardInputType/hook/HookEntry.kt:
--------------------------------------------------------------------------------
1 | package moe.kooritea.gboardInputType.hook
2 |
3 | import android.inputmethodservice.InputMethodService
4 | import android.view.inputmethod.EditorInfo
5 | import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
6 | import com.highcapable.yukihookapi.hook.factory.configs
7 | import com.highcapable.yukihookapi.hook.factory.encase
8 | import com.highcapable.yukihookapi.hook.type.defined.VagueType
9 | import com.highcapable.yukihookapi.hook.type.java.BooleanType
10 | import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
11 | import de.robv.android.xposed.XposedBridge
12 |
13 | const val TYPE_MASK_CLASS = 15
14 | const val TYPE_MASK_VARIATION = 240
15 |
16 | @InjectYukiHookWithXposed
17 | class HookEntry : IYukiHookXposedInit {
18 |
19 | override fun onInit() = configs {
20 | debugLog {
21 | isEnable = false
22 | }
23 | }
24 |
25 | override fun onHook() = encase {
26 | loadApp("com.google.android.inputmethod.latin") {
27 | searchClass {
28 | extends()
29 | method {
30 | name = "onStartInputView"
31 | param(VagueType, BooleanType)
32 | }.count(num = 1)
33 | }.get()?.hook {
34 | injectMember {
35 | method {
36 | name = "onStartInputView"
37 | param(VagueType, BooleanType)
38 | }
39 | beforeHook {
40 | hooker((args[0]!! as EditorInfo), false)
41 | }
42 | }
43 | }
44 | searchClass {
45 | extends()
46 | method {
47 | name = "onStartInput"
48 | param(VagueType, BooleanType)
49 | }.count(num = 1)
50 | }.get()?.hook {
51 | injectMember {
52 | method {
53 | name = "onStartInput"
54 | param(VagueType, BooleanType)
55 | }
56 | beforeHook {
57 | hooker((args[0]!! as EditorInfo), prefs.getBoolean("debug_mode", false))
58 | }
59 | }
60 | }
61 | }
62 | }
63 |
64 | private fun hooker(editorInfo: EditorInfo, log: Boolean) {
65 | var result = editorInfo.inputType
66 | result = replaceFlag(result, EditorInfo.TYPE_TEXT_VARIATION_WEB_PASSWORD, EditorInfo.TYPE_TEXT_VARIATION_WEB_EDIT_TEXT, TYPE_MASK_VARIATION)
67 | result = replaceFlag(result, EditorInfo.TYPE_TEXT_VARIATION_PASSWORD, 0, TYPE_MASK_VARIATION)
68 | result = replaceFlag(result, EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD, 0, TYPE_MASK_VARIATION)
69 | result = replaceFlag(result, 0, EditorInfo.TYPE_CLASS_TEXT, TYPE_MASK_CLASS)
70 | if(result != editorInfo.inputType){
71 | if(log){
72 | XposedBridge.log("[ForceGboardInputType][" + editorInfo.packageName + "] inputType: " + editorInfo.inputType + "->" + result)
73 | }
74 | editorInfo.inputType = result
75 | }else{
76 | if(log){
77 | XposedBridge.log("[ForceGboardInputType][" + editorInfo.packageName + "] inputType: " + editorInfo.inputType)
78 | }
79 | }
80 | }
81 |
82 | private fun replaceFlag(target: Int, flag:Int, replaceTo: Int, flagType: Int): Int {
83 | if((target and flagType) == flag){
84 | val otherFlag = target xor (target and flagType)
85 | return otherFlag or replaceTo
86 | }
87 | return target
88 | }
89 | }
--------------------------------------------------------------------------------
/app/src/main/java/moe/kooritea/gboardInputType/ui/activity/MainActivity.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("SetTextI18n")
2 |
3 | package moe.kooritea.gboardInputType.ui.activity
4 |
5 | import android.content.ComponentName
6 | import android.content.Intent
7 | import android.content.pm.PackageManager
8 | import android.net.Uri
9 | import androidx.core.view.isVisible
10 | import com.highcapable.yukihookapi.YukiHookAPI
11 | import com.highcapable.yukihookapi.YukiHookAPI.Status.Executor
12 | import com.highcapable.yukihookapi.hook.factory.prefs
13 | import moe.kooritea.gboardInputType.BuildConfig
14 | import moe.kooritea.gboardInputType.R
15 | import moe.kooritea.gboardInputType.databinding.ActivityMainBinding
16 | import moe.kooritea.gboardInputType.ui.activity.base.BaseActivity
17 |
18 | class MainActivity : BaseActivity() {
19 |
20 | override fun onCreate() {
21 | refreshModuleStatus()
22 | binding.mainTextVersion.text = getString(R.string.module_version, BuildConfig.VERSION_NAME)
23 | binding.hideIconInLauncherSwitch.isChecked = isLauncherIconShowing.not()
24 | binding.hideIconInLauncherSwitch.setOnCheckedChangeListener { button, isChecked ->
25 | if (button.isPressed) hideOrShowLauncherIcon(isChecked)
26 | }
27 | binding.debugSwitch.isChecked = prefs().getBoolean("debug_mode", false)
28 | binding.debugSwitch.setOnCheckedChangeListener { button, isChecked ->
29 | if (button.isPressed) {
30 | prefs().edit { putBoolean("debug_mode", isChecked) }
31 | }
32 | }
33 | binding.titleGithubIcon.setOnClickListener {
34 | startActivity(Intent().apply {
35 | action = Intent.ACTION_VIEW
36 | data = Uri.parse("https://github.com/kooritea/ForceGboardInputType")
37 | flags = Intent.FLAG_ACTIVITY_NEW_TASK
38 | })
39 | }
40 | }
41 |
42 | /**
43 | * Hide or show launcher icons
44 | *
45 | * - You may need the latest version of LSPosed to enable the function of hiding launcher
46 | * icons in higher version systems
47 | *
48 | * 隐藏或显示启动器图标
49 | *
50 | * - 你可能需要 LSPosed 的最新版本以开启高版本系统中隐藏 APP 桌面图标功能
51 | * @param isShow Whether to display / 是否显示
52 | */
53 | private fun hideOrShowLauncherIcon(isShow: Boolean) {
54 | packageManager?.setComponentEnabledSetting(
55 | ComponentName(packageName, "${BuildConfig.APPLICATION_ID}.Home"),
56 | if (isShow) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
57 | PackageManager.DONT_KILL_APP
58 | )
59 | }
60 |
61 | /**
62 | * Get launcher icon state
63 | *
64 | * 获取启动器图标状态
65 | * @return [Boolean] Whether to display / 是否显示
66 | */
67 | private val isLauncherIconShowing
68 | get() = packageManager?.getComponentEnabledSetting(
69 | ComponentName(packageName, "${BuildConfig.APPLICATION_ID}.Home")
70 | ) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED
71 |
72 | /**
73 | * Refresh module status
74 | *
75 | * 刷新模块状态
76 | */
77 | private fun refreshModuleStatus() {
78 | binding.mainLinStatus.setBackgroundResource(
79 | when {
80 | YukiHookAPI.Status.isModuleActive -> R.drawable.bg_green_round
81 | else -> R.drawable.bg_dark_round
82 | }
83 | )
84 | binding.mainImgStatus.setImageResource(
85 | when {
86 | YukiHookAPI.Status.isModuleActive -> R.mipmap.ic_success
87 | else -> R.mipmap.ic_warn
88 | }
89 | )
90 | binding.mainTextStatus.text = getString(
91 | when {
92 | YukiHookAPI.Status.isModuleActive -> R.string.module_is_activated
93 | else -> R.string.module_not_activated
94 | }
95 | )
96 | binding.mainTextApiWay.isVisible = YukiHookAPI.Status.isModuleActive
97 | when {
98 | Executor.apiLevel > 0 ->
99 | binding.mainTextApiWay.text =
100 | "Activated by ${Executor.name} API ${Executor.apiLevel}"
101 | YukiHookAPI.Status.isTaiChiModuleActive -> binding.mainTextApiWay.text = "Activated by TaiChi"
102 | else -> binding.mainTextApiWay.text = "Activated by anonymous"
103 | }
104 | }
105 | }
--------------------------------------------------------------------------------
/app/src/main/java/moe/kooritea/gboardInputType/ui/activity/base/BaseActivity.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("MemberVisibilityCanBePrivate", "UNCHECKED_CAST")
2 |
3 | package moe.kooritea.gboardInputType.ui.activity.base
4 |
5 | import android.os.Build
6 | import android.os.Bundle
7 | import androidx.appcompat.app.AppCompatActivity
8 | import androidx.core.content.res.ResourcesCompat
9 | import androidx.core.view.WindowCompat
10 | import androidx.viewbinding.ViewBinding
11 | import com.highcapable.yukihookapi.hook.factory.method
12 | import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass
13 | import moe.kooritea.gboardInputType.R
14 | import moe.kooritea.gboardInputType.utils.factory.isNotSystemInDarkMode
15 | import java.lang.reflect.ParameterizedType
16 |
17 | abstract class BaseActivity : AppCompatActivity() {
18 |
19 | /**
20 | * Get the binding layout object
21 | *
22 | * 获取绑定布局对象
23 | */
24 | lateinit var binding: VB
25 |
26 | override fun onCreate(savedInstanceState: Bundle?) {
27 | super.onCreate(savedInstanceState)
28 | javaClass.genericSuperclass.also { type ->
29 | if (type is ParameterizedType) {
30 | binding = (type.actualTypeArguments[0] as Class).method {
31 | name = "inflate"
32 | param(LayoutInflaterClass)
33 | }.get().invoke(layoutInflater) ?: error("binding failed")
34 | setContentView(binding.root)
35 | } else error("binding but got wrong type")
36 | }
37 | /**
38 | * Hide Activity title bar
39 | * 隐藏系统的标题栏
40 | */
41 | supportActionBar?.hide()
42 | /**
43 | * Init immersive status bar
44 | * 初始化沉浸状态栏
45 | */
46 | WindowCompat.getInsetsController(window, window.decorView).apply {
47 | isAppearanceLightStatusBars = isNotSystemInDarkMode
48 | isAppearanceLightNavigationBars = isNotSystemInDarkMode
49 | }
50 | ResourcesCompat.getColor(resources, R.color.colorThemeBackground, null).also {
51 | window?.statusBarColor = it
52 | window?.navigationBarColor = it
53 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) window?.navigationBarDividerColor = it
54 | }
55 | /**
56 | * Init children
57 | * 装载子类
58 | */
59 | onCreate()
60 | }
61 |
62 | /**
63 | * Callback [onCreate] method
64 | *
65 | * 回调 [onCreate] 方法
66 | */
67 | abstract fun onCreate()
68 | }
--------------------------------------------------------------------------------
/app/src/main/java/moe/kooritea/gboardInputType/ui/view/MaterialSwitch.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("SameParameterValue")
2 |
3 | package moe.kooritea.gboardInputType.ui.view
4 |
5 | import android.content.Context
6 | import android.content.res.ColorStateList
7 | import android.graphics.Color
8 | import android.text.TextUtils
9 | import android.util.AttributeSet
10 | import androidx.appcompat.widget.SwitchCompat
11 | import moe.kooritea.gboardInputType.utils.factory.dp
12 | import moe.kooritea.gboardInputType.utils.factory.isSystemInDarkMode
13 | import top.defaults.drawabletoolbox.DrawableBuilder
14 |
15 | class MaterialSwitch(context: Context, attrs: AttributeSet?) : SwitchCompat(context, attrs) {
16 |
17 | private fun trackColors(selected: Int, pressed: Int, normal: Int): ColorStateList {
18 | val colors = intArrayOf(selected, pressed, normal)
19 | val states = arrayOfNulls(3)
20 | states[0] = intArrayOf(android.R.attr.state_checked)
21 | states[1] = intArrayOf(android.R.attr.state_pressed)
22 | states[2] = intArrayOf()
23 | return ColorStateList(states, colors)
24 | }
25 |
26 | private val thumbColor get() = if (context.isSystemInDarkMode) 0xFF7C7C7C else 0xFFCCCCCC
27 |
28 | init {
29 | trackDrawable = DrawableBuilder()
30 | .rectangle()
31 | .rounded()
32 | .solidColor(0xFF656565.toInt())
33 | .height(20.dp(context))
34 | .cornerRadius(15.dp(context))
35 | .build()
36 | thumbDrawable = DrawableBuilder()
37 | .rectangle()
38 | .rounded()
39 | .solidColor(Color.WHITE)
40 | .size(20.dp(context), 20.dp(context))
41 | .cornerRadius(20.dp(context))
42 | .strokeWidth(8.dp(context))
43 | .strokeColor(Color.TRANSPARENT)
44 | .build()
45 | trackTintList = trackColors(
46 | 0xFF656565.toInt(),
47 | thumbColor.toInt(),
48 | thumbColor.toInt()
49 | )
50 | isSingleLine = true
51 | ellipsize = TextUtils.TruncateAt.END
52 | }
53 | }
--------------------------------------------------------------------------------
/app/src/main/java/moe/kooritea/gboardInputType/utils/factory/FunctionFactory.kt:
--------------------------------------------------------------------------------
1 | @file:Suppress("unused")
2 |
3 | package moe.kooritea.gboardInputType.utils.factory
4 |
5 | import android.content.Context
6 | import android.content.res.Configuration
7 |
8 | /**
9 | * System dark mode is enabled or not
10 | *
11 | * 系统深色模式是否开启
12 | * @return [Boolean] Whether to enable / 是否开启
13 | */
14 | val Context.isSystemInDarkMode get() = (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES
15 |
16 | /**
17 | * System dark mode is disable or not
18 | *
19 | * 系统深色模式是否没开启
20 | * @return [Boolean] Whether to enable / 是否开启
21 | */
22 | inline val Context.isNotSystemInDarkMode get() = isSystemInDarkMode.not()
23 |
24 | /**
25 | * dp to pxInt
26 | *
27 | * dp 转换为 pxInt
28 | * @param context using instance / 使用的实例
29 | * @return [Int]
30 | */
31 | fun Number.dp(context: Context) = dpFloat(context).toInt()
32 |
33 | /**
34 | * dp to pxFloat
35 | *
36 | * dp 转换为 pxFloat
37 | * @param context using instance / 使用的实例
38 | * @return [Float]
39 | */
40 | fun Number.dpFloat(context: Context) = toFloat() * context.resources.displayMetrics.density
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/bg_dark_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/bg_permotion_ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-night/bg_permotion_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_dark_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_green_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_orange_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_permotion_ripple.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | -
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/bg_permotion_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable/ic_launcher_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
10 |
15 |
20 |
25 |
30 |
35 |
40 |
45 |
50 |
55 |
60 |
65 |
70 |
75 |
80 |
85 |
90 |
95 |
100 |
105 |
110 |
115 |
120 |
125 |
130 |
135 |
140 |
145 |
150 |
155 |
160 |
165 |
170 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
19 |
20 |
29 |
30 |
39 |
40 |
41 |
52 |
53 |
61 |
62 |
70 |
71 |
81 |
82 |
88 |
89 |
99 |
100 |
115 |
116 |
117 |
128 |
129 |
130 |
131 |
144 |
145 |
149 |
150 |
155 |
156 |
164 |
165 |
166 |
174 |
175 |
184 |
185 |
194 |
195 |
203 |
204 |
213 |
214 |
215 |
223 |
224 |
229 |
230 |
240 |
241 |
246 |
247 |
257 |
258 |
259 |
260 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-hdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-mdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxhdpi/ic_github.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_home.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxhdpi/ic_home.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_success.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxhdpi/ic_success.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_warn.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxhdpi/ic_warn.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_yukihookapi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxhdpi/ic_yukihookapi.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
--------------------------------------------------------------------------------
/app/src/main/res/values-night/color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF2D2D2D
4 | #FFCFCFCF
5 | #FFD3D3D3
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values-night/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/values-zh-rCN/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 强制修改Gboard输入类型
4 | 让Gboard在部分输入类型中依然显示全键盘
5 | 此模块使用 YukiHookAPI 构建。\n了解更多 https://github.com/fankes/YukiHookAPI
6 | 模块版本:%1$s
7 | 模块未激活
8 | 模块已激活
9 | 显示设置
10 | 在桌面隐藏模块图标
11 | 隐藏模块图标后界面可能会被关闭,将不会再在桌面显示,你可以在 EdXposed、LSPosed 中找到模块设置并打开。
12 | 注意:请务必在 LSPosed 中关闭“强制显示桌面图标”功能
13 | 调试模式
14 | 打印更多日志
15 |
--------------------------------------------------------------------------------
/app/src/main/res/values/array.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - com.google.android.inputmethod.latin
5 |
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/color.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FFFFFFFF
4 | #FF777777
5 | #FF323B42
6 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #FF656565
4 | #FF000000
5 | #FFFFFFFF
6 | #00000000
7 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | 强制修改Gboard输入类型
3 | 让Gboard在部分输入类型中依然显示全键盘
4 | This module is made by YukiHookAPI. \nLearn more https://github.com/fankes/YukiHookAPI
5 | Module version: %1$s
6 | Module not activated
7 | Module is activated
8 | Display settings
9 | Hide app icons on launcher
10 | After hiding the app icon, the interface may be closed and will no longer be displayed on the launcher. You can find and open the module settings in EdXposed or LSPosed.
11 | Note: Be sure to turn off the \"Force apps to show launcher icons\" feature in LSPosed
12 | Debug mode
13 | Print more log
14 |
--------------------------------------------------------------------------------
/app/src/main/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
17 |
--------------------------------------------------------------------------------
/app/src/test/java/moe/kooritea/gboardInputType/ExampleUnitTest.kt:
--------------------------------------------------------------------------------
1 | package moe.kooritea.gboardInputType
2 |
3 | import org.junit.Test
4 |
5 | import org.junit.Assert.*
6 |
7 | /**
8 | * Example local unit test, which will execute on the development machine (host).
9 | *
10 | * See [testing documentation](http://d.android.com/tools/testing).
11 | */
12 | class ExampleUnitTest {
13 | @Test
14 | fun addition_isCorrect() {
15 | assertEquals(4, 2 + 2)
16 | }
17 | }
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application' version '7.3.1' apply false
3 | id 'com.android.library' version '7.3.1' apply false
4 | id 'org.jetbrains.kotlin.android' version '1.7.10' apply false
5 | }
6 |
7 | ext {
8 | appVersionName = "1.2"
9 | appVersionCode = 3
10 | enableR8 = false
11 | }
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-XX:+UseParallelGC
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Kotlin code style for this project: "official" or "obsolete":
19 | kotlin.code.style=official
20 | # Enables namespacing of each library's R class so that its R class includes only the
21 | # resources declared in the library itself and none from the library's dependencies,
22 | # thereby reducing the size of the R class for that library
23 | android.nonTransitiveRClass=true
24 | # Incremental
25 | kotlin.incremental.useClasspathSnapshot=true
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Aug 16 09:27:44 CST 2022
2 | distributionBase=GRADLE_USER_HOME
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
4 | distributionPath=wrapper/dists
5 | zipStorePath=wrapper/dists
6 | zipStoreBase=GRADLE_USER_HOME
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
--------------------------------------------------------------------------------
/md/98098b32a3420d6660045315efc6c1e4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/md/98098b32a3420d6660045315efc6c1e4.png
--------------------------------------------------------------------------------
/md/a3286cdeb41d6cdf54f2391bd740a32.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kooritea/ForceGboardInputType/f2ab1f9476f62288614eb1d37dd03cd41199e41a/md/a3286cdeb41d6cdf54f2391bd740a32.jpg
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | # 强制修改Gboard输入类型
2 |
3 | 在部分类型的输入框(如密码输入框)强制设置Gboard的输入类型,使Gboard能够使用不同语言的输入和使用剪贴板等功能
4 |
5 | 
6 | 
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | repositories {
3 | gradlePluginPortal()
4 | google()
5 | mavenCentral()
6 | }
7 | }
8 | dependencyResolutionManagement {
9 | repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
10 | repositories {
11 | google()
12 | maven { url "https://api.xposed.info/" }
13 | maven { url "https://www.jitpack.io" }
14 | maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
15 | mavenCentral()
16 | }
17 | }
18 | rootProject.name = "ForceGboardInputType"
19 | include ':app'
--------------------------------------------------------------------------------