├── .github
└── workflows
│ └── android.yml
├── .gitignore
├── LICENSE
├── README.md
├── build.gradle
├── demo
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── andrefrsousa
│ │ └── supertoolbar
│ │ └── demo
│ │ └── DemoActivity.kt
│ └── res
│ ├── drawable-v24
│ └── ic_launcher_foreground.xml
│ ├── drawable
│ └── ic_launcher_background.xml
│ ├── layout
│ ├── activity_demo.xml
│ └── list_item.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
├── docs
├── css
│ └── main.css
├── index.html
├── js
│ └── index.js
└── res
│ ├── .keep
│ └── example.gif
├── facelift.json
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── lib
├── build.gradle
├── proguard-rules.pro
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── java
│ └── com
│ │ └── andrefrsousa
│ │ └── supertoolbar
│ │ └── SuperToolbar.kt
│ └── res
│ ├── layout
│ └── super_toolbar_title.xml
│ └── values
│ ├── attrs.xml
│ └── dimens.xml
├── raw
└── example.gif
└── settings.gradle
/.github/workflows/android.yml:
--------------------------------------------------------------------------------
1 | name: Android CI
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v2
16 | - name: set up JDK 1.8
17 | uses: actions/setup-java@v1
18 | with:
19 | java-version: 1.8
20 | - name: Build with Gradle
21 | run: ./gradlew build assembleDebug
22 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | #built application files
2 | *.apk
3 |
4 | # files for the dex VM
5 | *.dex
6 |
7 | # Java class files
8 | *.class
9 |
10 | # generated files
11 | bin/
12 | gen/
13 |
14 | # Local configuration file (sdk path, etc)
15 | local.properties
16 |
17 | # Windows thumbnail db
18 | Thumbs.db
19 |
20 | # OSX files
21 | .DS_Store
22 |
23 | # Android Studio
24 | *.iml
25 | .idea
26 | #.idea/workspace.xml - remove # and delete .idea if it better suit your needs.
27 | .gradle
28 | build/
29 | .navigation
30 | captures/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2018 André Sousa
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
Super Toolbar
2 | Android native toolbar on steroids 💪
3 |
4 |
5 |
6 |
7 |
8 |
9 | ### Summary
10 |
11 | * Animate the height of the toolbar as you scroll
12 | * Center the toolbar title horizontally
13 | * Use light title font
14 |
15 |
16 | ## Download
17 |
18 | This library is available in **jitpack**, so to use it you need to add the above statement to your root *build.gradle*:
19 |
20 | ```groovy
21 | allprojects {
22 | repositories {
23 | ...
24 | maven { url 'https://jitpack.io' }
25 | }
26 | }
27 | ```
28 |
29 | Add the dependency:
30 |
31 | ```groovy
32 | dependencies {
33 | implementation 'com.github.andrefrsousa:SuperToolbar:1.3.0'
34 | }
35 | ```
36 |
37 | ## Sample Project
38 |
39 | We have a sample project in Kotlin that demonstrates the use of the library [here](https://github.com/andrefrsousa/SuperToolbar/blob/master/demo/src/main/java/com/andrefrsousa/supertoolbar/demo/DemoActivity.kt).
40 |
41 | 
42 |
43 | ## Use
44 |
45 | It is recommended that you review the sample project to get a full understanding of all the features offered by the library.
46 | To display the height of the toolbar, you only need to call:
47 |
48 | ```kotlin
49 | fun setElevationVisibility(show: Boolean)
50 | ```
51 |
52 | If you want to have the same effect as the one used in Google Messages, for example, add a scroll listener to your *RecyclerView* or *ScrollView*. Like this:
53 |
54 | ```kotlin
55 |
56 | myRecyclerView.addOnScrollListener(object : RecyclerView.OnScrollListener() {
57 | override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
58 | super.onScrolled(recyclerView, dx, dy)
59 | toolbar.setElevationVisibility(recyclerView.canScrollVertically(-1))
60 | }
61 | })
62 |
63 | ```
64 |
65 |
66 | ## Adjustments
67 |
68 | You can costumize your toolbar with the following attributes:
69 |
70 | ```xml
71 |
72 | // The duration of the elevation animation. By default it is 250 miliseconds.
73 |
74 |
75 | // If you want to show the toolbar elevation when created. By default is false.
76 |
77 |
78 | // Center the toolbar title. Is false by default.
79 |
80 |
81 | // Use a light font as the title of the toolbar. The default value is false.
82 |
83 |
84 | ```
85 |
86 | ## License
87 |
88 | ```
89 | Copyright (c) 2018 André Sousa
90 |
91 | Licensed under the Apache License, Version 2.0 (the "License");
92 | you may not use this file except in compliance with the License.
93 | You may obtain a copy of the License at
94 |
95 | http://www.apache.org/licenses/LICENSE-2.0
96 |
97 | Unless required by applicable law or agreed to in writing, software
98 | distributed under the License is distributed on an "AS IS" BASIS,
99 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
100 | See the License for the specific language governing permissions and
101 | limitations under the License.
102 | ```
103 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | google()
4 | jcenter()
5 | }
6 |
7 | dependencies {
8 | classpath 'com.android.tools.build:gradle:4.1.0'
9 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
10 | }
11 | }
12 |
13 | allprojects {
14 | repositories {
15 | google()
16 | jcenter()
17 | }
18 | }
19 |
20 | task clean(type: Delete) {
21 | delete rootProject.buildDir
22 | }
23 |
--------------------------------------------------------------------------------
/demo/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 30
7 |
8 | defaultConfig {
9 | applicationId "com.andrefrsousa.supertoolbar.demo"
10 | minSdkVersion 16
11 | targetSdkVersion 30
12 | versionCode 1
13 | versionName "1.0"
14 | }
15 | }
16 |
17 | dependencies {
18 | implementation project(path: ':lib')
19 |
20 | implementation 'androidx.appcompat:appcompat:1.2.0'
21 | implementation 'androidx.recyclerview:recyclerview:1.1.0'
22 | implementation 'androidx.constraintlayout:constraintlayout:2.0.2'
23 | }
24 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/demo/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/demo/src/main/java/com/andrefrsousa/supertoolbar/demo/DemoActivity.kt:
--------------------------------------------------------------------------------
1 | /*
2 | * The MIT License (MIT)
3 | *
4 | * Copyright (c) 2018 André Sousa
5 | *
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy
7 | * of this software and associated documentation files (the "Software"), to deal
8 | * in the Software without restriction, including without limitation the rights
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | * copies of the Software, and to permit persons to whom the Software is
11 | * furnished to do so, subject to the following conditions:
12 | *
13 | * The above copyright notice and this permission notice shall be included in all
14 | * copies or substantial portions of the Software.
15 | *
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | * SOFTWARE.
23 | */
24 | package com.andrefrsousa.supertoolbar.demo
25 |
26 | import android.os.Bundle
27 | import android.view.LayoutInflater
28 | import android.view.View
29 | import android.view.ViewGroup
30 | import android.widget.TextView
31 | import androidx.appcompat.app.AppCompatActivity
32 | import androidx.recyclerview.widget.RecyclerView.OnScrollListener
33 | import kotlinx.android.synthetic.main.activity_demo.*
34 | import kotlinx.android.synthetic.main.list_item.view.*
35 |
36 | class DemoActivity : AppCompatActivity() {
37 |
38 | private lateinit var listener: OnScrollListener
39 |
40 | override fun onCreate(savedInstanceState: Bundle?) {
41 | super.onCreate(savedInstanceState)
42 | setContentView(R.layout.activity_demo)
43 |
44 | toolbar.title = getString(R.string.app_name)
45 |
46 | listener = object : OnScrollListener() {
47 | override fun onScrolled(
48 | recyclerView: androidx.recyclerview.widget.RecyclerView,
49 | dx: Int,
50 | dy: Int
51 | ) {
52 | super.onScrolled(recyclerView, dx, dy)
53 | toolbar.setElevationVisibility(recyclerView.canScrollVertically(-1))
54 | }
55 | }
56 |
57 | items_list.run {
58 | layoutManager = androidx.recyclerview.widget.LinearLayoutManager(this@DemoActivity)
59 | adapter = ItemsAdapter()
60 | }
61 | }
62 |
63 | override fun onResume() {
64 | super.onResume()
65 | items_list.addOnScrollListener(listener)
66 | }
67 |
68 | override fun onPause() {
69 | items_list.removeOnScrollListener(listener)
70 | super.onPause()
71 | }
72 | }
73 |
74 | // Inner classes
75 |
76 | class ItemsAdapter : androidx.recyclerview.widget.RecyclerView.Adapter() {
77 |
78 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int) =
79 | ViewHolder(parent.inflate(R.layout.list_item))
80 |
81 | override fun onBindViewHolder(p0: ViewHolder, p1: Int) {
82 | }
83 |
84 | override fun getItemCount() = 15
85 |
86 | class ViewHolder(view: View) : androidx.recyclerview.widget.RecyclerView.ViewHolder(view) {
87 | val text: TextView = view.text_view
88 | }
89 | }
90 |
91 | private fun ViewGroup.inflate(layoutId: Int) =
92 | LayoutInflater.from(context).inflate(layoutId, this, false)!!
--------------------------------------------------------------------------------
/demo/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
12 |
13 |
19 |
22 |
25 |
26 |
27 |
28 |
34 |
35 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/activity_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
18 |
19 |
26 |
27 |
--------------------------------------------------------------------------------
/demo/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-anydpi-v26/ic_launcher.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-hdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-hdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-mdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-mdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-xhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/andrefrsousa/SuperToolbar/2ededfd9843ea0b0f42f6380ec4fbde49316bcee/demo/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
--------------------------------------------------------------------------------
/demo/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #008577
4 | #00574B
5 | #D81B60
6 |
7 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Demo SuperToolbar
3 |
4 |
--------------------------------------------------------------------------------
/demo/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/docs/css/main.css:
--------------------------------------------------------------------------------
1 | div.notification.notification-producthunt {
2 | border-radius: 0 !important;
3 | background: #da552f;
4 | }
5 |
6 | p.install-text code {
7 | border-radius: 5px;
8 | padding: 0.75rem;
9 | }
10 |
11 | p.install-text code::before {
12 | content: '';
13 | }
14 |
15 | p.install-text code:hover {
16 | cursor: text;
17 | }
18 |
19 | p.install-text code:hover span {
20 | background: pink;
21 | }
22 |
23 | .hero .hero-foot {
24 | margin-bottom: 1rem;
25 | }
26 |
27 | #madeWithBulma {
28 | vertical-align: bottom;
29 | }
30 |
31 | div.column.has-content-vcentered {
32 | display: flex;
33 | flex-direction: column;
34 | justify-content: center;
35 | }
36 |
37 | div.notification.copy-notification {
38 | position: absolute;
39 | top: 0;
40 | right: 0;
41 | z-index: 999;
42 | }
43 |
44 | .makerlink {
45 | font-family: BlinkMacSystemFont, -apple-system, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
46 | right: 0px;
47 | bottom: 0px;
48 | position: fixed;
49 | z-index: 100;
50 | border-top-left-radius: 5px;
51 | color: rgb(111, 111, 111);
52 | padding: 6px;
53 | border-top: 1px solid rgb(239, 239, 239);
54 | border-left: 1px solid rgb(239, 239, 239);
55 | background: rgb(255, 255, 255);
56 | text-decoration: none;
57 | }
58 |
59 | .makerlink .makerlink__img {
60 | width: 22px;
61 | vertical-align: middle;
62 | border-radius: 100%;
63 | }
64 |
65 | .makerlink .makerlink__author {
66 | vertical-align: middle;
67 | display: inline;
68 | font-weight: 500;
69 | font-size: 14px;
70 | margin: 0px 0px 0px 7px;
71 | }
72 |
73 | h1 a {
74 | color:inherit;
75 | text-decoration: none;
76 | }
--------------------------------------------------------------------------------
/docs/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | SuperToolbar - Android native Toolbar on steroids 💪
9 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
31 |
Android native toolbar on steroids 💪
32 |
33 |
34 | implementation 'com.github.andrefrsousa:SuperToolbar:1.3.0'
35 |
36 |
Copied to
37 | clipboard!
38 |
39 |
40 |
41 |
42 |
Features
43 |
44 | - Animate the toolbar elevation when scrolling
45 | - Center toolbar title
46 | - Light title font
47 |
48 |
49 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
72 | by André Sousa
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/docs/js/index.js:
--------------------------------------------------------------------------------
1 | // `copyToClipboard()` courtesy @chalarangelo (Angelos Chalaris)
2 | // refs: https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f
3 | const copyToClipboard = (str) => {
4 | const el = document.createElement('textarea'); // Create a