Repository navigation
Migrate App resources snippets - #1157
Draft
djubinville wants to merge 1 commit into
Draft
djubinville wants to merge 1 commit into
djubinville wants to merge 1 commit into
Conversation
djubinville
force-pushed
the
djubinville/app-resources-snippets
branch
from
October 9, 2026 17:08
8d8add4 to
c52a1a3
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:
compose/snippets/src/main/res/animator/property_animator.xmland supporting resource declarations incompose/snippets/src/main/res/values/strings.xml,colors.xml, anddimens.xmlare included because tagged Kotlin snippets referenceR.animator.property_animator,R.string.hello,R.string.welcome_messages,R.array.planets_array,R.plurals.numberOfSongsAvailable,R.bool.screen_small,R.color.opaque_red,R.dimen.font_size,R.integer.max_speed,R.array.bits,R.array.icons, andR.array.colorsand will not build without them. Existing repository assetsR.font.raleway_regularandR.drawable.cupcakeare reused in place ofR.font.permanent_markerandR.drawable.myimageto avoid adding duplicate font or bitmap files.List of modifications:
ProvidingResources.ktand added a terminal period to the inline comment.RuntimeChanges.kt.AppLanguages.kt, commented out inlineimportstatements inside region tags so imports remain at the top of the file, updatedoverrideLocaleConfig.supportedLocales()to the nullable SDK propertyoverrideLocaleConfig?.supportedLocalesso the code compiles, and standardized inline comment punctuation.Localization.kt.Internationalization.kt.AnimatorInflatersnippet intoAnimationResources.kt, added an explicitas AnimatorSetcast soAnimatorInflater.loadAnimatorcompiles withAnimatorSet, and addedres/animator/property_animator.xml(required for the Kotlin snippet to compile).ResourcesCompat.getDrawablesnippet intoDrawableResources.kt, reusing existing drawable assetR.drawable.cupcakein place ofR.drawable.myimage.StringResources.kt, added type argumentArray<String>to rawArrayinPlanetList, commented out inlineimportstatements inside region tags, standardized inline comment punctuation, and reused existing font assetR.font.raleway_regularin place ofR.font.permanent_marker.MoreResources.kt, updatedresources.getColor(R.color.opaque_red)toresources.getColor(R.color.opaque_red, null)to match the current two-argumentResources.getColorsignature, and madeval drawable: Drawable? = icons.getDrawable(0)nullable to match the SDK return type.Snippets not migrated:
<resources>XML syntax blocks left hardcoded on the guide page.AndroidManifest.xml<activity>configuration blocks.gradle.propertiesconfiguration,AndroidManifest.xmlsnippets, and<locale-config>XML configuration lists left hardcoded on the guide page.<string>and XLIFF XML examples left hardcoded on the guide page.ImageView/findViewByIdView-based snippets, and XML animation syntax examples left hardcoded on the guide page.findViewByIdView-based snippets (ImageButton,ImageView,TextView), and XML drawable syntax examples left hardcoded on the guide page.<string>,<string-array>,<plurals>, andAndroidManifest.xmlXML snippets left hardcoded on the guide page.Activity.showDialog/onCreateDialogsnippets, and XML resource syntax examples left hardcoded on the guide page.