Skip to content

Commit

Permalink
Annotate attributes with resource category hint for the IDE
Browse files Browse the repository at this point in the history
The code completion experience can be improved if the editor knew
which string properties typically come from resources so a completion
suggestion can be provided that is filtered to the type of resource
the property should be pointing to (i.e. `@(string)` vs `@(drawable)`).

Fixes dotnet#2862
  • Loading branch information
kzu committed Mar 22, 2019
1 parent 58137da commit ba158e9
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.ComponentModel;

using Android.Content.PM;
using Android.Views;
Expand Down Expand Up @@ -52,7 +53,9 @@ public ActivityAttribute ()
#if ANDROID_11
public bool HardwareAccelerated {get; set;}
#endif
[Category("@drawable;@mipmap")]
public string Icon {get; set;}
[Category("@string")]
public string Label {get; set;}
public LaunchMode LaunchMode {get; set;}
#if ANDROID_23
Expand Down Expand Up @@ -99,6 +102,7 @@ public ActivityAttribute ()
public WindowRotationAnimation RotationAnimation {get; set;}
#endif
#if ANDROID_25
[Category("@drawable;@mipmap")]
public string RoundIcon {get; set;}
#endif
#if ANDROID_23
Expand All @@ -120,6 +124,7 @@ public ActivityAttribute ()
#endif
public bool StateNotNeeded {get; set;}
public string TaskAffinity {get; set;}
[Category("@style")]
public string Theme {get; set;}
#if ANDROID_27
public bool TurnScreenOn {get; set;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public ApplicationAttribute ()
public string Banner {get; set;}
#endif
public bool Debuggable {get; set;}
[Category("@string")]
public string Description {get; set;}
#if ANDROID_24
public bool DirectBootAware {get; set;}
Expand All @@ -46,13 +47,16 @@ public ApplicationAttribute ()
public bool HardwareAccelerated {get; set;}
#endif
public bool HasCode {get; set;}
[Category("@drawable;@mipmap")]
public string Icon {get; set;}
public bool KillAfterRestore {get; set;}
#if ANDROID_11
public bool LargeHeap {get; set;}
#endif
[Category("@string")]
public string Label {get; set;}
#if ANDROID_11
[Category("@drawable;@mipmap")]
public string Logo {get; set;}
#endif
public Type ManageSpaceActivity {get; set;}
Expand All @@ -70,12 +74,14 @@ public ApplicationAttribute ()
public string RestrictedAccountType {get; set;}
#endif
#if ANDROID_25
[Category("@drawable;@mipmap")]
public string RoundIcon {get; set;}
#endif
#if ANDROID_17
public bool SupportsRtl {get; set;}
#endif
public string TaskAffinity {get; set;}
[Category("@style")]
public string Theme {get; set;}
#if ANDROID_14
public UiOptions UiOptions {get; set;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ public InstrumentationAttribute ()

public bool FunctionalTest {get; set;}
public bool HandleProfiling {get; set;}
[Category("@drawable;@mipmap")]
public string Icon {get; set;}
[Category("@string")]
public string Label {get; set;}
public string Name {get; set;}
#if ANDROID_25
[Category("@drawable;@mipmap")]
public string RoundIcon {get; set;}
#endif
public string TargetPackage {get; set;}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ public ServiceAttribute ()
#endif
public bool Enabled {get; set;}
public bool Exported {get; set;}
[Category("@drawable;@mipmap")]
public string Icon {get; set;}
#if ANDROID_16
public bool IsolatedProcess {get; set;}
#endif
[Category("@string")]
public string Label {get; set;}
public string Permission {get; set;}
public string Process {get; set;}
#if ANDROID_25
[Category("@drawable;@mipmap")]
public string RoundIcon {get; set;}
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@ public BroadcastReceiverAttribute ()
public bool DirectBootAware {get; set;}
public bool Enabled {get; set;}
public bool Exported {get; set;}
[Category("@string")]
public string Description {get; set;}
[Category("@drawable;@mipmap")]
public string Icon {get; set;}
[Category("@string")]
public string Label {get; set;}
public string Name {get; set;}
public string Permission {get; set;}
public string Process {get; set;}
#if ANDROID_25
[Category("@drawable;@mipmap")]
public string RoundIcon {get; set;}
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@ public ContentProviderAttribute (string[] authorities)
public bool Enabled {get; set;}
public bool Exported {get; set;}
public bool GrantUriPermissions {get; set;}
[Category("@drawable;@mipmap")]
public string Icon {get; set;}
public int InitOrder {get; set;}
[Category("@string")]
public string Label {get; set;}
public bool MultiProcess {get; set;}
public string Name {get; set;}
public string Permission {get; set;}
public string Process {get; set;}
public string ReadPermission {get; set;}
#if ANDROID_25
[Category("@drawable;@mipmap")]
public string RoundIcon {get; set;}
#endif
public bool Syncable {get; set;}
Expand Down

0 comments on commit ba158e9

Please sign in to comment.