Skip to content

Commit e1053b6

Browse files
authored
Merge pull request #8 from DigitallyImported/mopub-5.8.0
Mopub 5.8.0
2 parents 98e201d + e9069b5 commit e1053b6

28 files changed

+333
-24
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,6 @@ Components
114114

115115
.DS_Store
116116
.stversions
117-
.stfolder
117+
.stfolder
118+
119+
.idea/
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
Additions allow you to add arbitrary C# to the generated classes
2+
before they are compiled. This can be helpful for providing convenience
3+
methods or adding pure C# classes.
4+
5+
== Adding Methods to Generated Classes ==
6+
7+
Let's say the library being bound has a Rectangle class with a constructor
8+
that takes an x and y position, and a width and length size. It will look like
9+
this:
10+
11+
public partial class Rectangle
12+
{
13+
public Rectangle (int x, int y, int width, int height)
14+
{
15+
// JNI bindings
16+
}
17+
}
18+
19+
Imagine we want to add a constructor to this class that takes a Point and
20+
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
21+
with a partial class containing our new method:
22+
23+
public partial class Rectangle
24+
{
25+
public Rectangle (Point location, Size size) :
26+
this (location.X, location.Y, size.Width, size.Height)
27+
{
28+
}
29+
}
30+
31+
At compile time, the additions class will be added to the generated class
32+
and the final assembly will a Rectangle class with both constructors.
33+
34+
35+
== Adding C# Classes ==
36+
37+
Another thing that can be done is adding fully C# managed classes to the
38+
generated library. In the above example, let's assume that there isn't a
39+
Point class available in Java or our library. The one we create doesn't need
40+
to interact with Java, so we'll create it like a normal class in C#.
41+
42+
By adding a Point.cs file with this class, it will end up in the binding library:
43+
44+
public class Point
45+
{
46+
public int X { get; set; }
47+
public int Y { get; set; }
48+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This directory is for Android .jars.
2+
3+
There are 2 types of jars that are supported:
4+
5+
== Input Jar ==
6+
7+
This is the jar that bindings should be generated for.
8+
9+
For example, if you were binding the Google Maps library, this would
10+
be Google's "maps.jar".
11+
12+
Set the build action for these jars in the properties page to "InputJar".
13+
14+
15+
== Reference Jars ==
16+
17+
These are jars that are referenced by the input jar. C# bindings will
18+
not be created for these jars. These jars will be used to resolve
19+
types used by the input jar.
20+
21+
NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
22+
based on the Target Framework selected.
23+
24+
Set the build action for these jars in the properties page to "ReferenceJar".
92.1 KB
Binary file not shown.
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6+
<ProductVersion>8.0.30703</ProductVersion>
7+
<SchemaVersion>2.0</SchemaVersion>
8+
<ProjectGuid>{D5E1D972-ADD9-44FD-9631-54BD4899C5BC}</ProjectGuid>
9+
<ProjectTypeGuids>{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
10+
<TemplateGuid>{77efb91c-a7e9-4b0e-a7c5-31eeec3c6d46}</TemplateGuid>
11+
<OutputType>Library</OutputType>
12+
<AppDesignerFolder>Properties</AppDesignerFolder>
13+
<RootNamespace>MopubVolleyBinding</RootNamespace>
14+
<AssemblyName>MopubVolleyBinding</AssemblyName>
15+
<FileAlignment>512</FileAlignment>
16+
<Deterministic>True</Deterministic>
17+
<AndroidUseLatestPlatformSdk>false</AndroidUseLatestPlatformSdk>
18+
<TargetFrameworkVersion>v9.0</TargetFrameworkVersion>
19+
<AndroidClassParser>class-parse</AndroidClassParser>
20+
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
21+
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
22+
</PropertyGroup>
23+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
24+
<DebugSymbols>true</DebugSymbols>
25+
<DebugType>portable</DebugType>
26+
<Optimize>false</Optimize>
27+
<OutputPath>bin\Debug\</OutputPath>
28+
<DefineConstants>DEBUG;TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
33+
<DebugType>portable</DebugType>
34+
<Optimize>true</Optimize>
35+
<OutputPath>bin\Release\</OutputPath>
36+
<DefineConstants>TRACE</DefineConstants>
37+
<ErrorReport>prompt</ErrorReport>
38+
<WarningLevel>4</WarningLevel>
39+
</PropertyGroup>
40+
<ItemGroup>
41+
<Reference Include="Mono.Android" />
42+
<Reference Include="System" />
43+
<Reference Include="System.Core" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Compile Include="Properties\AssemblyInfo.cs" />
47+
</ItemGroup>
48+
<ItemGroup>
49+
<None Include="Jars\AboutJars.txt" />
50+
<None Include="Additions\AboutAdditions.txt" />
51+
<LibraryProjectZip Include="Jars\mopub-volley-release.aar" />
52+
</ItemGroup>
53+
<ItemGroup>
54+
<TransformFile Include="Transforms\Metadata.xml" />
55+
<TransformFile Include="Transforms\EnumFields.xml" />
56+
<TransformFile Include="Transforms\EnumMethods.xml" />
57+
</ItemGroup>
58+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
59+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
60+
Other similar extension points exist, see Microsoft.Common.targets.
61+
<Target Name="BeforeBuild">
62+
</Target>
63+
<Target Name="AfterBuild">
64+
</Target>
65+
-->
66+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
using Android.App;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("MopubVolleyBinding")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("MopubVolleyBinding")]
14+
[assembly: AssemblyCopyright("Copyright © 2018")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
[assembly: AssemblyVersion("1.0.0.0")]
26+
[assembly: AssemblyFileVersion("1.0.0.0")]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<enum-field-mappings>
2+
<!--
3+
This example converts the constants Fragment_id, Fragment_name,
4+
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
5+
to an enum called Android.Support.V4.App.FragmentTagType with values
6+
Id, Name, and Tag.
7+
8+
<mapping jni-class="android/support/v4/app/FragmentActivity$FragmentTag" clr-enum-type="Android.Support.V4.App.FragmentTagType">
9+
<field jni-name="Fragment_name" clr-name="Name" value="0" />
10+
<field jni-name="Fragment_id" clr-name="Id" value="1" />
11+
<field jni-name="Fragment_tag" clr-name="Tag" value="2" />
12+
</mapping>
13+
-->
14+
</enum-field-mappings>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<enum-method-mappings>
2+
<!--
3+
This example changes the Java method:
4+
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
5+
to be:
6+
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
7+
when bound in C#.
8+
9+
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
10+
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
11+
</mapping>
12+
-->
13+
</enum-method-mappings>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<metadata>
2+
<!--
3+
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
4+
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
5+
6+
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
7+
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
8+
-->
9+
10+
<attr path="/api/package[@name='com.mopub.volley']/class[@name='Request']/method[@name='getMethod' and count(parameter)=0]" name="name">MethodInt</attr>
11+
12+
<add-node path="/api/package[@name='com.mopub.volley.toolbox']/class[@name='ClearCacheRequest']">
13+
<method name="compareTo" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public">
14+
<parameter name="o" type="java.lang.Object" />
15+
</method>
16+
</add-node>
17+
18+
<add-node path="/api/package[@name='com.mopub.volley.toolbox']/class[@name='ImageRequest']">
19+
<method name="compareTo" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public">
20+
<parameter name="o" type="java.lang.Object" />
21+
</method>
22+
</add-node>
23+
24+
<add-node path="/api/package[@name='com.mopub.volley.toolbox']/class[@name='ImageRequest']">
25+
<method name="deliverResponse" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="protected">
26+
<parameter name="p0" type="java.lang.Object" />
27+
</method>
28+
</add-node>
29+
30+
<add-node path="/api/package[@name='com.mopub.volley.toolbox']/class[@name='JsonArrayRequest']">
31+
<method name="compareTo" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public">
32+
<parameter name="o" type="java.lang.Object" />
33+
</method>
34+
</add-node>
35+
36+
<add-node path="/api/package[@name='com.mopub.volley.toolbox']/class[@name='JsonObjectRequest']">
37+
<method name="compareTo" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public">
38+
<parameter name="o" type="java.lang.Object" />
39+
</method>
40+
</add-node>
41+
42+
<add-node path="/api/package[@name='com.mopub.volley.toolbox']/class[@name='StringRequest']">
43+
<method name="compareTo" return="int" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public">
44+
<parameter name="o" type="java.lang.Object" />
45+
</method>
46+
</add-node>
47+
48+
<add-node path="/api/package[@name='com.mopub.volley.toolbox']/class[@name='StringRequest']">
49+
<method name="deliverResponse" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="protected">
50+
<parameter name="p0" type="java.lang.Object" />
51+
</method>
52+
</add-node>
53+
54+
<remove-node path="/api/package[@name='com.mopub.volley.toolbox']/class[@name='JsonRequest']/method[@name='parseNetworkResponse' and count(parameter)=1 and parameter[1][@type='com.mopub.volley.NetworkResponse']]" />
55+
56+
<remove-node path="/api/package[@name='com.mopub.volley']/class[@name='RequestQueue']" />
57+
</metadata>

mopub-android-xamarin.sln

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 14
4-
VisualStudioVersion = 14.0.25420.1
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30611.23
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MopubSdkAndroidBinding", "mopub-sdk-android-binding\MopubSdkAndroidBinding.csproj", "{7EB648A0-D2FE-49B5-B373-4E1B2C8AFF66}"
77
EndProject
@@ -17,6 +17,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MopubSdkNativeVideoAndroidB
1717
EndProject
1818
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MopubSdkRewardeVideoAndroidBinding", "mopub-sdk-rewardedvideo-android-binding\MopubSdkRewardeVideoAndroidBinding.csproj", "{C19FEA8C-B55E-4BDC-A4C1-B296810CA5F8}"
1919
EndProject
20+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MopubVolleyBinding", "MopubVolleyBinding\MopubVolleyBinding.csproj", "{D5E1D972-ADD9-44FD-9631-54BD4899C5BC}"
21+
EndProject
2022
Global
2123
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2224
Debug|Any CPU = Debug|Any CPU
@@ -51,8 +53,15 @@ Global
5153
{C19FEA8C-B55E-4BDC-A4C1-B296810CA5F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
5254
{C19FEA8C-B55E-4BDC-A4C1-B296810CA5F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
5355
{C19FEA8C-B55E-4BDC-A4C1-B296810CA5F8}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{D5E1D972-ADD9-44FD-9631-54BD4899C5BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{D5E1D972-ADD9-44FD-9631-54BD4899C5BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{D5E1D972-ADD9-44FD-9631-54BD4899C5BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
59+
{D5E1D972-ADD9-44FD-9631-54BD4899C5BC}.Release|Any CPU.Build.0 = Release|Any CPU
5460
EndGlobalSection
5561
GlobalSection(SolutionProperties) = preSolution
5662
HideSolutionNode = FALSE
5763
EndGlobalSection
64+
GlobalSection(ExtensibilityGlobals) = postSolution
65+
SolutionGuid = {E9CF70C6-C2ED-452A-8E57-962EA9F4EAE6}
66+
EndGlobalSection
5867
EndGlobal

0 commit comments

Comments
 (0)