Improve scrolling, sounds, and settings links

This commit is contained in:
waozi authored and Waozi committed 2026-07-11 18:49:15 -03:00
1 parent 1badb0387c
commit 3c3f4cd063
6 files changed
+254 -39

No files matched your search

+9
View File
@@ -1,5 +1,14 @@
# Changelog
## [1.0.2] - 2026-05-26
### Fixed
- Fixed "Starting in" countdown text positioning (now displays above circle)
- Fixed first round to always use 3-second countdown regardless of settings
- Fixed slider knob vertical centering (DPI scaling issue)
- Fixed slider touch hit area scaling for better mobile interaction
- Fixed speed meter position in tutorial (removed double DPI scaling)
- Fixed results screen DPI scaling for consistent appearance
## [1.0.1] - 2026-05-26
### Fixed
- Fixed WebAssembly local storage persistence
+39
View File
@@ -350,6 +350,7 @@ dist:
$(MAKE) windows
$(MAKE) web
$(MAKE) android-$(ANDROID_DIST)
$(MAKE) android-bundle
$(MAKE) dist-linux
$(MAKE) dist-windows
@@ -460,6 +461,42 @@ android-release:
exit 1; \
fi
android-bundle:
$(MAKE) android-copy-assets
@if [ -n "$(PASSWORD)" ]; then \
PASSWORD_VALUE="$(PASSWORD)"; \
elif [ -t 0 ]; then \
printf "Keystore password: "; \
stty -echo; \
read PASSWORD_VALUE; \
stty echo; \
printf "\n"; \
else \
echo "Keystore password is required. Run from a terminal or use PASSWORD=your-password."; \
exit 1; \
fi; \
if [ -n "$$PASSWORD_VALUE" ]; then \
$(GRADLE) -p $(ANDROID_DIR) bundleRelease -Pkeystore.password="$$PASSWORD_VALUE" || exit $$?; \
$(MAKE) android-copy-bundle; \
else \
echo "Keystore password is required"; \
exit 1; \
fi
android-copy-bundle: | $(ANDROID_BUILD_DIR)
@VERSION=$$(grep -m1 '^## \[' CHANGELOG.md | sed 's/^## \[\([^]]*\)\].*/\1/'); \
BUNDLE=$$(find $(ANDROID_DIR)/app/build/outputs/bundle/release -name "*.aab" 2>/dev/null | head -1); \
if [ -n "$$BUNDLE" ] && [ -f "$$BUNDLE" ]; then \
VERSIONED_BUNDLE="$(ANDROID_BUILD_DIR)/inbe-$$VERSION.aab"; \
echo "Copying and renaming $$BUNDLE to $$VERSIONED_BUNDLE"; \
cp "$$BUNDLE" "$$VERSIONED_BUNDLE"; \
ln -sf "$$(basename "$$VERSIONED_BUNDLE")" "$(ANDROID_BUILD_DIR)/inbe-latest.aab"; \
echo "Created symlink: inbe-latest.aab → $$(basename "$$VERSIONED_BUNDLE")"; \
else \
echo "Bundle not found in $(ANDROID_DIR)/app/build/outputs/bundle/release/"; \
exit 1; \
fi
android-copy-apks: android-copy-debug-apks android-copy-release-apks
android-copy-debug-apks: | $(ANDROID_BUILD_DIR)
@@ -538,10 +575,12 @@ FORCE:
android-init-signing \
android-debug \
android-release \
android-bundle \
android-copy-assets \
android-copy-apks \
android-copy-debug-apks \
android-copy-release-apks \
android-copy-bundle \
android-install \
android-install-release \
android-clean \
+2 -2
View File
@@ -29,8 +29,8 @@ android {
defaultConfig {
minSdk 19
targetSdk 35
versionCode 1
versionName "1.0.0"
versionCode 3
versionName "1.0.2"
}
+134 -37
View File
@@ -640,6 +640,9 @@ start_session(InbeApp *app)
inbeinit(&app->inbe);
apply_settings(&app->inbe, speed, max_rounds, max_breaths, pause_seconds);
/* Save user's pause preference and use 3 seconds for first round */
app->saved_pause_seconds = app->inbe.pause_seconds;
app->inbe.pause_seconds = 3;
update_circle_bounds_for_view(&app->inbe, 0, ui_clamp_px(TAB_BAR_H, 44, 56) + 80);
app->inbe.screen = InbeScreenSession;
app->session_paused = 0;
@@ -668,6 +671,10 @@ finish_round(InbeApp *app)
if(app->inbe.round < app->inbe.max_rounds - 1) {
app->inbe.round++;
/* Restore user's pause preference after round 0 */
if(app->inbe.round == 1) {
app->inbe.pause_seconds = app->saved_pause_seconds;
}
reset_round_start(&app->inbe);
} else {
save_session_results(app);
@@ -1026,16 +1033,6 @@ history_set_selected_record(InbeApp *app, const HistoryEntry *entry)
entry->hour, entry->minute, entry->second);
}
static void
history_set_selection(InbeApp *app, const HistoryEntry *entry, int level)
{
app->history_year = entry->year;
app->history_month = entry->month;
app->history_day = entry->day;
app->history_level = level;
history_set_selected_record(app, entry);
}
static void
history_clear_record_selection(InbeApp *app)
{
@@ -1124,6 +1121,59 @@ draw_history_row(InbeApp *app, int x, int y, int w, int h, const char *text, int
return hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT);
}
static int
draw_history_session_row(InbeApp *app, int x, int y, int w, int h, const char *text, int selected)
{
Vector2 mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera);
int mx = (int)mouse_world.x;
int my = (int)mouse_world.y;
int hover = 0;
int icon_size = ui_clamp_px(16, 14, 18);
int font = ui_clamp_px(14, 12, 16);
(void)font; /* Currently unused but may be needed for future */
if(mx > x && mx < x + w && my > y && my < y + h) {
DrawRectangle(x, y, w, h, selected ? c_button_hover : darken(c_button_hover, 6));
draw_bevel(x, y, w, h, darken(c_button_hover, 40), lighten(c_button_hover, 40));
hover = 1;
app->cursor_clickable = 1;
if(IsMouseButtonDown(MOUSE_BUTTON_LEFT)) {
draw_bevel(x, y, w, h, lighten(c_button_hover, 40), darken(c_button_hover, 40));
}
} else {
DrawRectangle(x, y, w, h, selected ? c_button : darken(c_bg, 6));
draw_bevel(x, y, w, h, lighten(c_button, 28), darken(c_button, 20));
}
/* Draw text */
DrawText(text, x + ui_px(46), y + ui_px(6), font, c_text);
/* Draw trash icon on the right */
if(app->trash_icon.id != 0) {
int trash_hover = 0;
int trash_x = x + w - icon_size - ui_px(8);
int trash_y = y + (h - icon_size) / 2;
Rectangle src = {0, 0, app->trash_icon.width, app->trash_icon.height};
Rectangle dst = {trash_x, trash_y, (float)icon_size, (float)icon_size};
/* Check if trash icon is hovered */
if(mx > trash_x && mx < trash_x + icon_size && my > trash_y && my < trash_y + icon_size) {
(void)trash_hover; /* Mark as intentionally unused for future hover effects */
app->cursor_clickable = 1;
DrawTexturePro(app->trash_icon, src, dst, (Vector2){0}, 0, darken(c_icon, 30));
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
return 2; /* Return 2 to indicate trash clicked */
} else {
DrawTexturePro(app->trash_icon, src, dst, (Vector2){0}, 0, c_icon);
}
}
if(hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
return 1; /* Return 1 to indicate row clicked */
return 0;
}
static int
history_count_year_rows(const HistoryEntry *entries, int count)
{
@@ -1231,8 +1281,8 @@ history_format_session_label(const HistoryEntry *entry, char *out, int out_size)
if(out == NULL || out_size <= 0)
return;
snprintf(out, (size_t)out_size, "%02d:%02d:%02d avg %ds",
entry->hour, entry->minute, entry->second, entry->avg_seconds);
snprintf(out, (size_t)out_size, "%02d:%02d avg %ds",
entry->hour, entry->minute, entry->avg_seconds);
}
static void
@@ -1373,7 +1423,7 @@ draw_nav_button(InbeApp *app, int x, int y, int icon_size, Texture2D icon, const
if(show_label && label != NULL && label[0] != '\0') {
int text_x = x + icon_size + ui_px(12);
int text_y = y + ui_px(5);
int text_y = y + (h - font) / 2;
DrawText(label, text_x, text_y, font, c_text);
}
@@ -1445,24 +1495,37 @@ static void
draw_session_status(InbeApp *app, int center_x, int center_y)
{
char text[32];
char max_text[32];
int total_seconds;
int remaining;
int text_w;
int max_text_w;
int text_y;
if(app->inbe.phase != InbePhaseStarting || app->inbe.pause_seconds <= 0)
if(app->inbe.phase != InbePhaseStarting)
return;
remaining = app->inbe.pause_seconds - app->inbe.sectick / 60;
if(app->inbe.round == 0) {
total_seconds = 3;
} else {
if(app->inbe.pause_seconds <= 0)
return;
total_seconds = app->inbe.pause_seconds;
}
remaining = total_seconds - app->inbe.sectick / 60;
if(remaining < 1)
remaining = 1;
snprintf(text, sizeof(text), "STARTING IN %d", remaining);
int font = ui_clamp_px(18, 16, 20);
text_w = MeasureText(text, font);
text_y = center_y + (int)(app->inbe.rmax * dpi_scale + 0.5f) + ui_px(12);
if(text_y > view_height - ui_px(72))
text_y = view_height - ui_px(72);
DrawText(text, center_x - text_w / 2, text_y, font, c_text);
/* Calculate fixed width based on maximum possible value */
snprintf(max_text, sizeof(max_text), "STARTING IN %2d", 30);
max_text_w = MeasureText(max_text, font);
snprintf(text, sizeof(text), "STARTING IN %2d", remaining);
text_y = center_y - (int)(app->inbe.rmax * 0.72f) - ui_px(40);
if(text_y < ui_px(20))
text_y = ui_px(20);
DrawText(text, center_x - max_text_w / 2, text_y, font, c_text);
}
static void
@@ -1520,9 +1583,11 @@ draw_slider(InbeApp *app, int id, int x, int y, int w, const char *label,
int track_h = ui_px(8);
int knob_w = ui_px(12);
int knob_h = ui_px(22);
int knob_y = track_y - (knob_h - track_h) / 2;
int hit_padding = ui_px(16);
int changed = 0;
char value_text[32];
Rectangle hit = {(float)(x - 6), (float)(track_y - 10), (float)(w + 12), 32};
Rectangle hit = {(float)(x - hit_padding), (float)(knob_y - hit_padding), (float)(w + hit_padding * 2), (float)(knob_h + hit_padding * 2)};
snprintf(value_text, sizeof(value_text), "%d%s", *value, suffix != NULL ? suffix : "");
DrawText(label, x, y, label_font, c_text);
@@ -1551,8 +1616,8 @@ draw_slider(InbeApp *app, int id, int x, int y, int w, const char *label,
float t = (float)(*value - min) / (float)(max - min);
int knob_x = x + (int)(t * (float)w) - knob_w / 2;
DrawRectangle(knob_x, track_y - 7, knob_w, knob_h, c_button);
draw_bevel(knob_x, track_y - 7, knob_w, knob_h, lighten(c_button, 40), darken(c_button, 40));
DrawRectangle(knob_x, knob_y, knob_w, knob_h, c_button);
draw_bevel(knob_x, knob_y, knob_w, knob_h, lighten(c_button, 40), darken(c_button, 40));
return changed;
}
@@ -1866,7 +1931,7 @@ draw_manual(InbeApp *app)
int_from_count(app->inbe.maxbreaths), app->inbe.pause_seconds);
}
draw_preview_inbe(&app->settings_preview, content_x + content_w / 2, y + ui_px(40));
y += (int)(app->settings_preview.rmax * dpi_scale + 0.5f) + ui_px(54);
y += (int)(app->settings_preview.rmax * 0.72f) + ui_px(54);
if(draw_slider(app, 10, content_x, y, content_w, "Speed", SETTINGS_SPEED_MIN,
SETTINGS_SPEED_MAX, &speed, "")) {
@@ -1904,8 +1969,8 @@ draw_manual(InbeApp *app)
draw_scrollbar(app, &app->manual_scroll, content_h, viewport_h);
snprintf(page_label, sizeof(page_label), "%d/%d", app->tutorial_step + 1, TUTORIAL_STEPS);
DrawText(page_label,
view_width / 2 - MeasureText(page_label, 14) / 2,
footer_mid_y, 14, c_text);
view_width / 2 - MeasureText(page_label, ui_clamp_px(14, 14, 16)) / 2,
footer_mid_y, ui_clamp_px(14, 14, 16), c_text);
int left_hover = 0;
int right_hover = 0;
@@ -2109,15 +2174,52 @@ draw_history(InbeApp *app)
char time_label[HISTORY_TEXT_SIZE];
char record_name[16];
int selected;
int result;
snprintf(record_name, sizeof(record_name), "inbe-%02d%02d%02d",
entries[i].hour, entries[i].minute, entries[i].second);
history_format_session_label(&entries[i], time_label, sizeof(time_label));
selected = strcmp(app->history_record, record_name) == 0;
if(draw_history_row(app, content_x, y, content_w, row_h, time_label, selected, 46)) {
result = draw_history_session_row(app, content_x, y, content_w, row_h, time_label, selected);
if(result == 1) {
/* Row clicked - select session */
history_set_selected_record(app, &entries[i]);
app->history_level = 3;
selected_index = i;
} else if(result == 2) {
/* Trash clicked - delete session file */
char dir_day[FS_PATH_MAX];
char path[FS_PATH_MAX];
snprintf(dir_day, sizeof(dir_day), "%s/%04d/%02d/%02d",
history_root(), entries[i].year, entries[i].month, entries[i].day);
snprintf(path, sizeof(path), "%s/%s", dir_day, record_name);
remove(path);
/* Reload history */
scan_history_tree(entries, &count);
qsort(entries, (size_t)count, sizeof(entries[0]), compare_history_entries);
history_clear_record_selection(app);
selected_index = -1;
/* Rebuild content rows */
content_rows = history_count_year_rows(entries, count);
if(count > 0 && has_year && app->history_level >= 1) {
content_rows += history_count_month_rows(entries, count, app->history_year);
if(has_month && app->history_level >= 2) {
content_rows += history_count_day_rows(entries, count, app->history_year, app->history_month);
if(has_day && app->history_level >= 3) {
content_rows += history_count_record_rows(entries, count,
app->history_year, app->history_month,
app->history_day);
}
}
}
content_h = 18 + content_rows * row_h;
max_scroll = content_h - viewport_h;
if(max_scroll < 0)
max_scroll = 0;
app->history_scroll = clampi(app->history_scroll, 0, max_scroll);
y -= row_h; /* Don't advance y since we removed this row */
continue;
}
y += row_h;
@@ -2329,8 +2431,6 @@ updateapp(InbeApp *app)
finish_hold(app);
}
}
if(app->inbe.screen == InbeScreenResults)
save_session_results(app);
break;
case InbeScreenResults:
@@ -2363,9 +2463,9 @@ updateapp(InbeApp *app)
if(best < 0)
best = 0;
DrawRectangle(box_x, box_y, box_w, 78, darken(c_bg, 6));
DrawLine(box_x, box_y + 26, box_x + box_w, box_y + 26, darken(c_bg, 30));
DrawLine(box_x, box_y + 52, box_x + box_w, box_y + 52, darken(c_bg, 30));
DrawRectangle(box_x, box_y, box_w, ui_px(78), darken(c_bg, 6));
DrawLine(box_x, box_y + ui_px(26), box_x + box_w, box_y + ui_px(26), darken(c_bg, 30));
DrawLine(box_x, box_y + ui_px(52), box_x + box_w, box_y + ui_px(52), darken(c_bg, 30));
DrawText(TextFormat("%d rounds", rounds), box_x + ui_px(10), box_y + ui_px(8), ui_clamp_px(16, 14, 18), c_text);
DrawText(TextFormat("best %ds", best), box_x + ui_px(10), box_y + ui_px(34), ui_clamp_px(16, 14, 18), c_text);
DrawText(TextFormat("avg %ds", rounds > 0 ? total / rounds : 0), box_x + ui_px(10), box_y + ui_px(60), ui_clamp_px(16, 14, 18), c_text);
@@ -2384,9 +2484,6 @@ updateapp(InbeApp *app)
if (drawbtn(app, center_x, view_height - ui_px(40), "HOME", &hover)) {
inbe_app_init(app);
}
if(!app->results_saved)
save_session_results(app);
}
break;
+1
View File
@@ -49,6 +49,7 @@ struct InbeApp {
char history_record[16];
int session_paused;
int results_saved;
int saved_pause_seconds;
};
void inbe_app_init(void *app);
+69
View File
@@ -0,0 +1,69 @@
#!/usr/bin/env bash
# update_version.sh - Update version from CHANGELOG.md
# Usage: ./update_version.sh
set -e
CHANGELOG_FILE="CHANGELOG.md"
GRADLE_FILE="droid/app/build.gradle"
# Check if files exist
if [ ! -f "$CHANGELOG_FILE" ]; then
echo "Error: $CHANGELOG_FILE not found"
exit 1
fi
if [ ! -f "$GRADLE_FILE" ]; then
echo "Error: $GRADLE_FILE not found"
exit 1
fi
# Extract latest version from CHANGELOG (first ## [X.Y.Z] pattern)
VERSION=$(grep -m1 '^## \[' "$CHANGELOG_FILE" | sed 's/^## \[\([^]]*\)\].*/\1/')
if [ -z "$VERSION" ]; then
echo "Error: No version found in $CHANGELOG_FILE"
echo "Expected format: ## [1.0.0] - YYYY-MM-DD"
exit 1
fi
# Validate version format (basic semver check)
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Invalid version format: $VERSION"
echo "Expected semantic versioning format: X.Y.Z"
exit 1
fi
# Get current versionCode and increment
CURRENT_CODE=$(grep "versionCode" "$GRADLE_FILE" | awk '{print $2}')
NEW_CODE=$((CURRENT_CODE + 1))
# Get current versionName for comparison
CURRENT_NAME=$(grep "versionName" "$GRADLE_FILE" | sed 's/.*"\([^"]*\)".*/\1/')
echo "Current: versionName = $CURRENT_NAME, versionCode = $CURRENT_CODE"
echo "New: versionName = $VERSION, versionCode = $NEW_CODE"
# Confirm before making changes
read -p "Apply changes? (y/N) " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted"
exit 0
fi
# Backup original file
cp "$GRADLE_FILE" "$GRADLE_FILE.bak"
# Update gradle file
sed -i "s/versionCode $CURRENT_CODE/versionCode $NEW_CODE/" "$GRADLE_FILE"
sed -i "s/versionName \"$CURRENT_NAME\"/versionName \"$VERSION\"/" "$GRADLE_FILE"
echo "✓ Updated $GRADLE_FILE"
echo ""
echo "Changes:"
diff -u "$GRADLE_FILE.bak" "$GRADLE_FILE" || true
rm "$GRADLE_FILE.bak"
echo ""
echo "Done! Build and test the app before committing."