├── .gitignore ├── .idea └── copyright │ ├── ArcToolbarView_MIT_License.xml │ └── profiles_settings.xml ├── LICENSE.md ├── README.md ├── arctoolbarview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── massivedisaster │ │ └── widget │ │ ├── ArcToolbarView.kt │ │ └── extensions │ │ └── AppBarLayoutExtensions.kt │ └── res │ └── values │ └── attrs_arctoolbarview.xml ├── art └── sample.gif ├── build.gradle ├── deploy ├── configuration.json └── updateReadme.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── sample ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── massivedisaster │ │ └── sample │ │ ├── ArcToolbarViewActivity.kt │ │ └── MainActivity.kt │ └── res │ ├── drawable-v24 │ └── ic_launcher_foreground.xml │ ├── drawable │ └── ic_launcher_background.xml │ ├── layout │ ├── activity_arc_toolbar_view.xml │ ├── activity_main.xml │ └── content_arc_toolbar_view.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 │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/android,java,macos 3 | 4 | ### Android ### 5 | # Built application files 6 | *.apk 7 | *.ap_ 8 | 9 | # Files for the ART/Dalvik VM 10 | *.dex 11 | 12 | # Java class files 13 | *.class 14 | 15 | # Generated files 16 | bin/ 17 | gen/ 18 | out/ 19 | 20 | # Gradle files 21 | .gradle/ 22 | build/ 23 | 24 | # Local configuration file (sdk path, etc) 25 | local.properties 26 | 27 | # Proguard folder generated by Eclipse 28 | proguard/ 29 | 30 | # Log Files 31 | *.log 32 | 33 | # Android Studio Navigation editor temp files 34 | .navigation/ 35 | 36 | # Android Studio captures folder 37 | captures/ 38 | 39 | # Intellij 40 | *.iml 41 | 42 | ## Directory-based project format: 43 | .idea/* 44 | 45 | # Track copyright configuration 46 | !.idea/copyright 47 | .idea/copyright/* 48 | !.idea/copyright/ArcToolbarView_MIT_License.xml 49 | !.idea/copyright/profiles_settings.xml 50 | 51 | # Keystore files 52 | *.jks 53 | 54 | ### Android Patch ### 55 | gen-external-apklibs 56 | 57 | 58 | ### macOS ### 59 | *.DS_Store 60 | .AppleDouble 61 | .LSOverride 62 | 63 | # Icon must end with two \r 64 | Icon 65 | 66 | 67 | # Thumbnails 68 | ._* 69 | 70 | # Files that might appear in the root of a volume 71 | .DocumentRevisions-V100 72 | .fseventsd 73 | .Spotlight-V100 74 | .TemporaryItems 75 | .Trashes 76 | .VolumeIcon.icns 77 | .com.apple.timemachine.donotpresent 78 | 79 | # Directories potentially created on remote AFP share 80 | .AppleDB 81 | .AppleDesktop 82 | Network Trash Folder 83 | Temporary Items 84 | .apdisk 85 | 86 | 87 | ### Java ### 88 | *.class 89 | 90 | # Mobile Tools for Java (J2ME) 91 | .mtj.tmp/ 92 | 93 | # Package Files # 94 | *.jar 95 | *.war 96 | *.ear 97 | 98 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 99 | hs_err_pid* 100 | 101 | # Allow anything in the gradle wrapper folder 102 | !gradle/wrapper/* 103 | !gradle/wrapper/gradle-wrapper.jar 104 | !gradle/wrapper/gradle-wrapper.properties 105 | -------------------------------------------------------------------------------- /.idea/copyright/ArcToolbarView_MIT_License.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | ===================== 3 | 4 | Copyright © `2017` `copyright massivedisaster` 5 | 6 | Permission is hereby granted, free of charge, to any person 7 | obtaining a copy of this software and associated documentation 8 | files (the “Software”), to deal in the Software without 9 | restriction, including without limitation the rights to use, 10 | copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the 12 | Software is furnished to do so, subject to the following 13 | conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 21 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 22 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 23 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 24 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 25 | OTHER DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ArcToolbarView 2 | [![API](https://img.shields.io/badge/API-19%2B-green.svg?style=flat)](https://android-arsenal.com/api?level=19) 3 | [ ![Download](https://api.bintray.com/packages/massivedisaster/widget/arctoolbarview/images/download.svg) ](https://bintray.com/massivedisaster/widget/arctoolbarview/_latestVersion) 4 | [![Android Arsenal]( https://img.shields.io/badge/Android%20Arsenal-ArcToolbarView-green.svg?style=flat )]( https://android-arsenal.com/details/1/6772 ) 5 | 6 | An Arc view for the android Toolbar or anywhere. 7 | 8 |
9 | 10 |
11 | 12 | ### Download 13 | 14 | Gradle: 15 | 16 | ```gradle 17 | dependencies { 18 | implementation 'com.massivedisaster.widget:arctoolbarview:0.0.1' 19 | } 20 | ``` 21 | 22 | ### Usage 23 | 24 | 1. Declare your `Toolbar` with `ArcToolbarView`. 25 | 26 | ```xml 27 | 34 | 35 | 39 | 40 | 49 | 50 | 55 | 56 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | ``` 70 | 71 | 2. Set the `AppBarLayout` to `ArcToolbarView`. 72 | 73 | ```java 74 | class ArcToolbarViewActivity : AppCompatActivity() { 75 | override fun onCreate(savedInstanceState: Bundle?) { 76 | super.onCreate(savedInstanceState) 77 | setContentView(R.layout.activity_arc_toolbar_view) 78 | setSupportActionBar(toolbar) 79 | arcToolbar.setAppBarLayout(appbar) 80 | } 81 | } 82 | ``` 83 | 84 | ### License 85 | [MIT LICENSE](LICENSE.md) -------------------------------------------------------------------------------- /arctoolbarview/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /arctoolbarview/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | apply plugin: 'com.android.library' 27 | apply plugin: 'com.novoda.bintray-release' 28 | 29 | android { 30 | compileSdkVersion project.targetSdkVersion.toInteger() 31 | buildToolsVersion project.buildToolsVersion 32 | 33 | 34 | defaultConfig { 35 | minSdkVersion project.minSdkVersion.toInteger() 36 | targetSdkVersion project.targetSdkVersion.toInteger() 37 | versionCode libraryVersionCode 38 | versionName libraryVersionName 39 | } 40 | } 41 | 42 | dependencies { 43 | implementation "com.android.support:appcompat-v7:$project.supportVersion" 44 | implementation "com.android.support:design:$project.supportVersion" 45 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$project.kotlinVersion" 46 | } 47 | 48 | publish { 49 | userOrg = userOrgBase 50 | groupId = moduleBase 51 | artifactId = 'arctoolbarview' 52 | repoName = repoNameBase 53 | publishVersion = libraryVersionString() 54 | desc = 'An Arc view for the android Toolbar.' 55 | website = websiteBase 56 | licences = licensesBase 57 | } 58 | 59 | apply plugin: 'kotlin-android' 60 | apply plugin: 'kotlin-android-extensions' -------------------------------------------------------------------------------- /arctoolbarview/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 | -------------------------------------------------------------------------------- /arctoolbarview/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 28 | -------------------------------------------------------------------------------- /arctoolbarview/src/main/java/com/massivedisaster/widget/ArcToolbarView.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.widget 27 | 28 | import android.content.Context 29 | import android.graphics.Canvas 30 | import android.graphics.Color 31 | import android.graphics.Paint 32 | import android.graphics.RectF 33 | import android.util.AttributeSet 34 | import android.util.TypedValue 35 | import android.widget.FrameLayout 36 | import com.massivedisaster.widget.arctoolbarview.R 37 | 38 | class ArcToolbarView(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : FrameLayout(context, attrs, defStyleAttr) { 39 | 40 | constructor(context: Context) : this(context, null) 41 | constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0) 42 | 43 | private var arcHeight: Float = 0.0f 44 | private var extendOverBoundary: Float = 0.0f 45 | private var scale: Float = 1.0f 46 | private var arcPaint: Paint = Paint(Paint.ANTI_ALIAS_FLAG) 47 | private var arcRect: RectF = RectF() 48 | 49 | init { 50 | arcPaint = Paint(Paint.ANTI_ALIAS_FLAG) 51 | arcPaint.style = Paint.Style.FILL 52 | 53 | parseAttributes(attrs) 54 | } 55 | 56 | private fun getWindowBackgroundColorOrDefault(defaultColor: Int): Int { 57 | val a = TypedValue() 58 | context.theme.resolveAttribute(android.R.attr.windowBackground, a, true) 59 | if (a.type >= TypedValue.TYPE_FIRST_COLOR_INT && a.type <= TypedValue.TYPE_LAST_COLOR_INT) { 60 | return a.data 61 | } 62 | return defaultColor 63 | } 64 | 65 | private fun parseAttributes(attrs: AttributeSet?) { 66 | if (attrs != null) { 67 | val a = context.obtainStyledAttributes(attrs, R.styleable.ArcToolbarView) 68 | arcHeight = a.getDimension(R.styleable.ArcToolbarView_arcHeight, 60f) 69 | extendOverBoundary = a.getDimension(R.styleable.ArcToolbarView_arcBoundary, 60f) 70 | arcPaint.color = a.getColor(R.styleable.ArcToolbarView_arcColor, getWindowBackgroundColorOrDefault(Color.TRANSPARENT)) 71 | 72 | a.recycle() 73 | } 74 | } 75 | 76 | override fun onDraw(canvas: Canvas) { 77 | super.onDraw(canvas) 78 | 79 | arcRect.set(-extendOverBoundary, 80 | height - arcHeight * scale, 81 | width + extendOverBoundary, 82 | height + arcHeight * scale) 83 | 84 | canvas.drawOval(arcRect, arcPaint) 85 | } 86 | 87 | fun setScale(n: Float) { 88 | var scale = n 89 | if (n < 0) scale = 0.0f 90 | this.scale = scale 91 | 92 | invalidate() 93 | } 94 | 95 | fun setArcColor(color: Int) { 96 | arcPaint.color = color 97 | invalidate() 98 | } 99 | } -------------------------------------------------------------------------------- /arctoolbarview/src/main/java/com/massivedisaster/widget/extensions/AppBarLayoutExtensions.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.widget.extensions 27 | 28 | import android.support.design.widget.AppBarLayout 29 | import com.massivedisaster.widget.ArcToolbarView 30 | 31 | fun ArcToolbarView.setAppBarLayout(appbar: AppBarLayout) { 32 | appbar.addOnOffsetChangedListener(object : AppBarLayout.OnOffsetChangedListener { 33 | internal var scrollRange = -1f 34 | 35 | override fun onOffsetChanged(appBarLayout: AppBarLayout, verticalOffset: Int) { 36 | if (scrollRange == -1f) { 37 | scrollRange = appBarLayout.totalScrollRange.toFloat() 38 | } 39 | 40 | val scale = 1 + verticalOffset / scrollRange 41 | 42 | this@setAppBarLayout.setScale(scale) 43 | } 44 | }) 45 | } 46 | 47 | -------------------------------------------------------------------------------- /arctoolbarview/src/main/res/values/attrs_arctoolbarview.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /art/sample.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/art/sample.gif -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 27 | 28 | apply from: "$project.rootDir/deploy/updateReadme.gradle" 29 | 30 | ext { 31 | userOrgBase = 'massivedisaster' 32 | websiteBase = 'https://github.com/massivedisaster/ArcToolbarView' 33 | licensesBase = ['MIT'] 34 | packageBase = 'com.massivedisaster' 35 | moduleBase = packageBase + '.widget' 36 | repoNameBase = "widget" 37 | isLibrary = true 38 | libraryVersionCode = 1 39 | libraryVersionName = project.libraryVersionName 40 | librarySnaphotEnabled = false 41 | 42 | libraryVersionString = { 43 | return libraryVersionName + (librarySnaphotEnabled ? '-SNAPSHOT' : '') 44 | } 45 | } 46 | 47 | buildscript { 48 | repositories { 49 | google() 50 | jcenter() 51 | } 52 | dependencies { 53 | classpath 'com.android.tools.build:gradle:3.0.1' 54 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$project.kotlinVersion" 55 | classpath 'com.novoda:bintray-release:0.8.0' 56 | } 57 | } 58 | 59 | allprojects { 60 | repositories { 61 | google() 62 | jcenter() 63 | } 64 | 65 | tasks.withType(Javadoc) { 66 | excludes = ['**/*.kt'] 67 | } 68 | } 69 | 70 | task version { 71 | println "Current version: " + libraryVersionString() 72 | } 73 | 74 | task updateReadme() { 75 | doLast { 76 | processUpdateReadme file("$project.rootDir"), ".md", libraryVersionName 77 | } 78 | } 79 | 80 | task clean(type: Delete) { 81 | delete rootProject.buildDir 82 | } 83 | -------------------------------------------------------------------------------- /deploy/configuration.json: -------------------------------------------------------------------------------- 1 | { 2 | "basePath": "../", 3 | "version": "0.0.1", 4 | "extraTasks": [ 5 | "updateReadme" 6 | ], 7 | "modules": [ 8 | "arctoolbarview" 9 | ] 10 | } -------------------------------------------------------------------------------- /deploy/updateReadme.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | import java.nio.charset.Charset 27 | import java.nio.file.Files 28 | import java.nio.file.Paths 29 | 30 | /** 31 | * Reads a file as string. 32 | * 33 | * @param path path to the file. 34 | * @return the string with the file contents. 35 | * @throws IOException if file don’t exist. 36 | */ 37 | private static String readFileAsString(String path) throws IOException { 38 | byte[] encoded = Files.readAllBytes(Paths.get(path)); 39 | return new String(encoded, Charset.defaultCharset()); 40 | } 41 | 42 | /** 43 | * Replace every semantic version occurrence in specified file. 44 | * 45 | * @param newVersion version to replace. 46 | * @param fileName the file to search. 47 | * @throws IOException if file don’t exist. 48 | */ 49 | private static void replaceAllSemVerInFile(String newVersion, String fileName) throws IOException { 50 | String readme = readFileAsString(fileName); 51 | String readmeVersionReplaced = readme.replaceAll("(\\d+(\\.\\d+){2})(\\-[\\w\\d\\.\\-]*)?(\\+[\\w\\d\\.\\-]*)?", newVersion); 52 | 53 | PrintWriter output = new PrintWriter(fileName); 54 | output.print(readmeVersionReplaced); 55 | output.close(); 56 | } 57 | 58 | ext { 59 | processUpdateReadme = { File resDir, String extension, String libraryVersionName -> 60 | resDir.eachFileRecurse { file -> 61 | if (file.name.endsWith(extension)) { 62 | replaceAllSemVerInFile(libraryVersionName, file.absolutePath) 63 | } 64 | } 65 | } 66 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | # 4 | # Copyright (c) 2018 ArcToolbarView 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of this software and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be 15 | # included in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | # 25 | 26 | # Project-wide Gradle settings. 27 | 28 | # IDE (e.g. Android Studio) users: 29 | # Gradle settings configured through the IDE *will override* 30 | # any settings specified in this file. 31 | 32 | # For more details on how to configure your build environment visit 33 | # http://www.gradle.org/docs/current/userguide/build_environment.html 34 | 35 | # Specifies the JVM arguments used for the daemon process. 36 | # The setting is particularly useful for tweaking memory settings. 37 | org.gradle.jvmargs=-Xmx1536m 38 | 39 | # When configured, Gradle will run in incubating parallel mode. 40 | # This option should only be used with decoupled projects. More details, visit 41 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 42 | # org.gradle.parallel=true 43 | 44 | # General properties 45 | minSdkVersion=19 46 | targetSdkVersion=27 47 | buildToolsVersion=27.0.3 48 | 49 | # Dependencies versions 50 | supportVersion=27.0.2 51 | kotlinVersion=1.2.21 52 | 53 | # Library version 54 | libraryVersionName=0.0.0 55 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | # 4 | # Copyright (c) 2018 ArcToolbarView 5 | # 6 | # Permission is hereby granted, free of charge, to any person obtaining 7 | # a copy of this software and associated documentation files (the 8 | # "Software"), to deal in the Software without restriction, including 9 | # without limitation the rights to use, copy, modify, merge, publish, 10 | # distribute, sublicense, and/or sell copies of the Software, and to 11 | # permit persons to whom the Software is furnished to do so, subject to 12 | # the following conditions: 13 | # 14 | # The above copyright notice and this permission notice shall be 15 | # included in all copies or substantial portions of the Software. 16 | # 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | # 25 | 26 | #Tue Oct 24 21:14:15 BST 2017 27 | distributionBase=GRADLE_USER_HOME 28 | distributionPath=wrapper/dists 29 | zipStoreBase=GRADLE_USER_HOME 30 | zipStorePath=wrapper/dists 31 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip 32 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | apply plugin: 'com.android.application' 27 | apply plugin: 'kotlin-android' 28 | apply plugin: 'kotlin-android-extensions' 29 | 30 | android { 31 | compileSdkVersion project.targetSdkVersion.toInteger() 32 | buildToolsVersion project.buildToolsVersion 33 | 34 | 35 | defaultConfig { 36 | applicationId "com.massivedisaster.sample" 37 | minSdkVersion project.minSdkVersion.toInteger() 38 | targetSdkVersion project.targetSdkVersion.toInteger() 39 | versionCode libraryVersionCode 40 | versionName libraryVersionName 41 | } 42 | 43 | buildTypes { 44 | release { 45 | minifyEnabled false 46 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 47 | } 48 | } 49 | 50 | } 51 | 52 | dependencies { 53 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$project.kotlinVersion" 54 | implementation "com.android.support:appcompat-v7:$project.supportVersion" 55 | implementation "com.android.support:design:$project.supportVersion" 56 | implementation project(':arctoolbarview') 57 | } 58 | -------------------------------------------------------------------------------- /sample/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 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 29 | 30 | 37 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /sample/src/main/java/com/massivedisaster/sample/ArcToolbarViewActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.sample 27 | 28 | import android.content.Intent 29 | import android.os.Bundle 30 | import android.support.v7.app.AppCompatActivity 31 | import com.massivedisaster.widget.extensions.setAppBarLayout 32 | import kotlinx.android.synthetic.main.activity_arc_toolbar_view.* 33 | 34 | class ArcToolbarViewActivity : AppCompatActivity() { 35 | 36 | override fun onCreate(savedInstanceState: Bundle?) { 37 | super.onCreate(savedInstanceState) 38 | setContentView(R.layout.activity_arc_toolbar_view) 39 | setSupportActionBar(toolbar) 40 | fab.setOnClickListener { _ -> 41 | startActivity(Intent(this, MainActivity::class.java)) 42 | } 43 | 44 | arcToolbar.setAppBarLayout(appbar) 45 | } 46 | } 47 | 48 | -------------------------------------------------------------------------------- /sample/src/main/java/com/massivedisaster/sample/MainActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | package com.massivedisaster.sample 27 | 28 | import android.animation.ValueAnimator 29 | import android.os.Bundle 30 | import android.support.v7.app.AppCompatActivity 31 | import android.util.DisplayMetrics 32 | import android.view.animation.AccelerateInterpolator 33 | import kotlinx.android.synthetic.main.activity_main.* 34 | 35 | class MainActivity : AppCompatActivity() { 36 | 37 | private var animationDuration = 700L 38 | 39 | override fun onCreate(savedInstanceState: Bundle?) { 40 | super.onCreate(savedInstanceState) 41 | setContentView(R.layout.activity_main) 42 | 43 | var arcHeight = resources.getDimensionPixelSize(R.dimen.arc_height) 44 | val displayMetrics = DisplayMetrics() 45 | windowManager.defaultDisplay.getMetrics(displayMetrics) 46 | var halfScreenHeight = (displayMetrics.heightPixels / 2) - arcHeight 47 | 48 | val valueAnimator = ValueAnimator.ofInt(halfScreenHeight, arcHeight) 49 | 50 | valueAnimator.addUpdateListener { 51 | val value = it.animatedValue as Int 52 | val topArcParams = topArc.layoutParams 53 | val bottomArcParams = bottomArc.layoutParams 54 | 55 | topArcParams.height = value 56 | bottomArcParams.height = value 57 | 58 | topArc.layoutParams = topArcParams 59 | bottomArc.layoutParams = bottomArcParams 60 | } 61 | 62 | valueAnimator.interpolator = AccelerateInterpolator(0.5f) 63 | valueAnimator.duration = animationDuration 64 | 65 | valueAnimator.start() 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 32 | 37 | 38 | 44 | 47 | 50 | 51 | 52 | 53 | 59 | 60 | -------------------------------------------------------------------------------- /sample/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 32 | 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 | 175 | 180 | 185 | 190 | 195 | 196 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_arc_toolbar_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 34 | 35 | 39 | 40 | 49 | 50 | 55 | 56 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 32 | 33 | 39 | 40 | 47 | 48 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/content_arc_toolbar_view.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 35 | 36 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/massivedisaster/ArcToolbarView/9b1a59bbac71d0714acf1d7c906f3bd4c07b50e7/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 26 | 27 | 28 | #4e342e 29 | #3e2723 30 | #d84315 31 | 32 | -------------------------------------------------------------------------------- /sample/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 180dp 28 | 16dp 29 | 16dp 30 | 50dp 31 | 32 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | ArcToolbar Sample 28 | 29 | "Material is the metaphor.\n\n" 30 | 31 | "A material metaphor is the unifying theory of a rationalized space and a system of motion." 32 | "The material is grounded in tactile reality, inspired by the study of paper and ink, yet " 33 | "technologically advanced and open to imagination and magic.\n" 34 | "Surfaces and edges of the material provide visual cues that are grounded in reality. The " 35 | "use of familiar tactile attributes helps users quickly understand affordances. Yet the " 36 | "flexibility of the material creates new affordances that supercede those in the physical " 37 | "world, without breaking the rules of physics.\n" 38 | "The fundamentals of light, surface, and movement are key to conveying how objects move, " 39 | "interact, and exist in space and in relation to each other. Realistic lighting shows " 40 | "seams, divides space, and indicates moving parts.\n\n" 41 | 42 | "Bold, graphic, intentional.\n\n" 43 | 44 | "The foundational elements of print based design typography, grids, space, scale, color, " 45 | "and use of imagery guide visual treatments. These elements do far more than please the " 46 | "eye. They create hierarchy, meaning, and focus. Deliberate color choices, edge to edge " 47 | "imagery, large scale typography, and intentional white space create a bold and graphic " 48 | "interface that immerse the user in the experience.\n" 49 | "An emphasis on user actions makes core functionality immediately apparent and provides " 50 | "waypoints for the user.\n\n" 51 | 52 | "Motion provides meaning.\n\n" 53 | 54 | "Motion respects and reinforces the user as the prime mover. Primary user actions are " 55 | "inflection points that initiate motion, transforming the whole design.\n" 56 | "All action takes place in a single environment. Objects are presented to the user without " 57 | "breaking the continuity of experience even as they transform and reorganize.\n" 58 | "Motion is meaningful and appropriate, serving to focus attention and maintain continuity. " 59 | "Feedback is subtle yet clear. Transitions are efficient yet coherent.\n\n" 60 | 61 | "3D world.\n\n" 62 | 63 | "The material environment is a 3D space, which means all objects have x, y, and z " 64 | "dimensions. The z-axis is perpendicularly aligned to the plane of the display, with the " 65 | "positive z-axis extending towards the viewer. Every sheet of material occupies a single " 66 | "position along the z-axis and has a standard 1dp thickness.\n" 67 | "On the web, the z-axis is used for layering and not for perspective. The 3D world is " 68 | "emulated by manipulating the y-axis.\n\n" 69 | 70 | "Light and shadow.\n\n" 71 | 72 | "Within the material environment, virtual lights illuminate the scene. Key lights create " 73 | "directional shadows, while ambient light creates soft shadows from all angles.\n" 74 | "Shadows in the material environment are cast by these two light sources. In Android " 75 | "development, shadows occur when light sources are blocked by sheets of material at " 76 | "various positions along the z-axis. On the web, shadows are depicted by manipulating the " 77 | "y-axis only. The following example shows the card with a height of 6dp.\n\n" 78 | 79 | "Resting elevation.\n\n" 80 | 81 | "All material objects, regardless of size, have a resting elevation, or default elevation " 82 | "that does not change. If an object changes elevation, it should return to its resting " 83 | "elevation as soon as possible.\n\n" 84 | 85 | "Component elevations.\n\n" 86 | 87 | "The resting elevation for a component type is consistent across apps (e.g., FAB elevation " 88 | "does not vary from 6dp in one app to 16dp in another app).\n" 89 | "Components may have different resting elevations across platforms, depending on the depth " 90 | "of the environment (e.g., TV has a greater depth than mobile or desktop).\n\n" 91 | 92 | "Responsive elevation and dynamic elevation offsets.\n\n" 93 | 94 | "Some component types have responsive elevation, meaning they change elevation in response " 95 | "to user input (e.g., normal, focused, and pressed) or system events. These elevation " 96 | "changes are consistently implemented using dynamic elevation offsets.\n" 97 | "Dynamic elevation offsets are the goal elevation that a component moves towards, relative " 98 | "to the component’s resting state. They ensure that elevation changes are consistent " 99 | "across actions and component types. For example, all components that lift on press have " 100 | "the same elevation change relative to their resting elevation.\n" 101 | "Once the input event is completed or cancelled, the component will return to its resting " 102 | "elevation.\n\n" 103 | 104 | "Avoiding elevation interference.\n\n" 105 | 106 | "Components with responsive elevations may encounter other components as they move between " 107 | "their resting elevations and dynamic elevation offsets. Because material cannot pass " 108 | "through other material, components avoid interfering with one another any number of ways, " 109 | "whether on a per component basis or using the entire app layout.\n" 110 | "On a component level, components can move or be removed before they cause interference. " 111 | "For example, a floating action button (FAB) can disappear or move off screen before a " 112 | "user picks up a card, or it can move if a snackbar appears.\n" 113 | "On the layout level, design your app layout to minimize opportunities for interference. " 114 | "For example, position the FAB to one side of stream of a cards so the FAB won’t interfere " 115 | "when a user tries to pick up one of cards.\n\n" 116 | 117 | Settings 118 | 119 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 25 | 26 | 27 | 33 | 34 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * ArcToolbarView - An Arc view for the android Toolbar or anywhere. 3 | * 4 | * Copyright (c) 2018 ArcToolbarView 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * "Software"), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 20 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 21 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 22 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 23 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | */ 25 | 26 | include ':arctoolbarview', ':sample' 27 | --------------------------------------------------------------------------------