<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <!--
      One permission. A keyboard could ask for far more and users would tick it,
      which is exactly why this one does not.
    -->
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name=".SahiApp"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/Theme.Sahi">

        <activity
            android:name=".SettingsActivity"
            android:exported="true"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!--
          The path that works everywhere without a keyboard at all.

          Select text in WhatsApp, Gmail, Chrome, anything — Sahi appears in the
          selection toolbar. Android hands over only the selected text and takes
          back the corrected version. Nothing else on the phone is visible to us.
        -->
        <activity
            android:name=".ProcessTextActivity"
            android:exported="true"
            android:label="@string/process_text_label"
            android:theme="@style/Theme.Sahi.Dialog"
            android:windowSoftInputMode="stateHidden">
            <intent-filter>
                <action android:name="android.intent.action.PROCESS_TEXT" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/plain" />
            </intent-filter>
            <!-- Share sheet, for apps whose selection toolbar is non-standard. -->
            <intent-filter>
                <action android:name="android.intent.action.SEND" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/plain" />
            </intent-filter>
        </activity>

        <service
            android:name=".SahiInputMethodService"
            android:exported="true"
            android:label="@string/keyboard_name"
            android:permission="android.permission.BIND_INPUT_METHOD">
            <intent-filter>
                <action android:name="android.view.InputMethod" />
            </intent-filter>
            <meta-data
                android:name="android.view.im"
                android:resource="@xml/method" />
        </service>

    </application>
</manifest>
