Skip to content

Commit 6b8d018

Browse files
Merge pull request #11 from bitcoin3us/docs/input-activity-selected-callback
Document InputActivity's optional selected_callback
2 parents 31bef33 + 854af01 commit 6b8d018

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

‎docs/frameworks/input-activity.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ The `setting` dict has the same shape as the one used by `SettingActivity` and `
5959
- **`min`** (int): Minimum value for `"slider"` (default: `0`)
6060
- **`max`** (int): Maximum value for `"slider"` (default: `100`)
6161
- **`allow_deselect`** (bool): For `radiobuttons`, allow the user to un-select the active option (default: `False`)
62+
- **`selected_callback`** (callable): For `radiobuttons` and `dropdown`, called as `selected_callback(value)` every time the user picks an option (including re-tapping the already-selected radio), **before** Save. Use it to preview a choice live, e.g. play the sound the user just tapped. Independent of `changed_callback`, which still fires only after Save when the stored value changed. Exceptions inside it are logged and swallowed. (default: `None`)
6263

6364
## Result Contract
6465

‎docs/frameworks/setting-activity.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Each setting is defined as a dictionary with the following properties:
4040
### Optional Properties
4141
- **`ui`** (string): UI type to use for editing. Options: `"textarea"` (default), `"radiobuttons"`, `"dropdown"`, `"slider"`, `"activity"`
4242
- **`ui_options`** (list): Options for `radiobuttons` and `dropdown` UI types. Each entry is a `(label, value)` tuple — the **label** appears on the radio button or dropdown row AND in the parent `SettingsActivity`'s value-label row beneath the title. The **value** is what gets stored in SharedPreferences. See [SettingsActivity → Display Labels for `ui_options`](settings-activity.md#display-labels-for-ui_options) for details.
43+
- **`selected_callback`** (callable): Optional live-selection hook for `radiobuttons`/`dropdown`: `selected_callback(value)` fires on every pick before Save (so a picker can preview, e.g. play a sound), while `changed_callback` fires after Save. See [InputActivity](input-activity.md).
4344
- **`placeholder`** (string): Placeholder text for textarea input
4445
- **`default_value`** (string): Default value to select or fill in
4546
- **`changed_callback`** (function): Callback function called when the setting value changes

0 commit comments

Comments
 (0)