Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ class EditHabitActivity : AppCompatActivity() {
binding.targetInput.error = getString(R.string.validation_cannot_be_blank)
isValid = false
}
if (binding.unitInput.text.length > resources.getInteger(R.integer.unit_name_max_length)) {
binding.unitInput.error = getString(R.string.validation_unit_too_long)
isValid = false
}
}
return isValid
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
android:id="@+id/unitInput"
android:maxLines="1"
android:ems="10"
android:maxLength="@integer/unit_name_max_length"
android:hint="@string/measurable_units_example"/>
</LinearLayout>
</FrameLayout>
Expand Down
3 changes: 3 additions & 0 deletions uhabits-android/src/main/res/values/constants.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
<string name="bugReportTo">[email protected]</string>
<string name="bugReportSubject">Bug Report - Loop Habit Tracker</string>
<string name="syncBaseURL" formatted="false">https://sync.loophabits.org</string>

<!-- Maximum length for unit names in numerical habits -->
<integer name="unit_name_max_length">7</integer>

<string-array name="snooze_picker_names">
<item>@string/interval_15_minutes</item>
Expand Down
1 change: 1 addition & 0 deletions uhabits-android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,5 @@
<string name="pref_midnight_delay_description">Wait until 3:00 AM to show a new day. Useful if you typically go to sleep after midnight. Requires app restart.</string>
<string name="pref_animations_title">Disable animations</string>
<string name="pref_animations_description">Disable confetti animation after adding a checkmark.</string>
<string name="validation_unit_too_long">Unit name is too long.</string>
</resources>
Loading