Skip to content

Commit

Permalink
[Resource Inspection] Set up Android Studio resource inspection annot…
Browse files Browse the repository at this point in the history
…ation and annotation processor, and add @Attribute annotation to MaterialButton#getIconPadding

PiperOrigin-RevId: 536411748
  • Loading branch information
dsn5ft committed May 30, 2023
1 parent dae89b7 commit 2b5c75f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
38 changes: 22 additions & 16 deletions build.gradle
Expand Up @@ -22,22 +22,24 @@ ext {
targetSdkVersion = 33

androidXVersions = [
annotation : '1.2.0',
appCompat : '1.6.1',
cardView : '1.0.0',
constraintlayout : '2.0.1',
coordinatorlayout : '1.1.0',
core : '1.6.0',
drawerlayout : '1.1.1',
experimental : '1.0.0',
fragment : '1.2.5',
lifecycle : '2.0.0',
recyclerView : '1.0.0',
recyclerViewSelection : '1.0.0',
transition : '1.2.0',
vectorDrawable : '1.1.0',
viewpager2 : '1.0.0',
dynamicanimation : '1.0.0',
annotation : '1.2.0',
appCompat : '1.6.1',
cardView : '1.0.0',
constraintlayout : '2.0.1',
coordinatorlayout : '1.1.0',
core : '1.6.0',
drawerlayout : '1.1.1',
experimental : '1.0.0',
fragment : '1.2.5',
lifecycle : '2.0.0',
recyclerView : '1.0.0',
recyclerViewSelection : '1.0.0',
resourceInspectionAnnotation : '1.0.1',
resourceInspectionProcessor : '1.0.1',
transition : '1.2.0',
vectorDrawable : '1.1.0',
viewpager2 : '1.0.0',
dynamicanimation : '1.0.0',
]

errorproneVersion = '2.15.0'
Expand Down Expand Up @@ -112,6 +114,10 @@ def compatibility(name) {
return "androidx.vectordrawable:vectordrawable:${androidXVersions.vectorDrawable}"
case "recyclerViewSelection":
return "androidx.recyclerview:recyclerview-selection:${androidXVersions.recyclerViewSelection}"
case "resourceInspectionAnnotation":
return "androidx.resourceinspection:resourceinspection-annotation:${androidXVersions.resourceInspectionAnnotation}"
case "resourceInspectionProcessor":
return "androidx.resourceinspection:resourceinspection-processor:${androidXVersions.resourceInspectionProcessor}"
case "viewpager2":
return "androidx.viewpager2:viewpager2:${androidXVersions.viewpager2}"
case "experimental":
Expand Down
3 changes: 3 additions & 0 deletions lib/build.gradle
Expand Up @@ -18,10 +18,13 @@ dependencies {
api compatibility("fragment")
api compatibility("lifecycleRuntime")
api compatibility("recyclerview")
api compatibility("resourceInspectionAnnotation")
api compatibility("transition")
api compatibility("vectordrawable")
api compatibility("viewpager2")

annotationProcessor compatibility("resourceInspectionProcessor")

implementation "com.google.errorprone:error_prone_annotations:${errorproneVersion}"

testImplementation "androidx.test:core:${testRunnerVersion}"
Expand Down
Expand Up @@ -65,6 +65,7 @@
import androidx.customview.view.AbsSavedState;
import com.google.android.material.internal.ThemeEnforcement;
import com.google.android.material.internal.ViewUtils;
import androidx.resourceinspection.annotation.Attribute;
import com.google.android.material.resources.MaterialResources;
import com.google.android.material.shape.MaterialShapeUtils;
import com.google.android.material.shape.ShapeAppearanceModel;
Expand Down Expand Up @@ -686,6 +687,7 @@ public void setIconPadding(@Px int iconPadding) {
* @attr ref com.google.android.material.R.styleable#MaterialButton_iconPadding
* @see #setIconPadding(int)
*/
@Attribute("com.google.android.material:iconPadding")
@Px
public int getIconPadding() {
return iconPadding;
Expand Down

0 comments on commit 2b5c75f

Please sign in to comment.