Rewritely is an Android app that helps users quickly rewrite their written text to improve grammar and sentence structure in any app.
| Home Screen | Text Input with Floating Icon |
|---|---|
![]() |
- Text Rewriting: Rewrites text in any input field using the OpenAI API.
- Floating Icon: Provides a non-intrusive floating icon for easy access to the rewrite functionality. Type at least 3 words in the input field for the icon to show up.
- Shortcut Triggers: Create custom shortcut texts (2-5 characters) that automatically trigger text rewriting when typed at the end of your text followed by a space. Each shortcut can be configured with its own custom prompt or use existing custom options.
- Trigger Modes: Choose how to trigger rewrites - shortcuts only, floating icon only, or both modes together.
- API Key Management: Securely stores and manages the OpenAI API key with the ability to reset it.
- App Selection: Choose which specific apps should show the floating icon, or enable it for all apps.
- Custom Options: Create and manage custom rewrite prompts with up to 4 custom options plus default and ChatGPT options. Users can also update default prompts along with adding new custom options.
- ChatGPT Integration: Special ChatGPT option that copy-pastes text directly into ChatGPT with the configured prompt for seamless workflow.
- Permissions Handling: Manages necessary permissions, including Accessibility Service and Draw Over Other Apps.
- Android device with API level 23 or higher.
- OpenAI API Key.
- Clone the repository:
git clone <repository_url>
- Open the project in Android Studio.
- Obtain an OpenAI API Key from the OpenAI platform.
- Build and run the app on an Android device or emulator.
- Enter your OpenAI API key in the app's settings.
- Grant the necessary permissions, specifically:
- Accessibility Service: Enable the Rewritely Accessibility Service to allow the app to monitor and interact with text fields.
- Draw Over Other Apps: Allow the app to display the floating icon.
- Open any app with text input fields
- Type at least 3 words in a text field
- A floating icon will appear next to the text field
- Tap the floating icon to rewrite your text using AI
- Go to the app's settings screen
- Tap "Choose Apps" in the App Selection section
- Select which apps should show the floating icon
- You can choose specific apps or enable it for all apps
- In the settings screen, tap "Customize Now" in the Customization section
- Create custom rewrite prompts with descriptive names
- Edit the default and ChatGPT options as needed
- Up to 4 custom options can be created in addition to the built-in options
- In the settings screen, tap "Add shortcut" in the Shortcuts section
- Create shortcut texts (2-5 characters) that will automatically trigger rewriting
- Configure each shortcut with a custom prompt or select an existing custom option
- Enable or disable shortcuts individually as needed
- Up to 10 shortcuts can be created
- When typing in any text field, type your shortcut followed by a space to automatically trigger rewriting
- The shortcut text is automatically removed before the rewrite is performed
- In the settings screen, tap "Configure Mode" in the Trigger Mode section
- Choose from three modes:
- Shortcuts Only: Only shortcut triggers work; no floating icon appears
- Floating Icon Only: Only the floating icon appears; shortcut triggers are disabled
- Both: Both shortcuts and floating icon are active
The app follows a simple architecture with the following key components:
- MainActivity: The main activity handles the UI for API key input, permission requests, and settings management.
- RewritelyService: An Accessibility Service that monitors text fields, displays the floating icon, detects shortcut triggers, and handles the text rewriting.
- OpenAiApiService: A Retrofit interface for making API calls to the OpenAI API.
- ApiClient: A singleton object that provides a Retrofit client for the OpenAI API.
- SecurePrefs: A utility class for securely storing the OpenAI API key, custom options, and shortcut triggers using EncryptedSharedPreferences.
- AppSelectionSettings: Manages which apps should show the floating icon.
- CustomOption: Data class for managing custom rewrite prompts.
- ShortcutTrigger: Data class for managing shortcut trigger configurations.
- TriggerMode: Enum for managing trigger mode settings (shortcuts only, floating icon only, or both).
- AppCache: Handles caching of installed apps for better performance.
- Kotlin
- AndroidX libraries
- Retrofit
- OkHttp
- AndroidX Security Crypto
- Jetpack Compose
The app requires the following permissions:
- android.permission.SYSTEM_ALERT_WINDOW: To draw the floating icon over other apps.
- android.permission.INTERNET: To communicate with the OpenAI API.
- android.permission.FOREGROUND_SERVICE: To keep the service running in the background.
- android.permission.FOREGROUND_SERVICE_SPECIAL_USE: (Android 14+) Specific foreground service permission.
- android.permission.BIND_ACCESSIBILITY_SERVICE: Granted by the system when the user enables the Accessibility Service.
- The OpenAI API key is stored securely using EncryptedSharedPreferences.
- The Accessibility Service is crucial for the app's functionality. The app will not function correctly without it enabled.
- The app uses
foregroundServiceType="specialUse"and the corresponding permission for Android 14 to provide a clear justification for its background operation, emphasizing its assistance features. - Custom options are limited to 4 additional options plus the default and ChatGPT options.
- Shortcut triggers are limited to 10 shortcuts, each with 2-5 characters.
- Shortcut triggers automatically detect when you type a shortcut followed by a space and trigger rewriting without requiring the floating icon.
- App selection settings are saved automatically and persist across app restarts.
MIT License
