Skip to content

Commit

Permalink
[enumification][Mono.Android] fix ChoiceMode enum generation. (#1200)
Browse files Browse the repository at this point in the history
Fixes: #1170
Context: a301764

Bumps to xamarin-android-api-compatibility/master/6874e3f3

Xamarin.Android 8.1 (d15-5) provides an `Android.Widget.ChoiceMode`
enum type in API-10+, used by the
`Android.Widget.ListView.ChoiceMode` property.
`ChoiceMode` contains the `android.widget.ListView.CHOICE_MODE_*`
constants from API-10, which were moved to
`android.widget.AbsListView` in API-15.

Xamarin.Android 8.2 (d15-6) inadvertently *removed* the
`Android.Widget.ChoiceMode` enum, because
[xamarin-android/a301764a][xa-a301764a] altered the mapping of the
`CHOICE_MODE` constants so that they were only bound into the
`Android.Widget.ChoiceMode` enum for API-15+.

[xa-a301764a]: a301764

Removing the `ChoiceMode` enum in turn caused the
`ListView.ChoiceMode` property to be removed, as the
`ListView.getChoiceMode()` and `ListView.setChoiceMode()` methods
expected the (now nonexistent) `ChoiceMode` enum type.

Update `map.csv` so that the `CHOICE_MODE_*` values are mapped to the
`ChoiceMode` enum in API-10+, not API-15+, which restores the
`Android.Widget.ChoiceMode` enum type and the `ListView.ChoiceMode`
property.
  • Loading branch information
atsushieno authored and jonpryor committed Jan 18, 2018
1 parent 9372683 commit 2e0e224
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,8 @@
<map package='android.webkit' class='WebView.HitTestResult' fields='*' enum-name='HitTestResult' is-transient='false' />
<map package='android.webkit' class='WebViewClient' prefix='ERROR_' enum-name='ClientError' is-transient='false' />
<map package='android.webkit' class='WebViewClient' prefix='SAFE_BROWSING_THREAT_' enum-name='SafeBrowsingThreat' is-transient='false' />
<map package='android.widget' class='AbsListView' prefix='CHOICE_MODE_' enum-name='ChoiceMode' is-transient='false' />
<map package='android.widget' class='ListView' prefix='CHOICE_MODE_' enum-name='ChoiceMode' is-transient='true' />
<map package='android.widget' class='AbsListView' prefix='CHOICE_MODE_' fields='CHOICE_MODE_MULTIPLE_MODAL' enum-name='ChoiceMode' is-transient='true' />
<map package='android.widget' class='AbsListView' prefix='TRANSCRIPT_MODE_' enum-name='TranscriptMode' is-transient='false' />
<map package='android.widget' class='AdapterView' prefix='ITEM_VIEW_TYPE_' enum-name='ItemViewType' is-transient='false' />
<map package='android.widget' class='CursorAdapter' prefix='FLAG_' enum-name='CursorAdapterFlags' extra-default='None' is-transient='false' />
Expand Down
2 changes: 1 addition & 1 deletion external/xamarin-android-api-compatibility
8 changes: 4 additions & 4 deletions src/Mono.Android/map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2967,10 +2967,6 @@
27,Android.Webkit.SafeBrowsingThreat,Phishing,android/webkit/WebViewClient.SAFE_BROWSING_THREAT_PHISHING,2
27,Android.Webkit.SafeBrowsingThreat,Unknown,android/webkit/WebViewClient.SAFE_BROWSING_THREAT_UNKNOWN,0
27,Android.Webkit.SafeBrowsingThreat,UnwantedSoftware,android/webkit/WebViewClient.SAFE_BROWSING_THREAT_UNWANTED_SOFTWARE,3
15,Android.Widget.ChoiceMode,Multiple,android/widget/AbsListView.CHOICE_MODE_MULTIPLE,2
15,Android.Widget.ChoiceMode,MultipleModal,android/widget/AbsListView.CHOICE_MODE_MULTIPLE_MODAL,3
15,Android.Widget.ChoiceMode,None,android/widget/AbsListView.CHOICE_MODE_NONE,0
15,Android.Widget.ChoiceMode,Single,android/widget/AbsListView.CHOICE_MODE_SINGLE,1
10,Android.Widget.TranscriptMode,AlwaysScroll,android/widget/AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL,2
10,Android.Widget.TranscriptMode,Disabled,android/widget/AbsListView.TRANSCRIPT_MODE_DISABLED,0
10,Android.Widget.TranscriptMode,Normal,android/widget/AbsListView.TRANSCRIPT_MODE_NORMAL,1
Expand Down Expand Up @@ -5095,6 +5091,10 @@
27,Android.Views.FeedbackConstants,VirtualKeyRelease,android/view/HapticFeedbackConstants.VIRTUAL_KEY_RELEASE,8
10,Android.Views.FeedbackFlags,IgnoreGlobalSetting,android/view/HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING,2
10,Android.Views.FeedbackFlags,IgnoreViewSetting,android/view/HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING,1
10,Android.Widget.ChoiceMode,Multiple,android/widget/ListView.CHOICE_MODE_MULTIPLE,2
10,Android.Widget.ChoiceMode,None,android/widget/ListView.CHOICE_MODE_NONE,0
10,Android.Widget.ChoiceMode,Single,android/widget/ListView.CHOICE_MODE_SINGLE,1
15,Android.Widget.ChoiceMode,MultipleModal,android/widget/AbsListView.CHOICE_MODE_MULTIPLE_MODAL,3
24,Android.AccessibilityServices.AccessibilityServiceShowMode,Auto,android/accessibilityservice/AccessibilityService.SHOW_MODE_AUTO,0
24,Android.AccessibilityServices.AccessibilityServiceShowMode,Hidden,android/accessibilityservice/AccessibilityService.SHOW_MODE_HIDDEN,1
24,Android.App.Admin.BugReportFailureReason,FailedCompleting,android/app/admin/DeviceAdminReceiver.BUGREPORT_FAILURE_FAILED_COMPLETING,0
Expand Down

0 comments on commit 2e0e224

Please sign in to comment.