Bug 1725 - ValueAnimator.SetDuration should be a property
Summary: ValueAnimator.SetDuration should be a property
Status: RESOLVED FEATURE
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 1.0
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 3414 ()
Depends on:
Blocks:
 
Reported: 2011-10-27 11:11 UTC by Jonathan Pobst
Modified: 2013-08-06 04:05 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FEATURE

Description Jonathan Pobst 2011-10-27 11:11:57 UTC
http://developer.android.com/reference/android/animation/ValueAnimator.html#setDuration%28long%29

SetDuration is a method in the bindings because it returns ValueAnimator (to support Java chaining).  For us, it makes more sense to have it be a property (or additionally have a property), as there is a property getter, but no property setter.

I don't know if we want to automate this change, or just have a way to manually flag things that could use a property setter as well.
Comment 1 Jonathan Pobst 2011-10-27 14:50:17 UTC
Same with ActionBar.Tab.SetText.
Comment 2 Atsushi Eno 2011-10-28 09:41:44 UTC
This is not a bug. They return non-void value and do not follow property getter/setter design.

There are couple of similar methods that are designed for fluent interface.
Comment 3 Atsushi Eno 2011-10-28 09:42:59 UTC
OK you are pretty much aware of that. But I don't think there are deterministic way of doing that kind of conversion.
Comment 4 Jonathan Pobst 2011-10-28 10:46:13 UTC
We might can do it automatically if MyType.setBlah (value) return MyType.

Even if we can't do it automatically, maybe we need a way to manually flag setters that should (additionally?) have C# property setters.
Comment 5 Atsushi Eno 2011-10-28 11:27:37 UTC
OK, it's probably doable deterministically.

using System;
using System.Xml;
using System.Xml.XPath;

public class Test
{
	public static void Main (String [] args)
	{
		var doc = new XmlDocument ();
		doc.Load (args [0]);
		var nav = doc.CreateNavigator ();
		foreach (XPathNavigator n in nav.Select ("/api/package/*/method[starts-with(@name, \"set\") and count(parameter) = 1 and @return = concat (../../@name, \".\", ../@name)]"))
			Console.WriteLine (n.Evaluate ("concat(../../@name, '.', ../@name, '.', @name)"));
	}
}


