I am using Android LintFix (see slide 119 or code examples) and I have managed to do fixes for the function, however it does not seem to be possible to add imports like Kotlin #Deprecated annotation. Is it possible to do somehow or should I rely on the IDE for auto-import?
Thanks to Mark Prengemann who indicated me the solution:
Using fully qualified names with reformat(true) and shortenNames():
LintFix.create().replace()
.text("<original>").with("<correction with fully qualified entities>")
.shortenNames()
.reformat(true)
.build()
Related
I want to use this class to render the animation in the word thread,
But now I can't find this class, who can tell me why this class was deleted?
question why it was removed should be answered by someone from Android team. probably they just refactored some internal animation utils due to new possibilities...
you can always copy-paste this class source and paste into your project (with different name just in case), you probably should find workaround for FallbackLUTInterpolator usage (or just remove related items, supplying different Interpolator in this place, eg. linear)
SOURCE
I'm an Android dev who is using AndroidStudio or IntelliJ IDEA.
I tend to trust my IDE and I'm annoyed with next facts:
In android project when IDE autogenerates a method in java that extends Kotlin class then both IDE uses #NotNull instead of #NonNull, is there setting for this? This
We have #ParametersAreNonnullByDefault but when I override the method from the point 1 and I don't put any annotation IDE warns me, but why?
Am I wrong in my assumptions?
Are there solutions?
Which annotations to use for null/not-null is set under Configure annotations... in the Compiler page of the Settings/Preferences dialog. Select the one you want and press the checkmark button. See https://www.jetbrains.com/help/idea/nullable-notnull-configuration-dialog.html for documentation.
I can't test right now whether IDEA/AS use the default annotations from there when overriding a method which already uses another, but if they don't you'll need to file a ticket.
I'm trying to bind an android SDK for voice chat (zoom sdk).
They have two .aar files (zoomcoomonlib.aar and zoomsdk.aar)
I know I have to create separate binding project for each .aar and then reference them.
While binding zoomsdk.aar I'm getting the below error
The type `Com.Zipow.Videobox.Onedrive.ErrorEventArgs' already contains a definition for `P0' (CS0102) (B14)
In the .aar file I navigated to the package com.zipow.videobox.onedrive; to the interface IODFoldLoaderListener
And below are the contents of it
So it seems parameter String var1 of method onError is causing the issue.
And xamarin studio generated obj/debug/api.xml confirms it (below screenshot) that onError will have first parameter named p0:
So in this scenario I change the metadata.xml to give this parameter a meaningful name.
Like below screenshot:
But even after doing that I am getting same error. That error didn't resolve.
Moreover now if I see the obj/debug/api/.xml file I see the contents for the class IODFoldLoaderListener remains the same.
So changing the metadata.xml has no effect it seems.
Your definition needs to be changed quite a bit. Here is an example that solves the same problem:
<attr path="/api/package[#name='com.emarsys.mobileengage.inbox']/interface[#name='ResetBadgeCountResultListener']/method[#name='onError' and count(parameter)=1 and parameter[1][#type='java.lang.Exception']]" name="argsType">ResetBadgeCountResultListenerOnErrorArgs</attr>
Please note the /interface and argsType items here as your initial definition is incorrect. You would then change the parameters to strings instead of java.lang.Exception from my example.
I mean, imports generally don't effect code unless you use something that is unknown in the current file without giving the full qualified identifier, but this one seems weird to me. It's in a few files and is generally unused.
Can "import org.parceler.Generated" be removed savely? Is there any reason to keep it?
The part that stumps me is the word "Generated" here. It seems like this has to be or atleast should be kept, but I don't know why.
I suppose it's autoincluded when using some autogeneration tool, potentially even build into android-studio. But why is the "import org.parceler.Generated" line generated if the import is unused ?
If you're using Parceler, then it should be generating classes that look like the following:
#Generated(value = "org.parceler.ParcelAnnotationProcessor", date = "2016-09-03T09:53-0600")
#SuppressWarnings({
"unchecked",
"deprecation"
})
public class ParcelerTestModel$$Parcelable
implements Parcelable, ParcelWrapper<org.parceler.test.ParcelerTestModel>
{
...
Notice the #Generated annotation. This requires the import you mentioned if the generated class it outside of the org.parceler package.
The #Generated annotation doesn't do much here. The intention behind this annotation is to demarcate generated code from user written code, following the JSR269 standard.
If you're taking the generated code out of the purview of the annotation processor and managing it yourself then you're free to remove this annotation. I wouldn't recommend this approach, however, as it's simply more boilerplate to manage which defeats the purpose of using a boilerplate-reducing solution like Parceler.
I'm creating a new module in android studio, and I want some of the classes to be hidden to outside of the module, I mean, that the classes could just be used internally in the module, but not externally. Is it possible? How could I achieve that?
Thanks in advance!
EDIT: I doubt it's possible to have module-visibility, but the closest you can use is package-visibility, for which you do the following:
Don't make the classes you intend to hide 'public'. Keep the default visibility, which is only seen within classes of the same package. Other public classes within this same package can act as your external interface to your module.
class PrivateToPackageInModule {
}
public class InterfaceOfModule {
private PrivateToPackageInModule ptpim;
}
For anyone that happens to stumble upon this post, there is now a keyword called internal which offers exactly the functionality that OP was looking for.
Documentation link