diff options
| author | Tom Cooks <tommasogagliardi+github@gmail.com> | 2026-11-16 09:34:52 -0500 |
|---|---|---|
| committer | Tom Cooks <tommasogagliardi+github@gmail.com> | 2026-11-16 09:34:52 -0500 |
| commit | 5090b55eb7bc3a98b678e21b859fd01d2e30e554 (patch) | |
| tree | 21fb8fb1dcb994231a0d0468345b64c0156c24e8 | |
| parent | e0f907c9cc8f4cd11387bd943df9a0bdf2a0dbcf (diff) | |
| download | reccoon-1.1.2.tar.gz | |
Release RECCoon 1.1.2v1.1.2
- Refreshable MIC/SPK pickers with labels above the selectors.
- WAV/M4A, MONO/STEREO and Silence alerts on one harmonised row.
- Waveform and L/R meters under the record button, with Swap L/R.
- Recordings saved in Downloads/RECCoon.
- Confirmation before discarding and timer reset.
- Player export next to Transcribe, transcript save timestamp.
- Signed release APK for the F-Droid Binaries URL.
33 files changed, 1025 insertions, 322 deletions
@@ -1,32 +1,37 @@ # RECCoon -A minimal Android app that records uncompressed WAV audio and transcribes it +A minimal Android app that records audio (WAV or M4A) and transcribes it on device. -- **Format:** 44.1 kHz, 16-bit PCM (stereo when the device supports it), no compression -- **Compact mode:** an optional switch saves a small AAC-LC `.m4a` instead of the WAV +- **Capture:** 44.1 kHz, 16-bit PCM (stereo when the device supports it) +- **Format:** choose **WAV** or a small AAC-LC `.m4a` radio on the main screen (~22 MB/hour mono instead of ~317 MB); transcription still works because the decoder streams the M4A back to PCM (`PcmAudioSource`) - **Controls:** one big round button — tap to start recording (timer starts), tap again to stop and save -- **Meters:** live scrolling waveform plus left/right peak level meters with a clip indicator while recording -- **Mono switch:** optionally record a single channel (half the file size) -- **Swap L/R:** exchange the stereo channels when a device reports them inverted in - landscape; applies to the meters and the saved file -- **Mic picker:** choose Auto, the built-in mic, or a specific input (Bluetooth SCO, - USB, wired headset ...) — the BT-Mic-Force feature folded into RECCoon -- **Live monitoring:** an optional **Monitor** switch plays the microphone through a - chosen output (built-in speaker, wired, USB, Bluetooth ...). Use headphones — the - speaker causes feedback. A dedicated thread and a bounded queue keep a slow output - from ever stalling the recording -- **Discard:** stop a recording and throw it away without saving +- **Meters:** live scrolling waveform and left/right peak strips directly under the + record button, each with a microphone icon; a **Swap L/R** icon button sits on the right +- **MONO / STEREO radios:** record one channel (half the file size) or two +- **Mic / speaker pickers:** **MIC** and **SPK** labels sit above their selectors, + which list Auto, the built-in device, and every detected input/output. The first + entry in each list refreshes the device scan; phones show the two pickers side by + side, tablets stack them +- **Live monitoring:** with a concrete output selected, the microphone is played + through that SPK device while recording. Auto means no monitoring. Use + headphones — the speaker causes feedback. A dedicated thread and a bounded queue + keep a slow output from ever stalling the recording +- **Discard:** asks for confirmation, then stops the recording and throws it away + without saving; the timer returns to `00:00` - **Markers:** place labelled cue points while recording; they are embedded in the WAV (`cue ` + `LIST/adtl`) and shown in the player -- **Silence:** optional Do Not Disturb total silence (no notifications, no vibration) while recording -- **Recordings list:** scrollable list at the bottom of the main screen, newest first -- **Player:** scrubber, ±10 s jumps, speed control, delete / rename / share / export, no autoplay +- **Silence alerts:** barred-bell chip that enables Do Not Disturb total silence + (no notifications, no vibration) while recording +- **Recordings list:** scrollable list at the bottom of the main screen, newest first, + read from `Downloads/RECCoon` +- **Player:** scrubber, ±10 s jumps, speed control, delete / rename / share; Export + sits next to Transcribe and stays greyed out until a transcript exists; no autoplay - **Transcription:** on-device, offline speech recognition with [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx) using multilingual **NVIDIA Parakeet v3** — works with English, Italian and 23 other languages -- **Name:** RECCoon · **by** Tom Cooks · **version** 1.0.0 +- **Name:** RECCoon · **by** Tom Cooks · **version** 1.1.2 - **Icon:** raccoon with a microphone ## Requirements @@ -52,8 +57,8 @@ Outputs: F-Droid submission status, the release-signing key and the build/reproducibility gotchas are documented in `FDROID.md`. -A prebuilt copy is available at `dist/RECCoon-1.0.0.apk` (release, signed with -the maintainer key). The APK in `dist/` is **not** tracked in git. The sherpa-onnx +A prebuilt copy of the previous release is available at `dist/RECCoon-1.0.0.apk` +(release, signed with the maintainer key). The APK in `dist/` is **not** tracked in git. The sherpa-onnx runtime comes from [JitPack](https://jitpack.io) (an F-Droid-trusted Maven repository), so no prebuilt binary lives in this repository. @@ -68,11 +73,13 @@ repository), so no prebuilt binary lives in this repository. - `RecordingService` is a microphone-typed foreground service started while recording, so capture continues when the app is in the background. - `MainActivity` handles the runtime permissions, the timer, the level meters - and copying the finished file into Downloads. On Android 10+ this uses - `MediaStore`; on older versions it writes directly to the public Downloads - directory and notifies the media scanner. -- Files are named `reccoon-YYYY-MM-DD-HHMMSS-XXXXX.wav`, where `XXXXX` is a - persistent 5-digit progressive counter. + and copying the finished file into `Downloads/RECCoon`. On Android 10+ this + uses `MediaStore` with `RELATIVE_PATH`; on older versions it writes directly + to that public subdirectory and notifies the media scanner. +- Files are named `RECCoon_YYYY-MM-DD_HH-MM-SS_XXXXX.wav` (or `.m4a`), where + `XXXXX` is a persistent 5-digit counter. The folder is the source of truth: + the recordings list accepts every `.wav` / `.m4a` in it, and still shows old + `reccoon-*` files from the root of Downloads after an upgrade. ## Waveform, meters and markers @@ -94,8 +101,9 @@ repository), so no prebuilt binary lives in this repository. (`SeekBar`), ±10 s jumps and a playback speed control (0.5×–2×). Playback does **not** start automatically. - Library actions: **Share** (FileProvider on Android 9 and older), **Rename** - (MediaStore or file), **Export** (writes `.txt` and `.srt` to Downloads) and - **Delete** (removes the WAV and its sidecars). + (MediaStore or file) and **Delete** (removes the recording and its sidecars). + **Export** (writes `.txt` and `.srt` to Downloads) sits next to Transcribe and + is enabled only when a transcript exists. - Transcript words are clickable: tapping a word seeks the player to it. Word timings come from the model's token timestamps when available, otherwise the segment is divided between its words. @@ -123,12 +131,15 @@ repository), so no prebuilt binary lives in this repository. and handles language detection itself (no language picker). It needs ~670 MB of storage and a large-heap device. - Transcripts are stored as JSON sidecars in app-private storage - (`filesDir/transcripts/<recording>.json`). + (`filesDir/transcripts/<recording>.json`). The sidecar records `savedAt`, shown + as **Transcript saved yyyy-mm-ddThh:mm:ss** in the player. +- The model spinner is hidden while Parakeet v3 is the only model. Transcribe is + disabled once a transcript exists; Export is enabled at the same moment. ## Compact (compressed) recordings -- The **Compressed (small M4A)** checkbox transcodes the finished WAV to - AAC-LC (48 kbps per channel) with `AudioCompressor` and saves that instead. +- The **M4A** radio transcodes the finished WAV to AAC-LC (48 kbps per channel) + with `AudioCompressor` and saves that instead. **WAV** keeps the original PCM. Markers are kept as a JSON sidecar. Use it when storage matters more than bit-exact audio. - `tools/whistle-eval/` contains a desktop harness that compares Whisper, @@ -136,14 +147,15 @@ repository), so no prebuilt binary lives in this repository. ## Live monitoring and discard -- **Monitor** plays the incoming audio back through the selected output device while - recording. The output picker mirrors the mic picker (Auto, phone speaker, wired, - USB, Bluetooth). `LiveMonitor` owns an `AudioTrack` on its own thread with a small - bounded queue, so a slow output (for example Bluetooth A2DP) drops monitor chunks - instead of blocking the capture loop and corrupting the recording. Headphones are - strongly recommended — the phone speaker feeds back. -- **Discard** stops the recording and deletes the temporary file without saving it, - for takes that are obviously bad. +- Monitoring plays the incoming audio back through the selected SPK device while + recording. The SPK picker mirrors the MIC picker (Auto, phone speaker, wired, USB, + Bluetooth). A concrete output enables monitoring; **Auto** means no live playback. + `LiveMonitor` owns an `AudioTrack` on its own thread with a small bounded queue, + so a slow output (for example Bluetooth A2DP) drops monitor chunks instead of + blocking the capture loop and corrupting the recording. Headphones are strongly + recommended — the phone speaker feeds back. +- **Discard** asks for confirmation, then stops the recording and deletes the + temporary file without saving it, for takes that are obviously bad. ## License @@ -1,5 +1,144 @@ # RECCoon TODO +## Version 1.1.2 — layout spacing (2026-11-09) + +Semver: **1.1.2** (patch). + +- [x] Centre the Silence alerts chip between WAV/M4A and MONO/STEREO. + - [x] Add wider gaps between the three groups. +- [x] Move the recording status text directly below the record button. +- [x] Bump `versionName` to **1.1.2** and `versionCode` to **4**. +- [x] Rebuild the debug APK. + +## Version 1.1.1 — follow-up polish (2026-11-09) + +Semver: **1.1.1** (patch). Refines the 1.1.0 layout after on-device feedback. + +- [x] Remove the redundant **Monitor** checkbox. + - [x] Live monitoring is enabled whenever a concrete SPK output is selected. + - [x] Auto output means no monitoring. +- [x] Add vertical spacing and a hairline below the L/R meters. +- [x] Change the Swap L/R icon to up/down arrows. +- [x] Put the **[icon] MIC** and **[icon] SPK** labels above their spinners. + - [x] Give both spinners the full width of their column. +- [x] Add padding to the WAV/M4A, MONO/STEREO and Silence alerts chips. + - [x] Give each chip an equal share of the row so they line up. +- [x] Move Mark / Discard below the meters. + - [x] Add vertical spacing and a hairline below those buttons. +- [x] Bump `versionName` to **1.1.1** and `versionCode` to **3**. +- [x] Rebuild the debug APK for on-device testing. + +## Version 1.1.0 — UI/UX refresh (requested 2026-11-02) + +Semver: **1.1.0** (minor). All changes are UI/behaviour additions and fixes; +nothing removes data or breaks the saved-file format. `versionCode` 2. + +### 1. Refreshable MIC / SPK device pickers + +- [x] Add a **Refresh inputs** item as the first entry of the MIC spinner. + - [x] Show the refresh icon before the label. + - [x] Draw a bottom border on the item so its purpose is obvious. + - [x] Re-scan `AudioManager.getDevices(GET_DEVICES_INPUTS)` when tapped. +- [x] Add a **Refresh outputs** item as the first entry of the SPK spinner. + - [x] Show the refresh icon before the label. + - [x] Draw a bottom border on the item so its purpose is obvious. + - [x] Re-scan `AudioManager.getDevices(GET_DEVICES_OUTPUTS)` when tapped. +- [x] Keep the current device selected after a refresh (fall back to Auto if it vanished). + +### 2. Responsive MIC / SPK layout + +- [x] Place the MIC and SPK pickers side by side on small screens. +- [x] Stack them vertically on larger screens (`sw600dp` and up), as today. + +### 3. MIC / SPK labels + +- [x] Replace the words **Mic** and **Out** with a microphone icon + **MIC**. +- [x] Replace **Out** with a speaker icon + **SPK**. + +### 4. Waveform, L/R meters and Swap L/R + +- [x] Move the waveform directly below the record button. +- [x] Move the L/R level meters below the waveform. +- [x] Put the **Swap L/R** control to the right of the meters. + - [x] Replace the checkbox with an icon button that shows arrows. + - [x] Keep the persisted swap setting and selected visual state. +- [x] Draw a microphone icon to the left of each **L** / **R** meter label. + +### 5. Recording format radio + +- [x] Replace the **Compressed (small M4A)** checkbox with a WAV / M4A radio. + - [x] WAV on the left, M4A on the right. + - [x] Keep the persisted preference and the existing compression pipeline. + +### 6. Live monitoring behaviour + +- [x] Explain what happens when **Monitor** is off (recording still works, but the + chosen output is not used; Monitor only feeds the mic back to an output). +- [x] Automatically switch Monitor on when a non-default output is selected, + so the output picker never looks broken. + - [x] Keep the feedback warning. + - [x] Let the user turn Monitor off again manually. + +> **What Monitor off means:** recording and saving still work normally; the app +> simply does not play the microphone back through the SPK device, so the SPK +> picker has no effect. Monitor is only a confidence/level aid, not a +> requirement. Selecting any concrete output (even the phone speaker) now turns +> Monitor on automatically and shows the feedback warning; you can turn it off +> again at any time. + +### 7. Mono / stereo radio + +- [x] Replace the **Mono** checkbox with a microphone-icon **MONO** radio. +- [x] Add a microphone-icon **STEREO** radio. +- [x] Check that the radios really change `WavRecorder.setForceMono(...)` and the + saved channel count. + +### 8. Silence alerts icon + +- [x] Add a barred-bell icon to the **Silence alerts** control. + +### 9. One-line options row + +- [x] Place WAV/M4A, MONO/STEREO and Silence alerts on the same line. +- [x] Keep the row usable on narrow screens (compact segmented controls). + +### 10. Discard confirmation + +- [x] Add a confirmation dialog before discarding: + **Do you really want to discard the current recording?** + - [x] OK discards. + - [x] Cancel keeps recording. +- [x] Reset the timer to `00:00` after a discard. + +### 11. Downloads/RECCoon recordings folder + +- [x] Save new recordings to `Downloads/RECCoon` on Android 10+ (MediaStore + `RELATIVE_PATH`). +- [x] Save new recordings to `Downloads/RECCoon` on Android 8–9 (direct file). +- [x] Stop depending on the `reccoon-*` filename prefix: + - [x] List every `.wav` / `.m4a` inside `Downloads/RECCoon`. + - [x] Keep old `reccoon-*` files in the root of Downloads visible for migration. + - [x] Give new files a readable `RECCoon_<date>_<time>` name. + +### 12. Player transcription actions + +- [x] Move **Export** next to **Transcribe**. + - [x] Grey it out until a transcript exists. +- [x] Disable **Transcribe** after a transcript has been produced. +- [x] Hide the model spinner (there is only one Parakeet option). + +### 13. Transcript timestamp + +- [x] Show the save time: **Transcript saved yyyy-mm-ddThh:mm:ss**. + - [x] Persist the timestamp in the transcript sidecar. + - [x] Fall back to the sidecar file time for old transcripts. + +### 14. Release housekeeping + +- [x] Bump `versionName` to **1.1.0** and `versionCode` to **2**. +- [x] Update the subtitle, README and fastlane changelog. +- [x] Build and run the JVM tests. + ## Requested (2026-10-05) ### 1. Compare transcription models (Whisper / Parakeet / Whistle) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 835ff7e..c198d4a 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -15,8 +15,8 @@ android { applicationId = "com.tomcooks.reccoon" minSdk = 26 targetSdk = 35 - versionCode = 1 - versionName = "1.0.0" + versionCode = 4 + versionName = "1.1.2" ndk { // Prebuilt sherpa-onnx / onnxruntime native libraries. Only arm64 is diff --git a/app/src/main/java/com/tomcooks/reccoon/DeviceSpinnerAdapter.java b/app/src/main/java/com/tomcooks/reccoon/DeviceSpinnerAdapter.java new file mode 100644 index 0000000..9e4b770 --- /dev/null +++ b/app/src/main/java/com/tomcooks/reccoon/DeviceSpinnerAdapter.java @@ -0,0 +1,48 @@ +package com.tomcooks.reccoon; + +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.widget.ArrayAdapter; +import android.widget.TextView; + +import java.util.List; + +/** + * Adapter for the MIC / SPK device spinners. The first entry is always a + * refresh command, shown with an icon and a divider so it cannot be mistaken + * for a device. + */ +public final class DeviceSpinnerAdapter extends ArrayAdapter<String> { + + private final LayoutInflater inflater; + + public DeviceSpinnerAdapter(Context context, List<String> labels) { + super(context, android.R.layout.simple_spinner_item, labels); + inflater = LayoutInflater.from(context); + setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + return itemView(position, android.R.layout.simple_spinner_item, parent); + } + + @Override + public View getDropDownView(int position, View convertView, ViewGroup parent) { + return itemView(position, android.R.layout.simple_spinner_dropdown_item, parent); + } + + private View itemView(int position, int normalLayout, ViewGroup parent) { + if (position == 0) { + View view = inflater.inflate(R.layout.item_spinner_refresh, parent, false); + TextView label = view.findViewById(R.id.refreshText); + label.setText(getItem(position)); + return view; + } + TextView text = (TextView) inflater.inflate(normalLayout, parent, false); + text.setText(getItem(position)); + return text; + } +} diff --git a/app/src/main/java/com/tomcooks/reccoon/Formats.java b/app/src/main/java/com/tomcooks/reccoon/Formats.java index 338fd58..c77cba3 100644 --- a/app/src/main/java/com/tomcooks/reccoon/Formats.java +++ b/app/src/main/java/com/tomcooks/reccoon/Formats.java @@ -8,7 +8,7 @@ public final class Formats { private Formats() { } - /** Turns {@code reccoon-2026-09-24-153000-00001.wav} into a readable label. */ + /** Turns {@code RECCoon_2026-09-24_15-30-00_00001.wav} into a readable label. */ public static String prettyName(String fileName) { if (fileName == null) { return ""; @@ -16,17 +16,30 @@ public final class Formats { String core = fileName; if (core.startsWith("reccoon-")) { core = core.substring("reccoon-".length()); + } else if (core.startsWith("RECCoon_")) { + core = core.substring("RECCoon_".length()); } if (core.endsWith(".wav") || core.endsWith(".m4a")) { core = core.substring(0, core.length() - 4); } - String[] parts = core.split("-"); + String[] parts = core.replace('_', '-').split("-"); if (parts.length >= 4) { String date = parts[0] + "-" + parts[1] + "-" + parts[2]; - String time = parts[3]; - String sequence = parts.length >= 5 ? parts[4] : ""; - if (time.length() == 6) { - time = time.substring(0, 2) + ":" + time.substring(2, 4) + ":" + time.substring(4); + String time; + String sequence; + if (parts.length >= 7 && parts[3].length() == 2 + && parts[4].length() == 2 && parts[5].length() == 2) { + // New RECCoon_yyyy-MM-dd_HH-mm-ss_xxxxx names. + time = parts[3] + ":" + parts[4] + ":" + parts[5]; + sequence = parts[6]; + } else { + // Historical reccoon-yyyy-MM-dd-HHmmss-xxxxx names. + time = parts[3]; + if (time.length() == 6) { + time = time.substring(0, 2) + ":" + + time.substring(2, 4) + ":" + time.substring(4); + } + sequence = parts.length >= 5 ? parts[4] : ""; } return date + " " + time + (sequence.isEmpty() ? "" : " #" + sequence); } diff --git a/app/src/main/java/com/tomcooks/reccoon/LevelMeterView.java b/app/src/main/java/com/tomcooks/reccoon/LevelMeterView.java index 362ee6a..4dd8f97 100644 --- a/app/src/main/java/com/tomcooks/reccoon/LevelMeterView.java +++ b/app/src/main/java/com/tomcooks/reccoon/LevelMeterView.java @@ -6,10 +6,12 @@ import android.graphics.LinearGradient; import android.graphics.Paint; import android.graphics.RectF; import android.graphics.Shader; +import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.View; import androidx.annotation.Nullable; +import androidx.core.content.ContextCompat; /** * Two-channel (left/right) peak level meter with a decaying peak hold and a @@ -26,6 +28,7 @@ public class LevelMeterView extends View { private final Paint peakPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint labelPaint = new Paint(Paint.ANTI_ALIAS_FLAG); private final Paint clipPaint = new Paint(Paint.ANTI_ALIAS_FLAG); + private final Drawable micIcon; private final RectF barRect = new RectF(); @@ -54,6 +57,13 @@ public class LevelMeterView extends View { clipPaint.setTextSize(11f * density); clipPaint.setFakeBoldText(true); clipPaint.setTextAlign(Paint.Align.RIGHT); + + Drawable icon = ContextCompat.getDrawable(context, R.drawable.ic_mic); + if (icon != null) { + icon = icon.mutate(); + icon.setTint(0xFF93A0B0); + } + micIcon = icon; } /** Feed one measurement window. Amplitudes are 0..1. */ @@ -92,13 +102,15 @@ public class LevelMeterView extends View { float density = getResources().getDisplayMetrics().density; float gap = 6f * density; float barHeight = (getHeight() - gap) / 2f; - float labelWidth = labelPaint.measureText("L") + 10f * density; + float iconSize = 14f * density; + float labelX = micIcon == null ? 0f : iconSize + 3f * density; + float labelWidth = labelX + labelPaint.measureText("L") + 10f * density; float rightEdge = getWidth() - clipPaint.measureText("CLIP") - 10f * density; drawBar(canvas, 0f, labelWidth, rightEdge - labelWidth, barHeight, - leftLevel, leftPeak, "L"); + leftLevel, leftPeak, "L", iconSize, labelX); drawBar(canvas, barHeight + gap, labelWidth, rightEdge - labelWidth, barHeight, - rightLevel, rightPeak, "R"); + rightLevel, rightPeak, "R", iconSize, labelX); if (System.currentTimeMillis() < clipUntil) { float baseline = getHeight() / 2f - (clipPaint.descent() + clipPaint.ascent()) / 2f; @@ -113,10 +125,16 @@ public class LevelMeterView extends View { } private void drawBar(Canvas canvas, float top, float left, float width, float height, - float level, float peak, String label) { + float level, float peak, String label, + float iconSize, float labelX) { float density = getResources().getDisplayMetrics().density; float labelBaseline = top + height / 2f - (labelPaint.descent() + labelPaint.ascent()) / 2f; - canvas.drawText(label, 0f, labelBaseline, labelPaint); + if (micIcon != null) { + int iconTop = Math.round(top + height / 2f - iconSize / 2f); + micIcon.setBounds(0, iconTop, Math.round(iconSize), iconTop + Math.round(iconSize)); + micIcon.draw(canvas); + } + canvas.drawText(label, labelX, labelBaseline, labelPaint); barRect.set(left, top, left + width, top + height); canvas.drawRoundRect(barRect, height / 2f, height / 2f, backgroundPaint); diff --git a/app/src/main/java/com/tomcooks/reccoon/MainActivity.java b/app/src/main/java/com/tomcooks/reccoon/MainActivity.java index 37ff774..259acc6 100644 --- a/app/src/main/java/com/tomcooks/reccoon/MainActivity.java +++ b/app/src/main/java/com/tomcooks/reccoon/MainActivity.java @@ -25,13 +25,15 @@ import android.text.InputType; import android.view.LayoutInflater; import android.view.View; import android.view.WindowManager; -import android.widget.ArrayAdapter; +import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; +import android.widget.RadioButton; +import android.widget.RadioGroup; import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; @@ -65,7 +67,6 @@ public class MainActivity extends AppCompatActivity { private static final String PREF_COMPRESS = "compress_recordings"; private static final String PREF_INPUT = "input_device"; private static final String PREF_SWAP = "swap_channels"; - private static final String PREF_MONITOR = "live_monitor"; private static final String PREF_OUTPUT = "output_device"; /** Spinner positions that are not a concrete {@link AudioDeviceInfo}. */ @@ -81,10 +82,16 @@ public class MainActivity extends AppCompatActivity { private LevelMeterView levelMeter; private WaveformView waveformView; private AppCompatCheckBox silenceCheckbox; - private AppCompatCheckBox monoCheckbox; - private AppCompatCheckBox compressCheckbox; - private AppCompatCheckBox swapCheckbox; - private AppCompatCheckBox monitorCheckbox; + private RadioGroup formatGroup; + private RadioGroup channelGroup; + private RadioButton formatWav; + private RadioButton formatM4a; + private RadioButton monoButton; + private RadioButton stereoButton; + private ImageButton swapButton; + private LinearLayout deviceSelectorRow; + private LinearLayout inputRow; + private LinearLayout outputRow; private Spinner inputSpinner; private Spinner outputSpinner; private final List<AudioDeviceInfo> inputDevices = new ArrayList<>(); @@ -94,6 +101,10 @@ public class MainActivity extends AppCompatActivity { private LinearLayout recordingsContainer; private TextView emptyText; private int savedInterruptionFilter = -1; + private boolean swapChannels; + /** True while a device list is rebuilt, so selection callbacks are ignored. */ + private boolean populatingInputs; + private boolean populatingOutputs; private WavRecorder recorder; private RecordingStore recordingStore; @@ -118,10 +129,16 @@ public class MainActivity extends AppCompatActivity { levelMeter = findViewById(R.id.levelMeter); waveformView = findViewById(R.id.waveformView); silenceCheckbox = findViewById(R.id.silenceCheckbox); - monoCheckbox = findViewById(R.id.monoCheckbox); - compressCheckbox = findViewById(R.id.compressCheckbox); - swapCheckbox = findViewById(R.id.swapCheckbox); - monitorCheckbox = findViewById(R.id.monitorCheckbox); + formatGroup = findViewById(R.id.formatGroup); + channelGroup = findViewById(R.id.channelGroup); + formatWav = findViewById(R.id.formatWav); + formatM4a = findViewById(R.id.formatM4a); + monoButton = findViewById(R.id.monoButton); + stereoButton = findViewById(R.id.stereoButton); + swapButton = findViewById(R.id.swapButton); + deviceSelectorRow = findViewById(R.id.deviceSelectorRow); + inputRow = findViewById(R.id.inputRow); + outputRow = findViewById(R.id.outputRow); inputSpinner = findViewById(R.id.inputSpinner); outputSpinner = findViewById(R.id.outputSpinner); markButton = findViewById(R.id.markButton); @@ -142,16 +159,16 @@ public class MainActivity extends AppCompatActivity { })); setUpSilence(); - setUpMono(); - setUpCompress(); + setUpFormat(); + setUpChannels(); setUpSwap(); - setUpMonitor(); + configureDeviceSelectorLayout(); populateInputDevices(); populateOutputDevices(); markButton.setOnClickListener(v -> addMarker()); discardButton.setOnClickListener(v -> { if (recording && !busy) { - stopRecording(true); + confirmDiscard(); } }); InsetsHelper.apply(findViewById(R.id.root)); @@ -286,44 +303,77 @@ public class MainActivity extends AppCompatActivity { }); } - private void setUpMono() { + private void setUpFormat() { + SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); + boolean compress = prefs.getBoolean(PREF_COMPRESS, false); + formatM4a.setChecked(compress); + formatWav.setChecked(!compress); + formatGroup.setOnCheckedChangeListener((group, checkedId) -> + getSharedPreferences(PREFS, MODE_PRIVATE) + .edit().putBoolean(PREF_COMPRESS, checkedId == R.id.formatM4a).apply()); + } + + private void setUpChannels() { SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); boolean mono = prefs.getBoolean(PREF_MONO, false); - monoCheckbox.setChecked(mono); + monoButton.setChecked(mono); + stereoButton.setChecked(!mono); recorder.setForceMono(mono); - monoCheckbox.setOnCheckedChangeListener((button, checked) -> { + channelGroup.setOnCheckedChangeListener((group, checkedId) -> { + boolean forceMono = checkedId == R.id.monoButton; getSharedPreferences(PREFS, MODE_PRIVATE) - .edit().putBoolean(PREF_MONO, checked).apply(); - recorder.setForceMono(checked); + .edit().putBoolean(PREF_MONO, forceMono).apply(); + recorder.setForceMono(forceMono); }); } - private void setUpCompress() { - SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); - compressCheckbox.setChecked(prefs.getBoolean(PREF_COMPRESS, false)); - compressCheckbox.setOnCheckedChangeListener((button, checked) -> - getSharedPreferences(PREFS, MODE_PRIVATE) - .edit().putBoolean(PREF_COMPRESS, checked).apply()); + private void setUpSwap() { + swapChannels = getSharedPreferences(PREFS, MODE_PRIVATE) + .getBoolean(PREF_SWAP, false); + applySwapState(); + swapButton.setOnClickListener(v -> { + swapChannels = !swapChannels; + getSharedPreferences(PREFS, MODE_PRIVATE) + .edit().putBoolean(PREF_SWAP, swapChannels).apply(); + applySwapState(); + }); } - private void setUpSwap() { - SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); - swapCheckbox.setChecked(prefs.getBoolean(PREF_SWAP, false)); - swapCheckbox.setOnCheckedChangeListener((button, checked) -> - getSharedPreferences(PREFS, MODE_PRIVATE) - .edit().putBoolean(PREF_SWAP, checked).apply()); + private void applySwapState() { + swapButton.setSelected(swapChannels); + swapButton.setContentDescription(getString(R.string.swap_channels)); } - private void setUpMonitor() { - SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); - monitorCheckbox.setChecked(prefs.getBoolean(PREF_MONITOR, false)); - monitorCheckbox.setOnCheckedChangeListener((button, checked) -> { - getSharedPreferences(PREFS, MODE_PRIVATE) - .edit().putBoolean(PREF_MONITOR, checked).apply(); - if (checked) { - Toast.makeText(this, R.string.monitor_warning, Toast.LENGTH_LONG).show(); - } - }); + /** Phones use one row; tablets keep the two pickers stacked. */ + private void configureDeviceSelectorLayout() { + boolean sideBySide = getResources().getBoolean(R.bool.device_selectors_side_by_side); + LinearLayout.LayoutParams inputParams = + (LinearLayout.LayoutParams) inputRow.getLayoutParams(); + LinearLayout.LayoutParams outputParams = + (LinearLayout.LayoutParams) outputRow.getLayoutParams(); + if (sideBySide) { + deviceSelectorRow.setOrientation(LinearLayout.HORIZONTAL); + inputParams.width = 0; + inputParams.weight = 1f; + outputParams.width = 0; + outputParams.weight = 1f; + outputParams.leftMargin = dp(10); + outputParams.topMargin = 0; + } else { + deviceSelectorRow.setOrientation(LinearLayout.VERTICAL); + inputParams.width = LinearLayout.LayoutParams.MATCH_PARENT; + inputParams.weight = 0f; + outputParams.width = LinearLayout.LayoutParams.MATCH_PARENT; + outputParams.weight = 0f; + outputParams.leftMargin = 0; + outputParams.topMargin = dp(4); + } + inputRow.setLayoutParams(inputParams); + outputRow.setLayoutParams(outputParams); + } + + private int dp(int value) { + return Math.round(value * getResources().getDisplayMetrics().density); } // --- Output source for live monitoring --------------------------------- @@ -332,6 +382,7 @@ public class MainActivity extends AppCompatActivity { int selected = getSharedPreferences(PREFS, MODE_PRIVATE).getInt(PREF_OUTPUT, OUTPUT_AUTO); outputDevices.clear(); List<String> labels = new ArrayList<>(); + labels.add(getString(R.string.output_refresh)); labels.add(getString(R.string.output_auto)); labels.add(getString(R.string.output_speaker)); @@ -351,51 +402,89 @@ public class MainActivity extends AppCompatActivity { } } - ArrayAdapter<String> adapter = new ArrayAdapter<>(this, - android.R.layout.simple_spinner_item, labels); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - outputSpinner.setAdapter(adapter); + populatingOutputs = true; + outputSpinner.setAdapter(new DeviceSpinnerAdapter(this, labels)); + int selection = 1; if (selected == OUTPUT_SPEAKER) { - outputSpinner.setSelection(1); - return; - } - for (int i = 0; i < outputDevices.size(); i++) { - if (outputDevices.get(i).getId() == selected) { - outputSpinner.setSelection(i + 2); - return; + selection = 2; + } else { + for (int i = 0; i < outputDevices.size(); i++) { + if (outputDevices.get(i).getId() == selected) { + selection = i + 3; + break; + } } } - outputSpinner.setSelection(0); + outputSpinner.setSelection(selection); + outputSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { + if (populatingOutputs) { + return; + } + if (position == 0) { + handler.post(MainActivity.this::refreshOutputs); + return; + } + int choice = selectedOutputId(); + int saved = getSharedPreferences(PREFS, MODE_PRIVATE) + .getInt(PREF_OUTPUT, OUTPUT_AUTO); + if (choice == saved) { + // Programmatic restore (or a refresh that kept the same + // device): do not repeat the feedback warning. + return; + } + getSharedPreferences(PREFS, MODE_PRIVATE) + .edit().putInt(PREF_OUTPUT, choice).apply(); + // A concrete output turns live monitoring on for the next + // recording; there is no separate Monitor switch any more. + if (position >= 2) { + Toast.makeText(MainActivity.this, R.string.monitor_warning, + Toast.LENGTH_LONG).show(); + } + } + + @Override + public void onNothingSelected(AdapterView<?> parent) { + // Keep the current selection. + } + }); + handler.post(() -> populatingOutputs = false); + } + + private void refreshOutputs() { + populateOutputDevices(); + Toast.makeText(this, R.string.output_refreshed, Toast.LENGTH_SHORT).show(); } /** Resolves the spinner to a concrete device id, or -1 for the default. */ private int resolveOutputDeviceId() { int position = outputSpinner.getSelectedItemPosition(); - if (position == 1) { + if (position == 2) { return findBuiltinSpeakerId(); } - if (position >= 2 && position - 2 < outputDevices.size()) { - return outputDevices.get(position - 2).getId(); + if (position >= 3 && position - 3 < outputDevices.size()) { + return outputDevices.get(position - 3).getId(); } return OUTPUT_AUTO; } private int selectedOutputId() { int position = outputSpinner.getSelectedItemPosition(); - if (position == 1) { + if (position == 2) { return OUTPUT_SPEAKER; } - if (position >= 2 && position - 2 < outputDevices.size()) { - return outputDevices.get(position - 2).getId(); + if (position >= 3 && position - 3 < outputDevices.size()) { + return outputDevices.get(position - 3).getId(); } return OUTPUT_AUTO; } private boolean selectedOutputIsBluetooth() { int position = outputSpinner.getSelectedItemPosition(); - return position >= 2 && position - 2 < outputDevices.size() - && isBluetoothOutput(outputDevices.get(position - 2)); + return position >= 3 && position - 3 < outputDevices.size() + && isBluetoothOutput(outputDevices.get(position - 3)); } private static boolean isBluetoothOutput(AudioDeviceInfo device) { @@ -481,6 +570,7 @@ public class MainActivity extends AppCompatActivity { int selected = getSharedPreferences(PREFS, MODE_PRIVATE).getInt(PREF_INPUT, INPUT_AUTO); inputDevices.clear(); List<String> labels = new ArrayList<>(); + labels.add(getString(R.string.input_refresh)); labels.add(getString(R.string.input_auto)); labels.add(getString(R.string.input_phone)); @@ -502,31 +592,61 @@ public class MainActivity extends AppCompatActivity { } } - ArrayAdapter<String> adapter = new ArrayAdapter<>(this, - android.R.layout.simple_spinner_item, labels); - adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - inputSpinner.setAdapter(adapter); + populatingInputs = true; + inputSpinner.setAdapter(new DeviceSpinnerAdapter(this, labels)); + int selection = 1; if (selected == INPUT_PHONE) { - inputSpinner.setSelection(1); - return; - } - for (int i = 0; i < inputDevices.size(); i++) { - if (inputDevices.get(i).getId() == selected) { - inputSpinner.setSelection(i + 2); - return; + selection = 2; + } else { + for (int i = 0; i < inputDevices.size(); i++) { + if (inputDevices.get(i).getId() == selected) { + selection = i + 3; + break; + } } } - inputSpinner.setSelection(0); + inputSpinner.setSelection(selection); + inputSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + @Override + public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { + if (populatingInputs) { + return; + } + if (position == 0) { + handler.post(MainActivity.this::refreshInputs); + return; + } + int choice = selectedInputId(); + int saved = getSharedPreferences(PREFS, MODE_PRIVATE) + .getInt(PREF_INPUT, INPUT_AUTO); + if (choice == saved) { + return; + } + getSharedPreferences(PREFS, MODE_PRIVATE) + .edit().putInt(PREF_INPUT, choice).apply(); + } + + @Override + public void onNothingSelected(AdapterView<?> parent) { + // Keep the current selection. + } + }); + handler.post(() -> populatingInputs = false); + } + + private void refreshInputs() { + populateInputDevices(); + Toast.makeText(this, R.string.input_refreshed, Toast.LENGTH_SHORT).show(); } private InputChoice resolveInput() { int position = inputSpinner.getSelectedItemPosition(); - if (position == 1) { + if (position == 2) { return new InputChoice(findBuiltinMicId(), false); } - if (position >= 2 && position - 2 < inputDevices.size()) { - AudioDeviceInfo device = inputDevices.get(position - 2); + if (position >= 3 && position - 3 < inputDevices.size()) { + AudioDeviceInfo device = inputDevices.get(position - 3); return new InputChoice(device.getId(), isBluetoothInput(device)); } return new InputChoice(INPUT_AUTO, false); @@ -534,19 +654,19 @@ public class MainActivity extends AppCompatActivity { private int selectedInputId() { int position = inputSpinner.getSelectedItemPosition(); - if (position == 1) { + if (position == 2) { return INPUT_PHONE; } - if (position >= 2 && position - 2 < inputDevices.size()) { - return inputDevices.get(position - 2).getId(); + if (position >= 3 && position - 3 < inputDevices.size()) { + return inputDevices.get(position - 3).getId(); } return INPUT_AUTO; } private boolean selectedInputIsBluetooth() { int position = inputSpinner.getSelectedItemPosition(); - return position >= 2 && position - 2 < inputDevices.size() - && isBluetoothInput(inputDevices.get(position - 2)); + return position >= 3 && position - 3 < inputDevices.size() + && isBluetoothInput(inputDevices.get(position - 3)); } private int findBuiltinMicId() { @@ -718,9 +838,10 @@ public class MainActivity extends AppCompatActivity { .edit().putInt(PREF_INPUT, selectedInputId()).apply(); recorder.setPreferredDeviceId(input.deviceId); recorder.setBluetoothSco(input.bluetoothSco); - recorder.setSwapChannels(swapCheckbox.isChecked()); - recorder.setForceMono(monoCheckbox.isChecked()); - recorder.setMonitoring(monitorCheckbox.isChecked()); + recorder.setSwapChannels(swapChannels); + recorder.setForceMono(monoButton.isChecked()); + boolean monitoring = selectedOutputId() != OUTPUT_AUTO; + recorder.setMonitoring(monitoring); recorder.setMonitorDeviceId(resolveOutputDeviceId()); getSharedPreferences(PREFS, MODE_PRIVATE) .edit().putInt(PREF_OUTPUT, selectedOutputId()).apply(); @@ -730,7 +851,7 @@ public class MainActivity extends AppCompatActivity { Toast.makeText(this, R.string.err_record, Toast.LENGTH_LONG).show(); return; } - if (monitorCheckbox.isChecked() && !recorder.isMonitoring()) { + if (monitoring && !recorder.isMonitoring()) { Toast.makeText(this, R.string.err_monitor, Toast.LENGTH_LONG).show(); } @@ -762,6 +883,15 @@ public class MainActivity extends AppCompatActivity { handler.post(timerRunnable); } + private void confirmDiscard() { + new AlertDialog.Builder(this) + .setTitle(R.string.discard_confirm_title) + .setMessage(R.string.discard_confirm_message) + .setPositiveButton(R.string.ok, (dialog, which) -> stopRecording(true)) + .setNegativeButton(R.string.cancel, null) + .show(); + } + private void stopRecording(boolean discard) { recording = false; busy = true; @@ -777,12 +907,14 @@ public class MainActivity extends AppCompatActivity { blinkAnimator.cancel(); recIndicator.setVisibility(View.INVISIBLE); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); - timerText.setText(formatDuration(elapsed)); + timerText.setText(discard + ? getString(R.string.timer_zero) + : formatDuration(elapsed)); recordButton.setBackgroundResource(R.drawable.bg_record_idle); recordButton.setContentDescription(getString(R.string.cd_record)); recordButton.setEnabled(false); statusText.setText(discard ? R.string.status_discarding : R.string.status_saving); - final boolean compress = compressCheckbox.isChecked(); + final boolean compress = formatM4a.isChecked(); new Thread(() -> { File wav; @@ -840,6 +972,7 @@ public class MainActivity extends AppCompatActivity { busy = false; recordButton.setEnabled(true); if (wasDiscarded) { + timerText.setText(R.string.timer_zero); statusText.setText(R.string.discarded); Toast.makeText(this, R.string.discarded, Toast.LENGTH_SHORT).show(); } else if (result != null) { @@ -870,7 +1003,8 @@ public class MainActivity extends AppCompatActivity { ContentValues values = new ContentValues(); values.put(MediaStore.MediaColumns.DISPLAY_NAME, fileName); values.put(MediaStore.MediaColumns.MIME_TYPE, mimeType); - values.put(MediaStore.MediaColumns.RELATIVE_PATH, Environment.DIRECTORY_DOWNLOADS); + values.put(MediaStore.MediaColumns.RELATIVE_PATH, + Environment.DIRECTORY_DOWNLOADS + "/" + RecordingStore.SUBDIR); values.put(MediaStore.MediaColumns.IS_PENDING, 1); Uri uri = resolver.insert(MediaStore.Downloads.EXTERNAL_CONTENT_URI, values); @@ -895,9 +1029,11 @@ public class MainActivity extends AppCompatActivity { @SuppressWarnings("deprecation") private void saveToPublicDownloads(File source, String fileName, String mimeType) throws IOException { - File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); + File downloads = Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_DOWNLOADS); + File dir = new File(downloads, RecordingStore.SUBDIR); if (!dir.exists() && !dir.mkdirs()) { - throw new IOException("Could not create the Downloads directory"); + throw new IOException("Could not create the RECCoon directory"); } File outFile = new File(dir, fileName); try (InputStream in = new FileInputStream(source); @@ -912,11 +1048,13 @@ public class MainActivity extends AppCompatActivity { } private String buildFileName(String extension) { - String stamp = new SimpleDateFormat("yyyy-MM-dd-HHmmss", Locale.US).format(new Date()); + String stamp = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss", Locale.US).format(new Date()); SharedPreferences prefs = getSharedPreferences(PREFS, MODE_PRIVATE); int next = prefs.getInt(PREF_COUNTER, 0) + 1; prefs.edit().putInt(PREF_COUNTER, next).apply(); - return String.format(Locale.US, "reccoon-%s-%05d%s", stamp, next, extension); + // The folder (not this name) identifies RECCoon recordings; the prefix is + // only there to keep the files recognisable when shared elsewhere. + return String.format(Locale.US, "RECCoon_%s_%05d%s", stamp, next, extension); } private static void copy(InputStream in, OutputStream out) throws IOException { diff --git a/app/src/main/java/com/tomcooks/reccoon/PlayerActivity.java b/app/src/main/java/com/tomcooks/reccoon/PlayerActivity.java index 6d7d3f4..58647d7 100644 --- a/app/src/main/java/com/tomcooks/reccoon/PlayerActivity.java +++ b/app/src/main/java/com/tomcooks/reccoon/PlayerActivity.java @@ -14,14 +14,12 @@ import android.text.TextPaint; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; import android.view.View; -import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.SeekBar; -import android.widget.Spinner; import android.widget.TextView; import android.widget.Toast; @@ -35,7 +33,7 @@ import java.util.Locale; /** * Plays a saved recording with a scrubber and transcribes it on device with - * sherpa-onnx (multilingual Whisper: English and Italian). + * sherpa-onnx (NVIDIA Parakeet v3, multilingual). */ public class PlayerActivity extends AppCompatActivity { @@ -57,7 +55,7 @@ public class PlayerActivity extends AppCompatActivity { private Button playButton; private Button speedButton; private Button transcribeButton; - private Spinner modelSpinner; + private Button exportButton; private ProgressBar progressBar; private LinearLayout transcriptContainer; private LinearLayout markersSection; @@ -73,6 +71,7 @@ public class PlayerActivity extends AppCompatActivity { private TranscriptStore transcripts; private MarkerStore markerStore; private ModelRepository.Model downloadingModel; + private boolean hasTranscript; private final ModelDownloadService.Listener downloadListener = new ModelDownloadService.Listener() { @@ -101,6 +100,7 @@ public class PlayerActivity extends AppCompatActivity { public void onError(String message) { runOnUiThread(() -> { transcribeButton.setEnabled(true); + exportButton.setEnabled(hasTranscript); progressBar.setVisibility(View.GONE); statusText.setText(getString(R.string.err_download, message)); }); @@ -140,7 +140,7 @@ public class PlayerActivity extends AppCompatActivity { playButton = findViewById(R.id.playButton); speedButton = findViewById(R.id.speedButton); transcribeButton = findViewById(R.id.transcribeButton); - modelSpinner = findViewById(R.id.modelSpinner); + exportButton = findViewById(R.id.exportButton); progressBar = findViewById(R.id.progressBar); transcriptContainer = findViewById(R.id.transcriptContainer); markersSection = findViewById(R.id.markersSection); @@ -148,7 +148,6 @@ public class PlayerActivity extends AppCompatActivity { titleText.setText(Formats.prettyName(recordingName)); - setUpSpinners(); setUpButtons(); setUpPlayer(); @@ -165,18 +164,6 @@ public class PlayerActivity extends AppCompatActivity { handler.post(ticker); } - private void setUpSpinners() { - ModelRepository.Model[] allModels = ModelRepository.Model.values(); - String[] modelLabels = new String[allModels.length]; - for (int i = 0; i < allModels.length; i++) { - modelLabels[i] = allModels[i].label; - } - ArrayAdapter<String> modelAdapter = new ArrayAdapter<>(this, - android.R.layout.simple_spinner_item, modelLabels); - modelAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); - modelSpinner.setAdapter(modelAdapter); - } - private void setUpButtons() { playButton.setOnClickListener(v -> togglePlay()); speedButton.setOnClickListener(v -> cycleSpeed()); @@ -184,7 +171,7 @@ public class PlayerActivity extends AppCompatActivity { findViewById(R.id.forwardButton).setOnClickListener(v -> seekBy(10_000)); findViewById(R.id.shareButton).setOnClickListener(v -> shareRecording()); findViewById(R.id.renameButton).setOnClickListener(v -> showRenameDialog()); - findViewById(R.id.exportButton).setOnClickListener(v -> exportTranscript()); + exportButton.setOnClickListener(v -> exportTranscript()); findViewById(R.id.deleteButton).setOnClickListener(v -> confirmDelete()); transcribeButton.setOnClickListener(v -> onTranscribeClicked()); @@ -416,12 +403,8 @@ public class PlayerActivity extends AppCompatActivity { // --- Transcription ---------------------------------------------------- private void onTranscribeClicked() { - ModelRepository.Model[] allModels = ModelRepository.Model.values(); - int position = modelSpinner.getSelectedItemPosition(); - if (position < 0 || position >= allModels.length) { - position = 0; - } - ModelRepository.Model model = allModels[position]; + // The model picker is hidden while Parakeet v3 is the only model. + ModelRepository.Model model = ModelRepository.Model.values()[0]; if (!models.isReady(model)) { promptDownload(model); @@ -443,6 +426,7 @@ public class PlayerActivity extends AppCompatActivity { private void runDownload(ModelRepository.Model model) { downloadingModel = model; transcribeButton.setEnabled(false); + exportButton.setEnabled(false); progressBar.setVisibility(View.VISIBLE); progressBar.setIndeterminate(false); progressBar.setProgress(0); @@ -456,6 +440,7 @@ public class PlayerActivity extends AppCompatActivity { private void runTranscription(ModelRepository.Model model) { cancelled = false; transcribeButton.setEnabled(false); + exportButton.setEnabled(false); transcriptContainer.removeAllViews(); progressBar.setVisibility(View.VISIBLE); progressBar.setIndeterminate(true); @@ -487,7 +472,9 @@ public class PlayerActivity extends AppCompatActivity { return; } finally { runOnUiThread(() -> { - transcribeButton.setEnabled(true); + if (!hasTranscript) { + transcribeButton.setEnabled(true); + } progressBar.setVisibility(View.GONE); }); } @@ -507,13 +494,23 @@ public class PlayerActivity extends AppCompatActivity { private void showTranscript(TranscriptionEngine.Result result) { transcriptContainer.removeAllViews(); if (result.segments.isEmpty()) { + hasTranscript = false; + transcribeButton.setEnabled(true); + exportButton.setEnabled(false); statusText.setText(R.string.status_no_speech); return; } for (TranscriptionEngine.Segment segment : result.segments) { addTranscriptLine(segment); } - statusText.setText(R.string.status_transcript_saved); + hasTranscript = true; + transcribeButton.setEnabled(false); + exportButton.setEnabled(true); + if (result.savedAt == null || result.savedAt.isEmpty()) { + statusText.setText(R.string.status_transcript_saved); + } else { + statusText.setText(getString(R.string.status_transcript_saved_fmt, result.savedAt)); + } } private void addTranscriptLine(TranscriptionEngine.Segment segment) { diff --git a/app/src/main/java/com/tomcooks/reccoon/RecordingStore.java b/app/src/main/java/com/tomcooks/reccoon/RecordingStore.java index b7a1c84..c28145e 100644 --- a/app/src/main/java/com/tomcooks/reccoon/RecordingStore.java +++ b/app/src/main/java/com/tomcooks/reccoon/RecordingStore.java @@ -13,9 +13,17 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; -/** Lists the WAV files saved by RECCoon in the public Downloads folder. */ +/** + * Lists the recordings saved by RECCoon in {@code Downloads/RECCoon}. + * + * <p>The folder, not the file name, is the source of truth. Files written by + * older versions in the root of Downloads are still listed when they use the + * historical {@code reccoon-*} name, so upgrading does not hide them. + */ public final class RecordingStore { + public static final String SUBDIR = "RECCoon"; + public static final class Recording { public final String name; public final Uri uri; @@ -31,7 +39,7 @@ public final class RecordingStore { } } - private static final String PREFIX = "reccoon-"; + private static final String LEGACY_PREFIX = "reccoon-"; private static final String[] SUFFIXES = {".wav", ".m4a"}; private final Context context; @@ -68,8 +76,9 @@ public final class RecordingStore { MediaStore.MediaColumns.SIZE, MediaStore.MediaColumns.DATE_MODIFIED, }; - StringBuilder selection = new StringBuilder(MediaStore.MediaColumns.DISPLAY_NAME) - .append(" LIKE ? AND ("); + StringBuilder selection = new StringBuilder("(") + .append(MediaStore.MediaColumns.RELATIVE_PATH).append(" LIKE ? OR ") + .append(MediaStore.MediaColumns.DISPLAY_NAME).append(" LIKE ?) AND ("); for (int i = 0; i < SUFFIXES.length; i++) { if (i > 0) { selection.append(" OR "); @@ -77,10 +86,11 @@ public final class RecordingStore { selection.append(MediaStore.MediaColumns.DISPLAY_NAME).append(" LIKE ?"); } selection.append(')'); - String[] args = new String[SUFFIXES.length + 1]; - args[0] = PREFIX + "%"; + String[] args = new String[SUFFIXES.length + 2]; + args[0] = Environment.DIRECTORY_DOWNLOADS + "/" + SUBDIR + "/%"; + args[1] = LEGACY_PREFIX + "%"; for (int i = 0; i < SUFFIXES.length; i++) { - args[i + 1] = "%" + SUFFIXES[i]; + args[i + 2] = "%" + SUFFIXES[i]; } try (Cursor cursor = context.getContentResolver().query( MediaStore.Downloads.EXTERNAL_CONTENT_URI, @@ -111,18 +121,26 @@ public final class RecordingStore { @SuppressWarnings("deprecation") private List<Recording> listFromDirectory() { List<Recording> result = new ArrayList<>(); - File dir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); - File[] files = dir.listFiles((d, name) -> name.startsWith(PREFIX) && hasKnownSuffix(name)); + File downloads = Environment.getExternalStoragePublicDirectory( + Environment.DIRECTORY_DOWNLOADS); + addDirectory(result, new File(downloads, SUBDIR), false); + // Files saved before 1.1.0 lived in the root of Downloads. + addDirectory(result, downloads, true); + return result; + } + + private void addDirectory(List<Recording> target, File dir, boolean legacyOnly) { + File[] files = dir.listFiles((d, name) -> + hasKnownSuffix(name) && (!legacyOnly || name.startsWith(LEGACY_PREFIX))); if (files == null) { - return result; + return; } for (File file : files) { - result.add(new Recording( + target.add(new Recording( file.getName(), Uri.fromFile(file), file.length(), file.lastModified() / 1000L)); } - return result; } } diff --git a/app/src/main/java/com/tomcooks/reccoon/TranscriptStore.java b/app/src/main/java/com/tomcooks/reccoon/TranscriptStore.java index 69d9439..84a0577 100644 --- a/app/src/main/java/com/tomcooks/reccoon/TranscriptStore.java +++ b/app/src/main/java/com/tomcooks/reccoon/TranscriptStore.java @@ -11,6 +11,9 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; /** Stores and loads transcript sidecar files in app-private storage. */ public final class TranscriptStore { @@ -26,10 +29,15 @@ public final class TranscriptStore { } public void save(String recordingName, TranscriptionEngine.Result result) throws IOException { + if (result.savedAt == null || result.savedAt.isEmpty()) { + result.savedAt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US) + .format(new Date()); + } JSONObject root = new JSONObject(); JSONArray segments = new JSONArray(); try { root.put("language", result.language == null ? "" : result.language); + root.put("savedAt", result.savedAt); for (TranscriptionEngine.Segment segment : result.segments) { JSONObject item = new JSONObject(); item.put("start", segment.startSeconds); @@ -83,6 +91,11 @@ public final class TranscriptStore { JSONObject root = new JSONObject(new String(buffer, 0, read, StandardCharsets.UTF_8)); TranscriptionEngine.Result result = new TranscriptionEngine.Result(); result.language = root.optString("language", ""); + result.savedAt = root.optString("savedAt", ""); + if (result.savedAt.isEmpty()) { + result.savedAt = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US) + .format(new Date(file.lastModified())); + } JSONArray segments = root.optJSONArray("segments"); if (segments != null) { for (int i = 0; i < segments.length(); i++) { diff --git a/app/src/main/java/com/tomcooks/reccoon/TranscriptionEngine.java b/app/src/main/java/com/tomcooks/reccoon/TranscriptionEngine.java index 5483cbf..93a3971 100644 --- a/app/src/main/java/com/tomcooks/reccoon/TranscriptionEngine.java +++ b/app/src/main/java/com/tomcooks/reccoon/TranscriptionEngine.java @@ -65,6 +65,8 @@ public final class TranscriptionEngine { public static final class Result { public final List<Segment> segments = new ArrayList<>(); public String language = ""; + /** Local save time, formatted as {@code yyyy-MM-dd'T'HH:mm:ss}. */ + public String savedAt = ""; /** Plain transcript with one segment per paragraph. */ public String asText() { diff --git a/app/src/main/res/color/option_text.xml b/app/src/main/res/color/option_text.xml new file mode 100644 index 0000000..11ac466 --- /dev/null +++ b/app/src/main/res/color/option_text.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_checked="true" android:color="@color/text_primary" /> + <item android:color="@color/text_secondary" /> +</selector> diff --git a/app/src/main/res/drawable/bg_option.xml b/app/src/main/res/drawable/bg_option.xml new file mode 100644 index 0000000..81c76b6 --- /dev/null +++ b/app/src/main/res/drawable/bg_option.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_checked="true"> + <shape android:shape="rectangle"> + <solid android:color="#2AE53935" /> + <corners android:radius="8dp" /> + <stroke + android:width="1dp" + android:color="@color/accent" /> + </shape> + </item> + <item android:state_pressed="true"> + <shape android:shape="rectangle"> + <solid android:color="#1FFFFFFF" /> + <corners android:radius="8dp" /> + </shape> + </item> + <item> + <shape android:shape="rectangle"> + <solid android:color="#0DFFFFFF" /> + <corners android:radius="8dp" /> + </shape> + </item> +</selector> diff --git a/app/src/main/res/drawable/bg_refresh_item.xml b/app/src/main/res/drawable/bg_refresh_item.xml new file mode 100644 index 0000000..f479a5c --- /dev/null +++ b/app/src/main/res/drawable/bg_refresh_item.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> + <item> + <shape android:shape="rectangle"> + <solid android:color="@android:color/transparent" /> + </shape> + </item> + <item + android:height="1dp" + android:gravity="bottom"> + <shape android:shape="rectangle"> + <solid android:color="#55FFFFFF" /> + </shape> + </item> +</layer-list> diff --git a/app/src/main/res/drawable/bg_toggle.xml b/app/src/main/res/drawable/bg_toggle.xml new file mode 100644 index 0000000..f08be92 --- /dev/null +++ b/app/src/main/res/drawable/bg_toggle.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_selected="true"> + <shape android:shape="rectangle"> + <solid android:color="#2AE53935" /> + <corners android:radius="10dp" /> + <stroke + android:width="1dp" + android:color="@color/accent" /> + </shape> + </item> + <item android:state_pressed="true"> + <shape android:shape="rectangle"> + <solid android:color="#1FFFFFFF" /> + <corners android:radius="10dp" /> + </shape> + </item> + <item> + <shape android:shape="rectangle"> + <solid android:color="#0DFFFFFF" /> + <corners android:radius="10dp" /> + </shape> + </item> +</selector> diff --git a/app/src/main/res/drawable/ic_bell_off.xml b/app/src/main/res/drawable/ic_bell_off.xml new file mode 100644 index 0000000..3e3ca8b --- /dev/null +++ b/app/src/main/res/drawable/ic_bell_off.xml @@ -0,0 +1,14 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="16dp" + android:height="16dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="@color/text_secondary"> + <path + android:fillColor="@android:color/white" + android:pathData="M12,22c1.1,0 2,-0.9 2,-2h-4c0,1.1 0.9,2 2,2zM18,16v-5c0,-3.07 -1.63,-5.64 -4.5,-6.32V4c0,-0.83 -0.67,-1.5 -1.5,-1.5s-1.5,0.67 -1.5,1.5v0.68C7.64,5.36 6,7.92 6,11v5l-2,2v1h16v-1l-2,-2z" /> + <path + android:strokeColor="@android:color/white" + android:strokeWidth="2.4" + android:pathData="M4.2,3.2L20.8,20.8" /> +</vector> diff --git a/app/src/main/res/drawable/ic_mic.xml b/app/src/main/res/drawable/ic_mic.xml new file mode 100644 index 0000000..94bb721 --- /dev/null +++ b/app/src/main/res/drawable/ic_mic.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="16dp" + android:height="16dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="@color/text_secondary"> + <path + android:fillColor="@android:color/white" + android:pathData="M12,14c1.66,0 3,-1.34 3,-3V5c0,-1.66 -1.34,-3 -3,-3S9,3.34 9,5v6c0,1.66 1.34,3 3,3zM17,11c0,2.76 -2.24,5 -5,5s-5,-2.24 -5,-5H5c0,3.53 2.61,6.43 6,6.92V21h2v-3.08c3.39,-0.49 6,-3.39 6,-6.92h-2z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_refresh.xml b/app/src/main/res/drawable/ic_refresh.xml new file mode 100644 index 0000000..fe87a2b --- /dev/null +++ b/app/src/main/res/drawable/ic_refresh.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="18dp" + android:height="18dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="@color/text_secondary"> + <path + android:fillColor="@android:color/white" + android:pathData="M17.65,6.35C16.2,4.9 14.21,4 12,4c-4.42,0 -7.99,3.58 -7.99,8s3.57,8 7.99,8c3.73,0 6.84,-2.55 7.73,-6h-2.08c-0.82,2.33 -3.04,4 -5.65,4 -3.31,0 -6,-2.69 -6,-6s2.69,-6 6,-6c1.66,0 3.14,0.69 4.22,1.78L13,11h7V4l-2.35,2.35z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_speaker.xml b/app/src/main/res/drawable/ic_speaker.xml new file mode 100644 index 0000000..2c665c5 --- /dev/null +++ b/app/src/main/res/drawable/ic_speaker.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="16dp" + android:height="16dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="@color/text_secondary"> + <path + android:fillColor="@android:color/white" + android:pathData="M3,9v6h4l5,5V4L7,9H3zM16.5,12c0,-1.77 -1.02,-3.29 -2.5,-4.03v8.05c1.48,-0.73 2.5,-2.25 2.5,-4.02zM14,3.23v2.06c2.89,0.86 5,3.54 5,6.71s-2.11,5.85 -5,6.71v2.06c4.01,-0.91 7,-4.49 7,-8.77s-2.99,-7.86 -7,-8.77z" /> +</vector> diff --git a/app/src/main/res/drawable/ic_swap.xml b/app/src/main/res/drawable/ic_swap.xml new file mode 100644 index 0000000..948f460 --- /dev/null +++ b/app/src/main/res/drawable/ic_swap.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="@color/text_primary"> + <path + android:fillColor="@android:color/white" + android:pathData="M16,17.01V10h-2v7.01h-3L15,21l4,-3.99h-3zM9,3L5,6.99h3V14h2V6.99h3L9,3z" /> +</vector> diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 2f3a1ac..c713d95 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -65,93 +65,58 @@ android:scaleType="centerInside" android:src="@android:color/transparent" /> - <androidx.appcompat.widget.AppCompatCheckBox - android:id="@+id/compressCheckbox" - android:layout_width="wrap_content" + <TextView + android:id="@+id/statusText" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="4dp" - android:contentDescription="@string/compress_recording" - android:text="@string/compress_short" + android:layout_marginTop="6dp" + android:gravity="center" + android:text="@string/status_idle" android:textColor="@color/text_secondary" - android:textSize="13sp" /> - - <LinearLayout - android:id="@+id/inputRow" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="4dp" - android:gravity="center_vertical" - android:orientation="horizontal"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/input_label" - android:textColor="@color/text_secondary" - android:textSize="13sp" /> + android:textSize="14sp" /> - <Spinner - android:id="@+id/inputSpinner" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginStart="8dp" - android:minWidth="180dp" /> - </LinearLayout> + <com.tomcooks.reccoon.WaveformView + android:id="@+id/waveformView" + android:layout_width="match_parent" + android:layout_height="64dp" + android:layout_marginTop="8dp" /> <LinearLayout - android:id="@+id/outputRow" - android:layout_width="wrap_content" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="4dp" + android:layout_marginTop="8dp" android:gravity="center_vertical" android:orientation="horizontal"> - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/output_label" - android:textColor="@color/text_secondary" - android:textSize="13sp" /> + <com.tomcooks.reccoon.LevelMeterView + android:id="@+id/levelMeter" + android:layout_width="0dp" + android:layout_height="44dp" + android:layout_weight="1" /> - <Spinner - android:id="@+id/outputSpinner" - android:layout_width="wrap_content" - android:layout_height="wrap_content" + <ImageButton + android:id="@+id/swapButton" + android:layout_width="44dp" + android:layout_height="44dp" android:layout_marginStart="8dp" - android:minWidth="180dp" /> + android:background="@drawable/bg_toggle" + android:contentDescription="@string/swap_channels" + android:padding="10dp" + android:scaleType="centerInside" + android:src="@drawable/ic_swap" /> </LinearLayout> - <androidx.appcompat.widget.AppCompatCheckBox - android:id="@+id/monitorCheckbox" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="2dp" - android:contentDescription="@string/monitor_recording" - android:text="@string/monitor_short" - android:textColor="@color/text_secondary" - android:textSize="13sp" /> - - <com.tomcooks.reccoon.WaveformView - android:id="@+id/waveformView" - android:layout_width="match_parent" - android:layout_height="64dp" - android:layout_marginTop="16dp" /> - - <com.tomcooks.reccoon.LevelMeterView - android:id="@+id/levelMeter" + <View android:layout_width="match_parent" - android:layout_height="38dp" - android:layout_marginTop="10dp" /> + android:layout_height="1dp" + android:layout_marginTop="14dp" + android:background="@color/divider" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" - android:layout_marginTop="6dp" + android:layout_marginTop="10dp" android:gravity="center" android:orientation="horizontal"> @@ -173,55 +138,176 @@ android:text="@string/discard_action" /> </LinearLayout> + <View + android:layout_width="match_parent" + android:layout_height="1dp" + android:layout_marginTop="14dp" + android:background="@color/divider" /> + <LinearLayout - android:id="@+id/optionsRow" - android:layout_width="wrap_content" + android:id="@+id/deviceSelectorRow" + android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="2dp" - android:gravity="center" + android:layout_marginTop="10dp" + android:gravity="center_vertical" android:orientation="horizontal"> - <androidx.appcompat.widget.AppCompatCheckBox - android:id="@+id/monoCheckbox" - android:layout_width="wrap_content" + <LinearLayout + android:id="@+id/inputRow" + android:layout_width="0dp" android:layout_height="wrap_content" - android:contentDescription="@string/mono_recording" - android:text="@string/mono_short" - android:textColor="@color/text_secondary" - android:textSize="13sp" /> + android:layout_weight="1" + android:orientation="vertical"> - <androidx.appcompat.widget.AppCompatCheckBox - android:id="@+id/silenceCheckbox" - android:layout_width="wrap_content" + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <ImageView + android:layout_width="16dp" + android:layout_height="16dp" + android:contentDescription="@null" + android:src="@drawable/ic_mic" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="4dp" + android:text="@string/input_label" + android:textColor="@color/text_secondary" + android:textSize="12sp" + android:textStyle="bold" /> + </LinearLayout> + + <Spinner + android:id="@+id/inputSpinner" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="2dp" + android:minWidth="0dp" /> + </LinearLayout> + + <LinearLayout + android:id="@+id/outputRow" + android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginStart="10dp" - android:contentDescription="@string/silence_recording" - android:text="@string/silence_short" - android:textColor="@color/text_secondary" - android:textSize="13sp" /> - </LinearLayout> + android:layout_weight="1" + android:orientation="vertical"> - <androidx.appcompat.widget.AppCompatCheckBox - android:id="@+id/swapCheckbox" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_gravity="center_horizontal" - android:layout_marginTop="2dp" - android:contentDescription="@string/swap_channels" - android:text="@string/swap_short" - android:textColor="@color/text_secondary" - android:textSize="13sp" /> + <LinearLayout + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:gravity="center_vertical" + android:orientation="horizontal"> - <TextView - android:id="@+id/statusText" + <ImageView + android:layout_width="16dp" + android:layout_height="16dp" + android:contentDescription="@null" + android:src="@drawable/ic_speaker" /> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="4dp" + android:text="@string/output_label" + android:textColor="@color/text_secondary" + android:textSize="12sp" + android:textStyle="bold" /> + </LinearLayout> + + <Spinner + android:id="@+id/outputSpinner" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="2dp" + android:minWidth="0dp" /> + </LinearLayout> + </LinearLayout> + + <LinearLayout + android:id="@+id/optionsRow" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_marginTop="6dp" - android:gravity="center" - android:text="@string/status_idle" - android:textColor="@color/text_secondary" - android:textSize="14sp" /> + android:layout_marginTop="10dp" + android:gravity="center_vertical" + android:orientation="horizontal"> + + <RadioGroup + android:id="@+id/formatGroup" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="2" + android:orientation="horizontal"> + + <RadioButton + android:id="@+id/formatWav" + style="@style/OptionChip" + android:layout_width="0dp" + android:layout_weight="1" + android:contentDescription="@string/format_wav_description" + android:text="@string/format_wav" /> + + <RadioButton + android:id="@+id/formatM4a" + style="@style/OptionChip" + android:layout_width="0dp" + android:layout_marginStart="2dp" + android:layout_weight="1" + android:contentDescription="@string/format_m4a_description" + android:text="@string/format_m4a" /> + </RadioGroup> + + <Space + android:layout_width="12dp" + android:layout_height="1dp" /> + + <androidx.appcompat.widget.AppCompatCheckBox + android:id="@+id/silenceCheckbox" + style="@style/OptionChip" + android:layout_width="0dp" + android:layout_height="44dp" + android:layout_weight="1" + android:contentDescription="@string/silence_recording" + android:drawableStart="@drawable/ic_bell_off" + android:gravity="center" + android:maxLines="2" + android:text="@string/silence_short" /> + + <Space + android:layout_width="12dp" + android:layout_height="1dp" /> + + <RadioGroup + android:id="@+id/channelGroup" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="2" + android:orientation="horizontal"> + + <RadioButton + android:id="@+id/monoButton" + style="@style/OptionChip" + android:layout_width="0dp" + android:layout_weight="1" + android:contentDescription="@string/mono_recording" + android:drawableStart="@drawable/ic_mic" + android:text="@string/mono_short" /> + + <RadioButton + android:id="@+id/stereoButton" + style="@style/OptionChip" + android:layout_width="0dp" + android:layout_marginStart="2dp" + android:layout_weight="1" + android:contentDescription="@string/stereo_recording" + android:drawableStart="@drawable/ic_mic" + android:text="@string/stereo_short" /> + </RadioGroup> + </LinearLayout> <View android:layout_width="match_parent" diff --git a/app/src/main/res/layout/activity_player.xml b/app/src/main/res/layout/activity_player.xml index 2bb2f54..5a9013a 100644 --- a/app/src/main/res/layout/activity_player.xml +++ b/app/src/main/res/layout/activity_player.xml @@ -98,14 +98,6 @@ android:text="@string/action_rename" /> <Button - android:id="@+id/exportButton" - style="?android:attr/buttonBarButtonStyle" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/action_export" /> - - <Button android:id="@+id/deleteButton" style="?android:attr/buttonBarButtonStyle" android:layout_width="0dp" @@ -159,18 +151,29 @@ android:textSize="18sp" android:textStyle="bold" /> - <Spinner - android:id="@+id/modelSpinner" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" /> - - <Button - android:id="@+id/transcribeButton" + <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" - android:text="@string/transcribe_action" /> + android:orientation="horizontal"> + + <Button + android:id="@+id/transcribeButton" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/transcribe_action" /> + + <Button + android:id="@+id/exportButton" + android:layout_width="0dp" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:layout_weight="1" + android:enabled="false" + android:text="@string/action_export" + android:textSize="12sp" /> + </LinearLayout> <ProgressBar android:id="@+id/progressBar" diff --git a/app/src/main/res/layout/item_spinner_refresh.xml b/app/src/main/res/layout/item_spinner_refresh.xml new file mode 100644 index 0000000..3cfddc6 --- /dev/null +++ b/app/src/main/res/layout/item_spinner_refresh.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:background="@drawable/bg_refresh_item" + android:gravity="center_vertical" + android:minHeight="44dp" + android:orientation="horizontal" + android:paddingLeft="12dp" + android:paddingTop="10dp" + android:paddingRight="12dp" + android:paddingBottom="10dp"> + + <ImageView + android:layout_width="18dp" + android:layout_height="18dp" + android:contentDescription="@null" + android:src="@drawable/ic_refresh" /> + + <TextView + android:id="@+id/refreshText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginStart="8dp" + android:textColor="@color/text_secondary" + android:textSize="13sp" /> +</LinearLayout> diff --git a/app/src/main/res/values-sw600dp/bools.xml b/app/src/main/res/values-sw600dp/bools.xml new file mode 100644 index 0000000..94b0f65 --- /dev/null +++ b/app/src/main/res/values-sw600dp/bools.xml @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <bool name="device_selectors_side_by_side">false</bool> +</resources> diff --git a/app/src/main/res/values/bools.xml b/app/src/main/res/values/bools.xml new file mode 100644 index 0000000..9fc67cb --- /dev/null +++ b/app/src/main/res/values/bools.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="utf-8"?> +<resources> + <!-- Phones put the MIC and SPK pickers on one row; tablets stack them. --> + <bool name="device_selectors_side_by_side">true</bool> +</resources> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 648210b..0059492 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,16 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> <resources> <string name="app_name">RECCoon</string> - <string name="subtitle">by Tom Cooks · v1.0.0</string> + <string name="subtitle">by Tom Cooks · v1.1.2</string> <string name="timer_zero">00:00</string> - <string name="footer">44.1 kHz · 16-bit · PCM (WAV) · cue markers</string> + <string name="footer">44.1 kHz · 16-bit · WAV or AAC (M4A) · cue markers</string> <string name="status_idle">Tap the button to start recording</string> <string name="status_recording">Recording… tap again to stop and save</string> - <string name="status_saving">Saving to Downloads…</string> + <string name="status_saving">Saving to Downloads/RECCoon…</string> <string name="status_discarding">Discarding…</string> <string name="discarded">Recording discarded</string> <string name="discard_action">Discard</string> + <string name="discard_confirm_title">Discard recording?</string> + <string name="discard_confirm_message">Do you really want to discard the current recording?</string> + <string name="ok">OK</string> <string name="cd_record">Start recording</string> <string name="cd_stop">Stop and save</string> @@ -23,24 +26,29 @@ <string name="marker_added_fmt">Marker %1$d added</string> <string name="markers_title">Markers</string> - <string name="mono_short">Mono</string> + <string name="mono_short">MONO</string> + <string name="stereo_short">STEREO</string> <string name="mono_recording">Record in mono (half file size)</string> - <string name="compress_short">Compressed (small M4A)</string> - <string name="compress_recording">Save a compressed M4A instead of a WAV (much smaller, lossy)</string> - <string name="input_label">Mic</string> + <string name="stereo_recording">Record in stereo (separate left and right channels)</string> + <string name="format_wav">WAV</string> + <string name="format_m4a">M4A</string> + <string name="format_wav_description">Save an uncompressed WAV file</string> + <string name="format_m4a_description">Save a compressed, much smaller M4A file</string> + <string name="input_label">MIC</string> <string name="input_auto">Auto (Android picks)</string> <string name="input_phone">Phone mic (built-in)</string> + <string name="input_refresh">Refresh inputs</string> + <string name="input_refreshed">Inputs refreshed</string> <string name="silence_short">Silence alerts</string> <string name="silence_recording">Silence notifications & vibrations while recording</string> - <string name="swap_short">Swap L/R</string> <string name="swap_channels">Swap the left and right channels (use this if the meters are inverted)</string> - <string name="monitor_short">Monitor</string> - <string name="monitor_recording">Play the microphone through the selected output while recording</string> <string name="monitor_warning">Monitoring live audio can cause feedback — use headphones.</string> <string name="err_monitor">Could not start live monitoring</string> - <string name="output_label">Out</string> + <string name="output_label">SPK</string> <string name="output_auto">Auto (system default)</string> <string name="output_speaker">Phone speaker</string> + <string name="output_refresh">Refresh outputs</string> + <string name="output_refreshed">Outputs refreshed</string> <string name="dnd_title">Allow Do Not Disturb</string> <string name="dnd_message">To silence notifications and vibrations while recording, allow RECCoon access to Do Not Disturb.</string> <string name="dnd_open_settings">Open settings</string> @@ -53,7 +61,7 @@ <string name="library">Recordings</string> <string name="action_share">Share</string> <string name="action_rename">Rename</string> - <string name="action_export">Export</string> + <string name="action_export">Export .txt/.srt</string> <string name="action_delete">Delete</string> <string name="delete_title">Delete recording?</string> <string name="delete_message">Delete %1$s? This cannot be undone.</string> @@ -69,7 +77,7 @@ <string name="model_download_channel">Model download</string> <string name="notification_recording">Recording audio…</string> <string name="recordings_title">Recordings</string> - <string name="recordings_subtitle">Saved in Downloads · reccoon-*.wav / *.m4a</string> + <string name="recordings_subtitle">Saved in Downloads/RECCoon</string> <string name="recordings_empty">No recordings yet.\nTap the record button to make one.</string> <string name="badge_transcript">TXT</string> @@ -92,6 +100,7 @@ <string name="status_transcribing">Transcribing…</string> <string name="status_no_speech">No speech was recognized</string> <string name="status_transcript_saved">Transcript saved</string> + <string name="status_transcript_saved_fmt">Transcript saved %1$s</string> <string name="err_download">Download failed: %1$s</string> <string name="err_transcribe">Transcription failed: %1$s</string> <string name="err_playback">Could not play this file</string> diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index 1cc7d6d..bbcdbd8 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -10,4 +10,26 @@ <item name="colorPrimaryDark">@color/background</item> <item name="colorAccent">@color/accent</item> </style> + + <!-- Compact segmented-control look for the WAV/M4A, MONO/STEREO and + Silence alerts radios/checkbox. The radio circle is hidden and the + checked state is shown by the chip background and text colour. --> + <style name="OptionChip"> + <item name="android:layout_width">wrap_content</item> + <item name="android:layout_height">44dp</item> + <item name="android:button">@null</item> + <item name="android:background">@drawable/bg_option</item> + <item name="android:textColor">@color/option_text</item> + <item name="android:textSize">9sp</item> + <item name="android:minWidth">0dp</item> + <item name="android:minHeight">0dp</item> + <item name="android:paddingLeft">5dp</item> + <item name="android:paddingRight">5dp</item> + <item name="android:paddingTop">4dp</item> + <item name="android:paddingBottom">4dp</item> + <item name="android:drawablePadding">2dp</item> + <item name="android:includeFontPadding">false</item> + <item name="android:gravity">center</item> + <item name="android:maxLines">2</item> + </style> </resources> diff --git a/app/src/test/java/com/tomcooks/reccoon/FormatsTest.java b/app/src/test/java/com/tomcooks/reccoon/FormatsTest.java index 96427a1..a37ea1f 100644 --- a/app/src/test/java/com/tomcooks/reccoon/FormatsTest.java +++ b/app/src/test/java/com/tomcooks/reccoon/FormatsTest.java @@ -17,4 +17,10 @@ public class FormatsTest { assertEquals("2026-10-05 09:30:00 #00012", Formats.prettyName("reccoon-2026-10-05-093000-00012.m4a")); } + + @Test + public void prettyNameReadsNewRecordingNames() { + assertEquals("2026-11-02 12:39:00 #00001", + Formats.prettyName("RECCoon_2026-11-02_12-39-00_00001.wav")); + } } diff --git a/fastlane/metadata/android/en-US/changelogs/2.txt b/fastlane/metadata/android/en-US/changelogs/2.txt new file mode 100644 index 0000000..b52473d --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/2.txt @@ -0,0 +1,8 @@ +Version 1.1.0 + +- MIC and SPK pickers: refresh entries, compact side-by-side layout on phones. +- Waveform and L/R meters moved under the record button; Swap L/R is an icon button. +- WAV/M4A and MONO/STEREO segmented radios; Silence alerts has a barred-bell icon. +- Discard now asks for confirmation and resets the timer. +- Recordings are stored in Downloads/RECCoon. +- Player: Export next to Transcribe, model picker hidden, transcript save timestamp. diff --git a/fastlane/metadata/android/en-US/changelogs/3.txt b/fastlane/metadata/android/en-US/changelogs/3.txt new file mode 100644 index 0000000..6571250 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/3.txt @@ -0,0 +1,7 @@ +Version 1.1.1 + +- Removed the redundant Monitor switch; a concrete SPK output enables monitoring. +- MIC / SPK labels sit above their selectors for more room. +- Harmonised WAV/M4A, MONO/STEREO and Silence alerts chips with padding. +- Swap L/R now uses up/down arrows. +- Mark/Discard moved under the meters, with hairlines separating the sections. diff --git a/fastlane/metadata/android/en-US/changelogs/4.txt b/fastlane/metadata/android/en-US/changelogs/4.txt new file mode 100644 index 0000000..03f3f44 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/4.txt @@ -0,0 +1,4 @@ +Version 1.1.2 + +- Silence alerts is centred between WAV/M4A and MONO/STEREO, with wider gaps. +- The recording status text now sits directly under the record button. diff --git a/fastlane/metadata/android/en-US/full_description.txt b/fastlane/metadata/android/en-US/full_description.txt index 18d1fa3..6363488 100644 --- a/fastlane/metadata/android/en-US/full_description.txt +++ b/fastlane/metadata/android/en-US/full_description.txt @@ -1,18 +1,20 @@ RECCoon is a minimal, private audio recorder that transcribes on the device. -Record in uncompressed WAV, or flip one switch to save small AAC (.m4a) files. +Record in uncompressed WAV, or switch to small AAC (.m4a) files. Everything stays on your phone: there is no account, no analytics and no upload. Features: * One big record button: tap to start, tap to stop and save. * Live waveform and left/right peak meters with a clip indicator. -* Mono switch and a Swap L/R option for devices whose stereo channels are reversed. -* Mic picker: auto, built-in, wired, USB or Bluetooth SCO. +* MONO/STEREO radios and a Swap L/R icon button for devices whose channels are reversed. +* MIC and SPK pickers: auto, built-in, wired, USB or Bluetooth, with a refresh entry. +* WAV/M4A, MONO/STEREO and Silence alerts fit on one compact line. * Live monitoring: hear the microphone through the output you choose (headphones recommended). * Markers: add labelled cue points while recording; they are embedded in the WAV and shown in the player. -* Discard button to throw away a bad take without saving. +* Discard button (with confirmation) to throw away a bad take without saving. * Recordings list and a player with scrubber, +-10 s jumps, speed control and per-word tap-to-seek. -* Export transcripts as .txt or .srt, or share/rename/delete recordings. +* Export transcripts as .txt or .srt next to Transcribe, or share/rename/delete recordings. +* Recordings are stored in Downloads/RECCoon. Transcription uses NVIDIA Parakeet v3 (multilingual) through sherpa-onnx and runs fully offline. The model is about 670 MB and is downloaded once, on first diff --git a/releases/RECCoon-1.1.2.apk b/releases/RECCoon-1.1.2.apk Binary files differnew file mode 100644 index 0000000..14b5870 --- /dev/null +++ b/releases/RECCoon-1.1.2.apk |