android.animation.Animator.setDuration                                                  
android.app.ActionBar.Tab.setContentDescription
android.app.ActionBar.Tab.setContentDescription
android.app.ActionBar.Tab.setCustomView
android.app.ActionBar.Tab.setCustomView
android.app.ActionBar.Tab.setIcon
android.app.ActionBar.Tab.setIcon
android.app.ActionBar.Tab.setTabListener
android.app.ActionBar.Tab.setTag
android.app.ActionBar.Tab.setText
android.app.ActionBar.Tab.setText
android.app.AlertDialog.Builder.setCancelable
android.app.AlertDialog.Builder.setCustomTitle
android.app.AlertDialog.Builder.setIcon
android.app.AlertDialog.Builder.setIcon
android.app.AlertDialog.Builder.setIconAttribute
android.app.AlertDialog.Builder.setInverseBackgroundForced
android.app.AlertDialog.Builder.setMessage
android.app.AlertDialog.Builder.setMessage
android.app.AlertDialog.Builder.setOnCancelListener
android.app.AlertDialog.Builder.setOnItemSelectedListener
android.app.AlertDialog.Builder.setOnKeyListener
android.app.AlertDialog.Builder.setTitle
android.app.AlertDialog.Builder.setTitle
android.app.AlertDialog.Builder.setView
android.app.DownloadManager.Query.setFilterById
android.app.DownloadManager.Query.setFilterByStatus
android.app.DownloadManager.Request.setAllowedNetworkTypes
android.app.DownloadManager.Request.setAllowedOverRoaming
android.app.DownloadManager.Request.setDescription
android.app.DownloadManager.Request.setDestinationUri
android.app.DownloadManager.Request.setMimeType
android.app.DownloadManager.Request.setNotificationVisibility
android.app.DownloadManager.Request.setShowRunningNotification
android.app.DownloadManager.Request.setTitle
android.app.DownloadManager.Request.setVisibleInDownloadsUi
android.app.FragmentTransaction.setBreadCrumbShortTitle
android.app.FragmentTransaction.setBreadCrumbShortTitle
android.app.FragmentTransaction.setBreadCrumbTitle
android.app.FragmentTransaction.setBreadCrumbTitle
android.app.FragmentTransaction.setTransition
android.app.FragmentTransaction.setTransitionStyle
android.app.Notification.Builder.setAutoCancel
android.app.Notification.Builder.setContent
android.app.Notification.Builder.setContentInfo
android.app.Notification.Builder.setContentIntent
android.app.Notification.Builder.setContentText
android.app.Notification.Builder.setContentTitle
android.app.Notification.Builder.setDefaults
android.app.Notification.Builder.setDeleteIntent
android.app.Notification.Builder.setLargeIcon
android.app.Notification.Builder.setNumber
android.app.Notification.Builder.setOngoing
android.app.Notification.Builder.setOnlyAlertOnce
android.app.Notification.Builder.setSmallIcon
android.app.Notification.Builder.setSound
android.app.Notification.Builder.setTicker
android.app.Notification.Builder.setVibrate
android.app.Notification.Builder.setWhen
android.content.Intent.setAction
android.content.Intent.setComponent
android.content.Intent.setData
android.content.Intent.setFlags
android.content.Intent.setPackage
android.content.Intent.setType
android.net.VpnService.Builder.setConfigureIntent
android.net.VpnService.Builder.setMtu
android.net.VpnService.Builder.setSession
android.net.sip.SipProfile.Builder.setAuthUserName
android.net.sip.SipProfile.Builder.setAutoRegistration
android.net.sip.SipProfile.Builder.setDisplayName
android.net.sip.SipProfile.Builder.setOutboundProxy
android.net.sip.SipProfile.Builder.setPassword
android.net.sip.SipProfile.Builder.setPort
android.net.sip.SipProfile.Builder.setProfileName
android.net.sip.SipProfile.Builder.setProtocol
android.net.sip.SipProfile.Builder.setSendKeepAlive
android.renderscript.Program.BaseProgramBuilder.setShader
android.renderscript.ProgramFragmentFixedFunction.Builder.setPointSpriteTexCoordinateReplacement
android.renderscript.ProgramFragmentFixedFunction.Builder.setVaryingColor
android.renderscript.ProgramRaster.Builder.setCullMode
android.renderscript.ProgramRaster.Builder.setPointSpriteEnabled
android.renderscript.ProgramStore.Builder.setDepthFunc
android.renderscript.ProgramStore.Builder.setDepthMaskEnabled
android.renderscript.ProgramStore.Builder.setDitherEnabled
android.renderscript.ProgramVertexFixedFunction.Builder.setTextureMatrixEnable
android.renderscript.Type.Builder.setFaces
android.renderscript.Type.Builder.setMipmaps
android.renderscript.Type.Builder.setX
android.renderscript.Type.Builder.setY
android.view.ContextMenu.setHeaderIcon
android.view.ContextMenu.setHeaderIcon
android.view.ContextMenu.setHeaderTitle
android.view.ContextMenu.setHeaderTitle
android.view.ContextMenu.setHeaderView
android.view.MenuItem.setActionProvider
android.view.MenuItem.setActionView
android.view.MenuItem.setActionView
android.view.MenuItem.setAlphabeticShortcut
android.view.MenuItem.setCheckable
android.view.MenuItem.setChecked
android.view.MenuItem.setEnabled
android.view.MenuItem.setIcon
android.view.MenuItem.setIcon
android.view.MenuItem.setIntent
android.view.MenuItem.setNumericShortcut
android.view.MenuItem.setOnActionExpandListener
android.view.MenuItem.setOnMenuItemClickListener
android.view.MenuItem.setShowAsActionFlags
android.view.MenuItem.setTitle
android.view.MenuItem.setTitle
android.view.MenuItem.setTitleCondensed
android.view.MenuItem.setVisible
android.view.SubMenu.setHeaderIcon
android.view.SubMenu.setHeaderIcon
android.view.SubMenu.setHeaderTitle
android.view.SubMenu.setHeaderTitle
android.view.SubMenu.setHeaderView
android.view.SubMenu.setIcon
android.view.SubMenu.setIcon
android.view.ViewPropertyAnimator.setDuration
android.view.ViewPropertyAnimator.setInterpolator
android.view.ViewPropertyAnimator.setListener
android.view.ViewPropertyAnimator.setStartDelay
android.widget.TabHost.TabSpec.setContent
android.widget.TabHost.TabSpec.setContent
android.widget.TabHost.TabSpec.setContent
android.widget.TabHost.TabSpec.setIndicator
android.widget.TabHost.TabSpec.setIndicator
java.math.BigDecimal.setScale
java.math.BigInteger.setBit
Comment 6 Jonathan Pobst 2011-10-28 11:33:29 UTC
Some of it might still be a bit tricky cause you have to find the type that matches the getter:

android.app.ActionBar.Tab.setText (int resID)
android.app.ActionBar.Tab.setText (CharSequence text)

And some of them may not have a getter:

android.app.AlertDialog.Builder.setIcon
Comment 7 Atsushi Eno 2011-10-28 11:50:52 UTC
Turned out that it was more complicated case.

We actually don't have valid ValueAnimator.SetDuration().
I originally intended to *remove* that as ValueAnimator.setDuration() caused build issue (due to overlapped property definition, actually its backing members). 

So, in my plan, it was meant to be non-existent. However it *somehow* revived in the middle of the overriden methods resolution phase. Therefore, the method exists but has wrong reference to the method in JNI reference.

Ideally, this property could be declared as "public override long Duration { get ... set ... }" and that looks clean in managed land, but I'm not sure if the internals could be done easily (as it also faces members' conflict between the base type and current type).
Comment 8 Atsushi Eno 2012-02-13 02:01:04 UTC
*** Bug 3414 has been marked as a duplicate of this bug. ***
Comment 9 Atsushi Eno 2012-02-13 04:05:17 UTC
from the last comment from me:

> However it *somehow* revived in the middle of the overriden methods resolution phase.

It was just that we have added manual binding, so it was non-issue.

I'm going to create a patch that adds these properties, maybe (API is generated, not verified if they are valid, yet).
Comment 12 Atsushi Eno 2012-02-14 01:16:27 UTC
This should be included in the next alpha release.
Comment 13 Atsushi Eno 2012-02-14 22:52:18 UTC
Now we are discussing if this change should be really done. This likely harms users by API breakage especially regarding interfaces and abstract methods. I'm sort of sure it will. Depending on the conclusion I'll fully revert this change and resolve as FEATURE.
Comment 15 Atsushi Eno 2012-02-16 02:24:56 UTC
We have no conclusion on how to deal with it, so I cannot keep this change in. If it is said desired, it should be discussed enough so that we can say it's for benefit without significant harm.