├── .gitignore ├── LICENSE ├── README.md ├── appveyor.yml ├── build.cake ├── build.ps1 ├── build.sh ├── component ├── Details.md ├── GettingStarted.md ├── License.md ├── component.yaml ├── icons │ ├── slidinguppanel_128x128.png │ └── slidinguppanel_512x512.png └── screenshots │ ├── anchored.png │ ├── animation.gif │ ├── collapsed.png │ └── expanded.png ├── releasenotes.md ├── slidinguppanel.nuspec ├── src ├── Sample │ ├── DemoActivity.cs │ ├── Properties │ │ ├── AndroidManifest.xml │ │ └── AssemblyInfo.cs │ ├── Resources │ │ ├── Resource.Designer.cs │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxxhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable │ │ │ ├── container_dropshadow.xml │ │ │ └── my_mug.jpg │ │ ├── layout │ │ │ └── Main.axml │ │ └── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── Sample.csproj │ └── packages.config ├── SlidingUpPanel.sln └── SlidingUpPanel │ ├── Properties │ └── AssemblyInfo.cs │ ├── Resources │ ├── Resource.Designer.cs │ ├── drawable │ │ └── above_shadow.xml │ └── values │ │ └── attrs.xml │ ├── SlideState.cs │ ├── SlidingUpPanel.csproj │ ├── SlidingUpPanelEventArgs.cs │ ├── SlidingUpPanelLayout.cs │ └── packages.config └── tools └── packages.config /.gitignore: -------------------------------------------------------------------------------- 1 | # Build Folders (you can keep bin if you'd like, to store dlls and pdbs) 2 | [Bb]in/ 3 | [Oo]bj/ 4 | 5 | # mstest test results 6 | TestResults 7 | 8 | ## Ignore Visual Studio temporary files, build results, and 9 | ## files generated by popular Visual Studio add-ons. 10 | 11 | # User-specific files 12 | *.suo 13 | *.user 14 | *.sln.docstates 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Rr]elease/ 19 | x64/ 20 | *_i.c 21 | *_p.c 22 | *.ilk 23 | *.meta 24 | *.obj 25 | *.pch 26 | *.pdb 27 | *.pgc 28 | *.pgd 29 | *.rsp 30 | *.sbr 31 | *.tlb 32 | *.tli 33 | *.tlh 34 | *.tmp 35 | *.log 36 | *.vspscc 37 | *.vssscc 38 | .builds 39 | 40 | # Visual C++ cache files 41 | ipch/ 42 | *.aps 43 | *.ncb 44 | *.opensdf 45 | *.sdf 46 | 47 | # Visual Studio profiler 48 | *.psess 49 | *.vsp 50 | *.vspx 51 | 52 | # Guidance Automation Toolkit 53 | *.gpState 54 | 55 | # ReSharper is a .NET coding add-in 56 | _ReSharper* 57 | 58 | # NCrunch 59 | *.ncrunch* 60 | .*crunch*.local.xml 61 | 62 | # Installshield output folder 63 | [Ee]xpress 64 | 65 | # DocProject is a documentation generator add-in 66 | DocProject/buildhelp/ 67 | DocProject/Help/*.HxT 68 | DocProject/Help/*.HxC 69 | DocProject/Help/*.hhc 70 | DocProject/Help/*.hhk 71 | DocProject/Help/*.hhp 72 | DocProject/Help/Html2 73 | DocProject/Help/html 74 | 75 | # Click-Once directory 76 | publish 77 | 78 | # Publish Web Output 79 | *.Publish.xml 80 | 81 | # NuGet Packages Directory 82 | packages 83 | 84 | # Windows Azure Build Output 85 | csx 86 | *.build.csdef 87 | 88 | # Windows Store app package directory 89 | AppPackages/ 90 | 91 | # Others 92 | [Bb]in 93 | [Oo]bj 94 | sql 95 | TestResults 96 | [Tt]est[Rr]esult* 97 | *.Cache 98 | ClientBin 99 | [Ss]tyle[Cc]op.* 100 | ~$* 101 | *.dbmdl 102 | Generated_Code #added for RIA/Silverlight projects 103 | 104 | # Backup & report files from converting an old project file to a newer 105 | # Visual Studio version. Backup files are not needed, because we have git ;-) 106 | _UpgradeReport_Files/ 107 | Backup*/ 108 | UpgradeLog*.XML 109 | 110 | # Xamarin Components 111 | [Cc]omponents 112 | *.apk 113 | xpkg 114 | 115 | #Build 116 | project.lock.json 117 | tools/ 118 | !tools/packages.config 119 | artifacts/ 120 | *.nupkg 121 | .vs/ 122 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | SlidingUpPanel 2 | ============== 3 | 4 | > Consider using BottomSheetDialogFragment from the Android Design package instead 5 | 6 | [![Build status](https://ci.appveyor.com/api/projects/status/fn6agb25m7awlqbh?svg=true)](https://ci.appveyor.com/project/Cheesebaron/slidinguppanel) 7 | [![NuGet](https://img.shields.io/nuget/v/SlidingUpPanel.svg?maxAge=2592000)](https://www.nuget.org/packages/SlidingUpPanel/) 8 | 9 | SlidingUpPanel is a port of [AndroidSlidingUpPanel](https://github.com/umano/AndroidSlidingUpPanel) to Xamarin.Android. 10 | 11 | Add an awesome draggable panel that slides up from either the bottom or top of your screen. Use it to show more details, reveal music player controls or whatever you want. This type of panel is also used in apps such as Google Music and Rdio. 12 | 13 | 14 | 15 | ![animation](https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/master/component/screenshots/animation.gif) 16 | 17 | ## Installing 18 | 19 | Get it in the [Xamarin Component store](http://components.xamarin.com/view/slidinguppanel) 20 | 21 | Or through NuGet 22 | 23 | > Install-Package SlidingUpPanel 24 | 25 | 26 | ## Key features 27 | 28 | - Customizable height 29 | - Customizable shadow 30 | - Restrict draggable area of panel to 31 | - A visible view 32 | - An anchor point 33 | - Listen to events when dragging the panel 34 | - Switch between sliding from top or bottom 35 | 36 | ## Requirements 37 | 38 | This library uses Android Support v4, and it is tested on Android 2.2 and above. 39 | 40 | ## Usage 41 | 42 | To use it, add the component and in your layout simply wrap your layouts with `cheesebaron.slidinguppanel.SlidingUpPanelLayout`. It supports two children. The first child is your content layout. The second child is your layout for the sliding up panel. Both children should have their height set to 43 | `match_parent`. 44 | 45 | ``` 46 | 51 | 52 | 55 | 56 | 57 | 58 | 61 | 62 | 63 | 64 | ``` 65 | 66 | ## Thanks to 67 | 68 | - [Umano](https://github.com/umano) which have created the Java implementation for Java Android. 69 | 70 | ## License 71 | 72 | This project is licensed under the [Apache 2.0 License](https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel2/master/LICENSE). 73 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | image: Visual Studio 2017 3 | build_script: 4 | - ps: .\build.ps1 5 | deploy: 6 | - provider: NuGet 7 | api_key: 8 | secure: hukFrKl6aHI/QyMM4I47WR/rpi3n01lfSK66Np5G3EvBl+KYRcjfNREEhBy73r8o 9 | on: 10 | appveyor_repo_tag: true -------------------------------------------------------------------------------- /build.cake: -------------------------------------------------------------------------------- 1 | #tool nuget:?package=GitVersion.CommandLine 2 | #tool nuget:?package=vswhere 3 | 4 | var sln = new FilePath("src/SlidingUpPanel.sln"); 5 | var project = new FilePath("src/SlidingUpPanel/SlidingUpPanel.csproj"); 6 | var sample = new FilePath("src/Sample/Sample.csproj"); 7 | var binDir = new DirectoryPath("bin/Release"); 8 | var nuspec = new FilePath("slidinguppanel.nuspec"); 9 | var componentDir = new DirectoryPath("component"); 10 | var componentYaml = new FilePath("component/component.yaml"); 11 | var componentTool = new FilePath("component/xamarin-component.exe"); 12 | var outputDir = new DirectoryPath("artifacts"); 13 | var target = Argument("target", "Default"); 14 | var configuration = Argument("configuration", "Release"); 15 | 16 | var isRunningOnAppVeyor = AppVeyor.IsRunningOnAppVeyor; 17 | var isPullRequest = AppVeyor.Environment.PullRequest.IsPullRequest; 18 | 19 | Task("Clean").Does(() => 20 | { 21 | CleanDirectories("./**/bin"); 22 | CleanDirectories("./**/obj"); 23 | CleanDirectories(outputDir.FullPath); 24 | }); 25 | 26 | GitVersion versionInfo = null; 27 | Task("Version").Does(() => { 28 | GitVersion(new GitVersionSettings { 29 | UpdateAssemblyInfo = true, 30 | OutputType = GitVersionOutput.BuildServer 31 | }); 32 | 33 | versionInfo = GitVersion(new GitVersionSettings{ OutputType = GitVersionOutput.Json }); 34 | Information("VI:\t{0}", versionInfo.FullSemVer); 35 | }); 36 | 37 | FilePath msBuildPath; 38 | Task("ResolveBuildTools") 39 | .WithCriteria(() => IsRunningOnWindows()) 40 | .Does(() => 41 | { 42 | var vsLatest = VSWhereLatest(); 43 | msBuildPath = (vsLatest == null) 44 | ? null 45 | : vsLatest.CombineWithFilePath("./MSBuild/15.0/Bin/MSBuild.exe"); 46 | }); 47 | 48 | Task("Restore").Does(() => { 49 | NuGetRestore(sln); 50 | }); 51 | 52 | Task("Build") 53 | .IsDependentOn("Clean") 54 | .IsDependentOn("Version") 55 | .IsDependentOn("Restore") 56 | .IsDependentOn("ResolveBuildTools") 57 | .Does(() => 58 | { 59 | var settings = new MSBuildSettings 60 | { 61 | Configuration = configuration 62 | }; 63 | 64 | settings = settings.WithTarget("Build") 65 | .WithProperty("DebugSymbols", "True") 66 | .WithProperty("DebugType", "Full"); 67 | 68 | if (msBuildPath != null) 69 | settings.ToolPath = msBuildPath; 70 | 71 | MSBuild(sln, settings); 72 | }); 73 | 74 | Task("Package") 75 | .IsDependentOn("Build") 76 | .Does(() => { 77 | 78 | EnsureDirectoryExists(outputDir); 79 | 80 | var dllDir = binDir + "/Cheesebaron.SlidingUpPanel.*"; 81 | 82 | Information("Dll Dir: {0}", dllDir); 83 | 84 | var nugetContent = new List(); 85 | foreach(var dll in GetFiles(dllDir)){ 86 | Information("File: {0}", dll.ToString()); 87 | nugetContent.Add(new NuSpecContent { 88 | Target = "lib/MonoAndroid40", 89 | Source = dll.ToString() 90 | }); 91 | } 92 | 93 | Information("File Count {0}", nugetContent.Count); 94 | 95 | NuGetPack(nuspec, new NuGetPackSettings { 96 | Authors = new [] { "Tomasz Cielecki" }, 97 | Owners = new [] { "Tomasz Cielecki" }, 98 | IconUrl = new Uri("http://i.imgur.com/V3983YY.png"), 99 | ProjectUrl = new Uri("https://github.com/Cheesebaron/SlidingUpPanel"), 100 | LicenseUrl = new Uri("https://github.com/Cheesebaron/SlidingUpPanel/blob/master/LICENSE"), 101 | Copyright = "Copyright (c) Tomasz Cielecki", 102 | RequireLicenseAcceptance = false, 103 | ReleaseNotes = ParseReleaseNotes("./releasenotes.md").Notes.ToArray(), 104 | Tags = new [] {"umano", "xamarin", "android", "panel", "sliding"}, 105 | Version = versionInfo.NuGetVersion, 106 | Symbols = false, 107 | NoPackageAnalysis = true, 108 | OutputDirectory = outputDir, 109 | Verbosity = NuGetVerbosity.Detailed, 110 | Files = nugetContent, 111 | BasePath = "/." 112 | }); 113 | }); 114 | 115 | Task("UploadAppVeyorArtifact") 116 | .IsDependentOn("Package") 117 | .WithCriteria(() => !isPullRequest) 118 | .WithCriteria(() => isRunningOnAppVeyor) 119 | .Does(() => { 120 | 121 | Information("Artifacts Dir: {0}", outputDir.FullPath); 122 | 123 | foreach(var file in GetFiles(outputDir.FullPath + "/*")) { 124 | Information("Uploading {0}", file.FullPath); 125 | AppVeyor.UploadArtifact(file.FullPath); 126 | } 127 | }); 128 | 129 | Task("Default") 130 | .IsDependentOn("UploadAppVeyorArtifact") 131 | .Does(() => 132 | { 133 | Information("AppVeyor: {0}", isRunningOnAppVeyor); 134 | }); 135 | 136 | RunTarget(target); 137 | -------------------------------------------------------------------------------- /build.ps1: -------------------------------------------------------------------------------- 1 | ########################################################################## 2 | # This is the Cake bootstrapper script for PowerShell. 3 | # This file was downloaded from https://github.com/cake-build/resources 4 | # Feel free to change this file to fit your needs. 5 | ########################################################################## 6 | 7 | <# 8 | 9 | .SYNOPSIS 10 | This is a Powershell script to bootstrap a Cake build. 11 | 12 | .DESCRIPTION 13 | This Powershell script will download NuGet if missing, restore NuGet tools (including Cake) 14 | and execute your Cake build script with the parameters you provide. 15 | 16 | .PARAMETER Script 17 | The build script to execute. 18 | .PARAMETER Target 19 | The build script target to run. 20 | .PARAMETER Configuration 21 | The build configuration to use. 22 | .PARAMETER Verbosity 23 | Specifies the amount of information to be displayed. 24 | .PARAMETER ShowDescription 25 | Shows description about tasks. 26 | .PARAMETER DryRun 27 | Performs a dry run. 28 | .PARAMETER Experimental 29 | Uses the nightly builds of the Roslyn script engine. 30 | .PARAMETER Mono 31 | Uses the Mono Compiler rather than the Roslyn script engine. 32 | .PARAMETER SkipToolPackageRestore 33 | Skips restoring of packages. 34 | .PARAMETER ScriptArgs 35 | Remaining arguments are added here. 36 | 37 | .LINK 38 | https://cakebuild.net 39 | 40 | #> 41 | 42 | [CmdletBinding()] 43 | Param( 44 | [string]$Script = "build.cake", 45 | [string]$Target, 46 | [string]$Configuration, 47 | [ValidateSet("Quiet", "Minimal", "Normal", "Verbose", "Diagnostic")] 48 | [string]$Verbosity, 49 | [switch]$ShowDescription, 50 | [Alias("WhatIf", "Noop")] 51 | [switch]$DryRun, 52 | [switch]$Experimental, 53 | [switch]$Mono, 54 | [switch]$SkipToolPackageRestore, 55 | [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] 56 | [string[]]$ScriptArgs 57 | ) 58 | 59 | [Reflection.Assembly]::LoadWithPartialName("System.Security") | Out-Null 60 | function MD5HashFile([string] $filePath) 61 | { 62 | if ([string]::IsNullOrEmpty($filePath) -or !(Test-Path $filePath -PathType Leaf)) 63 | { 64 | return $null 65 | } 66 | 67 | [System.IO.Stream] $file = $null; 68 | [System.Security.Cryptography.MD5] $md5 = $null; 69 | try 70 | { 71 | $md5 = [System.Security.Cryptography.MD5]::Create() 72 | $file = [System.IO.File]::OpenRead($filePath) 73 | return [System.BitConverter]::ToString($md5.ComputeHash($file)) 74 | } 75 | finally 76 | { 77 | if ($file -ne $null) 78 | { 79 | $file.Dispose() 80 | } 81 | } 82 | } 83 | 84 | function GetProxyEnabledWebClient 85 | { 86 | $wc = New-Object System.Net.WebClient 87 | $proxy = [System.Net.WebRequest]::GetSystemWebProxy() 88 | $proxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials 89 | $wc.Proxy = $proxy 90 | return $wc 91 | } 92 | 93 | Write-Host "Preparing to run build script..." 94 | 95 | if(!$PSScriptRoot){ 96 | $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent 97 | } 98 | 99 | $TOOLS_DIR = Join-Path $PSScriptRoot "tools" 100 | $ADDINS_DIR = Join-Path $TOOLS_DIR "Addins" 101 | $MODULES_DIR = Join-Path $TOOLS_DIR "Modules" 102 | $NUGET_EXE = Join-Path $TOOLS_DIR "nuget.exe" 103 | $CAKE_EXE = Join-Path $TOOLS_DIR "Cake/Cake.exe" 104 | $NUGET_URL = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe" 105 | $PACKAGES_CONFIG = Join-Path $TOOLS_DIR "packages.config" 106 | $PACKAGES_CONFIG_MD5 = Join-Path $TOOLS_DIR "packages.config.md5sum" 107 | $ADDINS_PACKAGES_CONFIG = Join-Path $ADDINS_DIR "packages.config" 108 | $MODULES_PACKAGES_CONFIG = Join-Path $MODULES_DIR "packages.config" 109 | 110 | # Make sure tools folder exists 111 | if ((Test-Path $PSScriptRoot) -and !(Test-Path $TOOLS_DIR)) { 112 | Write-Verbose -Message "Creating tools directory..." 113 | New-Item -Path $TOOLS_DIR -Type directory | out-null 114 | } 115 | 116 | # Make sure that packages.config exist. 117 | if (!(Test-Path $PACKAGES_CONFIG)) { 118 | Write-Verbose -Message "Downloading packages.config..." 119 | try { 120 | $wc = GetProxyEnabledWebClient 121 | $wc.DownloadFile("https://cakebuild.net/download/bootstrapper/packages", $PACKAGES_CONFIG) } catch { 122 | Throw "Could not download packages.config." 123 | } 124 | } 125 | 126 | # Try find NuGet.exe in path if not exists 127 | if (!(Test-Path $NUGET_EXE)) { 128 | Write-Verbose -Message "Trying to find nuget.exe in PATH..." 129 | $existingPaths = $Env:Path -Split ';' | Where-Object { (![string]::IsNullOrEmpty($_)) -and (Test-Path $_ -PathType Container) } 130 | $NUGET_EXE_IN_PATH = Get-ChildItem -Path $existingPaths -Filter "nuget.exe" | Select -First 1 131 | if ($NUGET_EXE_IN_PATH -ne $null -and (Test-Path $NUGET_EXE_IN_PATH.FullName)) { 132 | Write-Verbose -Message "Found in PATH at $($NUGET_EXE_IN_PATH.FullName)." 133 | $NUGET_EXE = $NUGET_EXE_IN_PATH.FullName 134 | } 135 | } 136 | 137 | # Try download NuGet.exe if not exists 138 | if (!(Test-Path $NUGET_EXE)) { 139 | Write-Verbose -Message "Downloading NuGet.exe..." 140 | try { 141 | $wc = GetProxyEnabledWebClient 142 | $wc.DownloadFile($NUGET_URL, $NUGET_EXE) 143 | } catch { 144 | Throw "Could not download NuGet.exe." 145 | } 146 | } 147 | 148 | # Save nuget.exe path to environment to be available to child processed 149 | $ENV:NUGET_EXE = $NUGET_EXE 150 | 151 | # Restore tools from NuGet? 152 | if(-Not $SkipToolPackageRestore.IsPresent) { 153 | Push-Location 154 | Set-Location $TOOLS_DIR 155 | 156 | # Check for changes in packages.config and remove installed tools if true. 157 | [string] $md5Hash = MD5HashFile($PACKAGES_CONFIG) 158 | if((!(Test-Path $PACKAGES_CONFIG_MD5)) -Or 159 | ($md5Hash -ne (Get-Content $PACKAGES_CONFIG_MD5 ))) { 160 | Write-Verbose -Message "Missing or changed package.config hash..." 161 | Get-ChildItem -Exclude packages.config,nuget.exe,Cake.Bakery | 162 | Remove-Item -Recurse 163 | } 164 | 165 | Write-Verbose -Message "Restoring tools from NuGet..." 166 | $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$TOOLS_DIR`"" 167 | 168 | if ($LASTEXITCODE -ne 0) { 169 | Throw "An error occurred while restoring NuGet tools." 170 | } 171 | else 172 | { 173 | $md5Hash | Out-File $PACKAGES_CONFIG_MD5 -Encoding "ASCII" 174 | } 175 | Write-Verbose -Message ($NuGetOutput | out-string) 176 | 177 | Pop-Location 178 | } 179 | 180 | # Restore addins from NuGet 181 | if (Test-Path $ADDINS_PACKAGES_CONFIG) { 182 | Push-Location 183 | Set-Location $ADDINS_DIR 184 | 185 | Write-Verbose -Message "Restoring addins from NuGet..." 186 | $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$ADDINS_DIR`"" 187 | 188 | if ($LASTEXITCODE -ne 0) { 189 | Throw "An error occurred while restoring NuGet addins." 190 | } 191 | 192 | Write-Verbose -Message ($NuGetOutput | out-string) 193 | 194 | Pop-Location 195 | } 196 | 197 | # Restore modules from NuGet 198 | if (Test-Path $MODULES_PACKAGES_CONFIG) { 199 | Push-Location 200 | Set-Location $MODULES_DIR 201 | 202 | Write-Verbose -Message "Restoring modules from NuGet..." 203 | $NuGetOutput = Invoke-Expression "&`"$NUGET_EXE`" install -ExcludeVersion -OutputDirectory `"$MODULES_DIR`"" 204 | 205 | if ($LASTEXITCODE -ne 0) { 206 | Throw "An error occurred while restoring NuGet modules." 207 | } 208 | 209 | Write-Verbose -Message ($NuGetOutput | out-string) 210 | 211 | Pop-Location 212 | } 213 | 214 | # Make sure that Cake has been installed. 215 | if (!(Test-Path $CAKE_EXE)) { 216 | Throw "Could not find Cake.exe at $CAKE_EXE" 217 | } 218 | 219 | 220 | 221 | # Build Cake arguments 222 | $cakeArguments = @("$Script"); 223 | if ($Target) { $cakeArguments += "-target=$Target" } 224 | if ($Configuration) { $cakeArguments += "-configuration=$Configuration" } 225 | if ($Verbosity) { $cakeArguments += "-verbosity=$Verbosity" } 226 | if ($ShowDescription) { $cakeArguments += "-showdescription" } 227 | if ($DryRun) { $cakeArguments += "-dryrun" } 228 | if ($Experimental) { $cakeArguments += "-experimental" } 229 | if ($Mono) { $cakeArguments += "-mono" } 230 | $cakeArguments += $ScriptArgs 231 | 232 | # Start Cake 233 | Write-Host "Running build script..." 234 | &$CAKE_EXE $cakeArguments 235 | exit $LASTEXITCODE 236 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ########################################################################## 4 | # This is the Cake bootstrapper script for Linux and OS X. 5 | # This file was downloaded from https://github.com/cake-build/resources 6 | # Feel free to change this file to fit your needs. 7 | ########################################################################## 8 | 9 | # Define directories. 10 | SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) 11 | TOOLS_DIR=$SCRIPT_DIR/tools 12 | NUGET_EXE=$TOOLS_DIR/nuget.exe 13 | CAKE_EXE=$TOOLS_DIR/Cake/Cake.exe 14 | PACKAGES_CONFIG=$TOOLS_DIR/packages.config 15 | PACKAGES_CONFIG_MD5=$TOOLS_DIR/packages.config.md5sum 16 | 17 | # Define md5sum or md5 depending on Linux/OSX 18 | MD5_EXE= 19 | if [[ "$(uname -s)" == "Darwin" ]]; then 20 | MD5_EXE="md5 -r" 21 | else 22 | MD5_EXE="md5sum" 23 | fi 24 | 25 | # Define default arguments. 26 | SCRIPT="build.cake" 27 | TARGET="Default" 28 | CONFIGURATION="Release" 29 | VERBOSITY="verbose" 30 | DRYRUN= 31 | SHOW_VERSION=false 32 | SCRIPT_ARGUMENTS=() 33 | 34 | # Parse arguments. 35 | for i in "$@"; do 36 | case $1 in 37 | -s|--script) SCRIPT="$2"; shift ;; 38 | -t|--target) TARGET="$2"; shift ;; 39 | -c|--configuration) CONFIGURATION="$2"; shift ;; 40 | -v|--verbosity) VERBOSITY="$2"; shift ;; 41 | -d|--dryrun) DRYRUN="-dryrun" ;; 42 | --version) SHOW_VERSION=true ;; 43 | --) shift; SCRIPT_ARGUMENTS+=("$@"); break ;; 44 | *) SCRIPT_ARGUMENTS+=("$1") ;; 45 | esac 46 | shift 47 | done 48 | 49 | # Make sure the tools folder exist. 50 | if [ ! -d "$TOOLS_DIR" ]; then 51 | mkdir "$TOOLS_DIR" 52 | fi 53 | 54 | # Make sure that packages.config exist. 55 | if [ ! -f "$TOOLS_DIR/packages.config" ]; then 56 | echo "Downloading packages.config..." 57 | curl -Lsfo "$TOOLS_DIR/packages.config" http://cakebuild.net/download/bootstrapper/packages 58 | if [ $? -ne 0 ]; then 59 | echo "An error occured while downloading packages.config." 60 | exit 1 61 | fi 62 | fi 63 | 64 | # Download NuGet if it does not exist. 65 | if [ ! -f "$NUGET_EXE" ]; then 66 | echo "Downloading NuGet..." 67 | curl -Lsfo "$NUGET_EXE" https://dist.nuget.org/win-x86-commandline/latest/nuget.exe 68 | if [ $? -ne 0 ]; then 69 | echo "An error occured while downloading nuget.exe." 70 | exit 1 71 | fi 72 | fi 73 | 74 | # Restore tools from NuGet. 75 | pushd "$TOOLS_DIR" >/dev/null 76 | if [ ! -f $PACKAGES_CONFIG_MD5 ] || [ "$( cat $PACKAGES_CONFIG_MD5 | sed 's/\r$//' )" != "$( $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' )" ]; then 77 | find . -type d ! -name . | xargs rm -rf 78 | fi 79 | 80 | mono "$NUGET_EXE" install -ExcludeVersion 81 | if [ $? -ne 0 ]; then 82 | echo "Could not restore NuGet packages." 83 | exit 1 84 | fi 85 | 86 | $MD5_EXE $PACKAGES_CONFIG | awk '{ print $1 }' >| $PACKAGES_CONFIG_MD5 87 | 88 | popd >/dev/null 89 | 90 | # Make sure that Cake has been installed. 91 | if [ ! -f "$CAKE_EXE" ]; then 92 | echo "Could not find Cake.exe at '$CAKE_EXE'." 93 | exit 1 94 | fi 95 | 96 | # Start Cake 97 | if $SHOW_VERSION; then 98 | exec mono "$CAKE_EXE" -version 99 | else 100 | exec mono "$CAKE_EXE" $SCRIPT -verbosity=$VERBOSITY -configuration=$CONFIGURATION -target=$TARGET $DRYRUN "${SCRIPT_ARGUMENTS[@]}" 101 | fi -------------------------------------------------------------------------------- /component/Details.md: -------------------------------------------------------------------------------- 1 | Add an awesome draggable panel that slides up from either the bottom or top of your screen. Use it to show more details, reveal music player controls or whatever you want. This type of panel is also used in apps such as Google Music and Rdio. 2 | 3 | ## Key features 4 | 5 | - Customizable height 6 | - Customizable shadow 7 | - Restrict draggable area of panel to 8 | - A visible view 9 | - An anchor point 10 | - Listen to events when dragging the panel 11 | - Switch between sliding from top or bottom 12 | 13 | ## Requirements 14 | 15 | This library uses Android Support v4, and it is tested on Android 2.2 and above. 16 | 17 | ## Usage 18 | 19 | To use it, add the component and in your layout simply wrap your layouts with `cheesebaron.slidinguppanel.SlidingUpPanelLayout`. It supports two children. The first child is your content layout. The second child is your layout for the sliding up panel. Both children should have their height set to 20 | `match_parent`. 21 | 22 | ``` 23 | 28 | 29 | 32 | 33 | 34 | 35 | 38 | 39 | 40 | 41 | ``` 42 | 43 | The project is Open Source and can be [forked on GitHub](https://github.com/Cheesebaron/SlidingUpPanel). 44 | -------------------------------------------------------------------------------- /component/GettingStarted.md: -------------------------------------------------------------------------------- 1 | Start by creating or editing an existing AXML layout file. Add `cheesebaron.slidinguppanel.SlidingUpPanelLayout` as the root of this layout. 2 | 3 | ``` 4 | 5 | 11 | 12 | 18 | 19 | 25 | 26 | ``` 27 | 28 | The `SlidingUpPanelLayout` supports at most to nested children views. The first being the main content if you View, the second being the content of the sliding panel. The `android:gravity` attribute determines whether you have the menu on the `top` or the `bottom` of the screen. The two attributes `android:layout_width` and `android:layout_height`, for the root layout, both need to be set to `match_parent`. The same goes for the two nested child layouts. 29 | 30 | As the `SlidingUpPanelLayout` only supports two nested Views, you will have to wrap additional Views in a container such as `LinearLayout`, `FrameLayout` or `RelativeLayout` 31 | 32 | ## Supported attributes 33 | 34 | `SlidingUpPanelLayout` supports a variety of attributes to allow you to customize its behavior. Remember to add the namespace `xmlns:app="http://schemas.android.com/apk/res-auto"` to your layout. 35 | 36 | Then you can use the following attributes: 37 | 38 | - `collapsedHeight` sets the height of the drawer when it is collapsed. Use a dimension value `dp`, `sp`, `px` for this. 39 | - `shadowHeight` sets the height of the shadow. Use a dimension value `dp`, `sp`, `px` for this. 40 | - `fadeColor` sets the color to fade the main content with, when sliding the panel on top of it. 41 | - `flingVelocity` set the velocity of which the panel allows to be flinged to either be opened or closed. 42 | - `dragView` set the `id` of the view you want to restrict to allow dragging the panel. 43 | 44 | ### Usage of attributes 45 | 46 | So a sample of using the described attributes would look as follows 47 | 48 | ``` 49 | 50 | 60 | 61 | 62 | ``` 63 | 64 | ## Subscribing to events 65 | 66 | The `SlidingUpPanelLayout` has 4 events which you can listen to in your app. 67 | 68 | - `PanelExpanded` which triggers when the panel is expanded 69 | - `PanelCollapsed` triggers when the panel is collapsed 70 | - `PanelAnchored` triggers if you have set an `AnchorPoint` on the screen and the panel expands to that point 71 | - `PanelSlide` triggers whenever the panel is dragged 72 | 73 | As shown in the sample project, the `PanelSlide` event could be used to hide or show the `ActionBar` in an app whenever the sliding up panel has reached a certain point. 74 | 75 | ## Additional properties and methods 76 | 77 | If you prefer, or want to override a value set in the layout, using a coded approach, several Properties are exposed for your usage. 78 | 79 | - `PanelHeight` can be used to set the height of the panel 80 | - `AnchorPoint` can be used to set a point in the middle of the screen to allow an intermediate expanded state 81 | - `ShadowDrawable` can be used to set an alternative shadow 82 | - `SlidingEnabled` can be used to allow or disallow dragging of the panel 83 | - `CoveredFadeColor` can be used to set the fade color used on top of your main content 84 | - `IsExpanded`, `IsSlidable`, `PaneVisible`, `IsAnchored` give you the state of the panel 85 | 86 | You also have access to a couple methods to control the panel 87 | 88 | - `ShowPane()` and `HidePane()` show and hide the pane triggered in code 89 | 90 | For additional information refer to the Sample project 91 | -------------------------------------------------------------------------------- /component/License.md: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /component/component.yaml: -------------------------------------------------------------------------------- 1 | version: <%VERSION%> 2 | name: SlidingUpPanel 3 | id: slidinguppanel 4 | publisher: Tomasz Cielecki 5 | publisher-url: http://ostebaronen.dk 6 | src-url: https://github.com/Cheesebaron/SlidingUpPanel 7 | summary: A panel that slides out from the bottom or top of the screen. 8 | license: License.md 9 | details: Details.md 10 | getting-started: GettingStarted.md 11 | 12 | is_shell: true 13 | skip_docs: true 14 | no_build: true 15 | 16 | icons: 17 | - icons/slidinguppanel_128x128.png 18 | - icons/slidinguppanel_512x512.png 19 | 20 | packages: 21 | android: 22 | - Xamarin.Android.Support.v4, Version=24.2.1 23 | - Xamarin.Android.Support.Compat, Version=24.2.1 24 | 25 | libraries: 26 | android: ../bin/Release/Cheesebaron.SlidingUpPanel.dll 27 | 28 | samples: 29 | - name: Sample 30 | path: "../src/SlidingUpPanel.sln" 31 | no_build: true 32 | skip_docs: true 33 | -------------------------------------------------------------------------------- /component/icons/slidinguppanel_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/component/icons/slidinguppanel_128x128.png -------------------------------------------------------------------------------- /component/icons/slidinguppanel_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/component/icons/slidinguppanel_512x512.png -------------------------------------------------------------------------------- /component/screenshots/anchored.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/component/screenshots/anchored.png -------------------------------------------------------------------------------- /component/screenshots/animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/component/screenshots/animation.gif -------------------------------------------------------------------------------- /component/screenshots/collapsed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/component/screenshots/collapsed.png -------------------------------------------------------------------------------- /component/screenshots/expanded.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/component/screenshots/expanded.png -------------------------------------------------------------------------------- /releasenotes.md: -------------------------------------------------------------------------------- 1 | ### New in 1.0.2 2 | 3 | * Fixed issue with apps crashing when going into background 4 | * Built against latest Xamarin Support packages 24.2.1 5 | 6 | ### New in 1.0.3 7 | 8 | * Removed permissions hardcoded in AssemblyInfo 9 | 10 | ### New in 1.0.5 11 | 12 | * Fix package dependencies 13 | 14 | ### New in 1.1.0 15 | 16 | * Built against latest Android Support packages 17 | * Fixes crash in designer due to _dragHelper being null -------------------------------------------------------------------------------- /slidinguppanel.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SlidingUpPanel 5 | SlidingUpPanel 6 | $version$ 7 | A panel that slides out from the bottom or top of the screen 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/Sample/DemoActivity.cs: -------------------------------------------------------------------------------- 1 | using Android.App; 2 | using Android.Support.V7.App; 3 | using Android.Text.Method; 4 | using Android.Util; 5 | using Android.OS; 6 | using Android.Widget; 7 | using Cheesebaron.SlidingUpPanel; 8 | 9 | namespace Sample 10 | { 11 | [Activity(Label = "SlidingUpPanel Sample", MainLauncher = true, Icon = "@drawable/ic_launcher", 12 | Theme = "@style/AppTheme")] 13 | public class DemoActivity : AppCompatActivity 14 | { 15 | private const string Tag = "DemoActivity"; 16 | private const string SavedStateActionBarHidden = "saved_state_action_bar_hidden"; 17 | 18 | protected override void OnCreate(Bundle savedInstanceState) 19 | { 20 | base.OnCreate(savedInstanceState); 21 | 22 | // Set our view from the "main" layout resource 23 | SetContentView(Resource.Layout.Main); 24 | 25 | var layout = FindViewById(Resource.Id.sliding_layout); 26 | FindViewById(Resource.Id.more_info).MovementMethod = new LinkMovementMethod(); 27 | 28 | layout.ShadowDrawable = Resources.GetDrawable(Resource.Drawable.above_shadow); 29 | layout.AnchorPoint = 0.3f; 30 | layout.PanelExpanded += (s, e) => Log.Info(Tag, "PanelExpanded"); 31 | layout.PanelCollapsed += (s, e) => Log.Info(Tag, "PanelCollapsed"); 32 | layout.PanelAnchored += (s, e) => Log.Info(Tag, "PanelAnchored"); 33 | layout.PanelSlide += (s, e) => 34 | { 35 | if (e.SlideOffset < 0.2) 36 | { 37 | if (SupportActionBar.IsShowing) 38 | SupportActionBar.Hide(); 39 | } 40 | else 41 | { 42 | if (!SupportActionBar.IsShowing) 43 | SupportActionBar.Show(); 44 | } 45 | }; 46 | 47 | var actionBarHidden = savedInstanceState != null && 48 | savedInstanceState.GetBoolean(SavedStateActionBarHidden, false); 49 | if (actionBarHidden) 50 | SupportActionBar.Hide(); 51 | } 52 | 53 | protected override void OnSaveInstanceState(Bundle outState) 54 | { 55 | base.OnSaveInstanceState(outState); 56 | outState.PutBoolean(SavedStateActionBarHidden, !SupportActionBar.IsShowing); 57 | } 58 | } 59 | } 60 | 61 | -------------------------------------------------------------------------------- /src/Sample/Properties/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/Sample/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Sample")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Sample")] 14 | [assembly: AssemblyCopyright("Copyright © 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | -------------------------------------------------------------------------------- /src/Sample/Resources/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/src/Sample/Resources/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/Sample/Resources/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/src/Sample/Resources/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/Sample/Resources/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/src/Sample/Resources/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/Sample/Resources/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/src/Sample/Resources/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/Sample/Resources/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/src/Sample/Resources/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /src/Sample/Resources/drawable/container_dropshadow.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Sample/Resources/drawable/my_mug.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Cheesebaron/SlidingUpPanel/d8ce93b6a59cb2ad0e4e8d8b5ef7de65df5f10b0/src/Sample/Resources/drawable/my_mug.jpg -------------------------------------------------------------------------------- /src/Sample/Resources/layout/Main.axml: -------------------------------------------------------------------------------- 1 | 2 | 11 | 12 | 18 | 25 | 26 | 27 | 33 | 38 | 47 | 55 | 56 | 62 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/Sample/Resources/values/dimens.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 16dp 6 | 16dp 7 | 8 | -------------------------------------------------------------------------------- /src/Sample/Resources/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | \@Cheesebaron 4 | Visit me on GitHub for more cool projects and ports, which can make your app a lot more awesome. 5 | Main Content 6 | 7 | -------------------------------------------------------------------------------- /src/Sample/Resources/values/styles.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 7 | 8 | 10 | -------------------------------------------------------------------------------- /src/Sample/Sample.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {2BD66B76-2068-4ABD-A757-2FD512A38C93} 9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | Library 11 | Properties 12 | Sample 13 | Sample 14 | 512 15 | true 16 | Resources\Resource.Designer.cs 17 | Off 18 | Properties\AndroidManifest.xml 19 | armeabi,armeabi-v7a,x86 20 | 21 | 22 | 23 | 24 | True 25 | v8.0 26 | 27 | 28 | 29 | 30 | true 31 | full 32 | false 33 | bin\Debug\ 34 | DEBUG;TRACE 35 | prompt 36 | 4 37 | True 38 | true 39 | 40 | 41 | pdbonly 42 | true 43 | bin\Release\ 44 | TRACE 45 | prompt 46 | 4 47 | False 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | ..\packages\Xamarin.Android.Arch.Core.Common.1.0.0\lib\MonoAndroid80\Xamarin.Android.Arch.Core.Common.dll 59 | 60 | 61 | ..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.0.1\lib\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Common.dll 62 | 63 | 64 | ..\packages\Xamarin.Android.Arch.Lifecycle.Runtime.1.0.0\lib\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Runtime.dll 65 | 66 | 67 | ..\packages\Xamarin.Android.Support.Animated.Vector.Drawable.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Animated.Vector.Drawable.dll 68 | 69 | 70 | ..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Annotations.dll 71 | 72 | 73 | ..\packages\Xamarin.Android.Support.Compat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Compat.dll 74 | 75 | 76 | ..\packages\Xamarin.Android.Support.Core.UI.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Core.UI.dll 77 | 78 | 79 | ..\packages\Xamarin.Android.Support.Core.Utils.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Core.Utils.dll 80 | 81 | 82 | ..\packages\Xamarin.Android.Support.Fragment.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Fragment.dll 83 | 84 | 85 | ..\packages\Xamarin.Android.Support.Media.Compat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Media.Compat.dll 86 | 87 | 88 | ..\packages\Xamarin.Android.Support.v4.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v4.dll 89 | 90 | 91 | ..\packages\Xamarin.Android.Support.v7.AppCompat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v7.AppCompat.dll 92 | 93 | 94 | ..\packages\Xamarin.Android.Support.Vector.Drawable.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Vector.Drawable.dll 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | Designer 121 | 122 | 123 | 124 | 125 | {46f8ca39-daf4-4d7d-853e-27b74bab4fe1} 126 | SlidingUpPanel 127 | 128 | 129 | 130 | 131 | 132 | 133 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 168 | -------------------------------------------------------------------------------- /src/Sample/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/SlidingUpPanel.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25420.1 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SlidingUpPanel", "SlidingUpPanel\SlidingUpPanel.csproj", "{46F8CA39-DAF4-4D7D-853E-27B74BAB4FE1}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Sample", "Sample\Sample.csproj", "{2BD66B76-2068-4ABD-A757-2FD512A38C93}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {46F8CA39-DAF4-4D7D-853E-27B74BAB4FE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {46F8CA39-DAF4-4D7D-853E-27B74BAB4FE1}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {46F8CA39-DAF4-4D7D-853E-27B74BAB4FE1}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {46F8CA39-DAF4-4D7D-853E-27B74BAB4FE1}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {2BD66B76-2068-4ABD-A757-2FD512A38C93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {2BD66B76-2068-4ABD-A757-2FD512A38C93}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {2BD66B76-2068-4ABD-A757-2FD512A38C93}.Debug|Any CPU.Deploy.0 = Debug|Any CPU 23 | {2BD66B76-2068-4ABD-A757-2FD512A38C93}.Release|Any CPU.ActiveCfg = Release|Any CPU 24 | {2BD66B76-2068-4ABD-A757-2FD512A38C93}.Release|Any CPU.Build.0 = Release|Any CPU 25 | {2BD66B76-2068-4ABD-A757-2FD512A38C93}.Release|Any CPU.Deploy.0 = Release|Any CPU 26 | EndGlobalSection 27 | GlobalSection(SolutionProperties) = preSolution 28 | HideSolutionNode = FALSE 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /src/SlidingUpPanel/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | using Android.App; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("SlidingUpPanel")] 10 | [assembly: AssemblyDescription("")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("SlidingUpPanel")] 14 | [assembly: AssemblyCopyright("Copyright © Tomasz Cielecki 2014")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | [assembly: ComVisible(false)] 18 | 19 | // Version information for an assembly consists of the following four values: 20 | // 21 | // Major Version 22 | // Minor Version 23 | // Build Number 24 | // Revision 25 | // 26 | // You can specify all the values or you can default the Build and Revision Numbers 27 | // by using the '*' as shown below: 28 | // [assembly: AssemblyVersion("1.0.*")] 29 | [assembly: AssemblyVersion("1.0.0.0")] 30 | [assembly: AssemblyFileVersion("1.0.0.0")] 31 | -------------------------------------------------------------------------------- /src/SlidingUpPanel/Resources/Resource.Designer.cs: -------------------------------------------------------------------------------- 1 | #pragma warning disable 1591 2 | //------------------------------------------------------------------------------ 3 | // 4 | // This code was generated by a tool. 5 | // Runtime Version:4.0.30319.42000 6 | // 7 | // Changes to this file may cause incorrect behavior and will be lost if 8 | // the code is regenerated. 9 | // 10 | //------------------------------------------------------------------------------ 11 | 12 | [assembly: global::Android.Runtime.ResourceDesignerAttribute("Cheesebaron.SlidingUpPanel.Resource", IsApplication=false)] 13 | 14 | namespace Cheesebaron.SlidingUpPanel 15 | { 16 | 17 | 18 | [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "1.0.0.0")] 19 | public partial class Resource 20 | { 21 | 22 | static Resource() 23 | { 24 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 25 | } 26 | 27 | public partial class Attribute 28 | { 29 | 30 | // aapt resource value: 0x7f010009 31 | public static int collapsedHeight = 2130771977; 32 | 33 | // aapt resource value: 0x7f01000d 34 | public static int dragView = 2130771981; 35 | 36 | // aapt resource value: 0x7f01000b 37 | public static int fadeColor = 2130771979; 38 | 39 | // aapt resource value: 0x7f01000c 40 | public static int flingVelocity = 2130771980; 41 | 42 | // aapt resource value: 0x7f010007 43 | public static int font = 2130771975; 44 | 45 | // aapt resource value: 0x7f010000 46 | public static int fontProviderAuthority = 2130771968; 47 | 48 | // aapt resource value: 0x7f010003 49 | public static int fontProviderCerts = 2130771971; 50 | 51 | // aapt resource value: 0x7f010004 52 | public static int fontProviderFetchStrategy = 2130771972; 53 | 54 | // aapt resource value: 0x7f010005 55 | public static int fontProviderFetchTimeout = 2130771973; 56 | 57 | // aapt resource value: 0x7f010001 58 | public static int fontProviderPackage = 2130771969; 59 | 60 | // aapt resource value: 0x7f010002 61 | public static int fontProviderQuery = 2130771970; 62 | 63 | // aapt resource value: 0x7f010006 64 | public static int fontStyle = 2130771974; 65 | 66 | // aapt resource value: 0x7f010008 67 | public static int fontWeight = 2130771976; 68 | 69 | // aapt resource value: 0x7f01000e 70 | public static int overlay = 2130771982; 71 | 72 | // aapt resource value: 0x7f01000a 73 | public static int shadowHeight = 2130771978; 74 | 75 | static Attribute() 76 | { 77 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 78 | } 79 | 80 | private Attribute() 81 | { 82 | } 83 | } 84 | 85 | public partial class Boolean 86 | { 87 | 88 | // aapt resource value: 0x7f080000 89 | public static int abc_action_bar_embed_tabs = 2131230720; 90 | 91 | static Boolean() 92 | { 93 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 94 | } 95 | 96 | private Boolean() 97 | { 98 | } 99 | } 100 | 101 | public partial class Color 102 | { 103 | 104 | // aapt resource value: 0x7f050003 105 | public static int notification_action_color_filter = 2131034115; 106 | 107 | // aapt resource value: 0x7f050004 108 | public static int notification_icon_bg_color = 2131034116; 109 | 110 | // aapt resource value: 0x7f050000 111 | public static int notification_material_background_media_default_color = 2131034112; 112 | 113 | // aapt resource value: 0x7f050001 114 | public static int primary_text_default_material_dark = 2131034113; 115 | 116 | // aapt resource value: 0x7f050005 117 | public static int ripple_material_light = 2131034117; 118 | 119 | // aapt resource value: 0x7f050002 120 | public static int secondary_text_default_material_dark = 2131034114; 121 | 122 | // aapt resource value: 0x7f050006 123 | public static int secondary_text_default_material_light = 2131034118; 124 | 125 | static Color() 126 | { 127 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 128 | } 129 | 130 | private Color() 131 | { 132 | } 133 | } 134 | 135 | public partial class Dimension 136 | { 137 | 138 | // aapt resource value: 0x7f090004 139 | public static int compat_button_inset_horizontal_material = 2131296260; 140 | 141 | // aapt resource value: 0x7f090005 142 | public static int compat_button_inset_vertical_material = 2131296261; 143 | 144 | // aapt resource value: 0x7f090006 145 | public static int compat_button_padding_horizontal_material = 2131296262; 146 | 147 | // aapt resource value: 0x7f090007 148 | public static int compat_button_padding_vertical_material = 2131296263; 149 | 150 | // aapt resource value: 0x7f090008 151 | public static int compat_control_corner_material = 2131296264; 152 | 153 | // aapt resource value: 0x7f090009 154 | public static int notification_action_icon_size = 2131296265; 155 | 156 | // aapt resource value: 0x7f09000a 157 | public static int notification_action_text_size = 2131296266; 158 | 159 | // aapt resource value: 0x7f09000b 160 | public static int notification_big_circle_margin = 2131296267; 161 | 162 | // aapt resource value: 0x7f090001 163 | public static int notification_content_margin_start = 2131296257; 164 | 165 | // aapt resource value: 0x7f09000c 166 | public static int notification_large_icon_height = 2131296268; 167 | 168 | // aapt resource value: 0x7f09000d 169 | public static int notification_large_icon_width = 2131296269; 170 | 171 | // aapt resource value: 0x7f090002 172 | public static int notification_main_column_padding_top = 2131296258; 173 | 174 | // aapt resource value: 0x7f090003 175 | public static int notification_media_narrow_margin = 2131296259; 176 | 177 | // aapt resource value: 0x7f09000e 178 | public static int notification_right_icon_size = 2131296270; 179 | 180 | // aapt resource value: 0x7f090000 181 | public static int notification_right_side_padding_top = 2131296256; 182 | 183 | // aapt resource value: 0x7f09000f 184 | public static int notification_small_icon_background_padding = 2131296271; 185 | 186 | // aapt resource value: 0x7f090010 187 | public static int notification_small_icon_size_as_large = 2131296272; 188 | 189 | // aapt resource value: 0x7f090011 190 | public static int notification_subtext_size = 2131296273; 191 | 192 | // aapt resource value: 0x7f090012 193 | public static int notification_top_pad = 2131296274; 194 | 195 | // aapt resource value: 0x7f090013 196 | public static int notification_top_pad_large_text = 2131296275; 197 | 198 | static Dimension() 199 | { 200 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 201 | } 202 | 203 | private Dimension() 204 | { 205 | } 206 | } 207 | 208 | public partial class Drawable 209 | { 210 | 211 | // aapt resource value: 0x7f020000 212 | public static int above_shadow = 2130837504; 213 | 214 | // aapt resource value: 0x7f020001 215 | public static int notification_action_background = 2130837505; 216 | 217 | // aapt resource value: 0x7f020002 218 | public static int notification_bg = 2130837506; 219 | 220 | // aapt resource value: 0x7f020003 221 | public static int notification_bg_low = 2130837507; 222 | 223 | // aapt resource value: 0x7f020004 224 | public static int notification_bg_low_normal = 2130837508; 225 | 226 | // aapt resource value: 0x7f020005 227 | public static int notification_bg_low_pressed = 2130837509; 228 | 229 | // aapt resource value: 0x7f020006 230 | public static int notification_bg_normal = 2130837510; 231 | 232 | // aapt resource value: 0x7f020007 233 | public static int notification_bg_normal_pressed = 2130837511; 234 | 235 | // aapt resource value: 0x7f020008 236 | public static int notification_icon_background = 2130837512; 237 | 238 | // aapt resource value: 0x7f02000b 239 | public static int notification_template_icon_bg = 2130837515; 240 | 241 | // aapt resource value: 0x7f02000c 242 | public static int notification_template_icon_low_bg = 2130837516; 243 | 244 | // aapt resource value: 0x7f020009 245 | public static int notification_tile_bg = 2130837513; 246 | 247 | // aapt resource value: 0x7f02000a 248 | public static int notify_panel_notification_icon_bg = 2130837514; 249 | 250 | static Drawable() 251 | { 252 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 253 | } 254 | 255 | private Drawable() 256 | { 257 | } 258 | } 259 | 260 | public partial class Id 261 | { 262 | 263 | // aapt resource value: 0x7f0a000d 264 | public static int action0 = 2131361805; 265 | 266 | // aapt resource value: 0x7f0a000a 267 | public static int action_container = 2131361802; 268 | 269 | // aapt resource value: 0x7f0a0011 270 | public static int action_divider = 2131361809; 271 | 272 | // aapt resource value: 0x7f0a000b 273 | public static int action_image = 2131361803; 274 | 275 | // aapt resource value: 0x7f0a000c 276 | public static int action_text = 2131361804; 277 | 278 | // aapt resource value: 0x7f0a001b 279 | public static int actions = 2131361819; 280 | 281 | // aapt resource value: 0x7f0a0005 282 | public static int async = 2131361797; 283 | 284 | // aapt resource value: 0x7f0a0006 285 | public static int blocking = 2131361798; 286 | 287 | // aapt resource value: 0x7f0a000e 288 | public static int cancel_action = 2131361806; 289 | 290 | // aapt resource value: 0x7f0a0016 291 | public static int chronometer = 2131361814; 292 | 293 | // aapt resource value: 0x7f0a001d 294 | public static int end_padder = 2131361821; 295 | 296 | // aapt resource value: 0x7f0a0007 297 | public static int forever = 2131361799; 298 | 299 | // aapt resource value: 0x7f0a0018 300 | public static int icon = 2131361816; 301 | 302 | // aapt resource value: 0x7f0a001c 303 | public static int icon_group = 2131361820; 304 | 305 | // aapt resource value: 0x7f0a0017 306 | public static int info = 2131361815; 307 | 308 | // aapt resource value: 0x7f0a0008 309 | public static int italic = 2131361800; 310 | 311 | // aapt resource value: 0x7f0a0000 312 | public static int line1 = 2131361792; 313 | 314 | // aapt resource value: 0x7f0a0001 315 | public static int line3 = 2131361793; 316 | 317 | // aapt resource value: 0x7f0a0010 318 | public static int media_actions = 2131361808; 319 | 320 | // aapt resource value: 0x7f0a0009 321 | public static int normal = 2131361801; 322 | 323 | // aapt resource value: 0x7f0a001a 324 | public static int notification_background = 2131361818; 325 | 326 | // aapt resource value: 0x7f0a0013 327 | public static int notification_main_column = 2131361811; 328 | 329 | // aapt resource value: 0x7f0a0012 330 | public static int notification_main_column_container = 2131361810; 331 | 332 | // aapt resource value: 0x7f0a0019 333 | public static int right_icon = 2131361817; 334 | 335 | // aapt resource value: 0x7f0a0014 336 | public static int right_side = 2131361812; 337 | 338 | // aapt resource value: 0x7f0a000f 339 | public static int status_bar_latest_event_content = 2131361807; 340 | 341 | // aapt resource value: 0x7f0a0002 342 | public static int text = 2131361794; 343 | 344 | // aapt resource value: 0x7f0a0003 345 | public static int text2 = 2131361795; 346 | 347 | // aapt resource value: 0x7f0a0015 348 | public static int time = 2131361813; 349 | 350 | // aapt resource value: 0x7f0a0004 351 | public static int title = 2131361796; 352 | 353 | static Id() 354 | { 355 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 356 | } 357 | 358 | private Id() 359 | { 360 | } 361 | } 362 | 363 | public partial class Integer 364 | { 365 | 366 | // aapt resource value: 0x7f060000 367 | public static int cancel_button_image_alpha = 2131099648; 368 | 369 | // aapt resource value: 0x7f060001 370 | public static int status_bar_notification_info_maxnum = 2131099649; 371 | 372 | static Integer() 373 | { 374 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 375 | } 376 | 377 | private Integer() 378 | { 379 | } 380 | } 381 | 382 | public partial class Layout 383 | { 384 | 385 | // aapt resource value: 0x7f030000 386 | public static int notification_action = 2130903040; 387 | 388 | // aapt resource value: 0x7f030001 389 | public static int notification_action_tombstone = 2130903041; 390 | 391 | // aapt resource value: 0x7f030002 392 | public static int notification_media_action = 2130903042; 393 | 394 | // aapt resource value: 0x7f030003 395 | public static int notification_media_cancel_action = 2130903043; 396 | 397 | // aapt resource value: 0x7f030004 398 | public static int notification_template_big_media = 2130903044; 399 | 400 | // aapt resource value: 0x7f030005 401 | public static int notification_template_big_media_custom = 2130903045; 402 | 403 | // aapt resource value: 0x7f030006 404 | public static int notification_template_big_media_narrow = 2130903046; 405 | 406 | // aapt resource value: 0x7f030007 407 | public static int notification_template_big_media_narrow_custom = 2130903047; 408 | 409 | // aapt resource value: 0x7f030008 410 | public static int notification_template_custom_big = 2130903048; 411 | 412 | // aapt resource value: 0x7f030009 413 | public static int notification_template_icon_group = 2130903049; 414 | 415 | // aapt resource value: 0x7f03000a 416 | public static int notification_template_lines_media = 2130903050; 417 | 418 | // aapt resource value: 0x7f03000b 419 | public static int notification_template_media = 2130903051; 420 | 421 | // aapt resource value: 0x7f03000c 422 | public static int notification_template_media_custom = 2130903052; 423 | 424 | // aapt resource value: 0x7f03000d 425 | public static int notification_template_part_chronometer = 2130903053; 426 | 427 | // aapt resource value: 0x7f03000e 428 | public static int notification_template_part_time = 2130903054; 429 | 430 | static Layout() 431 | { 432 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 433 | } 434 | 435 | private Layout() 436 | { 437 | } 438 | } 439 | 440 | public partial class String 441 | { 442 | 443 | // aapt resource value: 0x7f070000 444 | public static int status_bar_notification_info_overflow = 2131165184; 445 | 446 | static String() 447 | { 448 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 449 | } 450 | 451 | private String() 452 | { 453 | } 454 | } 455 | 456 | public partial class Style 457 | { 458 | 459 | // aapt resource value: 0x7f040005 460 | public static int TextAppearance_Compat_Notification = 2130968581; 461 | 462 | // aapt resource value: 0x7f040006 463 | public static int TextAppearance_Compat_Notification_Info = 2130968582; 464 | 465 | // aapt resource value: 0x7f040000 466 | public static int TextAppearance_Compat_Notification_Info_Media = 2130968576; 467 | 468 | // aapt resource value: 0x7f04000b 469 | public static int TextAppearance_Compat_Notification_Line2 = 2130968587; 470 | 471 | // aapt resource value: 0x7f040004 472 | public static int TextAppearance_Compat_Notification_Line2_Media = 2130968580; 473 | 474 | // aapt resource value: 0x7f040001 475 | public static int TextAppearance_Compat_Notification_Media = 2130968577; 476 | 477 | // aapt resource value: 0x7f040007 478 | public static int TextAppearance_Compat_Notification_Time = 2130968583; 479 | 480 | // aapt resource value: 0x7f040002 481 | public static int TextAppearance_Compat_Notification_Time_Media = 2130968578; 482 | 483 | // aapt resource value: 0x7f040008 484 | public static int TextAppearance_Compat_Notification_Title = 2130968584; 485 | 486 | // aapt resource value: 0x7f040003 487 | public static int TextAppearance_Compat_Notification_Title_Media = 2130968579; 488 | 489 | // aapt resource value: 0x7f040009 490 | public static int Widget_Compat_NotificationActionContainer = 2130968585; 491 | 492 | // aapt resource value: 0x7f04000a 493 | public static int Widget_Compat_NotificationActionText = 2130968586; 494 | 495 | static Style() 496 | { 497 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 498 | } 499 | 500 | private Style() 501 | { 502 | } 503 | } 504 | 505 | public partial class Styleable 506 | { 507 | 508 | public static int[] FontFamily = new int[] { 509 | 2130771968, 510 | 2130771969, 511 | 2130771970, 512 | 2130771971, 513 | 2130771972, 514 | 2130771973}; 515 | 516 | // aapt resource value: 0 517 | public static int FontFamily_fontProviderAuthority = 0; 518 | 519 | // aapt resource value: 3 520 | public static int FontFamily_fontProviderCerts = 3; 521 | 522 | // aapt resource value: 4 523 | public static int FontFamily_fontProviderFetchStrategy = 4; 524 | 525 | // aapt resource value: 5 526 | public static int FontFamily_fontProviderFetchTimeout = 5; 527 | 528 | // aapt resource value: 1 529 | public static int FontFamily_fontProviderPackage = 1; 530 | 531 | // aapt resource value: 2 532 | public static int FontFamily_fontProviderQuery = 2; 533 | 534 | public static int[] FontFamilyFont = new int[] { 535 | 2130771974, 536 | 2130771975, 537 | 2130771976}; 538 | 539 | // aapt resource value: 1 540 | public static int FontFamilyFont_font = 1; 541 | 542 | // aapt resource value: 0 543 | public static int FontFamilyFont_fontStyle = 0; 544 | 545 | // aapt resource value: 2 546 | public static int FontFamilyFont_fontWeight = 2; 547 | 548 | public static int[] SlidingUpPanelLayout = new int[] { 549 | 2130771977, 550 | 2130771978, 551 | 2130771979, 552 | 2130771980, 553 | 2130771981, 554 | 2130771982}; 555 | 556 | // aapt resource value: 0 557 | public static int SlidingUpPanelLayout_collapsedHeight = 0; 558 | 559 | // aapt resource value: 4 560 | public static int SlidingUpPanelLayout_dragView = 4; 561 | 562 | // aapt resource value: 2 563 | public static int SlidingUpPanelLayout_fadeColor = 2; 564 | 565 | // aapt resource value: 3 566 | public static int SlidingUpPanelLayout_flingVelocity = 3; 567 | 568 | // aapt resource value: 5 569 | public static int SlidingUpPanelLayout_overlay = 5; 570 | 571 | // aapt resource value: 1 572 | public static int SlidingUpPanelLayout_shadowHeight = 1; 573 | 574 | static Styleable() 575 | { 576 | global::Android.Runtime.ResourceIdManager.UpdateIdValues(); 577 | } 578 | 579 | private Styleable() 580 | { 581 | } 582 | } 583 | } 584 | } 585 | #pragma warning restore 1591 586 | -------------------------------------------------------------------------------- /src/SlidingUpPanel/Resources/drawable/above_shadow.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 7 | 8 | -------------------------------------------------------------------------------- /src/SlidingUpPanel/Resources/values/attrs.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/SlidingUpPanel/SlideState.cs: -------------------------------------------------------------------------------- 1 | namespace Cheesebaron.SlidingUpPanel 2 | { 3 | public enum SlideState 4 | { 5 | Expanded = 0, 6 | Collapsed, 7 | Anchored 8 | } 9 | } -------------------------------------------------------------------------------- /src/SlidingUpPanel/SlidingUpPanel.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {46F8CA39-DAF4-4D7D-853E-27B74BAB4FE1} 9 | {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10 | Library 11 | Properties 12 | Cheesebaron.SlidingUpPanel 13 | Cheesebaron.SlidingUpPanel 14 | 512 15 | Resources\Resource.Designer.cs 16 | Off 17 | True 18 | v8.0 19 | 20 | 21 | 22 | 23 | true 24 | full 25 | false 26 | ..\..\bin\Debug\ 27 | DEBUG;TRACE 28 | prompt 29 | 4 30 | 31 | 32 | pdbonly 33 | true 34 | ..\..\bin\Release\ 35 | TRACE 36 | prompt 37 | 4 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | ..\packages\Xamarin.Android.Arch.Core.Common.1.0.0\lib\MonoAndroid80\Xamarin.Android.Arch.Core.Common.dll 47 | 48 | 49 | ..\packages\Xamarin.Android.Arch.Lifecycle.Common.1.0.1\lib\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Common.dll 50 | 51 | 52 | ..\packages\Xamarin.Android.Arch.Lifecycle.Runtime.1.0.0\lib\MonoAndroid80\Xamarin.Android.Arch.Lifecycle.Runtime.dll 53 | 54 | 55 | ..\packages\Xamarin.Android.Support.Annotations.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Annotations.dll 56 | 57 | 58 | ..\packages\Xamarin.Android.Support.Compat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Compat.dll 59 | 60 | 61 | ..\packages\Xamarin.Android.Support.Core.UI.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Core.UI.dll 62 | 63 | 64 | ..\packages\Xamarin.Android.Support.Core.Utils.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Core.Utils.dll 65 | 66 | 67 | ..\packages\Xamarin.Android.Support.Fragment.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Fragment.dll 68 | 69 | 70 | ..\packages\Xamarin.Android.Support.Media.Compat.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.Media.Compat.dll 71 | 72 | 73 | ..\packages\Xamarin.Android.Support.v4.26.1.0.1\lib\MonoAndroid80\Xamarin.Android.Support.v4.dll 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 125 | -------------------------------------------------------------------------------- /src/SlidingUpPanel/SlidingUpPanelEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Views; 3 | 4 | namespace Cheesebaron.SlidingUpPanel 5 | { 6 | public delegate void SlidingUpPanelEventHandler(object sender, SlidingUpPanelEventArgs args); 7 | public delegate void SlidingUpPanelSlideEventHandler(object sender, SlidingUpPanelSlideEventArgs args); 8 | 9 | public class SlidingUpPanelEventArgs : EventArgs 10 | { 11 | public View Panel { get; set; } 12 | } 13 | 14 | public class SlidingUpPanelSlideEventArgs : SlidingUpPanelEventArgs 15 | { 16 | public float SlideOffset { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/SlidingUpPanel/SlidingUpPanelLayout.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Android.Content; 3 | using Android.Graphics; 4 | using Android.Graphics.Drawables; 5 | using Android.OS; 6 | using Android.Runtime; 7 | using Android.Support.V4.View; 8 | using Android.Support.V4.Widget; 9 | using Android.Util; 10 | using Android.Views; 11 | using Android.Views.Accessibility; 12 | using Java.Interop; 13 | 14 | namespace Cheesebaron.SlidingUpPanel 15 | { 16 | public class SlidingUpPanelLayout : ViewGroup 17 | { 18 | private new const string Tag = "SlidingUpPanelLayout"; 19 | private const int DefaultPanelHeight = 68; 20 | private const int DefaultShadowHeight = 4; 21 | private const int DefaultMinFlingVelocity = 400; 22 | private const bool DefaultOverlayFlag = false; 23 | private static readonly Color DefaultFadeColor = new Color(0, 0, 0, 99); 24 | private static readonly int[] DefaultAttrs = { Android.Resource.Attribute.Gravity }; 25 | 26 | private readonly int _minFlingVelocity = DefaultMinFlingVelocity; 27 | private Color _coveredFadeColor = DefaultFadeColor; 28 | private readonly Paint _coveredFadePaint = new Paint(); 29 | private int _panelHeight = -1; 30 | private readonly int _shadowHeight = -1; 31 | private readonly bool _isSlidingUp; 32 | private bool _canSlide; 33 | private View _dragView; 34 | private readonly int _dragViewResId = -1; 35 | private View _slideableView; 36 | private SlideState _slideState = SlideState.Collapsed; 37 | private float _slideOffset; 38 | private int _slideRange; 39 | private bool _isUnableToDrag; 40 | private readonly int _scrollTouchSlop; 41 | private float _initialMotionX; 42 | private float _initialMotionY; 43 | private float _anchorPoint; 44 | private readonly ViewDragHelper _dragHelper; 45 | private bool _firstLayout = true; 46 | private readonly Rect _tmpRect = new Rect(); 47 | 48 | public event SlidingUpPanelSlideEventHandler PanelSlide; 49 | public event SlidingUpPanelEventHandler PanelCollapsed; 50 | public event SlidingUpPanelEventHandler PanelExpanded; 51 | public event SlidingUpPanelEventHandler PanelAnchored; 52 | 53 | public bool IsExpanded 54 | { 55 | get { return _slideState == SlideState.Expanded; } 56 | } 57 | 58 | public bool IsAnchored 59 | { 60 | get { return _slideState == SlideState.Anchored; } 61 | } 62 | 63 | public bool IsSlideable 64 | { 65 | get { return _canSlide; } 66 | } 67 | 68 | public Color CoveredFadeColor 69 | { 70 | get { return _coveredFadeColor; } 71 | set 72 | { 73 | _coveredFadeColor = value; 74 | Invalidate(); 75 | } 76 | } 77 | 78 | public int PanelHeight 79 | { 80 | get { return _panelHeight; } 81 | set 82 | { 83 | _panelHeight = value; 84 | RequestLayout(); 85 | } 86 | } 87 | 88 | public View DragView 89 | { 90 | get { return _dragView; } 91 | set { _dragView = value; } 92 | } 93 | 94 | public float AnchorPoint 95 | { 96 | get { return _anchorPoint; } 97 | set 98 | { 99 | if (value > 0 && value < 1) 100 | _anchorPoint = value; 101 | } 102 | } 103 | 104 | public Drawable ShadowDrawable { get; set; } 105 | 106 | public bool SlidingEnabled { get; set; } 107 | 108 | public bool OverlayContent { get; set; } 109 | 110 | public bool IsUsingDragViewTouchEvents { get; set; } 111 | 112 | private int SlidingTop 113 | { 114 | get 115 | { 116 | if (_slideableView != null) 117 | { 118 | return _isSlidingUp 119 | ? MeasuredHeight - PaddingBottom - _slideableView.MeasuredHeight 120 | : MeasuredHeight - PaddingBottom - (_slideableView.MeasuredHeight * 2); 121 | } 122 | 123 | return MeasuredHeight - PaddingBottom; 124 | } 125 | } 126 | 127 | public bool PaneVisible 128 | { 129 | get 130 | { 131 | if (ChildCount < 2) 132 | return false; 133 | var slidingPane = GetChildAt(1); 134 | return slidingPane.Visibility == ViewStates.Visible; 135 | } 136 | } 137 | 138 | public SlidingUpPanelLayout(IntPtr javaReference, JniHandleOwnership transfer) 139 | : base(javaReference, transfer) { } 140 | 141 | public SlidingUpPanelLayout(Context context) 142 | : this(context, null) { } 143 | 144 | public SlidingUpPanelLayout(Context context, IAttributeSet attrs) 145 | : this(context, attrs, 0) { } 146 | 147 | public SlidingUpPanelLayout(Context context, IAttributeSet attrs, int defStyle) 148 | : base(context, attrs, defStyle) 149 | { 150 | // not really relevan in Xamarin.Android but keeping for a possible 151 | // future update which will render layouts in the Designer. 152 | if (IsInEditMode) return; 153 | 154 | if (attrs != null) 155 | { 156 | var defAttrs = context.ObtainStyledAttributes(attrs, DefaultAttrs); 157 | 158 | if (defAttrs.Length() > 0) 159 | { 160 | var gravity = defAttrs.GetInt(0, (int)GravityFlags.NoGravity); 161 | var gravityFlag = (GravityFlags) gravity; 162 | if (gravityFlag != GravityFlags.Top && gravityFlag != GravityFlags.Bottom) 163 | throw new ArgumentException("gravity must be set to either top or bottom"); 164 | _isSlidingUp = gravityFlag == GravityFlags.Bottom; 165 | } 166 | 167 | defAttrs.Recycle(); 168 | 169 | var ta = context.ObtainStyledAttributes(attrs, Resource.Styleable.SlidingUpPanelLayout); 170 | 171 | if (ta.Length() > 0) 172 | { 173 | _panelHeight = ta.GetDimensionPixelSize(Resource.Styleable.SlidingUpPanelLayout_collapsedHeight, -1); 174 | _shadowHeight = ta.GetDimensionPixelSize(Resource.Styleable.SlidingUpPanelLayout_shadowHeight, -1); 175 | 176 | _minFlingVelocity = ta.GetInt(Resource.Styleable.SlidingUpPanelLayout_flingVelocity, 177 | DefaultMinFlingVelocity); 178 | _coveredFadeColor = ta.GetColor(Resource.Styleable.SlidingUpPanelLayout_fadeColor, DefaultFadeColor); 179 | 180 | _dragViewResId = ta.GetResourceId(Resource.Styleable.SlidingUpPanelLayout_dragView, -1); 181 | 182 | OverlayContent = ta.GetBoolean(Resource.Styleable.SlidingUpPanelLayout_overlay, DefaultOverlayFlag); 183 | } 184 | 185 | ta.Recycle(); 186 | } 187 | 188 | var density = context.Resources.DisplayMetrics.Density; 189 | if (_panelHeight == -1) 190 | _panelHeight = (int) (DefaultPanelHeight * density + 0.5f); 191 | if (_shadowHeight == -1) 192 | _shadowHeight = (int) (DefaultShadowHeight * density + 0.5f); 193 | 194 | SetWillNotDraw(false); 195 | 196 | _dragHelper = ViewDragHelper.Create(this, 0.5f, new DragHelperCallback(this)); 197 | _dragHelper.MinVelocity = _minFlingVelocity * density; 198 | 199 | _canSlide = true; 200 | SlidingEnabled = true; 201 | 202 | var vc = ViewConfiguration.Get(context); 203 | _scrollTouchSlop = vc.ScaledTouchSlop; 204 | } 205 | 206 | protected override void OnFinishInflate() 207 | { 208 | base.OnFinishInflate(); 209 | if (_dragViewResId != -1) 210 | _dragView = FindViewById(_dragViewResId); 211 | } 212 | 213 | private void OnPanelSlide(View panel) 214 | { 215 | if (PanelSlide != null) 216 | PanelSlide(this, new SlidingUpPanelSlideEventArgs {Panel = panel, SlideOffset = _slideOffset}); 217 | } 218 | 219 | private void OnPanelCollapsed(View panel) 220 | { 221 | if (PanelCollapsed != null) 222 | PanelCollapsed(this, new SlidingUpPanelEventArgs { Panel = panel }); 223 | SendAccessibilityEvent(EventTypes.WindowStateChanged); 224 | } 225 | 226 | private void OnPanelAnchored(View panel) 227 | { 228 | if (PanelAnchored != null) 229 | PanelAnchored(this, new SlidingUpPanelEventArgs { Panel = panel }); 230 | SendAccessibilityEvent(EventTypes.WindowStateChanged); 231 | } 232 | 233 | private void OnPanelExpanded(View panel) 234 | { 235 | if (PanelExpanded != null) 236 | PanelExpanded(this, new SlidingUpPanelEventArgs { Panel = panel }); 237 | SendAccessibilityEvent(EventTypes.WindowStateChanged); 238 | } 239 | 240 | private void UpdateObscuredViewVisibility() 241 | { 242 | if (ChildCount == 0) return; 243 | 244 | var leftBound = PaddingLeft; 245 | var rightBound = Width - PaddingLeft; 246 | var topBound = PaddingTop; 247 | var bottomBound = Height - PaddingBottom; 248 | int left; 249 | int right; 250 | int top; 251 | int bottom; 252 | 253 | if (_slideableView != null && HasOpaqueBackground(_slideableView)) 254 | { 255 | left = _slideableView.Left; 256 | right = _slideableView.Right; 257 | top = _slideableView.Top; 258 | bottom = _slideableView.Bottom; 259 | } 260 | else 261 | left = right = top = bottom = 0; 262 | 263 | var child = GetChildAt(0); 264 | var clampedChildLeft = Math.Max(leftBound, child.Left); 265 | var clampedChildTop = Math.Max(topBound, child.Top); 266 | var clampedChildRight = Math.Max(rightBound, child.Right); 267 | var clampedChildBottom = Math.Max(bottomBound, child.Bottom); 268 | ViewStates vis; 269 | if (clampedChildLeft >= left && clampedChildTop >= top && 270 | clampedChildRight <= right && clampedChildBottom <= bottom) 271 | vis = ViewStates.Invisible; 272 | else 273 | vis = ViewStates.Visible; 274 | child.Visibility = vis; 275 | } 276 | 277 | private void SetAllChildrenVisible() 278 | { 279 | for (var i = 0; i < ChildCount; i++) 280 | { 281 | var child = GetChildAt(i); 282 | if (child.Visibility == ViewStates.Invisible) 283 | child.Visibility = ViewStates.Visible; 284 | } 285 | } 286 | 287 | private static bool HasOpaqueBackground(View view) 288 | { 289 | var bg = view.Background; 290 | if (bg != null) 291 | return bg.Opacity == (int) Format.Opaque; 292 | return false; 293 | } 294 | 295 | protected override void OnAttachedToWindow() 296 | { 297 | base.OnAttachedToWindow(); 298 | _firstLayout = true; 299 | } 300 | 301 | protected override void OnDetachedFromWindow() 302 | { 303 | base.OnDetachedFromWindow(); 304 | _firstLayout = true; 305 | } 306 | 307 | protected override void OnMeasure(int widthMeasureSpec, int heightMeasureSpec) 308 | { 309 | var widthMode = MeasureSpec.GetMode(widthMeasureSpec); 310 | var widthSize = MeasureSpec.GetSize(widthMeasureSpec); 311 | var heightMode = MeasureSpec.GetMode(heightMeasureSpec); 312 | var heightSize = MeasureSpec.GetSize(heightMeasureSpec); 313 | 314 | if (widthMode != MeasureSpecMode.Exactly) 315 | throw new InvalidOperationException("Width must have an exact value or match_parent"); 316 | if (heightMode != MeasureSpecMode.Exactly) 317 | throw new InvalidOperationException("Height must have an exact value or match_parent"); 318 | 319 | var layoutHeight = heightSize - PaddingTop - PaddingBottom; 320 | var panelHeight = _panelHeight; 321 | 322 | if (ChildCount > 2) 323 | Log.Error(Tag, "OnMeasure: More than two child views are not supported."); 324 | else 325 | panelHeight = 0; 326 | 327 | _slideableView = null; 328 | _canSlide = false; 329 | 330 | for (var i = 0; i < ChildCount; i++) 331 | { 332 | var child = GetChildAt(i); 333 | var lp = (LayoutParams) child.LayoutParameters; 334 | 335 | var height = layoutHeight; 336 | if (child.Visibility == ViewStates.Gone) 337 | { 338 | lp.DimWhenOffset = false; 339 | continue; 340 | } 341 | 342 | if (i == 1) 343 | { 344 | lp.Slideable = true; 345 | lp.DimWhenOffset = true; 346 | _slideableView = child; 347 | _canSlide = true; 348 | } 349 | else 350 | { 351 | if (!OverlayContent) 352 | height -= panelHeight; 353 | } 354 | 355 | int childWidthSpec; 356 | if (lp.Width == ViewGroup.LayoutParams.WrapContent) 357 | childWidthSpec = MeasureSpec.MakeMeasureSpec(widthSize, MeasureSpecMode.AtMost); 358 | else if (lp.Width == ViewGroup.LayoutParams.MatchParent) 359 | childWidthSpec = MeasureSpec.MakeMeasureSpec(widthSize, MeasureSpecMode.Exactly); 360 | else 361 | childWidthSpec = MeasureSpec.MakeMeasureSpec(lp.Width, MeasureSpecMode.Exactly); 362 | 363 | int childHeightSpec; 364 | if (lp.Height == ViewGroup.LayoutParams.WrapContent) 365 | childHeightSpec = MeasureSpec.MakeMeasureSpec(height, MeasureSpecMode.AtMost); 366 | else if (lp.Height == ViewGroup.LayoutParams.MatchParent) 367 | childHeightSpec = MeasureSpec.MakeMeasureSpec(height, MeasureSpecMode.Exactly); 368 | else 369 | childHeightSpec = MeasureSpec.MakeMeasureSpec(lp.Height, MeasureSpecMode.Exactly); 370 | 371 | child.Measure(childWidthSpec, childHeightSpec); 372 | } 373 | SetMeasuredDimension(widthSize, heightSize); 374 | } 375 | 376 | protected override void OnLayout(bool changed, int l, int t, int r, int b) 377 | { 378 | if (_firstLayout) 379 | { 380 | switch (_slideState) 381 | { 382 | case SlideState.Expanded: 383 | _slideOffset = _canSlide ? 0.0f : 1.0f; 384 | break; 385 | case SlideState.Anchored: 386 | _slideOffset = _canSlide ? _anchorPoint : 1.0f; 387 | break; 388 | case SlideState.Collapsed: 389 | _slideOffset = 1.0f; 390 | break; 391 | } 392 | } 393 | 394 | for (var i = 0; i < ChildCount; i++) 395 | { 396 | var child = GetChildAt(i); 397 | 398 | if (child.Visibility == ViewStates.Gone) 399 | continue; 400 | 401 | var lp = (LayoutParams) child.LayoutParameters; 402 | var childHeight = child.MeasuredHeight; 403 | 404 | if (lp.Slideable) 405 | _slideRange = childHeight - _panelHeight; 406 | 407 | int childTop; 408 | if (_isSlidingUp) 409 | childTop = lp.Slideable ? SlidingTop + (int) (_slideRange * _slideOffset) : PaddingTop; 410 | else 411 | childTop = lp.Slideable ? SlidingTop - (int)(_slideRange * _slideOffset) : PaddingTop + PanelHeight; 412 | 413 | var childBottom = childTop + childHeight; 414 | var childLeft = PaddingLeft; 415 | var childRight = childLeft + child.MeasuredWidth; 416 | 417 | child.Layout(childLeft, childTop, childRight, childBottom); 418 | } 419 | 420 | if (_firstLayout) 421 | UpdateObscuredViewVisibility(); 422 | 423 | _firstLayout = false; 424 | } 425 | 426 | protected override void OnSizeChanged(int w, int h, int oldw, int oldh) 427 | { 428 | base.OnSizeChanged(w, h, oldw, oldh); 429 | 430 | if (h != oldh) 431 | _firstLayout = true; 432 | } 433 | 434 | public override bool OnInterceptTouchEvent(MotionEvent ev) 435 | { 436 | var action = MotionEventCompat.GetActionMasked(ev); 437 | 438 | if (!_canSlide || !SlidingEnabled || (_isUnableToDrag && action != (int) MotionEventActions.Down)) 439 | { 440 | _dragHelper?.Cancel(); 441 | return base.OnInterceptTouchEvent(ev); 442 | } 443 | 444 | if (action == (int) MotionEventActions.Cancel || action == (int) MotionEventActions.Up) 445 | { 446 | _dragHelper?.Cancel(); 447 | return false; 448 | } 449 | 450 | var x = ev.GetX(); 451 | var y = ev.GetY(); 452 | var interceptTap = false; 453 | 454 | switch (action) 455 | { 456 | case (int)MotionEventActions.Down: 457 | _isUnableToDrag = false; 458 | _initialMotionX = x; 459 | _initialMotionY = y; 460 | if (IsDragViewUnder((int) x, (int) y) && !IsUsingDragViewTouchEvents) 461 | interceptTap = true; 462 | break; 463 | case (int)MotionEventActions.Move: 464 | var adx = Math.Abs(x - _initialMotionX); 465 | var ady = Math.Abs(y - _initialMotionY); 466 | var dragSlop = _dragHelper?.TouchSlop ?? 0; 467 | 468 | if (IsUsingDragViewTouchEvents) 469 | { 470 | if (adx > _scrollTouchSlop && ady < _scrollTouchSlop) 471 | return base.OnInterceptTouchEvent(ev); 472 | if (ady > _scrollTouchSlop) 473 | interceptTap = IsDragViewUnder((int) x, (int) y); 474 | } 475 | 476 | if ((ady > dragSlop && adx > ady) || !IsDragViewUnder((int) x, (int) y)) 477 | { 478 | _dragHelper?.Cancel(); 479 | _isUnableToDrag = true; 480 | return false; 481 | } 482 | break; 483 | } 484 | 485 | var interceptForDrag = _dragHelper.ShouldInterceptTouchEvent(ev); 486 | 487 | return interceptForDrag || interceptTap; 488 | } 489 | 490 | public override bool OnTouchEvent(MotionEvent ev) 491 | { 492 | if (!_canSlide || !SlidingEnabled) 493 | return base.OnTouchEvent(ev); 494 | 495 | _dragHelper?.ProcessTouchEvent(ev); 496 | var action = (int)ev.Action; 497 | 498 | switch (action & MotionEventCompat.ActionMask) 499 | { 500 | case (int)MotionEventActions.Down: 501 | { 502 | var x = ev.GetX(); 503 | var y = ev.GetY(); 504 | _initialMotionX = x; 505 | _initialMotionY = y; 506 | break; 507 | } 508 | case (int)MotionEventActions.Up: 509 | { 510 | var x = ev.GetX(); 511 | var y = ev.GetY(); 512 | var dx = x - _initialMotionX; 513 | var dy = y - _initialMotionY; 514 | var slop = _dragHelper?.TouchSlop ?? 0; 515 | var dragView = _dragView ?? _slideableView; 516 | if (dx * dx + dy * dy < slop * slop && IsDragViewUnder((int)x, (int)y)) 517 | { 518 | dragView.PlaySoundEffect(SoundEffects.Click); 519 | if (!IsExpanded && !IsAnchored) 520 | ExpandPane(_anchorPoint); 521 | else 522 | CollapsePane(); 523 | } 524 | break; 525 | } 526 | } 527 | 528 | return true; 529 | } 530 | 531 | private bool IsDragViewUnder(int x, int y) 532 | { 533 | var dragView = _dragView ?? _slideableView; 534 | if (dragView == null) return false; 535 | 536 | var viewLocation = new int[2]; 537 | dragView.GetLocationOnScreen(viewLocation); 538 | var parentLocation = new int[2]; 539 | GetLocationOnScreen(parentLocation); 540 | 541 | var screenX = parentLocation[0] + x; 542 | var screenY = parentLocation[1] + y; 543 | return screenX >= viewLocation[0] && screenX < viewLocation[0] + dragView.Width && 544 | screenY >= viewLocation[1] && screenY < viewLocation[1] + dragView.Height; 545 | } 546 | 547 | public bool CollapsePane() 548 | { 549 | if (_firstLayout || SmoothSlideTo(1.0f)) 550 | return true; 551 | return false; 552 | } 553 | 554 | public bool ExpandPane() 555 | { 556 | return ExpandPane(0); 557 | } 558 | 559 | public bool ExpandPane(float slideOffset) 560 | { 561 | if (!PaneVisible) 562 | ShowPane(); 563 | return _firstLayout || SmoothSlideTo(slideOffset); 564 | } 565 | 566 | public void ShowPane() 567 | { 568 | if (ChildCount < 2) return; 569 | 570 | var slidingPane = GetChildAt(1); 571 | slidingPane.Visibility = ViewStates.Visible; 572 | RequestLayout(); 573 | } 574 | 575 | public void HidePane() 576 | { 577 | if (_slideableView == null) return; 578 | 579 | _slideableView.Visibility = ViewStates.Gone; 580 | RequestLayout(); 581 | } 582 | 583 | private void OnPanelDragged(int newTop) 584 | { 585 | _slideOffset = _isSlidingUp 586 | ? (float) (newTop - SlidingTop) / _slideRange 587 | : (float) (SlidingTop - newTop) / _slideRange; 588 | OnPanelSlide(_slideableView); 589 | } 590 | 591 | protected override bool DrawChild(Canvas canvas, View child, long drawingTime) 592 | { 593 | var lp = (LayoutParams) child.LayoutParameters; 594 | var save = canvas.Save(); 595 | 596 | var drawScrim = false; 597 | 598 | if (_canSlide && !lp.Slideable && _slideableView != null) 599 | { 600 | if (!OverlayContent) 601 | { 602 | canvas.GetClipBounds(_tmpRect); 603 | if (_isSlidingUp) 604 | _tmpRect.Bottom = Math.Min(_tmpRect.Bottom, _slideableView.Top); 605 | else 606 | _tmpRect.Top = Math.Max(_tmpRect.Top, _slideableView.Bottom); 607 | 608 | canvas.ClipRect(_tmpRect); 609 | } 610 | 611 | if (_slideOffset < 1) 612 | drawScrim = true; 613 | } 614 | 615 | var result = base.DrawChild(canvas, child, drawingTime); 616 | canvas.RestoreToCount(save); 617 | 618 | if (drawScrim) 619 | { 620 | var baseAlpha = (_coveredFadeColor.ToArgb() & 0xff000000) >> 24; 621 | var imag = (int) (baseAlpha * (1 - _slideOffset)); 622 | var color = imag << 24 | (_coveredFadeColor.ToArgb() & 0xffffff); 623 | _coveredFadePaint.Color = new Color(color); 624 | canvas.DrawRect(_tmpRect, _coveredFadePaint); 625 | } 626 | 627 | return result; 628 | } 629 | 630 | private bool SmoothSlideTo(float slideOffset) 631 | { 632 | if (!_canSlide) return false; 633 | 634 | var y = _isSlidingUp 635 | ? (int) (SlidingTop + slideOffset * _slideRange) 636 | : (int) (SlidingTop - slideOffset * _slideRange); 637 | 638 | if (!(_dragHelper?.SmoothSlideViewTo(_slideableView, _slideableView.Left, y) ?? false)) return false; 639 | 640 | SetAllChildrenVisible(); 641 | ViewCompat.PostInvalidateOnAnimation(this); 642 | return true; 643 | } 644 | 645 | public override void ComputeScroll() 646 | { 647 | if (_dragHelper == null) return; 648 | 649 | if (!_dragHelper.ContinueSettling(true)) return; 650 | 651 | if (!_canSlide) 652 | { 653 | _dragHelper.Abort(); 654 | return; 655 | } 656 | 657 | ViewCompat.PostInvalidateOnAnimation(this); 658 | } 659 | 660 | public override void Draw(Canvas canvas) 661 | { 662 | base.Draw(canvas); 663 | 664 | if (_slideableView == null) return; 665 | if (ShadowDrawable == null) return; 666 | 667 | var right = _slideableView.Right; 668 | var left = _slideableView.Left; 669 | int top; 670 | int bottom; 671 | if (_isSlidingUp) 672 | { 673 | top = _slideableView.Top - _shadowHeight; 674 | bottom = _slideableView.Top; 675 | } 676 | else 677 | { 678 | top = _slideableView.Bottom; 679 | bottom = _slideableView.Bottom + _shadowHeight; 680 | } 681 | 682 | ShadowDrawable.SetBounds(left, top, right, bottom); 683 | ShadowDrawable.Draw(canvas); 684 | } 685 | 686 | protected bool CanScroll(View view, bool checkV, int dx, int x, int y) 687 | { 688 | var viewGroup = view as ViewGroup; 689 | if (viewGroup == null) return checkV && ViewCompat.CanScrollHorizontally(view, -dx); 690 | 691 | var scrollX = viewGroup.ScrollX; 692 | var scrollY = viewGroup.ScrollY; 693 | var count = viewGroup.ChildCount; 694 | 695 | for (var i = count - 1; i >= 0; i--) 696 | { 697 | var child = viewGroup.GetChildAt(i); 698 | if (x + scrollX >= child.Left && x + scrollX < child.Right && 699 | y + scrollY >= child.Top && y + scrollY < child.Bottom && 700 | CanScroll(child, true, dx, x + scrollX - child.Left, y + scrollY - child.Top)) 701 | return true; 702 | } 703 | return checkV && ViewCompat.CanScrollHorizontally(view, -dx); 704 | } 705 | 706 | protected override ViewGroup.LayoutParams GenerateDefaultLayoutParams() 707 | { 708 | return new LayoutParams(); 709 | } 710 | 711 | protected override ViewGroup.LayoutParams GenerateLayoutParams(ViewGroup.LayoutParams p) 712 | { 713 | var param = p as MarginLayoutParams; 714 | return param != null ? new LayoutParams(param) : new LayoutParams(p); 715 | } 716 | 717 | protected override bool CheckLayoutParams(ViewGroup.LayoutParams p) 718 | { 719 | var param = p as LayoutParams; 720 | return param != null && base.CheckLayoutParams(p); 721 | } 722 | 723 | public override ViewGroup.LayoutParams GenerateLayoutParams(IAttributeSet attrs) 724 | { 725 | return new LayoutParams(Context, attrs); 726 | } 727 | 728 | public new class LayoutParams : MarginLayoutParams 729 | { 730 | private static readonly int[] Attrs = { 731 | Android.Resource.Attribute.LayoutWidth 732 | }; 733 | 734 | public bool Slideable { get; set; } 735 | 736 | public bool DimWhenOffset { get; set; } 737 | 738 | public Paint DimPaint { get; set; } 739 | 740 | public LayoutParams() 741 | : base(MatchParent, MatchParent) { } 742 | 743 | public LayoutParams(int width, int height) 744 | : base(width, height) { } 745 | 746 | public LayoutParams(ViewGroup.LayoutParams source) 747 | : base(source) { } 748 | 749 | public LayoutParams(MarginLayoutParams source) 750 | : base(source) { } 751 | 752 | public LayoutParams(LayoutParams source) 753 | : base(source) { } 754 | 755 | public LayoutParams(Context c, IAttributeSet attrs) 756 | : base(c, attrs) 757 | { 758 | var a = c.ObtainStyledAttributes(attrs, Attrs); 759 | a.Recycle(); 760 | } 761 | } 762 | 763 | private class DragHelperCallback : ViewDragHelper.Callback 764 | { 765 | //This class is a bit nasty, as C# does not allow calling variables directly 766 | //like stupid Java does. 767 | private readonly SlidingUpPanelLayout _panelLayout; 768 | 769 | public DragHelperCallback(SlidingUpPanelLayout layout) 770 | { 771 | _panelLayout = layout; 772 | } 773 | 774 | public override bool TryCaptureView(View child, int pointerId) 775 | { 776 | return !_panelLayout._isUnableToDrag && ((LayoutParams) child.LayoutParameters).Slideable; 777 | } 778 | 779 | public override void OnViewDragStateChanged(int state) 780 | { 781 | var anchoredTop = (int) (_panelLayout._anchorPoint * _panelLayout._slideRange); 782 | 783 | if (_panelLayout._dragHelper != null && _panelLayout._dragHelper.ViewDragState == ViewDragHelper.StateIdle) 784 | { 785 | if (FloatNearlyEqual(_panelLayout._slideOffset, 0)) 786 | { 787 | if (_panelLayout._slideState != SlideState.Expanded) 788 | { 789 | _panelLayout.UpdateObscuredViewVisibility(); 790 | _panelLayout.OnPanelExpanded(_panelLayout._slideableView); 791 | _panelLayout._slideState = SlideState.Expanded; 792 | } 793 | } 794 | else if (FloatNearlyEqual(_panelLayout._slideOffset, (float)anchoredTop / _panelLayout._slideRange)) 795 | { 796 | if (_panelLayout._slideState != SlideState.Anchored) 797 | { 798 | _panelLayout.UpdateObscuredViewVisibility(); 799 | _panelLayout.OnPanelAnchored(_panelLayout._slideableView); 800 | _panelLayout._slideState = SlideState.Anchored; 801 | } 802 | } 803 | else if (_panelLayout._slideState != SlideState.Collapsed) 804 | { 805 | _panelLayout.OnPanelCollapsed(_panelLayout._slideableView); 806 | _panelLayout._slideState = SlideState.Collapsed; 807 | } 808 | } 809 | } 810 | 811 | public override void OnViewCaptured(View capturedChild, int activePointerId) 812 | { 813 | _panelLayout.SetAllChildrenVisible(); 814 | } 815 | 816 | public override void OnViewPositionChanged(View changedView, int left, int top, int dx, int dy) 817 | { 818 | _panelLayout.OnPanelDragged(top); 819 | _panelLayout.Invalidate(); 820 | } 821 | 822 | public override void OnViewReleased(View releasedChild, float xvel, float yvel) 823 | { 824 | var top = _panelLayout._isSlidingUp 825 | ? _panelLayout.SlidingTop 826 | : _panelLayout.SlidingTop - _panelLayout._slideRange; 827 | 828 | if (!FloatNearlyEqual(_panelLayout._anchorPoint, 0)) 829 | { 830 | int anchoredTop; 831 | float anchorOffset; 832 | 833 | if (_panelLayout._isSlidingUp) 834 | { 835 | anchoredTop = (int) (_panelLayout._anchorPoint * _panelLayout._slideRange); 836 | anchorOffset = (float) anchoredTop / _panelLayout._slideRange; 837 | } 838 | else 839 | { 840 | anchoredTop = _panelLayout._panelHeight - 841 | (int) (_panelLayout._anchorPoint * _panelLayout._slideRange); 842 | anchorOffset = (float)(_panelLayout._panelHeight - anchoredTop) / _panelLayout._slideRange; 843 | } 844 | 845 | if (yvel > 0 || (FloatNearlyEqual(yvel, 0) && _panelLayout._slideOffset >= (1f + anchorOffset) / 2)) 846 | top += _panelLayout._slideRange; 847 | else if (FloatNearlyEqual(yvel, 0) && _panelLayout._slideOffset < (1f + anchorOffset) / 2 && 848 | _panelLayout._slideOffset >= anchorOffset / 2) 849 | top += (int) (_panelLayout._slideRange * _panelLayout._anchorPoint); 850 | } 851 | else if (yvel > 0 || (FloatNearlyEqual(yvel, 0) && _panelLayout._slideOffset > 0.5f)) 852 | top += _panelLayout._slideRange; 853 | 854 | _panelLayout._dragHelper?.SettleCapturedViewAt(releasedChild.Left, top); 855 | _panelLayout.Invalidate(); 856 | } 857 | 858 | public override int GetViewVerticalDragRange(View child) 859 | { 860 | return _panelLayout._slideRange; 861 | } 862 | 863 | public override int ClampViewPositionVertical(View child, int top, int dy) 864 | { 865 | int topBound; 866 | int bottomBound; 867 | if (_panelLayout._isSlidingUp) 868 | { 869 | topBound = _panelLayout.SlidingTop; 870 | bottomBound = topBound + _panelLayout._slideRange; 871 | } 872 | else 873 | { 874 | bottomBound = _panelLayout.PaddingTop; 875 | topBound = bottomBound - _panelLayout._slideRange; 876 | } 877 | 878 | return Math.Min(Math.Max(top, topBound), bottomBound); 879 | } 880 | } 881 | 882 | protected override IParcelable OnSaveInstanceState() 883 | { 884 | var superState = base.OnSaveInstanceState(); 885 | 886 | var savedState = new SavedState(superState, _slideState); 887 | return savedState; 888 | } 889 | 890 | protected override void OnRestoreInstanceState(IParcelable state) 891 | { 892 | try 893 | { 894 | var savedState = (SavedState) state; 895 | base.OnRestoreInstanceState(savedState.SuperState); 896 | _slideState = savedState.State; 897 | } 898 | catch 899 | { 900 | base.OnRestoreInstanceState(state); 901 | } 902 | } 903 | 904 | public class SavedState : BaseSavedState 905 | { 906 | public SlideState State { get; private set; } 907 | 908 | public SavedState(IParcelable superState, SlideState item) 909 | : base(superState) 910 | { 911 | State = item; 912 | } 913 | 914 | public SavedState(Parcel parcel) 915 | : base(parcel) 916 | { 917 | try 918 | { 919 | State = (SlideState) parcel.ReadInt(); 920 | } 921 | catch 922 | { 923 | State = SlideState.Collapsed; 924 | } 925 | } 926 | 927 | public override void WriteToParcel(Parcel dest, ParcelableWriteFlags flags) 928 | { 929 | base.WriteToParcel(dest, flags); 930 | dest.WriteInt((int)State); 931 | } 932 | 933 | [ExportField("CREATOR")] 934 | public static SavedStateCreator InitializeCreator() 935 | { 936 | return new SavedStateCreator(); 937 | } 938 | 939 | public class SavedStateCreator : Java.Lang.Object, IParcelableCreator 940 | { 941 | public Java.Lang.Object CreateFromParcel(Parcel source) 942 | { 943 | return new SavedState(source); 944 | } 945 | 946 | public Java.Lang.Object[] NewArray(int size) 947 | { 948 | return new SavedState[size]; 949 | } 950 | } 951 | } 952 | 953 | public static bool FloatNearlyEqual(float a, float b, float epsilon) 954 | { 955 | var absA = Math.Abs(a); 956 | var absB = Math.Abs(b); 957 | var diff = Math.Abs(a - b); 958 | 959 | if (a == b) // shortcut, handles infinities 960 | return true; 961 | if (a == 0 || b == 0 || diff < float.MinValue) 962 | // a or b is zero or both are extremely close to it 963 | // relative error is less meaningful here 964 | return diff < (epsilon * float.MinValue); 965 | 966 | // use relative error 967 | return diff / (absA + absB) < epsilon; 968 | } 969 | 970 | public static bool FloatNearlyEqual(float a, float b) 971 | { 972 | return FloatNearlyEqual(a, b, 0.00001f); 973 | } 974 | } 975 | } 976 | -------------------------------------------------------------------------------- /src/SlidingUpPanel/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /tools/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | --------------------------------------------------------------------------------