├── .gitignore
├── .gitmodules
├── CHANGELOG.md
├── LICENSE.txt
├── README.md
├── art
├── framed_1.png
├── framed_2.png
├── readme_pic big.png
├── readme_pic.png
├── screenshot_1.png
├── screenshot_2.png
└── screenshot_3.png
├── build.gradle
├── extras-actionbarcompat
├── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── ic_launcher-web.png
├── proguard-project.txt
├── res
│ └── layout
│ │ └── gab__frame.xml
└── src
│ └── com
│ └── manuelpeinado
│ └── glassactionbar
│ └── extras
│ └── actionbarcompat
│ └── GlassActionBarHelper.java
├── extras-actionbarsherlock
├── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── ic_launcher-web.png
├── proguard-project.txt
├── res
│ └── layout
│ │ └── gab__frame.xml
└── src
│ └── com
│ └── manuelpeinado
│ └── glassactionbar
│ └── extras
│ └── actionbarsherlock
│ └── GlassActionBarHelper.java
├── gradle.properties
├── library
├── AndroidManifest.xml
├── build.gradle
├── gradle.properties
├── ic_launcher-web.png
├── proguard-project.txt
├── project.properties
├── res
│ └── layout
│ │ └── gab__frame.xml
└── src
│ └── com
│ ├── cyrilmottier
│ └── android
│ │ └── translucentactionbar
│ │ └── NotifyingScrollView.java
│ └── manuelpeinado
│ └── glassactionbar
│ ├── Blur.java
│ ├── BlurTask.java
│ ├── GlassActionBar.java
│ ├── GlassActionBarHelper.java
│ ├── ListViewScrollObserver.java
│ └── Utils.java
├── maven_push.gradle
├── samples-actionbarcompat
├── AndroidManifest.xml
├── build.gradle
├── ic_launcher-web.png
├── proguard-project.txt
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ ├── ab_transparent.9.png
│ │ ├── glass.png
│ │ ├── ic_launcher.png
│ │ ├── new_york_city_1.jpg
│ │ ├── new_york_city_2.jpg
│ │ └── new_york_city_3.jpg
│ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ ├── layout
│ │ ├── activity_changing_content.xml
│ │ ├── activity_fixed_header.xml
│ │ ├── activity_home.xml
│ │ ├── activity_listview.xml
│ │ ├── activity_scrollview.xml
│ │ └── activity_settings.xml
│ ├── menu
│ │ └── main.xml
│ └── values
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── themes.xml
└── src
│ └── com
│ └── manuelpeinado
│ └── glassaction
│ └── samples
│ └── actionbarcompat
│ ├── ActivityInfo.java
│ ├── ChangingContentActivity.java
│ ├── FixedHeaderActivity.java
│ ├── HomeActivity.java
│ ├── ImagesAdapter.java
│ ├── ListViewActivity.java
│ ├── ScrollViewActivity.java
│ └── SettingsActivity.java
├── samples-actionbarsherlock
├── AndroidManifest.xml
├── build.gradle
├── ic_launcher-web.png
├── proguard-project.txt
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ ├── ab_transparent.9.png
│ │ ├── glass.png
│ │ ├── ic_launcher.png
│ │ ├── new_york_city_1.jpg
│ │ ├── new_york_city_2.jpg
│ │ └── new_york_city_3.jpg
│ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ ├── layout
│ │ ├── activity_changing_content.xml
│ │ ├── activity_fixed_header.xml
│ │ ├── activity_home.xml
│ │ ├── activity_listview.xml
│ │ ├── activity_scrollview.xml
│ │ └── activity_settings.xml
│ ├── menu
│ │ └── main.xml
│ └── values
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── themes.xml
└── src
│ └── com
│ └── manuelpeinado
│ └── glassaction
│ └── samples
│ └── actionbarsherlock
│ ├── ActivityInfo.java
│ ├── ChangingContentActivity.java
│ ├── FixedHeaderActivity.java
│ ├── HomeActivity.java
│ ├── ImagesAdapter.java
│ ├── ListViewActivity.java
│ ├── ScrollViewActivity.java
│ └── SettingsActivity.java
├── samples-stock
├── AndroidManifest.xml
├── build.gradle
├── ic_launcher-web.png
├── proguard-project.txt
├── res
│ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ ├── drawable-xhdpi
│ │ ├── ab_transparent.9.png
│ │ ├── glass.png
│ │ ├── ic_launcher.png
│ │ ├── new_york_city_1.jpg
│ │ ├── new_york_city_2.jpg
│ │ └── new_york_city_3.jpg
│ ├── drawable-xxhdpi
│ │ └── ic_launcher.png
│ ├── layout
│ │ ├── activity_changing_content.xml
│ │ ├── activity_fixed_header.xml
│ │ ├── activity_home.xml
│ │ ├── activity_listview.xml
│ │ ├── activity_scrollview.xml
│ │ └── activity_settings.xml
│ ├── menu
│ │ └── main.xml
│ └── values
│ │ ├── strings.xml
│ │ ├── styles.xml
│ │ └── themes.xml
└── src
│ └── com
│ └── manuelpeinado
│ └── glassactionbardemo
│ ├── ActivityInfo.java
│ ├── ChangingContentActivity.java
│ ├── FixedHeaderActivity.java
│ ├── HomeActivity.java
│ ├── ImagesAdapter.java
│ ├── ListViewActivity.java
│ ├── ScrollViewActivity.java
│ └── SettingsActivity.java
└── settings.gradle
/.gitignore:
--------------------------------------------------------------------------------
1 | # built application files
2 | *.apk
3 | *.ap_
4 |
5 | # files for the dex VM
6 | *.dex
7 |
8 | # Java class files
9 | *.class
10 |
11 | # generated files
12 | bin/
13 | gen/
14 |
15 | # Local configuration file (sdk path, etc)
16 | local.properties
17 |
18 | # Eclipse project files
19 | .classpath
20 | .project
21 | project.properties
22 |
23 | # Maven
24 | target
25 | release.properties
26 | pom.xml.*
27 |
28 | # IntelliJ / Android Studio
29 | *.iml
30 | .idea/
31 |
32 | # Gradle
33 | .gradle/
34 | build
35 |
36 | # Folder containing all the Google Play APKs
37 | apks
38 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "thirdParty/actionbarsherlock"]
2 | path = thirdParty/actionbarsherlock
3 | url = git://github.com/JakeWharton/ActionBarSherlock.git
4 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | Change Log
2 | =======================================
3 |
4 | Version 0.3.0 *(2013-10-06)*
5 | ----------------------------
6 |
7 | * Revamped project structure, now all AB types (stock, sherlock, compat) are under the same repo. Stock AB support in in the main library, whereas other types are in the "extras" folder.
8 |
9 | Version 0.2.1 *(2013-07-15)*
10 | ----------------------------
11 |
12 | * Added support for changing content (through the "invalidate" method).
13 | * Handle non-scrollable content in a more efficient manner.
14 | * Fixed bug which prevented transparent content from being blurred properly.
15 | * Many performance optimizations.
16 | * Added possibility of changing the gaussian blur params ("radius" and "downsampling").
17 | * Added support for maven and gradle builds.
18 |
19 | Version 0.1.1 *(2013-06-23)*
20 | ----------------------------
21 | * Important performance optimizations.
22 |
23 | Version 0.1.0 *(2013-06-23)*
24 | ----------------------------
25 | Initial release.
26 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 |
2 | Apache License
3 | Version 2.0, January 2004
4 | http://www.apache.org/licenses/
5 |
6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7 |
8 | 1. Definitions.
9 |
10 | "License" shall mean the terms and conditions for use, reproduction,
11 | and distribution as defined by Sections 1 through 9 of this document.
12 |
13 | "Licensor" shall mean the copyright owner or entity authorized by
14 | the copyright owner that is granting the License.
15 |
16 | "Legal Entity" shall mean the union of the acting entity and all
17 | other entities that control, are controlled by, or are under common
18 | control with that entity. For the purposes of this definition,
19 | "control" means (i) the power, direct or indirect, to cause the
20 | direction or management of such entity, whether by contract or
21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 | outstanding shares, or (iii) beneficial ownership of such entity.
23 |
24 | "You" (or "Your") shall mean an individual or Legal Entity
25 | exercising permissions granted by this License.
26 |
27 | "Source" form shall mean the preferred form for making modifications,
28 | including but not limited to software source code, documentation
29 | source, and configuration files.
30 |
31 | "Object" form shall mean any form resulting from mechanical
32 | transformation or translation of a Source form, including but
33 | not limited to compiled object code, generated documentation,
34 | and conversions to other media types.
35 |
36 | "Work" shall mean the work of authorship, whether in Source or
37 | Object form, made available under the License, as indicated by a
38 | copyright notice that is included in or attached to the work
39 | (an example is provided in the Appendix below).
40 |
41 | "Derivative Works" shall mean any work, whether in Source or Object
42 | form, that is based on (or derived from) the Work and for which the
43 | editorial revisions, annotations, elaborations, or other modifications
44 | represent, as a whole, an original work of authorship. For the purposes
45 | of this License, Derivative Works shall not include works that remain
46 | separable from, or merely link (or bind by name) to the interfaces of,
47 | the Work and Derivative Works thereof.
48 |
49 | "Contribution" shall mean any work of authorship, including
50 | the original version of the Work and any modifications or additions
51 | to that Work or Derivative Works thereof, that is intentionally
52 | submitted to Licensor for inclusion in the Work by the copyright owner
53 | or by an individual or Legal Entity authorized to submit on behalf of
54 | the copyright owner. For the purposes of this definition, "submitted"
55 | means any form of electronic, verbal, or written communication sent
56 | to the Licensor or its representatives, including but not limited to
57 | communication on electronic mailing lists, source code control systems,
58 | and issue tracking systems that are managed by, or on behalf of, the
59 | Licensor for the purpose of discussing and improving the Work, but
60 | excluding communication that is conspicuously marked or otherwise
61 | designated in writing by the copyright owner as "Not a Contribution."
62 |
63 | "Contributor" shall mean Licensor and any individual or Legal Entity
64 | on behalf of whom a Contribution has been received by Licensor and
65 | subsequently incorporated within the Work.
66 |
67 | 2. Grant of Copyright License. Subject to the terms and conditions of
68 | this License, each Contributor hereby grants to You a perpetual,
69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 | copyright license to reproduce, prepare Derivative Works of,
71 | publicly display, publicly perform, sublicense, and distribute the
72 | Work and such Derivative Works in Source or Object form.
73 |
74 | 3. Grant of Patent License. Subject to the terms and conditions of
75 | this License, each Contributor hereby grants to You a perpetual,
76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 | (except as stated in this section) patent license to make, have made,
78 | use, offer to sell, sell, import, and otherwise transfer the Work,
79 | where such license applies only to those patent claims licensable
80 | by such Contributor that are necessarily infringed by their
81 | Contribution(s) alone or by combination of their Contribution(s)
82 | with the Work to which such Contribution(s) was submitted. If You
83 | institute patent litigation against any entity (including a
84 | cross-claim or counterclaim in a lawsuit) alleging that the Work
85 | or a Contribution incorporated within the Work constitutes direct
86 | or contributory patent infringement, then any patent licenses
87 | granted to You under this License for that Work shall terminate
88 | as of the date such litigation is filed.
89 |
90 | 4. Redistribution. You may reproduce and distribute copies of the
91 | Work or Derivative Works thereof in any medium, with or without
92 | modifications, and in Source or Object form, provided that You
93 | meet the following conditions:
94 |
95 | (a) You must give any other recipients of the Work or
96 | Derivative Works a copy of this License; and
97 |
98 | (b) You must cause any modified files to carry prominent notices
99 | stating that You changed the files; and
100 |
101 | (c) You must retain, in the Source form of any Derivative Works
102 | that You distribute, all copyright, patent, trademark, and
103 | attribution notices from the Source form of the Work,
104 | excluding those notices that do not pertain to any part of
105 | the Derivative Works; and
106 |
107 | (d) If the Work includes a "NOTICE" text file as part of its
108 | distribution, then any Derivative Works that You distribute must
109 | include a readable copy of the attribution notices contained
110 | within such NOTICE file, excluding those notices that do not
111 | pertain to any part of the Derivative Works, in at least one
112 | of the following places: within a NOTICE text file distributed
113 | as part of the Derivative Works; within the Source form or
114 | documentation, if provided along with the Derivative Works; or,
115 | within a display generated by the Derivative Works, if and
116 | wherever such third-party notices normally appear. The contents
117 | of the NOTICE file are for informational purposes only and
118 | do not modify the License. You may add Your own attribution
119 | notices within Derivative Works that You distribute, alongside
120 | or as an addendum to the NOTICE text from the Work, provided
121 | that such additional attribution notices cannot be construed
122 | as modifying the License.
123 |
124 | You may add Your own copyright statement to Your modifications and
125 | may provide additional or different license terms and conditions
126 | for use, reproduction, or distribution of Your modifications, or
127 | for any such Derivative Works as a whole, provided Your use,
128 | reproduction, and distribution of the Work otherwise complies with
129 | the conditions stated in this License.
130 |
131 | 5. Submission of Contributions. Unless You explicitly state otherwise,
132 | any Contribution intentionally submitted for inclusion in the Work
133 | by You to the Licensor shall be under the terms and conditions of
134 | this License, without any additional terms or conditions.
135 | Notwithstanding the above, nothing herein shall supersede or modify
136 | the terms of any separate license agreement you may have executed
137 | with Licensor regarding such Contributions.
138 |
139 | 6. Trademarks. This License does not grant permission to use the trade
140 | names, trademarks, service marks, or product names of the Licensor,
141 | except as required for reasonable and customary use in describing the
142 | origin of the Work and reproducing the content of the NOTICE file.
143 |
144 | 7. Disclaimer of Warranty. Unless required by applicable law or
145 | agreed to in writing, Licensor provides the Work (and each
146 | Contributor provides its Contributions) on an "AS IS" BASIS,
147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 | implied, including, without limitation, any warranties or conditions
149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 | PARTICULAR PURPOSE. You are solely responsible for determining the
151 | appropriateness of using or redistributing the Work and assume any
152 | risks associated with Your exercise of permissions under this License.
153 |
154 | 8. Limitation of Liability. In no event and under no legal theory,
155 | whether in tort (including negligence), contract, or otherwise,
156 | unless required by applicable law (such as deliberate and grossly
157 | negligent acts) or agreed to in writing, shall any Contributor be
158 | liable to You for damages, including any direct, indirect, special,
159 | incidental, or consequential damages of any character arising as a
160 | result of this License or out of the use or inability to use the
161 | Work (including but not limited to damages for loss of goodwill,
162 | work stoppage, computer failure or malfunction, or any and all
163 | other commercial damages or losses), even if such Contributor
164 | has been advised of the possibility of such damages.
165 |
166 | 9. Accepting Warranty or Additional Liability. While redistributing
167 | the Work or Derivative Works thereof, You may choose to offer,
168 | and charge a fee for, acceptance of support, warranty, indemnity,
169 | or other liability obligations and/or rights consistent with this
170 | License. However, in accepting such obligations, You may act only
171 | on Your own behalf and on Your sole responsibility, not on behalf
172 | of any other Contributor, and only if You agree to indemnify,
173 | defend, and hold each Contributor harmless for any liability
174 | incurred by, or claims asserted against, such Contributor by reason
175 | of your accepting any such warranty or additional liability.
176 |
177 | END OF TERMS AND CONDITIONS
178 |
179 | APPENDIX: How to apply the Apache License to your work.
180 |
181 | To apply the Apache License to your work, attach the following
182 | boilerplate notice, with the fields enclosed by brackets "[]"
183 | replaced with your own identifying information. (Don't include
184 | the brackets!) The text should be enclosed in the appropriate
185 | comment syntax for the file format. We also recommend that a
186 | file or class name and description of purpose be included on the
187 | same "printed page" as the copyright notice for easier
188 | identification within third-party archives.
189 |
190 | Copyright [yyyy] [name of copyright owner]
191 |
192 | Licensed under the Apache License, Version 2.0 (the "License");
193 | you may not use this file except in compliance with the License.
194 | You may obtain a copy of the License at
195 |
196 | http://www.apache.org/licenses/LICENSE-2.0
197 |
198 | Unless required by applicable law or agreed to in writing, software
199 | distributed under the License is distributed on an "AS IS" BASIS,
200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201 | See the License for the specific language governing permissions and
202 | limitations under the License.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | GlassActionBar
2 | ==================
3 |
4 | GlassActionBar is an Android library which implements a glass-like effect for the action bar.
5 |
6 | The three most commonly used action bar implementations are supported: stock (API >13), ActionBarCompat and ActionBarSherlock.
7 |
8 | The code of this library is based on techniques outlined by Nicolas Pomepuy in [a recent blog post][1].
9 |
10 | ![Example Image][2]
11 |
12 | Try out the sample application:
13 |
14 |
15 |
17 |
18 |
19 | Or browse the [source code of the sample application][3] for a complete example of use.
20 |
21 | Including in your project
22 | -------------------------
23 |
24 | The library is pushed to Maven Central as a AAR, so you just need to add the following dependency to your `build.gradle`.
25 |
26 | dependencies {
27 | compile 'com.github.manuelpeinado.glassactionbar:glassactionbar:0.3.0'
28 | }
29 |
30 | Or if your project doesn't use the stock action bar, but one of the compatibility implementations, you would use the following:
31 |
32 | dependencies {
33 | // Use the following if your project uses ActionBarCompat
34 | compile 'com.github.manuelpeinado.glassactionbar:glassactionbar-abc:0.3.0'
35 | // Or the following if your project uses ActionBarSherlock
36 | compile 'com.github.manuelpeinado.glassactionbar:glassactionbar-abs:0.3.0'
37 | }
38 |
39 | Usage
40 | -----
41 |
42 | Using the library is really simple, just look at the source code of the provided samples:
43 | * [Stock action bar][3].
44 | * [ActionBarCompat][4]
45 | * [ActionBarSherlock][5]
46 |
47 |
48 | Acknowledgements
49 | --------------------
50 |
51 | * Thanks to [Nicolas Pomepuy][1] for sharing the techniques that make this library possible.
52 | * The gaussian blur effect is based on code by [Mario Klingemann][8] which was ported to Android by [Yahel Bouaziz][9].
53 | * NotifyingScrollView class by [Cyril Mottier][10].
54 | * The project organization is heavily inspired by Chris Bane's [ActionBar-PullToRefresh][11] library.
55 | * Cat icon by [Davic Vignoni][12].
56 |
57 | Who's using it
58 | --------------
59 |
60 | *Does your app use GlassActionBar? If you want to be featured on this list drop me a line.*
61 |
62 |
63 | Developed By
64 | --------------------
65 |
66 | Manuel Peinado Gallego -
67 |
68 |
69 |
71 |
72 |
73 |
75 |
76 |
77 |
79 |
80 |
81 | License
82 | -----------
83 |
84 | Copyright 2013 Manuel Peinado
85 |
86 | Licensed under the Apache License, Version 2.0 (the "License");
87 | you may not use this file except in compliance with the License.
88 | You may obtain a copy of the License at
89 |
90 | http://www.apache.org/licenses/LICENSE-2.0
91 |
92 | Unless required by applicable law or agreed to in writing, software
93 | distributed under the License is distributed on an "AS IS" BASIS,
94 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95 | See the License for the specific language governing permissions and
96 | limitations under the License.
97 |
98 |
99 |
100 |
101 | [1]: http://nicolaspomepuy.fr/?p=18
102 | [2]: https://raw.github.com/ManuelPeinado/GlassActionBar/master/art/readme_pic.png
103 | [3]: https://github.com/ManuelPeinado/GlassActionBar/tree/master/samples-stock
104 | [4]: https://github.com/ManuelPeinado/GlassActionBar/tree/master/samples-actionbarcompat
105 | [5]: https://github.com/ManuelPeinado/GlassActionBar/tree/master/extras-actionbarsherlock
106 | [6]: https://github.com/mosabua/maven-android-sdk-deployer
107 | [7]: https://github.com/ManuelPeinado/GlassActionBar/tree/master/samples
108 | [8]: http://www.quasimondo.com/
109 | [9]: https://plus.google.com/107352914145283602089
110 | [10]: http://www.cyrilmottier.com
111 | [11]: https://github.com/chrisbanes/ActionBar-PullToRefresh
112 | [12]: http://www.icon-king.com/
113 |
114 |
--------------------------------------------------------------------------------
/art/framed_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/art/framed_1.png
--------------------------------------------------------------------------------
/art/framed_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/art/framed_2.png
--------------------------------------------------------------------------------
/art/readme_pic big.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/art/readme_pic big.png
--------------------------------------------------------------------------------
/art/readme_pic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/art/readme_pic.png
--------------------------------------------------------------------------------
/art/screenshot_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/art/screenshot_1.png
--------------------------------------------------------------------------------
/art/screenshot_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/art/screenshot_2.png
--------------------------------------------------------------------------------
/art/screenshot_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/art/screenshot_3.png
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 |
6 | dependencies {
7 | classpath 'com.android.tools.build:gradle:0.12.+'
8 | }
9 | }
10 |
11 | def isReleaseBuild() {
12 | return version.contains("SNAPSHOT") == false
13 | }
14 |
15 | allprojects {
16 | version = VERSION_NAME
17 | group = GROUP
18 |
19 | repositories {
20 | mavenCentral()
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/extras-actionbarcompat/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/extras-actionbarcompat/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'android-library'
2 |
3 | dependencies {
4 | compile project(':library')
5 | compile 'com.android.support:appcompat-v7:19.+'
6 | }
7 |
8 | android {
9 | compileSdkVersion 19
10 | buildToolsVersion '19.1'
11 |
12 | sourceSets {
13 | main {
14 | manifest.srcFile 'AndroidManifest.xml'
15 | java.srcDirs = ['src']
16 | res.srcDirs = ['res']
17 | }
18 | }
19 | }
20 |
21 | apply from: '../maven_push.gradle'
22 |
23 |
24 |
--------------------------------------------------------------------------------
/extras-actionbarcompat/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=GlassActionBar Extras: ActionBarCompat
2 | POM_ARTIFACT_ID=glassactionbar-abc
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/extras-actionbarcompat/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/extras-actionbarcompat/ic_launcher-web.png
--------------------------------------------------------------------------------
/extras-actionbarcompat/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/extras-actionbarcompat/res/layout/gab__frame.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/extras-actionbarcompat/src/com/manuelpeinado/glassactionbar/extras/actionbarcompat/GlassActionBarHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbar.extras.actionbarcompat;
17 |
18 | import com.manuelpeinado.glassactionbar.extras.actionbarsherlock.R;
19 |
20 | import android.content.Context;
21 |
22 | public class GlassActionBarHelper extends com.manuelpeinado.glassactionbar.GlassActionBarHelper {
23 | @Override
24 | protected int getActionBarHeight(Context context) {
25 | return context.getResources().getDimensionPixelOffset(R.dimen.abc_action_bar_default_height);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/extras-actionbarsherlock/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/extras-actionbarsherlock/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'android-library'
2 |
3 | dependencies {
4 | compile project(':library')
5 | compile 'com.android.support:support-v4:19.+'
6 | compile ("com.actionbarsherlock:actionbarsherlock:[4.4,)@aar") {
7 | // Need to specifically exclude this as it is specified in ActionBarSherlock pom
8 | exclude group: 'com.google.android', module: 'support-v4'
9 | }
10 | }
11 |
12 | android {
13 | compileSdkVersion 19
14 | buildToolsVersion '19.1'
15 |
16 | sourceSets {
17 | main {
18 | manifest.srcFile 'AndroidManifest.xml'
19 | java.srcDirs = ['src']
20 | res.srcDirs = ['res']
21 | }
22 | }
23 | }
24 |
25 | apply from: '../maven_push.gradle'
26 |
27 |
28 |
--------------------------------------------------------------------------------
/extras-actionbarsherlock/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=GlassActionBar Extras: ActionBarSherlock
2 | POM_ARTIFACT_ID=glassactionbar-abs
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/extras-actionbarsherlock/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/extras-actionbarsherlock/ic_launcher-web.png
--------------------------------------------------------------------------------
/extras-actionbarsherlock/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/extras-actionbarsherlock/res/layout/gab__frame.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
12 |
--------------------------------------------------------------------------------
/extras-actionbarsherlock/src/com/manuelpeinado/glassactionbar/extras/actionbarsherlock/GlassActionBarHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbar.extras.actionbarsherlock;
17 |
18 | import android.content.Context;
19 |
20 | public class GlassActionBarHelper extends com.manuelpeinado.glassactionbar.GlassActionBarHelper {
21 | @Override
22 | protected int getActionBarHeight(Context context) {
23 | return context.getResources().getDimensionPixelOffset(R.dimen.abs__action_bar_default_height);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | VERSION_NAME=0.3.0
2 | VERSION_CODE=30
3 | GROUP=com.github.manuelpeinado.glassactionbar
4 |
5 | POM_DESCRIPTION=A tiny library which adds a glass-like effect to the action bar.
6 | POM_URL=https://github.com/ManuelPeinado/GlassActionBar
7 | POM_SCM_URL=https://github.com/ManuelPeinado/GlassActionBar
8 | POM_SCM_CONNECTION=scm:git@github.com:ManuelPeinado/GlassActionBar.git
9 | POM_SCM_DEV_CONNECTION=scm:git@github.com:ManuelPeinado/GlassActionBar.git
10 | POM_LICENCE_NAME=The Apache Software License, Version 2.0
11 | POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
12 | POM_LICENCE_DIST=repo
13 | POM_DEVELOPER_ID=manuelpeinado
14 | POM_DEVELOPER_NAME=Manuel Peinado
15 |
--------------------------------------------------------------------------------
/library/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'android-library'
2 |
3 |
4 | android {
5 | compileSdkVersion 19
6 | buildToolsVersion '19.1'
7 |
8 | defaultConfig {
9 | targetSdkVersion 19
10 | }
11 |
12 | sourceSets {
13 | main {
14 | manifest.srcFile 'AndroidManifest.xml'
15 | java.srcDirs = ['src']
16 | res.srcDirs = ['res']
17 | }
18 | }
19 |
20 | lintOptions {
21 | abortOnError false
22 | }
23 | }
24 |
25 |
26 | apply from: '../maven_push.gradle'
27 |
28 |
29 |
--------------------------------------------------------------------------------
/library/gradle.properties:
--------------------------------------------------------------------------------
1 | POM_NAME=GlassActionBar
2 | POM_ARTIFACT_ID=glassactionbar
3 | POM_PACKAGING=aar
4 |
--------------------------------------------------------------------------------
/library/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/library/ic_launcher-web.png
--------------------------------------------------------------------------------
/library/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/library/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-18
15 | android.library=true
16 |
--------------------------------------------------------------------------------
/library/res/layout/gab__frame.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
11 |
12 |
--------------------------------------------------------------------------------
/library/src/com/cyrilmottier/android/translucentactionbar/NotifyingScrollView.java:
--------------------------------------------------------------------------------
1 | package com.cyrilmottier.android.translucentactionbar;
2 |
3 | import android.content.Context;
4 | import android.os.Build;
5 | import android.util.AttributeSet;
6 | import android.widget.ScrollView;
7 |
8 | /**
9 | * @author Cyril Mottier with modifications from Manuel Peinado
10 | */
11 | public class NotifyingScrollView extends ScrollView {
12 | // Edge-effects don't mix well with the translucent action bar in Android 2.X
13 | private boolean mDisableEdgeEffects = true;
14 |
15 | /**
16 | * @author Cyril Mottier
17 | */
18 | public interface OnScrollChangedListener {
19 | void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt);
20 | }
21 |
22 | private OnScrollChangedListener mOnScrollChangedListener;
23 |
24 | public NotifyingScrollView(Context context) {
25 | super(context);
26 | }
27 |
28 | public NotifyingScrollView(Context context, AttributeSet attrs) {
29 | super(context, attrs);
30 | }
31 |
32 | public NotifyingScrollView(Context context, AttributeSet attrs, int defStyle) {
33 | super(context, attrs, defStyle);
34 | }
35 |
36 | @Override
37 | protected void onScrollChanged(int l, int t, int oldl, int oldt) {
38 | super.onScrollChanged(l, t, oldl, oldt);
39 | if (mOnScrollChangedListener != null) {
40 | mOnScrollChangedListener.onScrollChanged(this, l, t, oldl, oldt);
41 | }
42 | }
43 |
44 | public void setOnScrollChangedListener(OnScrollChangedListener listener) {
45 | mOnScrollChangedListener = listener;
46 | }
47 |
48 | @Override
49 | protected float getTopFadingEdgeStrength() {
50 | // http://stackoverflow.com/a/6894270/244576
51 | if (mDisableEdgeEffects && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
52 | return 0.0f;
53 | }
54 | return super.getTopFadingEdgeStrength();
55 | }
56 |
57 | @Override
58 | protected float getBottomFadingEdgeStrength() {
59 | // http://stackoverflow.com/a/6894270/244576
60 | if (mDisableEdgeEffects && Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
61 | return 0.0f;
62 | }
63 | return super.getBottomFadingEdgeStrength();
64 | }
65 | }
--------------------------------------------------------------------------------
/library/src/com/manuelpeinado/glassactionbar/Blur.java:
--------------------------------------------------------------------------------
1 | package com.manuelpeinado.glassactionbar;
2 |
3 | import android.annotation.SuppressLint;
4 | import android.content.Context;
5 | import android.graphics.Bitmap;
6 | import android.os.Build.VERSION;
7 | import android.renderscript.Allocation;
8 | import android.renderscript.Element;
9 | import android.renderscript.RenderScript;
10 | import android.renderscript.ScriptIntrinsicBlur;
11 |
12 | // Code borrowed from Nicolas Pomepuy
13 | // https://github.com/PomepuyN/BlurEffectForAndroidDesign
14 | public class Blur {
15 |
16 | public static Bitmap apply(Context context, Bitmap sentBitmap) {
17 | return apply(context, sentBitmap, GlassActionBar.DEFAULT_BLUR_RADIUS);
18 | }
19 |
20 | @SuppressLint("NewApi")
21 | public static Bitmap apply(Context context, Bitmap sentBitmap, int radius) {
22 | if (VERSION.SDK_INT > 16) {
23 | Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
24 |
25 | final RenderScript rs = RenderScript.create(context);
26 | final Allocation input = Allocation.createFromBitmap(rs, sentBitmap, Allocation.MipmapControl.MIPMAP_NONE,
27 | Allocation.USAGE_SCRIPT);
28 | final Allocation output = Allocation.createTyped(rs, input.getType());
29 | final ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
30 | script.setRadius(radius);
31 | script.setInput(input);
32 | script.forEach(output);
33 | output.copyTo(bitmap);
34 | return bitmap;
35 | }
36 |
37 | // Stack Blur v1.0 from
38 | // http://www.quasimondo.com/StackBlurForCanvas/StackBlurDemo.html
39 | //
40 | // Java Author: Mario Klingemann
41 | // http://incubator.quasimondo.com
42 | // created Feburary 29, 2004
43 | // Android port : Yahel Bouaziz
44 | // http://www.kayenko.com
45 | // ported april 5th, 2012
46 |
47 | // This is a compromise between Gaussian Blur and Box blur
48 | // It creates much better looking blurs than Box Blur, but is
49 | // 7x faster than my Gaussian Blur implementation.
50 | //
51 | // I called it Stack Blur because this describes best how this
52 | // filter works internally: it creates a kind of moving stack
53 | // of colors whilst scanning through the image. Thereby it
54 | // just has to add one new block of color to the right side
55 | // of the stack and remove the leftmost color. The remaining
56 | // colors on the topmost layer of the stack are either added on
57 | // or reduced by one, depending on if they are on the right or
58 | // on the left side of the stack.
59 | //
60 | // If you are using this algorithm in your code please add
61 | // the following line:
62 | //
63 | // Stack Blur Algorithm by Mario Klingemann
64 |
65 | Bitmap bitmap = sentBitmap.copy(sentBitmap.getConfig(), true);
66 |
67 | if (radius < 1) {
68 | return (null);
69 | }
70 |
71 | int w = bitmap.getWidth();
72 | int h = bitmap.getHeight();
73 |
74 | int[] pix = new int[w * h];
75 | bitmap.getPixels(pix, 0, w, 0, 0, w, h);
76 |
77 | int wm = w - 1;
78 | int hm = h - 1;
79 | int wh = w * h;
80 | int div = radius + radius + 1;
81 |
82 | int r[] = new int[wh];
83 | int g[] = new int[wh];
84 | int b[] = new int[wh];
85 | int rsum, gsum, bsum, x, y, i, p, yp, yi, yw;
86 | int vmin[] = new int[Math.max(w, h)];
87 |
88 | int divsum = (div + 1) >> 1;
89 | divsum *= divsum;
90 | int dv[] = new int[256 * divsum];
91 | for (i = 0; i < 256 * divsum; i++) {
92 | dv[i] = (i / divsum);
93 | }
94 |
95 | yw = yi = 0;
96 |
97 | int[][] stack = new int[div][3];
98 | int stackpointer;
99 | int stackstart;
100 | int[] sir;
101 | int rbs;
102 | int r1 = radius + 1;
103 | int routsum, goutsum, boutsum;
104 | int rinsum, ginsum, binsum;
105 |
106 | for (y = 0; y < h; y++) {
107 | rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
108 | for (i = -radius; i <= radius; i++) {
109 | p = pix[yi + Math.min(wm, Math.max(i, 0))];
110 | sir = stack[i + radius];
111 | sir[0] = (p & 0xff0000) >> 16;
112 | sir[1] = (p & 0x00ff00) >> 8;
113 | sir[2] = (p & 0x0000ff);
114 | rbs = r1 - Math.abs(i);
115 | rsum += sir[0] * rbs;
116 | gsum += sir[1] * rbs;
117 | bsum += sir[2] * rbs;
118 | if (i > 0) {
119 | rinsum += sir[0];
120 | ginsum += sir[1];
121 | binsum += sir[2];
122 | } else {
123 | routsum += sir[0];
124 | goutsum += sir[1];
125 | boutsum += sir[2];
126 | }
127 | }
128 | stackpointer = radius;
129 |
130 | for (x = 0; x < w; x++) {
131 |
132 | r[yi] = dv[rsum];
133 | g[yi] = dv[gsum];
134 | b[yi] = dv[bsum];
135 |
136 | rsum -= routsum;
137 | gsum -= goutsum;
138 | bsum -= boutsum;
139 |
140 | stackstart = stackpointer - radius + div;
141 | sir = stack[stackstart % div];
142 |
143 | routsum -= sir[0];
144 | goutsum -= sir[1];
145 | boutsum -= sir[2];
146 |
147 | if (y == 0) {
148 | vmin[x] = Math.min(x + radius + 1, wm);
149 | }
150 | p = pix[yw + vmin[x]];
151 |
152 | sir[0] = (p & 0xff0000) >> 16;
153 | sir[1] = (p & 0x00ff00) >> 8;
154 | sir[2] = (p & 0x0000ff);
155 |
156 | rinsum += sir[0];
157 | ginsum += sir[1];
158 | binsum += sir[2];
159 |
160 | rsum += rinsum;
161 | gsum += ginsum;
162 | bsum += binsum;
163 |
164 | stackpointer = (stackpointer + 1) % div;
165 | sir = stack[(stackpointer) % div];
166 |
167 | routsum += sir[0];
168 | goutsum += sir[1];
169 | boutsum += sir[2];
170 |
171 | rinsum -= sir[0];
172 | ginsum -= sir[1];
173 | binsum -= sir[2];
174 |
175 | yi++;
176 | }
177 | yw += w;
178 | }
179 | for (x = 0; x < w; x++) {
180 | rinsum = ginsum = binsum = routsum = goutsum = boutsum = rsum = gsum = bsum = 0;
181 | yp = -radius * w;
182 | for (i = -radius; i <= radius; i++) {
183 | yi = Math.max(0, yp) + x;
184 |
185 | sir = stack[i + radius];
186 |
187 | sir[0] = r[yi];
188 | sir[1] = g[yi];
189 | sir[2] = b[yi];
190 |
191 | rbs = r1 - Math.abs(i);
192 |
193 | rsum += r[yi] * rbs;
194 | gsum += g[yi] * rbs;
195 | bsum += b[yi] * rbs;
196 |
197 | if (i > 0) {
198 | rinsum += sir[0];
199 | ginsum += sir[1];
200 | binsum += sir[2];
201 | } else {
202 | routsum += sir[0];
203 | goutsum += sir[1];
204 | boutsum += sir[2];
205 | }
206 |
207 | if (i < hm) {
208 | yp += w;
209 | }
210 | }
211 | yi = x;
212 | stackpointer = radius;
213 | for (y = 0; y < h; y++) {
214 | // Preserve alpha channel: ( 0xff000000 & pix[yi] )
215 | pix[yi] = (0xff000000 & pix[yi]) | (dv[rsum] << 16) | (dv[gsum] << 8) | dv[bsum];
216 |
217 | rsum -= routsum;
218 | gsum -= goutsum;
219 | bsum -= boutsum;
220 |
221 | stackstart = stackpointer - radius + div;
222 | sir = stack[stackstart % div];
223 |
224 | routsum -= sir[0];
225 | goutsum -= sir[1];
226 | boutsum -= sir[2];
227 |
228 | if (x == 0) {
229 | vmin[y] = Math.min(y + r1, hm) * w;
230 | }
231 | p = x + vmin[y];
232 |
233 | sir[0] = r[p];
234 | sir[1] = g[p];
235 | sir[2] = b[p];
236 |
237 | rinsum += sir[0];
238 | ginsum += sir[1];
239 | binsum += sir[2];
240 |
241 | rsum += rinsum;
242 | gsum += ginsum;
243 | bsum += binsum;
244 |
245 | stackpointer = (stackpointer + 1) % div;
246 | sir = stack[stackpointer];
247 |
248 | routsum += sir[0];
249 | goutsum += sir[1];
250 | boutsum += sir[2];
251 |
252 | rinsum -= sir[0];
253 | ginsum -= sir[1];
254 | binsum -= sir[2];
255 |
256 | yi += w;
257 | }
258 | }
259 |
260 | bitmap.setPixels(pix, 0, w, 0, 0, w, h);
261 | return (bitmap);
262 | }
263 |
264 | }
265 |
--------------------------------------------------------------------------------
/library/src/com/manuelpeinado/glassactionbar/BlurTask.java:
--------------------------------------------------------------------------------
1 | package com.manuelpeinado.glassactionbar;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.os.AsyncTask;
7 | import android.util.Log;
8 |
9 | public class BlurTask {
10 | protected static final String TAG = "BlurTask";
11 | private Bitmap source;
12 | private Canvas canvas;
13 | private AsyncTask task;
14 | private Bitmap blurred;
15 | private Listener listener;
16 | private Context context;
17 | private int radius;
18 |
19 | public interface Listener {
20 | void onBlurOperationFinished();
21 | }
22 |
23 | public BlurTask(Context context, Listener listener, Bitmap source) {
24 | this(context, listener, source, GlassActionBar.DEFAULT_BLUR_RADIUS);
25 | }
26 |
27 | public BlurTask(Context context, Listener listener, Bitmap source, int radius) {
28 | this.context = context;
29 | this.listener = listener;
30 | this.source = source;
31 | this.radius = radius;
32 | canvas = new Canvas(source);
33 | startTask();
34 | }
35 |
36 | private void startTask() {
37 | task = new AsyncTask() {
38 | @Override
39 | protected Void doInBackground(Void... args) {
40 | blurSourceBitmap();
41 | return null;
42 | }
43 |
44 | @Override
45 | protected void onPostExecute(Void result) {
46 | canvas.drawBitmap(blurred, 0, 0, null);
47 | blurred.recycle();
48 | listener.onBlurOperationFinished();
49 | }
50 | };
51 | task.execute();
52 | }
53 |
54 | private void blurSourceBitmap() {
55 | Bitmap section = source;
56 | if (section == null) {
57 | // Probably indicates we've reached the end.
58 | return;
59 | }
60 | long start = System.nanoTime();
61 | blurred = Blur.apply(context, source, radius);
62 | long delta = System.nanoTime() - start;
63 | if (GlassActionBar.verbose) Log.v("BlurTask", "Blurring took " + delta/1e6f + " ms");
64 | }
65 |
66 | public void cancel() {
67 | if (task != null) {
68 | task.cancel(true);
69 | }
70 | task = null;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/library/src/com/manuelpeinado/glassactionbar/GlassActionBar.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbar;
17 |
18 |
19 | public class GlassActionBar {
20 | public static boolean verbose = false;
21 |
22 | public static final int DEFAULT_BLUR_RADIUS = 7;
23 | public static final int MIN_BLUR_RADIUS = 1;
24 | public static final int MAX_BLUR_RADIUS = 20;
25 |
26 | public static final int DEFAULT_DOWNSAMPLING = 5;
27 | public static final int MIN_DOWNSAMPLING = 1;
28 | public static final int MAX_DOWNSAMPLING = 6;
29 |
30 | public static boolean isValidBlurRadius(int value) {
31 | return value >= MIN_BLUR_RADIUS && value <= MAX_BLUR_RADIUS;
32 | }
33 |
34 | public static boolean isValidDownsampling(int value) {
35 | return value >= MIN_DOWNSAMPLING && value <= MAX_DOWNSAMPLING;
36 | }
37 | }
--------------------------------------------------------------------------------
/library/src/com/manuelpeinado/glassactionbar/GlassActionBarHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbar;
17 |
18 | import android.content.Context;
19 | import android.content.res.TypedArray;
20 | import android.graphics.Bitmap;
21 | import android.graphics.drawable.Drawable;
22 | import android.util.Log;
23 | import android.util.TypedValue;
24 | import android.view.LayoutInflater;
25 | import android.view.View;
26 | import android.view.View.MeasureSpec;
27 | import android.view.ViewGroup;
28 | import android.view.ViewGroup.LayoutParams;
29 | import android.view.ViewTreeObserver.OnGlobalLayoutListener;
30 | import android.widget.FrameLayout;
31 | import android.widget.ImageView;
32 | import android.widget.ListAdapter;
33 | import android.widget.ListView;
34 | import android.widget.ScrollView;
35 |
36 | import com.cyrilmottier.android.translucentactionbar.NotifyingScrollView;
37 | import com.cyrilmottier.android.translucentactionbar.NotifyingScrollView.OnScrollChangedListener;
38 | import com.manuelpeinado.glassactionbar.ListViewScrollObserver.OnListViewScrollListener;
39 |
40 | public class GlassActionBarHelper implements OnGlobalLayoutListener, OnScrollChangedListener, BlurTask.Listener, OnListViewScrollListener {
41 | private int contentLayout;
42 | private FrameLayout frame;
43 | private View content;
44 | private ListAdapter adapter;
45 | private ImageView blurredOverlay;
46 | private int actionBarHeight;
47 | private int width;
48 | private int height;
49 | private Bitmap scaled;
50 | private int blurRadius = GlassActionBar.DEFAULT_BLUR_RADIUS;
51 | private BlurTask blurTask;
52 | private int lastScrollPosition = -1;
53 | private NotifyingScrollView scrollView;
54 | private ListView listView;
55 | private int downSampling = GlassActionBar.DEFAULT_DOWNSAMPLING;
56 | private static final String TAG = "GlassActionBarHelper";
57 | private boolean verbose = GlassActionBar.verbose;
58 | private Drawable windowBackground;
59 |
60 | public GlassActionBarHelper contentLayout(int layout) {
61 | this.contentLayout = layout;
62 | return this;
63 | }
64 |
65 | public GlassActionBarHelper contentLayout(int layout, ListAdapter adapter) {
66 | this.contentLayout = layout;
67 | this.adapter = adapter;
68 | return this;
69 | }
70 |
71 | public View createView(Context context) {
72 | int[] attrs = { android.R.attr.windowBackground };
73 |
74 | // Need to get resource id of style pointed to from actionBarStyle
75 | TypedValue outValue = new TypedValue();
76 | context.getTheme().resolveAttribute(android.R.attr.windowBackground, outValue, true);
77 |
78 | TypedArray style = context.getTheme().obtainStyledAttributes(outValue.resourceId, attrs);
79 | windowBackground = style.getDrawable(0);
80 | style.recycle();
81 |
82 | LayoutInflater inflater = LayoutInflater.from(context);
83 | frame = (FrameLayout) inflater.inflate(R.layout.gab__frame, null);
84 | content = inflater.inflate(contentLayout, (ViewGroup) frame, false);
85 | frame.addView(content, 0);
86 |
87 | frame.getViewTreeObserver().addOnGlobalLayoutListener(this);
88 | blurredOverlay = (ImageView) frame.findViewById(R.id.blurredOverlay);
89 |
90 | if (content instanceof NotifyingScrollView) {
91 | if (verbose) Log.v(TAG, "ScrollView content!");
92 | scrollView = (NotifyingScrollView) content;
93 | scrollView.setOnScrollChangedListener(this);
94 | } else if (content instanceof ListView) {
95 | if (verbose) Log.v(TAG, "ListView content!");
96 | listView = (ListView) content;
97 | listView.setAdapter(adapter);
98 | ListViewScrollObserver observer = new ListViewScrollObserver(listView);
99 | observer.setOnScrollUpAndDownListener(this);
100 | }
101 |
102 | actionBarHeight = getActionBarHeight(context);
103 | return frame;
104 | }
105 |
106 | public void invalidate() {
107 | if (verbose) Log.v(TAG, "invalidate()");
108 | scaled = null;
109 | computeBlurOverlay();
110 | updateBlurOverlay(lastScrollPosition, true);
111 | }
112 |
113 | public void setBlurRadius(int newValue) {
114 | if (!GlassActionBar.isValidBlurRadius(newValue)) {
115 | throw new IllegalArgumentException("Invalid blur radius");
116 | }
117 | if (blurRadius == newValue) {
118 | return;
119 | }
120 | blurRadius = newValue;
121 | invalidate();
122 | }
123 |
124 | public int getBlurRadius() {
125 | return blurRadius;
126 | }
127 |
128 | public void setDownsampling(int newValue) {
129 | if (!GlassActionBar.isValidDownsampling(newValue)) {
130 | throw new IllegalArgumentException("Invalid downsampling");
131 | }
132 | if (downSampling == newValue) {
133 | return;
134 | }
135 | downSampling = newValue;
136 | invalidate();
137 | }
138 |
139 | public int getDownsampling() {
140 | return downSampling;
141 | }
142 |
143 | protected int getActionBarHeight(Context context) {
144 | TypedValue outValue = new TypedValue();
145 | context.getTheme().resolveAttribute(android.R.attr.actionBarSize, outValue, true);
146 | return context.getResources().getDimensionPixelSize(outValue.resourceId);
147 | }
148 |
149 | @Override
150 | public void onGlobalLayout() {
151 | if (verbose) Log.v(TAG, "onGlobalLayout()");
152 | if (width != 0) {
153 | if (verbose) Log.v(TAG, "onGlobalLayout() - returning because not first time it's called");
154 | return;
155 | }
156 | int widthMeasureSpec = MeasureSpec.makeMeasureSpec(frame.getWidth(), MeasureSpec.AT_MOST);
157 | int heightMeasureSpec;
158 | if (listView != null) {
159 | heightMeasureSpec = MeasureSpec.makeMeasureSpec(frame.getHeight(), MeasureSpec.EXACTLY);
160 | } else {
161 | heightMeasureSpec = MeasureSpec.makeMeasureSpec(LayoutParams.WRAP_CONTENT, MeasureSpec.UNSPECIFIED);
162 | }
163 | content.measure(widthMeasureSpec, heightMeasureSpec);
164 | width = frame.getWidth();
165 | height = content.getMeasuredHeight();
166 | lastScrollPosition = scrollView != null ? scrollView.getScrollY() : 0;
167 | invalidate();
168 | }
169 |
170 | private void computeBlurOverlay() {
171 | if (verbose) Log.v(TAG, "computeBlurOverlay()");
172 | if (scaled != null) {
173 | if (verbose) Log.v(TAG, "computeBlurOverlay() - returning because scaled is not null");
174 | return;
175 | }
176 | if (verbose) Log.v(TAG, "computeBlurOverlay() - drawing layout to canvas");
177 | int scrollPosition = 0;
178 | if (scrollView != null) {
179 | scrollPosition = scrollView.getScrollY();
180 | if (verbose) Log.v(TAG, "computeBlurOverlay() - scroll position is " + scrollPosition);
181 | }
182 | long start = System.nanoTime();
183 |
184 | scaled = Utils.drawViewToBitmap(scaled, content, width, height, downSampling, windowBackground);
185 |
186 | long delta = System.nanoTime() - start;
187 | if (verbose) Log.v(TAG, "computeBlurOverlay() - drawing layout to canvas took " + delta/1e6f + " ms");
188 |
189 | if (verbose) Log.v(TAG, "computeBlurOverlay() - starting blur task");
190 | startBlurTask();
191 |
192 | if (scrollView != null) {
193 | if (verbose) Log.v(TAG, "computeBlurOverlay() - restoring scroll from " + scrollView.getScrollY() + " to " + scrollPosition);
194 | scrollView.scrollTo(0, scrollPosition);
195 | }
196 | }
197 |
198 | private void startBlurTask() {
199 | if (verbose) Log.v(TAG, "startBlurTask()");
200 | if (blurTask != null) {
201 | if (verbose) Log.v(TAG, "startBlurTask() - task was already running, canceling it");
202 | blurTask.cancel();
203 | }
204 | blurTask = new BlurTask(frame.getContext(), this, scaled, blurRadius);
205 | }
206 |
207 | private void updateBlurOverlay(int top, boolean force) {
208 | if (verbose) Log.v(TAG, "updateBlurOverlay() - top=" + top);
209 |
210 | if (scaled == null) {
211 | if (verbose) Log.v(TAG, "updateBlurOverlay() - returning because scaled is null");
212 | return;
213 | }
214 |
215 | if (top < 0) {
216 | if (verbose) Log.v(TAG, "updateBlurOverlay() - clamping top to 0");
217 | top = 0;
218 | }
219 | if (!force && lastScrollPosition == top) {
220 | if (verbose) Log.v(TAG, "updateBlurOverlay() - returning because scroll position hasn't changed");
221 | return;
222 | }
223 | lastScrollPosition = top;
224 | Bitmap actionBarSection = Bitmap.createBitmap(scaled, 0, top / downSampling, width / downSampling,
225 | actionBarHeight / downSampling);
226 | // Blur here until background finished (will make smooth jerky during the first second or so).
227 | Bitmap blurredBitmap;
228 | if (isBlurTaskFinished()) {
229 | if (verbose) Log.v(TAG, "updateBlurOverlay() - blur task finished, no need to blur content under action bar");
230 | blurredBitmap = actionBarSection;
231 | } else {
232 | if (verbose) Log.v(TAG, "updateBlurOverlay() - blur task not finished, blurring content under action bar");
233 | blurredBitmap = Blur.apply(frame.getContext(), actionBarSection);
234 | }
235 | Bitmap enlarged = Bitmap.createScaledBitmap(blurredBitmap, width, actionBarHeight, false);
236 | blurredBitmap.recycle();
237 | actionBarSection.recycle();
238 | blurredOverlay.setImageBitmap(enlarged);
239 | }
240 |
241 | private boolean isBlurTaskFinished() {
242 | return blurTask == null;
243 | }
244 |
245 | @Override
246 | public void onScrollChanged(ScrollView who, int l, int t, int oldl, int oldt) {
247 | // ScrollView scroll
248 | onNewScroll(t);
249 | }
250 |
251 | @Override
252 | public void onScrollUpDownChanged(int delta, int scrollPosition, boolean exact) {
253 | // ListView scroll
254 | if (verbose) Log.v(TAG, "onScrollUpDownChanged() " + exact);
255 | if (exact) {
256 | onNewScroll(-scrollPosition);
257 | }
258 | }
259 |
260 | private void onNewScroll(int t) {
261 | if (verbose) Log.v(TAG, "onNewScroll() - new scroll position is " + t);
262 | updateBlurOverlay(t, false);
263 | }
264 |
265 | @Override
266 | public void onBlurOperationFinished() {
267 | if (verbose) Log.v(TAG, "onBlurOperationFinished() - blur operation finished");
268 | blurTask = null;
269 | updateBlurOverlay(lastScrollPosition, true);
270 | // Utils.saveToSdCard(scaled, "blurred.png");
271 | }
272 |
273 | @Override
274 | public void onScrollIdle() {
275 | }
276 |
277 | }
--------------------------------------------------------------------------------
/library/src/com/manuelpeinado/glassactionbar/ListViewScrollObserver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbar;
17 |
18 | import android.view.View;
19 | import android.widget.AbsListView;
20 | import android.widget.AbsListView.OnScrollListener;
21 | import android.widget.ListView;
22 |
23 | public class ListViewScrollObserver implements OnScrollListener {
24 | private OnListViewScrollListener listener;
25 | private int lastFirstVisibleItem;
26 | private int lastTop;
27 | private int scrollPosition;
28 | private int lastHeight;
29 |
30 | public interface OnListViewScrollListener {
31 | void onScrollUpDownChanged(int delta, int scrollPosition, boolean exact);
32 | void onScrollIdle();
33 | }
34 |
35 | public ListViewScrollObserver(ListView listView) {
36 | listView.setOnScrollListener(this);
37 | }
38 |
39 | public void setOnScrollUpAndDownListener(OnListViewScrollListener listener) {
40 | this.listener = listener;
41 | }
42 |
43 | @Override
44 | public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
45 | View firstChild = view.getChildAt(0);
46 | if (firstChild == null) {
47 | return;
48 | }
49 | int top = firstChild.getTop();
50 | int height = firstChild.getHeight();
51 | int delta;
52 | int skipped = 0;
53 | if (lastFirstVisibleItem == firstVisibleItem) {
54 | delta = lastTop - top;
55 | } else if (firstVisibleItem > lastFirstVisibleItem) {
56 | skipped = firstVisibleItem - lastFirstVisibleItem - 1;
57 | delta = skipped * height + lastHeight + lastTop - top;
58 | } else {
59 | skipped = lastFirstVisibleItem - firstVisibleItem - 1;
60 | delta = skipped * -height + lastTop - (height + top);
61 | }
62 | boolean exact = skipped == 0;
63 | scrollPosition += -delta;
64 | if (listener != null) {
65 | listener.onScrollUpDownChanged(-delta, scrollPosition, exact);
66 | }
67 | lastFirstVisibleItem = firstVisibleItem;
68 | lastTop = top;
69 | lastHeight = firstChild.getHeight();
70 | }
71 |
72 | @Override
73 | public void onScrollStateChanged(AbsListView view, int scrollState) {
74 | if (listener != null && scrollState == SCROLL_STATE_IDLE) {
75 | listener.onScrollIdle();
76 | }
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/library/src/com/manuelpeinado/glassactionbar/Utils.java:
--------------------------------------------------------------------------------
1 | package com.manuelpeinado.glassactionbar;
2 |
3 | import java.io.ByteArrayOutputStream;
4 | import java.io.File;
5 | import java.io.FileOutputStream;
6 | import java.io.IOException;
7 |
8 | import android.graphics.Bitmap;
9 | import android.graphics.Canvas;
10 | import android.graphics.Rect;
11 | import android.graphics.drawable.Drawable;
12 | import android.os.Environment;
13 | import android.view.View;
14 |
15 | public class Utils {
16 | public static Bitmap drawViewToBitmap(Bitmap dest, View view, int width, int height, int downSampling, Drawable drawable) {
17 | float scale = 1f / downSampling;
18 | int heightCopy = view.getHeight();
19 | view.layout(0, 0, width, height);
20 | int bmpWidth = (int)(width * scale);
21 | int bmpHeight = (int)(height * scale);
22 | if (dest == null || dest.getWidth() != bmpWidth || dest.getHeight() != bmpHeight) {
23 | dest = Bitmap.createBitmap(bmpWidth, bmpHeight, Bitmap.Config.ARGB_8888);
24 | }
25 | Canvas c = new Canvas(dest);
26 | drawable.setBounds(new Rect(0, 0, width, height));
27 | drawable.draw(c);
28 | if (downSampling > 1) {
29 | c.scale(scale, scale);
30 | }
31 | view.draw(c);
32 | view.layout(0, 0, width, heightCopy);
33 | // saveToSdCard(original, "original.png");
34 | return dest;
35 | }
36 |
37 | public static void saveToSdCard(Bitmap bmp, String fileName) {
38 | try {
39 | ByteArrayOutputStream bytes = new ByteArrayOutputStream();
40 | bmp.compress(Bitmap.CompressFormat.JPEG, 40, bytes);
41 |
42 | //you can create a new file name "test.jpg" in sdcard folder.
43 | File f = new File(Environment.getExternalStorageDirectory() + File.separator + fileName);
44 | f.createNewFile();
45 | //write the bytes in file
46 | FileOutputStream fo = new FileOutputStream(f);
47 | fo.write(bytes.toByteArray());
48 |
49 | // remember close de FileOutput
50 | fo.close();
51 | } catch (IOException e) {
52 | // TODO Auto-generated catch block
53 | e.printStackTrace();
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/maven_push.gradle:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2013 Chris Banes
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | apply plugin: 'maven'
18 | apply plugin: 'signing'
19 |
20 | def isReleaseBuild() {
21 | return VERSION_NAME.contains("SNAPSHOT") == false
22 | }
23 |
24 | def getReleaseRepositoryUrl() {
25 | return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL
26 | : "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
27 | }
28 |
29 | def getSnapshotRepositoryUrl() {
30 | return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL
31 | : "https://oss.sonatype.org/content/repositories/snapshots/"
32 | }
33 |
34 | def getRepositoryUsername() {
35 | return hasProperty('NEXUS_USERNAME') ? NEXUS_USERNAME : ""
36 | }
37 |
38 | def getRepositoryPassword() {
39 | return hasProperty('NEXUS_PASSWORD') ? NEXUS_PASSWORD : ""
40 | }
41 |
42 | afterEvaluate { project ->
43 | uploadArchives {
44 | repositories {
45 | mavenDeployer {
46 | beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
47 |
48 | pom.groupId = GROUP
49 | pom.artifactId = POM_ARTIFACT_ID
50 | pom.version = VERSION_NAME
51 |
52 | repository(url: getReleaseRepositoryUrl()) {
53 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
54 | }
55 | snapshotRepository(url: getSnapshotRepositoryUrl()) {
56 | authentication(userName: getRepositoryUsername(), password: getRepositoryPassword())
57 | }
58 |
59 | pom.project {
60 | name POM_NAME
61 | packaging POM_PACKAGING
62 | description POM_DESCRIPTION
63 | url POM_URL
64 |
65 | scm {
66 | url POM_SCM_URL
67 | connection POM_SCM_CONNECTION
68 | developerConnection POM_SCM_DEV_CONNECTION
69 | }
70 |
71 | licenses {
72 | license {
73 | name POM_LICENCE_NAME
74 | url POM_LICENCE_URL
75 | distribution POM_LICENCE_DIST
76 | }
77 | }
78 |
79 | developers {
80 | developer {
81 | id POM_DEVELOPER_ID
82 | name POM_DEVELOPER_NAME
83 | }
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
90 | signing {
91 | required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") }
92 | sign configurations.archives
93 | }
94 |
95 | task androidJavadocs(type: Javadoc) {
96 | source = android.sourceSets.main.java
97 | }
98 |
99 | task androidJavadocsJar(type: Jar, dependsOn: androidJavadocs) {
100 | classifier = 'javadoc'
101 | from androidJavadocs.destinationDir
102 | }
103 |
104 | task androidSourcesJar(type: Jar) {
105 | classifier = 'sources'
106 | from android.sourceSets.main.java
107 | }
108 |
109 | artifacts {
110 | archives androidSourcesJar
111 | archives androidJavadocsJar
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
33 |
37 |
41 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'android'
2 |
3 | dependencies {
4 | compile project(':extras-actionbarcompat')
5 | }
6 |
7 | android {
8 | compileSdkVersion 19
9 | buildToolsVersion '19.1'
10 |
11 | defaultConfig {
12 | versionName project.VERSION_NAME
13 | versionCode Integer.parseInt(project.VERSION_CODE)
14 | }
15 |
16 | sourceSets {
17 | main {
18 | manifest.srcFile 'AndroidManifest.xml'
19 | java.srcDirs = ['src']
20 | res.srcDirs = ['res']
21 | }
22 | }
23 |
24 | lintOptions {
25 | abortOnError false
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/ic_launcher-web.png
--------------------------------------------------------------------------------
/samples-actionbarcompat/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-xhdpi/ab_transparent.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-xhdpi/ab_transparent.9.png
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-xhdpi/glass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-xhdpi/glass.png
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-xhdpi/new_york_city_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-xhdpi/new_york_city_1.jpg
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-xhdpi/new_york_city_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-xhdpi/new_york_city_2.jpg
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-xhdpi/new_york_city_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-xhdpi/new_york_city_3.jpg
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarcompat/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/layout/activity_changing_content.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
17 |
18 |
24 |
25 |
32 |
33 |
40 |
41 |
48 |
49 |
56 |
57 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/layout/activity_fixed_header.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
16 |
17 |
21 |
22 |
28 |
29 |
36 |
37 |
43 |
44 |
51 |
52 |
58 |
59 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/layout/activity_listview.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/layout/activity_scrollview.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
16 |
17 |
24 |
25 |
32 |
33 |
40 |
41 |
48 |
49 |
56 |
57 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
17 |
18 |
24 |
25 |
31 |
32 |
38 |
39 |
45 |
46 |
53 |
54 |
61 |
62 |
69 |
70 |
77 |
78 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | GlassActionBarDemo
5 | Settings
6 | ScrollView sample
7 | Fixed header sample
8 | Changing content sample
9 | ListView sample
10 | Settings sample
11 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
12 |
13 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
12 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/src/com/manuelpeinado/glassaction/samples/actionbarcompat/ActivityInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarcompat;
17 |
18 | import android.app.Activity;
19 |
20 | public class ActivityInfo {
21 | public Class extends Activity> activityClass;
22 | public int titleResourceId;
23 |
24 | public ActivityInfo(Class extends Activity> activityClass, int titleResourceId) {
25 | this.activityClass = activityClass;
26 | this.titleResourceId = titleResourceId;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/src/com/manuelpeinado/glassaction/samples/actionbarcompat/ChangingContentActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarcompat;
17 |
18 | import android.os.Bundle;
19 | import android.support.v7.app.ActionBarActivity;
20 | import android.view.Menu;
21 | import android.view.View;
22 | import android.widget.ImageView;
23 |
24 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
25 | import com.manuelpeinado.glassaction.samples.actionbarcompat.R;
26 |
27 | public class ChangingContentActivity extends ActionBarActivity {
28 |
29 | private GlassActionBarHelper helper;
30 | private ImageView imageView;
31 | private static final int[] IMAGES = {
32 | R.drawable.new_york_city_1,
33 | R.drawable.new_york_city_2,
34 | R.drawable.new_york_city_3
35 | };
36 | private int currentImage = 0;
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 |
42 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_changing_content);
43 | setContentView(helper.createView(this));
44 | imageView = (ImageView) findViewById(R.id.imageView);
45 | }
46 |
47 | public void changeImage(View view) {
48 | imageView.setImageResource(IMAGES[++currentImage % IMAGES.length]);
49 | helper.invalidate();
50 | }
51 |
52 | @Override
53 | public boolean onCreateOptionsMenu(Menu menu) {
54 | getMenuInflater().inflate(R.menu.main, menu);
55 | return true;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/src/com/manuelpeinado/glassaction/samples/actionbarcompat/FixedHeaderActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarcompat;
17 |
18 | import android.os.Bundle;
19 | import android.support.v7.app.ActionBarActivity;
20 | import android.view.Menu;
21 |
22 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
23 | import com.manuelpeinado.glassaction.samples.actionbarcompat.R;
24 |
25 | public class FixedHeaderActivity extends ActionBarActivity {
26 |
27 | private GlassActionBarHelper helper;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 |
33 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_fixed_header);
34 | setContentView(helper.createView(this));
35 | }
36 |
37 | @Override
38 | public boolean onCreateOptionsMenu(Menu menu) {
39 | getMenuInflater().inflate(R.menu.main, menu);
40 | return true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/src/com/manuelpeinado/glassaction/samples/actionbarcompat/HomeActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarcompat;
17 |
18 | import java.util.Arrays;
19 | import java.util.List;
20 |
21 | import android.app.Activity;
22 | import android.app.ListActivity;
23 | import android.content.Intent;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.ArrayAdapter;
27 | import android.widget.ListView;
28 | import com.manuelpeinado.glassaction.samples.actionbarcompat.R;
29 |
30 | public class HomeActivity extends ListActivity {
31 | private List activitiesInfo = Arrays.asList(
32 | new ActivityInfo(ScrollViewActivity.class, R.string.activity_title_scrollview),
33 | new ActivityInfo(FixedHeaderActivity.class, R.string.activity_title_fixed_header),
34 | new ActivityInfo(ChangingContentActivity.class, R.string.activity_title_changing_content),
35 | //new ActivityInfo(ListViewActivity.class, R.string.activity_title_listview),
36 | new ActivityInfo(SettingsActivity.class, R.string.activity_title_settings));
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_home);
42 | String[] titles = getActivityTitles();
43 | setListAdapter(new ArrayAdapter(
44 | this, android.R.layout.simple_list_item_1, android.R.id.text1, titles));
45 | }
46 |
47 | @Override
48 | protected void onListItemClick(ListView l, View v, int position, long id) {
49 | Class extends Activity> class_ = activitiesInfo.get(position).activityClass;
50 | Intent intent = new Intent(this, class_);
51 | startActivity(intent);
52 | }
53 |
54 | private String[] getActivityTitles() {
55 | String[] result = new String[activitiesInfo.size()];
56 | int i = 0;
57 | for (ActivityInfo info : activitiesInfo) {
58 | result[i++] = getString(info.titleResourceId);
59 | }
60 | return result;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/src/com/manuelpeinado/glassaction/samples/actionbarcompat/ImagesAdapter.java:
--------------------------------------------------------------------------------
1 | package com.manuelpeinado.glassaction.samples.actionbarcompat;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.Drawable;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import com.manuelpeinado.glassaction.samples.actionbarcompat.R;
10 |
11 |
12 | public class ImagesAdapter extends BaseAdapter {
13 | private Drawable drawable;
14 |
15 | public ImagesAdapter(Context context) {
16 | drawable = context.getResources().getDrawable(R.drawable.new_york_city_1);
17 | }
18 |
19 |
20 | @Override
21 | public int getCount() {
22 | return 10;
23 | }
24 |
25 | @Override
26 | public Drawable getItem(int position) {
27 | return drawable;
28 | }
29 |
30 | @Override
31 | public long getItemId(int position) {
32 | return position;
33 | }
34 |
35 | @Override
36 | public View getView(int position, View convertView, ViewGroup parent) {
37 | if (convertView == null) {
38 | convertView = new ImageView(parent.getContext());
39 | }
40 | ImageView imageView = (ImageView) convertView;
41 | imageView.setImageDrawable(getItem(position));
42 | return imageView;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/src/com/manuelpeinado/glassaction/samples/actionbarcompat/ListViewActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarcompat;
17 |
18 | import android.os.Bundle;
19 | import android.support.v7.app.ActionBarActivity;
20 | import android.view.Menu;
21 | import android.widget.ListAdapter;
22 |
23 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
24 | import com.manuelpeinado.glassaction.samples.actionbarcompat.R;
25 |
26 | public class ListViewActivity extends ActionBarActivity {
27 |
28 | private GlassActionBarHelper helper;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 |
34 | ListAdapter adapter = new ImagesAdapter(this);
35 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_listview, adapter);
36 | setContentView(helper.createView(this));
37 | }
38 |
39 | @Override
40 | public boolean onCreateOptionsMenu(Menu menu) {
41 | getMenuInflater().inflate(R.menu.main, menu);
42 | return true;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/src/com/manuelpeinado/glassaction/samples/actionbarcompat/ScrollViewActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarcompat;
17 |
18 | import android.os.Bundle;
19 | import android.support.v7.app.ActionBarActivity;
20 | import android.view.Menu;
21 |
22 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
23 | import com.manuelpeinado.glassaction.samples.actionbarcompat.R;
24 |
25 | public class ScrollViewActivity extends ActionBarActivity {
26 |
27 | private GlassActionBarHelper helper;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 |
33 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_scrollview);
34 | setContentView(helper.createView(this));
35 | }
36 |
37 | @Override
38 | public boolean onCreateOptionsMenu(Menu menu) {
39 | getMenuInflater().inflate(R.menu.main, menu);
40 | return true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples-actionbarcompat/src/com/manuelpeinado/glassaction/samples/actionbarcompat/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarcompat;
17 |
18 | import android.os.Bundle;
19 | import android.support.v7.app.ActionBarActivity;
20 | import android.view.Menu;
21 | import android.widget.SeekBar;
22 | import android.widget.SeekBar.OnSeekBarChangeListener;
23 | import android.widget.TextView;
24 |
25 | import com.manuelpeinado.glassactionbar.GlassActionBar;
26 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
27 | import com.manuelpeinado.glassaction.samples.actionbarcompat.R;
28 |
29 | public class SettingsActivity extends ActionBarActivity implements OnSeekBarChangeListener {
30 |
31 | private GlassActionBarHelper helper;
32 | private SeekBar radiusSeekBar;
33 | private TextView radiusTextView;
34 | private SeekBar downsamplingSeekBar;
35 | private TextView downsamplingTextView;
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 |
41 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_settings);
42 | setContentView(helper.createView(this));
43 |
44 | radiusSeekBar = (SeekBar) findViewById(R.id.radiusSeekBar);
45 | radiusSeekBar.setOnSeekBarChangeListener(this);
46 | radiusTextView = (TextView) findViewById(R.id.radiusTextView);
47 | initializeRadiusSeekBar();
48 | updateRadiusTextView();
49 |
50 | downsamplingSeekBar = (SeekBar) findViewById(R.id.downsamplingSeekBar);
51 | downsamplingSeekBar.setOnSeekBarChangeListener(this);
52 | downsamplingTextView = (TextView) findViewById(R.id.downsamplingTextView);
53 | initializeDownsamplingSeekBar();
54 | updateDownsamplingTextView();
55 | }
56 |
57 | private void initializeRadiusSeekBar() {
58 | setSeekBarValue(radiusSeekBar, helper.getBlurRadius(), GlassActionBar.MIN_BLUR_RADIUS, GlassActionBar.MAX_BLUR_RADIUS);
59 | }
60 |
61 | private void updateRadiusTextView() {
62 | int radius = helper.getBlurRadius();
63 | radiusTextView.setText("Blur radius=" + radius);
64 | }
65 |
66 | private void initializeDownsamplingSeekBar() {
67 | setSeekBarValue(downsamplingSeekBar, helper.getDownsampling(), GlassActionBar.MIN_DOWNSAMPLING, GlassActionBar.MAX_DOWNSAMPLING);
68 | }
69 |
70 | private void updateDownsamplingTextView() {
71 | downsamplingTextView.setText("Downsampling=" + helper.getDownsampling());
72 | }
73 |
74 | @Override
75 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
76 | if (seekBar == radiusSeekBar) {
77 | float value = transformSeekBarValue(seekBar, GlassActionBar.MIN_BLUR_RADIUS, GlassActionBar.MAX_BLUR_RADIUS);
78 | helper.setBlurRadius(Math.round(value));
79 | updateRadiusTextView();
80 | } else {
81 | float value = transformSeekBarValue(seekBar, GlassActionBar.MIN_DOWNSAMPLING, GlassActionBar.MAX_DOWNSAMPLING);
82 | helper.setDownsampling(Math.round(value));
83 | updateDownsamplingTextView();
84 | }
85 | }
86 |
87 | private static void setSeekBarValue(SeekBar seekBar, float value, float min, float max) {
88 | float span = max - min;
89 | value = (value - min) / span;
90 | seekBar.setProgress(Math.round(value * seekBar.getMax()));
91 | }
92 |
93 | private static float transformSeekBarValue(SeekBar seekBar, int min, int max) {
94 | float value = seekBar.getProgress() / (float) seekBar.getMax();
95 | float span = max - min;
96 | return min + value * span;
97 | }
98 |
99 | @Override
100 | public boolean onCreateOptionsMenu(Menu menu) {
101 | getMenuInflater().inflate(R.menu.main, menu);
102 | return true;
103 | }
104 |
105 | @Override
106 | public void onStartTrackingTouch(SeekBar seekBar) {
107 | }
108 |
109 | @Override
110 | public void onStopTrackingTouch(SeekBar seekBar) {
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
33 |
37 |
41 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'android'
2 |
3 | dependencies {
4 | compile project(':extras-actionbarsherlock')
5 | }
6 |
7 | android {
8 | compileSdkVersion 19
9 | buildToolsVersion '19.1'
10 |
11 | defaultConfig {
12 | versionName project.VERSION_NAME
13 | versionCode Integer.parseInt(project.VERSION_CODE)
14 | }
15 |
16 | sourceSets {
17 | main {
18 | manifest.srcFile 'AndroidManifest.xml'
19 | java.srcDirs = ['src']
20 | res.srcDirs = ['res']
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/ic_launcher-web.png
--------------------------------------------------------------------------------
/samples-actionbarsherlock/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-xhdpi/ab_transparent.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-xhdpi/ab_transparent.9.png
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-xhdpi/glass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-xhdpi/glass.png
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-xhdpi/new_york_city_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-xhdpi/new_york_city_1.jpg
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-xhdpi/new_york_city_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-xhdpi/new_york_city_2.jpg
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-xhdpi/new_york_city_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-xhdpi/new_york_city_3.jpg
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-actionbarsherlock/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/layout/activity_changing_content.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
17 |
18 |
24 |
25 |
32 |
33 |
40 |
41 |
48 |
49 |
56 |
57 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/layout/activity_fixed_header.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
16 |
17 |
21 |
22 |
28 |
29 |
36 |
37 |
43 |
44 |
51 |
52 |
58 |
59 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/layout/activity_listview.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/layout/activity_scrollview.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
16 |
17 |
24 |
25 |
32 |
33 |
40 |
41 |
48 |
49 |
56 |
57 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
17 |
18 |
24 |
25 |
31 |
32 |
38 |
39 |
45 |
46 |
53 |
54 |
61 |
62 |
69 |
70 |
77 |
78 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | GlassActionBarDemo
5 | Settings
6 | ScrollView sample
7 | Fixed header sample
8 | Changing content sample
9 | ListView sample
10 | Settings sample
11 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
12 |
13 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
12 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/src/com/manuelpeinado/glassaction/samples/actionbarsherlock/ActivityInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarsherlock;
17 |
18 | import android.app.Activity;
19 |
20 | public class ActivityInfo {
21 | public Class extends Activity> activityClass;
22 | public int titleResourceId;
23 |
24 | public ActivityInfo(Class extends Activity> activityClass, int titleResourceId) {
25 | this.activityClass = activityClass;
26 | this.titleResourceId = titleResourceId;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/src/com/manuelpeinado/glassaction/samples/actionbarsherlock/ChangingContentActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarsherlock;
17 |
18 | import android.os.Bundle;
19 | import android.view.View;
20 | import android.widget.ImageView;
21 |
22 | import com.actionbarsherlock.app.SherlockActivity;
23 | import com.actionbarsherlock.view.Menu;
24 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
25 | import com.manuelpeinado.glassactionbar.samples.actionbarsherlock.R;
26 |
27 | public class ChangingContentActivity extends SherlockActivity {
28 |
29 | private GlassActionBarHelper helper;
30 | private ImageView imageView;
31 | private static final int[] IMAGES = {
32 | R.drawable.new_york_city_1,
33 | R.drawable.new_york_city_2,
34 | R.drawable.new_york_city_3
35 | };
36 | private int currentImage = 0;
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 |
42 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_changing_content);
43 | setContentView(helper.createView(this));
44 | imageView = (ImageView) findViewById(R.id.imageView);
45 | }
46 |
47 | public void changeImage(View view) {
48 | imageView.setImageResource(IMAGES[++currentImage % IMAGES.length]);
49 | helper.invalidate();
50 | }
51 |
52 | @Override
53 | public boolean onCreateOptionsMenu(Menu menu) {
54 | getSupportMenuInflater().inflate(R.menu.main, menu);
55 | return true;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/src/com/manuelpeinado/glassaction/samples/actionbarsherlock/FixedHeaderActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarsherlock;
17 |
18 | import android.os.Bundle;
19 |
20 | import com.actionbarsherlock.app.SherlockActivity;
21 | import com.actionbarsherlock.view.Menu;
22 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
23 | import com.manuelpeinado.glassactionbar.samples.actionbarsherlock.R;
24 |
25 | public class FixedHeaderActivity extends SherlockActivity {
26 |
27 | private GlassActionBarHelper helper;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 |
33 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_fixed_header);
34 | setContentView(helper.createView(this));
35 | }
36 |
37 | @Override
38 | public boolean onCreateOptionsMenu(Menu menu) {
39 | getSupportMenuInflater().inflate(R.menu.main, menu);
40 | return true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/src/com/manuelpeinado/glassaction/samples/actionbarsherlock/HomeActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarsherlock;
17 |
18 | import java.util.Arrays;
19 | import java.util.List;
20 |
21 | import android.app.Activity;
22 | import android.app.ListActivity;
23 | import android.content.Intent;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.ArrayAdapter;
27 | import android.widget.ListView;
28 | import com.manuelpeinado.glassactionbar.samples.actionbarsherlock.R;
29 |
30 | public class HomeActivity extends ListActivity {
31 | private List activitiesInfo = Arrays.asList(
32 | new ActivityInfo(ScrollViewActivity.class, R.string.activity_title_scrollview),
33 | new ActivityInfo(FixedHeaderActivity.class, R.string.activity_title_fixed_header),
34 | new ActivityInfo(ChangingContentActivity.class, R.string.activity_title_changing_content),
35 | //new ActivityInfo(ListViewActivity.class, R.string.activity_title_listview),
36 | new ActivityInfo(SettingsActivity.class, R.string.activity_title_settings));
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_home);
42 | String[] titles = getActivityTitles();
43 | setListAdapter(new ArrayAdapter(
44 | this, android.R.layout.simple_list_item_1, android.R.id.text1, titles));
45 | }
46 |
47 | @Override
48 | protected void onListItemClick(ListView l, View v, int position, long id) {
49 | Class extends Activity> class_ = activitiesInfo.get(position).activityClass;
50 | Intent intent = new Intent(this, class_);
51 | startActivity(intent);
52 | }
53 |
54 | private String[] getActivityTitles() {
55 | String[] result = new String[activitiesInfo.size()];
56 | int i = 0;
57 | for (ActivityInfo info : activitiesInfo) {
58 | result[i++] = getString(info.titleResourceId);
59 | }
60 | return result;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/src/com/manuelpeinado/glassaction/samples/actionbarsherlock/ImagesAdapter.java:
--------------------------------------------------------------------------------
1 | package com.manuelpeinado.glassaction.samples.actionbarsherlock;
2 |
3 | import android.content.Context;
4 | import android.graphics.drawable.Drawable;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 | import android.widget.BaseAdapter;
8 | import android.widget.ImageView;
9 | import com.manuelpeinado.glassactionbar.samples.actionbarsherlock.R;
10 |
11 |
12 | public class ImagesAdapter extends BaseAdapter {
13 | private Drawable drawable;
14 |
15 | public ImagesAdapter(Context context) {
16 | drawable = context.getResources().getDrawable(R.drawable.new_york_city_1);
17 | }
18 |
19 |
20 | @Override
21 | public int getCount() {
22 | return 10;
23 | }
24 |
25 | @Override
26 | public Drawable getItem(int position) {
27 | return drawable;
28 | }
29 |
30 | @Override
31 | public long getItemId(int position) {
32 | return position;
33 | }
34 |
35 | @Override
36 | public View getView(int position, View convertView, ViewGroup parent) {
37 | if (convertView == null) {
38 | convertView = new ImageView(parent.getContext());
39 | }
40 | ImageView imageView = (ImageView) convertView;
41 | imageView.setImageDrawable(getItem(position));
42 | return imageView;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/src/com/manuelpeinado/glassaction/samples/actionbarsherlock/ListViewActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarsherlock;
17 |
18 | import android.os.Bundle;
19 | import android.widget.ListAdapter;
20 |
21 | import com.actionbarsherlock.app.SherlockActivity;
22 | import com.actionbarsherlock.view.Menu;
23 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
24 | import com.manuelpeinado.glassactionbar.samples.actionbarsherlock.R;
25 |
26 | public class ListViewActivity extends SherlockActivity {
27 |
28 | private GlassActionBarHelper helper;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 |
34 | ListAdapter adapter = new ImagesAdapter(this);
35 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_listview, adapter);
36 | setContentView(helper.createView(this));
37 | }
38 |
39 | @Override
40 | public boolean onCreateOptionsMenu(Menu menu) {
41 | getSupportMenuInflater().inflate(R.menu.main, menu);
42 | return true;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/src/com/manuelpeinado/glassaction/samples/actionbarsherlock/ScrollViewActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarsherlock;
17 |
18 | import android.os.Bundle;
19 |
20 | import com.actionbarsherlock.app.SherlockActivity;
21 | import com.actionbarsherlock.view.Menu;
22 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
23 | import com.manuelpeinado.glassactionbar.samples.actionbarsherlock.R;
24 |
25 | public class ScrollViewActivity extends SherlockActivity {
26 |
27 | private GlassActionBarHelper helper;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 |
33 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_scrollview);
34 | setContentView(helper.createView(this));
35 | }
36 |
37 | @Override
38 | public boolean onCreateOptionsMenu(Menu menu) {
39 | getSupportMenuInflater().inflate(R.menu.main, menu);
40 | return true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples-actionbarsherlock/src/com/manuelpeinado/glassaction/samples/actionbarsherlock/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassaction.samples.actionbarsherlock;
17 |
18 | import android.os.Bundle;
19 | import android.widget.SeekBar;
20 | import android.widget.SeekBar.OnSeekBarChangeListener;
21 | import android.widget.TextView;
22 |
23 | import com.actionbarsherlock.app.SherlockActivity;
24 | import com.actionbarsherlock.view.Menu;
25 | import com.manuelpeinado.glassactionbar.GlassActionBar;
26 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
27 | import com.manuelpeinado.glassactionbar.samples.actionbarsherlock.R;
28 |
29 | public class SettingsActivity extends SherlockActivity implements OnSeekBarChangeListener {
30 |
31 | private GlassActionBarHelper helper;
32 | private SeekBar radiusSeekBar;
33 | private TextView radiusTextView;
34 | private SeekBar downsamplingSeekBar;
35 | private TextView downsamplingTextView;
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 |
41 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_settings);
42 | setContentView(helper.createView(this));
43 |
44 | radiusSeekBar = (SeekBar) findViewById(R.id.radiusSeekBar);
45 | radiusSeekBar.setOnSeekBarChangeListener(this);
46 | radiusTextView = (TextView) findViewById(R.id.radiusTextView);
47 | initializeRadiusSeekBar();
48 | updateRadiusTextView();
49 |
50 | downsamplingSeekBar = (SeekBar) findViewById(R.id.downsamplingSeekBar);
51 | downsamplingSeekBar.setOnSeekBarChangeListener(this);
52 | downsamplingTextView = (TextView) findViewById(R.id.downsamplingTextView);
53 | initializeDownsamplingSeekBar();
54 | updateDownsamplingTextView();
55 | }
56 |
57 | private void initializeRadiusSeekBar() {
58 | setSeekBarValue(radiusSeekBar, helper.getBlurRadius(), GlassActionBar.MIN_BLUR_RADIUS, GlassActionBar.MAX_BLUR_RADIUS);
59 | }
60 |
61 | private void updateRadiusTextView() {
62 | int radius = helper.getBlurRadius();
63 | radiusTextView.setText("Blur radius=" + radius);
64 | }
65 |
66 | private void initializeDownsamplingSeekBar() {
67 | setSeekBarValue(downsamplingSeekBar, helper.getDownsampling(), GlassActionBar.MIN_DOWNSAMPLING, GlassActionBar.MAX_DOWNSAMPLING);
68 | }
69 |
70 | private void updateDownsamplingTextView() {
71 | downsamplingTextView.setText("Downsampling=" + helper.getDownsampling());
72 | }
73 |
74 | @Override
75 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
76 | if (seekBar == radiusSeekBar) {
77 | float value = transformSeekBarValue(seekBar, GlassActionBar.MIN_BLUR_RADIUS, GlassActionBar.MAX_BLUR_RADIUS);
78 | helper.setBlurRadius(Math.round(value));
79 | updateRadiusTextView();
80 | } else {
81 | float value = transformSeekBarValue(seekBar, GlassActionBar.MIN_DOWNSAMPLING, GlassActionBar.MAX_DOWNSAMPLING);
82 | helper.setDownsampling(Math.round(value));
83 | updateDownsamplingTextView();
84 | }
85 | }
86 |
87 | private static void setSeekBarValue(SeekBar seekBar, float value, float min, float max) {
88 | float span = max - min;
89 | value = (value - min) / span;
90 | seekBar.setProgress(Math.round(value * seekBar.getMax()));
91 | }
92 |
93 | private static float transformSeekBarValue(SeekBar seekBar, int min, int max) {
94 | float value = seekBar.getProgress() / (float) seekBar.getMax();
95 | float span = max - min;
96 | return min + value * span;
97 | }
98 |
99 | @Override
100 | public boolean onCreateOptionsMenu(Menu menu) {
101 | getSupportMenuInflater().inflate(R.menu.main, menu);
102 | return true;
103 | }
104 |
105 | @Override
106 | public void onStartTrackingTouch(SeekBar seekBar) {
107 | }
108 |
109 | @Override
110 | public void onStopTrackingTouch(SeekBar seekBar) {
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/samples-stock/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
8 |
9 |
10 |
11 |
16 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
29 |
33 |
37 |
41 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/samples-stock/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'android'
2 |
3 | dependencies {
4 | compile project(':library')
5 | }
6 |
7 | android {
8 | compileSdkVersion 19
9 | buildToolsVersion '19.1'
10 |
11 | defaultConfig {
12 | versionName project.VERSION_NAME
13 | versionCode Integer.parseInt(project.VERSION_CODE)
14 | }
15 |
16 | sourceSets {
17 | main {
18 | manifest.srcFile 'AndroidManifest.xml'
19 | java.srcDirs = ['src']
20 | res.srcDirs = ['res']
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/samples-stock/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/ic_launcher-web.png
--------------------------------------------------------------------------------
/samples-stock/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/samples-stock/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-stock/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-stock/res/drawable-xhdpi/ab_transparent.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-xhdpi/ab_transparent.9.png
--------------------------------------------------------------------------------
/samples-stock/res/drawable-xhdpi/glass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-xhdpi/glass.png
--------------------------------------------------------------------------------
/samples-stock/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-stock/res/drawable-xhdpi/new_york_city_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-xhdpi/new_york_city_1.jpg
--------------------------------------------------------------------------------
/samples-stock/res/drawable-xhdpi/new_york_city_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-xhdpi/new_york_city_2.jpg
--------------------------------------------------------------------------------
/samples-stock/res/drawable-xhdpi/new_york_city_3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-xhdpi/new_york_city_3.jpg
--------------------------------------------------------------------------------
/samples-stock/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ManuelPeinado/GlassActionBar/092cc2ed51af568531cc32c3989e21664165ef8e/samples-stock/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/samples-stock/res/layout/activity_changing_content.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
17 |
18 |
24 |
25 |
32 |
33 |
40 |
41 |
48 |
49 |
56 |
57 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/samples-stock/res/layout/activity_fixed_header.xml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
12 |
13 |
16 |
17 |
21 |
22 |
28 |
29 |
36 |
37 |
43 |
44 |
51 |
52 |
58 |
59 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/samples-stock/res/layout/activity_home.xml:
--------------------------------------------------------------------------------
1 |
6 |
--------------------------------------------------------------------------------
/samples-stock/res/layout/activity_listview.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/samples-stock/res/layout/activity_scrollview.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
16 |
17 |
24 |
25 |
32 |
33 |
40 |
41 |
48 |
49 |
56 |
57 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/samples-stock/res/layout/activity_settings.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
9 |
10 |
17 |
18 |
24 |
25 |
31 |
32 |
38 |
39 |
45 |
46 |
53 |
54 |
61 |
62 |
69 |
70 |
77 |
78 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/samples-stock/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/samples-stock/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | GlassActionBarDemo
5 | Settings
6 | ScrollView sample
7 | Fixed header sample
8 | Changing content sample
9 | ListView sample
10 | Settings sample
11 | Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.
12 |
13 |
--------------------------------------------------------------------------------
/samples-stock/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
--------------------------------------------------------------------------------
/samples-stock/res/values/themes.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
5 |
6 |
10 |
--------------------------------------------------------------------------------
/samples-stock/src/com/manuelpeinado/glassactionbardemo/ActivityInfo.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbardemo;
17 |
18 | import android.app.Activity;
19 |
20 | public class ActivityInfo {
21 | public Class extends Activity> activityClass;
22 | public int titleResourceId;
23 |
24 | public ActivityInfo(Class extends Activity> activityClass, int titleResourceId) {
25 | this.activityClass = activityClass;
26 | this.titleResourceId = titleResourceId;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples-stock/src/com/manuelpeinado/glassactionbardemo/ChangingContentActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbardemo;
17 |
18 | import android.app.Activity;
19 | import android.os.Bundle;
20 | import android.view.Menu;
21 | import android.view.View;
22 | import android.widget.ImageView;
23 |
24 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
25 | import com.manuelpeinado.glassactionbar.samples.stock.R;
26 |
27 | public class ChangingContentActivity extends Activity {
28 |
29 | private GlassActionBarHelper helper;
30 | private ImageView imageView;
31 | private static final int[] IMAGES = {
32 | R.drawable.new_york_city_1,
33 | R.drawable.new_york_city_2,
34 | R.drawable.new_york_city_3
35 | };
36 | private int currentImage = 0;
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 |
42 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_changing_content);
43 | setContentView(helper.createView(this));
44 | imageView = (ImageView) findViewById(R.id.imageView);
45 | }
46 |
47 | public void changeImage(View view) {
48 | imageView.setImageResource(IMAGES[++currentImage % IMAGES.length]);
49 | helper.invalidate();
50 | }
51 |
52 | @Override
53 | public boolean onCreateOptionsMenu(Menu menu) {
54 | getMenuInflater().inflate(R.menu.main, menu);
55 | return true;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/samples-stock/src/com/manuelpeinado/glassactionbardemo/FixedHeaderActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbardemo;
17 |
18 | import android.app.Activity;
19 | import android.os.Bundle;
20 | import android.view.Menu;
21 |
22 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
23 | import com.manuelpeinado.glassactionbar.samples.stock.R;
24 |
25 | public class FixedHeaderActivity extends Activity {
26 |
27 | private GlassActionBarHelper helper;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 |
33 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_fixed_header);
34 | setContentView(helper.createView(this));
35 | }
36 |
37 | @Override
38 | public boolean onCreateOptionsMenu(Menu menu) {
39 | getMenuInflater().inflate(R.menu.main, menu);
40 | return true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples-stock/src/com/manuelpeinado/glassactionbardemo/HomeActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbardemo;
17 |
18 | import java.util.Arrays;
19 | import java.util.List;
20 |
21 | import android.app.Activity;
22 | import android.app.ListActivity;
23 | import android.content.Intent;
24 | import android.os.Bundle;
25 | import android.view.View;
26 | import android.widget.ArrayAdapter;
27 | import android.widget.ListView;
28 | import com.manuelpeinado.glassactionbar.samples.stock.R;
29 |
30 | public class HomeActivity extends ListActivity {
31 | private List activitiesInfo = Arrays.asList(
32 | new ActivityInfo(ScrollViewActivity.class, R.string.activity_title_scrollview),
33 | new ActivityInfo(FixedHeaderActivity.class, R.string.activity_title_fixed_header),
34 | new ActivityInfo(ChangingContentActivity.class, R.string.activity_title_changing_content),
35 | //new ActivityInfo(ListViewActivity.class, R.string.activity_title_listview),
36 | new ActivityInfo(SettingsActivity.class, R.string.activity_title_settings));
37 |
38 | @Override
39 | protected void onCreate(Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_home);
42 | String[] titles = getActivityTitles();
43 | setListAdapter(new ArrayAdapter(
44 | this, android.R.layout.simple_list_item_1, android.R.id.text1, titles));
45 | }
46 |
47 | @Override
48 | protected void onListItemClick(ListView l, View v, int position, long id) {
49 | Class extends Activity> class_ = activitiesInfo.get(position).activityClass;
50 | Intent intent = new Intent(this, class_);
51 | startActivity(intent);
52 | }
53 |
54 | private String[] getActivityTitles() {
55 | String[] result = new String[activitiesInfo.size()];
56 | int i = 0;
57 | for (ActivityInfo info : activitiesInfo) {
58 | result[i++] = getString(info.titleResourceId);
59 | }
60 | return result;
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/samples-stock/src/com/manuelpeinado/glassactionbardemo/ImagesAdapter.java:
--------------------------------------------------------------------------------
1 | package com.manuelpeinado.glassactionbardemo;
2 |
3 | import java.util.Arrays;
4 |
5 | import android.content.Context;
6 | import android.graphics.drawable.Drawable;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.BaseAdapter;
10 | import android.widget.ImageView;
11 | import com.manuelpeinado.glassactionbar.samples.stock.R;
12 |
13 |
14 | public class ImagesAdapter extends BaseAdapter {
15 | private Drawable[] drawables;
16 |
17 | public ImagesAdapter(Context context) {
18 | drawables = new Drawable[] {
19 | context.getResources().getDrawable(R.drawable.new_york_city_1),
20 | context.getResources().getDrawable(R.drawable.new_york_city_2),
21 | context.getResources().getDrawable(R.drawable.new_york_city_3)
22 | };
23 | }
24 |
25 |
26 | @Override
27 | public int getCount() {
28 | return 10;
29 | }
30 |
31 | @Override
32 | public Drawable getItem(int position) {
33 | return drawables[position % drawables.length];
34 | }
35 |
36 | @Override
37 | public long getItemId(int position) {
38 | return position;
39 | }
40 |
41 | @Override
42 | public View getView(int position, View convertView, ViewGroup parent) {
43 | if (convertView == null) {
44 | convertView = new ImageView(parent.getContext());
45 | }
46 | ImageView imageView = (ImageView) convertView;
47 | imageView.setImageDrawable(getItem(position));
48 | return imageView;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/samples-stock/src/com/manuelpeinado/glassactionbardemo/ListViewActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbardemo;
17 |
18 | import android.app.Activity;
19 | import android.os.Bundle;
20 | import android.view.Menu;
21 | import android.widget.ListAdapter;
22 |
23 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
24 | import com.manuelpeinado.glassactionbar.samples.stock.R;
25 |
26 | public class ListViewActivity extends Activity {
27 |
28 | private GlassActionBarHelper helper;
29 |
30 | @Override
31 | protected void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 |
34 | ListAdapter adapter = new ImagesAdapter(this);
35 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_listview, adapter);
36 | setContentView(helper.createView(this));
37 | }
38 |
39 | @Override
40 | public boolean onCreateOptionsMenu(Menu menu) {
41 | getMenuInflater().inflate(R.menu.main, menu);
42 | return true;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/samples-stock/src/com/manuelpeinado/glassactionbardemo/ScrollViewActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbardemo;
17 |
18 | import android.app.Activity;
19 | import android.os.Bundle;
20 | import android.view.Menu;
21 |
22 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
23 | import com.manuelpeinado.glassactionbar.samples.stock.R;
24 |
25 | public class ScrollViewActivity extends Activity {
26 |
27 | private GlassActionBarHelper helper;
28 |
29 | @Override
30 | protected void onCreate(Bundle savedInstanceState) {
31 | super.onCreate(savedInstanceState);
32 |
33 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_scrollview);
34 | setContentView(helper.createView(this));
35 | }
36 |
37 | @Override
38 | public boolean onCreateOptionsMenu(Menu menu) {
39 | getMenuInflater().inflate(R.menu.main, menu);
40 | return true;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples-stock/src/com/manuelpeinado/glassactionbardemo/SettingsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2013 Manuel Peinado
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 | package com.manuelpeinado.glassactionbardemo;
17 |
18 | import android.app.Activity;
19 | import android.os.Bundle;
20 | import android.view.Menu;
21 | import android.widget.SeekBar;
22 | import android.widget.SeekBar.OnSeekBarChangeListener;
23 | import android.widget.TextView;
24 |
25 | import com.manuelpeinado.glassactionbar.GlassActionBar;
26 | import com.manuelpeinado.glassactionbar.GlassActionBarHelper;
27 | import com.manuelpeinado.glassactionbar.samples.stock.R;
28 |
29 | public class SettingsActivity extends Activity implements OnSeekBarChangeListener {
30 |
31 | private GlassActionBarHelper helper;
32 | private SeekBar radiusSeekBar;
33 | private TextView radiusTextView;
34 | private SeekBar downsamplingSeekBar;
35 | private TextView downsamplingTextView;
36 |
37 | @Override
38 | protected void onCreate(Bundle savedInstanceState) {
39 | super.onCreate(savedInstanceState);
40 |
41 | helper = new GlassActionBarHelper().contentLayout(R.layout.activity_settings);
42 | setContentView(helper.createView(this));
43 |
44 | radiusSeekBar = (SeekBar) findViewById(R.id.radiusSeekBar);
45 | radiusSeekBar.setOnSeekBarChangeListener(this);
46 | radiusTextView = (TextView) findViewById(R.id.radiusTextView);
47 | initializeRadiusSeekBar();
48 | updateRadiusTextView();
49 |
50 | downsamplingSeekBar = (SeekBar) findViewById(R.id.downsamplingSeekBar);
51 | downsamplingSeekBar.setOnSeekBarChangeListener(this);
52 | downsamplingTextView = (TextView) findViewById(R.id.downsamplingTextView);
53 | initializeDownsamplingSeekBar();
54 | updateDownsamplingTextView();
55 | }
56 |
57 | private void initializeRadiusSeekBar() {
58 | setSeekBarValue(radiusSeekBar, helper.getBlurRadius(), GlassActionBar.MIN_BLUR_RADIUS, GlassActionBar.MAX_BLUR_RADIUS);
59 | }
60 |
61 | private void updateRadiusTextView() {
62 | int radius = helper.getBlurRadius();
63 | radiusTextView.setText("Blur radius=" + radius);
64 | }
65 |
66 | private void initializeDownsamplingSeekBar() {
67 | setSeekBarValue(downsamplingSeekBar, helper.getDownsampling(), GlassActionBar.MIN_DOWNSAMPLING, GlassActionBar.MAX_DOWNSAMPLING);
68 | }
69 |
70 | private void updateDownsamplingTextView() {
71 | downsamplingTextView.setText("Downsampling=" + helper.getDownsampling());
72 | }
73 |
74 | @Override
75 | public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
76 | if (seekBar == radiusSeekBar) {
77 | float value = transformSeekBarValue(seekBar, GlassActionBar.MIN_BLUR_RADIUS, GlassActionBar.MAX_BLUR_RADIUS);
78 | helper.setBlurRadius(Math.round(value));
79 | updateRadiusTextView();
80 | } else {
81 | float value = transformSeekBarValue(seekBar, GlassActionBar.MIN_DOWNSAMPLING, GlassActionBar.MAX_DOWNSAMPLING);
82 | helper.setDownsampling(Math.round(value));
83 | updateDownsamplingTextView();
84 | }
85 | }
86 |
87 | private static void setSeekBarValue(SeekBar seekBar, float value, float min, float max) {
88 | float span = max - min;
89 | value = (value - min) / span;
90 | seekBar.setProgress(Math.round(value * seekBar.getMax()));
91 | }
92 |
93 | private static float transformSeekBarValue(SeekBar seekBar, int min, int max) {
94 | float value = seekBar.getProgress() / (float) seekBar.getMax();
95 | float span = max - min;
96 | return min + value * span;
97 | }
98 |
99 | @Override
100 | public boolean onCreateOptionsMenu(Menu menu) {
101 | getMenuInflater().inflate(R.menu.main, menu);
102 | return true;
103 | }
104 |
105 | @Override
106 | public void onStartTrackingTouch(SeekBar seekBar) {
107 | }
108 |
109 | @Override
110 | public void onStopTrackingTouch(SeekBar seekBar) {
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':library'
2 | include ':samples-stock'
3 | include ':extras-actionbarsherlock'
4 | include ':extras-actionbarcompat'
5 | include ':samples-actionbarsherlock'
6 | include ':samples-actionbarcompat'
7 |
--------------------------------------------------------------------------------