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 #2862
  • Loading branch information
kzu committed Mar 22, 2019
1 parent 6b02d35 commit a909d69
Show file tree
Hide file tree
Showing 6 changed files with 23 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 @@ -35,7 +36,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_17
Expand All @@ -55,6 +58,7 @@ public ActivityAttribute ()
public bool ResizeableActivity {get;set;}
#endif
#if ANDROID_25
[Category("@drawable;@mipmap")]
public string RoundIcon {get; set;}
#endif
#if ANDROID_24
Expand All @@ -63,6 +67,7 @@ public ActivityAttribute ()
public ScreenOrientation ScreenOrientation {get; set;}
public bool StateNotNeeded {get; set;}
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 @@ -27,6 +27,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 @@ -40,13 +41,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 @@ -61,12 +65,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,12 +15,15 @@ public BroadcastReceiverAttribute ()
public bool DirectBootAware {get; set;}
public bool Enabled {get; set;}
public bool Exported {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 a909d69

Please sign in to comment.