├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle-mvn-push.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle ├── split-pane-layout-demo ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── mobidevelop │ │ └── spl │ │ └── demo │ │ └── MainActivity.java │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ ├── ic_launcher_background.xml │ ├── splitter_bg_h.xml │ └── splitter_bg_v.xml │ ├── layout-land │ └── activity_main.xml │ ├── layout │ └── activity_main.xml │ ├── mipmap-anydpi-v26 │ ├── ic_launcher.xml │ └── ic_launcher_round.xml │ ├── mipmap-hdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-mdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ ├── mipmap-xxxhdpi │ ├── ic_launcher.png │ └── ic_launcher_round.png │ └── values │ ├── colors.xml │ ├── strings.xml │ └── styles.xml └── split-pane-layout ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro └── src └── main ├── AndroidManifest.xml ├── java └── com │ └── mobidevelop │ └── spl │ └── widget │ └── SplitPaneLayout.java └── res └── values ├── attrs.xml └── dimens.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Android Split Pane Layout 2 | =========== 3 | 4 | An Android layout which splits the available space between two child views. An optionally movable bar exists between the children which allows the user to redistribute the space allocated to each view. 5 | 6 | Usage 7 | ===== 8 | Add a reference to the split-pane-layout library project, or copy the necessary files into your project. Add a SplitPaneLayout as follows: 9 | 10 | 20 | 24 | 28 | 29 | 30 | **NOTE**: A SplitPaneLayout **MUST** have exactly two children. 31 | 32 | Using with Gradle 33 | ==================== 34 | SplitPaneLayout is published to Maven Central so can be easily added to your Gradle-based Android projects by adding the following entry to your dependencies: 35 | 36 | ```groovy 37 | dependencies { 38 | compile 'com.mobidevelop.spl:split-pane-layout:1.0.0' 39 | } 40 | ``` 41 | 42 | 43 | Precompiled Demo APK 44 | ==================== 45 | 46 | 47 | ![QR](https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl=https://www.box.com/s/6yw9kekmq558wgbwan91) 48 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.1.3' 11 | 12 | 13 | // NOTE: Do not place your application dependencies here; they belong 14 | // in the individual module build.gradle files 15 | } 16 | } 17 | 18 | allprojects { 19 | repositories { 20 | google() 21 | jcenter() 22 | } 23 | } 24 | 25 | task clean(type: Delete) { 26 | delete rootProject.buildDir 27 | } 28 | -------------------------------------------------------------------------------- /gradle-mvn-push.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Chris Banes 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'maven' 18 | apply plugin: 'signing' 19 | 20 | def isReleaseBuild() { 21 | return VERSION_NAME.contains("SNAPSHOT") == false 22 | } 23 | 24 | def getReleaseRepositoryUrl() { 25 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL 26 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" 27 | } 28 | 29 | def getSnapshotRepositoryUrl() { 30 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL 31 | : "https://oss.sonatype.org/content/repositories/snapshots/" 32 | } 33 | 34 | def getRepositoryUsername() { 35 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : "" 36 | } 37 | 38 | def getRepositoryPassword() { 39 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : "" 40 | } 41 | 42 | afterEvaluate { project -> 43 | uploadArchives { 44 | repositories { 45 | mavenDeployer { 46 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } 47 | 48 | pom.groupId = GROUP 49 | pom.artifactId = POM_ARTIFACT_ID 50 | pom.version = VERSION_NAME 51 | 52 | repository(url: getReleaseRepositoryUrl()) { 53 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 54 | } 55 | snapshotRepository(url: getSnapshotRepositoryUrl()) { 56 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword()) 57 | } 58 | 59 | pom.project { 60 | name POM_NAME 61 | packaging POM_PACKAGING 62 | description POM_DESCRIPTION 63 | url POM_URL 64 | 65 | scm { 66 | url POM_SCM_URL 67 | connection POM_SCM_CONNECTION 68 | developerConnection POM_SCM_DEV_CONNECTION 69 | } 70 | 71 | licenses { 72 | license { 73 | name POM_LICENCE_NAME 74 | url POM_LICENCE_URL 75 | distribution POM_LICENCE_DIST 76 | } 77 | } 78 | 79 | developers { 80 | developer { 81 | id POM_DEVELOPER_ID 82 | name POM_DEVELOPER_NAME 83 | } 84 | } 85 | } 86 | } 87 | } 88 | } 89 | 90 | signing { 91 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } 92 | sign configurations.archives 93 | } 94 | 95 | task androidJavadocs(type: Javadoc) { 96 | source = android.sourceSets.main.java.sourceFiles 97 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 98 | } 99 | 100 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) { 101 | classifier = 'javadoc' 102 | from androidJavadocs.destinationDir 103 | } 104 | 105 | task androidSourcesJar(type: Jar) { 106 | classifier = 'sources' 107 | from android.sourceSets.main.java.sourceFiles 108 | } 109 | 110 | artifacts { 111 | archives androidSourcesJar 112 | archives androidJavadocsJar 113 | } 114 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | org.gradle.jvmargs=-Xmx1536m 13 | 14 | # When configured, Gradle will run in incubating parallel mode. 15 | # This option should only be used with decoupled projects. More details, visit 16 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 17 | # org.gradle.parallel=true 18 | 19 | GROUP=com.mobidevelop.spl 20 | VERSION_NAME=1.0.0 21 | 22 | POM_DESCRIPTION=An Android layout which splits the available space between child views 23 | POM_URL=https://github.com/MobiDevelop/android-split-pane-layout 24 | POM_SCM_URL=https://github.com/MobiDevelop/android-split-pane-layout 25 | POM_SCM_CONNECTION=scm:git@github.com:MobiDevelop/android-split-pane-layout.git 26 | POM_SCM_DEV_CONNECTION=scm:git@github.com:MobiDevelop/android-split-pane-layout.git 27 | POM_LICENCE_NAME=The Apache Software License, Version 2.0 28 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt 29 | POM_LICENCE_DIST=repo 30 | POM_DEVELOPER_ID=mobidevelop 31 | POM_DEVELOPER_NAME=MobiDevelop -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jul 31 20:52:57 MST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':split-pane-layout' 2 | include ':split-pane-layout-demo' 3 | -------------------------------------------------------------------------------- /split-pane-layout-demo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /split-pane-layout-demo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 26 5 | 6 | defaultConfig { 7 | applicationId "com.mobidevelop.spl.demo" 8 | minSdkVersion 16 9 | targetSdkVersion 26 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | } 22 | 23 | dependencies { 24 | implementation project(':split-pane-layout') 25 | implementation 'com.android.support:appcompat-v7:26.1.0' 26 | } 27 | -------------------------------------------------------------------------------- /split-pane-layout-demo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/java/com/mobidevelop/spl/demo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.mobidevelop.spl.demo; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.TextView; 7 | 8 | import com.mobidevelop.spl.widget.SplitPaneLayout; 9 | 10 | import java.text.DecimalFormat; 11 | import java.text.NumberFormat; 12 | import java.util.Locale; 13 | 14 | public class MainActivity extends Activity { 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_main); 20 | 21 | final TextView first = findViewById(R.id.first); 22 | final TextView second = findViewById(R.id.second); 23 | 24 | final SplitPaneLayout layout = findViewById(R.id.layout); 25 | layout.setOnSplitterPositionChangedListener(new SplitPaneLayout.OnSplitterPositionChangedListener() { 26 | @Override 27 | public void onSplitterPositionChanged(SplitPaneLayout splitPaneLayout, boolean fromUser) { 28 | NumberFormat percent = DecimalFormat.getPercentInstance(Locale.getDefault()); 29 | 30 | first.setText(percent.format(layout.getSplitterPositionPercent())); 31 | second.setText(percent.format(1f - layout.getSplitterPositionPercent())); 32 | } 33 | }); 34 | layout.post(new Runnable() { 35 | @Override 36 | public void run() { 37 | NumberFormat percent = DecimalFormat.getPercentInstance(Locale.getDefault()); 38 | 39 | first.setText(percent.format(layout.getSplitterPositionPercent())); 40 | second.setText(percent.format(1f - layout.getSplitterPositionPercent())); 41 | 42 | } 43 | }); 44 | 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/drawable/splitter_bg_h.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/drawable/splitter_bg_v.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 10 | 11 | 12 | 13 | 14 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/layout-land/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | 21 | 22 | 27 | 28 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 15 | 16 | 21 | 22 | 27 | 28 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MobiDevelop/android-split-pane-layout/8148353ae986c1840f28cfc9095d140b3a9f7a75/split-pane-layout-demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SPL 3 | Hello World! 4 | 5 | -------------------------------------------------------------------------------- /split-pane-layout-demo/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /split-pane-layout/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /split-pane-layout/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 26 5 | 6 | defaultConfig { 7 | minSdkVersion 16 8 | targetSdkVersion 26 9 | versionCode 1 10 | versionName "1.0" 11 | 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | 14 | } 15 | 16 | buildTypes { 17 | release { 18 | minifyEnabled false 19 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 20 | } 21 | } 22 | 23 | } 24 | 25 | apply from: '../gradle-mvn-push.gradle' -------------------------------------------------------------------------------- /split-pane-layout/gradle.properties: -------------------------------------------------------------------------------- 1 | POM_NAME=Android Split Pane Layout 2 | POM_ARTIFACT_ID=split-pane-layout 3 | POM_PACKAGING=aar -------------------------------------------------------------------------------- /split-pane-layout/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /split-pane-layout/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /split-pane-layout/src/main/java/com/mobidevelop/spl/widget/SplitPaneLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Android Split Pane Layout. 3 | * https://github.com/MobiDevelop/android-split-pane-layout 4 | * 5 | * Copyright (C) 2012 Justin Shapcott 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package com.mobidevelop.spl.widget; 21 | 22 | import android.content.Context; 23 | import android.content.res.TypedArray; 24 | import android.graphics.Canvas; 25 | import android.graphics.Rect; 26 | import android.graphics.drawable.Drawable; 27 | import android.graphics.drawable.PaintDrawable; 28 | import android.os.Parcel; 29 | import android.os.Parcelable; 30 | import android.util.AttributeSet; 31 | import android.util.Log; 32 | import android.util.TypedValue; 33 | import android.view.HapticFeedbackConstants; 34 | import android.view.KeyEvent; 35 | import android.view.MotionEvent; 36 | import android.view.ViewConfiguration; 37 | import android.view.ViewGroup; 38 | 39 | import com.mobidevelop.spl.R; 40 | 41 | /** 42 | * A layout that splits the available space between two child views. 43 | *

44 | * An optionally movable bar exists between the children which allows the user 45 | * to redistribute the space allocated to each view. 46 | */ 47 | public class SplitPaneLayout extends ViewGroup { 48 | 49 | public interface OnSplitterPositionChangedListener { 50 | void onSplitterPositionChanged(SplitPaneLayout splitPaneLayout, boolean fromUser); 51 | } 52 | 53 | public static final int ORIENTATION_HORIZONTAL = 0; 54 | public static final int ORIENTATION_VERTICAL = 1; 55 | 56 | private int mOrientation = 0; 57 | private int mSplitterSize = 8; 58 | private boolean mSplitterMovable = true; 59 | private int mSplitterPosition = Integer.MIN_VALUE; 60 | private float mSplitterPositionPercent = 0.5f; 61 | private int mSplitterTouchSlop = 0; 62 | 63 | private int mPaneSizeMin = 0; 64 | 65 | private Drawable mSplitterDrawable; 66 | private Drawable mSplitterDraggingDrawable; 67 | 68 | private Rect mSplitterBounds = new Rect(); 69 | private Rect mSplitterTouchBounds = new Rect(); 70 | private Rect mSplitterDraggingBounds = new Rect(); 71 | 72 | private OnSplitterPositionChangedListener mOnSplitterPositionChangedListener; 73 | 74 | private int lastTouchX; 75 | private int lastTouchY; 76 | 77 | private boolean isDragging = false; 78 | private boolean isMovingSplitter = false; 79 | 80 | private boolean isMeasured = false; 81 | 82 | public SplitPaneLayout(Context context) { 83 | super(context); 84 | mSplitterPositionPercent = 0.5f; 85 | mSplitterDrawable = new PaintDrawable(0x88FFFFFF); 86 | mSplitterDraggingDrawable = new PaintDrawable(0x88FFFFFF); 87 | } 88 | 89 | public SplitPaneLayout(Context context, AttributeSet attrs) { 90 | super(context, attrs); 91 | extractAttributes(context, attrs); 92 | setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); 93 | setFocusable(true); 94 | setFocusableInTouchMode(false); 95 | } 96 | 97 | public SplitPaneLayout(Context context, AttributeSet attrs, int defStyle) { 98 | super(context, attrs, defStyle); 99 | extractAttributes(context, attrs); 100 | setDescendantFocusability(FOCUS_AFTER_DESCENDANTS); 101 | setFocusable(true); 102 | setFocusableInTouchMode(false); 103 | } 104 | 105 | private void extractAttributes(Context context, AttributeSet attrs) { 106 | if (attrs != null) { 107 | TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SplitPaneLayout); 108 | mOrientation = a.getInt(R.styleable.SplitPaneLayout_orientation, 0); 109 | mSplitterSize = a.getDimensionPixelSize(R.styleable.SplitPaneLayout_splitterSize, context.getResources().getDimensionPixelSize(R.dimen.spl_default_splitter_size)); 110 | mSplitterMovable = a.getBoolean(R.styleable.SplitPaneLayout_splitterMovable, true); 111 | TypedValue value = a.peekValue(R.styleable.SplitPaneLayout_splitterPosition); 112 | if (value != null) { 113 | if (value.type == TypedValue.TYPE_DIMENSION) { 114 | mSplitterPosition = a.getDimensionPixelSize(R.styleable.SplitPaneLayout_splitterPosition, Integer.MIN_VALUE); 115 | } else if (value.type == TypedValue.TYPE_FRACTION) { 116 | mSplitterPositionPercent = a.getFraction(R.styleable.SplitPaneLayout_splitterPosition, 100, 100, 50) * 0.01f; 117 | } 118 | } else { 119 | mSplitterPosition = Integer.MIN_VALUE; 120 | mSplitterPositionPercent = 0.5f; 121 | } 122 | 123 | value = a.peekValue(R.styleable.SplitPaneLayout_splitterBackground); 124 | if (value != null) { 125 | if (value.type == TypedValue.TYPE_REFERENCE || 126 | value.type == TypedValue.TYPE_STRING) { 127 | mSplitterDrawable = a.getDrawable(R.styleable.SplitPaneLayout_splitterBackground); 128 | } else if (value.type == TypedValue.TYPE_INT_COLOR_ARGB8 || 129 | value.type == TypedValue.TYPE_INT_COLOR_ARGB4 || 130 | value.type == TypedValue.TYPE_INT_COLOR_RGB8 || 131 | value.type == TypedValue.TYPE_INT_COLOR_RGB4) { 132 | mSplitterDrawable = new PaintDrawable(a.getColor(R.styleable.SplitPaneLayout_splitterBackground, 0xFF000000)); 133 | } 134 | } 135 | value = a.peekValue(R.styleable.SplitPaneLayout_splitterDraggingBackground); 136 | if (value != null) { 137 | if (value.type == TypedValue.TYPE_REFERENCE || 138 | value.type == TypedValue.TYPE_STRING) { 139 | mSplitterDraggingDrawable = a.getDrawable(R.styleable.SplitPaneLayout_splitterDraggingBackground); 140 | } else if (value.type == TypedValue.TYPE_INT_COLOR_ARGB8 || 141 | value.type == TypedValue.TYPE_INT_COLOR_ARGB4 || 142 | value.type == TypedValue.TYPE_INT_COLOR_RGB8 || 143 | value.type == TypedValue.TYPE_INT_COLOR_RGB4) { 144 | mSplitterDraggingDrawable = new PaintDrawable(a.getColor(R.styleable.SplitPaneLayout_splitterDraggingBackground, 0x88FFFFFF)); 145 | } 146 | } else { 147 | mSplitterDraggingDrawable = new PaintDrawable(0x88FFFFFF); 148 | } 149 | mSplitterTouchSlop = a.getDimensionPixelSize(R.styleable.SplitPaneLayout_splitterTouchSlop, ViewConfiguration.get(context).getScaledTouchSlop()); 150 | mPaneSizeMin = a.getDimensionPixelSize(R.styleable.SplitPaneLayout_paneSizeMin, 0); 151 | a.recycle(); 152 | } 153 | } 154 | 155 | private void computeSplitterPosition() { 156 | 157 | int measuredWidth = getMeasuredWidth(); 158 | int measuredHeight = getMeasuredHeight(); 159 | 160 | if (measuredWidth > 0 && measuredHeight > 0) { 161 | switch (mOrientation) { 162 | case ORIENTATION_HORIZONTAL: { 163 | if (mSplitterPosition == Integer.MIN_VALUE && mSplitterPositionPercent < 0) { 164 | mSplitterPosition = measuredWidth / 2; 165 | } else if (mSplitterPosition == Integer.MIN_VALUE && mSplitterPositionPercent >= 0) { 166 | mSplitterPosition = (int) (measuredWidth * mSplitterPositionPercent); 167 | if (!between(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition())) { 168 | mSplitterPosition = clamp(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition()); 169 | mSplitterPositionPercent = (float) mSplitterPosition / (float) measuredWidth; 170 | } 171 | } else if (mSplitterPosition != Integer.MIN_VALUE && mSplitterPositionPercent < 0) { 172 | if (!between(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition())) { 173 | mSplitterPosition = clamp(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition()); 174 | } 175 | mSplitterPositionPercent = (float) mSplitterPosition / (float) measuredWidth; 176 | } 177 | mSplitterBounds.set(mSplitterPosition - (mSplitterSize / 2), 0, mSplitterPosition + (mSplitterSize / 2), measuredHeight); 178 | mSplitterTouchBounds.set(mSplitterBounds.left - mSplitterTouchSlop, mSplitterBounds.top, mSplitterBounds.right + mSplitterTouchSlop, mSplitterBounds.bottom); 179 | break; 180 | } 181 | case ORIENTATION_VERTICAL: { 182 | if (mSplitterPosition == Integer.MIN_VALUE && mSplitterPositionPercent < 0) { 183 | mSplitterPosition = measuredHeight / 2; 184 | } else if (mSplitterPosition == Integer.MIN_VALUE && mSplitterPositionPercent >= 0) { 185 | mSplitterPosition = (int) (measuredHeight * mSplitterPositionPercent); 186 | if (!between(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition())) { 187 | mSplitterPosition = clamp(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition()); 188 | mSplitterPositionPercent = (float) mSplitterPosition / (float) measuredHeight; 189 | } 190 | } else if (mSplitterPosition != Integer.MIN_VALUE && mSplitterPositionPercent < 0) { 191 | if (!between(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition())) { 192 | mSplitterPosition = clamp(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition()); 193 | } 194 | mSplitterPositionPercent = (float) mSplitterPosition / (float) measuredHeight; 195 | } 196 | mSplitterBounds.set(0, mSplitterPosition - (mSplitterSize / 2), measuredWidth, mSplitterPosition + (mSplitterSize / 2)); 197 | mSplitterTouchBounds.set(mSplitterBounds.left, mSplitterBounds.top - mSplitterTouchSlop / 2, mSplitterBounds.right, mSplitterBounds.bottom + mSplitterTouchSlop / 2); 198 | break; 199 | } 200 | } 201 | } 202 | 203 | } 204 | 205 | @Override 206 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 207 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 208 | 209 | int measuredWidth = getMeasuredWidth(); 210 | int measuredHeight = getMeasuredHeight(); 211 | 212 | check(); 213 | 214 | if (measuredWidth > 0 && measuredHeight > 0) { 215 | 216 | computeSplitterPosition(); 217 | 218 | switch (mOrientation) { 219 | case ORIENTATION_HORIZONTAL: { 220 | getChildAt(0).measure(MeasureSpec.makeMeasureSpec(mSplitterPosition - (mSplitterSize / 2), MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY)); 221 | getChildAt(1).measure(MeasureSpec.makeMeasureSpec(measuredWidth - (mSplitterSize / 2) - mSplitterPosition, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(measuredHeight, MeasureSpec.EXACTLY)); 222 | break; 223 | } 224 | case ORIENTATION_VERTICAL: { 225 | getChildAt(0).measure(MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(mSplitterPosition - (mSplitterSize / 2), MeasureSpec.EXACTLY)); 226 | getChildAt(1).measure(MeasureSpec.makeMeasureSpec(measuredWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(measuredHeight - (mSplitterSize / 2) - mSplitterPosition, MeasureSpec.EXACTLY)); 227 | break; 228 | } 229 | } 230 | 231 | isMeasured = true; 232 | } 233 | } 234 | 235 | @Override 236 | protected void onLayout(boolean changed, int l, int t, int r, int b) { 237 | int w = r - l; 238 | int h = b - t; 239 | switch (mOrientation) { 240 | case ORIENTATION_HORIZONTAL: { 241 | getChildAt(0).layout(0, 0, mSplitterPosition - (mSplitterSize / 2), h); 242 | getChildAt(1).layout(mSplitterPosition + (mSplitterSize / 2), 0, r, h); 243 | break; 244 | } 245 | case ORIENTATION_VERTICAL: { 246 | getChildAt(0).layout(0, 0, w, mSplitterPosition - (mSplitterSize / 2)); 247 | getChildAt(1).layout(0, mSplitterPosition + (mSplitterSize / 2), w, h); 248 | break; 249 | } 250 | } 251 | } 252 | 253 | @Override 254 | public boolean onKeyDown(int keyCode, KeyEvent event) { 255 | boolean remeasure = false; 256 | int offset = mSplitterSize; 257 | if (event.isShiftPressed()) { 258 | offset *= 5; 259 | } 260 | switch (mOrientation) { 261 | case ORIENTATION_HORIZONTAL: 262 | if (keyCode == KeyEvent.KEYCODE_DPAD_LEFT) { 263 | mSplitterPosition = clamp(mSplitterPosition - offset, getMinSplitterPosition(), getMaxSplitterPosition()); 264 | mSplitterPositionPercent = -1; 265 | remeasure = true; 266 | } else if (keyCode == KeyEvent.KEYCODE_DPAD_RIGHT) { 267 | mSplitterPosition = clamp(mSplitterPosition + offset, getMinSplitterPosition(), getMaxSplitterPosition()); 268 | mSplitterPositionPercent = -1; 269 | remeasure = true; 270 | } 271 | break; 272 | case ORIENTATION_VERTICAL: 273 | if (keyCode == KeyEvent.KEYCODE_DPAD_UP) { 274 | mSplitterPosition = clamp(mSplitterPosition - offset, getMinSplitterPosition(), getMaxSplitterPosition()); 275 | mSplitterPositionPercent = -1; 276 | remeasure = true; 277 | } else if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) { 278 | mSplitterPosition = clamp(mSplitterPosition + offset, getMinSplitterPosition(), getMaxSplitterPosition()); 279 | mSplitterPositionPercent = -1; 280 | remeasure = true; 281 | } 282 | break; 283 | } 284 | if (remeasure) { 285 | remeasure(); 286 | notifySplitterPositionChanged(true); 287 | return true; 288 | } 289 | return super.onKeyDown(keyCode, event); 290 | } 291 | 292 | @Override 293 | public boolean onTouchEvent(MotionEvent event) { 294 | if (mSplitterMovable) { 295 | int x = (int) event.getX(); 296 | int y = (int) event.getY(); 297 | 298 | switch (event.getAction()) { 299 | case MotionEvent.ACTION_DOWN: 300 | handleTouchDown(x, y); 301 | break; 302 | case MotionEvent.ACTION_MOVE: 303 | handleTouchMove(x, y); 304 | break; 305 | case MotionEvent.ACTION_UP: 306 | handleTouchUp(x, y); 307 | break; 308 | } 309 | return true; 310 | } 311 | return false; 312 | } 313 | 314 | private void handleTouchDown(int x, int y) { 315 | if (mSplitterTouchBounds.contains(x, y)) { 316 | performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY); 317 | isDragging = true; 318 | mSplitterDraggingBounds.set(mSplitterBounds); 319 | invalidate(mSplitterDraggingBounds); 320 | lastTouchX = x; 321 | lastTouchY = y; 322 | } 323 | } 324 | 325 | private void handleTouchMove(int x, int y) { 326 | if (isDragging) { 327 | if (!isMovingSplitter) { 328 | // Verify we've moved far enough to leave the touch bounds before moving the splitter 329 | if (mSplitterTouchBounds.contains(x, y)) { 330 | return; 331 | } else { 332 | isMovingSplitter = true; 333 | } 334 | } 335 | boolean take = true; 336 | switch (mOrientation) { 337 | case ORIENTATION_HORIZONTAL: { 338 | mSplitterDraggingBounds.offset(x - lastTouchX, 0); 339 | if (mSplitterDraggingBounds.centerX() < getMinSplitterPosition()) { 340 | take = false; 341 | mSplitterDraggingBounds.offset(getMinSplitterPosition() - mSplitterDraggingBounds.centerX(), 0); 342 | } 343 | if (mSplitterDraggingBounds.centerX() > getMaxSplitterPosition()) { 344 | take = false; 345 | mSplitterDraggingBounds.offset(getMaxSplitterPosition() - mSplitterDraggingBounds.centerX(), 0); 346 | } 347 | break; 348 | } 349 | case ORIENTATION_VERTICAL: { 350 | mSplitterDraggingBounds.offset(0, y - lastTouchY); 351 | if (mSplitterDraggingBounds.centerY() < getMinSplitterPosition()) { 352 | take = false; 353 | mSplitterDraggingBounds.offset(0, getMinSplitterPosition() - mSplitterDraggingBounds.centerY()); 354 | } 355 | if (mSplitterDraggingBounds.centerY() > getMaxSplitterPosition()) { 356 | take = false; 357 | mSplitterDraggingBounds.offset(0, getMaxSplitterPosition() - mSplitterDraggingBounds.centerY()); 358 | } 359 | break; 360 | } 361 | } 362 | if (take) { 363 | lastTouchX = x; 364 | lastTouchY = y; 365 | } 366 | invalidate(); 367 | } 368 | } 369 | 370 | private void handleTouchUp(int x, int y) { 371 | if (isDragging) { 372 | isDragging = false; 373 | isMovingSplitter = false; 374 | switch (mOrientation) { 375 | case ORIENTATION_HORIZONTAL: { 376 | mSplitterPosition = clamp(x, getMinSplitterPosition(), getMaxSplitterPosition()); 377 | mSplitterPositionPercent = -1; 378 | break; 379 | } 380 | case ORIENTATION_VERTICAL: { 381 | mSplitterPosition = clamp(y, getMinSplitterPosition(), getMaxSplitterPosition()); 382 | mSplitterPositionPercent = -1; 383 | break; 384 | } 385 | } 386 | remeasure(); 387 | notifySplitterPositionChanged(true); 388 | } 389 | } 390 | 391 | private int getMinSplitterPosition() { 392 | return mPaneSizeMin; 393 | } 394 | 395 | private int getMaxSplitterPosition() { 396 | switch (mOrientation) { 397 | case ORIENTATION_HORIZONTAL: 398 | return getMeasuredWidth() - mPaneSizeMin; 399 | case ORIENTATION_VERTICAL: 400 | return getMeasuredHeight() - mPaneSizeMin; 401 | } 402 | return 0; 403 | } 404 | 405 | @Override 406 | public Parcelable onSaveInstanceState() { 407 | Parcelable superState = super.onSaveInstanceState(); 408 | SavedState ss = new SavedState(superState); 409 | ss.mSplitterPositionPercent = mSplitterPositionPercent; 410 | return ss; 411 | } 412 | 413 | @Override 414 | public void onRestoreInstanceState(Parcelable state) { 415 | if (!(state instanceof SavedState)) { 416 | super.onRestoreInstanceState(state); 417 | return; 418 | } 419 | SavedState ss = (SavedState) state; 420 | super.onRestoreInstanceState(ss.getSuperState()); 421 | setSplitterPositionPercent(ss.mSplitterPositionPercent); 422 | } 423 | 424 | /** 425 | * Convenience for calling own measure method. 426 | */ 427 | private void remeasure() { 428 | // TODO: Performance: Guard against calling too often, can it be done without requestLayout? 429 | forceLayout(); 430 | measure(MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.EXACTLY), 431 | MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.EXACTLY) 432 | ); 433 | requestLayout(); 434 | } 435 | 436 | /** 437 | * Checks that we have exactly two children. 438 | */ 439 | private void check() { 440 | if (getChildCount() != 2) { 441 | throw new RuntimeException("SplitPaneLayout must have exactly two child views."); 442 | } 443 | } 444 | 445 | private void enforcePaneSizeMin() { 446 | 447 | } 448 | 449 | @Override 450 | protected void dispatchDraw(Canvas canvas) { 451 | super.dispatchDraw(canvas); 452 | if (mSplitterDrawable != null) { 453 | mSplitterDrawable.setState(getDrawableState()); 454 | mSplitterDrawable.setBounds(mSplitterBounds); 455 | mSplitterDrawable.draw(canvas); 456 | } 457 | if (isDragging) { 458 | mSplitterDraggingDrawable.setState(getDrawableState()); 459 | mSplitterDraggingDrawable.setBounds(mSplitterDraggingBounds); 460 | mSplitterDraggingDrawable.draw(canvas); 461 | } 462 | } 463 | 464 | /** 465 | * Gets the current drawable used for the splitter. 466 | * 467 | * @return the drawable used for the splitter 468 | */ 469 | public Drawable getSplitterDrawable() { 470 | return mSplitterDrawable; 471 | } 472 | 473 | /** 474 | * Sets the drawable used for the splitter. 475 | * 476 | * @param splitterDrawable the desired orientation of the layout 477 | */ 478 | public void setSplitterDrawable(Drawable splitterDrawable) { 479 | mSplitterDrawable = splitterDrawable; 480 | if (getChildCount() == 2) { 481 | remeasure(); 482 | } 483 | } 484 | 485 | /** 486 | * Gets the current drawable used for the splitter dragging overlay. 487 | * 488 | * @return the drawable used for the splitter 489 | */ 490 | public Drawable getSplitterDraggingDrawable() { 491 | return mSplitterDraggingDrawable; 492 | } 493 | 494 | /** 495 | * Sets the drawable used for the splitter dragging overlay. 496 | * 497 | * @param splitterDraggingDrawable the drawable to use while dragging the splitter 498 | */ 499 | public void setSplitterDraggingDrawable(Drawable splitterDraggingDrawable) { 500 | mSplitterDraggingDrawable = splitterDraggingDrawable; 501 | if (isDragging) { 502 | invalidate(); 503 | } 504 | } 505 | 506 | /** 507 | * Gets the current orientation of the layout. 508 | * 509 | * @return the orientation of the layout 510 | */ 511 | public int getOrientation() { 512 | return mOrientation; 513 | } 514 | 515 | /** 516 | * Sets the orientation of the layout. 517 | * 518 | * @param orientation the desired orientation of the layout 519 | */ 520 | public void setOrientation(int orientation) { 521 | if (mOrientation != orientation) { 522 | mOrientation = orientation; 523 | if (getChildCount() == 2) { 524 | remeasure(); 525 | } 526 | } 527 | } 528 | 529 | /** 530 | * Gets the current size of the splitter in pixels. 531 | * 532 | * @return the size of the splitter 533 | */ 534 | public int getSplitterSize() { 535 | return mSplitterSize; 536 | } 537 | 538 | /** 539 | * Sets the current size of the splitter in pixels. 540 | * 541 | * @param splitterSize the desired size of the splitter 542 | */ 543 | public void setSplitterSize(int splitterSize) { 544 | mSplitterSize = splitterSize; 545 | if (getChildCount() == 2) { 546 | remeasure(); 547 | } 548 | } 549 | 550 | /** 551 | * Gets whether the splitter is movable by the user. 552 | * 553 | * @return whether the splitter is movable 554 | */ 555 | public boolean isSplitterMovable() { 556 | return mSplitterMovable; 557 | } 558 | 559 | /** 560 | * Sets whether the splitter is movable by the user. 561 | * 562 | * @param splitterMovable whether the splitter is movable 563 | */ 564 | public void setSplitterMovable(boolean splitterMovable) { 565 | mSplitterMovable = splitterMovable; 566 | } 567 | 568 | /** 569 | * Gets the current position of the splitter in pixels. 570 | * 571 | * @return the position of the splitter 572 | */ 573 | public int getSplitterPosition() { 574 | return mSplitterPosition; 575 | } 576 | 577 | /** 578 | * Sets the current position of the splitter in pixels. 579 | * 580 | * @param position the desired position of the splitter 581 | */ 582 | public void setSplitterPosition(int position) { 583 | mSplitterPosition = clamp(position, 0, Integer.MAX_VALUE); 584 | mSplitterPositionPercent = -1; 585 | remeasure(); 586 | notifySplitterPositionChanged(false); 587 | } 588 | 589 | /** 590 | * Gets the current position of the splitter as a percent. 591 | * 592 | * @return the position of the splitter 593 | */ 594 | public float getSplitterPositionPercent() { 595 | return mSplitterPositionPercent; 596 | } 597 | 598 | /** 599 | * Sets the current position of the splitter as a percentage of the layout. 600 | * 601 | * @param position the desired position of the splitter 602 | */ 603 | public void setSplitterPositionPercent(float position) { 604 | mSplitterPosition = Integer.MIN_VALUE; 605 | mSplitterPositionPercent = clamp(position, 0, 1); 606 | remeasure(); 607 | notifySplitterPositionChanged(false); 608 | } 609 | 610 | /** 611 | * Gets the current "touch slop" which is used to extends the grab size of the splitter 612 | * and requires the splitter to be dragged at least this far to be considered a move. 613 | * 614 | * @return the current "touch slop" of the splitter 615 | */ 616 | public int getSplitterTouchSlop() { 617 | return mSplitterTouchSlop; 618 | } 619 | 620 | /** 621 | * Sets the current "touch slop" which is used to extends the grab size of the splitter 622 | * and requires the splitter to be dragged at least this far to be considered a move. 623 | * 624 | * @param splitterTouchSlop the desired "touch slop" of the splitter 625 | */ 626 | public void setSplitterTouchSlop(int splitterTouchSlop) { 627 | this.mSplitterTouchSlop = splitterTouchSlop; 628 | computeSplitterPosition(); 629 | } 630 | 631 | /** 632 | * Gets the minimum size of panes, in pixels. 633 | * 634 | * @return the minimum size of panes, in pixels. 635 | */ 636 | public int getPaneSizeMin() { 637 | return mPaneSizeMin; 638 | } 639 | 640 | /** 641 | * Sets the minimum size of panes, in pixels. 642 | * 643 | * @param paneSizeMin the minimum size of panes, in pixels 644 | */ 645 | public void setPaneSizeMin(int paneSizeMin) { 646 | mPaneSizeMin = paneSizeMin; 647 | if (isMeasured) { 648 | int newSplitterPosition = clamp(mSplitterPosition, getMinSplitterPosition(), getMaxSplitterPosition()); 649 | if(newSplitterPosition != mSplitterPosition) { 650 | setSplitterPosition(newSplitterPosition); 651 | } 652 | } 653 | } 654 | 655 | /** 656 | * Gets the OnSplitterPositionChangedListener to receive callbacks when the splitter position is changed 657 | * 658 | * @return the OnSplitterPositionChangedListener to receive callbacks when the splitter position is changed 659 | */ 660 | public OnSplitterPositionChangedListener getOnSplitterPositionChangedListener() { 661 | return mOnSplitterPositionChangedListener; 662 | } 663 | 664 | /** 665 | * Sets the OnSplitterPositionChangedListener to receive callbacks when the splitter position is changed 666 | * 667 | * @param l the OnSplitterPositionChangedListener to receive callbacks when the splitter position is changed 668 | */ 669 | public void setOnSplitterPositionChangedListener(OnSplitterPositionChangedListener l) { 670 | this.mOnSplitterPositionChangedListener = l; 671 | } 672 | 673 | private void notifySplitterPositionChanged(boolean fromUser) { 674 | if (mOnSplitterPositionChangedListener != null) { 675 | Log.d("SPL", "Splitter Position Changed"); 676 | mOnSplitterPositionChangedListener.onSplitterPositionChanged(this, fromUser); 677 | } 678 | } 679 | 680 | private static float clamp(float value, float min, float max) { 681 | if (value < min) { 682 | return min; 683 | } else if (value > max) { 684 | return max; 685 | } 686 | return value; 687 | } 688 | 689 | private static int clamp(int value, int min, int max) { 690 | if (value < min) { 691 | return min; 692 | } else if (value > max) { 693 | return max; 694 | } 695 | return value; 696 | } 697 | 698 | private static boolean between(int value, int min, int max) { 699 | return min <= value && value <= max; 700 | } 701 | 702 | /** 703 | * Holds important values when we need to save instance state. 704 | */ 705 | public static class SavedState extends BaseSavedState { 706 | public static final Creator CREATOR = new Creator() { 707 | 708 | public SavedState createFromParcel(Parcel in) { 709 | return new SavedState(in); 710 | } 711 | 712 | public SavedState[] newArray(int size) { 713 | return new SavedState[size]; 714 | } 715 | 716 | }; 717 | 718 | float mSplitterPositionPercent; 719 | 720 | SavedState(Parcelable superState) { 721 | super(superState); 722 | } 723 | 724 | private SavedState(Parcel in) { 725 | super(in); 726 | mSplitterPositionPercent = in.readFloat(); 727 | } 728 | 729 | @Override 730 | public void writeToParcel(Parcel out, int flags) { 731 | super.writeToParcel(out, flags); 732 | out.writeFloat(mSplitterPositionPercent); 733 | } 734 | } 735 | 736 | } -------------------------------------------------------------------------------- /split-pane-layout/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /split-pane-layout/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 8dp 3 | --------------------------------------------------------------------------------