{"id":23260792,"url":"https://github.com/boybeak/skb-global","last_synced_at":"2025-03-31T11:02:07.666Z","repository":{"id":266199773,"uuid":"897674767","full_name":"boybeak/skb-global","owner":"boybeak","description":"May be the best solution for Android soft keyboard listening","archived":false,"fork":false,"pushed_at":"2024-12-25T04:45:34.000Z","size":3301,"stargazers_count":96,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T09:08:39.997Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boybeak.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-03T03:21:27.000Z","updated_at":"2025-03-22T07:02:10.000Z","dependencies_parsed_at":"2024-12-10T15:22:56.012Z","dependency_job_id":"8f4f8ed7-76bc-40bf-ad95-722193549d35","html_url":"https://github.com/boybeak/skb-global","commit_stats":null,"previous_names":["boybeak/softkeyboardglobal","boybeak/skb-global"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boybeak%2Fskb-global","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boybeak%2Fskb-global/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boybeak%2Fskb-global/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boybeak%2Fskb-global/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boybeak","download_url":"https://codeload.github.com/boybeak/skb-global/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246457966,"owners_count":20780676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-19T13:18:50.178Z","updated_at":"2025-03-31T11:02:07.638Z","avatar_url":"https://github.com/boybeak.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SoftKeyboardGlobal ![version](https://jitpack.io/v/boybeak/skb-global.svg)\n\nMay be the best solution for Android soft keyboard listening。\n\n![gif](arts/skb-global.gif)\n\n## Installation\n\nAdd **jitpack** to your `settings.gradle.kts`.\n\n```groovy\ndependencyResolutionManagement {\n    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)\n    repositories {\n        mavenCentral()\n        maven { url 'https://jitpack.io' }\n    }\n}\n```\n\nthen, add dependency.\n\n```groovy\ndependencies {\n    implementation 'com.github.boybeak:skb-global:Tag'\n}\n```\nThe newest version is: ![version](https://jitpack.io/v/boybeak/skb-global.svg)\n\n# Usage\nYou can use it **globally** or **locally**.\n\n### Globally\nInitialize `SoftKeyboardGlobal` before using it.\n\n```kotlin\nclass App : Application() {\n\n    override fun onCreate() {\n        super.onCreate()\n        SoftKeyboardGlobal.install(this, true)\n    }\n}\n```\nYou can pass `true` to second parameter to display a debug UI indicator.\n\n```kotlin\nSoftKeyboardGlobal.addSoftKeyboardCallback(object : SoftKeyboardGlobal.SoftKeyboardCallback {\n    override fun onOpen(height: Int) {\n        Log.d(TAG, \"onOpen height=$height\")\n    }\n\n    override fun onClose() {\n        Log.d(TAG, \"onClose\")\n    }\n\n    override fun onHeightChanged(height: Int) {\n        Log.d(TAG, \"onHeightChanged height=$height\")\n    }\n})\n```\n\nYou can observe soft keyboard state change and height change at any where in your app.\n\n### Locally\n```kotlin\nclass MainActivity : AppCompatActivity() {\n\n    private val observer by lazy { KeyboardObserver.create(this, true) }\n    private val switchBtn: SwitchCompat by lazy { findViewById(R.id.switchBtn) }\n\n    override fun onCreate(savedInstanceState: Bundle?) {\n        super.onCreate(savedInstanceState)\n        setContentView(R.layout.activity_main)\n\n        switchBtn.setOnCheckedChangeListener { buttonView, isChecked -\u003e\n            if (isChecked) {\n                observer.watch()\n            } else {\n                observer.unwatch()\n            }\n        }\n    }\n}\n```\nYou can pass `true` to second parameter when creating a `KeyboardObserver` to display a debug UI indicator.\n\n## Q\u0026A\n### 1. Landscape problem\nThe `EditText`'s default behavior for landscape is **ExtractUi**.\n\n![landscape](./arts/landscape.png)\n\nYou need add `android:imeOptions=\"flagNoExtractUi\"` to your `EditText` in xml or use `editText.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI` in program.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboybeak%2Fskb-global","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboybeak%2Fskb-global","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboybeak%2Fskb-global/lists"}