Repository navigation
Migrate App resources overview (complex XML, color list, menu, font, style) snippets - #1181
Open
djubinville wants to merge 3 commits into
Open
djubinville wants to merge 3 commits into
djubinville wants to merge 3 commits into
Conversation
djubinville
force-pushed
the
djubinville/app-resources-views-snippets
branch
from
October 14, 2026 19:28
a59b617 to
681fce1
Compare
Contributor
Author
|
Rule Set Alignment & Bypass Note (
|
djubinville
force-pushed
the
djubinville/app-resources-views-snippets
branch
from
October 15, 2026 18:16
9de924c to
8e7002c
Compare
djubinville
marked this pull request as ready for review
October 15, 2026 18:56
|
Here is the summary of changes. You are about to add 11 region tags.
This comment is generated by snippet-bot.
|
djubinville
force-pushed
the
djubinville/app-resources-views-snippets
branch
5 times, most recently
from
October 21, 2026 17:46
7be6ba1 to
80f555d
Compare
…d move menu strings to strings.xml
djubinville
force-pushed
the
djubinville/app-resources-views-snippets
branch
from
October 22, 2026 12:38
80f555d to
df7ce8c
Compare
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.
Code snippets are for:
The XML menu resource
compose/snippets/src/main/res/menu/example_menu.xmlwas migrated because the tagged Kotlin regionandroid_resources_menu_inflateinMenuResource.ktreferencesR.menu.example_menuand cannot compile without it. The guide pages specify the resource filenamesres/menu/example_menu.xml,res/color/button_text.xml,res/drawable/avd.xml,res/drawable/vectordrawable.xml,res/anim/rotation.xml, andres/font/lobster.xml. Because the Complex-xml-resources and Font-resource guide pages each print two distinct XML resource files with the same path (res/drawable/avd.xmlandres/font/lobster.xml) andaapt2prohibits duplicate resource names insrc/main/res/, the second variant on each page is namedres/drawable/avd_inline.xmlandres/font/lobster_downloadable.xmlso all resources are compiled byaapt2.List of modifications:
<selector>color state list XML intocompose/snippets/src/main/res/color/button_text.xml(android_resources_color_list_button_text) and removed the redundantxmlns:androidattribute from the second<item>element after Spotless XML formatting.compose/snippets/src/main/res/drawable/avd.xml(android_resources_complex_xml_avd),compose/snippets/src/main/res/drawable/vectordrawable.xml(android_resources_complex_xml_vectordrawable), andcompose/snippets/src/main/res/anim/rotation.xml(android_resources_complex_xml_rotation).<aapt:attr>animated vector drawable XML intocompose/snippets/src/main/res/drawable/avd_inline.xml(android_resources_complex_xml_avd_inline), namedavd_inline.xmlto avoid colliding withres/drawable/avd.xmlfrom the same page soaapt2compiles both resources.<font-family>XML intocompose/snippets/src/main/res/font/lobster.xml(android_resources_font_bundled), replacing@font/lobster_regularand@font/lobster_italicwith existing repository font assets@font/raleway_regularand@font/raleway_italicso the resource compiles without adding new binary font files.<font-family>XML intocompose/snippets/src/main/res/font/lobster_downloadable.xml(android_resources_font_downloadable, namedlobster_downloadable.xmlto avoid colliding withres/font/lobster.xmlfrom the same page soaapt2compiles both resources) and the certificate<array>XML intocompose/snippets/src/main/res/values/font_certs.xml(android_resources_font_certs).<menu>XML intocompose/snippets/src/main/res/menu/example_menu.xml(android_resources_menu_example_xml). Required for the Kotlin snippet to compile (R.menu.example_menuinMenuResource.kt). Replaced non-existent@drawable/ic_new_gameand@drawable/ic_helpreferences with@drawable/ic_launcher_foregroundsoaapt2compiles the menu resource.<string>resources (item1,group_item1,group_item2,submenu_title, andsubmenu_item1) incompose/snippets/src/main/res/values/menu_strings.xml(no region tag; not printed on the guide page). Required for the Kotlin snippet to compile viares/menu/example_menu.xml.onCreateOptionsMenusnippet intocompose/snippets/src/main/java/com/example/compose/snippets/resources/MenuResource.kt(android_resources_menu_inflate) and formatted with Spotless.<style name="CustomText">XML intocompose/snippets/src/main/res/values/style_resource.xml(android_resources_style_custom_text) with a silent exclude defining the parent<style name="Text" />so the style resource links cleanly.Snippets not migrated:
providing-resources.html) page: Contains only directory-tree listings, naming tables, and 2-line pseudo-syntax examples.more-types.html) page: Contains only short 1-4 line syntax templates and attribute tables.<selector>block is a syntax template; Line 75 Kotlinresources.getColorStateListsnippet is a 2-line snippet inside an explanatory block; Line 79 Java block was removed because Kotlin is sufficient; Line 147<Button>XML is a 5-line legacy View fragment.<font-family>block is a syntax template; Lines 65, 81, 96, 122, and 188<TextView>/<EditText>/<style>XML blocks are short legacy View layout or style fragments; Line 113 Kotlinresources.getFontsnippet is a 2-line fragment; Line 117 Java block was removed because Kotlin is sufficient.LinearLayout,TextView,Button,include,merge, andfindViewByIdactivity stub).<menu>syntax template) and 199 (3-line<item>fragment) are syntax templates; Line 186 Java block was removed because Kotlin is sufficient; Line 204onOptionsItemSelectedKotlin/Java blocks use placeholder pseudo-code (// Handle item selection.).<style>block is a syntax template (@[package:]style/style_name); Line 108<TextView>XML is a 4-line legacy View fragment.