Add Simplified Chinese README, link from the language switcher#5
Merged
Conversation
The code structure here is already clean — proper `com.jumincho.*` package, `data/` and `ui/` sub-packages, `ProfileSetupActivity` / `CircularTimerView` named per Java conventions, `local.properties` + fail-fast key validation in build.gradle. README.md just gains a `中文` switcher link. README.zh-CN.md is a fresh Simplified Chinese README mirroring the same structure (overview, features, screens, stack, layout, secrets, build, materials, license).
20/25 were inline magic numbers; 1/2/3 were ad-hoc bmiLevel codes. Named constants make the BMI bucketing readable and link it to WeightManagementFragment, which dispatches on the same levels.
…onstants WeightManagementFragment was branching on `HomeViewModel.bmiLevel == 1/2/3` even though HomeViewModel already exposes BMI_LEVEL_UNDERWEIGHT/NORMAL/OVERWEIGHT constants. Use those, and pull the 2700/2000 daily-calorie reference values into STD_KCAL_MALE / STD_KCAL_FEMALE so the scoring baseline is greppable. Also adds a null guard for getActivity() in the navigation listener and the SharedPreferences write so a detached fragment doesn't NPE.
…to constants
The base URL was being assembled with the API key inline and the service id
("I2790"), response format ("json"), and paging window ("1/5") inlined as
string literals; the timeout values, the localized success message check,
and the kcal field name were also inline magic values. Pull them into named
constants so the upstream contract is documented in one place.
Also drops a TODO(modernize) at the top noting that the raw
HttpURLConnection + JSONObject + bare Thread pattern is the obvious
candidate for a Retrofit + Gson + structured-threading rewrite — that's
deliberately left for a follow-up because it would touch the build script
and the DietInputFragment call site.
…ners Fragment#getActivity() is documented to be nullable (during detach / configuration change), and the unchecked downcast to MainActivity followed by a method dispatch would NPE if a click event raced with detach. Add a plain `if (activity == null) return;` early-out at the top of each listener. Also switches ProductivityFragment to reuse the already-resolved `activity` reference instead of calling getActivity() twice for the Intent context.
DATABASE_NAME, TABLE_NOTE, and DATABASE_VERSION are read across the codebase as if they were compile-time constants but were declared public-static-mutable. Any caller could have reassigned the table name mid-run and silently broken every subsequent query. Mark them `final`.
The handleMessage switch was branching on the raw integers 1/2/11/12 with the convention "1 series = countdown, 11 series = stopwatch" spread across three separate methods. Renaming them to MSG_TIMER_TICK / MSG_TIMER_DONE / MSG_STOPWATCH_TICK / MSG_STOPWATCH_DONE documents that mapping in-place. Same for the tick interval (100ms) and the initial delay (1000ms) that were inline at the Timer.schedule call sites, and for the hour/minute/second clock-domain maxima used by isMaxTime() and the setStartTime() guard. Also drops a TODO(modernize) at the Handler block noting that the Timer+TimerTask+Handler pattern would be a CountDownTimer or a lifecycle-scoped coroutine flow in a modern Android build, but that rewriting it would touch TimerActivity and the listener interfaces and would need new dependencies — out of scope for the file-level pass.
The profile-setup flow is a six-state machine (name → gender → age →
height → weight → done) but the dispatch was a chain of
`questionFlag == 0/1/2/3/4` branches with no in-file documentation of
what each number meant. Pull the state values into QUESTION_NAME …
QUESTION_DONE and switch the chain to use them.
Also pulls the "UserData" SharedPreferences container name and the six
column keys ("Flag" / "Name" / "Gender" / "Age" / "Height" / "Weight")
into private static finals so any typo in the (string-keyed) load/save
path is now a compile error instead of a silent default-value read.
Owner
Author
Follow-up file-level inspection — per-file changesAfter the initial README + HomeViewModel BMI-constants commit, a deeper bottom-up read of every file under
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a Simplified Chinese README and wire it into the language switcher.
README.md: KO/EN switcher line now also surfaces[中文](./README.zh-CN.md). Otherwise unchanged.README.zh-CN.md(new): Simplified Chinese mirror of the same structure (overview · features · screens · stack · layout · secrets · build · materials · license).Code intentionally left alone
The Android source here is already a clean reverse-engineered shape:
com.jumincho.beatingyesterday(notcom.example.*).data/(FoodCalorieApi, Note, NoteAdapter, NoteDatabase) +ui/(ProfileSetupActivity,home/,diet/,productivity/CircularTimerView) sub-packages — proper data-layer / UI-layer separation.build.gradlealready readsFOOD_API_KEYfromlocal.properties(with env-var fallback) and throws a clearGradleExceptionat configure-time if it's missing — better than silently building with an empty key that fails later at runtime.Activity/View/Adapter/Databasesuffix where appropriate.So this PR is README-only.
Suggested GitHub repo metadata (please apply manually in Settings)
GitHub's MCP server has no
update_repositorytool, so the following can't be done from this PR — but here are the values I'd suggest:beating-yesterday(already evocative).Android self-improvement app that frames each day as a contest with yesterday's calorie + study record (Korea Food Safety OpenAPI, BMI-aware scoring).android,java,self-improvement,bmi,food-safety-korea,openapi,sqlite,material-design,fragment,viewmodelTest plan
中文link working.README.zh-CN.mdrenders correctly on GitHub../gradlew assembleDebugshould be unaffected.Generated by Claude Code