Skip to content

Commit 8ff139f

Browse files
atsushienojonpryor
authored andcommitted
[enumification][Mono.Android] Fix ChoiceMode enum generation. (#1183)
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.
1 parent 2fc9887 commit 8ff139f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

build-tools/enumification-helpers/enum-conversion-mappings.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,8 @@
842842
<map package='android.webkit' class='WebView.HitTestResult' fields='*' enum-name='HitTestResult' is-transient='false' />
843843
<map package='android.webkit' class='WebViewClient' prefix='ERROR_' enum-name='ClientError' is-transient='false' />
844844
<map package='android.webkit' class='WebViewClient' prefix='SAFE_BROWSING_THREAT_' enum-name='SafeBrowsingThreat' is-transient='false' />
845-
<map package='android.widget' class='AbsListView' prefix='CHOICE_MODE_' enum-name='ChoiceMode' is-transient='false' />
845+
<map package='android.widget' class='ListView' prefix='CHOICE_MODE_' enum-name='ChoiceMode' is-transient='true' />
846+
<map package='android.widget' class='AbsListView' prefix='CHOICE_MODE_' fields='CHOICE_MODE_MULTIPLE_MODAL' enum-name='ChoiceMode' is-transient='true' />
846847
<map package='android.widget' class='AbsListView' prefix='TRANSCRIPT_MODE_' enum-name='TranscriptMode' is-transient='false' />
847848
<map package='android.widget' class='AdapterView' prefix='ITEM_VIEW_TYPE_' enum-name='ItemViewType' is-transient='false' />
848849
<map package='android.widget' class='CursorAdapter' prefix='FLAG_' enum-name='CursorAdapterFlags' extra-default='None' is-transient='false' />

src/Mono.Android/map.csv

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2967,10 +2967,6 @@
29672967
27,Android.Webkit.SafeBrowsingThreat,Phishing,android/webkit/WebViewClient.SAFE_BROWSING_THREAT_PHISHING,2
29682968
27,Android.Webkit.SafeBrowsingThreat,Unknown,android/webkit/WebViewClient.SAFE_BROWSING_THREAT_UNKNOWN,0
29692969
27,Android.Webkit.SafeBrowsingThreat,UnwantedSoftware,android/webkit/WebViewClient.SAFE_BROWSING_THREAT_UNWANTED_SOFTWARE,3
2970-
15,Android.Widget.ChoiceMode,Multiple,android/widget/AbsListView.CHOICE_MODE_MULTIPLE,2
2971-
15,Android.Widget.ChoiceMode,MultipleModal,android/widget/AbsListView.CHOICE_MODE_MULTIPLE_MODAL,3
2972-
15,Android.Widget.ChoiceMode,None,android/widget/AbsListView.CHOICE_MODE_NONE,0
2973-
15,Android.Widget.ChoiceMode,Single,android/widget/AbsListView.CHOICE_MODE_SINGLE,1
29742970
10,Android.Widget.TranscriptMode,AlwaysScroll,android/widget/AbsListView.TRANSCRIPT_MODE_ALWAYS_SCROLL,2
29752971
10,Android.Widget.TranscriptMode,Disabled,android/widget/AbsListView.TRANSCRIPT_MODE_DISABLED,0
29762972
10,Android.Widget.TranscriptMode,Normal,android/widget/AbsListView.TRANSCRIPT_MODE_NORMAL,1
@@ -5095,6 +5091,10 @@
50955091
27,Android.Views.FeedbackConstants,VirtualKeyRelease,android/view/HapticFeedbackConstants.VIRTUAL_KEY_RELEASE,8
50965092
10,Android.Views.FeedbackFlags,IgnoreGlobalSetting,android/view/HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING,2
50975093
10,Android.Views.FeedbackFlags,IgnoreViewSetting,android/view/HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING,1
5094+
10,Android.Widget.ChoiceMode,Multiple,android/widget/ListView.CHOICE_MODE_MULTIPLE,2
5095+
10,Android.Widget.ChoiceMode,None,android/widget/ListView.CHOICE_MODE_NONE,0
5096+
10,Android.Widget.ChoiceMode,Single,android/widget/ListView.CHOICE_MODE_SINGLE,1
5097+
15,Android.Widget.ChoiceMode,MultipleModal,android/widget/AbsListView.CHOICE_MODE_MULTIPLE_MODAL,3
50985098
24,Android.AccessibilityServices.AccessibilityServiceShowMode,Auto,android/accessibilityservice/AccessibilityService.SHOW_MODE_AUTO,0
50995099
24,Android.AccessibilityServices.AccessibilityServiceShowMode,Hidden,android/accessibilityservice/AccessibilityService.SHOW_MODE_HIDDEN,1
51005100
24,Android.App.Admin.BugReportFailureReason,FailedCompleting,android/app/admin/DeviceAdminReceiver.BUGREPORT_FAILURE_FAILED_COMPLETING,0

0 commit comments

Comments
 (0)