Repository navigation
Show the tag card battery as an icon instead of a word - #283
Open
ibrahim-iqbal wants to merge 1 commit into
Open
ibrahim-iqbal wants to merge 1 commit into
ibrahim-iqbal wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Closes #228.
The map tag card's nearby line no longer spells out the battery. "Nearby (●●●○○) · Battery medium" is now "Nearby (●●●○○)" followed by a battery icon.
What changed
Icons: four Material Symbols vectors, exported as-is from google/material-design-icons and in the same format as
history_24px.xml(viewportWidth="960",?attr/colorControlNormaltint). I used the horizontalbattery_android_*set so the icon sits on a 12sp text line. No new dependency.FULLbattery_android_fullMEDIUMbattery_android_3LOWbattery_android_1VERY_LOWbattery_android_alertNearbyTagLabel.batteryIcon(level): picks the drawable, next toshortBatteryLabel, so the choice is covered by the JVM test.ui/maps/NearbyBatteryIcon.show(icon, level): sets the drawable, the content description and the visibility. Anulllevel (Google trackers) hides the icon. It is a separate class so the layout test can drive it withoutMapsActivity.maps_tag_card.xml: addsdevice_nearby_battery, a 16dpImageViewtinted?attr/colorOutlinelike the text next to it.device_last_updateis nowwrap_contentinstead of a weighted0dp, so the icon follows the text rather than sitting at the far end of the row.MapsActivity: the nearby line always usesnearby_now_with_signaland callsNearbyBatteryIcon.show. The timestamp branch hides the icon along with the pulse.Strings:
battery_icon_description("Battery %1$s"), used as the icon's content description. A screen reader still hears "Battery medium". Each translation reuses the wording already in that locale's battery line.nearby_now_with_battery_and_signalhad no other user, so I removed it withadd_strings.py --remove.--checkpasses.I left the Device Info screen alone. It still shows the battery word, which seemed right for a diagnostics view.
Screenshots
Before and after, in dark and light, rendered by the new test:
Tests
TagCardBatteryIconTest(new, instrumented) inflates the real card in the light and dark app themes:#6F797Aon#F5FAFB= 4.25:1#899294on#0E1415= 5.85:1Other test changes:
NearbyTagLabelTest: each level gets its own icon, and critical gets the alert glyph.TagCardLayoutTest.theLongestNearbyStatusLineDoesNotMakeItsCardTaller: now checks the new line (five dots plus the icon) instead of the old "· Battery critical" text.I also checked that the tests can fail. I made
MEDIUMreuse the full icon and dropped the content description. That turned exactly four tests red:batteryIconGivesEveryLevelItsOwnIcon,everyLevelShowsAnIconAndKeepsTheWordForScreenReaders,everyLevelDrawsADifferentVisibleIconInBothThemesandtheMediumIconIsReadAsBatteryMedium. Putting the code back turned them green again.What I ran, and what I did not
./gradlew testAllpython scripts/add_strings.py --check./gradlew :app:testEmulatorDebugAndroidTeston the managedaosp-atddevice, filtered toTagCardBatteryIconTestandTagCardLayoutTest: 28 tests, 0 failures