visual enhancements and documentation changes.
This commit is contained in:
@@ -3,12 +3,12 @@
|
||||
A minimal Android application that demonstrates a simple countdown functionality with an audible alert.
|
||||
|
||||
## Description
|
||||
The Countdown Timer app is a lightweight utility that launches a modal dialog to count down from 10 seconds. Once the timer reaches zero, the app plays a system error tone and closes the dialog. This project serves as a basic example of using `CountDownTimer`, `ToneGenerator`, and custom `Dialog` implementation in Android.
|
||||
The Countdown Timer app is a lightweight utility that launches a modal dialog to count down from a user-selected duration (5s, 10s, 15s, or 30s). Once the timer reaches zero, the app plays a confirmation tone and vibration, then shows a dismiss button. This project serves as a basic example of using `CountDownTimer`, `ToneGenerator`, and custom `Dialog` implementation in Android.
|
||||
|
||||
## Key Features
|
||||
- **Single-Action Interface**: A simple main screen with a start button.
|
||||
- **Modal Countdown**: A non-cancelable dialog that prevents user interference during the countdown.
|
||||
- **Audible Alert**: Integration with Android's `ToneGenerator` to play `TONE_SUP_ERROR` upon completion.
|
||||
- **Selectable Duration**: A main screen with a duration picker (chip group) and a start button.
|
||||
- **Modal Countdown**: A full-screen dialog with circular progress ring, stop/restart buttons, and a confirmation tone during the final 3 seconds.
|
||||
- **Haptic Feedback**: Vibration on the last 3 seconds and on completion (configurable via shared preferences).
|
||||
- **Real-time Updates**: UI updates every second to reflect the remaining time.
|
||||
|
||||
## Getting Started
|
||||
@@ -25,19 +25,46 @@ To build the debug APK from the command line:
|
||||
```
|
||||
|
||||
### Running the App
|
||||
|
||||
#### Via Android Studio
|
||||
1. Open the project in Android Studio.
|
||||
2. Select your target device/emulator.
|
||||
3. Click the **Run** button or press `Shift + F10`.
|
||||
|
||||
#### Via ADB
|
||||
First, ensure your device or emulator is connected (`adb devices`). Then install the debug APK and launch the app:
|
||||
|
||||
```bash
|
||||
# Install the debug APK
|
||||
adb install -r app/build/outputs/apk/debug/app-debug.apk
|
||||
|
||||
# Launch the app
|
||||
adb shell am start -n com.example.countdowntimer.debug/com.example.countdowntimer.MainActivity
|
||||
```
|
||||
|
||||
#### Taking a Screenshot via ADB
|
||||
To capture a screenshot of the app from your host machine:
|
||||
|
||||
```bash
|
||||
# Take the screenshot on the device
|
||||
adb shell screencap -p /sdcard/screenshot.png
|
||||
|
||||
# Pull it to your host machine
|
||||
adb pull /sdcard/screenshot.png screenshots/
|
||||
```
|
||||
|
||||
## Project Structure
|
||||
```text
|
||||
app/
|
||||
├── src/
|
||||
│ └── main/
|
||||
│ ├── java/com/example/countdowntimer/
|
||||
│ │ ├── MainActivity.kt # Main entry point; launches the timer
|
||||
│ │ └── CountdownDialog.kt # Logic for the 10s countdown and tone
|
||||
│ ├── res/ # UI layouts and resources
|
||||
│ └── AndroidManifest.xml # Application manifest
|
||||
└── build.gradle # App-level build configuration
|
||||
│ │ ├── MainActivity.kt # Main entry point; duration picker and timer trigger
|
||||
│ │ ├── CountdownDialog.kt # Countdown logic, tone, and vibration
|
||||
│ │ └── CountdownCanvasView.kt # Custom circular progress ring view
|
||||
│ ├── res/layout/ # UI layouts
|
||||
│ │ ├── activity_main.xml
|
||||
│ │ └── dialog_countdown.xml
|
||||
│ └── AndroidManifest.xml # Application manifest
|
||||
└── build.gradle # App-level build configuration
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user