Skip to content
CleverKeys Wiki
implemented v1.4.0

Quick Settings Tile

Overview

CleverKeys provides an Android Quick Settings tile that allows users to quickly access the keyboard switcher from the notification shade. Tapping the tile opens the system input method picker, providing a convenient way to switch between keyboards without navigating to system settings.

Key Files

FileClass/FunctionPurpose
src/main/kotlin/tribixbite/cleverkeys/KeyboardTileService.ktKeyboardTileServiceTileService implementation
AndroidManifest.xmlService registrationDeclares tile service

Architecture

Quick Settings Panel
       |
       v (user taps tile)
+------------------+
| KeyboardTile     | -- Android calls onClick()
| Service          |
+------------------+
       |
       v
+------------------+
| showInputMethod  | -- Opens system IME picker
| Picker()         |
+------------------+
       |
       v (fallback)
+------------------+
| Open Input       | -- If picker fails, opens settings
| Method Settings  |
+------------------+

Public API

KeyboardTileService

@RequiresApi(Build.VERSION_CODES.N)
class KeyboardTileService : TileService() {

    // Called when Quick Settings panel opens
    override fun onStartListening() {
        updateTileState()
    }

    // Called when user taps the tile
    override fun onClick() {
        showInputMethodPicker()
    }

    // Called when user adds tile to panel
    override fun onTileAdded() {
        updateTileState()
    }

    // Update tile visual state
    private fun updateTileState() {
        qsTile?.apply {
            state = if (isCleverKeysActive()) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE
            updateTile()
        }
    }

    // Show system input method picker
    private fun showInputMethodPicker() {
        val imm = getSystemService(InputMethodManager::class.java)
        imm?.showInputMethodPicker()
    }
}

Implementation Details

Tile States

StateConditionVisual
STATE_ACTIVECleverKeys is current input methodHighlighted/colored
STATE_INACTIVEAnother keyboard is activeDimmed/gray

Input Method Detection

private fun isCleverKeysActive(): Boolean {
    val currentIme = Settings.Secure.getString(
        contentResolver,
        Settings.Secure.DEFAULT_INPUT_METHOD
    )
    return currentIme?.contains(packageName) == true
}

Fallback Behavior

If InputMethodManager.showInputMethodPicker() fails:

private fun showInputMethodPicker() {
    try {
        val imm = getSystemService(InputMethodManager::class.java)
        imm?.showInputMethodPicker()
    } catch (e: Exception) {
        // Fallback: open system input method settings
        val intent = Intent(Settings.ACTION_INPUT_METHOD_SETTINGS)
        intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
        startActivity(intent)
    }
}

AndroidManifest Registration

<service
    android:name="tribixbite.cleverkeys.KeyboardTileService"
    android:label="@string/app_name"
    android:icon="@mipmap/ic_launcher"
    android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
    android:exported="true">
  <intent-filter>
    <action android:name="android.service.quicksettings.action.QS_TILE"/>
  </intent-filter>
</service>

Requirements

  • Android 7.0 (API 24) or higher (TileService introduced in API 24)
  • CleverKeys must be installed and enabled as an input method
  • User must manually add tile to Quick Settings panel

User Flow

  1. Pull down notification shade
  2. Tap “Edit” or pencil icon to customize tiles
  3. Find “CleverKeys” in available tiles
  4. Drag to active tiles area
  5. Tile now appears in Quick Settings
  6. Tap tile → system IME picker appears → select keyboard