Initial code transfer to public repo
|
@ -0,0 +1,19 @@
|
|||
tools/
|
||||
bin/
|
||||
obj/
|
||||
packages/
|
||||
externals/
|
||||
output/
|
||||
|
||||
*.xam
|
||||
*.DS_Store
|
||||
*.pidb
|
||||
*.userprefs
|
||||
*.dotSettings
|
||||
*.suo
|
||||
*.a
|
||||
*.xcuserstate
|
||||
*.xcuserstate
|
||||
|
||||
Resource.designer.cs
|
||||
component.yaml
|
|
@ -0,0 +1,131 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V4", "v4\source\V4.csproj", "{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V13", "v13\source\V13.csproj", "{69351B41-DA07-42F6-9083-0080EBC6407D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-CardView", "v7-cardview\source\V7-CardView.csproj", "{E9848EF1-14E6-4144-95A0-926A52F301B5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-GridLayout", "v7-gridlayout\source\V7-GridLayout.csproj", "{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-RecyclerView", "v7-recyclerview\source\V7-RecyclerView.csproj", "{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-Palette", "v7-palette\source\V7-Palette.csproj", "{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-Preference", "v7-preference\source\V7-Preference.csproj", "{A419C738-BD3D-4460-97E9-B8E44FC26896}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-AppCompat", "v7-appcompat\source\V7-AppCompat.csproj", "{B4ED245B-BBD8-4549-9990-476A36AAD381}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V8-RenderScript", "v8-renderscript\source\V8-RenderScript.csproj", "{732E9891-9FEE-4493-8C1C-C06F12C5248B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V14-Preference", "v14-preference\source\V14-Preference.csproj", "{E2ACB402-B348-4CD9-9686-9F029DCB3277}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-MediaRouter", "v7-mediarouter\source\V7-MediaRouter.csproj", "{9E11B536-73E2-4BC6-9921-92889CF089CB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V17-Leanback", "v17-leanback\source\V17-Leanback.csproj", "{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V17-Preference-Leanback", "v17-preference-leanback\source\V17-Preference-Leanback.csproj", "{6948B25E-4A71-4F31-B042-D21B0B99ADA1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomTabs", "customtabs\source\CustomTabs.csproj", "{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Design", "design\source\Design.csproj", "{8022A1F5-C228-4B21-8194-BC9E76F9174A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Percent", "percent\source\Percent.csproj", "{A557F298-10FD-4F47-8C96-20387E2AA741}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Recommendation", "recommendation\source\Recommendation.csproj", "{257D3C55-FADE-4C65-9967-7DCDE23F83A8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Animated-Vector-Drawable", "animated-vector-drawable\source\Animated-Vector-Drawable.csproj", "{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vector-Drawable", "vector-drawable\source\Vector-Drawable.csproj", "{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vector-Drawable-BuildTasks", "vector-drawable\buildtask\Vector-Drawable-BuildTasks.csproj", "{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{257D3C55-FADE-4C65-9967-7DCDE23F83A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{257D3C55-FADE-4C65-9967-7DCDE23F83A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{257D3C55-FADE-4C65-9967-7DCDE23F83A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{257D3C55-FADE-4C65-9967-7DCDE23F83A8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{69351B41-DA07-42F6-9083-0080EBC6407D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{69351B41-DA07-42F6-9083-0080EBC6407D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{69351B41-DA07-42F6-9083-0080EBC6407D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{69351B41-DA07-42F6-9083-0080EBC6407D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{6948B25E-4A71-4F31-B042-D21B0B99ADA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{6948B25E-4A71-4F31-B042-D21B0B99ADA1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{6948B25E-4A71-4F31-B042-D21B0B99ADA1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{6948B25E-4A71-4F31-B042-D21B0B99ADA1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{732E9891-9FEE-4493-8C1C-C06F12C5248B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{732E9891-9FEE-4493-8C1C-C06F12C5248B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{732E9891-9FEE-4493-8C1C-C06F12C5248B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{732E9891-9FEE-4493-8C1C-C06F12C5248B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9E11B536-73E2-4BC6-9921-92889CF089CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9E11B536-73E2-4BC6-9921-92889CF089CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9E11B536-73E2-4BC6-9921-92889CF089CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9E11B536-73E2-4BC6-9921-92889CF089CB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A419C738-BD3D-4460-97E9-B8E44FC26896}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A419C738-BD3D-4460-97E9-B8E44FC26896}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A419C738-BD3D-4460-97E9-B8E44FC26896}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A419C738-BD3D-4460-97E9-B8E44FC26896}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A557F298-10FD-4F47-8C96-20387E2AA741}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A557F298-10FD-4F47-8C96-20387E2AA741}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A557F298-10FD-4F47-8C96-20387E2AA741}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A557F298-10FD-4F47-8C96-20387E2AA741}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D33F5F79-994B-4C34-BCC3-2B30CB630F1B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D9C9670F-8B06-4083-9EEF-42E4D1DE22C1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DA26C0C2-286A-4B41-9DF7-84D7E5D00C68}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{DB19F806-FEF2-4BBB-8A0B-37EA54DB3A0D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E2ACB402-B348-4CD9-9686-9F029DCB3277}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E2ACB402-B348-4CD9-9686-9F029DCB3277}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E2ACB402-B348-4CD9-9686-9F029DCB3277}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E2ACB402-B348-4CD9-9686-9F029DCB3277}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,79 @@
|
|||
# Xamarin Component for Android Support Library
|
||||
|
||||
Xamarin creates and maintains Xamarin.Android bindings for the Google Android Support Libraries, including:
|
||||
|
||||
- Design
|
||||
- Animated Vector Drawable
|
||||
- Vector Drawable
|
||||
- Custom Tabs
|
||||
- Recommendation
|
||||
- Support v4
|
||||
- Support v13
|
||||
- Support v7 AppCompat
|
||||
- Support v7 CardView
|
||||
- Support v7 GridLayout
|
||||
- Support v7 MediaRouter
|
||||
- Support v7 Palette
|
||||
- Support v7 Preference
|
||||
- Support v7 RecyclerView
|
||||
- Support v8 RenderScript
|
||||
- Support v14 Preference
|
||||
- Support v17 Leanback
|
||||
- Support v17 Preference Leanback
|
||||
|
||||
|
||||
|
||||
## Building
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Mac OSX 10.11 or higher / Windows 10 or higher (experimental support only)
|
||||
- Xamarin.Android 6.0 or higher
|
||||
- Mono 4.3 or higher
|
||||
- Java JDK 1.7 or higher
|
||||
- Android SDK with API Levels 15, 16, 17, 18, 21, 23
|
||||
|
||||
|
||||
### Build Scripts
|
||||
The build script for this project uses [Cake](http://cakebuild.net). To run the build, you can use one of the bootstrapper files either for Mac or Windows:
|
||||
|
||||
**Mac**:
|
||||
```
|
||||
sh build.sh -target libs
|
||||
```
|
||||
|
||||
**Windows (experimental support only)**:
|
||||
|
||||
***NOTE:*** Windows build support is still experimental. You may need to first build the `externals` target, then open the `GooglePlayServices.sln` in Visual Studio, rebuild it, build the `clean` target, and then continue on normally building whichever targets you like. This will ensure the appropriate files are downloaded and cached in your user's AppData folder.
|
||||
|
||||
```
|
||||
powershell .\build.ps1 -Target libs
|
||||
```
|
||||
|
||||
The bootstrapper script will automatically download Cake.exe and all the required tools and files into the `./tools/` folder.
|
||||
|
||||
The following targets can be specified:
|
||||
|
||||
- `libs` builds the class library bindings (depends on `externals`)
|
||||
- `externals` downloads the external dependencies
|
||||
- `samples` builds all of the samples (depends on `libs`)
|
||||
- `nuget` builds the nuget packages (depends on `libs`)
|
||||
- `component` builds the xamarin components (depends on `samples` and `nuget`)
|
||||
- `clean` cleans up everything
|
||||
|
||||
***NOTE***: The `externals` build task may take awhile to run as it downloads several large dependencies.
|
||||
|
||||
You may want to consider passing `-verbosity diagnostic` to the bootstrapper to enable more verbose output, including downloading progress.
|
||||
|
||||
|
||||
### Working in Visual Studio / Xamarin Studio
|
||||
|
||||
Before the `.sln` files will compile in Visual Studio or Xamarin Studio, the external dependencies need to be downloaded. This can be done by running the `build.sh` or `build.ps1` with the target `externals`. After the externals are setup, the `.sln` files should compile in an IDE.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
The license for this repository is specified in
|
||||
[LICENSE.md](LICENSE.md)
|
||||
|
||||
The `externals` build task downloads some external dependencies from Google which are licensed under and subject to the terms of [Android Software Development Kit License Agreement](http://developer.android.com/sdk/terms.html)
|
|
@ -0,0 +1,5 @@
|
|||
static class __SupportConsts {
|
||||
public const string Url = "https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip";
|
||||
public const string Version = "23.3.0.0";
|
||||
public const string AarVersion = "23.3.0";
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
# Animated Vector Drawable Android Support Library
|
||||
|
||||
|
||||
This library adds support for Animated Vector Drawables in older Android API Levels.
|
||||
|
||||
|
||||
|
||||
|
||||
## Android Support Libraries
|
||||
|
||||
The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.
|
||||
|
||||
Including the Support Libraries in your Android project is considered a best practice for application developers, depending on the range of platform versions your app is targeting and the APIs that it uses. Using the features the libraries provide can help you improve the look of your application, increase performance and broaden the reach of your application to more users.
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
# Animated Vector Drawable Android Support Library
|
||||
|
||||
|
||||
This library adds support for Animated Vector Drawables in older Android API Levels.
|
||||
|
||||
|
||||
{GENERAL}
|
|
@ -0,0 +1,121 @@
|
|||
|
||||
This library adds support for utilizing Vector drawable graphics on devices running Android API Level 11 or higher.
|
||||
|
||||
### Target SDK Version
|
||||
NOTE: Using this support library requires that your app have its Target Android Version (*targetSdkVersion*) set to Lollipop (5.0 - API Level 21) or higher, or you will have *aapt* related compile errors. You can still set the Target Framework which your app is compiled against as low as Android 4.0.3 (API Level 15).
|
||||
|
||||
|
||||
Using Animated Vector Drawables
|
||||
------
|
||||
|
||||
To use your vector drawable, you should also reference the **AppCompat v7 Support Library** in your app.
|
||||
|
||||
Your activity should derive from `AppCompatActivity` so that the `AppCompatImageView` is automatically used at runtime where you have defined `ImageView` types.
|
||||
|
||||
Here is an example of an animated vector. It is created by defining multiple resources.
|
||||
|
||||
1. Create a vector image by creating a file `Resources/drawable/vector.xml` with the contents:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="64dp"
|
||||
android:width="64dp"
|
||||
android:viewportHeight="600"
|
||||
android:viewportWidth="600" >
|
||||
<group
|
||||
android:name="rotationGroup"
|
||||
android:pivotX="300.0"
|
||||
android:pivotY="300.0"
|
||||
android:rotation="45.0" >
|
||||
<path
|
||||
android:name="v"
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" />
|
||||
</group>
|
||||
</vector>
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
2. Create a file `Resources/anim/path_morph.xml` with the contents:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<objectAnimator
|
||||
android:duration="3000"
|
||||
android:propertyName="pathData"
|
||||
android:valueFrom="M300,70 l 0,-70 70,70 0,0 -70,70z"
|
||||
android:valueTo="M300,70 l 0,-70 70,0 0,140 -70,0 z"
|
||||
android:valueType="pathType"/>
|
||||
</set>
|
||||
```
|
||||
|
||||
|
||||
3. Create a file `Resources/anim/rotation.xml` with the contents:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<objectAnimator
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="6000"
|
||||
android:propertyName="rotation"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="360" />
|
||||
```
|
||||
|
||||
|
||||
Finally, create an animated vector drawable file `Resources/anim/avd.xml` to tie the vector and animations together with the contents:
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<animated-vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/vector" >
|
||||
<target
|
||||
android:name="rotationGroup"
|
||||
android:animation="@anim/rotation" />
|
||||
<target
|
||||
android:name="v"
|
||||
android:animation="@anim/path_morph" />
|
||||
</animated-vector>
|
||||
```
|
||||
|
||||
You can then reference your vector drawable programmatically, or declaratively in your android layout xml.
|
||||
|
||||
To use your vector drawable programmatically:
|
||||
|
||||
```csharp
|
||||
imageView.SetImageResource (Resource.Drawable.avd);
|
||||
```
|
||||
|
||||
To specify the vector in your layout file, use the `app:srcCompat` attribute (be sure to define the `xmlns:app` namespace as well):
|
||||
|
||||
```xml
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageView
|
||||
app:srcCompat="@drawable/avd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/imageView" />
|
||||
</LinearLayout>
|
||||
```
|
||||
|
||||
Finally, you will need to start the animation from your code:
|
||||
|
||||
```csharp
|
||||
imageView.Drawable.JavaCast<Android.Graphics.Drawables.IAnimatable> ().Start ();
|
||||
```
|
||||
|
||||
|
||||
**NOTE:** The `Xamarin.Android.Support.Vector.Drawable` nuget package contains a .targets file which appends the argument `--no-version-vectors` to `AndroidResgenExtraArgs` build property value to ensure the parameter is passed to the `aapt` invocation.
|
|
@ -0,0 +1,39 @@
|
|||
version: $version$
|
||||
name: Android Support Library Animated Vector Drawable
|
||||
id: xamandroidsupportanimatedvector
|
||||
publisher: Xamarin Inc.
|
||||
publisher-url: http://xamarin.com
|
||||
src-url: https://github.com/xamarin/AndroidSupportComponents
|
||||
summary: Provide backward-compatible versions of Android framework APIs.
|
||||
license: ../../component/License.md
|
||||
icons:
|
||||
- icons/xamandroidsupportanimatedvector_128x128.png
|
||||
- icons/xamandroidsupportanimatedvector_512x512.png
|
||||
libraries:
|
||||
android:
|
||||
- ../../output/Xamarin.Android.Support.Animated.Vector.Drawable.dll
|
||||
- ../../output/Xamarin.Android.Support.Vector.Drawable.dll
|
||||
- ../../output/Xamarin.Android.Support.v4.dll
|
||||
is_shell: true
|
||||
packages:
|
||||
android:
|
||||
- Xamarin.Android.Support.Animated.Vector.Drawable, Version=$nuget-version$
|
||||
samples:
|
||||
- name: "Vector Drawable Sample"
|
||||
path: ../samples/VectorDrawableSample.sln
|
||||
removeProjects:
|
||||
- V4
|
||||
- V7-AppCompat
|
||||
- Vector-Drawable
|
||||
- Animated-Vector-Drawable
|
||||
installNuGets:
|
||||
- project: VectorDrawableSample
|
||||
packages:
|
||||
- Xamarin.Android.Support.v4
|
||||
- Xamarin.Android.Support.v7.AppCompat
|
||||
- Xamarin.Android.Support.Vector.Drawable
|
||||
- Xamarin.Android.Support.Animated.Vector.Drawable
|
||||
removeNodes:
|
||||
- "//xNS:Import[contains (@Project, 'Xamarin.Android.Support.Vector.Drawable.targets')]"
|
||||
local-nuget-repo: ../../output
|
||||
no_build: true
|
Двоичные данные
animated-vector-drawable/component/icons/xamandroidsupportanimatedvector_128x128.png
Normal file
После Ширина: | Высота: | Размер: 9.7 KiB |
Двоичные данные
animated-vector-drawable/component/icons/xamandroidsupportanimatedvector_512x512.png
Normal file
После Ширина: | Высота: | Размер: 98 KiB |
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>Xamarin.Android.Support.Animated.Vector.Drawable</id>
|
||||
<title>Xamarin Android Support Library - Animated Vector Drawable</title>
|
||||
<version>$version$</version>
|
||||
<authors>Xamarin Inc.</authors>
|
||||
<owners>Xamarin Inc.</owners>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<description>Animated Vector Drawable Android Support Library C# bindings for Xamarin</description>
|
||||
<copyright>Copyright 2013-2016</copyright>
|
||||
<projectUrl>https://components.xamarin.com/view/xamandroidsupportanimatedvector</projectUrl>
|
||||
<licenseUrl>https://components.xamarin.com/license/xamandroidsupportanimatedvector</licenseUrl>
|
||||
<iconUrl>https://xamarin-component-icons.s3.amazonaws.com/Xamarin.Android.Support.Animated.Vector.Drawable.png</iconUrl>
|
||||
<dependencies>
|
||||
<dependency id="Xamarin.Android.Support.v4" version="[$version$]"/>
|
||||
<dependency id="Xamarin.Android.Support.Vector.Drawable" version="[$version$]"/>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="output/Xamarin.Android.Support.Animated.Vector.Drawable.dll" target="lib\MonoAndroid403" />
|
||||
</files>
|
||||
</package>
|
|
@ -0,0 +1,41 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VectorDrawableSample", "VectorDrawableSample\VectorDrawableSample.csproj", "{05B87270-652B-438E-BCFF-AC65BC4C892F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-AppCompat", "..\..\v7-appcompat\source\V7-AppCompat.csproj", "{B4ED245B-BBD8-4549-9990-476A36AAD381}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V4", "..\..\v4\source\V4.csproj", "{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Animated-Vector-Drawable", "..\source\Animated-Vector-Drawable.csproj", "{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vector-Drawable", "..\..\vector-drawable\source\Vector-Drawable.csproj", "{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{05B87270-652B-438E-BCFF-AC65BC4C892F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{05B87270-652B-438E-BCFF-AC65BC4C892F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{05B87270-652B-438E-BCFF-AC65BC4C892F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{05B87270-652B-438E-BCFF-AC65BC4C892F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,19 @@
|
|||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with your package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
|
@ -0,0 +1,28 @@
|
|||
using Android.App;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
using Android.Runtime;
|
||||
|
||||
namespace VectorDrawableSample
|
||||
{
|
||||
[Activity (Label = "Animated Vector Drawable Sample", MainLauncher = true, Icon = "@mipmap/icon")]
|
||||
public class MainActivity : Android.Support.V7.App.AppCompatActivity
|
||||
{
|
||||
protected override void OnCreate (Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate (savedInstanceState);
|
||||
|
||||
// Set our view from the "main" layout resource
|
||||
SetContentView (Resource.Layout.Main);
|
||||
|
||||
// Get our image view
|
||||
var iv = FindViewById<ImageView> (Resource.Id.imageView);
|
||||
|
||||
// Start the animation
|
||||
var avd = iv.Drawable.JavaCast<Android.Graphics.Drawables.IAnimatable> ();
|
||||
avd.Start ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.xamarin.animatedvectordrawablesample">
|
||||
<uses-sdk android:minSdkVersion="15" />
|
||||
<application android:allowBackup="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:theme="@style/Theme.AppCompat.DayNight"></application>
|
||||
</manifest>
|
|
@ -0,0 +1,28 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Android.App;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("VectorDrawableSample")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("Xamarin")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("Xamarin")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.0")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.axml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.axml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called "R"
|
||||
(this is an Android convention) that contains the tokens for each one of the resources
|
||||
included. For example, for the above Resources layout, this is what the R class would expose:
|
||||
|
||||
public class R {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
|
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<set
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<objectAnimator
|
||||
android:duration="3000"
|
||||
android:propertyName="pathData"
|
||||
android:valueFrom="M300,70 l 0,-70 70,70 0,0 -70,70z"
|
||||
android:valueTo="M300,70 l 0,-70 70,0 0,140 -70,0 z"
|
||||
android:valueType="pathType"/>
|
||||
</set>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<objectAnimator
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:duration="6000"
|
||||
android:propertyName="rotation"
|
||||
android:valueFrom="0"
|
||||
android:valueTo="360" />
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<animated-vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/vector" >
|
||||
<target
|
||||
android:name="rotationGroup"
|
||||
android:animation="@anim/rotation" />
|
||||
<target
|
||||
android:name="v"
|
||||
android:animation="@anim/path_morph" />
|
||||
</animated-vector>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="64dp"
|
||||
android:width="64dp"
|
||||
android:viewportHeight="600"
|
||||
android:viewportWidth="600" >
|
||||
<group
|
||||
android:name="rotationGroup"
|
||||
android:pivotX="300.0"
|
||||
android:pivotY="300.0"
|
||||
android:rotation="45.0" >
|
||||
<path
|
||||
android:name="v"
|
||||
android:fillColor="#000000"
|
||||
android:pathData="M300,70 l 0,-70 70,70 0,0 -70,70z" />
|
||||
</group>
|
||||
</vector>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<ImageView
|
||||
app:srcCompat="@drawable/avd"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="fill_parent"
|
||||
android:layout_weight="1"
|
||||
android:id="@+id/imageView" />
|
||||
</LinearLayout>
|
Двоичные данные
animated-vector-drawable/samples/VectorDrawableSample/Resources/mipmap-hdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 2.1 KiB |
Двоичные данные
animated-vector-drawable/samples/VectorDrawableSample/Resources/mipmap-mdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
animated-vector-drawable/samples/VectorDrawableSample/Resources/mipmap-xhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 3.2 KiB |
Двоичные данные
animated-vector-drawable/samples/VectorDrawableSample/Resources/mipmap-xxhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 5.3 KiB |
Двоичные данные
animated-vector-drawable/samples/VectorDrawableSample/Resources/mipmap-xxxhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 7.6 KiB |
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="hello">Hello World, Click Me!</string>
|
||||
<string name="app_name">VectorDrawableSample</string>
|
||||
</resources>
|
|
@ -0,0 +1,89 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{05B87270-652B-438E-BCFF-AC65BC4C892F}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>VectorDrawableSample</RootNamespace>
|
||||
<AssemblyName>VectorDrawableSample</AssemblyName>
|
||||
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>true</AndroidUseLatestPlatformSdk>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\drawable\vector.xml" />
|
||||
<AndroidResource Include="Resources\drawable\avd.xml" />
|
||||
<AndroidResource Include="Resources\anim\rotation.xml" />
|
||||
<AndroidResource Include="Resources\anim\path_morph.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\v7-appcompat\source\V7-AppCompat.csproj">
|
||||
<Project>{B4ED245B-BBD8-4549-9990-476A36AAD381}</Project>
|
||||
<Name>V7-AppCompat</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\v4\source\V4.csproj">
|
||||
<Project>{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}</Project>
|
||||
<Name>V4</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\animated-vector-drawable\source\Animated-Vector-Drawable.csproj">
|
||||
<Project>{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}</Project>
|
||||
<Name>Animated-Vector-Drawable</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\vector-drawable\source\Vector-Drawable.csproj">
|
||||
<Project>{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}</Project>
|
||||
<Name>Vector-Drawable</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<Import Project="..\..\..\vector-drawable\buildtask\bin\Release\Xamarin.Android.Support.Vector.Drawable.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
|
||||
namespace Android.Support.Graphics.Drawable
|
||||
{
|
||||
public partial class AnimatedVectorDrawableCompat
|
||||
{
|
||||
public override void SetAlpha (int alpha)
|
||||
{
|
||||
Alpha = alpha;
|
||||
}
|
||||
|
||||
// [Register ("setColorFilter", "(Landroid/graphics/ColorFilter;)V", "GetSetColorFilter_Landroid_graphics_ColorFilter_Handler")]
|
||||
// public override void SetColorFilter (Android.Graphics.ColorFilter cf)
|
||||
// {
|
||||
//
|
||||
// }
|
||||
// // Metadata.xml XPath method reference: path="/api/package[@name='android.support.graphics.drawable']/class[@name='VectorDrawableCompat']/method[@name='setColorFilter' and count(parameter)=1 and parameter[1][@type='android.graphics.ColorFilter']]"
|
||||
// [Register ("setColorFilter", "(Landroid/graphics/ColorFilter;)V", "GetSetColorFilter_Landroid_graphics_ColorFilter_Handler")]
|
||||
// set {
|
||||
// if (id_setColorFilter_Landroid_graphics_ColorFilter_ == IntPtr.Zero)
|
||||
// id_setColorFilter_Landroid_graphics_ColorFilter_ = JNIEnv.GetMethodID (class_ref, "setColorFilter", "(Landroid/graphics/ColorFilter;)V");
|
||||
// try {
|
||||
// JValue* __args = stackalloc JValue [1];
|
||||
// __args [0] = new JValue (value);
|
||||
//
|
||||
// if (GetType () == ThresholdType)
|
||||
// JNIEnv.CallVoidMethod (Handle, id_setColorFilter_Landroid_graphics_ColorFilter_, __args);
|
||||
// else
|
||||
// JNIEnv.CallNonvirtualVoidMethod (Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setColorFilter", "(Landroid/graphics/ColorFilter;)V"), __args);
|
||||
// } finally {
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{75CB848E-6EE8-4DAF-8AD4-1782641F69D3}</ProjectGuid>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Xamarin.Android.Support.Animated.Vector.Drawable</RootNamespace>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
|
||||
<AssemblyName>Xamarin.Android.Support.Animated.Vector.Drawable</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0.3</TargetFrameworkVersion>
|
||||
<!-- <SignAssembly>true</SignAssembly>
|
||||
<DelaySign>true</DelaySign>
|
||||
<AssemblyOriginatorKeyFile>publickey.snk</AssemblyOriginatorKeyFile> -->
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;__MOBILE__;__ANDROID__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<DefineConstants>__MOBILE__;__ANDROID__;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<DroidDocPaths>..\..\externals\docs\reference</DroidDocPaths>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="..\..\SupportConsts.cs">
|
||||
<Link>Properties\SupportConsts.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Additions\Additions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Jars\AboutJars.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<TransformFile Include="Transforms\EnumFields.xml" />
|
||||
<TransformFile Include="Transforms\EnumMethods.xml" />
|
||||
<TransformFile Include="Transforms\Metadata.xml" />
|
||||
<TransformFile Include="Transforms\Metadata.generated.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\v4\source\V4.csproj">
|
||||
<Project>{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}</Project>
|
||||
<Name>V4</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\vector-drawable\source\Vector-Drawable.csproj">
|
||||
<Project>{418B64BA-2BAC-4B92-8888-CAFEAAF7E860}</Project>
|
||||
<Name>Vector-Drawable</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InputJar Include="..\..\externals\animated-vector-drawable\classes.jar">
|
||||
<Link>Jars\animated-vector-drawable-aar.jar</Link>
|
||||
</InputJar>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="Additions\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,37 @@
|
|||
This directory is for Android .jars.
|
||||
|
||||
There are 3 types of jars that are supported:
|
||||
|
||||
== Input Jar and Embedded Jar ==
|
||||
|
||||
This is the jar that bindings should be generated for.
|
||||
|
||||
For example, if you were binding the Google Maps library, this would
|
||||
be Google's "maps.jar".
|
||||
|
||||
The difference between EmbeddedJar and InputJar is, EmbeddedJar is to be
|
||||
embedded in the resulting dll as EmbeddedResource, while InputJar is not.
|
||||
There are couple of reasons you wouldn't like to embed the target jar
|
||||
in your dll (the ones that could be internally loaded by <uses-library>
|
||||
feature e.g. maps.jar, or you cannot embed jars that are under some
|
||||
proprietary license).
|
||||
|
||||
Set the build action for these jars in the properties page to "InputJar".
|
||||
|
||||
|
||||
== Reference Jar and Embedded Reference Jar ==
|
||||
|
||||
These are jars that are referenced by the input jar. C# bindings will
|
||||
not be created for these jars. These jars will be used to resolve
|
||||
types used by the input jar.
|
||||
|
||||
NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
|
||||
based on the Target Framework selected.
|
||||
|
||||
Set the build action for these jars in the properties page to "ReferenceJar".
|
||||
|
||||
"EmbeddedJar" works like "ReferenceJar", but like "EmbeddedJar", it is
|
||||
embedded in your dll. But at application build time, they are not included
|
||||
in the final apk, like ReferenceJar files.
|
||||
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Android.App;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
[assembly: AssemblyTitle ("Xamarin.Android.Support.Animated.Vector.Drawable")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("Xamarin Inc.")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("Xamarin Inc.")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
[assembly: AssemblyVersion ("1.0.0")]
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
||||
// GridLayout-v7
|
||||
[assembly: Java.Interop.JavaLibraryReference ("classes.jar",
|
||||
PackageName = __Consts.PackageName,
|
||||
SourceUrl = __SupportConsts.Url,
|
||||
EmbeddedArchive = __Consts.AarPath,
|
||||
Version = __SupportConsts.Version)]
|
||||
// GridLayout-v7 resources
|
||||
[assembly: Android.IncludeAndroidResourcesFromAttribute ("./",
|
||||
PackageName = __Consts.PackageName,
|
||||
SourceUrl = __SupportConsts.Url,
|
||||
EmbeddedArchive = __Consts.AarPath,
|
||||
Version = __SupportConsts.Version)]
|
||||
|
||||
static class __Consts {
|
||||
public const string PackageName = "Xamarin.Android.Support.Animated.Vector.Drawable";
|
||||
public const string AarPath = "m2repository/com/android/support/animated-vector-drawable/" + __SupportConsts.AarVersion + "/animated-vector-drawable-" + __SupportConsts.AarVersion + ".aar";
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<enum-field-mappings>
|
||||
<!--
|
||||
This example converts the constants Fragment_id, Fragment_name,
|
||||
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
|
||||
to an enum called Android.Support.V4.App.FragmentTagType with values
|
||||
Id, Name, and Tag.
|
||||
|
||||
<mapping clr-enum-type="Android.Support.V4.App.FragmentTagType" jni-class="android/support/v4/app/FragmentActivity$FragmentTag">
|
||||
<field clr-name="Id" jni-name="Fragment_id" value="1" />
|
||||
<field clr-name="Name" jni-name="Fragment_name" value="0" />
|
||||
<field clr-name="Tag" jni-name="Fragment_tag" value="2" />
|
||||
</type>
|
||||
|
||||
Notes:
|
||||
- An optional "bitfield" attribute marks the enum type with [Flags].
|
||||
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
|
||||
-->
|
||||
</enum-field-mappings>
|
|
@ -0,0 +1,18 @@
|
|||
<enum-method-mappings>
|
||||
<!--
|
||||
This example changes the Java method:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
|
||||
to be:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
|
||||
when bound in C#.
|
||||
|
||||
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
|
||||
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
|
||||
</mapping>
|
||||
|
||||
Notes:
|
||||
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
|
||||
- To change the type of the return value, use "return" as the parameter name.
|
||||
- The parameter names will be p0, p1, ... unless you provide JavaDoc file in the project.
|
||||
-->
|
||||
</enum-method-mappings>
|
|
@ -0,0 +1,28 @@
|
|||
<metadata>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='applyTheme' and count(parameter)=1 and parameter[1][@type='android.content.res.Resources.Theme']]/parameter[1]" name="managedName">tValue</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='create' and count(parameter)=2 and parameter[1][@type='android.content.Context'] and parameter[2][@type='int']]/parameter[1]" name="managedName">context</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='create' and count(parameter)=2 and parameter[1][@type='android.content.Context'] and parameter[2][@type='int']]/parameter[2]" name="managedName">resId</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='createFromXmlInner' and count(parameter)=5 and parameter[1][@type='android.content.Context'] and parameter[2][@type='android.content.res.Resources'] and parameter[3][@type='org.xmlpull.v1.XmlPullParser'] and parameter[4][@type='android.util.AttributeSet'] and parameter[5][@type='android.content.res.Resources.Theme']]/parameter[1]" name="managedName">context</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='createFromXmlInner' and count(parameter)=5 and parameter[1][@type='android.content.Context'] and parameter[2][@type='android.content.res.Resources'] and parameter[3][@type='org.xmlpull.v1.XmlPullParser'] and parameter[4][@type='android.util.AttributeSet'] and parameter[5][@type='android.content.res.Resources.Theme']]/parameter[2]" name="managedName">rValue</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='createFromXmlInner' and count(parameter)=5 and parameter[1][@type='android.content.Context'] and parameter[2][@type='android.content.res.Resources'] and parameter[3][@type='org.xmlpull.v1.XmlPullParser'] and parameter[4][@type='android.util.AttributeSet'] and parameter[5][@type='android.content.res.Resources.Theme']]/parameter[3]" name="managedName">parser</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='createFromXmlInner' and count(parameter)=5 and parameter[1][@type='android.content.Context'] and parameter[2][@type='android.content.res.Resources'] and parameter[3][@type='org.xmlpull.v1.XmlPullParser'] and parameter[4][@type='android.util.AttributeSet'] and parameter[5][@type='android.content.res.Resources.Theme']]/parameter[4]" name="managedName">attrs</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='createFromXmlInner' and count(parameter)=5 and parameter[1][@type='android.content.Context'] and parameter[2][@type='android.content.res.Resources'] and parameter[3][@type='org.xmlpull.v1.XmlPullParser'] and parameter[4][@type='android.util.AttributeSet'] and parameter[5][@type='android.content.res.Resources.Theme']]/parameter[5]" name="managedName">theme</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='draw' and count(parameter)=1 and parameter[1][@type='android.graphics.Canvas']]/parameter[1]" name="managedName">canvas</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='inflate' and count(parameter)=3 and parameter[1][@type='android.content.res.Resources'] and parameter[2][@type='org.xmlpull.v1.XmlPullParser'] and parameter[3][@type='android.util.AttributeSet']]/parameter[1]" name="managedName">res</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='inflate' and count(parameter)=3 and parameter[1][@type='android.content.res.Resources'] and parameter[2][@type='org.xmlpull.v1.XmlPullParser'] and parameter[3][@type='android.util.AttributeSet']]/parameter[2]" name="managedName">parser</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='inflate' and count(parameter)=3 and parameter[1][@type='android.content.res.Resources'] and parameter[2][@type='org.xmlpull.v1.XmlPullParser'] and parameter[3][@type='android.util.AttributeSet']]/parameter[3]" name="managedName">attrs</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='inflate' and count(parameter)=4 and parameter[1][@type='android.content.res.Resources'] and parameter[2][@type='org.xmlpull.v1.XmlPullParser'] and parameter[3][@type='android.util.AttributeSet'] and parameter[4][@type='android.content.res.Resources.Theme']]/parameter[1]" name="managedName">res</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='inflate' and count(parameter)=4 and parameter[1][@type='android.content.res.Resources'] and parameter[2][@type='org.xmlpull.v1.XmlPullParser'] and parameter[3][@type='android.util.AttributeSet'] and parameter[4][@type='android.content.res.Resources.Theme']]/parameter[2]" name="managedName">parser</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='inflate' and count(parameter)=4 and parameter[1][@type='android.content.res.Resources'] and parameter[2][@type='org.xmlpull.v1.XmlPullParser'] and parameter[3][@type='android.util.AttributeSet'] and parameter[4][@type='android.content.res.Resources.Theme']]/parameter[3]" name="managedName">attrs</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='inflate' and count(parameter)=4 and parameter[1][@type='android.content.res.Resources'] and parameter[2][@type='org.xmlpull.v1.XmlPullParser'] and parameter[3][@type='android.util.AttributeSet'] and parameter[4][@type='android.content.res.Resources.Theme']]/parameter[4]" name="managedName">theme</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='onBoundsChange' and count(parameter)=1 and parameter[1][@type='android.graphics.Rect']]/parameter[1]" name="managedName">bounds</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='onLevelChange' and count(parameter)=1 and parameter[1][@type='int']]/parameter[1]" name="managedName">level</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='onStateChange' and count(parameter)=1 and parameter[1][@type='int[]']]/parameter[1]" name="managedName">state</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setAlpha' and count(parameter)=1 and parameter[1][@type='int']]/parameter[1]" name="managedName">alpha</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setColorFilter' and count(parameter)=1 and parameter[1][@type='android.graphics.ColorFilter']]/parameter[1]" name="managedName">colorFilter</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setTint' and count(parameter)=1 and parameter[1][@type='int']]/parameter[1]" name="managedName">tint</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setTintList' and count(parameter)=1 and parameter[1][@type='android.content.res.ColorStateList']]/parameter[1]" name="managedName">tint</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setTintMode' and count(parameter)=1 and parameter[1][@type='android.graphics.PorterDuff.Mode']]/parameter[1]" name="managedName">tintMode</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setVisible' and count(parameter)=2 and parameter[1][@type='boolean'] and parameter[2][@type='boolean']]/parameter[1]" name="managedName">visible</attr>
|
||||
<attr path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setVisible' and count(parameter)=2 and parameter[1][@type='boolean'] and parameter[2][@type='boolean']]/parameter[2]" name="managedName">restart</attr>
|
||||
</metadata>
|
|
@ -0,0 +1,7 @@
|
|||
<metadata>
|
||||
|
||||
<remove-node path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setColorFilter' and count(parameter)=2 and parameter[1][@type='int'] and parameter[2][@type='android.graphics.PorterDuff.Mode']]" />
|
||||
|
||||
<remove-node path="/api/package[@name='android.support.graphics.drawable']/class[@name='AnimatedVectorDrawableCompat']/method[@name='setChangingConfigurations' and count(parameter)=1 and parameter[1][@type='int']]" />
|
||||
|
||||
</metadata>
|
|
@ -0,0 +1,316 @@
|
|||
#tool nuget:?package=ILRepack&version=2.0.10
|
||||
#tool nuget:?package=XamarinComponent&version=1.1.0.29
|
||||
|
||||
#addin nuget:?package=Cake.XCode&version=1.0.4.0
|
||||
#addin nuget:?package=Cake.Xamarin&version=1.3.0.1
|
||||
#addin nuget:?package=Cake.Xamarin.Build&version=1.0.11.0
|
||||
#addin nuget:?package=Cake.FileHelpers&version=1.0.3.2
|
||||
|
||||
var TARGET = Argument ("t", Argument ("target", "Default"));
|
||||
|
||||
var NUGET_VERSION = "23.3.0-beta1";
|
||||
var COMPONENT_VERSION = "23.3.0";
|
||||
var AAR_VERSION = "23.3.0";
|
||||
|
||||
// FROM: https://dl.google.com/android/repository/addon.xml
|
||||
var M2_REPOSITORY_URL = "https://dl-ssl.google.com/android/repository/android_m2repository_r29.zip";
|
||||
var BUILD_TOOLS_URL = "https://dl-ssl.google.com/android/repository/build-tools_r23-macosx.zip";
|
||||
var DOCS_URL = "https://dl-ssl.google.com/android/repository/docs-23_r01.zip";
|
||||
|
||||
var AAR_DIRS = new [] {
|
||||
"support-v4", "support-v13", "appcompat-v7", "gridlayout-v7", "mediarouter-v7", "recyclerview-v7",
|
||||
"palette-v7", "cardview-v7", "leanback-v17", "design", "percent", "customtabs", "preference-v7",
|
||||
"preference-v14", "preference-leanback-v17", "recommendation", "animated-vector-drawable",
|
||||
"support-vector-drawable"
|
||||
};
|
||||
|
||||
var MONODROID_PATH = "/Library/Frameworks/Xamarin.Android.framework/Versions/Current/lib/mandroid/platforms/android-23/";
|
||||
if (IsRunningOnWindows ())
|
||||
MONODROID_PATH = new DirectoryPath (Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86)).Combine ("Reference Assemblies/Microsoft/Framework/MonoAndroid/v6.0/").FullPath;
|
||||
|
||||
var buildSpec = new BuildSpec {
|
||||
Libs = new [] {
|
||||
new DefaultSolutionBuilder {
|
||||
SolutionPath = "./AndroidSupport.sln",
|
||||
BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac,
|
||||
OutputFiles = new [] {
|
||||
new OutputFileCopy { FromFile = "./customtabs/source/bin/Release/Xamarin.Android.Support.CustomTabs.dll" },
|
||||
new OutputFileCopy { FromFile = "./design/source/bin/Release/Xamarin.Android.Support.Design.dll" },
|
||||
new OutputFileCopy { FromFile = "./percent/source/bin/Release/Xamarin.Android.Support.Percent.dll" },
|
||||
new OutputFileCopy { FromFile = "./recommendation/source/bin/Release/Xamarin.Android.Support.Recommendation.dll" },
|
||||
new OutputFileCopy { FromFile = "./v4/source/bin/Release/Xamarin.Android.Support.v4.dll" },
|
||||
new OutputFileCopy { FromFile = "./v7-appcompat/source/bin/Release/Xamarin.Android.Support.v7.AppCompat.dll" },
|
||||
new OutputFileCopy { FromFile = "./v7-cardview/source/bin/Release/Xamarin.Android.Support.v7.CardView.dll" },
|
||||
new OutputFileCopy { FromFile = "./v7-gridlayout/source/bin/Release/Xamarin.Android.Support.v7.GridLayout.dll" },
|
||||
new OutputFileCopy { FromFile = "./v7-mediarouter/source/bin/Release/Xamarin.Android.Support.v7.MediaRouter.dll" },
|
||||
new OutputFileCopy { FromFile = "./v7-palette/source/bin/Release/Xamarin.Android.Support.v7.Palette.dll" },
|
||||
new OutputFileCopy { FromFile = "./v7-preference/source/bin/Release/Xamarin.Android.Support.v7.Preference.dll" },
|
||||
new OutputFileCopy { FromFile = "./v7-recyclerview/source/bin/Release/Xamarin.Android.Support.v7.RecyclerView.dll" },
|
||||
new OutputFileCopy { FromFile = "./v8-renderscript/source/bin/Release/Xamarin.Android.Support.v8.RenderScript.dll" },
|
||||
new OutputFileCopy { FromFile = "./v13/source/bin/Release/Xamarin.Android.Support.v13.dll" },
|
||||
new OutputFileCopy { FromFile = "./v14-preference/source/bin/Release/Xamarin.Android.Support.v14.Preference.dll" },
|
||||
new OutputFileCopy { FromFile = "./v17-leanback/source/bin/Release/Xamarin.Android.Support.v17.Leanback.dll" },
|
||||
new OutputFileCopy { FromFile = "./v17-preference-leanback/source/bin/Release/Xamarin.Android.Support.v17.Preference.Leanback.dll" },
|
||||
new OutputFileCopy { FromFile = "./animated-vector-drawable/source/bin/Release/Xamarin.Android.Support.Animated.Vector.Drawable.dll" },
|
||||
new OutputFileCopy { FromFile = "./vector-drawable/source/bin/Release/Xamarin.Android.Support.Vector.Drawable.dll" },
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Samples = new [] {
|
||||
new DefaultSolutionBuilder { SolutionPath = "./customtabs/samples/ChromeCustomTabsSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./design/samples/Cheesesquare.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./percent/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./recommendation/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v4/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v7-appcompat/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v7-cardview/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v7-gridlayout/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v7-mediarouter/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v7-palette/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v7-preference/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v7-recyclerview/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v8-renderscript/samples/RenderScriptSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v13/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./v17-leanback/samples/AndroidSupportSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./vector-drawable/samples/VectorDrawableSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
new DefaultSolutionBuilder { SolutionPath = "./animated-vector-drawable/samples/VectorDrawableSample.sln", BuildsOn = BuildPlatforms.Windows | BuildPlatforms.Mac },
|
||||
},
|
||||
|
||||
NuGets = new [] {
|
||||
new NuGetInfo { NuSpec = "./customtabs/nuget/Xamarin.Android.Support.CustomTabs.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./design/nuget/Xamarin.Android.Support.Design.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./percent/nuget/Xamarin.Android.Support.Percent.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./recommendation/nuget/Xamarin.Android.Support.Recommendation.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v4/nuget/Xamarin.Android.Support.v4.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v7-appcompat/nuget/Xamarin.Android.Support.v7.AppCompat.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v7-cardview/nuget/Xamarin.Android.Support.v7.CardView.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v7-gridlayout/nuget/Xamarin.Android.Support.v7.GridLayout.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v7-mediarouter/nuget/Xamarin.Android.Support.v7.MediaRouter.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v7-palette/nuget/Xamarin.Android.Support.v7.Palette.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v7-preference/nuget/Xamarin.Android.Support.v7.Preference.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v7-recyclerview/nuget/Xamarin.Android.Support.v7.RecyclerView.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v8-renderscript/nuget/Xamarin.Android.Support.v8.RenderScript.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v13/nuget/Xamarin.Android.Support.v13.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v14-preference/nuget/Xamarin.Android.Support.v14.Preference.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v17-leanback/nuget/Xamarin.Android.Support.v17.Leanback.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./v17-preference-leanback/nuget/Xamarin.Android.Support.v17.Preference.Leanback.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./animated-vector-drawable/nuget/Xamarin.Android.Support.Animated.Vector.Drawable.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
new NuGetInfo { NuSpec = "./vector-drawable/nuget/Xamarin.Android.Support.Vector.Drawable.nuspec", Version = NUGET_VERSION, RequireLicenseAcceptance = true },
|
||||
},
|
||||
|
||||
Components = new [] {
|
||||
new Component { ManifestDirectory = "./animated-vector-drawable/component" },
|
||||
new Component { ManifestDirectory = "./customtabs/component" },
|
||||
new Component { ManifestDirectory = "./design/component" },
|
||||
new Component { ManifestDirectory = "./percent/component" },
|
||||
new Component { ManifestDirectory = "./recommendation/component" },
|
||||
new Component { ManifestDirectory = "./v4/component" },
|
||||
new Component { ManifestDirectory = "./v7-appcompat/component" },
|
||||
new Component { ManifestDirectory = "./v7-cardview/component" },
|
||||
new Component { ManifestDirectory = "./v7-gridlayout/component" },
|
||||
new Component { ManifestDirectory = "./v7-palette/component" },
|
||||
new Component { ManifestDirectory = "./v7-preference/component" },
|
||||
new Component { ManifestDirectory = "./v7-recyclerview/component" },
|
||||
new Component { ManifestDirectory = "./v8-renderscript/component" },
|
||||
new Component { ManifestDirectory = "./v13/component" },
|
||||
new Component { ManifestDirectory = "./v17-leanback/component" },
|
||||
new Component { ManifestDirectory = "./vector-drawable/component" },
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
// You shouldn't have to configure anything below here
|
||||
// ######################################################
|
||||
|
||||
Task ("externals")
|
||||
.WithCriteria (() => !FileExists ("./externals/support-v4/classes.jar")).Does (() =>
|
||||
{
|
||||
var path = "./externals/";
|
||||
|
||||
if (!DirectoryExists (path))
|
||||
CreateDirectory (path);
|
||||
|
||||
// Get the actual GPS .aar files and extract
|
||||
if (!FileExists (path + "m2repository.zip"))
|
||||
DownloadFile (M2_REPOSITORY_URL, path + "m2repository.zip");
|
||||
if (!FileExists (path + "m2repository/source.properties"))
|
||||
Unzip(path + "m2repository.zip", path);
|
||||
|
||||
// Copy the .aar's to a better location
|
||||
foreach (var aar in AAR_DIRS) {
|
||||
CopyFile (string.Format (path + "m2repository/com/android/support/{0}/{1}/{2}-{3}.aar", aar, AAR_VERSION, aar, AAR_VERSION),
|
||||
string.Format (path + "{0}.aar", aar));
|
||||
Unzip (string.Format (path + "{0}.aar", aar), path + aar);
|
||||
|
||||
var implFile = path + aar + "/libs/internal_impl-" + AAR_VERSION + ".jar";
|
||||
|
||||
if (FileExists (implFile))
|
||||
MoveFile (implFile, path + aar + "/libs/internal_impl.jar");
|
||||
}
|
||||
|
||||
// Get android docs
|
||||
if (!FileExists (path + "docs.zip")) {
|
||||
DownloadFile (DOCS_URL, path + "docs.zip");
|
||||
Unzip (path + "docs.zip", path);
|
||||
}
|
||||
|
||||
// Get Renderscript
|
||||
if (!FileExists (path + "buildtools.zip"))
|
||||
DownloadFile (BUILD_TOOLS_URL, path + "buildtools.zip");
|
||||
if (!FileExists (path + "build-tools/renderscript/lib/renderscript-v8.jar")) {
|
||||
Unzip (path + "buildtools.zip", path);
|
||||
CopyDirectory (path + "android-6.0", path + "build-tools");
|
||||
DeleteDirectory (path + "android-6.0", true);
|
||||
}
|
||||
});
|
||||
|
||||
Task ("merge").IsDependentOn ("libs").Does (() =>
|
||||
{
|
||||
var mergeDlls = GetFiles ("./output/*.dll");
|
||||
|
||||
// Wait for ILRepack support in cake-0.5.2
|
||||
ILRepack ("./output/AndroidSupport.Merged.dll", mergeDlls.First(), mergeDlls.Skip(1), new ILRepackSettings {
|
||||
CopyAttrs = true,
|
||||
AllowMultiple = true,
|
||||
//TargetKind = ILRepack.TargetKind.Dll,
|
||||
Libs = new List<FilePath> {
|
||||
MONODROID_PATH
|
||||
},
|
||||
});
|
||||
|
||||
// Don't want to think about what the paths will do to this on windows right now
|
||||
if (!IsRunningOnWindows ()) {
|
||||
// Next run the mono-api-info.exe to generate xml api info we can later diff with
|
||||
var monoApiInfoExe = GetFiles ("../../**/mono-api-info.exe").FirstOrDefault ();
|
||||
var monoApiDiffExe = GetFiles ("../../**/mono-api-diff.exe").FirstOrDefault ();
|
||||
var monoApiHtmlExe = GetFiles ("../../**/mono-api-html.exe").FirstOrDefault ();
|
||||
|
||||
//eg: mono mono-api-info.exe --search-directory=/Library/Frameworks/Xamarin.Android.framework/Libraries/mandroid/platforms/android-23 ./Some.dll > api-info.xml
|
||||
using(var process = StartAndReturnProcess (monoApiInfoExe, new ProcessSettings {
|
||||
Arguments = "--search-directory=" + MONODROID_PATH + " ./output/AndroidSupport.Merged.dll",
|
||||
RedirectStandardOutput = true,
|
||||
})) {
|
||||
process.WaitForExit();
|
||||
FileWriteLines ("./output/AndroidSupport.api-info.xml", process.GetStandardOutput ().ToArray ());
|
||||
}
|
||||
|
||||
// Grab the latest published api info from S3
|
||||
var latestReleasedApiInfoUrl = "http://xamarin-components-apiinfo.s3.amazonaws.com/Support.Android-Latest.xml";
|
||||
DownloadFile (latestReleasedApiInfoUrl, "./output/AndroidSupport.api-info.previous.xml");
|
||||
|
||||
// Now diff against current release'd api info
|
||||
// eg: mono mono-api-diff.exe ./gps.r26.xml ./gps.r27.xml > gps.diff.xml
|
||||
using(var process = StartAndReturnProcess (monoApiDiffExe, new ProcessSettings {
|
||||
Arguments = "./output/AndroidSupport.api-info.previous.xml ./output/AndroidSupport.api-info.xml",
|
||||
RedirectStandardOutput = true,
|
||||
})) {
|
||||
process.WaitForExit();
|
||||
FileWriteLines ("./output/AndroidSupport.api-diff.xml", process.GetStandardOutput ().ToArray ());
|
||||
}
|
||||
|
||||
// Now let's make a purty html file
|
||||
// eg: mono mono-api-html.exe -c -x ./gps.previous.info.xml ./gps.current.info.xml > gps.diff.html
|
||||
using(var process = StartAndReturnProcess (monoApiHtmlExe, new ProcessSettings {
|
||||
Arguments = "-c -x ./output/AndroidSupport.api-info.previous.xml ./output/AndroidSupport.api-info.xml",
|
||||
RedirectStandardOutput = true,
|
||||
})) {
|
||||
process.WaitForExit();
|
||||
FileWriteLines ("./output/AndroidSupport.api-diff.html", process.GetStandardOutput ().ToArray ());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Task ("component-setup").Does (() =>
|
||||
{
|
||||
var yamls = GetFiles ("./**/component/component.template.yaml");
|
||||
|
||||
foreach (var yaml in yamls) {
|
||||
var manifestTxt = FileReadText (yaml)
|
||||
.Replace ("$nuget-version$", NUGET_VERSION)
|
||||
.Replace ("$version$", COMPONENT_VERSION);
|
||||
|
||||
var newYaml = yaml.GetDirectory ().CombineWithFilePath ("component.yaml");
|
||||
|
||||
FileWriteText (newYaml, manifestTxt);
|
||||
}
|
||||
});
|
||||
|
||||
Task ("component").IsDependentOn ("component-setup").IsDependentOn ("component-base");
|
||||
|
||||
Task ("clean").IsDependentOn ("clean-base").Does (() =>
|
||||
{
|
||||
if (DirectoryExists ("./externals"))
|
||||
DeleteDirectory ("./externals", true);
|
||||
});
|
||||
|
||||
|
||||
Task ("component-docs").Does (() =>
|
||||
{
|
||||
var gettingStartedTemplates = new Dictionary<string, string> ();
|
||||
|
||||
foreach (var f in GetFiles ("./component/GettingStarted.*.md")) {
|
||||
|
||||
var key = f.GetFilenameWithoutExtension ().FullPath.Replace ("GettingStarted.", "");
|
||||
var val = TransformTextFile (f).ToString ();
|
||||
|
||||
gettingStartedTemplates.Add (key, val);
|
||||
}
|
||||
|
||||
var componentDirs = GetDirectories ("./AndroidSupport*");
|
||||
|
||||
foreach (var compDir in componentDirs)
|
||||
Information ("Found: {0}", compDir);
|
||||
|
||||
foreach (var compDir in componentDirs) {
|
||||
|
||||
if (!FileExists (compDir.CombineWithFilePath ("./component/GettingStarted.template.md")))
|
||||
continue;
|
||||
|
||||
Information ("Transforming: {0}", compDir);
|
||||
|
||||
var apiLevel = "Android 4.0.3 (API Level 15)";
|
||||
|
||||
var t = TransformTextFile (compDir.CombineWithFilePath ("./component/GettingStarted.template.md"), "{", "}");
|
||||
|
||||
foreach (var kvp in gettingStartedTemplates) {
|
||||
var v = TransformText (kvp.Value, "{", "}").WithToken ("APILEVEL", apiLevel).ToString ();
|
||||
t = t.WithToken (kvp.Key, v);
|
||||
}
|
||||
|
||||
FileWriteText (compDir.CombineWithFilePath ("./component/GettingStarted.md"), t.ToString ());
|
||||
}
|
||||
|
||||
|
||||
var detailsTemplates = new Dictionary<string, string> ();
|
||||
|
||||
foreach (var f in GetFiles ("./component/Details.*.md")) {
|
||||
|
||||
var key = f.GetFilenameWithoutExtension ().FullPath.Replace ("Details.", "");
|
||||
var val = TransformTextFile (f).ToString ();
|
||||
|
||||
gettingStartedTemplates.Add (key, val);
|
||||
}
|
||||
|
||||
foreach (var compDir in componentDirs) {
|
||||
|
||||
if (!FileExists (compDir.CombineWithFilePath ("./component/Details.template.md")))
|
||||
continue;
|
||||
|
||||
Information ("Transforming: {0}", compDir);
|
||||
|
||||
var t = TransformTextFile (compDir.CombineWithFilePath ("./component/Details.template.md"), "{", "}");
|
||||
|
||||
foreach (var kvp in gettingStartedTemplates)
|
||||
t = t.WithToken (kvp.Key, kvp.Value);
|
||||
|
||||
FileWriteText (compDir.CombineWithFilePath ("./component/Details.md"), t.ToString ());
|
||||
}
|
||||
});
|
||||
|
||||
SetupXamarinBuildTasks (buildSpec, Tasks, Task);
|
||||
|
||||
RunTarget (TARGET);
|
|
@ -0,0 +1,140 @@
|
|||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
This is a Powershell script to bootstrap a Cake build.
|
||||
|
||||
.DESCRIPTION
|
||||
This Powershell script will download NuGet if missing, restore NuGet tools (including Cake)
|
||||
and execute your Cake build script with the parameters you provide.
|
||||
|
||||
.PARAMETER Script
|
||||
The build script to execute.
|
||||
.PARAMETER Target
|
||||
The build script target to run.
|
||||
.PARAMETER Configuration
|
||||
The build configuration to use.
|
||||
.PARAMETER Verbosity
|
||||
Specifies the amount of information to be displayed.
|
||||
.PARAMETER Experimental
|
||||
Tells Cake to use the latest Roslyn release.
|
||||
.PARAMETER WhatIf
|
||||
Performs a dry run of the build script.
|
||||
No tasks will be executed.
|
||||
.PARAMETER Mono
|
||||
Tells Cake to use the Mono scripting engine.
|
||||
|
||||
.LINK
|
||||
http://cakebuild.net
|
||||
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param(
|
||||
[string]$Script = "build.cake",
|
||||
[string]$Target = "Default",
|
||||
[string]$Configuration = "Release",
|
||||
[ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")]
|
||||
[string]$Verbosity = "Verbose",
|
||||
[switch]$Experimental,
|
||||
[Alias("DryRun","Noop")]
|
||||
[switch]$WhatIf,
|
||||
[switch]$Mono,
|
||||
[switch]$SkipToolPackageRestore,
|
||||
[Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)]
|
||||
[string[]]$ScriptArgs
|
||||
)
|
||||
|
||||
Write-Host "Preparing to run build script..."
|
||||
|
||||
$PS_SCRIPT_ROOT = split-path -parent $MyInvocation.MyCommand.Definition;
|
||||
$TOOLS_DIR = Join-Path $PSScriptRoot "tools"
|
||||
$NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe"
|
||||
$NUGET_URL = "http://dist.nuget.org/win-x86-commandline/latest/nuget.exe"
|
||||
$CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe"
|
||||
$PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config"
|
||||
|
||||
# Should we use mono?
|
||||
$UseMono = "";
|
||||
if($Mono.IsPresent) {
|
||||
Write-Verbose -Message "Using the Mono based scripting engine."
|
||||
$UseMono = "-mono"
|
||||
}
|
||||
|
||||
# Should we use the new Roslyn?
|
||||
$UseExperimental = "";
|
||||
if($Experimental.IsPresent -and !($Mono.IsPresent)) {
|
||||
Write-Verbose -Message "Using experimental version of Roslyn."
|
||||
$UseExperimental = "-experimental"
|
||||
}
|
||||
|
||||
# Is this a dry run?
|
||||
$UseDryRun = "";
|
||||
if($WhatIf.IsPresent) {
|
||||
$UseDryRun = "-dryrun"
|
||||
}
|
||||
|
||||
# Make sure tools folder exists
|
||||
if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) {
|
||||
Write-Verbose -Message "Creating tools directory..."
|
||||
New-Item -Path $TOOLS_DIR -Type directory | out-null
|
||||
}
|
||||
|
||||
# Make sure that packages.config exist.
|
||||
if (!(Test-Path $PACKAGES_CONFIG)) {
|
||||
Write-Verbose -Message "Downloading packages.config..."
|
||||
try { Invoke-WebRequest -Uri http://cakebuild.net/bootstrapper/packages -OutFile $PACKAGES_CONFIG } catch {
|
||||
Throw "Could not download packages.config."
|
||||
}
|
||||
}
|
||||
|
||||
# Try find NuGet.exe in path if not exists
|
||||
if (!(Test-Path $NUGET_EXE)) {
|
||||
Write-Verbose -Message "Trying to find nuget.exe in PATH..."
|
||||
$existingPaths = $Env:Path -Split ';' | Where-Object { Test-Path $_ }
|
||||
$NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1
|
||||
if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) {
|
||||
Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)."
|
||||
$NUGET_EXE = $NUGET_EXE_IN_PATH.FullName
|
||||
}
|
||||
}
|
||||
|
||||
# Try download NuGet.exe if not exists
|
||||
if (!(Test-Path $NUGET_EXE)) {
|
||||
Write-Verbose -Message "Downloading NuGet.exe..."
|
||||
try {
|
||||
(New-Object System.Net.WebClient).DownloadFile($NUGET_URL, $NUGET_EXE)
|
||||
} catch {
|
||||
Throw "Could not download NuGet.exe."
|
||||
}
|
||||
}
|
||||
|
||||
# Save nuget.exe path to environment to be available to child processed
|
||||
$ENV:NUGET_EXE = $NUGET_EXE
|
||||
|
||||
# Restore tools from NuGet?
|
||||
if(-Not $SkipToolPackageRestore.IsPresent)
|
||||
{
|
||||
# Restore packages from NuGet.
|
||||
Push-Location
|
||||
Set-Location $TOOLS_DIR
|
||||
|
||||
Write-Verbose -Message "Restoring tools from NuGet..."
|
||||
$NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`""
|
||||
Write-Verbose -Message ($NuGetOutput | out-string)
|
||||
|
||||
Pop-Location
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
}
|
||||
|
||||
# Make sure that Cake has been installed.
|
||||
if (!(Test-Path $CAKE_EXE)) {
|
||||
Throw "Could not find Cake.exe at $CAKE_EXE"
|
||||
}
|
||||
|
||||
# Start Cake
|
||||
Write-Host "Running build script..."
|
||||
Invoke-Expression "& `"$CAKE_EXE`" `"$Script`" -target=`"$Target`" -configuration=`"$Configuration`" -verbosity=`"$Verbosity`" $UseMono $UseDryRun $UseExperimental $ScriptArgs"
|
||||
exit $LASTEXITCODE
|
|
@ -0,0 +1,82 @@
|
|||
#!/usr/bin/env bash
|
||||
###############################################################
|
||||
# This is the Cake bootstrapper script that is responsible for
|
||||
# downloading Cake and all specified tools from NuGet.
|
||||
###############################################################
|
||||
|
||||
# Define directories.
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
TOOLS_DIR=$SCRIPT_DIR/tools
|
||||
NUGET_EXE=$TOOLS_DIR/nuget.exe
|
||||
CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe
|
||||
|
||||
# Define default arguments.
|
||||
SCRIPT="build.cake"
|
||||
TARGET="Default"
|
||||
CONFIGURATION="Release"
|
||||
VERBOSITY="verbose"
|
||||
DRYRUN=
|
||||
SHOW_VERSION=false
|
||||
SCRIPT_ARGUMENTS=()
|
||||
|
||||
# Parse arguments.
|
||||
for i in "$@"; do
|
||||
case $1 in
|
||||
-s|--script) SCRIPT="$2"; shift ;;
|
||||
-t|--target) TARGET="$2"; shift ;;
|
||||
-c|--configuration) CONFIGURATION="$2"; shift ;;
|
||||
-v|--verbosity) VERBOSITY="$2"; shift ;;
|
||||
-d|--dryrun) DRYRUN="-dryrun" ;;
|
||||
--version) SHOW_VERSION=true ;;
|
||||
--) shift; SCRIPT_ARGUMENTS+=("$@"); break ;;
|
||||
*) SCRIPT_ARGUMENTS+=("$1") ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Make sure the tools folder exist.
|
||||
if [ ! -d "$TOOLS_DIR" ]; then
|
||||
mkdir "$TOOLS_DIR"
|
||||
fi
|
||||
|
||||
# Make sure that packages.config exist.
|
||||
if [ ! -f "$TOOLS_DIR/packages.config" ]; then
|
||||
echo "Downloading packages.config..."
|
||||
curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/bootstrapper/packages
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "An error occured while downloading packages.config."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Download NuGet if it does not exist.
|
||||
if [ ! -f "$NUGET_EXE" ]; then
|
||||
echo "Downloading NuGet..."
|
||||
curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "An error occured while downloading nuget.exe."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Restore tools from NuGet.
|
||||
pushd "$TOOLS_DIR" >/dev/null
|
||||
mono "$NUGET_EXE" install -ExcludeVersion
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Could not restore NuGet packages."
|
||||
exit 1
|
||||
fi
|
||||
popd >/dev/null
|
||||
|
||||
# Make sure that Cake has been installed.
|
||||
if [ ! -f "$CAKE_EXE" ]; then
|
||||
echo "Could not find Cake.exe at '$CAKE_EXE'."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Start Cake
|
||||
if $SHOW_VERSION; then
|
||||
exec mono "$CAKE_EXE" -version
|
||||
else
|
||||
exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}"
|
||||
fi
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
|
||||
## Android Support Libraries
|
||||
|
||||
The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.
|
||||
|
||||
Including the Support Libraries in your Android project is considered a best practice for application developers, depending on the range of platform versions your app is targeting and the APIs that it uses. Using the features the libraries provide can help you improve the look of your application, increase performance and broaden the reach of your application to more users.
|
||||
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
**Xamarin is not responsible for, nor does it grant any licenses to, third-party packages. Some packages may require or install dependencies which are governed by additional licenses.**
|
||||
|
||||
|
||||
This component depends on [Google Android Support Library](http://developer.android.com/tools/support-library/), which is subject to the terms of [Android Software Development Kit License Agreement](http://developer.android.com/sdk/terms.html)
|
||||
|
||||
### Xamarin Component for Android Support Library
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Xamarin Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
20160427
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
# Custom Tabs Android Support Library
|
||||
|
||||
App developers face a choice when a user taps a URL to either launch a browser, or build their own in-app browser using WebViews.
|
||||
|
||||
Both options present challenges — launching the browser is a heavy context switch that isn't customizable, while WebViews don't share state with the browser and add maintenance overhead.
|
||||
|
||||
Custom tabs give apps more control over their web experience, and make transitions between native and web content more seamless without having to resort to a WebView.
|
||||
|
||||
Custom tabs allow an app to customize how Chrome looks and feels. An app can change things like:
|
||||
- Toolbar color
|
||||
- Enter and exit animations
|
||||
- Add custom actions to the Chrome toolbar and overflow menu
|
||||
- Custom tabs also allow the developer to pre-start Chrome and pre-fetch content for faster loading.
|
||||
|
||||
|
||||
### When should I use Chrome custom tabs vs WebView?
|
||||
|
||||
The WebView is good solution if you are hosting your own content inside your app. If your app directs people to URLs outside your domain, we recommend that you use Chrome custom tabs for these reasons:
|
||||
|
||||
- Simple to implement. No need to build code to manage requests, permission grants or cookie stores.
|
||||
- UI customization:
|
||||
- Toolbar color
|
||||
- Action button
|
||||
- Custom menu items
|
||||
- Custom in/out animations
|
||||
- Navigation awareness: the browser delivers a callback to the application upon an external navigation.
|
||||
- Performance optimization:
|
||||
- Pre-warming of the Browser in the background, while avoiding stealing resources from the application.
|
||||
- Providing a likely URL in advance to the browser, which may perform speculative work, speeding up page load time.
|
||||
- Lifecycle management: the browser prevents the application from being evicted by the system while on top of it, by raising its importance to the "foreground" level.
|
||||
- Shared Cookie Jar and permissions model so users don't have to log in to sites they are already connected to, or re-grant permissions they have already granted.
|
||||
- If the user has turned on Data Saver, they will still benefit from it.
|
||||
Synchronized AutoComplete across devices for better form completion.
|
||||
- Simple customization model.
|
||||
- Quickly return to app with a single tap.
|
||||
- You want to use the latest browser implementations on devices pre-Lollipop (auto updating WebView) instead of older WebViews.
|
||||
|
||||
|
||||
|
||||
|
||||
## Android Support Libraries
|
||||
|
||||
The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.
|
||||
|
||||
Including the Support Libraries in your Android project is considered a best practice for application developers, depending on the range of platform versions your app is targeting and the APIs that it uses. Using the features the libraries provide can help you improve the look of your application, increase performance and broaden the reach of your application to more users.
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
# Custom Tabs Android Support Library
|
||||
|
||||
App developers face a choice when a user taps a URL to either launch a browser, or build their own in-app browser using WebViews.
|
||||
|
||||
Both options present challenges — launching the browser is a heavy context switch that isn't customizable, while WebViews don't share state with the browser and add maintenance overhead.
|
||||
|
||||
Custom tabs give apps more control over their web experience, and make transitions between native and web content more seamless without having to resort to a WebView.
|
||||
|
||||
Custom tabs allow an app to customize how Chrome looks and feels. An app can change things like:
|
||||
- Toolbar color
|
||||
- Enter and exit animations
|
||||
- Add custom actions to the Chrome toolbar and overflow menu
|
||||
- Custom tabs also allow the developer to pre-start Chrome and pre-fetch content for faster loading.
|
||||
|
||||
|
||||
### When should I use Chrome custom tabs vs WebView?
|
||||
|
||||
The WebView is good solution if you are hosting your own content inside your app. If your app directs people to URLs outside your domain, we recommend that you use Chrome custom tabs for these reasons:
|
||||
|
||||
- Simple to implement. No need to build code to manage requests, permission grants or cookie stores.
|
||||
- UI customization:
|
||||
- Toolbar color
|
||||
- Action button
|
||||
- Custom menu items
|
||||
- Custom in/out animations
|
||||
- Navigation awareness: the browser delivers a callback to the application upon an external navigation.
|
||||
- Performance optimization:
|
||||
- Pre-warming of the Browser in the background, while avoiding stealing resources from the application.
|
||||
- Providing a likely URL in advance to the browser, which may perform speculative work, speeding up page load time.
|
||||
- Lifecycle management: the browser prevents the application from being evicted by the system while on top of it, by raising its importance to the "foreground" level.
|
||||
- Shared Cookie Jar and permissions model so users don't have to log in to sites they are already connected to, or re-grant permissions they have already granted.
|
||||
- If the user has turned on Data Saver, they will still benefit from it.
|
||||
Synchronized AutoComplete across devices for better form completion.
|
||||
- Simple customization model.
|
||||
- Quickly return to app with a single tap.
|
||||
- You want to use the latest browser implementations on devices pre-Lollipop (auto updating WebView) instead of older WebViews.
|
||||
|
||||
|
||||
{GENERAL}
|
|
@ -0,0 +1,93 @@
|
|||
Custom Tabs Support Library
|
||||
===========================
|
||||
|
||||
As of Chrome 45, Chrome custom tabs is now generally available to all users of Chrome, on all of Chrome's supported Android versions (Jellybean onwards). Please note that the API will change slightly over the coming weeks.
|
||||
|
||||
|
||||
### Loading a Page
|
||||
|
||||
You can load pages without any customization very easily:
|
||||
|
||||
```csharp
|
||||
var mgr = new CustomTabsActivityManager (this);
|
||||
mgr.CustomTabsServiceConnected += delegate {
|
||||
mgr.LaunchUrl ("http://xamarin.com");
|
||||
};
|
||||
mgr.BindService ();
|
||||
```
|
||||
|
||||
### Customization
|
||||
|
||||
You can also customize the look and feel of the browser tab. You can change the background colour of the toolbar, customize start and exit animations, add items to the overflow menu, and even add icons to the action bar!
|
||||
|
||||
```csharp
|
||||
var builder = new CustomTabsIntent.Builder (customTabs.Session)
|
||||
|
||||
// Xamarin Blue
|
||||
.SetToolbarColor (Color.Argb (255, 52, 152, 219))
|
||||
|
||||
// Show Title of page, not just URL
|
||||
.SetShowTitle (true)
|
||||
|
||||
// Customize the Animations for displaying the browser
|
||||
.SetStartAnimations (this, Resource.Animation.slide_in_right, Resource.Animation.slide_out_left)
|
||||
.SetExitAnimations (this, Resource.Animation.slide_in_left, Resource.Animation.slide_out_right);
|
||||
|
||||
var intent = builder.Build ();
|
||||
|
||||
var mgr = new CustomTabsActivityManager (this);
|
||||
mgr.CustomTabsServiceConnected += delegate {
|
||||
mgr.LaunchUrl ("http://xamarin.com", intent);
|
||||
};
|
||||
mgr.BindService ();
|
||||
```
|
||||
|
||||
|
||||
#### Adding Menu Items
|
||||
|
||||
It's also possible to add your own menu items to the overflow menu:
|
||||
|
||||
```csharp
|
||||
var menuIntent = new Intent (typeof (MainActivity));
|
||||
menuIntent.PutExtra ("hug", true);
|
||||
|
||||
// Optional animation configuration when the user clicks menu items.
|
||||
var menuBundle = ActivityOptions.MakeCustomAnimation (this,
|
||||
Android.Resource.Animation.SlideInLeft,
|
||||
Android.Resource.Animation.SlideOutRight).ToBundle ();
|
||||
|
||||
var pi = PendingIntent.GetActivity (
|
||||
ApplicationContext, 0, menuIntent, 0, menuBundle);
|
||||
|
||||
builder.AddMenuItem ("Hug a Monkey", pi);
|
||||
```
|
||||
|
||||
#### Adding Action Button
|
||||
|
||||
You can also add your own buttons to the Toolbar:
|
||||
|
||||
```csharp
|
||||
// An example intent that sends an email.
|
||||
var actionIntent = new Intent(Intent.ActionSend);
|
||||
actionIntent.SetType("*/*");
|
||||
actionIntent.PutExtra (Intent.ExtraEmail, "support@xamarin.com");
|
||||
actionIntent.PutExtra (Intent.ExtraSubject, "Help me make awesome apps!");
|
||||
|
||||
var pi = PendingIntent.GetActivity (ApplicationContext, 0, actionIntent, 0);
|
||||
|
||||
var icon = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Icon);
|
||||
|
||||
builder.SetActionButton (icon, pi);
|
||||
```
|
||||
|
||||
### Fall back gracefully
|
||||
|
||||
Not every user will have Chrome installed, so you should build your app to gracefully fall back to other methods of handling displaying your URL. If your call to `BindService` returns false, you should assume Custom Tabs will not work and should handle the URL another way:
|
||||
|
||||
```csharp
|
||||
if (!mgr.BindService ()) {
|
||||
// Cannot use Custom Tabs,
|
||||
// Launch the URL another way
|
||||
}
|
||||
```
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
version: $version$
|
||||
name: Android Support Custom Tabs Library
|
||||
id: xamandroidsupportcustomtabs
|
||||
publisher: Xamarin Inc.
|
||||
publisher-url: http://xamarin.com
|
||||
src-url: https://github.com/xamarin/AndroidSupportComponents
|
||||
license: ../../component/License.md
|
||||
summary: Provide backward-compatible versions of Android framework APIs.
|
||||
icons:
|
||||
- icons/xamandroidsupportcustomtabs_128x128.png
|
||||
- icons/xamandroidsupportcustomtabs_512x512.png
|
||||
libraries:
|
||||
android: ../../output/Xamarin.Android.Support.CustomTabs.dll
|
||||
is_shell: true
|
||||
packages:
|
||||
android:
|
||||
- Xamarin.Android.Support.CustomTabs, Version=$nuget-version$
|
||||
samples:
|
||||
- name: "Chrome Custom Tabs Sample"
|
||||
path: ../samples/ChromeCustomTabsSample.sln
|
||||
removeProjects:
|
||||
- V4
|
||||
- CustomTabs
|
||||
installNuGets:
|
||||
- project: ChromeCustomTabsSample
|
||||
packages:
|
||||
- Xamarin.Android.Support.v4
|
||||
- Xamarin.Android.Support.CustomTabs
|
||||
local-nuget-repo: ../../output
|
||||
no_build: true
|
После Ширина: | Высота: | Размер: 3.5 KiB |
После Ширина: | Высота: | Размер: 32 KiB |
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>Xamarin.Android.Support.CustomTabs</id>
|
||||
<title>Xamarin Android Support Library - Custom Tabs</title>
|
||||
<version>$version$</version>
|
||||
<authors>Xamarin Inc.</authors>
|
||||
<owners>Xamarin Inc.</owners>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<description>Custom Tabs Android Support Library C# bindings for Xamarin</description>
|
||||
<copyright>Copyright 2013-2016</copyright>
|
||||
<projectUrl>https://components.xamarin.com/view/xamandroidsupportcustomtabs</projectUrl>
|
||||
<licenseUrl>https://components.xamarin.com/license/xamandroidsupportcustomtabs</licenseUrl>
|
||||
<iconUrl>https://xamarin-component-icons.s3.amazonaws.com/Xamarin.Android.Support.CustomTabs.png</iconUrl>
|
||||
<dependencies>
|
||||
<dependency id="Xamarin.Android.Support.v4" version="[$version$]"/>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="output/Xamarin.Android.Support.CustomTabs.dll" target="lib\MonoAndroid403" />
|
||||
</files>
|
||||
</package>
|
|
@ -0,0 +1,29 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromeCustomTabsSample", "ChromeCustomTabsSample\ChromeCustomTabsSample.csproj", "{59CF662E-2BBD-40EF-B08D-1BF89D713D96}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V4", "..\..\v4\source\V4.csproj", "{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CustomTabs", "..\source\CustomTabs.csproj", "{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{59CF662E-2BBD-40EF-B08D-1BF89D713D96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{59CF662E-2BBD-40EF-B08D-1BF89D713D96}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{59CF662E-2BBD-40EF-B08D-1BF89D713D96}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{59CF662E-2BBD-40EF-B08D-1BF89D713D96}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,19 @@
|
|||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with your package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ProjectGuid>{59CF662E-2BBD-40EF-B08D-1BF89D713D96}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>ChromeCustomTabs</RootNamespace>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
|
||||
<AssemblyName>ChromeCustomTabsSample</AssemblyName>
|
||||
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
|
||||
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\layout\Main.axml" />
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxxhdpi\Icon.png" />
|
||||
<AndroidResource Include="Resources\anim\slide_in_left.xml" />
|
||||
<AndroidResource Include="Resources\anim\slide_in_right.xml" />
|
||||
<AndroidResource Include="Resources\anim\slide_out_left.xml" />
|
||||
<AndroidResource Include="Resources\anim\slide_out_right.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\anim\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\source\CustomTabs.csproj">
|
||||
<Project>{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}</Project>
|
||||
<Name>CustomTabs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\v4\source\V4.csproj">
|
||||
<Project>{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}</Project>
|
||||
<Name>V4</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,148 @@
|
|||
using System;
|
||||
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
using Android.Graphics;
|
||||
using Android.Support.CustomTabs;
|
||||
|
||||
namespace ChromeCustomTabs
|
||||
{
|
||||
[Activity (Label = "Chrome Tabs", MainLauncher = true, Icon = "@drawable/icon")]
|
||||
public class MainActivity : Activity
|
||||
{
|
||||
const string TAG = "CustomTabsClientExample";
|
||||
|
||||
CustomTabsActivityManager customTabs;
|
||||
|
||||
string packageNameToBind = null;
|
||||
EditText editText;
|
||||
Button connectButton;
|
||||
Button warmupButton;
|
||||
Button mayLaunchButton;
|
||||
Button launchButton;
|
||||
Button simpleLaunch;
|
||||
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
// Set our view from the "main" layout resource
|
||||
SetContentView (Resource.Layout.Main);
|
||||
|
||||
editText = FindViewById<EditText> (Resource.Id.edit);
|
||||
connectButton = FindViewById<Button> (Resource.Id.connect_button);
|
||||
warmupButton = FindViewById<Button> (Resource.Id.warmup_button);
|
||||
mayLaunchButton = FindViewById<Button> (Resource.Id.may_launch_button);
|
||||
launchButton = FindViewById<Button> (Resource.Id.launch_button);
|
||||
Spinner spinner = FindViewById<Spinner> (Resource.Id.spinner);
|
||||
|
||||
customTabs = new CustomTabsActivityManager (this);
|
||||
customTabs.CustomTabsServiceConnected += (name, client) => {
|
||||
connectButton.Enabled = false;
|
||||
warmupButton.Enabled = true;
|
||||
mayLaunchButton.Enabled = true;
|
||||
launchButton.Enabled = true;
|
||||
};
|
||||
customTabs.CustomTabsServiceDisconnected += (name) => {
|
||||
connectButton.Enabled = true;
|
||||
warmupButton.Enabled = false;
|
||||
mayLaunchButton.Enabled = false;
|
||||
launchButton.Enabled = false;
|
||||
};
|
||||
customTabs.NavigationEvent += (navigationEvent, extras) => {
|
||||
Android.Util.Log.Debug (TAG, "Navigation: " + navigationEvent);
|
||||
};
|
||||
|
||||
|
||||
simpleLaunch = FindViewById<Button> (Resource.Id.buttonSimpleLaunch);
|
||||
simpleLaunch.Click += (sender, e) => {
|
||||
|
||||
var mgr = new CustomTabsActivityManager (this);
|
||||
mgr.CustomTabsServiceConnected += delegate {
|
||||
mgr.LaunchUrl ("http://xamarin.com");
|
||||
};
|
||||
mgr.BindService ();
|
||||
};
|
||||
|
||||
editText.RequestFocus ();
|
||||
connectButton.Click += delegate {
|
||||
if (!customTabs.BindService (packageNameToBind))
|
||||
Toast.MakeText (this, "Custom Tabs Not Supported - try installing Chrome", ToastLength.Long).Show ();
|
||||
};
|
||||
warmupButton.Click += delegate {
|
||||
|
||||
warmupButton.Enabled = customTabs.Warmup ();
|
||||
|
||||
Toast.MakeText (this, "Warmed Up", ToastLength.Short).Show ();
|
||||
};
|
||||
mayLaunchButton.Click += delegate {
|
||||
var url = editText.Text;
|
||||
|
||||
mayLaunchButton.Enabled = customTabs.MayLaunchUrl (url, null, null);
|
||||
|
||||
Toast.MakeText (this, "May Launch Called", ToastLength.Short).Show ();
|
||||
};
|
||||
launchButton.Click += delegate {
|
||||
var url = editText.Text;
|
||||
|
||||
var builder = new CustomTabsIntent.Builder (customTabs.Session)
|
||||
.SetToolbarColor (Color.Argb (255, 52, 152, 219))
|
||||
.SetShowTitle (true)
|
||||
.SetStartAnimations (this, Resource.Animation.slide_in_right, Resource.Animation.slide_out_left)
|
||||
.SetExitAnimations (this, Resource.Animation.slide_in_left, Resource.Animation.slide_out_right);
|
||||
|
||||
prepareMenuItems(builder);
|
||||
prepareActionButton(builder);
|
||||
|
||||
var customTabsIntent = builder.Build ();
|
||||
|
||||
CustomTabsHelper.AddKeepAliveExtra (this, customTabsIntent.Intent);
|
||||
|
||||
customTabsIntent.LaunchUrl (this, Android.Net.Uri.Parse (url));
|
||||
};
|
||||
|
||||
spinner.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem,
|
||||
CustomTabsHelper.Packages);
|
||||
|
||||
|
||||
spinner.ItemSelected += (sender, e) => {
|
||||
if (string.IsNullOrEmpty (e.Parent.GetItemAtPosition (e.Position).ToString ()))
|
||||
packageNameToBind = null;
|
||||
};
|
||||
spinner.NothingSelected += (sender, e) => {
|
||||
packageNameToBind = null;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
void prepareMenuItems (CustomTabsIntent.Builder builder)
|
||||
{
|
||||
var menuIntent = new Intent();
|
||||
menuIntent.SetClass (ApplicationContext, typeof(MainActivity));
|
||||
// Optional animation configuration when the user clicks menu items.
|
||||
var menuBundle = ActivityOptions.MakeCustomAnimation (this, Android.Resource.Animation.SlideInLeft,
|
||||
Android.Resource.Animation.SlideOutRight).ToBundle ();
|
||||
var pi = PendingIntent.GetActivity (ApplicationContext, 0, menuIntent, 0, menuBundle);
|
||||
builder.AddMenuItem ("Menu entry 1", pi);
|
||||
}
|
||||
|
||||
void prepareActionButton(CustomTabsIntent.Builder builder)
|
||||
{
|
||||
// An example intent that sends an email.
|
||||
var actionIntent = new Intent(Intent .ActionSend);
|
||||
actionIntent.SetType ("*/*");
|
||||
actionIntent.PutExtra (Intent.ExtraEmail, "example@example.com");
|
||||
actionIntent.PutExtra (Intent.ExtraSubject, "example");
|
||||
var pi = PendingIntent.GetActivity (ApplicationContext, 0, actionIntent, 0);
|
||||
var icon = BitmapFactory.DecodeResource (Resources, Resource.Drawable.Icon);
|
||||
builder.SetActionButton (icon, "send email", pi);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.xamarin.chromecustomtabs">
|
||||
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22" />
|
||||
<application android:label="ChromeCustomTabs" android:theme="@android:style/Theme.Material.Light">
|
||||
</application>
|
||||
</manifest>
|
|
@ -0,0 +1,28 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Android.App;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("ChromeCustomTabs")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("redth")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.0")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
Images, layout descriptions, binary blobs and string dictionaries can be included
|
||||
in your application as resource files. Various Android APIs are designed to
|
||||
operate on the resource IDs instead of dealing with images, strings or binary blobs
|
||||
directly.
|
||||
|
||||
For example, a sample Android app that contains a user interface layout (main.axml),
|
||||
an internationalization string table (strings.xml) and some icons (drawable-XXX/icon.png)
|
||||
would keep its resources in the "Resources" directory of the application:
|
||||
|
||||
Resources/
|
||||
drawable/
|
||||
icon.png
|
||||
|
||||
layout/
|
||||
main.axml
|
||||
|
||||
values/
|
||||
strings.xml
|
||||
|
||||
In order to get the build system to recognize Android resources, set the build action to
|
||||
"AndroidResource". The native Android APIs do not operate directly with filenames, but
|
||||
instead operate on resource IDs. When you compile an Android application that uses resources,
|
||||
the build system will package the resources for distribution and generate a class called "R"
|
||||
(this is an Android convention) that contains the tokens for each one of the resources
|
||||
included. For example, for the above Resources layout, this is what the R class would expose:
|
||||
|
||||
public class R {
|
||||
public class drawable {
|
||||
public const int icon = 0x123;
|
||||
}
|
||||
|
||||
public class layout {
|
||||
public const int main = 0x456;
|
||||
}
|
||||
|
||||
public class strings {
|
||||
public const int first_string = 0xabc;
|
||||
public const int second_string = 0xbcd;
|
||||
}
|
||||
}
|
||||
|
||||
You would then use R.drawable.icon to reference the drawable/icon.png file, or R.layout.main
|
||||
to reference the layout/main.axml file, or R.strings.first_string to reference the first
|
||||
string in the dictionary file values/strings.xml.
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2015 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="-100%p" android:toXDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
</set>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2015 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="100%p" android:toXDelta="0"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
</set>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2015 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0" android:toXDelta="-100%p"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
</set>
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright 2015 Google Inc. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<set xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromXDelta="0" android:toXDelta="100%p"
|
||||
android:duration="@android:integer/config_mediumAnimTime"/>
|
||||
</set>
|
Двоичные данные
customtabs/samples/ChromeCustomTabsSample/Resources/drawable-hdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 2.1 KiB |
Двоичные данные
customtabs/samples/ChromeCustomTabsSample/Resources/drawable-mdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 1.4 KiB |
Двоичные данные
customtabs/samples/ChromeCustomTabsSample/Resources/drawable-xhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 3.2 KiB |
Двоичные данные
customtabs/samples/ChromeCustomTabsSample/Resources/drawable-xxhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 5.3 KiB |
Двоичные данные
customtabs/samples/ChromeCustomTabsSample/Resources/drawable-xxxhdpi/Icon.png
Normal file
После Ширина: | Высота: | Размер: 7.6 KiB |
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_width="match_parent"
|
||||
android:padding="5dp"
|
||||
android:orientation="vertical">
|
||||
<EditText
|
||||
android:id="@+id/edit"
|
||||
android:padding="5dp"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Please type the url here."
|
||||
android:inputType="textNoSuggestions"
|
||||
android:text="http://xamarin.com" />
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:orientation="horizontal">
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:text="Package:" />
|
||||
<Spinner
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/spinner"
|
||||
android:layout_margin="3dp"
|
||||
android:layout_gravity="center_horizontal" />
|
||||
</LinearLayout>
|
||||
<Space
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="5dp" />
|
||||
<Button
|
||||
android:id="@+id/connect_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:text="Connect to the service"
|
||||
android:enabled="true" />
|
||||
<Button
|
||||
android:id="@+id/warmup_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:text="Warmup Chrome"
|
||||
android:enabled="false" />
|
||||
<Button
|
||||
android:id="@+id/may_launch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:text="May Launch URL"
|
||||
android:enabled="false" />
|
||||
<Button
|
||||
android:id="@+id/launch_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="3dp"
|
||||
android:textAllCaps="false"
|
||||
android:text="Launch URL in a Chrome Custom Tab"
|
||||
android:enabled="false" />
|
||||
<Button
|
||||
android:text="Simple Launch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAllCaps="false"
|
||||
android:id="@+id/buttonSimpleLaunch" />
|
||||
</LinearLayout>
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="hello">Hello World, Click Me!</string>
|
||||
<string name="app_name">ChromeCustomTabs</string>
|
||||
</resources>
|
|
@ -0,0 +1,48 @@
|
|||
Additions allow you to add arbitrary C# to the generated classes
|
||||
before they are compiled. This can be helpful for providing convenience
|
||||
methods or adding pure C# classes.
|
||||
|
||||
== Adding Methods to Generated Classes ==
|
||||
|
||||
Let's say the library being bound has a Rectangle class with a constructor
|
||||
that takes an x and y position, and a width and length size. It will look like
|
||||
this:
|
||||
|
||||
public partial class Rectangle
|
||||
{
|
||||
public Rectangle (int x, int y, int width, int height)
|
||||
{
|
||||
// JNI bindings
|
||||
}
|
||||
}
|
||||
|
||||
Imagine we want to add a constructor to this class that takes a Point and
|
||||
Size structure instead of 4 ints. We can add a new file called Rectangle.cs
|
||||
with a partial class containing our new method:
|
||||
|
||||
public partial class Rectangle
|
||||
{
|
||||
public Rectangle (Point location, Size size) :
|
||||
this (location.X, location.Y, size.Width, size.Height)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
At compile time, the additions class will be added to the generated class
|
||||
and the final assembly will a Rectangle class with both constructors.
|
||||
|
||||
|
||||
== Adding C# Classes ==
|
||||
|
||||
Another thing that can be done is adding fully C# managed classes to the
|
||||
generated library. In the above example, let's assume that there isn't a
|
||||
Point class available in Java or our library. The one we create doesn't need
|
||||
to interact with Java, so we'll create it like a normal class in C#.
|
||||
|
||||
By adding a Point.cs file with this class, it will end up in the binding library:
|
||||
|
||||
public class Point
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using Android.OS;
|
||||
|
||||
namespace Android.Support.CustomTabs
|
||||
{
|
||||
public partial class CustomTabsClient
|
||||
{
|
||||
public delegate void OnNavigationEventDelegate (int navigationEvent, Bundle extras);
|
||||
|
||||
public CustomTabsSession NewSession (OnNavigationEventDelegate callback)
|
||||
{
|
||||
return NewSession (new CustomTabsCallbackImpl (callback));
|
||||
}
|
||||
|
||||
internal class CustomTabsCallbackImpl : CustomTabsCallback
|
||||
{
|
||||
OnNavigationEventDelegate callback;
|
||||
|
||||
public CustomTabsCallbackImpl (OnNavigationEventDelegate callback)
|
||||
{
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
public void OnNavigationEvent (int navigationEvent, Bundle extras)
|
||||
{
|
||||
if (callback != null)
|
||||
callback (navigationEvent, extras);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
using System;
|
||||
using Android.Content;
|
||||
using Android.OS;
|
||||
using System.Collections.Generic;
|
||||
using Android.App;
|
||||
|
||||
namespace Android.Support.CustomTabs
|
||||
{
|
||||
public class CustomTabsActivityManager
|
||||
{
|
||||
static CustomTabsActivityManager instance;
|
||||
public static CustomTabsActivityManager From (Activity parentActivity, string servicePackageName = null)
|
||||
{
|
||||
if (instance == null) {
|
||||
instance = new CustomTabsActivityManager (parentActivity);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public Activity ParentActivity { get; private set; }
|
||||
public CustomTabsClient Client { get; private set; }
|
||||
|
||||
CustomTabsSession session = null;
|
||||
public CustomTabsSession Session {
|
||||
get {
|
||||
if (Client == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (session == null) {
|
||||
session = Client.NewSession ((navEvent, extras) => {
|
||||
var evt = NavigationEvent;
|
||||
if (evt != null)
|
||||
evt (navEvent, extras);
|
||||
});
|
||||
}
|
||||
|
||||
return session;
|
||||
}
|
||||
}
|
||||
|
||||
CustomTabsServiceConnectionImpl connection;
|
||||
|
||||
public delegate void NavigationEventDelegate (int navigationEvent, Bundle extras);
|
||||
public delegate void CustomTabsServiceConnectedDelegate (ComponentName name, CustomTabsClient client);
|
||||
public delegate void CustomTabsServiceDisconnectedDelegate (ComponentName name);
|
||||
|
||||
public event NavigationEventDelegate NavigationEvent;
|
||||
public event CustomTabsServiceConnectedDelegate CustomTabsServiceConnected;
|
||||
public event CustomTabsServiceDisconnectedDelegate CustomTabsServiceDisconnected;
|
||||
|
||||
public CustomTabsActivityManager (Activity parentActivity)
|
||||
{
|
||||
ParentActivity = parentActivity;
|
||||
}
|
||||
|
||||
public bool BindService (string servicePackageName = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty (servicePackageName)) {
|
||||
servicePackageName = CustomTabsHelper.GetPackageNameToUse (ParentActivity);
|
||||
|
||||
if (servicePackageName == null)
|
||||
return false;
|
||||
}
|
||||
|
||||
connection = new CustomTabsServiceConnectionImpl {
|
||||
CustomTabsServiceConnectedHandler = (name, client) => {
|
||||
Client = client;
|
||||
var evt = CustomTabsServiceConnected;
|
||||
if (evt != null)
|
||||
evt (name, client);
|
||||
},
|
||||
OnServiceDisconnectedHandler = (name) => {
|
||||
var evt = CustomTabsServiceDisconnected;
|
||||
if (evt != null)
|
||||
evt (name);
|
||||
}
|
||||
};
|
||||
|
||||
return CustomTabsClient.BindCustomTabsService (ParentActivity, servicePackageName, connection);
|
||||
}
|
||||
|
||||
public bool Warmup (long flags = 0)
|
||||
{
|
||||
if (Client == null)
|
||||
return false;
|
||||
|
||||
return Client.Warmup (flags);
|
||||
}
|
||||
|
||||
public bool MayLaunchUrl (string url, Bundle extras, List<string> otherLikelyUrls)
|
||||
{
|
||||
if (Session == null)
|
||||
return false;
|
||||
|
||||
var otherLikelyBundles = new List<Bundle> ();
|
||||
|
||||
if (otherLikelyUrls != null) {
|
||||
foreach (var otherUrl in otherLikelyUrls) {
|
||||
var bundle = new Bundle ();
|
||||
bundle.PutString ("url", otherUrl);
|
||||
otherLikelyBundles.Add (bundle);
|
||||
}
|
||||
}
|
||||
|
||||
return Session.MayLaunchUrl (Android.Net.Uri.Parse (url), extras, otherLikelyBundles);
|
||||
}
|
||||
|
||||
public void LaunchUrl (string url, CustomTabsIntent customTabsIntent = null)
|
||||
{
|
||||
if (customTabsIntent == null) {
|
||||
customTabsIntent = new CustomTabsIntent.Builder ()
|
||||
.Build ();
|
||||
}
|
||||
|
||||
CustomTabsHelper.AddKeepAliveExtra (ParentActivity, customTabsIntent.Intent);
|
||||
|
||||
customTabsIntent.LaunchUrl (ParentActivity, Android.Net.Uri.Parse (url));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
using System;
|
||||
using Android.Content;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Android.Support.CustomTabs
|
||||
{
|
||||
public class CustomTabsHelper
|
||||
{
|
||||
const string TAG = "CustomTabsHelper";
|
||||
const string STABLE_PACKAGE = "com.android.chrome";
|
||||
const string BETA_PACKAGE = "com.chrome.beta";
|
||||
const string DEV_PACKAGE = "com.chrome.dev";
|
||||
const string LOCAL_PACKAGE = "com.google.android.apps.chrome";
|
||||
const string EXTRA_CUSTOM_TABS_KEEP_ALIVE = "android.support.customtabs.extra.KEEP_ALIVE";
|
||||
|
||||
static String packageNameToUse;
|
||||
|
||||
public static void AddKeepAliveExtra (Context context, Intent intent)
|
||||
{
|
||||
var keepAliveIntent = new Intent ().SetClass (context, typeof(KeepAliveService));
|
||||
intent.PutExtra (EXTRA_CUSTOM_TABS_KEEP_ALIVE, keepAliveIntent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Goes through all apps that handle VIEW intents and have a warmup service. Picks
|
||||
* the one chosen by the user if there is one, otherwise makes a best effort to return a
|
||||
* valid package name.
|
||||
*
|
||||
* This is <strong>not</strong> threadsafe.
|
||||
*
|
||||
* @param context {@link Context} to use for accessing {@link PackageManager}.
|
||||
* @return The package name recommended to use for connecting to custom tabs related components.
|
||||
*/
|
||||
public static String GetPackageNameToUse (Context context)
|
||||
{
|
||||
if (packageNameToUse != null)
|
||||
return packageNameToUse;
|
||||
|
||||
var pm = context.PackageManager;
|
||||
|
||||
// Get default VIEW intent handler.
|
||||
var activityIntent = new Intent (Intent.ActionView, global::Android.Net.Uri.Parse ("http://www.example.com"));
|
||||
var defaultViewHandlerInfo = pm.ResolveActivity (activityIntent, 0);
|
||||
|
||||
string defaultViewHandlerPackageName = null;
|
||||
if (defaultViewHandlerInfo != null)
|
||||
defaultViewHandlerPackageName = defaultViewHandlerInfo.ActivityInfo.PackageName;
|
||||
|
||||
// Get all apps that can handle VIEW intents.
|
||||
var resolvedActivityList = pm.QueryIntentActivities (activityIntent, 0);
|
||||
var packagesSupportingCustomTabs = new List<string> ();
|
||||
|
||||
foreach (var info in resolvedActivityList) {
|
||||
var serviceIntent = new Intent();
|
||||
serviceIntent.SetAction (CustomTabsService.ActionCustomTabsConnection);
|
||||
serviceIntent.SetPackage (info.ActivityInfo.PackageName);
|
||||
|
||||
if (pm.ResolveService (serviceIntent, 0) != null)
|
||||
packagesSupportingCustomTabs.Add (info.ActivityInfo.PackageName);
|
||||
}
|
||||
|
||||
// Now packagesSupportingCustomTabs contains all apps that can handle both VIEW intents
|
||||
// and service calls.
|
||||
if (!packagesSupportingCustomTabs.Any ()) {
|
||||
packageNameToUse = null;
|
||||
} else if (packagesSupportingCustomTabs.Count == 1) {
|
||||
packageNameToUse = packagesSupportingCustomTabs [0];
|
||||
} else if (!string.IsNullOrEmpty (defaultViewHandlerPackageName)
|
||||
&& !hasSpecializedHandlerIntents (context, activityIntent)
|
||||
&& packagesSupportingCustomTabs.Contains (defaultViewHandlerPackageName)) {
|
||||
packageNameToUse = defaultViewHandlerPackageName;
|
||||
} else if (packagesSupportingCustomTabs.Contains (STABLE_PACKAGE)) {
|
||||
packageNameToUse = STABLE_PACKAGE;
|
||||
} else if (packagesSupportingCustomTabs.Contains (BETA_PACKAGE)) {
|
||||
packageNameToUse = BETA_PACKAGE;
|
||||
} else if (packagesSupportingCustomTabs.Contains (DEV_PACKAGE)) {
|
||||
packageNameToUse = DEV_PACKAGE;
|
||||
} else if (packagesSupportingCustomTabs.Contains (LOCAL_PACKAGE)) {
|
||||
packageNameToUse = LOCAL_PACKAGE;
|
||||
}
|
||||
|
||||
return packageNameToUse;
|
||||
}
|
||||
|
||||
static bool hasSpecializedHandlerIntents (Context context, Intent intent)
|
||||
{
|
||||
try {
|
||||
var pm = context.PackageManager;
|
||||
var handlers = pm.QueryIntentActivities (intent, Android.Content.PM.PackageInfoFlags.ResolvedFilter);
|
||||
|
||||
if (handlers == null || handlers.Count == 0)
|
||||
return false;
|
||||
|
||||
foreach (var resolveInfo in handlers) {
|
||||
|
||||
var filter = resolveInfo.Filter;
|
||||
if (filter == null)
|
||||
continue;
|
||||
if (filter.CountDataAuthorities () == 0 || filter.CountDataPaths () == 0)
|
||||
continue;
|
||||
if (resolveInfo.ActivityInfo == null)
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
} catch (Java.Lang.RuntimeException) {
|
||||
global::Android.Util.Log.Error (TAG, "Runtime exception while getting specialized handlers");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// All possible chrome package names with this feature
|
||||
public static string[] Packages = new [] {"", STABLE_PACKAGE, BETA_PACKAGE, DEV_PACKAGE, LOCAL_PACKAGE};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
using Android.Graphics;
|
||||
using Android.Support.CustomTabs;
|
||||
|
||||
namespace Android.Support.CustomTabs
|
||||
{
|
||||
|
||||
class CustomTabsServiceConnectionImpl : CustomTabsServiceConnection
|
||||
{
|
||||
public Action<ComponentName, CustomTabsClient> CustomTabsServiceConnectedHandler { get; set; }
|
||||
public Action<ComponentName> OnServiceDisconnectedHandler { get; set; }
|
||||
|
||||
public override void OnCustomTabsServiceConnected (ComponentName name, CustomTabsClient customTabsClient)
|
||||
{
|
||||
var h = CustomTabsServiceConnectedHandler;
|
||||
if (h != null)
|
||||
h (name, customTabsClient);
|
||||
}
|
||||
|
||||
public override void OnServiceDisconnected (ComponentName name)
|
||||
{
|
||||
var h = OnServiceDisconnectedHandler;
|
||||
if (h != null)
|
||||
h (name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using Android.App;
|
||||
using Android.OS;
|
||||
|
||||
namespace Android.Support.CustomTabs
|
||||
{
|
||||
// Empty service to bind to, to raise the application's importance to the OS
|
||||
[Service]
|
||||
public class KeepAliveService : global::Android.App.Service
|
||||
{
|
||||
static readonly Binder binder = new Binder();
|
||||
|
||||
public override IBinder OnBind (global::Android.Content.Intent intent)
|
||||
{
|
||||
return binder;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{10368E6C-D01B-4462-8E8B-01FC667A7035};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ProjectGuid>{5B33CEC5-C89D-4C5B-8365-17C83CCFAD4C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Xamarin.Android.Support.CustomTabs</RootNamespace>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<AndroidUseLatestPlatformSdk>False</AndroidUseLatestPlatformSdk>
|
||||
<AssemblyName>Xamarin.Android.Support.CustomTabs</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.0.3</TargetFrameworkVersion>
|
||||
<!-- <SignAssembly>true</SignAssembly>
|
||||
<DelaySign>true</DelaySign>
|
||||
<AssemblyOriginatorKeyFile>publickey.snk</AssemblyOriginatorKeyFile> -->
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Additions\Additions.cs" />
|
||||
<Compile Include="Additions\CustomTabsHelper.cs" />
|
||||
<Compile Include="Additions\KeepAliveService.cs" />
|
||||
<Compile Include="..\..\SupportConsts.cs">
|
||||
<Link>Properties\SupportConsts.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Additions\CustomTabsActivityManager.cs" />
|
||||
<Compile Include="Additions\CustomTabsServiceConnectionImpl.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Additions\AboutAdditions.txt" />
|
||||
<None Include="Jars\AboutJars.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<TransformFile Include="Transforms\EnumFields.xml" />
|
||||
<TransformFile Include="Transforms\EnumMethods.xml" />
|
||||
<TransformFile Include="Transforms\Metadata.xml" />
|
||||
<TransformFile Include="Transforms\Metadata.generated.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<InputJar Include="..\..\externals\customtabs\classes.jar">
|
||||
<Link>Jars\classes.jar</Link>
|
||||
</InputJar>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.Bindings.targets" />
|
||||
<PropertyGroup>
|
||||
<DroidDocPaths>..\..\externals\docs\reference</DroidDocPaths>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,37 @@
|
|||
This directory is for Android .jars.
|
||||
|
||||
There are 4 types of jars that are supported:
|
||||
|
||||
== Input Jar and Embedded Jar ==
|
||||
|
||||
This is the jar that bindings should be generated for.
|
||||
|
||||
For example, if you were binding the Google Maps library, this would
|
||||
be Google's "maps.jar".
|
||||
|
||||
The difference between EmbeddedJar and InputJar is, EmbeddedJar is to be
|
||||
embedded in the resulting dll as EmbeddedResource, while InputJar is not.
|
||||
There are couple of reasons you wouldn't like to embed the target jar
|
||||
in your dll (the ones that could be internally loaded by <uses-library>
|
||||
feature e.g. maps.jar, or you cannot embed jars that are under some
|
||||
proprietary license).
|
||||
|
||||
Set the build action for these jars in the properties page to "InputJar".
|
||||
|
||||
|
||||
== Reference Jar and Embedded Reference Jar ==
|
||||
|
||||
These are jars that are referenced by the input jar. C# bindings will
|
||||
not be created for these jars. These jars will be used to resolve
|
||||
types used by the input jar.
|
||||
|
||||
NOTE: Do not add "android.jar" as a reference jar. It will be added automatically
|
||||
based on the Target Framework selected.
|
||||
|
||||
Set the build action for these jars in the properties page to "ReferenceJar".
|
||||
|
||||
"EmbeddedJar" works like "ReferenceJar", but like "EmbeddedJar", it is
|
||||
embedded in your dll. But at application build time, they are not included
|
||||
in the final apk, like ReferenceJar files.
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Android.App;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("Xamarin.Android.Support.CustomTabs")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Xamarin Inc.")]
|
||||
[assembly: AssemblyProduct("")]
|
||||
[assembly: AssemblyCopyright("Xamarin Inc.")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.0")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|
||||
[assembly: Java.Interop.JavaLibraryReference ("classes.jar",
|
||||
PackageName = __Consts.PackageName,
|
||||
SourceUrl = __SupportConsts.Url,
|
||||
EmbeddedArchive = __Consts.AarPath,
|
||||
Version = __SupportConsts.Version)]
|
||||
|
||||
[assembly: Android.IncludeAndroidResourcesFromAttribute ("./",
|
||||
PackageName = __Consts.PackageName,
|
||||
SourceUrl = __SupportConsts.Url,
|
||||
EmbeddedArchive = __Consts.AarPath,
|
||||
Version = __SupportConsts.Version)]
|
||||
|
||||
static class __Consts {
|
||||
public const string PackageName = "Xamarin.Android.Support.CustomTabs";
|
||||
public const string AarPath = "m2repository/com/android/support/customtabs/" + __SupportConsts.AarVersion + "/customtabs-" + __SupportConsts.AarVersion + ".aar";
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
<enum-field-mappings>
|
||||
<!--
|
||||
This example converts the constants Fragment_id, Fragment_name,
|
||||
and Fragment_tag from android.support.v4.app.FragmentActivity.FragmentTag
|
||||
to an enum called Android.Support.V4.App.FragmentTagType with values
|
||||
Id, Name, and Tag.
|
||||
|
||||
<mapping clr-enum-type="Android.Support.V4.App.FragmentTagType" jni-class="android/support/v4/app/FragmentActivity$FragmentTag">
|
||||
<field clr-name="Id" jni-name="Fragment_id" value="1" />
|
||||
<field clr-name="Name" jni-name="Fragment_name" value="0" />
|
||||
<field clr-name="Tag" jni-name="Fragment_tag" value="2" />
|
||||
</type>
|
||||
|
||||
Notes:
|
||||
- An optional "bitfield" attribute marks the enum type with [Flags].
|
||||
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
|
||||
-->
|
||||
</enum-field-mappings>
|
|
@ -0,0 +1,18 @@
|
|||
<enum-method-mappings>
|
||||
<!--
|
||||
This example changes the Java method:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (int flags)
|
||||
to be:
|
||||
android.support.v4.app.Fragment.SavedState.writeToParcel (Android.OS.ParcelableWriteFlags flags)
|
||||
when bound in C#.
|
||||
|
||||
<mapping jni-class="android/support/v4/app/Fragment.SavedState">
|
||||
<method jni-name="writeToParcel" parameter="flags" clr-enum-type="Android.OS.ParcelableWriteFlags" />
|
||||
</mapping>
|
||||
|
||||
Notes:
|
||||
- For Java interfaces, use "jni-interface" attribute instead of "jni-class" attribute.
|
||||
- To change the type of the return value, use "return" as the parameter name.
|
||||
- The parameter names will be p0, p1, ... unless you provide JavaDoc file in the project.
|
||||
-->
|
||||
</enum-method-mappings>
|
|
@ -0,0 +1,77 @@
|
|||
<metadata>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsCallback']/method[@name='extraCallback' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.os.Bundle']]/parameter[1]" name="managedName">callbackName</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsCallback']/method[@name='extraCallback' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.os.Bundle']]/parameter[2]" name="managedName">args</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsCallback']/method[@name='onNavigationEvent' and count(parameter)=2 and parameter[1][@type='int'] and parameter[2][@type='android.os.Bundle']]/parameter[1]" name="managedName">navigationEvent</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsCallback']/method[@name='onNavigationEvent' and count(parameter)=2 and parameter[1][@type='int'] and parameter[2][@type='android.os.Bundle']]/parameter[2]" name="managedName">extras</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsClient']/method[@name='bindCustomTabsService' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.support.customtabs.CustomTabsServiceConnection']]/parameter[1]" name="managedName">context</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsClient']/method[@name='bindCustomTabsService' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.support.customtabs.CustomTabsServiceConnection']]/parameter[2]" name="managedName">packageName</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsClient']/method[@name='bindCustomTabsService' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.support.customtabs.CustomTabsServiceConnection']]/parameter[3]" name="managedName">connection</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsClient']/method[@name='extraCommand' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.os.Bundle']]/parameter[1]" name="managedName">commandName</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsClient']/method[@name='extraCommand' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.os.Bundle']]/parameter[2]" name="managedName">args</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsClient']/method[@name='newSession' and count(parameter)=1 and parameter[1][@type='android.support.customtabs.CustomTabsCallback']]/parameter[1]" name="managedName">callback</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsClient']/method[@name='warmup' and count(parameter)=1 and parameter[1][@type='long']]/parameter[1]" name="managedName">flags</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent']/method[@name='launchUrl' and count(parameter)=2 and parameter[1][@type='android.app.Activity'] and parameter[2][@type='android.net.Uri']]/parameter[1]" name="managedName">context</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent']/method[@name='launchUrl' and count(parameter)=2 and parameter[1][@type='android.app.Activity'] and parameter[2][@type='android.net.Uri']]/parameter[2]" name="managedName">url</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/constructor[@name='CustomTabsIntent.Builder' and count(parameter)=1 and parameter[1][@type='android.support.customtabs.CustomTabsSession']]/parameter[1]" name="managedName">session</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='addMenuItem' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.app.PendingIntent']]/parameter[1]" name="managedName">label</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='addMenuItem' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.app.PendingIntent']]/parameter[2]" name="managedName">pendingIntent</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='addToolbarItem' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.graphics.Bitmap'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='android.app.PendingIntent']]/parameter[1]" name="managedName">id</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='addToolbarItem' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.graphics.Bitmap'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='android.app.PendingIntent']]/parameter[2]" name="managedName">icon</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='addToolbarItem' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.graphics.Bitmap'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='android.app.PendingIntent']]/parameter[3]" name="managedName">description</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='addToolbarItem' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.graphics.Bitmap'] and parameter[3][@type='java.lang.String'] and parameter[4][@type='android.app.PendingIntent']]/parameter[4]" name="managedName">pendingIntent</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setActionButton' and count(parameter)=3 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.app.PendingIntent']]/parameter[1]" name="managedName">icon</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setActionButton' and count(parameter)=3 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.app.PendingIntent']]/parameter[2]" name="managedName">description</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setActionButton' and count(parameter)=3 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.app.PendingIntent']]/parameter[3]" name="managedName">pendingIntent</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setActionButton' and count(parameter)=4 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.app.PendingIntent'] and parameter[4][@type='boolean']]/parameter[1]" name="managedName">icon</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setActionButton' and count(parameter)=4 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.app.PendingIntent'] and parameter[4][@type='boolean']]/parameter[2]" name="managedName">description</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setActionButton' and count(parameter)=4 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.app.PendingIntent'] and parameter[4][@type='boolean']]/parameter[3]" name="managedName">pendingIntent</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setActionButton' and count(parameter)=4 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String'] and parameter[3][@type='android.app.PendingIntent'] and parameter[4][@type='boolean']]/parameter[4]" name="managedName">shouldTint</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setCloseButtonIcon' and count(parameter)=1 and parameter[1][@type='android.graphics.Bitmap']]/parameter[1]" name="managedName">icon</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setExitAnimations' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='int'] and parameter[3][@type='int']]/parameter[1]" name="managedName">context</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setExitAnimations' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='int'] and parameter[3][@type='int']]/parameter[2]" name="managedName">enterResId</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setExitAnimations' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='int'] and parameter[3][@type='int']]/parameter[3]" name="managedName">exitResId</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setSecondaryToolbarColor' and count(parameter)=1 and parameter[1][@type='int']]/parameter[1]" name="managedName">color</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setShowTitle' and count(parameter)=1 and parameter[1][@type='boolean']]/parameter[1]" name="managedName">showTitle</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setStartAnimations' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='int'] and parameter[3][@type='int']]/parameter[1]" name="managedName">context</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setStartAnimations' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='int'] and parameter[3][@type='int']]/parameter[2]" name="managedName">enterResId</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setStartAnimations' and count(parameter)=3 and parameter[1][@type='android.content.Context'] and parameter[2][@type='int'] and parameter[3][@type='int']]/parameter[3]" name="managedName">exitResId</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsIntent.Builder']/method[@name='setToolbarColor' and count(parameter)=1 and parameter[1][@type='int']]/parameter[1]" name="managedName">color</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsService']/method[@name='cleanUpSession' and count(parameter)=1 and parameter[1][@type='android.support.customtabs.CustomTabsSessionToken']]/parameter[1]" name="managedName">sessionToken</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsService']/method[@name='onBind' and count(parameter)=1 and parameter[1][@type='android.content.Intent']]/parameter[1]" name="managedName">intent</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsServiceConnection']/method[@name='onServiceConnected' and count(parameter)=2 and parameter[1][@type='android.content.ComponentName'] and parameter[2][@type='android.os.IBinder']]/parameter[1]" name="managedName">nameValue</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsServiceConnection']/method[@name='onServiceConnected' and count(parameter)=2 and parameter[1][@type='android.content.ComponentName'] and parameter[2][@type='android.os.IBinder']]/parameter[2]" name="managedName">service</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSession']/method[@name='mayLaunchUrl' and count(parameter)=3 and parameter[1][@type='android.net.Uri'] and parameter[2][@type='android.os.Bundle'] and parameter[3][@type='java.util.List<android.os.Bundle>']]/parameter[1]" name="managedName">url</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSession']/method[@name='mayLaunchUrl' and count(parameter)=3 and parameter[1][@type='android.net.Uri'] and parameter[2][@type='android.os.Bundle'] and parameter[3][@type='java.util.List<android.os.Bundle>']]/parameter[2]" name="managedName">extras</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSession']/method[@name='mayLaunchUrl' and count(parameter)=3 and parameter[1][@type='android.net.Uri'] and parameter[2][@type='android.os.Bundle'] and parameter[3][@type='java.util.List<android.os.Bundle>']]/parameter[3]" name="managedName">otherLikelyBundles</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSession']/method[@name='setActionButton' and count(parameter)=2 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String']]/parameter[1]" name="managedName">icon</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSession']/method[@name='setActionButton' and count(parameter)=2 and parameter[1][@type='android.graphics.Bitmap'] and parameter[2][@type='java.lang.String']]/parameter[2]" name="managedName">description</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSession']/method[@name='setToolbarItem' and count(parameter)=3 and parameter[1][@type='int'] and parameter[2][@type='android.graphics.Bitmap'] and parameter[3][@type='java.lang.String']]/parameter[1]" name="managedName">id</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSession']/method[@name='setToolbarItem' and count(parameter)=3 and parameter[1][@type='int'] and parameter[2][@type='android.graphics.Bitmap'] and parameter[3][@type='java.lang.String']]/parameter[2]" name="managedName">icon</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSession']/method[@name='setToolbarItem' and count(parameter)=3 and parameter[1][@type='int'] and parameter[2][@type='android.graphics.Bitmap'] and parameter[3][@type='java.lang.String']]/parameter[3]" name="managedName">description</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSessionToken']/method[@name='equals' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]/parameter[1]" name="managedName">oValue</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='CustomTabsSessionToken']/method[@name='getSessionTokenFromIntent' and count(parameter)=1 and parameter[1][@type='android.content.Intent']]/parameter[1]" name="managedName">intent</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsCallback']/method[@name='extraCallback' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.os.Bundle']]/parameter[1]" name="managedName">callbackName</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsCallback']/method[@name='extraCallback' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.os.Bundle']]/parameter[2]" name="managedName">args</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsCallback']/method[@name='onNavigationEvent' and count(parameter)=2 and parameter[1][@type='int'] and parameter[2][@type='android.os.Bundle']]/parameter[1]" name="managedName">navigationEvent</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsCallback']/method[@name='onNavigationEvent' and count(parameter)=2 and parameter[1][@type='int'] and parameter[2][@type='android.os.Bundle']]/parameter[2]" name="managedName">extras</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsCallback.Stub']/method[@name='asInterface' and count(parameter)=1 and parameter[1][@type='android.os.IBinder']]/parameter[1]" name="managedName">objValue</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsCallback.Stub']/method[@name='onTransact' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.os.Parcel'] and parameter[3][@type='android.os.Parcel'] and parameter[4][@type='int']]/parameter[1]" name="managedName">code</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsCallback.Stub']/method[@name='onTransact' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.os.Parcel'] and parameter[3][@type='android.os.Parcel'] and parameter[4][@type='int']]/parameter[2]" name="managedName">data</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsCallback.Stub']/method[@name='onTransact' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.os.Parcel'] and parameter[3][@type='android.os.Parcel'] and parameter[4][@type='int']]/parameter[3]" name="managedName">reply</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsCallback.Stub']/method[@name='onTransact' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.os.Parcel'] and parameter[3][@type='android.os.Parcel'] and parameter[4][@type='int']]/parameter[4]" name="managedName">flags</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='extraCommand' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.os.Bundle']]/parameter[1]" name="managedName">commandName</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='extraCommand' and count(parameter)=2 and parameter[1][@type='java.lang.String'] and parameter[2][@type='android.os.Bundle']]/parameter[2]" name="managedName">args</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='mayLaunchUrl' and count(parameter)=4 and parameter[1][@type='android.support.customtabs.ICustomTabsCallback'] and parameter[2][@type='android.net.Uri'] and parameter[3][@type='android.os.Bundle'] and parameter[4][@type='java.util.List<android.os.Bundle>']]/parameter[1]" name="managedName">callback</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='mayLaunchUrl' and count(parameter)=4 and parameter[1][@type='android.support.customtabs.ICustomTabsCallback'] and parameter[2][@type='android.net.Uri'] and parameter[3][@type='android.os.Bundle'] and parameter[4][@type='java.util.List<android.os.Bundle>']]/parameter[2]" name="managedName">url</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='mayLaunchUrl' and count(parameter)=4 and parameter[1][@type='android.support.customtabs.ICustomTabsCallback'] and parameter[2][@type='android.net.Uri'] and parameter[3][@type='android.os.Bundle'] and parameter[4][@type='java.util.List<android.os.Bundle>']]/parameter[3]" name="managedName">extras</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='mayLaunchUrl' and count(parameter)=4 and parameter[1][@type='android.support.customtabs.ICustomTabsCallback'] and parameter[2][@type='android.net.Uri'] and parameter[3][@type='android.os.Bundle'] and parameter[4][@type='java.util.List<android.os.Bundle>']]/parameter[4]" name="managedName">otherLikelyBundles</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='newSession' and count(parameter)=1 and parameter[1][@type='android.support.customtabs.ICustomTabsCallback']]/parameter[1]" name="managedName">callback</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='updateVisuals' and count(parameter)=2 and parameter[1][@type='android.support.customtabs.ICustomTabsCallback'] and parameter[2][@type='android.os.Bundle']]/parameter[1]" name="managedName">callback</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='updateVisuals' and count(parameter)=2 and parameter[1][@type='android.support.customtabs.ICustomTabsCallback'] and parameter[2][@type='android.os.Bundle']]/parameter[2]" name="managedName">bundle</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/interface[@name='ICustomTabsService']/method[@name='warmup' and count(parameter)=1 and parameter[1][@type='long']]/parameter[1]" name="managedName">flags</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsService.Stub']/method[@name='asInterface' and count(parameter)=1 and parameter[1][@type='android.os.IBinder']]/parameter[1]" name="managedName">objValue</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsService.Stub']/method[@name='onTransact' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.os.Parcel'] and parameter[3][@type='android.os.Parcel'] and parameter[4][@type='int']]/parameter[1]" name="managedName">code</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsService.Stub']/method[@name='onTransact' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.os.Parcel'] and parameter[3][@type='android.os.Parcel'] and parameter[4][@type='int']]/parameter[2]" name="managedName">data</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsService.Stub']/method[@name='onTransact' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.os.Parcel'] and parameter[3][@type='android.os.Parcel'] and parameter[4][@type='int']]/parameter[3]" name="managedName">reply</attr>
|
||||
<attr path="/api/package[@name='android.support.customtabs']/class[@name='ICustomTabsService.Stub']/method[@name='onTransact' and count(parameter)=4 and parameter[1][@type='int'] and parameter[2][@type='android.os.Parcel'] and parameter[3][@type='android.os.Parcel'] and parameter[4][@type='int']]/parameter[4]" name="managedName">flags</attr>
|
||||
</metadata>
|
|
@ -0,0 +1,10 @@
|
|||
<metadata>
|
||||
<!--
|
||||
This sample removes the class: android.support.v4.content.AsyncTaskLoader.LoadTask:
|
||||
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='AsyncTaskLoader.LoadTask']" />
|
||||
|
||||
This sample removes the method: android.support.v4.content.CursorLoader.loadInBackground:
|
||||
<remove-node path="/api/package[@name='android.support.v4.content']/class[@name='CursorLoader']/method[@name='loadInBackground']" />
|
||||
-->
|
||||
<attr path="/api/package[@name='android.support.customtabs']" name="managedName">Android.Support.CustomTabs</attr>
|
||||
</metadata>
|
|
@ -0,0 +1,17 @@
|
|||
|
||||
# Design Android Support Library
|
||||
|
||||
The Design Support Library provides APIs to support adding material design components and patterns to your apps.
|
||||
|
||||
The Design Support Library adds support for various material design components and patterns for app developers to build upon, such as navigation drawers, floating action buttons (FAB), snackbars, and tabs.
|
||||
|
||||
|
||||
|
||||
|
||||
## Android Support Libraries
|
||||
|
||||
The Android Support Libraries are a set of code libraries that provide backward-compatible versions of Android framework APIs as well as features that are only available through the library APIs. Each Support Library is backward-compatible to a specific Android API level. This design means that your applications can use the libraries' features and still be compatible with devices running older versions of Android.
|
||||
|
||||
Including the Support Libraries in your Android project is considered a best practice for application developers, depending on the range of platform versions your app is targeting and the APIs that it uses. Using the features the libraries provide can help you improve the look of your application, increase performance and broaden the reach of your application to more users.
|
||||
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
|
||||
# Design Android Support Library
|
||||
|
||||
The Design Support Library provides APIs to support adding material design components and patterns to your apps.
|
||||
|
||||
The Design Support Library adds support for various material design components and patterns for app developers to build upon, such as navigation drawers, floating action buttons (FAB), snackbars, and tabs.
|
||||
|
||||
|
||||
{GENERAL}
|
|
@ -0,0 +1,255 @@
|
|||
Design Support Library
|
||||
======================
|
||||
|
||||
The Android Design Support Library brings a number of important material design elements to older Android devices.
|
||||
|
||||
### Prerequisites
|
||||
|
||||
**Themes**
|
||||
|
||||
Any activity you use Design Support library views in must either use the theme `Theme.AppCompat` or inherit from `Theme.AppCompat` found in the AppCompat v7 Support library.
|
||||
|
||||
**Target SDK Version**
|
||||
|
||||
Using this support library requires that your app have its Target Android Version (*targetSdkVersion*) set to Lollipop (5.0 - API Level 21) or higher, or you will have *aapt* related compile errors. You can still set the Target Framework which your app is compiled against as low as Android 4.0.3 (API Level 15).
|
||||
|
||||
|
||||
Snackbar
|
||||
--------
|
||||
Providing lightweight, quick feedback about an operation is a perfect opportunity to use a snackbar. Snackbars are shown on the bottom of the screen and contain text with an optional single action. They automatically time out after the given time length by animating off the screen. In addition, users can swipe them away before the timeout.
|
||||
|
||||
By including the ability to interact with the Snackbar through swiping it away or actions, these are considerably more powerful than toasts, another lightweight feedback mechanism. However, you’ll find the API very similar:
|
||||
|
||||
```csharp
|
||||
Snackbar
|
||||
.Make (parentLayout, "Text Here", Snackbar.LengthLong)
|
||||
.SetAction (Resource.String.snackbar_action, () => { })
|
||||
.Show (); // Don’t forget to show!
|
||||
```
|
||||
|
||||
You’ll note the use of a `View` as the first parameter to `Make ()` - Snackbar will attempt to find an appropriate parent of the Snackbar’s view to ensure that it is anchored to the bottom.
|
||||
|
||||
|
||||
|
||||
|
||||
Navigation View
|
||||
----------------
|
||||
The navigation drawer can be an important focal point for identity and navigation within your app and consistency in the design here can make a considerable difference in how easy your app is to navigate, particularly for first time users. `NavigationView` makes this easier by providing the framework you need for the navigation drawer as well as the ability to inflate your navigation items through a menu resource.
|
||||
|
||||
You use `NavigationView` as `DrawerLayout`'s drawer content view with a layout such as:
|
||||
|
||||
```xml
|
||||
<android.support.v4.widget.DrawerLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:fitsSystemWindows="true">
|
||||
|
||||
<!-- your content layout -->
|
||||
|
||||
<android.support.design.widget.NavigationView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="start"
|
||||
app:headerLayout="@layout/drawer_header"
|
||||
app:menu="@menu/drawer"/>
|
||||
</android.support.v4.widget.DrawerLayout>
|
||||
```
|
||||
|
||||
You’ll note two attributes for NavigationView: app:headerLayout controls the (optional) layout used for the header. `app:menu` is the menu resource inflated for the navigation items (which can also be updated programmatically). `NavigationView` takes care of the scrim protection of the status bar for you, ensuring that your `NavigationView` interacts with the status bar appropriately on API21+ devices.
|
||||
|
||||
The simplest drawer menus will be a collection of checkable menu items:
|
||||
|
||||
```xml
|
||||
<group android:checkableBehavior="single">
|
||||
<item
|
||||
android:id="@+id/navigation_item_1"
|
||||
android:checked="true"
|
||||
android:icon="@drawable/ic_android"
|
||||
android:title="@string/navigation_item_1"/>
|
||||
<item
|
||||
android:id="@+id/navigation_item_2"
|
||||
android:icon="@drawable/ic_android"
|
||||
android:title="@string/navigation_item_2"/>
|
||||
</group>
|
||||
```
|
||||
|
||||
The checked item will appear highlighted in the navigation drawer, ensuring the user knows which navigation item is currently selected.
|
||||
|
||||
You can also use subheaders in your menu to separate groups of items:
|
||||
|
||||
```xml
|
||||
<item
|
||||
android:id="@+id/navigation_subheader"
|
||||
android:title="@string/navigation_subheader">
|
||||
<menu>
|
||||
<item
|
||||
android:id="@+id/navigation_sub_item_1"
|
||||
android:icon="@drawable/ic_android"
|
||||
android:title="@string/navigation_sub_item_1"/>
|
||||
<item
|
||||
android:id="@+id/navigation_sub_item_2"
|
||||
android:icon="@drawable/ic_android"
|
||||
android:title="@string/navigation_sub_item_2"/>
|
||||
</menu>
|
||||
</item>
|
||||
```
|
||||
|
||||
You’ll get callbacks on selected items by subscribing to the `NavigationItemSelected` event. This provides you with the `MenuItem` that was clicked, allowing you to handle selection events, changed the checked status, load new content, programmatically close the drawer, or any other actions you may want.
|
||||
|
||||
|
||||
|
||||
|
||||
Floating Action Button
|
||||
----------------------
|
||||
A floating action button is a round button denoting a primary action on your interface. The Design library’s `FloatingActionButton` gives you a single consistent implementation, by default colored using the `colorAccent` from your theme.
|
||||
|
||||
In addition to the normal size floating action button, it also supports the mini size (`fabSize="mini"`) when visual continuity with other elements is critical. As `FloatingActionButton` extends `ImageView`, you’ll use `android:src` or any of the methods such as `SetImageDrawable ()` to control the icon shown within the `FloatingActionButton`.
|
||||
|
||||
|
||||
|
||||
|
||||
Floating labels for editing text
|
||||
--------------------------------
|
||||
|
||||
Even the humble `EditText` has room to improve in material design. While an `EditText` alone will hide the hint text after the first character is typed, you can now wrap it in a `TextInputLayout`, causing the hint text to become a floating label above the `EditText`, ensuring that users never lose context in what they are entering:
|
||||
|
||||
```xml
|
||||
<android.support.design.widget.TextInputLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editTextFirstName"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="First Name" />
|
||||
|
||||
</android.support.design.widget.TextInputLayout>
|
||||
```
|
||||
|
||||
In addition to showing hints, you can also display an error message below the `EditText` by calling `SetError ()`.
|
||||
|
||||
|
||||
|
||||
Tabs
|
||||
----
|
||||
Switching between different views in your app via tabs is not a new concept to material design and they are equally at home as a top level navigation pattern or for organizing different groupings of content within your app (say, different genres of music).
|
||||
|
||||
The Design library’s `TabLayout` implements both fixed tabs, where the view’s width is divided equally between all of the tabs, as well as scrollable tabs, where the tabs are not a uniform size and can scroll horizontally. Tabs can be added programmatically:
|
||||
|
||||
```csharp
|
||||
var tabLayout = ...;
|
||||
|
||||
tabLayout.AddTab (tabLayout.NewTab ().SetText ("Tab 1"));
|
||||
```
|
||||
|
||||
However, if you are using a `ViewPager` for horizontal paging between tabs, you can create tabs directly from your `PagerAdapter`’s `PageTitle` and then connect the two together using `SetupWithViewPager ()`. This ensures that tab selection events update the `ViewPager` and page changes update the selected tab.
|
||||
|
||||
|
||||
|
||||
|
||||
CoordinatorLayout, motion, and scrolling
|
||||
----------------------------------------
|
||||
|
||||
Distinctive visuals are only one part of material design: motion is also an important part of making a great material designed app. While there are a lot of parts of motion in material design including touch ripples and meaningful transitions, the Design library introduces `CoordinatorLayout`, a layout which provides an additional level of control over touch events between child views, something which many of the components in the Design library take advantage of.
|
||||
|
||||
|
||||
|
||||
|
||||
CoordinatorLayout and floating action buttons
|
||||
---------------------------------------------
|
||||
|
||||
A great example of this is when you add a `FloatingActionButton` as a child of your `CoordinatorLayout` and then pass that `CoordinatorLayout` to your `Snackbar.Make ()` call - instead of the snackbar displaying over the floating action button, the `FloatingActionButton` takes advantage of additional callbacks provided by `CoordinatorLayout` to automatically move upward as the snackbar animates in and returns to its position when the snackbar animates out on Android 3.0 and higher devices - no extra code required.
|
||||
|
||||
`CoordinatorLayout` also provides an `layout_anchor` attribute which, along with `layout_anchorGravity`, can be used to place floating views, such as the `FloatingActionButton`, relative to other views.
|
||||
|
||||
|
||||
|
||||
|
||||
CoordinatorLayout and the app bar
|
||||
---------------------------------
|
||||
|
||||
The other main use case for the `CoordinatorLayout` concerns the app bar (formerly action bar) and scrolling techniques. You may already be using a `Toolbar` in your layout, allowing you to more easily customize the look and integration of that iconic part of an app with the rest of your layout. The Design library takes this to the next level: using an `AppBarLayout` allows your `Toolbar` and other views (such as tabs provided by `TabLayout`) to react to scroll events in a sibling view marked with a `ScrollingViewBehavior`. Therefore you can create a layout such as:
|
||||
|
||||
```xml
|
||||
<android.support.design.widget.CoordinatorLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<! -- Your Scrollable View -->
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
|
||||
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<android.support.v7.widget.Toolbar
|
||||
...
|
||||
app:layout_scrollFlags="scroll|enterAlways">
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
...
|
||||
app:layout_scrollFlags="scroll|enterAlways" />
|
||||
|
||||
</android.support.v7.widget.Toolbar>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
```
|
||||
|
||||
Now, as the user scrolls the `RecyclerView`, the `AppBarLayout` can respond to those events by using the children’s scroll flags to control how they enter (scroll on screen) and exit (scroll off screen). Flags include:
|
||||
|
||||
- `scroll` this flag should be set for all views that want to scroll off the
|
||||
- `screen` for views that do not use this flag, they’ll remain pinned to the top of the screen
|
||||
- `enterAlways` this flag ensures that any downward scroll will cause this view to become visible, enabling the *quick return* pattern
|
||||
- `enterAlwaysCollapsed` When your view has declared a minHeight and you use this flag, your View will only enter at its minimum height (i.e., *collapsed*), only re-expanding to its full height when the scrolling view has reached it’s top.
|
||||
- `exitUntilCollapsed` this flag causes the view to scroll off until it is *collapsed* (its minHeight) before exiting
|
||||
|
||||
One note: all views using the scroll flag must be declared before views that do not use the flag. This ensures that all views exit from the top, leaving the fixed elements behind.
|
||||
|
||||
|
||||
|
||||
|
||||
Collapsing Toolbars
|
||||
-------------------
|
||||
|
||||
Adding a `Toolbar` directly to an `AppBarLayout` gives you access to the `enterAlwaysCollapsed` and `exitUntilCollapsed` scroll flags, but not the detailed control on how different elements react to collapsing. For that, you can use `CollapsingToolbarLayout`:
|
||||
|
||||
```xml
|
||||
<android.support.design.widget.AppBarLayout
|
||||
android:layout_height="192dp"
|
||||
android:layout_width="match_parent">
|
||||
|
||||
<android.support.design.widget.CollapsingToolbarLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_scrollFlags="scroll|exitUntilCollapsed">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_width="match_parent"
|
||||
app:layout_collapseMode="pin"/>
|
||||
|
||||
</android.support.design.widget.CollapsingToolbarLayout>
|
||||
|
||||
</android.support.design.widget.AppBarLayout>
|
||||
```
|
||||
|
||||
This setup uses `CollapsingToolbarLayout`’s `app:layout_collapseMode="pin"` to ensure that the `Toolbar` itself remains pinned to the top of the screen while the view collapses. Even better, when you use `CollapsingToolbarLayout` and `Toolbar` together, the title will automatically appear larger when the layout is fully visible, then transition to its default size as it is collapsed. Note that in those cases, you should call `SetTitle ()` on the `CollapsingToolbarLayout`, rather than on the `Toolbar` itself.
|
||||
|
||||
In addition to pinning a view, you can use `app:layout_collapseMode="parallax"` (and optionally `app:layout_collapseParallaxMultiplier="0.7"` to set the parallax multiplier) to implement parallax scrolling (say of a sibling `ImageView` within the `CollapsingToolbarLayout`). This use case pairs nicely with the `app:contentScrim="?attr/colorPrimary"` attribute for `CollapsingToolbarLayout`, adding a full bleed scrim when the view is collapsed.
|
||||
|
||||
|
||||
|
||||
|
||||
CoordinatorLayout and custom views
|
||||
----------------------------------
|
||||
|
||||
One thing that is important to note is that `CoordinatorLayout` doesn’t have any innate understanding of a `FloatingActionButton` or `AppBarLayout` work - it just provides an additional API in the form of a `Coordinator.Behavior`, which allows child views to better control touch events and gestures as well as declare dependencies between each other and receive callbacks via `OnDependentViewChanged ()`.
|
|
@ -0,0 +1,37 @@
|
|||
version: $version$
|
||||
name: Android Support Design Library
|
||||
id: xamandroidsupportdesign
|
||||
publisher: Xamarin Inc.
|
||||
publisher-url: http://xamarin.com
|
||||
src-url: https://github.com/xamarin/AndroidSupportComponents
|
||||
license: ../../component/License.md
|
||||
summary: Provide backward-compatible versions of Android framework APIs.
|
||||
icons:
|
||||
- icons/xamandroidsupportdesign_128x128.png
|
||||
- icons/xamandroidsupportdesign_512x512.png
|
||||
libraries:
|
||||
android: ../../output/Xamarin.Android.Support.Design.dll
|
||||
is_shell: true
|
||||
packages:
|
||||
android:
|
||||
- Xamarin.Android.Support.Design, Version=$nuget-version$
|
||||
samples:
|
||||
- name: "Cheesesquare"
|
||||
path: ../samples/Cheesesquare.sln
|
||||
removeProjects:
|
||||
- V4
|
||||
- Design
|
||||
- V7-AppCompat
|
||||
- V7-CardView
|
||||
- V7-RecyclerView
|
||||
installNuGets:
|
||||
- project: Cheesesquare
|
||||
packages:
|
||||
- Xamarin.Android.Support.v4
|
||||
- Xamarin.Android.Support.Design
|
||||
- Xamarin.Android.Support.v7.AppCompat
|
||||
- Xamarin.Android.Support.v7.CardView
|
||||
- Xamarin.Android.Support.v7.RecyclerView
|
||||
local-nuget-repo: ../../output
|
||||
no_build: true
|
||||
|
После Ширина: | Высота: | Размер: 9.8 KiB |
После Ширина: | Высота: | Размер: 88 KiB |
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>Xamarin.Android.Support.Design</id>
|
||||
<title>Xamarin Android Support Library - Design</title>
|
||||
<version>$version$</version>
|
||||
<authors>Xamarin Inc.</authors>
|
||||
<owners>Xamarin Inc.</owners>
|
||||
<requireLicenseAcceptance>true</requireLicenseAcceptance>
|
||||
<description>Design Android Support Library C# bindings for Xamarin</description>
|
||||
<copyright>Copyright 2013-2016</copyright>
|
||||
<projectUrl>https://components.xamarin.com/view/xamandroidsupportdesign</projectUrl>
|
||||
<licenseUrl>https://components.xamarin.com/license/xamandroidsupportdesign</licenseUrl>
|
||||
<iconUrl>https://xamarin-component-icons.s3.amazonaws.com/Xamarin.Android.Support.Design.png</iconUrl>
|
||||
<dependencies>
|
||||
<dependency id="Xamarin.Android.Support.v7.AppCompat" version="[$version$]"/>
|
||||
<dependency id="Xamarin.Android.Support.v7.RecyclerView" version="[$version$]"/>
|
||||
<dependency id="Xamarin.Android.Support.v4" version="[$version$]"/>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="output/Xamarin.Android.Support.Design.dll" target="lib\MonoAndroid43" />
|
||||
</files>
|
||||
</package>
|
|
@ -0,0 +1,54 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9690A5F4-6D51-47C4-BB78-ACDF05B859C5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Cheesesquare.UITests</RootNamespace>
|
||||
<AssemblyName>Cheesesquare.UITests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Xamarin.UITest">
|
||||
<HintPath>..\packages\Xamarin.UITest.0.8.0\lib\Xamarin.UITest.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Cheesesquare\Cheesesquare.csproj">
|
||||
<Project>{580F5B91-D14A-449B-BFDE-C21A0F9A7D2F}</Project>
|
||||
<Name>Cheesesquare</Name>
|
||||
<ReferenceOutputAssembly>False</ReferenceOutputAssembly>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Tests.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Xamarin.UITest;
|
||||
using Xamarin.UITest.Android;
|
||||
using Xamarin.UITest.Queries;
|
||||
|
||||
namespace Cheesesquare.UITests
|
||||
{
|
||||
[TestFixture]
|
||||
public class Tests
|
||||
{
|
||||
AndroidApp app;
|
||||
|
||||
[SetUp]
|
||||
public void BeforeEachTest ()
|
||||
{
|
||||
app = ConfigureApp.Android
|
||||
.ApkFile ("app.apk")
|
||||
.PreferIdeSettings ()
|
||||
.StartApp ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClickingHamburgerShouldRevealDrawer ()
|
||||
{
|
||||
app.Screenshot ("Launch");
|
||||
app.Tap(t => t.Class("ImageButton"));
|
||||
app.WaitForElement(t => t.Text("Discussion"));
|
||||
app.Screenshot ("Tap Hamburger");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClickingFloatingActionButtonShouldDisplaySnackbar ()
|
||||
{
|
||||
app.Screenshot ("Launch");
|
||||
app.Tap (q => q.Id ("fab"));
|
||||
app.Screenshot ("Tap Button");
|
||||
app.WaitForElement (q => q.Id ("snackbar_text"));
|
||||
app.Screenshot ("Snackbar");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ClickingItemShouldRevealDetails ()
|
||||
{
|
||||
app.Screenshot ("Launch");
|
||||
app.Tap (q => q.Id ("text1"));
|
||||
app.Screenshot ("Tap Item");
|
||||
app.WaitForElement (q => q.Text ("Info"));
|
||||
app.Screenshot ("Details Page");
|
||||
}
|
||||
|
||||
//[Test]
|
||||
public void Repl ()
|
||||
{
|
||||
app.Repl ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NUnit" version="2.6.4" targetFramework="net45" />
|
||||
<package id="Xamarin.UITest" version="0.8.0" targetFramework="net45" />
|
||||
</packages>
|
|
@ -0,0 +1,53 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V4", "..\..\v4\source\V4.csproj", "{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-CardView", "..\..\v7-cardview\source\V7-CardView.csproj", "{E9848EF1-14E6-4144-95A0-926A52F301B5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-RecyclerView", "..\..\v7-recyclerview\source\V7-RecyclerView.csproj", "{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "V7-AppCompat", "..\..\v7-appcompat\source\V7-AppCompat.csproj", "{B4ED245B-BBD8-4549-9990-476A36AAD381}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Design", "..\source\Design.csproj", "{8022A1F5-C228-4B21-8194-BC9E76F9174A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cheesesquare", "Cheesesquare\Cheesesquare.csproj", "{580F5B91-D14A-449B-BFDE-C21A0F9A7D2F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cheesesquare.UITests", "Cheesesquare.UITests\Cheesesquare.UITests.csproj", "{9690A5F4-6D51-47C4-BB78-ACDF05B859C5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{580F5B91-D14A-449B-BFDE-C21A0F9A7D2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{580F5B91-D14A-449B-BFDE-C21A0F9A7D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{580F5B91-D14A-449B-BFDE-C21A0F9A7D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{580F5B91-D14A-449B-BFDE-C21A0F9A7D2F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8022A1F5-C228-4B21-8194-BC9E76F9174A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{9690A5F4-6D51-47C4-BB78-ACDF05B859C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9690A5F4-6D51-47C4-BB78-ACDF05B859C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9690A5F4-6D51-47C4-BB78-ACDF05B859C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9690A5F4-6D51-47C4-BB78-ACDF05B859C5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{B4ED245B-BBD8-4549-9990-476A36AAD381}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E9848EF1-14E6-4144-95A0-926A52F301B5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,19 @@
|
|||
Any raw assets you want to be deployed with your application can be placed in
|
||||
this directory (and child directories) and given a Build Action of "AndroidAsset".
|
||||
|
||||
These files will be deployed with your package and will be accessible using Android's
|
||||
AssetManager, like this:
|
||||
|
||||
public class ReadAsset : Activity
|
||||
{
|
||||
protected override void OnCreate (Bundle bundle)
|
||||
{
|
||||
base.OnCreate (bundle);
|
||||
|
||||
InputStream input = Assets.Open ("my_asset.txt");
|
||||
}
|
||||
}
|
||||
|
||||
Additionally, some Android functions will automatically load asset files:
|
||||
|
||||
Typeface tf = Typeface.CreateFromAsset (Context.Assets, "fonts/samplefont.ttf");
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using Android.OS;
|
||||
using Android.Support.V7.App;
|
||||
using Android.Support.V7.Widget;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using V7Toolbar = Android.Support.V7.Widget.Toolbar;
|
||||
using Android.Support.Design.Widget;
|
||||
using Android.App;
|
||||
|
||||
namespace Cheesesquare
|
||||
{
|
||||
[Activity (Label="Details")]
|
||||
public class CheeseDetailActivity : AppCompatActivity
|
||||
{
|
||||
public const string EXTRA_NAME = "cheese_name";
|
||||
|
||||
protected override void OnCreate (Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate (savedInstanceState);
|
||||
|
||||
SetContentView(Resource.Layout.activity_detail);
|
||||
|
||||
var cheeseName = Intent.GetStringExtra (EXTRA_NAME);
|
||||
|
||||
var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar);
|
||||
SetSupportActionBar (toolbar);
|
||||
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
|
||||
|
||||
var collapsingToolbar = FindViewById<CollapsingToolbarLayout> (Resource.Id.collapsing_toolbar);
|
||||
collapsingToolbar.Title = cheeseName;
|
||||
//collapsingToolbar.SetTitle (cheeseName);
|
||||
|
||||
loadBackdrop();
|
||||
}
|
||||
|
||||
public override bool OnOptionsItemSelected (IMenuItem item)
|
||||
{
|
||||
switch (item.ItemId) {
|
||||
case Android.Resource.Id.Home:
|
||||
Finish ();
|
||||
return true;
|
||||
}
|
||||
return base.OnOptionsItemSelected (item);
|
||||
}
|
||||
|
||||
void loadBackdrop()
|
||||
{
|
||||
var imageView = FindViewById<ImageView> (Resource.Id.backdrop);
|
||||
|
||||
var r = Cheeses.GetRandomCheeseBackground ();
|
||||
imageView.SetImageResource (r);
|
||||
}
|
||||
|
||||
public override bool OnCreateOptionsMenu(IMenu menu)
|
||||
{
|
||||
MenuInflater.Inflate (Resource.Menu.sample_actions, menu);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
using System;
|
||||
using Android.Support.V4.App;
|
||||
using Android.Views;
|
||||
using Android.OS;
|
||||
using Android.Support.V7.Widget;
|
||||
using System.Collections.Generic;
|
||||
using Android.Widget;
|
||||
using Android.Content;
|
||||
using Android.Util;
|
||||
using Android.Runtime;
|
||||
using System.Threading.Tasks;
|
||||
using System.Linq;
|
||||
|
||||
namespace Cheesesquare
|
||||
{
|
||||
public class CheeseListFragment : Android.Support.V4.App.Fragment
|
||||
{
|
||||
public CheeseListFragment ()
|
||||
{
|
||||
}
|
||||
|
||||
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
var v = inflater.Inflate (
|
||||
Resource.Layout.fragment_cheese_list, container, false);
|
||||
var rv = v.JavaCast<RecyclerView> ();
|
||||
|
||||
setupRecyclerView(rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
void setupRecyclerView (RecyclerView recyclerView)
|
||||
{
|
||||
recyclerView.SetLayoutManager (new LinearLayoutManager (recyclerView.Context));
|
||||
recyclerView.SetAdapter (new SimpleStringRecyclerViewAdapter (Activity,
|
||||
getRandomSublist(Cheeses.CheeseList, 30)));
|
||||
}
|
||||
|
||||
List<String> getRandomSublist(string[] array, int amount)
|
||||
{
|
||||
var list = new List<string> (amount);
|
||||
var random = new Random();
|
||||
while (list.Count < amount)
|
||||
list.Add (array[random.Next (array.Length)]);
|
||||
list.Add ("Old Amsterdam");
|
||||
return list;
|
||||
}
|
||||
|
||||
public class SimpleStringRecyclerViewAdapter : RecyclerView.Adapter
|
||||
{
|
||||
|
||||
TypedValue typedValue = new TypedValue ();
|
||||
int background;
|
||||
List<string> values;
|
||||
Android.App.Activity parent;
|
||||
|
||||
public class ViewHolder : RecyclerView.ViewHolder
|
||||
{
|
||||
public string BoundString { get; set; }
|
||||
public View View { get;set; }
|
||||
public ImageView ImageView { get; set; }
|
||||
public TextView TextView { get; set; }
|
||||
public EventHandler ClickHandler { get; set; }
|
||||
|
||||
public ViewHolder (View view) : base (view)
|
||||
{
|
||||
View = view;
|
||||
ImageView = view.FindViewById<ImageView> (Resource.Id.avatar);
|
||||
TextView = view.FindViewById<TextView> (Android.Resource.Id.Text1);
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return base.ToString () + " '" + TextView.Text;
|
||||
}
|
||||
}
|
||||
|
||||
public String GetValueAt (int position)
|
||||
{
|
||||
return values[position];
|
||||
}
|
||||
|
||||
public SimpleStringRecyclerViewAdapter (Android.App.Activity context, List<String> items)
|
||||
{
|
||||
parent = context;
|
||||
context.Theme.ResolveAttribute (Resource.Attribute.selectableItemBackground, typedValue, true);
|
||||
background = typedValue.ResourceId;
|
||||
values = items;
|
||||
}
|
||||
|
||||
public override RecyclerView.ViewHolder OnCreateViewHolder (ViewGroup parent, int viewType)
|
||||
{
|
||||
var view = LayoutInflater.From (parent.Context)
|
||||
.Inflate(Resource.Layout.list_item, parent, false);
|
||||
view.SetBackgroundResource (background);
|
||||
return new ViewHolder(view);
|
||||
}
|
||||
|
||||
public override void OnBindViewHolder (RecyclerView.ViewHolder holder, int position)
|
||||
{
|
||||
var h = holder as ViewHolder;
|
||||
|
||||
h.BoundString = values [position];
|
||||
h.TextView.Text = values [position];
|
||||
|
||||
if (h.ClickHandler != null)
|
||||
h.View.Click -= h.ClickHandler;
|
||||
|
||||
h.ClickHandler = new EventHandler ((sender, e) => {
|
||||
var context = h.View.Context;
|
||||
var intent = new Intent (context, typeof(CheeseDetailActivity));
|
||||
intent.PutExtra (CheeseDetailActivity.EXTRA_NAME, h.BoundString);
|
||||
|
||||
context.StartActivity (intent);
|
||||
});
|
||||
|
||||
h.View.Click += h.ClickHandler;
|
||||
|
||||
h.ImageView.SetImageResource (Cheeses.GetRandomCheeseResource (parent));
|
||||
}
|
||||
|
||||
public override int ItemCount {
|
||||
get { return values.Count; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,192 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Android.App;
|
||||
using Android.Graphics.Drawables;
|
||||
using Android.Graphics;
|
||||
|
||||
namespace Cheesesquare
|
||||
{
|
||||
public static class Cheeses
|
||||
{
|
||||
static Random rnd = new Random();
|
||||
|
||||
public static int GetRandomCheeseResource (Activity context)
|
||||
{
|
||||
var r = 0;
|
||||
switch (rnd.Next (5)) {
|
||||
case 0:
|
||||
r = Resource.Drawable.cheese_1_small;
|
||||
break;
|
||||
case 1:
|
||||
r = Resource.Drawable.cheese_2_small;
|
||||
break;
|
||||
case 2:
|
||||
r = Resource.Drawable.cheese_3_small;
|
||||
break;
|
||||
case 3:
|
||||
r = Resource.Drawable.cheese_4_small;
|
||||
break;
|
||||
case 4:
|
||||
r = Resource.Drawable.cheese_5_small;
|
||||
break;
|
||||
default:
|
||||
r = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
public static int GetRandomCheeseBackground ()
|
||||
{
|
||||
switch (rnd.Next (5)) {
|
||||
case 0:
|
||||
return Resource.Drawable.cheese_1;
|
||||
case 1:
|
||||
return Resource.Drawable.cheese_2;
|
||||
case 2:
|
||||
return Resource.Drawable.cheese_3;
|
||||
case 3:
|
||||
return Resource.Drawable.cheese_4;
|
||||
case 4:
|
||||
return Resource.Drawable.cheese_5;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public static string[] CheeseList = new [] {
|
||||
"Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi",
|
||||
"Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale",
|
||||
"Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
|
||||
"Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell",
|
||||
"Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc",
|
||||
"Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss",
|
||||
"Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon",
|
||||
"Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase",
|
||||
"Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese",
|
||||
"Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy",
|
||||
"Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille",
|
||||
"Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore",
|
||||
"Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)",
|
||||
"Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves",
|
||||
"Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur",
|
||||
"Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon",
|
||||
"Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin",
|
||||
"Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)",
|
||||
"Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine",
|
||||
"Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza",
|
||||
"Buchette d'Anjou", "Buffalo", "Burgos", "Butterkase", "Button (Innes)",
|
||||
"Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta",
|
||||
"Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie",
|
||||
"Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat",
|
||||
"Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano",
|
||||
"Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain",
|
||||
"Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou",
|
||||
"Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar",
|
||||
"Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno",
|
||||
"Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack",
|
||||
"Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper",
|
||||
"Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)",
|
||||
"Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
|
||||
"Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza",
|
||||
"Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
|
||||
"Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino",
|
||||
"Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina",
|
||||
"Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby",
|
||||
"Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin",
|
||||
"Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester",
|
||||
"Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue",
|
||||
"Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz",
|
||||
"Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich",
|
||||
"Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue",
|
||||
"Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle",
|
||||
"Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia",
|
||||
"Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis",
|
||||
"Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus",
|
||||
"Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison",
|
||||
"Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois",
|
||||
"Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse",
|
||||
"Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese",
|
||||
"Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise",
|
||||
"Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra",
|
||||
"Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola",
|
||||
"Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost",
|
||||
"Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel",
|
||||
"Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve",
|
||||
"Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi",
|
||||
"Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti",
|
||||
"Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve",
|
||||
"Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster",
|
||||
"Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg",
|
||||
"Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa",
|
||||
"Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine",
|
||||
"Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese",
|
||||
"Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere",
|
||||
"La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire",
|
||||
"Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou",
|
||||
"Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger",
|
||||
"Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings",
|
||||
"Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse",
|
||||
"Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam",
|
||||
"Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego",
|
||||
"Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin",
|
||||
"Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)",
|
||||
"Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse",
|
||||
"Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda",
|
||||
"Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte",
|
||||
"Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio",
|
||||
"Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne",
|
||||
"Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)",
|
||||
"Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster",
|
||||
"Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel",
|
||||
"Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca",
|
||||
"Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre",
|
||||
"Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty",
|
||||
"Oszczypek", "Oxford Blue", "Petit Berrichon", "Palet de Babligny", "Paneer", "Panela",
|
||||
"Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano",
|
||||
"Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage",
|
||||
"Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry",
|
||||
"Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid",
|
||||
"Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn",
|
||||
"Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse",
|
||||
"Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin",
|
||||
"Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin",
|
||||
"Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre",
|
||||
"Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone",
|
||||
"Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark",
|
||||
"Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit",
|
||||
"Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia",
|
||||
"Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)",
|
||||
"Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna",
|
||||
"Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera",
|
||||
"Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou",
|
||||
"Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder",
|
||||
"Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort",
|
||||
"Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr",
|
||||
"Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin",
|
||||
"Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre",
|
||||
"Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss",
|
||||
"Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela",
|
||||
"Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda",
|
||||
"Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain",
|
||||
"Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese",
|
||||
"Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale",
|
||||
"Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie",
|
||||
"Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri",
|
||||
"Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar",
|
||||
"Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance",
|
||||
"Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes",
|
||||
"Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet",
|
||||
"Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe",
|
||||
"Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa",
|
||||
"Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois",
|
||||
"Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue",
|
||||
"Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington",
|
||||
"Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou",
|
||||
"Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue",
|
||||
"Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectTypeGuids>{EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<ProjectGuid>{580F5B91-D14A-449B-BFDE-C21A0F9A7D2F}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>Cheesesquare</RootNamespace>
|
||||
<MonoAndroidAssetsPrefix>Assets</MonoAndroidAssetsPrefix>
|
||||
<MonoAndroidResourcePrefix>Resources</MonoAndroidResourcePrefix>
|
||||
<AndroidManifest>Properties\AndroidManifest.xml</AndroidManifest>
|
||||
<AndroidResgenClass>Resource</AndroidResgenClass>
|
||||
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
|
||||
<AndroidApplication>True</AndroidApplication>
|
||||
<AndroidUseLatestPlatformSdk>True</AndroidUseLatestPlatformSdk>
|
||||
<AssemblyName>Cheesesquare</AssemblyName>
|
||||
<TargetFrameworkVersion>v6.0</TargetFrameworkVersion>
|
||||
<AndroidSupportedAbis>armeabi;armeabi-v7a;x86;arm64-v8a;x86_64</AndroidSupportedAbis>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidLinkMode>None</AndroidLinkMode>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
|
||||
<ConsolePause>false</ConsolePause>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="Mono.Android" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
<Compile Include="Resources\Resource.designer.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Cheeses.cs" />
|
||||
<Compile Include="CheeseListFragment.cs" />
|
||||
<Compile Include="CheeseDetailActivity.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\AboutResources.txt" />
|
||||
<None Include="Properties\AndroidManifest.xml" />
|
||||
<None Include="Assets\AboutAssets.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidResource Include="Resources\values\Strings.xml" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_1.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_2.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_3.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_4.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_5.jpg" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_dashboard.png" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_discuss.png" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_done.png" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_event.png" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_forum.png" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_headset.png" />
|
||||
<AndroidResource Include="Resources\drawable-hdpi\ic_menu.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_dashboard.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_discuss.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_done.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_event.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_forum.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_headset.png" />
|
||||
<AndroidResource Include="Resources\drawable-mdpi\ic_menu.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_dashboard.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_discuss.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_done.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_event.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_forum.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_headset.png" />
|
||||
<AndroidResource Include="Resources\drawable-xhdpi\ic_menu.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\ic_dashboard.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\ic_discuss.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\ic_done.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\ic_event.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\ic_forum.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\ic_headset.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxhdpi\ic_menu.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxxhdpi\ic_done.png" />
|
||||
<AndroidResource Include="Resources\drawable-xxxhdpi\ic_menu.png" />
|
||||
<AndroidResource Include="Resources\layout\activity_detail.xml" />
|
||||
<AndroidResource Include="Resources\layout\activity_main.xml" />
|
||||
<AndroidResource Include="Resources\layout\fragment_cheese_list.xml" />
|
||||
<AndroidResource Include="Resources\layout\include_list_viewpager.xml" />
|
||||
<AndroidResource Include="Resources\layout\list_item.xml" />
|
||||
<AndroidResource Include="Resources\layout\nav_header.xml" />
|
||||
<AndroidResource Include="Resources\menu\drawer_view.xml" />
|
||||
<AndroidResource Include="Resources\menu\sample_actions.xml" />
|
||||
<AndroidResource Include="Resources\mipmap-hdpi\ic_launcher.png" />
|
||||
<AndroidResource Include="Resources\mipmap-mdpi\ic_launcher.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xhdpi\ic_launcher.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxhdpi\ic_launcher.png" />
|
||||
<AndroidResource Include="Resources\mipmap-xxxhdpi\ic_launcher.png" />
|
||||
<AndroidResource Include="Resources\values-v21\styles.xml" />
|
||||
<AndroidResource Include="Resources\values\colors.xml" />
|
||||
<AndroidResource Include="Resources\values\dimens.xml" />
|
||||
<AndroidResource Include="Resources\values\styles.xml" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_1_small.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_2_small.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_3_small.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_4_small.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\cheese_5_small.jpg" />
|
||||
<AndroidResource Include="Resources\drawable\icon.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Resources\drawable-mdpi\" />
|
||||
<Folder Include="Resources\drawable-xxxhdpi\" />
|
||||
<Folder Include="Resources\layout\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\source\Design.csproj">
|
||||
<Project>{8022A1F5-C228-4B21-8194-BC9E76F9174A}</Project>
|
||||
<Name>Design</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\v4\source\V4.csproj">
|
||||
<Project>{BCE98C50-BDB6-49C4-AFB4-78EB1357A3F2}</Project>
|
||||
<Name>V4</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\v7-appcompat\source\V7-AppCompat.csproj">
|
||||
<Project>{B4ED245B-BBD8-4549-9990-476A36AAD381}</Project>
|
||||
<Name>V7-AppCompat</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\v7-cardview\source\V7-CardView.csproj">
|
||||
<Project>{E9848EF1-14E6-4144-95A0-926A52F301B5}</Project>
|
||||
<Name>V7-CardView</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\v7-recyclerview\source\V7-RecyclerView.csproj">
|
||||
<Project>{514ED7A8-0F25-4F61-B7B3-A4A652FD7192}</Project>
|
||||
<Name>V7-RecyclerView</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
|
@ -0,0 +1,140 @@
|
|||
using System;
|
||||
|
||||
using Android.App;
|
||||
using Android.Content;
|
||||
using Android.Runtime;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using Android.OS;
|
||||
using Android.Support.V7.App;
|
||||
using V7Toolbar = Android.Support.V7.Widget.Toolbar;
|
||||
using V4Fragment = Android.Support.V4.App.Fragment;
|
||||
using V4FragmentManager = Android.Support.V4.App.FragmentManager;
|
||||
using Android.Support.V4.Widget;
|
||||
using Android.Support.Design.Widget;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Cheesesquare
|
||||
{
|
||||
[Activity (Label = "Cheesesquare", MainLauncher = true)]
|
||||
public class MainActivity : AppCompatActivity
|
||||
{
|
||||
DrawerLayout drawerLayout;
|
||||
|
||||
protected override void OnCreate(Bundle savedInstanceState)
|
||||
{
|
||||
base.OnCreate (savedInstanceState);
|
||||
|
||||
SetContentView (Resource.Layout.activity_main);
|
||||
|
||||
var toolbar = FindViewById<V7Toolbar>(Resource.Id.toolbar);
|
||||
SetSupportActionBar (toolbar);
|
||||
|
||||
SupportActionBar.SetHomeAsUpIndicator (Resource.Drawable.ic_menu);
|
||||
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
|
||||
|
||||
drawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer_layout);
|
||||
|
||||
var navigationView = FindViewById<NavigationView> (Resource.Id.nav_view);
|
||||
if (navigationView != null)
|
||||
setupDrawerContent(navigationView);
|
||||
|
||||
var viewPager = FindViewById<Android.Support.V4.View.ViewPager> (Resource.Id.viewpager);
|
||||
if (viewPager != null)
|
||||
setupViewPager(viewPager);
|
||||
|
||||
var fab = FindViewById<FloatingActionButton> (Resource.Id.fab);
|
||||
fab.Click += (sender, e) => {
|
||||
// Show a snackbar
|
||||
Snackbar.Make (fab, "Here's a snackbar!", Snackbar.LengthLong).SetAction ("Action",
|
||||
v => Console.WriteLine ("Action handler")).Show ();
|
||||
};
|
||||
|
||||
var tabLayout = FindViewById<TabLayout> (Resource.Id.tabs);
|
||||
tabLayout.SetupWithViewPager (viewPager);
|
||||
}
|
||||
|
||||
public override bool OnCreateOptionsMenu (IMenu menu)
|
||||
{
|
||||
MenuInflater.Inflate(Resource.Menu.sample_actions, menu);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool OnOptionsItemSelected (IMenuItem item)
|
||||
{
|
||||
switch (item.ItemId) {
|
||||
case Android.Resource.Id.Home:
|
||||
drawerLayout.OpenDrawer (Android.Support.V4.View.GravityCompat.Start);
|
||||
return true;
|
||||
}
|
||||
return base.OnOptionsItemSelected (item);
|
||||
}
|
||||
|
||||
void setupViewPager (Android.Support.V4.View.ViewPager viewPager)
|
||||
{
|
||||
var adapter = new Adapter (SupportFragmentManager);
|
||||
adapter.AddFragment (new CheeseListFragment (), "Category 1");
|
||||
adapter.AddFragment (new CheeseListFragment (), "Category 2");
|
||||
adapter.AddFragment (new CheeseListFragment (), "Category 3");
|
||||
viewPager.Adapter = adapter;
|
||||
}
|
||||
|
||||
void setupDrawerContent(NavigationView navigationView)
|
||||
{
|
||||
navigationView.NavigationItemSelected += (sender, e) => {
|
||||
e.MenuItem.SetChecked (true);
|
||||
drawerLayout.CloseDrawers ();
|
||||
};
|
||||
}
|
||||
|
||||
class Adapter : Android.Support.V4.App.FragmentPagerAdapter
|
||||
{
|
||||
List<V4Fragment> fragments = new List<V4Fragment> ();
|
||||
List<string> fragmentTitles = new List<string> ();
|
||||
|
||||
public Adapter (V4FragmentManager fm) : base (fm)
|
||||
{
|
||||
}
|
||||
|
||||
public void AddFragment (V4Fragment fragment, String title)
|
||||
{
|
||||
fragments.Add(fragment);
|
||||
fragmentTitles.Add(title);
|
||||
}
|
||||
|
||||
public override V4Fragment GetItem(int position)
|
||||
{
|
||||
return fragments [position];
|
||||
}
|
||||
|
||||
public override int Count {
|
||||
get { return fragments.Count; }
|
||||
}
|
||||
|
||||
public override Java.Lang.ICharSequence GetPageTitleFormatted (int position)
|
||||
{
|
||||
return new Java.Lang.String (fragmentTitles [position]);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class ClickListener : Java.Lang.Object, View.IOnClickListener
|
||||
{
|
||||
public ClickListener (Action<View> handler)
|
||||
{
|
||||
Handler = handler;
|
||||
}
|
||||
|
||||
public Action<View> Handler { get; set; }
|
||||
|
||||
public void OnClick (View v)
|
||||
{
|
||||
var h = Handler;
|
||||
if (h != null)
|
||||
h (v);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.sample.cheesesquare">
|
||||
<uses-sdk android:minSdkVersion="15" android:targetSdkVersion="21" />
|
||||
<application android:label="Cheesesquare" android:theme="@style/Theme.DesignDemo" android:icon="@drawable/icon">
|
||||
</application>
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
</manifest>
|
|
@ -0,0 +1,28 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Android.App;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("Cheesesquare")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("redth")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.0")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
|