├── app
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── drawable-hdpi
│ │ │ ├── ic_done.png
│ │ │ ├── ic_event.png
│ │ │ ├── ic_forum.png
│ │ │ ├── ic_menu.png
│ │ │ ├── ic_headset.png
│ │ │ ├── ic_dashboard.png
│ │ │ ├── ic_message_white_18dp.png
│ │ │ └── ic_message_white_24dp.png
│ │ ├── drawable-mdpi
│ │ │ ├── ic_done.png
│ │ │ ├── ic_event.png
│ │ │ ├── ic_forum.png
│ │ │ ├── ic_menu.png
│ │ │ ├── ic_headset.png
│ │ │ ├── ic_dashboard.png
│ │ │ ├── ic_message_white_18dp.png
│ │ │ └── ic_message_white_24dp.png
│ │ ├── drawable-xhdpi
│ │ │ ├── ic_done.png
│ │ │ ├── ic_menu.png
│ │ │ ├── ic_event.png
│ │ │ ├── ic_forum.png
│ │ │ ├── ic_dashboard.png
│ │ │ ├── ic_headset.png
│ │ │ ├── ic_message_white_18dp.png
│ │ │ └── ic_message_white_24dp.png
│ │ ├── drawable-nodpi
│ │ │ ├── cheese_1.jpg
│ │ │ ├── cheese_2.jpg
│ │ │ ├── cheese_3.jpg
│ │ │ ├── cheese_4.jpg
│ │ │ └── cheese_5.jpg
│ │ ├── drawable-xxhdpi
│ │ │ ├── ic_done.png
│ │ │ ├── ic_event.png
│ │ │ ├── ic_forum.png
│ │ │ ├── ic_menu.png
│ │ │ ├── ic_headset.png
│ │ │ ├── ic_dashboard.png
│ │ │ ├── ic_message_white_18dp.png
│ │ │ └── ic_message_white_24dp.png
│ │ ├── drawable-xxxhdpi
│ │ │ ├── ic_done.png
│ │ │ ├── ic_menu.png
│ │ │ ├── ic_message_white_18dp.png
│ │ │ └── ic_message_white_24dp.png
│ │ ├── mipmap-hdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ │ └── ic_launcher.png
│ │ ├── values
│ │ │ ├── colors.xml
│ │ │ ├── dimens.xml
│ │ │ ├── strings.xml
│ │ │ └── styles.xml
│ │ ├── layout
│ │ │ ├── fragment_cheese_list.xml
│ │ │ ├── nav_header.xml
│ │ │ ├── activity_main.xml
│ │ │ ├── list_item.xml
│ │ │ ├── include_list_viewpager.xml
│ │ │ └── activity_detail.xml
│ │ ├── menu
│ │ │ ├── sample_actions.xml
│ │ │ └── drawer_view.xml
│ │ └── values-v21
│ │ │ └── styles.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── com
│ │ └── support
│ │ └── android
│ │ └── designlibdemo
│ │ ├── CheeseDetailActivity.java
│ │ ├── CheeseListFragment.java
│ │ ├── MainActivity.java
│ │ └── Cheeses.java
├── proguard-rules.pro
└── build.gradle
├── toolbarbutton
├── .gitignore
├── src
│ └── main
│ │ ├── res
│ │ ├── values
│ │ │ ├── strings.xml
│ │ │ └── dimens.xml
│ │ ├── drawable-v21
│ │ │ └── selector_toolbar_button.xml
│ │ └── drawable
│ │ │ └── selector_toolbar_button.xml
│ │ ├── AndroidManifest.xml
│ │ └── java
│ │ └── am
│ │ └── gaut
│ │ └── android
│ │ └── toolbarbutton
│ │ ├── helpers
│ │ └── CollapsingToolbarHelper.java
│ │ └── ToolbarButton.java
├── proguard-rules.pro
└── build.gradle
├── settings.gradle
├── art
└── toolbar-button.gif
├── gradle
└── wrapper
│ └── gradle-wrapper.properties
├── .gitignore
├── gradle.properties
├── gradlew.bat
├── README.md
├── gradlew
└── LICENSE
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/toolbarbutton/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app', ':toolbarbutton'
2 |
--------------------------------------------------------------------------------
/art/toolbar-button.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/art/toolbar-button.gif
--------------------------------------------------------------------------------
/toolbarbutton/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | Toolbar Button
3 |
4 |
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-hdpi/ic_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_event.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-hdpi/ic_event.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_forum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-hdpi/ic_forum.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-hdpi/ic_menu.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-mdpi/ic_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_event.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-mdpi/ic_event.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_forum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-mdpi/ic_forum.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-mdpi/ic_menu.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xhdpi/ic_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xhdpi/ic_menu.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_headset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-hdpi/ic_headset.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_headset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-mdpi/ic_headset.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/cheese_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-nodpi/cheese_1.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/cheese_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-nodpi/cheese_2.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/cheese_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-nodpi/cheese_3.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/cheese_4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-nodpi/cheese_4.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-nodpi/cheese_5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-nodpi/cheese_5.jpg
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_event.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xhdpi/ic_event.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_forum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xhdpi/ic_forum.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxhdpi/ic_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_event.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxhdpi/ic_event.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_forum.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxhdpi/ic_forum.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxhdpi/ic_menu.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxxhdpi/ic_done.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxxhdpi/ic_menu.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-hdpi/ic_dashboard.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-mdpi/ic_dashboard.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xhdpi/ic_dashboard.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_headset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xhdpi/ic_headset.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_headset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxhdpi/ic_headset.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_dashboard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxhdpi/ic_dashboard.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_message_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-hdpi/ic_message_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-hdpi/ic_message_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-hdpi/ic_message_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_message_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-mdpi/ic_message_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-mdpi/ic_message_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-mdpi/ic_message_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_message_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xhdpi/ic_message_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xhdpi/ic_message_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xhdpi/ic_message_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_message_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxhdpi/ic_message_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxhdpi/ic_message_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxhdpi/ic_message_white_24dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_message_white_18dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxxhdpi/ic_message_white_18dp.png
--------------------------------------------------------------------------------
/app/src/main/res/drawable-xxxhdpi/ic_message_white_24dp.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/GautamGupta/toolbar-button/HEAD/app/src/main/res/drawable-xxxhdpi/ic_message_white_24dp.png
--------------------------------------------------------------------------------
/toolbarbutton/src/main/res/drawable-v21/selector_toolbar_button.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Oct 02 15:16:18 EDT 2017
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-3.3-all.zip
7 |
--------------------------------------------------------------------------------
/toolbarbutton/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 6dp
4 | 16dp
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.jar
8 | *.war
9 | *.ear
10 |
11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12 | hs_err_pid*
13 |
14 | local.properties
15 | build/
16 | .gradle/
17 | .idea
18 | *.iml
--------------------------------------------------------------------------------
/toolbarbutton/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/toolbarbutton/src/main/res/drawable/selector_toolbar_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | -
4 |
5 |
6 |
7 |
8 |
9 | -
10 |
11 |
12 |
13 |
14 |
15 | -
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/toolbarbutton/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/Gautam/Library/Android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /usr/local/google/home/chrisbanes/bin/current-android-sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 |
--------------------------------------------------------------------------------
/app/src/main/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | #FFF5F5F5
20 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 25
5 | buildToolsVersion "26.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.support.android.designlibdemo"
9 | minSdkVersion 14
10 | targetSdkVersion 25
11 | versionCode 2
12 | versionName "1.1"
13 | }
14 | buildTypes {
15 | release {
16 | minifyEnabled false
17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18 | }
19 | }
20 | }
21 |
22 | repositories {
23 | jcenter()
24 | }
25 |
26 | dependencies {
27 | compile 'com.android.support:design:25.3.1'
28 | compile 'com.android.support:cardview-v7:25.3.1'
29 |
30 | compile 'com.github.bumptech.glide:glide:3.7.0'
31 | compile 'de.hdodenhof:circleimageview:1.3.0'
32 |
33 | compile project(path: ':toolbarbutton')
34 | }
35 |
--------------------------------------------------------------------------------
/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 | # Default value: -Xmx10248m -XX:MaxPermSize=256m
13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
--------------------------------------------------------------------------------
/app/src/main/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | 256dp
20 | 16dp
21 | 16dp
22 | 40dp
23 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_cheese_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/sample_actions.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
24 |
--------------------------------------------------------------------------------
/app/src/main/res/values-v21/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/nav_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
26 |
27 |
32 |
33 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 | Cheesesquare
20 |
21 | Jarlsberg lancashire edam. Dolcelatte hard cheese brie st. agur blue
22 | cheese caerphilly bavarian bergkase cheese and biscuits mascarpone. Cheeseburger swiss bavarian
23 | bergkase cream cheese fromage frais cheesy feet port-salut airedale. St. agur blue cheese rubber
24 | cheese caerphilly cheddar cheesecake cream cheese manchego lancashire. Roquefort squirty cheese
25 | the big cheese.
26 | Checkin
27 | Settings
28 |
29 |
30 |
--------------------------------------------------------------------------------
/toolbarbutton/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.library'
2 |
3 | ext {
4 | bintrayRepo = 'maven'
5 | bintrayName = 'toolbar-button'
6 |
7 | publishedGroupId = 'am.gaut.android.toolbarbutton'
8 | libraryName = 'ToolbarButton'
9 | artifact = 'toolbarbutton'
10 |
11 | libraryDescription = 'FAB to Toolbar Button library for Android Material Collapsing Toolbar'
12 |
13 | siteUrl = 'https://github.com/GautamGupta/toolbar-button'
14 | gitUrl = 'https://github.com/GautamGupta/toolbar-button.git'
15 |
16 | libraryVersion = '0.1.0'
17 |
18 | developerId = 'gautamgupta'
19 | developerName = 'Gautam Gupta'
20 | developerEmail = 'gautam@gaut.am'
21 |
22 | licenseName = 'The Apache Software License, Version 2.0'
23 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
24 | allLicenses = ["Apache-2.0"]
25 | }
26 |
27 | android {
28 | compileSdkVersion 25
29 | buildToolsVersion "26.0.2"
30 |
31 | defaultConfig {
32 | minSdkVersion 14
33 | targetSdkVersion 25
34 | }
35 | }
36 |
37 | dependencies {
38 | compile fileTree(dir: 'libs', include: ['*.jar'])
39 | compile ('com.android.support:design:23.2.1') {
40 | exclude module: 'shared'
41 | }
42 | }
43 |
44 | apply from: 'https://raw.githubusercontent.com/GautamGupta/JCenter/master/installv1.gradle'
45 | apply from: 'https://raw.githubusercontent.com/GautamGupta/JCenter/master/bintrayv1.gradle'
46 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
26 |
27 |
35 |
36 |
--------------------------------------------------------------------------------
/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
19 |
20 |
22 |
23 |
29 |
30 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
26 |
27 |
32 |
33 |
38 |
39 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
20 |
21 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
39 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/menu/drawer_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
50 |
--------------------------------------------------------------------------------
/app/src/main/java/com/support/android/designlibdemo/CheeseDetailActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 The Android Open Source Project
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 | package com.support.android.designlibdemo;
18 |
19 | import android.content.Intent;
20 | import android.os.Bundle;
21 | import android.support.design.widget.CollapsingToolbarLayout;
22 | import android.support.v7.app.AppCompatActivity;
23 | import android.support.v7.widget.Toolbar;
24 | import android.view.Menu;
25 | import android.view.MenuItem;
26 | import android.widget.ImageView;
27 |
28 | import com.bumptech.glide.Glide;
29 |
30 | import java.util.Random;
31 |
32 | public class CheeseDetailActivity extends AppCompatActivity {
33 |
34 | public static final String EXTRA_NAME = "cheese_name";
35 |
36 | @Override
37 | public void onCreate(Bundle savedInstanceState) {
38 | super.onCreate(savedInstanceState);
39 | setContentView(R.layout.activity_detail);
40 |
41 | Intent intent = getIntent();
42 | final String cheeseName = intent.getStringExtra(EXTRA_NAME);
43 |
44 | final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
45 | setSupportActionBar(toolbar);
46 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
47 |
48 | CollapsingToolbarLayout collapsingToolbar =
49 | (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
50 | collapsingToolbar.setTitle(cheeseName);
51 |
52 | loadBackdrop();
53 | }
54 |
55 | private void loadBackdrop() {
56 | final ImageView imageView = (ImageView) findViewById(R.id.backdrop);
57 | Glide.with(this).load(Cheeses.getRandomCheeseDrawable()).centerCrop().into(imageView);
58 | }
59 |
60 | @Override
61 | public boolean onCreateOptionsMenu(Menu menu) {
62 | // getMenuInflater().inflate(R.menu.sample_actions, menu);
63 | return true;
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/include_list_viewpager.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
23 |
24 |
29 |
30 |
37 |
38 |
42 |
43 |
44 |
45 |
50 |
51 |
58 |
59 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/toolbarbutton/src/main/java/am/gaut/android/toolbarbutton/helpers/CollapsingToolbarHelper.java:
--------------------------------------------------------------------------------
1 | package am.gaut.android.toolbarbutton.helpers;
2 |
3 | import android.graphics.Matrix;
4 | import android.graphics.Rect;
5 | import android.graphics.RectF;
6 | import android.support.v4.view.ViewCompat;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.view.ViewParent;
10 |
11 | /**
12 | * Need to duplicate code here because folks at Google decided to make their classes and methods
13 | * private.
14 | */
15 | public class CollapsingToolbarHelper {
16 | private static final ThreadLocal sMatrix = new ThreadLocal<>();
17 | private static final ThreadLocal sRectF = new ThreadLocal<>();
18 | private static final Matrix IDENTITY = new Matrix();
19 |
20 | /**
21 | * Borrowed from android.support.design.widget.AppBarLayout
22 | */
23 | public static int getMinimumHeightForVisibleOverlappingContent(ViewGroup appBarLayout) {
24 | final int topInset = getTopInset(appBarLayout);
25 | final int minHeight = ViewCompat.getMinimumHeight(appBarLayout);
26 | if (minHeight != 0) {
27 | // If this layout has a min height, use it (doubled)
28 | return (minHeight * 2) + topInset;
29 | }
30 |
31 | // Otherwise, we'll use twice the min height of our last child
32 | final int childCount = appBarLayout.getChildCount();
33 | return childCount >= 1
34 | ? (ViewCompat.getMinimumHeight(appBarLayout.getChildAt(childCount - 1)) * 2) + topInset
35 | : 0;
36 | }
37 |
38 | /**
39 | * Hack since we don't have access to the private
40 | * android.support.design.widget.AppBarLayout.getTopInset() method
41 | */
42 | public static int getTopInset(ViewGroup appBarLayout) {
43 | int inset = 0;
44 |
45 | int resourceId = appBarLayout.getResources().getIdentifier("status_bar_height", "dimen", "android");
46 | if (ViewCompat.getFitsSystemWindows(appBarLayout) && resourceId > 0) {
47 | inset = appBarLayout.getResources().getDimensionPixelSize(resourceId);
48 | }
49 |
50 | return inset;
51 | }
52 |
53 | /**
54 | * Honeycomb IMPL borrowed from android.support.design.widget.ViewGroupUtils and
55 | * android.support.design.widget.ViewGroupUtilsHoneycomb
56 | */
57 |
58 | public static void getDescendantRect(ViewGroup parent, View descendant, Rect out) {
59 | out.set(0, 0, descendant.getWidth(), descendant.getHeight());
60 | offsetDescendantRect(parent, descendant, out);
61 | }
62 |
63 | static void offsetDescendantRect(ViewGroup group, View child, Rect rect) {
64 | Matrix m = sMatrix.get();
65 | if (m == null) {
66 | m = new Matrix();
67 | sMatrix.set(m);
68 | } else {
69 | m.set(IDENTITY);
70 | }
71 |
72 | offsetDescendantMatrix(group, child, m);
73 |
74 | RectF rectF = sRectF.get();
75 | if (rectF == null) {
76 | rectF = new RectF();
77 | }
78 | rectF.set(rect);
79 | m.mapRect(rectF);
80 | rect.set((int) (rectF.left + 0.5f), (int) (rectF.top + 0.5f),
81 | (int) (rectF.right + 0.5f), (int) (rectF.bottom + 0.5f));
82 | }
83 |
84 | static void offsetDescendantMatrix(ViewParent target, View view, Matrix m) {
85 | final ViewParent parent = view.getParent();
86 | if (parent instanceof View && parent != target) {
87 | final View vp = (View) parent;
88 | offsetDescendantMatrix(target, vp, m);
89 | m.preTranslate(-vp.getScrollX(), -vp.getScrollY());
90 | }
91 |
92 | m.preTranslate(view.getLeft(), view.getTop());
93 |
94 | if (!view.getMatrix().isIdentity()) {
95 | m.preConcat(view.getMatrix());
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | Android Toolbar Button Library
4 | ==============================
5 |
6 | The problem with anchoring a floating action button to a collapsing toolbar is that the CTA gets
7 | hidden on scroll. This library allows you to artificially add a button in the toolbar with an
8 | animation as soon as the FAB hides itself.
9 |
10 | Works with Android 4.0+ (`minSdkVersion 14`).
11 |
12 |
13 | Gradle
14 | ------
15 |
16 | ```
17 | dependencies {
18 | ...
19 | compile 'com.android.support:design:25.3.1'
20 | compile 'am.gaut.android.toolbarbutton:toolbarbutton:0.1.0'
21 | }
22 | ```
23 |
24 | Usage
25 | -----
26 |
27 | Add this at the same level where your floating action button is defined in the activity.
28 | [Example](https://github.com/GautamGupta/toolbar-button/blob/master/app/src/main/res/layout/activity_detail.xml#L155-L169).
29 |
30 | ```xml
31 |
46 | ```
47 |
48 | You can treat the view as a
49 | [Button](http://developer.android.com/reference/android/widget/Button.html).
50 | Properties in the snippet produce a similar result as in the screen capture.
51 |
52 | `@dimen/toolbar_button_padding` (16dp), `@drawable/selector_toolbar_button`
53 | ([see](https://github.com/GautamGupta/toolbar-button/blob/master/toolbarbutton/src/main/res/drawable/selector_toolbar_button.xml),
54 | [v21](https://github.com/GautamGupta/toolbar-button/blob/master/toolbarbutton/src/main/res/drawable-v21/selector_toolbar_button.xml))
55 | are supplied by the library.
56 |
57 | `@drawable/ic_message_white_18dp` is a [material icon](https://design.google.com/icons/#ic_message).
58 |
59 | `?attr/borderlessButtonStyle` and `@style/TextAppearance.AppCompat.Widget.Button.Inverse` come from
60 | the design support library.
61 |
62 | Credits
63 | -------
64 | - [Gordon Evans](https://www.linkedin.com/in/gjrevans) for concept
65 | - Awesome folks at [Wirkn](http://wirkn.com/) (where the idea originated from), h/t [Joseph Voung](https://www.linkedin.com/in/josephwongcl)
66 | - [Cheesesquare](https://github.com/chrisbanes/cheesesquare) by Chris Banes for the material design demo app
67 |
68 | Troubleshooting
69 | ---------------
70 |
71 | **Q. The button hides on scroll. Why is this happening?**
72 |
73 | The default elevation of 6dp is getting overridden, making it compete with the elevation of the
74 | appbar. Try adding `android:elevation="6dp"` property on the view.
75 |
76 | **Q. Does this work for Android versions before 4.0?**
77 |
78 | It can be made to work for previous Android versions as well, using different implementation classes
79 | like the Floating Action Button. If you take up the initiative, please submit a PR.
80 |
81 | License
82 | -------
83 |
84 | ```
85 | Copyright 2016 Gautam Gupta
86 |
87 | Licensed to the Apache Software Foundation (ASF) under one or more contributor
88 | license agreements. See the NOTICE file distributed with this work for
89 | additional information regarding copyright ownership. The ASF licenses this
90 | file to you under the Apache License, Version 2.0 (the "License"); you may not
91 | use this file except in compliance with the License. You may obtain a copy of
92 | the License at
93 |
94 | http://www.apache.org/licenses/LICENSE-2.0
95 |
96 | Unless required by applicable law or agreed to in writing, software
97 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
98 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
99 | License for the specific language governing permissions and limitations under
100 | the License.
101 | ```
--------------------------------------------------------------------------------
/app/src/main/java/com/support/android/designlibdemo/CheeseListFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 The Android Open Source Project
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 | package com.support.android.designlibdemo;
18 |
19 | import android.content.Context;
20 | import android.content.Intent;
21 | import android.os.Bundle;
22 | import android.support.annotation.Nullable;
23 | import android.support.v4.app.Fragment;
24 | import android.support.v4.widget.TextViewCompat;
25 | import android.support.v7.widget.LinearLayoutManager;
26 | import android.support.v7.widget.RecyclerView;
27 | import android.util.TypedValue;
28 | import android.view.LayoutInflater;
29 | import android.view.View;
30 | import android.view.ViewGroup;
31 | import android.widget.ImageView;
32 | import android.widget.TextView;
33 |
34 | import com.bumptech.glide.Glide;
35 |
36 | import java.util.ArrayList;
37 | import java.util.List;
38 | import java.util.Random;
39 |
40 | public class CheeseListFragment extends Fragment {
41 |
42 | @Nullable
43 | @Override
44 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
45 | RecyclerView rv = (RecyclerView) inflater.inflate(
46 | R.layout.fragment_cheese_list, container, false);
47 | setupRecyclerView(rv);
48 | return rv;
49 | }
50 |
51 | private void setupRecyclerView(RecyclerView recyclerView) {
52 | recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext()));
53 | recyclerView.setAdapter(new SimpleStringRecyclerViewAdapter(getActivity(),
54 | getRandomSublist(Cheeses.sCheeseStrings, 30)));
55 | }
56 |
57 | private List getRandomSublist(String[] array, int amount) {
58 | ArrayList list = new ArrayList<>(amount);
59 | Random random = new Random();
60 | while (list.size() < amount) {
61 | list.add(array[random.nextInt(array.length)]);
62 | }
63 | return list;
64 | }
65 |
66 | public static class SimpleStringRecyclerViewAdapter
67 | extends RecyclerView.Adapter {
68 |
69 | private final TypedValue mTypedValue = new TypedValue();
70 | private int mBackground;
71 | private List mValues;
72 |
73 | public static class ViewHolder extends RecyclerView.ViewHolder {
74 | public String mBoundString;
75 |
76 | public final View mView;
77 | public final ImageView mImageView;
78 | public final TextView mTextView;
79 |
80 | public ViewHolder(View view) {
81 | super(view);
82 | mView = view;
83 | mImageView = (ImageView) view.findViewById(R.id.avatar);
84 | mTextView = (TextView) view.findViewById(android.R.id.text1);
85 | }
86 |
87 | @Override
88 | public String toString() {
89 | return super.toString() + " '" + mTextView.getText();
90 | }
91 | }
92 |
93 | public String getValueAt(int position) {
94 | return mValues.get(position);
95 | }
96 |
97 | public SimpleStringRecyclerViewAdapter(Context context, List items) {
98 | context.getTheme().resolveAttribute(R.attr.selectableItemBackground, mTypedValue, true);
99 | mBackground = mTypedValue.resourceId;
100 | mValues = items;
101 | }
102 |
103 | @Override
104 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
105 | View view = LayoutInflater.from(parent.getContext())
106 | .inflate(R.layout.list_item, parent, false);
107 | view.setBackgroundResource(mBackground);
108 | return new ViewHolder(view);
109 | }
110 |
111 | @Override
112 | public void onBindViewHolder(final ViewHolder holder, int position) {
113 | holder.mBoundString = mValues.get(position);
114 | holder.mTextView.setText(mValues.get(position));
115 |
116 | holder.mView.setOnClickListener(new View.OnClickListener() {
117 | @Override
118 | public void onClick(View v) {
119 | Context context = v.getContext();
120 | Intent intent = new Intent(context, CheeseDetailActivity.class);
121 | intent.putExtra(CheeseDetailActivity.EXTRA_NAME, holder.mBoundString);
122 |
123 | context.startActivity(intent);
124 | }
125 | });
126 |
127 | Glide.with(holder.mImageView.getContext())
128 | .load(Cheeses.getRandomCheeseDrawable())
129 | .fitCenter()
130 | .into(holder.mImageView);
131 | }
132 |
133 | @Override
134 | public int getItemCount() {
135 | return mValues.size();
136 | }
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/app/src/main/java/com/support/android/designlibdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 The Android Open Source Project
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 | package com.support.android.designlibdemo;
18 |
19 | import android.os.Bundle;
20 | import android.support.design.widget.FloatingActionButton;
21 | import android.support.design.widget.NavigationView;
22 | import android.support.design.widget.Snackbar;
23 | import android.support.design.widget.TabLayout;
24 | import android.support.v4.app.Fragment;
25 | import android.support.v4.app.FragmentManager;
26 | import android.support.v4.app.FragmentPagerAdapter;
27 | import android.support.v4.view.GravityCompat;
28 | import android.support.v4.view.ViewPager;
29 | import android.support.v4.widget.DrawerLayout;
30 | import android.support.v7.app.ActionBar;
31 | import android.support.v7.app.AppCompatActivity;
32 | import android.support.v7.widget.Toolbar;
33 | import android.view.Menu;
34 | import android.view.MenuItem;
35 | import android.view.View;
36 | import android.widget.AdapterView;
37 | import android.widget.ArrayAdapter;
38 | import android.widget.Toast;
39 |
40 | import java.util.ArrayList;
41 | import java.util.List;
42 |
43 | /**
44 | * TODO
45 | */
46 | public class MainActivity extends AppCompatActivity {
47 |
48 | private DrawerLayout mDrawerLayout;
49 |
50 | @Override
51 | protected void onCreate(Bundle savedInstanceState) {
52 | super.onCreate(savedInstanceState);
53 | setContentView(R.layout.activity_main);
54 |
55 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
56 | setSupportActionBar(toolbar);
57 |
58 | final ActionBar ab = getSupportActionBar();
59 | ab.setHomeAsUpIndicator(R.drawable.ic_menu);
60 | ab.setDisplayHomeAsUpEnabled(true);
61 |
62 | mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
63 |
64 | NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
65 | if (navigationView != null) {
66 | setupDrawerContent(navigationView);
67 | }
68 |
69 | ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
70 | if (viewPager != null) {
71 | setupViewPager(viewPager);
72 | }
73 |
74 | FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
75 | fab.setOnClickListener(new View.OnClickListener() {
76 | @Override
77 | public void onClick(View view) {
78 | Snackbar.make(view, "Here's a Snackbar", Snackbar.LENGTH_LONG)
79 | .setAction("Action", null).show();
80 | }
81 | });
82 |
83 | TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs);
84 | tabLayout.setupWithViewPager(viewPager);
85 | }
86 |
87 | @Override
88 | public boolean onCreateOptionsMenu(Menu menu) {
89 | getMenuInflater().inflate(R.menu.sample_actions, menu);
90 | return true;
91 | }
92 |
93 | @Override
94 | public boolean onOptionsItemSelected(MenuItem item) {
95 | switch (item.getItemId()) {
96 | case android.R.id.home:
97 | mDrawerLayout.openDrawer(GravityCompat.START);
98 | return true;
99 | }
100 | return super.onOptionsItemSelected(item);
101 | }
102 |
103 | private void setupViewPager(ViewPager viewPager) {
104 | Adapter adapter = new Adapter(getSupportFragmentManager());
105 | adapter.addFragment(new CheeseListFragment(), "Category 1");
106 | adapter.addFragment(new CheeseListFragment(), "Category 2");
107 | adapter.addFragment(new CheeseListFragment(), "Category 3");
108 | viewPager.setAdapter(adapter);
109 | }
110 |
111 | private void setupDrawerContent(NavigationView navigationView) {
112 | navigationView.setNavigationItemSelectedListener(
113 | new NavigationView.OnNavigationItemSelectedListener() {
114 | @Override
115 | public boolean onNavigationItemSelected(MenuItem menuItem) {
116 | menuItem.setChecked(true);
117 | mDrawerLayout.closeDrawers();
118 | return true;
119 | }
120 | });
121 | }
122 |
123 | static class Adapter extends FragmentPagerAdapter {
124 | private final List mFragments = new ArrayList<>();
125 | private final List mFragmentTitles = new ArrayList<>();
126 |
127 | public Adapter(FragmentManager fm) {
128 | super(fm);
129 | }
130 |
131 | public void addFragment(Fragment fragment, String title) {
132 | mFragments.add(fragment);
133 | mFragmentTitles.add(title);
134 | }
135 |
136 | @Override
137 | public Fragment getItem(int position) {
138 | return mFragments.get(position);
139 | }
140 |
141 | @Override
142 | public int getCount() {
143 | return mFragments.size();
144 | }
145 |
146 | @Override
147 | public CharSequence getPageTitle(int position) {
148 | return mFragmentTitles.get(position);
149 | }
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_detail.xml:
--------------------------------------------------------------------------------
1 |
2 |
17 |
18 |
24 |
25 |
31 |
32 |
41 |
42 |
49 |
50 |
56 |
57 |
58 |
59 |
60 |
61 |
65 |
66 |
71 |
72 |
76 |
77 |
81 |
82 |
87 |
88 |
92 |
93 |
94 |
95 |
96 |
97 |
103 |
104 |
108 |
109 |
114 |
115 |
119 |
120 |
121 |
122 |
123 |
124 |
130 |
131 |
135 |
136 |
141 |
142 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
170 |
171 |
179 |
180 |
--------------------------------------------------------------------------------
/toolbarbutton/src/main/java/am/gaut/android/toolbarbutton/ToolbarButton.java:
--------------------------------------------------------------------------------
1 | package am.gaut.android.toolbarbutton;
2 |
3 | import android.animation.Animator;
4 | import android.animation.AnimatorListenerAdapter;
5 | import android.content.Context;
6 | import android.graphics.Rect;
7 | import android.os.Build;
8 | import android.support.annotation.Nullable;
9 | import android.support.design.widget.AppBarLayout;
10 | import android.support.design.widget.CoordinatorLayout;
11 | import android.support.v4.view.ViewCompat;
12 | import android.support.v4.view.animation.FastOutLinearInInterpolator;
13 | import android.support.v4.view.animation.LinearOutSlowInInterpolator;
14 | import android.util.AttributeSet;
15 | import android.view.View;
16 | import android.view.ViewGroup;
17 | import android.view.animation.Interpolator;
18 | import android.widget.Button;
19 |
20 | import am.gaut.android.toolbarbutton.helpers.CollapsingToolbarHelper;
21 |
22 | /**
23 | * Toolbar buttons are used for a special type of promoted action. They are used in combination
24 | * with a FloatingActionButton anchored to a CollapsingToolbarLayout.
25 | *
26 | * Requires ICS+ (sdk 14+)
27 | */
28 | @CoordinatorLayout.DefaultBehavior(ToolbarButton.Behavior.class)
29 | public class ToolbarButton extends Button {
30 |
31 | private static final String LOG_TAG = "ToolbarButton";
32 |
33 | /**
34 | * Callback to be invoked when the visibility of a ToolbarButton changes.
35 | */
36 | public abstract static class OnVisibilityChangedListener {
37 | /**
38 | * Called when a ToolbarButton has been
39 | * {@link #show(OnVisibilityChangedListener) shown}.
40 | *
41 | * @param toolbarBtn the ToolbarButton that was shown.
42 | */
43 | public void onShown(ToolbarButton toolbarBtn) {}
44 |
45 | /**
46 | * Called when a ToolbarButton has been
47 | * {@link #hide(OnVisibilityChangedListener) hidden}.
48 | *
49 | * @param toolbarBtn the ToolbarButton that was hidden.
50 | */
51 | public void onHidden(ToolbarButton toolbarBtn) {}
52 | }
53 |
54 | private static final String XMLNS_ANDROID = "http://schemas.android.com/apk/res/android";
55 |
56 | private static final int SHOW_HIDE_ANIM_DURATION = 200;
57 | private static final Interpolator FAST_OUT_LINEAR_IN_INTERPOLATOR = new FastOutLinearInInterpolator();
58 | private static final Interpolator LINEAR_OUT_SLOW_IN_INTERPOLATOR = new LinearOutSlowInInterpolator();
59 |
60 | private boolean mIsHiding;
61 |
62 | public ToolbarButton(Context context) {
63 | this(context, null);
64 | }
65 |
66 | public ToolbarButton(Context context, AttributeSet attrs) {
67 | this(context, attrs, 0);
68 | }
69 |
70 | public ToolbarButton(Context context, AttributeSet attrs, int defStyleAttr) {
71 | super(context, attrs, defStyleAttr);
72 |
73 | // Hide if there's no visibility attribute
74 | if (attrs.getAttributeValue(XMLNS_ANDROID, "visibility") == null) {
75 | setVisibility(GONE);
76 | }
77 |
78 | // Add elevation if it's not set
79 | if (Build.VERSION.SDK_INT >= 21 && attrs.getAttributeValue(XMLNS_ANDROID, "elevation") == null) {
80 | setElevation(R.dimen.toolbar_button_elevation);
81 | }
82 | }
83 |
84 | /**
85 | * Shows the button.
86 | * This method will animate the button show if the view has already been laid out.
87 | */
88 | public void show() {
89 | show(null);
90 | }
91 |
92 | /**
93 | * Shows the button.
94 | * This method will animate the button show if the view has already been laid out.
95 | *
96 | * @param listener the listener to notify when this view is shown
97 | */
98 | public void show(@Nullable final OnVisibilityChangedListener listener) {
99 | if (mIsHiding || getVisibility() != View.VISIBLE) {
100 | if (ViewCompat.isLaidOut(this) && !isInEditMode()) {
101 | animate().cancel();
102 | if (getVisibility() != View.VISIBLE) {
103 | // If the view isn't visible currently, we'll animate it from a single pixel
104 | setAlpha(0f);
105 | setScaleY(0f);
106 | setScaleX(0f);
107 | }
108 | animate()
109 | .scaleX(1f)
110 | .scaleY(1f)
111 | .alpha(1f)
112 | .setDuration(SHOW_HIDE_ANIM_DURATION)
113 | .setInterpolator(LINEAR_OUT_SLOW_IN_INTERPOLATOR)
114 | .setListener(new AnimatorListenerAdapter() {
115 | @Override
116 | public void onAnimationStart(Animator animation) {
117 | setVisibility(View.VISIBLE);
118 | }
119 |
120 | @Override
121 | public void onAnimationEnd(Animator animation) {
122 | if (listener != null) {
123 | listener.onShown(ToolbarButton.this);
124 | }
125 | }
126 | });
127 | } else {
128 | setVisibility(View.VISIBLE);
129 | setAlpha(1f);
130 | setScaleY(1f);
131 | setScaleX(1f);
132 | if (listener != null) {
133 | listener.onShown(this);
134 | }
135 | }
136 | }
137 | }
138 |
139 | /**
140 | * Hides the button.
141 | * This method will animate the button hide if the view has already been laid out.
142 | */
143 | public void hide() {
144 | hide(null);
145 | }
146 |
147 | private void hide(@Nullable final OnVisibilityChangedListener listener) {
148 | if (mIsHiding || getVisibility() != View.VISIBLE) {
149 | // A hide animation is in progress, or we're already hidden. Skip the call
150 | if (listener != null) {
151 | listener.onHidden(this);
152 | }
153 | return;
154 | }
155 |
156 | if (!ViewCompat.isLaidOut(this) || isInEditMode()) {
157 | // If the view isn't laid out, or we're in the editor, don't run the animation
158 | setVisibility(View.GONE);
159 | if (listener != null) {
160 | listener.onHidden(this);
161 | }
162 | } else {
163 | animate().cancel();
164 | animate().scaleX(0.0F)
165 | .scaleY(0.0F)
166 | .alpha(0.0F)
167 | .setDuration(SHOW_HIDE_ANIM_DURATION)
168 | .setInterpolator(FAST_OUT_LINEAR_IN_INTERPOLATOR)
169 | .setListener(new AnimatorListenerAdapter() {
170 | private boolean mCancelled;
171 |
172 | @Override
173 | public void onAnimationStart(Animator animation) {
174 | mIsHiding = true;
175 | mCancelled = false;
176 | setVisibility(View.VISIBLE);
177 | }
178 |
179 | @Override
180 | public void onAnimationCancel(Animator animation) {
181 | mIsHiding = false;
182 | mCancelled = true;
183 | }
184 |
185 | @Override
186 | public void onAnimationEnd(Animator animation) {
187 | mIsHiding = false;
188 | if (!mCancelled) {
189 | setVisibility(View.GONE);
190 | if (listener != null) {
191 | listener.onHidden(ToolbarButton.this);
192 | }
193 | }
194 | }
195 | });
196 | }
197 | }
198 |
199 | /**
200 | * Behavior designed for use with {@link ToolbarButton} instances. It's main function
201 | * is to show/hide {@link ToolbarButton} views based on the layout they are associated with.
202 | */
203 | public static class Behavior extends CoordinatorLayout.Behavior {
204 | private Rect mTmpRect;
205 |
206 | public Behavior() {
207 | }
208 |
209 | public Behavior(Context context, AttributeSet attrs) {
210 | }
211 |
212 | public boolean layoutDependsOn(CoordinatorLayout parent, ToolbarButton child, View dependency) {
213 | return dependency instanceof AppBarLayout;
214 | }
215 |
216 | public boolean onDependentViewChanged(CoordinatorLayout parent, ToolbarButton child, View dependency) {
217 | if (dependency instanceof AppBarLayout) {
218 | this.updateButtonVisibility(parent, (AppBarLayout) dependency, child);
219 | }
220 |
221 | return false;
222 | }
223 |
224 | private boolean updateButtonVisibility(CoordinatorLayout parent, AppBarLayout appBarLayout, final ToolbarButton child) {
225 | CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) child.getLayoutParams();
226 |
227 | if (lp.getAnchorId() != appBarLayout.getId()) {
228 | // The anchor ID doesn't match the dependency, so we won't automatically
229 | // show/hide the button
230 | return false;
231 | }
232 |
233 | if (mTmpRect == null) {
234 | mTmpRect = new Rect();
235 | }
236 |
237 | final Rect rect = mTmpRect;
238 | CollapsingToolbarHelper.getDescendantRect(parent, appBarLayout, rect);
239 |
240 | // Hide show code logic borrowed from Android Support Library Floating Action Button
241 | if (rect.bottom <= CollapsingToolbarHelper.getMinimumHeightForVisibleOverlappingContent(appBarLayout)) {
242 | child.show();
243 |
244 | // Height should equal toolbar height
245 | // If android:fitsSystemWindows="true" is enabled, add appropriate top margin
246 | final int inset = CollapsingToolbarHelper.getTopInset(appBarLayout);
247 | ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) child.getLayoutParams();
248 | params.topMargin = inset;
249 | params.height = rect.bottom - inset;
250 | child.setLayoutParams(params);
251 |
252 | } else {
253 | child.hide();
254 | }
255 | return true;
256 |
257 | }
258 | }
259 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/app/src/main/java/com/support/android/designlibdemo/Cheeses.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015 The Android Open Source Project
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 | package com.support.android.designlibdemo;
18 |
19 | import java.util.Random;
20 |
21 | public class Cheeses {
22 |
23 | private static final Random RANDOM = new Random();
24 |
25 | public static int getRandomCheeseDrawable() {
26 | switch (RANDOM.nextInt(5)) {
27 | default:
28 | case 0:
29 | return R.drawable.cheese_1;
30 | case 1:
31 | return R.drawable.cheese_2;
32 | case 2:
33 | return R.drawable.cheese_3;
34 | case 3:
35 | return R.drawable.cheese_4;
36 | case 4:
37 | return R.drawable.cheese_5;
38 | }
39 | }
40 |
41 | public static final String[] sCheeseStrings = {
42 | "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi",
43 | "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale",
44 | "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
45 | "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell",
46 | "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc",
47 | "Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss",
48 | "Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon",
49 | "Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase",
50 | "Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese",
51 | "Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy",
52 | "Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille",
53 | "Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore",
54 | "Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)",
55 | "Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves",
56 | "Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur",
57 | "Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon",
58 | "Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin",
59 | "Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)",
60 | "Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine",
61 | "Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza",
62 | "Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)",
63 | "Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta",
64 | "Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie",
65 | "Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat",
66 | "Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano",
67 | "Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain",
68 | "Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou",
69 | "Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar",
70 | "Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno",
71 | "Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack",
72 | "Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper",
73 | "Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)",
74 | "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
75 | "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza",
76 | "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
77 | "Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino",
78 | "Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina",
79 | "Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby",
80 | "Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin",
81 | "Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester",
82 | "Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue",
83 | "Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz",
84 | "Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich",
85 | "Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue",
86 | "Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle",
87 | "Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia",
88 | "Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis",
89 | "Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus",
90 | "Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison",
91 | "Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois",
92 | "Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse",
93 | "Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese",
94 | "Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise",
95 | "Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra",
96 | "Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola",
97 | "Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost",
98 | "Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel",
99 | "Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve",
100 | "Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi",
101 | "Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti",
102 | "Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve",
103 | "Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster",
104 | "Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg",
105 | "Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa",
106 | "Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine",
107 | "Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese",
108 | "Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere",
109 | "La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire",
110 | "Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou",
111 | "Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger",
112 | "Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings",
113 | "Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse",
114 | "Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam",
115 | "Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego",
116 | "Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin",
117 | "Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)",
118 | "Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse",
119 | "Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda",
120 | "Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte",
121 | "Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio",
122 | "Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne",
123 | "Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)",
124 | "Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster",
125 | "Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel",
126 | "Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca",
127 | "Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre",
128 | "Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty",
129 | "Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela",
130 | "Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano",
131 | "Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage",
132 | "Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry",
133 | "Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid",
134 | "Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn",
135 | "Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse",
136 | "Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin",
137 | "Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin",
138 | "Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre",
139 | "Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone",
140 | "Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark",
141 | "Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit",
142 | "Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia",
143 | "Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)",
144 | "Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna",
145 | "Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera",
146 | "Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou",
147 | "Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder",
148 | "Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort",
149 | "Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr",
150 | "Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin",
151 | "Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre",
152 | "Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss",
153 | "Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela",
154 | "Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda",
155 | "Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain",
156 | "Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese",
157 | "Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale",
158 | "Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie",
159 | "Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri",
160 | "Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar",
161 | "Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance",
162 | "Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes",
163 | "Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet",
164 | "Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe",
165 | "Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa",
166 | "Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois",
167 | "Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue",
168 | "Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington",
169 | "Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou",
170 | "Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue",
171 | "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"
172 | };
173 |
174 | }
175 |
--------------------------------------------------------------------------------