├── .gitignore
├── .project
├── LICENSE.txt
├── README.md
├── art
├── Blue
│ ├── Thumbs.db
│ ├── hdpi.png
│ ├── ldpi.png
│ ├── mdpi.png
│ └── xhdpi.png
├── Green
│ ├── Thumbs.db
│ ├── hdpi.png
│ ├── ldpi.png
│ ├── mdpi.png
│ └── xhdpi.png
├── Orange
│ ├── Thumbs.db
│ ├── hdpi.png
│ ├── ldpi.png
│ ├── mdpi.png
│ └── xhdpi.png
├── Red
│ ├── Thumbs.db
│ ├── hdpi.png
│ ├── ldpi.png
│ ├── mdpi.png
│ └── xhdpi.png
└── White
│ ├── Thumbs.db
│ ├── hdpi.png
│ ├── ldpi.png
│ ├── mdpi.png
│ └── xhdpi.png
├── example
├── .classpath
├── AndroidManifest.xml
├── example.iml
├── libs
│ └── crittercism_v3_0_3_sdkonly.jar
├── proguard
│ ├── dump.txt
│ ├── mapping.txt
│ ├── seeds.txt
│ └── usage.txt
├── project.properties
├── res
│ ├── drawable-hdpi
│ │ ├── ic_action_github.png
│ │ ├── ic_launcher.png
│ │ └── indicator.png
│ ├── drawable-ldpi
│ │ ├── ic_action_github.png
│ │ ├── ic_launcher.png
│ │ └── indicator.png
│ ├── drawable-mdpi
│ │ ├── ic_action_github.png
│ │ ├── ic_launcher.png
│ │ └── indicator.png
│ ├── drawable-xhdpi
│ │ ├── ic_action_github.png
│ │ ├── ic_launcher.png
│ │ └── indicator.png
│ ├── drawable
│ │ ├── eagle.png
│ │ ├── flamingo.png
│ │ ├── heron.png
│ │ ├── new_indicator.xml
│ │ ├── octocat.png
│ │ ├── octocat_scaled.xml
│ │ ├── ostrich.png
│ │ ├── peacock.png
│ │ ├── penguin.png
│ │ ├── shadow.xml
│ │ ├── shadowright.xml
│ │ ├── toucan.png
│ │ ├── turkey.png
│ │ └── vulture.png
│ ├── layout-large-land
│ │ └── responsive_content_frame.xml
│ ├── layout-xlarge
│ │ └── responsive_content_frame.xml
│ ├── layout
│ │ ├── content_frame.xml
│ │ ├── github_button.xml
│ │ ├── grid_item.xml
│ │ ├── list.xml
│ │ ├── list_grid.xml
│ │ ├── menu.xml
│ │ ├── menu_frame.xml
│ │ ├── menu_frame_two.xml
│ │ ├── pager.xml
│ │ ├── properties.xml
│ │ ├── responsive_content_frame.xml
│ │ └── row.xml
│ ├── menu
│ │ ├── example_list.xml
│ │ └── main.xml
│ ├── values-land
│ │ └── dimens.xml
│ ├── values-large-land
│ │ └── dimens.xml
│ ├── values-large
│ │ └── dimens.xml
│ ├── values-xlarge-land
│ │ └── dimens.xml
│ ├── values-xlarge
│ │ └── dimens.xml
│ ├── values
│ │ ├── array.xml
│ │ ├── colors.xml
│ │ ├── dimens.xml
│ │ ├── strings.xml
│ │ └── styles.xml
│ └── xml
│ │ └── main.xml
└── src
│ └── com
│ └── jeremyfeinstein
│ └── slidingmenu
│ └── example
│ ├── AttachExample.java
│ ├── BaseActivity.java
│ ├── ExampleListActivity.java
│ ├── LeftAndRightActivity.java
│ ├── PropertiesActivity.java
│ ├── SampleListFragment.java
│ ├── SlidingContent.java
│ ├── SlidingTitleBar.java
│ ├── Util.java
│ ├── ViewPagerActivity.java
│ ├── anim
│ ├── CustomAnimation.java
│ ├── CustomScaleAnimation.java
│ ├── CustomSlideAnimation.java
│ └── CustomZoomAnimation.java
│ └── fragments
│ ├── BirdActivity.java
│ ├── BirdGridFragment.java
│ ├── BirdMenuFragment.java
│ ├── ColorFragment.java
│ ├── ColorMenuFragment.java
│ ├── FragmentChangeActivity.java
│ └── ResponsiveUIActivity.java
├── library-maps-support
├── LICENSE.txt
├── pom.xml
└── src
│ └── com
│ └── jeremyfeinstein
│ └── slidingmenu
│ └── lib
│ └── app
│ └── SlidingMapActivity.java
├── library
├── .classpath
├── AndroidManifest.xml
├── LICENSE.txt
├── build.gradle
├── library.iml
├── libs
│ └── android-support-v4.jar
├── pom.xml
├── project.properties
├── res
│ ├── layout
│ │ └── slidingmenumain.xml
│ └── values
│ │ ├── attrs.xml
│ │ └── ids.xml
└── src
│ └── com
│ └── jeremyfeinstein
│ └── slidingmenu
│ └── lib
│ ├── CanvasTransformerBuilder.java
│ ├── CustomViewAbove.java
│ ├── CustomViewBehind.java
│ ├── MenuInterface.java
│ ├── SlidingMenu.java
│ └── app
│ ├── SlidingActivity.java
│ ├── SlidingActivityBase.java
│ ├── SlidingActivityHelper.java
│ ├── SlidingFragmentActivity.java
│ ├── SlidingListActivity.java
│ └── SlidingPreferenceActivity.java
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Package Files #
4 | *.dex
5 | *.war
6 | *.ear
7 | *.apk
8 | bin/
9 | bin
10 | gen/
11 | release/
12 | release
13 | gen
14 | .metadata/
15 | .metadata
16 | .idea/
17 | .idea
18 | *.project
19 | .DS_Store
20 | target/
21 |
22 | *.iml
23 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | com.menorking.android
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/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 | SlidingMenu ([Play Store Demo][7])
2 | ===========
3 |
4 | SlidingMenu is an Open Source Android library that allows developers to easily create applications
5 | with sliding menus like those made popular in the Google+, YouTube, and Facebook apps. Feel free
6 | to use it all you want in your Android apps provided that you cite this project and include the license in your app.
7 |
8 | SlidingMenu is currently used in some awesome Android apps. Here's a list of some of them:
9 | * [Foursquare][15]
10 | * [LinkedIn][19]
11 | * [Zappos][20]
12 | * [Rdio][8]
13 | * [Evernote Food][18]
14 | * [Plume][4]
15 | * [VLC for Android][5]
16 | * [ESPN ScoreCenter][14]
17 | * [MLS MatchDay][16]
18 | * [9GAG][17]
19 | * [Wunderlist 2][13]
20 | * [The Verge][6]
21 | * [MTG Familiar][9]
22 | * [Mantano Reader][10]
23 | * [Falcon Pro (BETA)][12]
24 | * [MW3 Barracks][11]
25 |
26 | If you are using SlidingMenu in your app and would like to be listed here, please let me know via [Twitter][1]!
27 |
28 | Here's an older video of the example application in this repository : http://youtu.be/8vNaANLHw-c
29 |
30 | Also, you can follow the project on Twitter : [@SlidingMenu][1]
31 |
32 | Setup
33 | -----
34 | * In Eclipse, just import the library as an Android library project. Project > Clean to generate the binaries
35 | you need, like R.java, etc.
36 | * Then, just add SlidingMenu as a dependency to your existing project and you're good to go!
37 |
38 | Setup with ActionBarSherlock
39 | ----------------------------
40 | * Setup as above.
41 | * Checkout a clean copy of [ActionBarSherlock][2] and import into your Eclipse workspace.
42 | * Add ActionBarSherlock as a dependency to SlidingMenu
43 | * Go into the SlidingActivities that you plan on using make them extend Sherlock___Activity instead of ___Activity.
44 |
45 | How to Integrate this Library into Your Projects
46 | ------------------------------------------------
47 | In order to integrate SlidingMenu into your own projects you can do one of two things.
48 |
49 | __1.__ You can wrap your Activities in a SlidingMenu by constructing it programmatically (`new SlidingMenu(Context context)`)
50 | and then calling `SlidingMenu.attachToActivity(Activity activity, SlidingMenu.SLIDING_WINDOW | SlidingMenu.SLIDING_CONTENT)`.
51 | `SLIDING_WINDOW` will include the Title/ActionBar in the content section of the SlidingMenu, while `SLIDING_CONTENT`
52 | does not. You can check it out in the example app AttachExample Activity.
53 |
54 | __2.__ You can embed the SlidingMenu at the Activity level by making your Activity extend `SlidingActivity`.
55 | * In your Activity's onCreate method, you will have to call `setContentView`, as usual, and also
56 | `setBehindContentView`, which has the same syntax as setContentView. `setBehindContentView` will place
57 | the view in the "behind" portion of the SlidingMenu. You will have access to the `getSlidingMenu` method so you can
58 | customize the SlidingMenu to your liking.
59 | * If you want to use another library such as ActionBarSherlock, you can just change the SlidingActivities to extend
60 | the SherlockActivities instead of the regular Activities.
61 |
62 | __3.__ You can use the SlidingMenu view directly in your xml layouts or programmatically in your Java code.
63 | * This way, you can treat SlidingMenu as you would any other view type and put it in crazy awesome places like in the
64 | rows of a ListView.
65 | * So. Many. Possibilities.
66 |
67 | Simple Example
68 | -----
69 | ```java
70 | public class SlidingExample extends Activity {
71 |
72 | @Override
73 | public void onCreate(Bundle savedInstanceState) {
74 | super.onCreate(savedInstanceState);
75 | setTitle(R.string.attach);
76 | // set the content view
77 | setContentView(R.layout.content);
78 | // configure the SlidingMenu
79 | SlidingMenu menu = new SlidingMenu(this);
80 | menu.setMode(SlidingMenu.LEFT);
81 | menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
82 | menu.setShadowWidthRes(R.dimen.shadow_width);
83 | menu.setShadowDrawable(R.drawable.shadow);
84 | menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
85 | menu.setFadeDegree(0.35f);
86 | menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
87 | menu.setMenu(R.layout.menu);
88 | }
89 |
90 | }
91 | ```
92 |
93 | XML Usage
94 | -----
95 | If you decide to use SlidingMenu as a view, you can define it in your xml layouts like this:
96 | ```xml
97 |
114 | ```
115 | NOTE : you cannot use both behindOffset and behindWidth. You will get an exception if you try.
116 | * `viewAbove` - a reference to the layout that you want to use as the above view of the SlidingMenu
117 | * `viewBehind` - a reference to the layout that you want to use as the behind view of the SlidingMenu
118 | * `touchModeAbove` - an enum that designates what part of the screen is touchable when the above view is
119 | showing. Margin means only the left margin. Fullscreen means the entire screen. Default is margin.
120 | * `behindOffset` - a dimension representing the number of pixels that you want the above view to show when the
121 | behind view is showing. Default is 0.
122 | * `behindWidth` - a dimension representing the width of the behind view. Default is the width of the screen
123 | (equivalent to behindOffset = 0).
124 | * `behindScrollScale` - a float representing the relationship between the above view scrolling and the behind
125 | behind view scrolling. If set to 0.5f, the behind view will scroll 1px for every 2px that the above view scrolls.
126 | If set to 1.0f, the behind view will scroll 1px for every 1px that the above view scrolls. And if set to 0.0f, the
127 | behind view will never scroll; it will be static. This one is fun to play around with. Default is 0.25f.
128 | * `shadowDrawable` - a reference to a drawable to be used as a drop shadow from the above view onto the below view.
129 | Default is no shadow for now.
130 | * `shadowWidth` - a dimension representing the width of the shadow drawable. Default is 0.
131 | * `fadeEnabled` - a boolean representing whether or not the behind view should fade when the SlidingMenu is closing
132 | and "un-fade" when opening
133 | * `fadeDegree` - a float representing the "amount" of fade. `1.0f` would mean fade all the way to black when the
134 | SlidingMenu is closed. `0.0f` would mean do not fade at all.
135 | * `selectorEnabled` - a boolean representing whether or not a selector should be drawn on the left side of the above
136 | view showing a selected view on the behind view.
137 | * `selectorDrawable` - a reference to a drawable to be used as the selector
138 | NOTE : in order to have the selector drawn, you must call SlidingMenu.setSelectedView(View v) with the selected view.
139 | Note that this will most likely not work with items in a ListView because of the way that Android recycles item views.
140 |
141 | Caveats
142 | -------
143 | * Your layouts have to be based on a viewgroup, unfortunatly this negates the `` optimisations.
144 |
145 |
146 | Developed By
147 | ------------
148 | * Jeremy Feinstein
149 |
150 | License
151 | -------
152 |
153 | Copyright 2012-2014 Jeremy Feinstein
154 |
155 | Licensed under the Apache License, Version 2.0 (the "License");
156 | you may not use this file except in compliance with the License.
157 | You may obtain a copy of the License at
158 |
159 | http://www.apache.org/licenses/LICENSE-2.0
160 |
161 | Unless required by applicable law or agreed to in writing, software
162 | distributed under the License is distributed on an "AS IS" BASIS,
163 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
164 | See the License for the specific language governing permissions and
165 | limitations under the License.
166 |
167 | [1]: http://twitter.com/slidingmenu
168 | [2]: http://actionbarsherlock.com/
169 | [3]: https://play.google.com/store/apps/details?id=com.zappos.android&hl=en
170 | [4]: https://play.google.com/store/apps/details?id=com.levelup.touiteur&hl=en
171 | [5]: https://play.google.com/store/apps/details?id=org.videolan.vlc.betav7neon
172 | [6]: https://play.google.com/store/apps/details?id=com.verge.android
173 | [7]: http://bit.ly/TWejze
174 | [8]: https://play.google.com/store/apps/details?id=com.rdio.android.ui
175 | [9]: https://play.google.com/store/apps/details?id=com.gelakinetic.mtgfam
176 | [10]: https://play.google.com/store/apps/details?id=com.mantano.reader.android
177 | [11]: https://play.google.com/store/apps/details?id=com.phonegap.MW3BarracksFree
178 | [12]: http://forum.xda-developers.com/showthread.php?p=34361296
179 | [13]: http://bit.ly/xs1sMN
180 | [14]: https://play.google.com/store/apps/details?id=com.espn.score_center
181 | [15]: https://play.google.com/store/apps/details?id=com.joelapenna.foursquared
182 | [16]: https://play.google.com/store/apps/details?id=com.mlssoccer
183 | [17]: https://play.google.com/store/apps/details?id=com.ninegag.android.app
184 | [18]: https://play.google.com/store/apps/details?id=com.evernote.food
185 | [19]: https://play.google.com/store/apps/details?id=com.linkedin.android
186 | [20]: https://play.google.com/store/apps/details?id=com.zappos.android
187 |
--------------------------------------------------------------------------------
/art/Blue/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Blue/Thumbs.db
--------------------------------------------------------------------------------
/art/Blue/hdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Blue/hdpi.png
--------------------------------------------------------------------------------
/art/Blue/ldpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Blue/ldpi.png
--------------------------------------------------------------------------------
/art/Blue/mdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Blue/mdpi.png
--------------------------------------------------------------------------------
/art/Blue/xhdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Blue/xhdpi.png
--------------------------------------------------------------------------------
/art/Green/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Green/Thumbs.db
--------------------------------------------------------------------------------
/art/Green/hdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Green/hdpi.png
--------------------------------------------------------------------------------
/art/Green/ldpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Green/ldpi.png
--------------------------------------------------------------------------------
/art/Green/mdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Green/mdpi.png
--------------------------------------------------------------------------------
/art/Green/xhdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Green/xhdpi.png
--------------------------------------------------------------------------------
/art/Orange/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Orange/Thumbs.db
--------------------------------------------------------------------------------
/art/Orange/hdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Orange/hdpi.png
--------------------------------------------------------------------------------
/art/Orange/ldpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Orange/ldpi.png
--------------------------------------------------------------------------------
/art/Orange/mdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Orange/mdpi.png
--------------------------------------------------------------------------------
/art/Orange/xhdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Orange/xhdpi.png
--------------------------------------------------------------------------------
/art/Red/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Red/Thumbs.db
--------------------------------------------------------------------------------
/art/Red/hdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Red/hdpi.png
--------------------------------------------------------------------------------
/art/Red/ldpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Red/ldpi.png
--------------------------------------------------------------------------------
/art/Red/mdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Red/mdpi.png
--------------------------------------------------------------------------------
/art/Red/xhdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/Red/xhdpi.png
--------------------------------------------------------------------------------
/art/White/Thumbs.db:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/White/Thumbs.db
--------------------------------------------------------------------------------
/art/White/hdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/White/hdpi.png
--------------------------------------------------------------------------------
/art/White/ldpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/White/ldpi.png
--------------------------------------------------------------------------------
/art/White/mdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/White/mdpi.png
--------------------------------------------------------------------------------
/art/White/xhdpi.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/art/White/xhdpi.png
--------------------------------------------------------------------------------
/example/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
17 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/example/example.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/example/libs/crittercism_v3_0_3_sdkonly.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/libs/crittercism_v3_0_3_sdkonly.jar
--------------------------------------------------------------------------------
/example/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-17
15 | android.library=false
16 | android.library.reference.1=../library
17 | android.library.reference.2=../ABS
18 | proguard.config=proguard-project.txt
19 |
--------------------------------------------------------------------------------
/example/res/drawable-hdpi/ic_action_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-hdpi/ic_action_github.png
--------------------------------------------------------------------------------
/example/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/res/drawable-hdpi/indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-hdpi/indicator.png
--------------------------------------------------------------------------------
/example/res/drawable-ldpi/ic_action_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-ldpi/ic_action_github.png
--------------------------------------------------------------------------------
/example/res/drawable-ldpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-ldpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/res/drawable-ldpi/indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-ldpi/indicator.png
--------------------------------------------------------------------------------
/example/res/drawable-mdpi/ic_action_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-mdpi/ic_action_github.png
--------------------------------------------------------------------------------
/example/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/res/drawable-mdpi/indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-mdpi/indicator.png
--------------------------------------------------------------------------------
/example/res/drawable-xhdpi/ic_action_github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-xhdpi/ic_action_github.png
--------------------------------------------------------------------------------
/example/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/res/drawable-xhdpi/indicator.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable-xhdpi/indicator.png
--------------------------------------------------------------------------------
/example/res/drawable/eagle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/eagle.png
--------------------------------------------------------------------------------
/example/res/drawable/flamingo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/flamingo.png
--------------------------------------------------------------------------------
/example/res/drawable/heron.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/heron.png
--------------------------------------------------------------------------------
/example/res/drawable/new_indicator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | -
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/res/drawable/octocat.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/octocat.png
--------------------------------------------------------------------------------
/example/res/drawable/octocat_scaled.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
--------------------------------------------------------------------------------
/example/res/drawable/ostrich.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/ostrich.png
--------------------------------------------------------------------------------
/example/res/drawable/peacock.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/peacock.png
--------------------------------------------------------------------------------
/example/res/drawable/penguin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/penguin.png
--------------------------------------------------------------------------------
/example/res/drawable/shadow.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/example/res/drawable/shadowright.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/example/res/drawable/toucan.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/toucan.png
--------------------------------------------------------------------------------
/example/res/drawable/turkey.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/turkey.png
--------------------------------------------------------------------------------
/example/res/drawable/vulture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/example/res/drawable/vulture.png
--------------------------------------------------------------------------------
/example/res/layout-large-land/responsive_content_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/example/res/layout-xlarge/responsive_content_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
12 |
13 |
18 |
19 |
--------------------------------------------------------------------------------
/example/res/layout/content_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/example/res/layout/github_button.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
21 |
22 |
--------------------------------------------------------------------------------
/example/res/layout/grid_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
12 |
13 |
--------------------------------------------------------------------------------
/example/res/layout/list.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
--------------------------------------------------------------------------------
/example/res/layout/list_grid.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/res/layout/menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
--------------------------------------------------------------------------------
/example/res/layout/menu_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/example/res/layout/menu_frame_two.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/example/res/layout/pager.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
--------------------------------------------------------------------------------
/example/res/layout/properties.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
12 |
18 |
19 |
26 |
27 |
31 |
32 |
38 |
39 |
44 |
45 |
50 |
51 |
52 |
53 |
59 |
60 |
67 |
68 |
72 |
73 |
79 |
80 |
85 |
86 |
91 |
92 |
93 |
94 |
101 |
102 |
109 |
110 |
114 |
115 |
121 |
122 |
127 |
128 |
129 |
130 |
136 |
137 |
141 |
142 |
149 |
150 |
155 |
156 |
160 |
161 |
168 |
169 |
174 |
175 |
176 |
180 |
181 |
185 |
186 |
193 |
194 |
199 |
200 |
201 |
205 |
206 |
207 |
--------------------------------------------------------------------------------
/example/res/layout/responsive_content_frame.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/example/res/layout/row.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
13 |
14 |
23 |
24 |
--------------------------------------------------------------------------------
/example/res/menu/example_list.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/example/res/menu/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/example/res/values-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 200dp
20 |
21 | 2
22 |
23 |
--------------------------------------------------------------------------------
/example/res/values-large-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 450dp
20 |
21 | 2
22 |
23 |
--------------------------------------------------------------------------------
/example/res/values-large/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 300dp
20 |
21 | 1
22 |
23 |
--------------------------------------------------------------------------------
/example/res/values-xlarge-land/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 750dp
20 |
21 | 3
22 |
23 |
--------------------------------------------------------------------------------
/example/res/values-xlarge/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 500dp
20 |
21 | 1
22 |
23 |
--------------------------------------------------------------------------------
/example/res/values/array.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | - Red
6 | - Green
7 | - Blue
8 | - White
9 | - Black
10 |
11 |
12 |
13 | - Eagle
14 | - Flamingo
15 | - Heron
16 | - Ostrich
17 | - Peacock
18 | - Penguin
19 | - Toucan
20 | - Turkey
21 | - Vulture
22 |
23 |
24 |
25 | - @drawable/eagle
26 | - @drawable/flamingo
27 | - @drawable/heron
28 | - @drawable/ostrich
29 | - @drawable/peacock
30 | - @drawable/penguin
31 | - @drawable/toucan
32 | - @drawable/turkey
33 | - @drawable/vulture
34 |
35 |
36 |
--------------------------------------------------------------------------------
/example/res/values/colors.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | #900
4 | #090
5 | #009
6 | #FFF
7 | #000
8 |
9 |
--------------------------------------------------------------------------------
/example/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 | 60dp
20 | 10dp
21 | 15dp
22 |
23 | 1
24 |
25 |
--------------------------------------------------------------------------------
/example/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SlidingMenu Demos
5 | SlidingMenu Properties
6 | General
7 | ViewPager
8 | Attach
9 | Title Bar Options
10 | Sliding Title Bar
11 | Sliding Content Only
12 | Custom Animations
13 | Zoom
14 | Scale
15 | Fold
16 | Slide Up
17 | Changing Fragments
18 | Responsive UI
19 | Left
20 | Right
21 | Left and Right
22 | GitHub
23 | SlidingMenu on GitHub
24 | What is this?
25 | This is an example of a UI that responds well to device type. On phones, the menu will be placed inside a SlidingMenu, while on tablets the menu will be exposed alongside the content because we have enough room to always show it.
26 | About
27 | Licenses
28 | Contact
29 | <b>SlidingMenu</b> is an Open Source Android library
30 | that allows developers to easily create applications with sliding menus like those
31 | made popular in the Google+, YouTube, and Facebook applications.
32 | You can find it on GitHub by clicking the little octocat icon in the ActionBar.
33 | Feel free to use it all you want in your Android apps provided
34 | that you cite this project and include the license in your app.
35 | <br><br>
36 | SlidingMenu is currently used in some incredibly popular Android
37 | apps such as Zappos, Plume, VLC for Android, and The Verge.
38 | If you are using SlidingMenu in your app and would like to be
39 | listed here, please let me know via Twitter (@slidingmenu)!
40 | <b>SlidingMenu </b><br>
41 | \u00A9 2012 Jeremy Feinstein<br>
42 | SlidingMenu is licensed under the Apache License Version 2.0.
43 | <br><br>
44 | <b>ActionBarSherlock </b><br>
45 | \u00A9 2012 Jake Wharton<br>
46 | ActionBarSherlock is licensed under the Apache License Version 2.0.
47 | <br><br>
48 | <b>The Apache License Version 2.0</b><br>
49 | You may obtain a copy of the License at<br>
50 | <center><a href=\'http://www.apache.org/licenses/LICENSE-2.0\'>
51 | "http://www.apache.org/licenses/LICENSE-2.0</a></center><br>
52 | Unless required by applicable law or agreed to in writing,
53 | software distributed under the License is distributed on an
54 | \'AS IS\' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
55 | either express or implied. See the License for the specific
56 | language governing permissions and limitations under the License.
57 | Sorry, I couldn\'t find any e-mail apps on your phone
58 |
59 |
--------------------------------------------------------------------------------
/example/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
--------------------------------------------------------------------------------
/example/res/xml/main.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/AttachExample.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.FragmentActivity;
5 |
6 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
7 |
8 | public class AttachExample extends FragmentActivity {
9 |
10 | private SlidingMenu menu;
11 |
12 | @Override
13 | public void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 |
16 | setTitle(R.string.attach);
17 |
18 | // set the Above View
19 | setContentView(R.layout.content_frame);
20 | getSupportFragmentManager()
21 | .beginTransaction()
22 | .replace(R.id.content_frame, new SampleListFragment())
23 | .commit();
24 |
25 | // configure the SlidingMenu
26 | menu = new SlidingMenu(this);
27 | menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
28 | menu.setShadowWidthRes(R.dimen.shadow_width);
29 | menu.setShadowDrawable(R.drawable.shadow);
30 | menu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
31 | menu.setFadeDegree(0.35f);
32 | menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
33 | menu.setMenu(R.layout.menu_frame);
34 | getSupportFragmentManager()
35 | .beginTransaction()
36 | .replace(R.id.menu_frame, new SampleListFragment())
37 | .commit();
38 | }
39 |
40 | @Override
41 | public void onBackPressed() {
42 | if (menu.isMenuShowing()) {
43 | menu.showContent();
44 | } else {
45 | super.onBackPressed();
46 | }
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/BaseActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import android.os.Bundle;
7 | import android.support.v4.app.Fragment;
8 | import android.support.v4.app.FragmentManager;
9 | import android.support.v4.app.FragmentPagerAdapter;
10 | import android.support.v4.app.FragmentTransaction;
11 | import android.support.v4.app.ListFragment;
12 | import android.support.v4.view.ViewPager;
13 |
14 | import com.actionbarsherlock.view.Menu;
15 | import com.actionbarsherlock.view.MenuItem;
16 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
17 | import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
18 |
19 | public class BaseActivity extends SlidingFragmentActivity {
20 |
21 | private int mTitleRes;
22 | protected ListFragment mFrag;
23 |
24 | public BaseActivity(int titleRes) {
25 | mTitleRes = titleRes;
26 | }
27 |
28 | @Override
29 | public void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 |
32 | setTitle(mTitleRes);
33 |
34 | // set the Behind View
35 | setBehindContentView(R.layout.menu_frame);
36 | if (savedInstanceState == null) {
37 | FragmentTransaction t = this.getSupportFragmentManager().beginTransaction();
38 | mFrag = new SampleListFragment();
39 | t.replace(R.id.menu_frame, mFrag);
40 | t.commit();
41 | } else {
42 | mFrag = (ListFragment)this.getSupportFragmentManager().findFragmentById(R.id.menu_frame);
43 | }
44 |
45 | // customize the SlidingMenu
46 | SlidingMenu sm = getSlidingMenu();
47 | sm.setShadowWidthRes(R.dimen.shadow_width);
48 | sm.setShadowDrawable(R.drawable.shadow);
49 | sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
50 | sm.setFadeDegree(0.35f);
51 | sm.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
52 |
53 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
54 | }
55 |
56 | @Override
57 | public boolean onOptionsItemSelected(MenuItem item) {
58 | switch (item.getItemId()) {
59 | case android.R.id.home:
60 | toggle();
61 | return true;
62 | case R.id.github:
63 | Util.goToGitHub(this);
64 | return true;
65 | }
66 | return super.onOptionsItemSelected(item);
67 | }
68 |
69 | @Override
70 | public boolean onCreateOptionsMenu(Menu menu) {
71 | getSupportMenuInflater().inflate(R.menu.main, menu);
72 | return true;
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/ExampleListActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import java.net.URLEncoder;
4 |
5 | import android.app.AlertDialog;
6 | import android.content.Context;
7 | import android.content.Intent;
8 | import android.net.Uri;
9 | import android.os.Bundle;
10 | import android.preference.Preference;
11 | import android.preference.PreferenceScreen;
12 | import android.text.Html;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 | import android.widget.ArrayAdapter;
16 | import android.widget.ImageView;
17 | import android.widget.ListView;
18 | import android.widget.TextView;
19 | import android.widget.Toast;
20 |
21 | import com.actionbarsherlock.app.SherlockPreferenceActivity;
22 | import com.actionbarsherlock.view.Menu;
23 | import com.actionbarsherlock.view.MenuItem;
24 | import com.crittercism.app.Crittercism;
25 | import com.jeremyfeinstein.slidingmenu.example.anim.CustomScaleAnimation;
26 | import com.jeremyfeinstein.slidingmenu.example.anim.CustomSlideAnimation;
27 | import com.jeremyfeinstein.slidingmenu.example.anim.CustomZoomAnimation;
28 | import com.jeremyfeinstein.slidingmenu.example.fragments.FragmentChangeActivity;
29 | import com.jeremyfeinstein.slidingmenu.example.fragments.ResponsiveUIActivity;
30 |
31 | public class ExampleListActivity extends SherlockPreferenceActivity {
32 |
33 | @Override
34 | public void onCreate(Bundle savedInstanceState) {
35 | super.onCreate(savedInstanceState);
36 | setTitle(R.string.app_name);
37 |
38 | // Crittercism.init(getApplicationContext(), "508ab27601ed857a20000003");
39 | this.addPreferencesFromResource(R.xml.main);
40 | }
41 |
42 | @Override
43 | public boolean onPreferenceTreeClick(PreferenceScreen screen, Preference pref) {
44 | Class> cls = null;
45 | String title = pref.getTitle().toString();
46 | if (title.equals(getString(R.string.properties))) {
47 | cls = PropertiesActivity.class;
48 | } else if (title.equals(getString(R.string.attach))) {
49 | cls = AttachExample.class;
50 | } else if (title.equals(getString(R.string.changing_fragments))) {
51 | cls = FragmentChangeActivity.class;
52 | } else if (title.equals(getString(R.string.left_and_right))) {
53 | cls = LeftAndRightActivity.class;
54 | } else if (title.equals(getString(R.string.responsive_ui))) {
55 | cls = ResponsiveUIActivity.class;
56 | } else if (title.equals(getString(R.string.viewpager))) {
57 | cls = ViewPagerActivity.class;
58 | } else if (title.equals(getString(R.string.title_bar_slide))) {
59 | cls = SlidingTitleBar.class;
60 | } else if (title.equals(getString(R.string.title_bar_content))) {
61 | cls = SlidingContent.class;
62 | } else if (title.equals(getString(R.string.anim_zoom))) {
63 | cls = CustomZoomAnimation.class;
64 | } else if (title.equals(getString(R.string.anim_scale))) {
65 | cls = CustomScaleAnimation.class;
66 | } else if (title.equals(getString(R.string.anim_slide))) {
67 | cls = CustomSlideAnimation.class;
68 | }
69 | Intent intent = new Intent(this, cls);
70 | startActivity(intent);
71 | return true;
72 | }
73 |
74 | @Override
75 | public boolean onOptionsItemSelected(MenuItem item) {
76 | switch (item.getItemId()) {
77 | case R.id.github:
78 | Util.goToGitHub(this);
79 | return true;
80 | case R.id.about:
81 | new AlertDialog.Builder(this)
82 | .setTitle(R.string.about)
83 | .setMessage(Html.fromHtml(getString(R.string.about_msg)))
84 | .show();
85 | break;
86 | case R.id.licenses:
87 | new AlertDialog.Builder(this)
88 | .setTitle(R.string.licenses)
89 | .setMessage(Html.fromHtml(getString(R.string.apache_license)))
90 | .show();
91 | break;
92 | case R.id.contact:
93 | final Intent email = new Intent(android.content.Intent.ACTION_SENDTO);
94 | String uriText = "mailto:jfeinstein10@gmail.com" +
95 | "?subject=" + URLEncoder.encode("SlidingMenu Demos Feedback");
96 | email.setData(Uri.parse(uriText));
97 | try {
98 | startActivity(email);
99 | } catch (Exception e) {
100 | Toast.makeText(this, R.string.no_email, Toast.LENGTH_SHORT).show();
101 | }
102 | break;
103 | }
104 | return super.onOptionsItemSelected(item);
105 | }
106 |
107 | @Override
108 | public boolean onCreateOptionsMenu(Menu menu) {
109 | getSupportMenuInflater().inflate(R.menu.example_list, menu);
110 | return true;
111 | }
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/LeftAndRightActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import android.os.Bundle;
4 | import android.view.KeyEvent;
5 | import android.view.View;
6 | import android.view.ViewGroup;
7 |
8 | import com.jeremyfeinstein.slidingmenu.example.fragments.ColorFragment;
9 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
10 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.OnClosedListener;
11 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.OnOpenedListener;
12 |
13 |
14 | public class LeftAndRightActivity extends BaseActivity {
15 |
16 | public LeftAndRightActivity() {
17 | super(R.string.left_and_right);
18 | }
19 |
20 | @Override
21 | public void onCreate(Bundle savedInstanceState) {
22 | super.onCreate(savedInstanceState);
23 | getSlidingMenu().setMode(SlidingMenu.LEFT_RIGHT);
24 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
25 |
26 | setContentView(R.layout.content_frame);
27 | getSupportFragmentManager()
28 | .beginTransaction()
29 | .replace(R.id.content_frame, new SampleListFragment())
30 | .commit();
31 |
32 | getSlidingMenu().setSecondaryMenu(R.layout.menu_frame_two);
33 | getSlidingMenu().setSecondaryShadowDrawable(R.drawable.shadowright);
34 | getSupportFragmentManager()
35 | .beginTransaction()
36 | .replace(R.id.menu_frame_two, new SampleListFragment())
37 | .commit();
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/PropertiesActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import android.os.Bundle;
4 | import android.view.View;
5 | import android.view.View.OnClickListener;
6 | import android.widget.Button;
7 | import android.widget.CheckBox;
8 | import android.widget.CompoundButton;
9 | import android.widget.RadioGroup;
10 | import android.widget.RadioGroup.OnCheckedChangeListener;
11 | import android.widget.SeekBar;
12 | import android.widget.SeekBar.OnSeekBarChangeListener;
13 |
14 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
15 |
16 | public class PropertiesActivity extends BaseActivity {
17 |
18 | public PropertiesActivity() {
19 | super(R.string.properties);
20 | }
21 |
22 | @Override
23 | public void onCreate(Bundle savedInstanceState) {
24 | super.onCreate(savedInstanceState);
25 |
26 | setSlidingActionBarEnabled(true);
27 |
28 | setContentView(R.layout.properties);
29 |
30 | // left and right modes
31 | RadioGroup mode = (RadioGroup) findViewById(R.id.mode);
32 | mode.check(R.id.left);
33 | mode.setOnCheckedChangeListener(new OnCheckedChangeListener() {
34 | @Override
35 | public void onCheckedChanged(RadioGroup group, int checkedId) {
36 | SlidingMenu sm = getSlidingMenu();
37 | switch (checkedId) {
38 | case R.id.left:
39 | sm.setMode(SlidingMenu.LEFT);
40 | sm.setShadowDrawable(R.drawable.shadow);
41 | break;
42 | case R.id.right:
43 | sm.setMode(SlidingMenu.RIGHT);
44 | sm.setShadowDrawable(R.drawable.shadowright);
45 | break;
46 | case R.id.left_right:
47 | sm.setMode(SlidingMenu.LEFT_RIGHT);
48 | sm.setSecondaryMenu(R.layout.menu_frame_two);
49 | getSupportFragmentManager()
50 | .beginTransaction()
51 | .replace(R.id.menu_frame_two, new SampleListFragment())
52 | .commit();
53 | sm.setSecondaryShadowDrawable(R.drawable.shadowright);
54 | sm.setShadowDrawable(R.drawable.shadow);
55 | }
56 | }
57 | });
58 |
59 | // touch mode stuff
60 | RadioGroup touchAbove = (RadioGroup) findViewById(R.id.touch_above);
61 | touchAbove.check(R.id.touch_above_full);
62 | touchAbove.setOnCheckedChangeListener(new OnCheckedChangeListener() {
63 | @Override
64 | public void onCheckedChanged(RadioGroup group, int checkedId) {
65 | switch (checkedId) {
66 | case R.id.touch_above_full:
67 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
68 | break;
69 | case R.id.touch_above_margin:
70 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
71 | break;
72 | case R.id.touch_above_none:
73 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
74 | break;
75 | }
76 | }
77 | });
78 |
79 | // scroll scale stuff
80 | SeekBar scrollScale = (SeekBar) findViewById(R.id.scroll_scale);
81 | scrollScale.setMax(1000);
82 | scrollScale.setProgress(333);
83 | scrollScale.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
84 | @Override
85 | public void onProgressChanged(SeekBar seekBar, int progress,
86 | boolean fromUser) { }
87 | @Override
88 | public void onStartTrackingTouch(SeekBar seekBar) { }
89 | @Override
90 | public void onStopTrackingTouch(SeekBar seekBar) {
91 | getSlidingMenu().setBehindScrollScale((float) seekBar.getProgress()/seekBar.getMax());
92 | }
93 | });
94 |
95 |
96 | // behind width stuff
97 | SeekBar behindWidth = (SeekBar) findViewById(R.id.behind_width);
98 | behindWidth.setMax(1000);
99 | behindWidth.setProgress(750);
100 | behindWidth.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
101 | @Override
102 | public void onProgressChanged(SeekBar seekBar, int progress,
103 | boolean fromUser) { }
104 | @Override
105 | public void onStartTrackingTouch(SeekBar seekBar) { }
106 | @Override
107 | public void onStopTrackingTouch(SeekBar seekBar) {
108 | float percent = (float) seekBar.getProgress()/seekBar.getMax();
109 | getSlidingMenu().setBehindWidth((int) (percent * getSlidingMenu().getWidth()));
110 | getSlidingMenu().requestLayout();
111 | }
112 | });
113 |
114 | // shadow stuff
115 | CheckBox shadowEnabled = (CheckBox) findViewById(R.id.shadow_enabled);
116 | shadowEnabled.setChecked(true);
117 | shadowEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
118 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
119 | if (isChecked)
120 | getSlidingMenu().setShadowDrawable(
121 | getSlidingMenu().getMode() == SlidingMenu.LEFT ?
122 | R.drawable.shadow : R.drawable.shadowright);
123 | else
124 | getSlidingMenu().setShadowDrawable(null);
125 | }
126 | });
127 | SeekBar shadowWidth = (SeekBar) findViewById(R.id.shadow_width);
128 | shadowWidth.setMax(1000);
129 | shadowWidth.setProgress(75);
130 | shadowWidth.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
131 | @Override
132 | public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) { }
133 | @Override
134 | public void onStartTrackingTouch(SeekBar seekBar) { }
135 | @Override
136 | public void onStopTrackingTouch(SeekBar seekBar) {
137 | float percent = (float) seekBar.getProgress()/ (float) seekBar.getMax();
138 | int width = (int) (percent * (float) getSlidingMenu().getWidth());
139 | getSlidingMenu().setShadowWidth(width);
140 | getSlidingMenu().invalidate();
141 | }
142 | });
143 |
144 | // fading stuff
145 | CheckBox fadeEnabled = (CheckBox) findViewById(R.id.fade_enabled);
146 | fadeEnabled.setChecked(true);
147 | fadeEnabled.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
148 | @Override
149 | public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
150 | getSlidingMenu().setFadeEnabled(isChecked);
151 | }
152 | });
153 | SeekBar fadeDeg = (SeekBar) findViewById(R.id.fade_degree);
154 | fadeDeg.setMax(1000);
155 | fadeDeg.setProgress(666);
156 | fadeDeg.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
157 | @Override
158 | public void onProgressChanged(SeekBar seekBar, int progress,
159 | boolean fromUser) { }
160 | @Override
161 | public void onStartTrackingTouch(SeekBar seekBar) { }
162 | @Override
163 | public void onStopTrackingTouch(SeekBar seekBar) {
164 | getSlidingMenu().setFadeDegree((float) seekBar.getProgress()/seekBar.getMax());
165 | }
166 | });
167 | }
168 |
169 | }
170 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/SampleListFragment.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import android.content.Context;
4 | import android.os.Bundle;
5 | import android.support.v4.app.ListFragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ArrayAdapter;
10 | import android.widget.ImageView;
11 | import android.widget.TextView;
12 |
13 | public class SampleListFragment extends ListFragment {
14 |
15 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
16 | return inflater.inflate(R.layout.list, null);
17 | }
18 |
19 | public void onActivityCreated(Bundle savedInstanceState) {
20 | super.onActivityCreated(savedInstanceState);
21 | SampleAdapter adapter = new SampleAdapter(getActivity());
22 | for (int i = 0; i < 20; i++) {
23 | adapter.add(new SampleItem("Sample List", android.R.drawable.ic_menu_search));
24 | }
25 | setListAdapter(adapter);
26 | }
27 |
28 | private class SampleItem {
29 | public String tag;
30 | public int iconRes;
31 | public SampleItem(String tag, int iconRes) {
32 | this.tag = tag;
33 | this.iconRes = iconRes;
34 | }
35 | }
36 |
37 | public class SampleAdapter extends ArrayAdapter {
38 |
39 | public SampleAdapter(Context context) {
40 | super(context, 0);
41 | }
42 |
43 | public View getView(int position, View convertView, ViewGroup parent) {
44 | if (convertView == null) {
45 | convertView = LayoutInflater.from(getContext()).inflate(R.layout.row, null);
46 | }
47 | ImageView icon = (ImageView) convertView.findViewById(R.id.row_icon);
48 | icon.setImageResource(getItem(position).iconRes);
49 | TextView title = (TextView) convertView.findViewById(R.id.row_title);
50 | title.setText(getItem(position).tag);
51 |
52 | return convertView;
53 | }
54 |
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/SlidingContent.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import android.os.Bundle;
4 |
5 |
6 | public class SlidingContent extends BaseActivity {
7 |
8 | public SlidingContent() {
9 | super(R.string.title_bar_content);
10 | }
11 |
12 | @Override
13 | public void onCreate(Bundle savedInstanceState) {
14 | super.onCreate(savedInstanceState);
15 |
16 | // set the Above View
17 | setContentView(R.layout.content_frame);
18 | getSupportFragmentManager()
19 | .beginTransaction()
20 | .replace(R.id.content_frame, new SampleListFragment())
21 | .commit();
22 |
23 | setSlidingActionBarEnabled(false);
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/SlidingTitleBar.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.view.ViewPager;
5 |
6 |
7 | public class SlidingTitleBar extends BaseActivity {
8 |
9 | public SlidingTitleBar() {
10 | super(R.string.title_bar_slide);
11 | }
12 |
13 | @Override
14 | public void onCreate(Bundle savedInstanceState) {
15 | super.onCreate(savedInstanceState);
16 |
17 | // set the Above View
18 | setContentView(R.layout.content_frame);
19 | getSupportFragmentManager()
20 | .beginTransaction()
21 | .replace(R.id.content_frame, new SampleListFragment())
22 | .commit();
23 |
24 | setSlidingActionBarEnabled(true);
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/Util.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import android.content.Context;
4 | import android.content.Intent;
5 | import android.net.Uri;
6 |
7 | public class Util {
8 |
9 | public static void goToGitHub(Context context) {
10 | Uri uriUrl = Uri.parse("http://github.com/jfeinstein10/slidingmenu");
11 | Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl);
12 | context.startActivity(launchBrowser);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/ViewPagerActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example;
2 |
3 | import java.util.ArrayList;
4 |
5 | import android.os.Bundle;
6 | import android.support.v4.app.Fragment;
7 | import android.support.v4.app.FragmentManager;
8 | import android.support.v4.app.FragmentPagerAdapter;
9 | import android.support.v4.view.ViewPager;
10 | import android.support.v4.view.ViewPager.OnPageChangeListener;
11 |
12 | import com.jeremyfeinstein.slidingmenu.example.fragments.ColorFragment;
13 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
14 |
15 | public class ViewPagerActivity extends BaseActivity {
16 |
17 | public ViewPagerActivity() {
18 | super(R.string.viewpager);
19 | }
20 |
21 | @Override
22 | public void onCreate(Bundle savedInstanceState) {
23 | super.onCreate(savedInstanceState);
24 |
25 | ViewPager vp = new ViewPager(this);
26 | vp.setId("VP".hashCode());
27 | vp.setAdapter(new ColorPagerAdapter(getSupportFragmentManager()));
28 | setContentView(vp);
29 |
30 | vp.setOnPageChangeListener(new OnPageChangeListener() {
31 | @Override
32 | public void onPageScrollStateChanged(int arg0) { }
33 |
34 | @Override
35 | public void onPageScrolled(int arg0, float arg1, int arg2) { }
36 |
37 | @Override
38 | public void onPageSelected(int position) {
39 | switch (position) {
40 | case 0:
41 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
42 | break;
43 | default:
44 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
45 | break;
46 | }
47 | }
48 |
49 | });
50 |
51 | vp.setCurrentItem(0);
52 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
53 | }
54 |
55 | public class ColorPagerAdapter extends FragmentPagerAdapter {
56 |
57 | private ArrayList mFragments;
58 |
59 | private final int[] COLORS = new int[] {
60 | R.color.red,
61 | R.color.green,
62 | R.color.blue,
63 | R.color.white,
64 | R.color.black
65 | };
66 |
67 | public ColorPagerAdapter(FragmentManager fm) {
68 | super(fm);
69 | mFragments = new ArrayList();
70 | for (int color : COLORS)
71 | mFragments.add(new ColorFragment(color));
72 | }
73 |
74 | @Override
75 | public int getCount() {
76 | return mFragments.size();
77 | }
78 |
79 | @Override
80 | public Fragment getItem(int position) {
81 | return mFragments.get(position);
82 | }
83 |
84 | }
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/anim/CustomAnimation.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.anim;
2 |
3 | import android.os.Bundle;
4 | import android.view.Menu;
5 |
6 | import com.jeremyfeinstein.slidingmenu.example.BaseActivity;
7 | import com.jeremyfeinstein.slidingmenu.example.R;
8 | import com.jeremyfeinstein.slidingmenu.example.SampleListFragment;
9 | import com.jeremyfeinstein.slidingmenu.example.R.id;
10 | import com.jeremyfeinstein.slidingmenu.example.R.layout;
11 | import com.jeremyfeinstein.slidingmenu.example.R.menu;
12 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
13 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.CanvasTransformer;
14 |
15 | public abstract class CustomAnimation extends BaseActivity {
16 |
17 | private CanvasTransformer mTransformer;
18 |
19 | public CustomAnimation(int titleRes, CanvasTransformer transformer) {
20 | super(titleRes);
21 | mTransformer = transformer;
22 | }
23 |
24 | @Override
25 | public void onCreate(Bundle savedInstanceState) {
26 | super.onCreate(savedInstanceState);
27 | // set the Above View
28 | setContentView(R.layout.content_frame);
29 | getSupportFragmentManager()
30 | .beginTransaction()
31 | .replace(R.id.content_frame, new SampleListFragment())
32 | .commit();
33 |
34 | SlidingMenu sm = getSlidingMenu();
35 | setSlidingActionBarEnabled(true);
36 | sm.setBehindScrollScale(0.0f);
37 | sm.setBehindCanvasTransformer(mTransformer);
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/anim/CustomScaleAnimation.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.anim;
2 |
3 | import android.graphics.Canvas;
4 |
5 | import com.jeremyfeinstein.slidingmenu.example.R;
6 | import com.jeremyfeinstein.slidingmenu.example.R.string;
7 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.CanvasTransformer;
8 |
9 | public class CustomScaleAnimation extends CustomAnimation {
10 |
11 | public CustomScaleAnimation() {
12 | super(R.string.anim_scale, new CanvasTransformer() {
13 | @Override
14 | public void transformCanvas(Canvas canvas, float percentOpen) {
15 | canvas.scale(percentOpen, 1, 0, 0);
16 | }
17 | });
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/anim/CustomSlideAnimation.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.anim;
2 |
3 | import android.graphics.Canvas;
4 | import android.view.animation.Interpolator;
5 |
6 | import com.jeremyfeinstein.slidingmenu.example.R;
7 | import com.jeremyfeinstein.slidingmenu.example.R.string;
8 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.CanvasTransformer;
9 |
10 | public class CustomSlideAnimation extends CustomAnimation {
11 |
12 | private static Interpolator interp = new Interpolator() {
13 | @Override
14 | public float getInterpolation(float t) {
15 | t -= 1.0f;
16 | return t * t * t + 1.0f;
17 | }
18 | };
19 |
20 | public CustomSlideAnimation() {
21 | // see the class CustomAnimation for how to attach
22 | // the CanvasTransformer to the SlidingMenu
23 | super(R.string.anim_slide, new CanvasTransformer() {
24 | @Override
25 | public void transformCanvas(Canvas canvas, float percentOpen) {
26 | canvas.translate(0, canvas.getHeight()*(1-interp.getInterpolation(percentOpen)));
27 | }
28 | });
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/anim/CustomZoomAnimation.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.anim;
2 |
3 | import android.graphics.Canvas;
4 |
5 | import com.jeremyfeinstein.slidingmenu.example.R;
6 | import com.jeremyfeinstein.slidingmenu.example.R.string;
7 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.CanvasTransformer;
8 |
9 | public class CustomZoomAnimation extends CustomAnimation {
10 |
11 | public CustomZoomAnimation() {
12 | // see the class CustomAnimation for how to attach
13 | // the CanvasTransformer to the SlidingMenu
14 | super(R.string.anim_zoom, new CanvasTransformer() {
15 | @Override
16 | public void transformCanvas(Canvas canvas, float percentOpen) {
17 | float scale = (float) (percentOpen*0.25 + 0.75);
18 | canvas.scale(scale, scale, canvas.getWidth()/2, canvas.getHeight()/2);
19 | }
20 | });
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/fragments/BirdActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.fragments;
2 |
3 | import android.app.Activity;
4 | import android.content.Intent;
5 | import android.content.res.TypedArray;
6 | import android.graphics.Color;
7 | import android.graphics.drawable.ColorDrawable;
8 | import android.os.Bundle;
9 | import android.os.Handler;
10 | import android.view.View;
11 | import android.view.View.OnClickListener;
12 | import android.view.Window;
13 | import android.widget.ImageView;
14 | import android.widget.ImageView.ScaleType;
15 |
16 | import com.actionbarsherlock.app.SherlockActivity;
17 | import com.actionbarsherlock.view.MenuItem;
18 | import com.jeremyfeinstein.slidingmenu.example.R;
19 |
20 | public class BirdActivity extends SherlockActivity {
21 |
22 | private Handler mHandler;
23 |
24 | public static Intent newInstance(Activity activity, int pos) {
25 | Intent intent = new Intent(activity, BirdActivity.class);
26 | intent.putExtra("pos", pos);
27 | return intent;
28 | }
29 |
30 | @Override
31 | public void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | int pos = 0;
34 | if (getIntent().getExtras() != null) {
35 | pos = getIntent().getExtras().getInt("pos");
36 | }
37 |
38 | String[] birds = getResources().getStringArray(R.array.birds);
39 | TypedArray imgs = getResources().obtainTypedArray(R.array.birds_img);
40 | int resId = imgs.getResourceId(pos, -1);
41 |
42 | setTitle(birds[pos]);
43 | getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
44 | ColorDrawable color = new ColorDrawable(Color.BLACK);
45 | color.setAlpha(128);
46 | getSupportActionBar().setBackgroundDrawable(color);
47 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
48 | mHandler = new Handler();
49 |
50 | ImageView imageView = new ImageView(this);
51 | imageView.setScaleType(ScaleType.CENTER_INSIDE);
52 | imageView.setImageResource(resId);
53 | imageView.setOnClickListener(new OnClickListener() {
54 | public void onClick(View v) {
55 | getSupportActionBar().show();
56 | hideActionBarDelayed(mHandler);
57 | }
58 | });
59 | setContentView(imageView);
60 | this.getWindow().setBackgroundDrawableResource(android.R.color.black);
61 | }
62 |
63 | @Override
64 | public void onResume() {
65 | super.onResume();
66 | getSupportActionBar().show();
67 | hideActionBarDelayed(mHandler);
68 | }
69 |
70 | @Override
71 | public boolean onOptionsItemSelected(MenuItem item) {
72 | switch (item.getItemId()) {
73 | case android.R.id.home:
74 | finish();
75 | return true;
76 | }
77 | return super.onOptionsItemSelected(item);
78 | }
79 |
80 | private void hideActionBarDelayed(Handler handler) {
81 | handler.postDelayed(new Runnable() {
82 | public void run() {
83 | getSupportActionBar().hide();
84 | }
85 | }, 2000);
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/fragments/BirdGridFragment.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.fragments;
2 |
3 | import android.content.res.TypedArray;
4 | import android.os.Bundle;
5 | import android.support.v4.app.Fragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.AdapterView;
10 | import android.widget.AdapterView.OnItemClickListener;
11 | import android.widget.BaseAdapter;
12 | import android.widget.GridView;
13 | import android.widget.ImageView;
14 |
15 | import com.jeremyfeinstein.slidingmenu.example.R;
16 |
17 | public class BirdGridFragment extends Fragment {
18 |
19 | private int mPos = -1;
20 | private int mImgRes;
21 |
22 | public BirdGridFragment() { }
23 | public BirdGridFragment(int pos) {
24 | mPos = pos;
25 | }
26 |
27 | @Override
28 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
29 | if (mPos == -1 && savedInstanceState != null)
30 | mPos = savedInstanceState.getInt("mPos");
31 | TypedArray imgs = getResources().obtainTypedArray(R.array.birds_img);
32 | mImgRes = imgs.getResourceId(mPos, -1);
33 |
34 | GridView gv = (GridView) inflater.inflate(R.layout.list_grid, null);
35 | gv.setBackgroundResource(android.R.color.black);
36 | gv.setAdapter(new GridAdapter());
37 | gv.setOnItemClickListener(new OnItemClickListener() {
38 | @Override
39 | public void onItemClick(AdapterView> parent, View view, int position,
40 | long id) {
41 | if (getActivity() == null)
42 | return;
43 | ResponsiveUIActivity activity = (ResponsiveUIActivity) getActivity();
44 | activity.onBirdPressed(mPos);
45 | }
46 | });
47 | return gv;
48 | }
49 |
50 | @Override
51 | public void onSaveInstanceState(Bundle outState) {
52 | super.onSaveInstanceState(outState);
53 | outState.putInt("mPos", mPos);
54 | }
55 |
56 | private class GridAdapter extends BaseAdapter {
57 |
58 | @Override
59 | public int getCount() {
60 | return 30;
61 | }
62 |
63 | @Override
64 | public Object getItem(int position) {
65 | return null;
66 | }
67 |
68 | @Override
69 | public long getItemId(int position) {
70 | return position;
71 | }
72 |
73 | @Override
74 | public View getView(int position, View convertView, ViewGroup parent) {
75 | if (convertView == null) {
76 | convertView = getActivity().getLayoutInflater().inflate(R.layout.grid_item, null);
77 | }
78 | ImageView img = (ImageView) convertView.findViewById(R.id.grid_item_img);
79 | img.setImageResource(mImgRes);
80 | return convertView;
81 | }
82 |
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/fragments/BirdMenuFragment.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.ListFragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ArrayAdapter;
10 | import android.widget.ListView;
11 |
12 | import com.jeremyfeinstein.slidingmenu.example.R;
13 |
14 | public class BirdMenuFragment extends ListFragment {
15 |
16 | @Override
17 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
18 | return inflater.inflate(R.layout.list, null);
19 | }
20 |
21 | @Override
22 | public void onActivityCreated(Bundle savedInstanceState) {
23 | super.onActivityCreated(savedInstanceState);
24 | String[] birds = getResources().getStringArray(R.array.birds);
25 | ArrayAdapter colorAdapter = new ArrayAdapter(getActivity(),
26 | android.R.layout.simple_list_item_1, android.R.id.text1, birds);
27 | setListAdapter(colorAdapter);
28 | }
29 |
30 | @Override
31 | public void onListItemClick(ListView lv, View v, int position, long id) {
32 | Fragment newContent = new BirdGridFragment(position);
33 | if (newContent != null)
34 | switchFragment(newContent);
35 | }
36 |
37 | // the meat of switching the above fragment
38 | private void switchFragment(Fragment fragment) {
39 | if (getActivity() == null)
40 | return;
41 |
42 | if (getActivity() instanceof ResponsiveUIActivity) {
43 | ResponsiveUIActivity ra = (ResponsiveUIActivity) getActivity();
44 | ra.switchContent(fragment);
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/fragments/ColorFragment.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.fragments;
2 |
3 | import com.jeremyfeinstein.slidingmenu.example.R;
4 |
5 | import android.os.Bundle;
6 | import android.support.v4.app.Fragment;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup;
10 | import android.widget.RelativeLayout;
11 |
12 | public class ColorFragment extends Fragment {
13 |
14 | private int mColorRes = -1;
15 |
16 | public ColorFragment() {
17 | this(R.color.white);
18 | }
19 |
20 | public ColorFragment(int colorRes) {
21 | mColorRes = colorRes;
22 | setRetainInstance(true);
23 | }
24 |
25 | @Override
26 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
27 | if (savedInstanceState != null)
28 | mColorRes = savedInstanceState.getInt("mColorRes");
29 | int color = getResources().getColor(mColorRes);
30 | // construct the RelativeLayout
31 | RelativeLayout v = new RelativeLayout(getActivity());
32 | v.setBackgroundColor(color);
33 | return v;
34 | }
35 |
36 | @Override
37 | public void onSaveInstanceState(Bundle outState) {
38 | super.onSaveInstanceState(outState);
39 | outState.putInt("mColorRes", mColorRes);
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/fragments/ColorMenuFragment.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 | import android.support.v4.app.ListFragment;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.ArrayAdapter;
10 | import android.widget.ListView;
11 |
12 | import com.jeremyfeinstein.slidingmenu.example.R;
13 |
14 | public class ColorMenuFragment extends ListFragment {
15 |
16 | @Override
17 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
18 | return inflater.inflate(R.layout.list, null);
19 | }
20 |
21 | @Override
22 | public void onActivityCreated(Bundle savedInstanceState) {
23 | super.onActivityCreated(savedInstanceState);
24 | String[] colors = getResources().getStringArray(R.array.color_names);
25 | ArrayAdapter colorAdapter = new ArrayAdapter(getActivity(),
26 | android.R.layout.simple_list_item_1, android.R.id.text1, colors);
27 | setListAdapter(colorAdapter);
28 | }
29 |
30 | @Override
31 | public void onListItemClick(ListView lv, View v, int position, long id) {
32 | Fragment newContent = null;
33 | switch (position) {
34 | case 0:
35 | newContent = new ColorFragment(R.color.red);
36 | break;
37 | case 1:
38 | newContent = new ColorFragment(R.color.green);
39 | break;
40 | case 2:
41 | newContent = new ColorFragment(R.color.blue);
42 | break;
43 | case 3:
44 | newContent = new ColorFragment(android.R.color.white);
45 | break;
46 | case 4:
47 | newContent = new ColorFragment(android.R.color.black);
48 | break;
49 | }
50 | if (newContent != null)
51 | switchFragment(newContent);
52 | }
53 |
54 | // the meat of switching the above fragment
55 | private void switchFragment(Fragment fragment) {
56 | if (getActivity() == null)
57 | return;
58 |
59 | if (getActivity() instanceof FragmentChangeActivity) {
60 | FragmentChangeActivity fca = (FragmentChangeActivity) getActivity();
61 | fca.switchContent(fragment);
62 | } else if (getActivity() instanceof ResponsiveUIActivity) {
63 | ResponsiveUIActivity ra = (ResponsiveUIActivity) getActivity();
64 | ra.switchContent(fragment);
65 | }
66 | }
67 |
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/fragments/FragmentChangeActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.fragments;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.Fragment;
5 |
6 | import com.jeremyfeinstein.slidingmenu.example.BaseActivity;
7 | import com.jeremyfeinstein.slidingmenu.example.R;
8 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
9 |
10 | public class FragmentChangeActivity extends BaseActivity {
11 |
12 | private Fragment mContent;
13 |
14 | public FragmentChangeActivity() {
15 | super(R.string.changing_fragments);
16 | }
17 |
18 | @Override
19 | public void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | // set the Above View
22 | if (savedInstanceState != null)
23 | mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
24 | if (mContent == null)
25 | mContent = new ColorFragment(R.color.red);
26 |
27 | // set the Above View
28 | setContentView(R.layout.content_frame);
29 | getSupportFragmentManager()
30 | .beginTransaction()
31 | .replace(R.id.content_frame, mContent)
32 | .commit();
33 |
34 | // set the Behind View
35 | setBehindContentView(R.layout.menu_frame);
36 | getSupportFragmentManager()
37 | .beginTransaction()
38 | .replace(R.id.menu_frame, new ColorMenuFragment())
39 | .commit();
40 |
41 | // customize the SlidingMenu
42 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
43 | }
44 |
45 | @Override
46 | public void onSaveInstanceState(Bundle outState) {
47 | super.onSaveInstanceState(outState);
48 | getSupportFragmentManager().putFragment(outState, "mContent", mContent);
49 | }
50 |
51 | public void switchContent(Fragment fragment) {
52 | mContent = fragment;
53 | getSupportFragmentManager()
54 | .beginTransaction()
55 | .replace(R.id.content_frame, fragment)
56 | .commit();
57 | getSlidingMenu().showContent();
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/example/src/com/jeremyfeinstein/slidingmenu/example/fragments/ResponsiveUIActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.example.fragments;
2 |
3 | import android.app.AlertDialog;
4 | import android.content.Intent;
5 | import android.os.Bundle;
6 | import android.os.Handler;
7 | import android.support.v4.app.Fragment;
8 | import android.view.View;
9 |
10 | import com.actionbarsherlock.view.MenuItem;
11 | import com.jeremyfeinstein.slidingmenu.example.R;
12 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
13 | import com.jeremyfeinstein.slidingmenu.lib.app.SlidingFragmentActivity;
14 |
15 | /**
16 | * This activity is an example of a responsive Android UI.
17 | * On phones, the SlidingMenu will be enabled only in portrait mode.
18 | * In landscape mode, it will present itself as a dual pane layout.
19 | * On tablets, it will will do the same general thing. In portrait
20 | * mode, it will enable the SlidingMenu, and in landscape mode, it
21 | * will be a dual pane layout.
22 | *
23 | * @author jeremy
24 | *
25 | */
26 | public class ResponsiveUIActivity extends SlidingFragmentActivity {
27 |
28 | private Fragment mContent;
29 |
30 | @Override
31 | public void onCreate(Bundle savedInstanceState) {
32 | super.onCreate(savedInstanceState);
33 | setTitle(R.string.responsive_ui);
34 |
35 | setContentView(R.layout.responsive_content_frame);
36 |
37 | // check if the content frame contains the menu frame
38 | if (findViewById(R.id.menu_frame) == null) {
39 | setBehindContentView(R.layout.menu_frame);
40 | getSlidingMenu().setSlidingEnabled(true);
41 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
42 | // show home as up so we can toggle
43 | getSupportActionBar().setDisplayHomeAsUpEnabled(true);
44 | } else {
45 | // add a dummy view
46 | View v = new View(this);
47 | setBehindContentView(v);
48 | getSlidingMenu().setSlidingEnabled(false);
49 | getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
50 | }
51 |
52 | // set the Above View Fragment
53 | if (savedInstanceState != null)
54 | mContent = getSupportFragmentManager().getFragment(savedInstanceState, "mContent");
55 | if (mContent == null)
56 | mContent = new BirdGridFragment(0);
57 | getSupportFragmentManager()
58 | .beginTransaction()
59 | .replace(R.id.content_frame, mContent)
60 | .commit();
61 |
62 | // set the Behind View Fragment
63 | getSupportFragmentManager()
64 | .beginTransaction()
65 | .replace(R.id.menu_frame, new BirdMenuFragment())
66 | .commit();
67 |
68 | // customize the SlidingMenu
69 | SlidingMenu sm = getSlidingMenu();
70 | sm.setBehindOffsetRes(R.dimen.slidingmenu_offset);
71 | sm.setShadowWidthRes(R.dimen.shadow_width);
72 | sm.setShadowDrawable(R.drawable.shadow);
73 | sm.setBehindScrollScale(0.25f);
74 | sm.setFadeDegree(0.25f);
75 |
76 | // show the explanation dialog
77 | if (savedInstanceState == null)
78 | new AlertDialog.Builder(this)
79 | .setTitle(R.string.what_is_this)
80 | .setMessage(R.string.responsive_explanation)
81 | .show();
82 | }
83 |
84 | @Override
85 | public boolean onOptionsItemSelected(MenuItem item) {
86 | switch (item.getItemId()) {
87 | case android.R.id.home:
88 | toggle();
89 | }
90 | return super.onOptionsItemSelected(item);
91 | }
92 |
93 | @Override
94 | public void onSaveInstanceState(Bundle outState) {
95 | super.onSaveInstanceState(outState);
96 | getSupportFragmentManager().putFragment(outState, "mContent", mContent);
97 | }
98 |
99 | public void switchContent(final Fragment fragment) {
100 | mContent = fragment;
101 | getSupportFragmentManager()
102 | .beginTransaction()
103 | .replace(R.id.content_frame, fragment)
104 | .commit();
105 | Handler h = new Handler();
106 | h.postDelayed(new Runnable() {
107 | public void run() {
108 | getSlidingMenu().showContent();
109 | }
110 | }, 50);
111 | }
112 |
113 | public void onBirdPressed(int pos) {
114 | Intent intent = BirdActivity.newInstance(this, pos);
115 | startActivity(intent);
116 | }
117 |
118 | }
119 |
--------------------------------------------------------------------------------
/library-maps-support/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.
--------------------------------------------------------------------------------
/library-maps-support/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 4.0.0
5 |
6 | slidingmenu-maps-support
7 | SlidingMenu Maps Support
8 | jar
9 |
10 |
11 | com.jeremyfeinstein.slidingmenu
12 | parent
13 | 1.3-SNAPSHOT
14 | ../pom.xml
15 |
16 |
17 |
18 |
19 | com.jeremyfeinstein.slidingmenu
20 | slidingmenu
21 | true
22 |
23 |
24 | com.google.android.maps
25 | maps
26 |
27 |
28 |
29 |
30 | src
31 |
32 |
33 |
34 | com.jayway.maven.plugins.android.generation2
35 | android-maven-plugin
36 | true
37 |
38 | ignored
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/library-maps-support/src/com/jeremyfeinstein/slidingmenu/lib/app/SlidingMapActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib.app;
2 |
3 | import android.os.Bundle;
4 | import android.view.KeyEvent;
5 | import android.view.View;
6 | import android.view.ViewGroup.LayoutParams;
7 |
8 | import com.google.android.maps.MapActivity;
9 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
10 |
11 | public abstract class SlidingMapActivity extends MapActivity implements SlidingActivityBase {
12 |
13 | private SlidingActivityHelper mHelper;
14 |
15 | /* (non-Javadoc)
16 | * @see com.google.android.maps.MapActivity#onCreate(android.os.Bundle)
17 | */
18 | @Override
19 | public void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | mHelper = new SlidingActivityHelper(this);
22 | mHelper.onCreate(savedInstanceState);
23 | }
24 |
25 | /* (non-Javadoc)
26 | * @see android.app.Activity#onPostCreate(android.os.Bundle)
27 | */
28 | @Override
29 | public void onPostCreate(Bundle savedInstanceState) {
30 | super.onPostCreate(savedInstanceState);
31 | mHelper.onPostCreate(savedInstanceState);
32 | }
33 |
34 | /* (non-Javadoc)
35 | * @see android.app.Activity#findViewById(int)
36 | */
37 | @Override
38 | public View findViewById(int id) {
39 | View v = super.findViewById(id);
40 | if (v != null)
41 | return v;
42 | return mHelper.findViewById(id);
43 | }
44 |
45 | /* (non-Javadoc)
46 | * @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
47 | */
48 | @Override
49 | protected void onSaveInstanceState(Bundle outState) {
50 | super.onSaveInstanceState(outState);
51 | mHelper.onSaveInstanceState(outState);
52 | }
53 |
54 | /* (non-Javadoc)
55 | * @see android.app.Activity#setContentView(int)
56 | */
57 | @Override
58 | public void setContentView(int id) {
59 | setContentView(getLayoutInflater().inflate(id, null));
60 | }
61 |
62 | /* (non-Javadoc)
63 | * @see android.app.Activity#setContentView(android.view.View)
64 | */
65 | @Override
66 | public void setContentView(View v) {
67 | setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
68 | }
69 |
70 | /* (non-Javadoc)
71 | * @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
72 | */
73 | @Override
74 | public void setContentView(View v, LayoutParams params) {
75 | super.setContentView(v, params);
76 | mHelper.registerAboveContentView(v, params);
77 | }
78 |
79 | /* (non-Javadoc)
80 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
81 | */
82 | public void setBehindContentView(int id) {
83 | setBehindContentView(getLayoutInflater().inflate(id, null));
84 | }
85 |
86 | /* (non-Javadoc)
87 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
88 | */
89 | public void setBehindContentView(View v) {
90 | setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
91 | }
92 |
93 | /* (non-Javadoc)
94 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
95 | */
96 | public void setBehindContentView(View v, LayoutParams params) {
97 | mHelper.setBehindContentView(v, params);
98 | }
99 |
100 | /* (non-Javadoc)
101 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
102 | */
103 | public SlidingMenu getSlidingMenu() {
104 | return mHelper.getSlidingMenu();
105 | }
106 |
107 | /* (non-Javadoc)
108 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
109 | */
110 | public void toggle() {
111 | mHelper.toggle();
112 | }
113 |
114 | /* (non-Javadoc)
115 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
116 | */
117 | public void showContent() {
118 | mHelper.showContent();
119 | }
120 |
121 | /* (non-Javadoc)
122 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
123 | */
124 | public void showMenu() {
125 | mHelper.showMenu();
126 | }
127 |
128 | /* (non-Javadoc)
129 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
130 | */
131 | public void showSecondaryMenu() {
132 | mHelper.showSecondaryMenu();
133 | }
134 |
135 | /* (non-Javadoc)
136 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
137 | */
138 | public void setSlidingActionBarEnabled(boolean b) {
139 | mHelper.setSlidingActionBarEnabled(b);
140 | }
141 |
142 | /* (non-Javadoc)
143 | * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
144 | */
145 | @Override
146 | public boolean onKeyUp(int keyCode, KeyEvent event) {
147 | boolean b = mHelper.onKeyUp(keyCode, event);
148 | if (b) return b;
149 | return super.onKeyUp(keyCode, event);
150 | }
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/library/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/library/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
--------------------------------------------------------------------------------
/library/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.
--------------------------------------------------------------------------------
/library/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenCentral()
4 | }
5 | dependencies {
6 | classpath 'com.android.tools.build:gradle:0.4.+'
7 | }
8 | }
9 | apply plugin: 'android-library'
10 |
11 | dependencies {
12 | compile 'com.android.support:support-v4:13.0.0'
13 | }
14 |
15 | android {
16 | compileSdkVersion 17
17 | buildToolsVersion "17.0.0"
18 |
19 | defaultConfig {
20 | minSdkVersion 7
21 | targetSdkVersion 16
22 | }
23 |
24 | sourceSets {
25 | main {
26 | java.srcDirs = ['src']
27 | resources.srcDirs = ['src']
28 | aidl.srcDirs = ['src']
29 | renderscript.srcDirs = ['src']
30 | res.srcDirs = ['res']
31 | assets.srcDirs = ['assets']
32 |
33 | manifest.srcFile 'AndroidManifest.xml'
34 | }
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/library/library.iml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/library/libs/android-support-v4.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jfeinstein10/SlidingMenu/4254feca3ece9397cd501921ee733f19ea0fdad8/library/libs/android-support-v4.jar
--------------------------------------------------------------------------------
/library/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 4.0.0
5 |
6 | slidingmenu
7 | SlidingMenu
8 | apklib
9 |
10 |
11 | com.jeremyfeinstein.slidingmenu
12 | parent
13 | 1.3-SNAPSHOT
14 | ../pom.xml
15 |
16 |
17 |
18 |
19 | com.google.android
20 | android
21 |
22 |
23 | com.google.android
24 | support-v4
25 |
26 |
27 |
28 |
29 | src
30 |
31 |
32 |
33 | com.jayway.maven.plugins.android.generation2
34 | android-maven-plugin
35 | true
36 |
37 | ignored
38 |
39 |
40 |
41 |
42 | org.codehaus.mojo
43 | build-helper-maven-plugin
44 | 1.7
45 |
46 |
47 | package
48 |
49 | attach-artifact
50 |
51 |
52 |
53 |
54 | jar
55 | ${project.build.directory}/${project.build.finalName}.jar
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/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 use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | android.library=true
11 | # Project target.
12 | target=android-16
13 |
14 |
--------------------------------------------------------------------------------
/library/res/layout/slidingmenumain.xml:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/library/res/values/attrs.xml:
--------------------------------------------------------------------------------
1 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/library/res/values/ids.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/CanvasTransformerBuilder.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib;
2 |
3 | import android.graphics.Canvas;
4 | import android.view.animation.Interpolator;
5 |
6 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.CanvasTransformer;
7 |
8 | public class CanvasTransformerBuilder {
9 |
10 | private CanvasTransformer mTrans;
11 |
12 | private static Interpolator lin = new Interpolator() {
13 | public float getInterpolation(float t) {
14 | return t;
15 | }
16 | };
17 |
18 | private void initTransformer() {
19 | if (mTrans == null)
20 | mTrans = new CanvasTransformer() {
21 | public void transformCanvas(Canvas canvas, float percentOpen) { }
22 | };
23 | }
24 |
25 | public CanvasTransformer zoom(final int openedX, final int closedX,
26 | final int openedY, final int closedY,
27 | final int px, final int py) {
28 | return zoom(openedX, closedX, openedY, closedY, px, py, lin);
29 | }
30 |
31 | public CanvasTransformer zoom(final int openedX, final int closedX,
32 | final int openedY, final int closedY,
33 | final int px, final int py, final Interpolator interp) {
34 | initTransformer();
35 | mTrans = new CanvasTransformer() {
36 | public void transformCanvas(Canvas canvas, float percentOpen) {
37 | mTrans.transformCanvas(canvas, percentOpen);
38 | float f = interp.getInterpolation(percentOpen);
39 | canvas.scale((openedX - closedX) * f + closedX,
40 | (openedY - closedY) * f + closedY, px, py);
41 | }
42 | };
43 | return mTrans;
44 | }
45 |
46 | public CanvasTransformer rotate(final int openedDeg, final int closedDeg,
47 | final int px, final int py) {
48 | return rotate(openedDeg, closedDeg, px, py, lin);
49 | }
50 |
51 | public CanvasTransformer rotate(final int openedDeg, final int closedDeg,
52 | final int px, final int py, final Interpolator interp) {
53 | initTransformer();
54 | mTrans = new CanvasTransformer() {
55 | public void transformCanvas(Canvas canvas, float percentOpen) {
56 | mTrans.transformCanvas(canvas, percentOpen);
57 | float f = interp.getInterpolation(percentOpen);
58 | canvas.rotate((openedDeg - closedDeg) * f + closedDeg,
59 | px, py);
60 | }
61 | };
62 | return mTrans;
63 | }
64 |
65 | public CanvasTransformer translate(final int openedX, final int closedX,
66 | final int openedY, final int closedY) {
67 | return translate(openedX, closedX, openedY, closedY, lin);
68 | }
69 |
70 | public CanvasTransformer translate(final int openedX, final int closedX,
71 | final int openedY, final int closedY, final Interpolator interp) {
72 | initTransformer();
73 | mTrans = new CanvasTransformer() {
74 | public void transformCanvas(Canvas canvas, float percentOpen) {
75 | mTrans.transformCanvas(canvas, percentOpen);
76 | float f = interp.getInterpolation(percentOpen);
77 | canvas.translate((openedX - closedX) * f + closedX,
78 | (openedY - closedY) * f + closedY);
79 | }
80 | };
81 | return mTrans;
82 | }
83 |
84 | public CanvasTransformer concatTransformer(final CanvasTransformer t) {
85 | initTransformer();
86 | mTrans = new CanvasTransformer() {
87 | public void transformCanvas(Canvas canvas, float percentOpen) {
88 | mTrans.transformCanvas(canvas, percentOpen);
89 | t.transformCanvas(canvas, percentOpen);
90 | }
91 | };
92 | return mTrans;
93 | }
94 |
95 | }
96 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/CustomViewBehind.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib;
2 |
3 | import android.content.Context;
4 | import android.graphics.Bitmap;
5 | import android.graphics.Canvas;
6 | import android.graphics.Color;
7 | import android.graphics.Paint;
8 | import android.graphics.drawable.Drawable;
9 | import android.util.AttributeSet;
10 | import android.util.Log;
11 | import android.util.TypedValue;
12 | import android.view.MotionEvent;
13 | import android.view.View;
14 | import android.view.ViewGroup;
15 |
16 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.CanvasTransformer;
17 |
18 | public class CustomViewBehind extends ViewGroup {
19 |
20 | private static final String TAG = "CustomViewBehind";
21 |
22 | private static final int MARGIN_THRESHOLD = 48; // dips
23 | private int mTouchMode = SlidingMenu.TOUCHMODE_MARGIN;
24 |
25 | private CustomViewAbove mViewAbove;
26 |
27 | private View mContent;
28 | private View mSecondaryContent;
29 | private int mMarginThreshold;
30 | private int mWidthOffset;
31 | private CanvasTransformer mTransformer;
32 | private boolean mChildrenEnabled;
33 |
34 | public CustomViewBehind(Context context) {
35 | this(context, null);
36 | }
37 |
38 | public CustomViewBehind(Context context, AttributeSet attrs) {
39 | super(context, attrs);
40 | mMarginThreshold = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
41 | MARGIN_THRESHOLD, getResources().getDisplayMetrics());
42 | }
43 |
44 | public void setCustomViewAbove(CustomViewAbove customViewAbove) {
45 | mViewAbove = customViewAbove;
46 | }
47 |
48 | public void setCanvasTransformer(CanvasTransformer t) {
49 | mTransformer = t;
50 | }
51 |
52 | public void setWidthOffset(int i) {
53 | mWidthOffset = i;
54 | requestLayout();
55 | }
56 |
57 | public void setMarginThreshold(int marginThreshold) {
58 | mMarginThreshold = marginThreshold;
59 | }
60 |
61 | public int getMarginThreshold() {
62 | return mMarginThreshold;
63 | }
64 |
65 | public int getBehindWidth() {
66 | return mContent.getWidth();
67 | }
68 |
69 | public void setContent(View v) {
70 | if (mContent != null)
71 | removeView(mContent);
72 | mContent = v;
73 | addView(mContent);
74 | }
75 |
76 | public View getContent() {
77 | return mContent;
78 | }
79 |
80 | /**
81 | * Sets the secondary (right) menu for use when setMode is called with SlidingMenu.LEFT_RIGHT.
82 | * @param v the right menu
83 | */
84 | public void setSecondaryContent(View v) {
85 | if (mSecondaryContent != null)
86 | removeView(mSecondaryContent);
87 | mSecondaryContent = v;
88 | addView(mSecondaryContent);
89 | }
90 |
91 | public View getSecondaryContent() {
92 | return mSecondaryContent;
93 | }
94 |
95 | public void setChildrenEnabled(boolean enabled) {
96 | mChildrenEnabled = enabled;
97 | }
98 |
99 | @Override
100 | public void scrollTo(int x, int y) {
101 | super.scrollTo(x, y);
102 | if (mTransformer != null)
103 | invalidate();
104 | }
105 |
106 | @Override
107 | public boolean onInterceptTouchEvent(MotionEvent e) {
108 | return !mChildrenEnabled;
109 | }
110 |
111 | @Override
112 | public boolean onTouchEvent(MotionEvent e) {
113 | return !mChildrenEnabled;
114 | }
115 |
116 | @Override
117 | protected void dispatchDraw(Canvas canvas) {
118 | if (mTransformer != null) {
119 | canvas.save();
120 | mTransformer.transformCanvas(canvas, mViewAbove.getPercentOpen());
121 | super.dispatchDraw(canvas);
122 | canvas.restore();
123 | } else
124 | super.dispatchDraw(canvas);
125 | }
126 |
127 | @Override
128 | protected void onLayout(boolean changed, int l, int t, int r, int b) {
129 | final int width = r - l;
130 | final int height = b - t;
131 | mContent.layout(0, 0, width-mWidthOffset, height);
132 | if (mSecondaryContent != null)
133 | mSecondaryContent.layout(0, 0, width-mWidthOffset, height);
134 | }
135 |
136 | @Override
137 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
138 | int width = getDefaultSize(0, widthMeasureSpec);
139 | int height = getDefaultSize(0, heightMeasureSpec);
140 | setMeasuredDimension(width, height);
141 | final int contentWidth = getChildMeasureSpec(widthMeasureSpec, 0, width-mWidthOffset);
142 | final int contentHeight = getChildMeasureSpec(heightMeasureSpec, 0, height);
143 | mContent.measure(contentWidth, contentHeight);
144 | if (mSecondaryContent != null)
145 | mSecondaryContent.measure(contentWidth, contentHeight);
146 | }
147 |
148 | private int mMode;
149 | private boolean mFadeEnabled;
150 | private final Paint mFadePaint = new Paint();
151 | private float mScrollScale;
152 | private Drawable mShadowDrawable;
153 | private Drawable mSecondaryShadowDrawable;
154 | private int mShadowWidth;
155 | private float mFadeDegree;
156 |
157 | public void setMode(int mode) {
158 | if (mode == SlidingMenu.LEFT || mode == SlidingMenu.RIGHT) {
159 | if (mContent != null)
160 | mContent.setVisibility(View.VISIBLE);
161 | if (mSecondaryContent != null)
162 | mSecondaryContent.setVisibility(View.INVISIBLE);
163 | }
164 | mMode = mode;
165 | }
166 |
167 | public int getMode() {
168 | return mMode;
169 | }
170 |
171 | public void setScrollScale(float scrollScale) {
172 | mScrollScale = scrollScale;
173 | }
174 |
175 | public float getScrollScale() {
176 | return mScrollScale;
177 | }
178 |
179 | public void setShadowDrawable(Drawable shadow) {
180 | mShadowDrawable = shadow;
181 | invalidate();
182 | }
183 |
184 | public void setSecondaryShadowDrawable(Drawable shadow) {
185 | mSecondaryShadowDrawable = shadow;
186 | invalidate();
187 | }
188 |
189 | public void setShadowWidth(int width) {
190 | mShadowWidth = width;
191 | invalidate();
192 | }
193 |
194 | public void setFadeEnabled(boolean b) {
195 | mFadeEnabled = b;
196 | }
197 |
198 | public void setFadeDegree(float degree) {
199 | if (degree > 1.0f || degree < 0.0f)
200 | throw new IllegalStateException("The BehindFadeDegree must be between 0.0f and 1.0f");
201 | mFadeDegree = degree;
202 | }
203 |
204 | public int getMenuPage(int page) {
205 | page = (page > 1) ? 2 : ((page < 1) ? 0 : page);
206 | if (mMode == SlidingMenu.LEFT && page > 1) {
207 | return 0;
208 | } else if (mMode == SlidingMenu.RIGHT && page < 1) {
209 | return 2;
210 | } else {
211 | return page;
212 | }
213 | }
214 |
215 | public void scrollBehindTo(View content, int x, int y) {
216 | int vis = View.VISIBLE;
217 | if (mMode == SlidingMenu.LEFT) {
218 | if (x >= content.getLeft()) vis = View.INVISIBLE;
219 | scrollTo((int)((x + getBehindWidth())*mScrollScale), y);
220 | } else if (mMode == SlidingMenu.RIGHT) {
221 | if (x <= content.getLeft()) vis = View.INVISIBLE;
222 | scrollTo((int)(getBehindWidth() - getWidth() +
223 | (x-getBehindWidth())*mScrollScale), y);
224 | } else if (mMode == SlidingMenu.LEFT_RIGHT) {
225 | mContent.setVisibility(x >= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
226 | mSecondaryContent.setVisibility(x <= content.getLeft() ? View.INVISIBLE : View.VISIBLE);
227 | vis = x == 0 ? View.INVISIBLE : View.VISIBLE;
228 | if (x <= content.getLeft()) {
229 | scrollTo((int)((x + getBehindWidth())*mScrollScale), y);
230 | } else {
231 | scrollTo((int)(getBehindWidth() - getWidth() +
232 | (x-getBehindWidth())*mScrollScale), y);
233 | }
234 | }
235 | if (vis == View.INVISIBLE)
236 | Log.v(TAG, "behind INVISIBLE");
237 | setVisibility(vis);
238 | }
239 |
240 | public int getMenuLeft(View content, int page) {
241 | if (mMode == SlidingMenu.LEFT) {
242 | switch (page) {
243 | case 0:
244 | return content.getLeft() - getBehindWidth();
245 | case 2:
246 | return content.getLeft();
247 | }
248 | } else if (mMode == SlidingMenu.RIGHT) {
249 | switch (page) {
250 | case 0:
251 | return content.getLeft();
252 | case 2:
253 | return content.getLeft() + getBehindWidth();
254 | }
255 | } else if (mMode == SlidingMenu.LEFT_RIGHT) {
256 | switch (page) {
257 | case 0:
258 | return content.getLeft() - getBehindWidth();
259 | case 2:
260 | return content.getLeft() + getBehindWidth();
261 | }
262 | }
263 | return content.getLeft();
264 | }
265 |
266 | public int getAbsLeftBound(View content) {
267 | if (mMode == SlidingMenu.LEFT || mMode == SlidingMenu.LEFT_RIGHT) {
268 | return content.getLeft() - getBehindWidth();
269 | } else if (mMode == SlidingMenu.RIGHT) {
270 | return content.getLeft();
271 | }
272 | return 0;
273 | }
274 |
275 | public int getAbsRightBound(View content) {
276 | if (mMode == SlidingMenu.LEFT) {
277 | return content.getLeft();
278 | } else if (mMode == SlidingMenu.RIGHT || mMode == SlidingMenu.LEFT_RIGHT) {
279 | return content.getLeft() + getBehindWidth();
280 | }
281 | return 0;
282 | }
283 |
284 | public boolean marginTouchAllowed(View content, int x) {
285 | int left = content.getLeft();
286 | int right = content.getRight();
287 | if (mMode == SlidingMenu.LEFT) {
288 | return (x >= left && x <= mMarginThreshold + left);
289 | } else if (mMode == SlidingMenu.RIGHT) {
290 | return (x <= right && x >= right - mMarginThreshold);
291 | } else if (mMode == SlidingMenu.LEFT_RIGHT) {
292 | return (x >= left && x <= mMarginThreshold + left) ||
293 | (x <= right && x >= right - mMarginThreshold);
294 | }
295 | return false;
296 | }
297 |
298 | public void setTouchMode(int i) {
299 | mTouchMode = i;
300 | }
301 |
302 | public boolean menuOpenTouchAllowed(View content, int currPage, float x) {
303 | switch (mTouchMode) {
304 | case SlidingMenu.TOUCHMODE_FULLSCREEN:
305 | return true;
306 | case SlidingMenu.TOUCHMODE_MARGIN:
307 | return menuTouchInQuickReturn(content, currPage, x);
308 | }
309 | return false;
310 | }
311 |
312 | public boolean menuTouchInQuickReturn(View content, int currPage, float x) {
313 | if (mMode == SlidingMenu.LEFT || (mMode == SlidingMenu.LEFT_RIGHT && currPage == 0)) {
314 | return x >= content.getLeft();
315 | } else if (mMode == SlidingMenu.RIGHT || (mMode == SlidingMenu.LEFT_RIGHT && currPage == 2)) {
316 | return x <= content.getRight();
317 | }
318 | return false;
319 | }
320 |
321 | public boolean menuClosedSlideAllowed(float dx) {
322 | if (mMode == SlidingMenu.LEFT) {
323 | return dx > 0;
324 | } else if (mMode == SlidingMenu.RIGHT) {
325 | return dx < 0;
326 | } else if (mMode == SlidingMenu.LEFT_RIGHT) {
327 | return true;
328 | }
329 | return false;
330 | }
331 |
332 | public boolean menuOpenSlideAllowed(float dx) {
333 | if (mMode == SlidingMenu.LEFT) {
334 | return dx < 0;
335 | } else if (mMode == SlidingMenu.RIGHT) {
336 | return dx > 0;
337 | } else if (mMode == SlidingMenu.LEFT_RIGHT) {
338 | return true;
339 | }
340 | return false;
341 | }
342 |
343 | public void drawShadow(View content, Canvas canvas) {
344 | if (mShadowDrawable == null || mShadowWidth <= 0) return;
345 | int left = 0;
346 | if (mMode == SlidingMenu.LEFT) {
347 | left = content.getLeft() - mShadowWidth;
348 | } else if (mMode == SlidingMenu.RIGHT) {
349 | left = content.getRight();
350 | } else if (mMode == SlidingMenu.LEFT_RIGHT) {
351 | if (mSecondaryShadowDrawable != null) {
352 | left = content.getRight();
353 | mSecondaryShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight());
354 | mSecondaryShadowDrawable.draw(canvas);
355 | }
356 | left = content.getLeft() - mShadowWidth;
357 | }
358 | mShadowDrawable.setBounds(left, 0, left + mShadowWidth, getHeight());
359 | mShadowDrawable.draw(canvas);
360 | }
361 |
362 | public void drawFade(View content, Canvas canvas, float openPercent) {
363 | if (!mFadeEnabled) return;
364 | final int alpha = (int) (mFadeDegree * 255 * Math.abs(1-openPercent));
365 | mFadePaint.setColor(Color.argb(alpha, 0, 0, 0));
366 | int left = 0;
367 | int right = 0;
368 | if (mMode == SlidingMenu.LEFT) {
369 | left = content.getLeft() - getBehindWidth();
370 | right = content.getLeft();
371 | } else if (mMode == SlidingMenu.RIGHT) {
372 | left = content.getRight();
373 | right = content.getRight() + getBehindWidth();
374 | } else if (mMode == SlidingMenu.LEFT_RIGHT) {
375 | left = content.getLeft() - getBehindWidth();
376 | right = content.getLeft();
377 | canvas.drawRect(left, 0, right, getHeight(), mFadePaint);
378 | left = content.getRight();
379 | right = content.getRight() + getBehindWidth();
380 | }
381 | canvas.drawRect(left, 0, right, getHeight(), mFadePaint);
382 | }
383 |
384 | private boolean mSelectorEnabled = true;
385 | private Bitmap mSelectorDrawable;
386 | private View mSelectedView;
387 |
388 | public void drawSelector(View content, Canvas canvas, float openPercent) {
389 | if (!mSelectorEnabled) return;
390 | if (mSelectorDrawable != null && mSelectedView != null) {
391 | String tag = (String) mSelectedView.getTag(R.id.selected_view);
392 | if (tag.equals(TAG+"SelectedView")) {
393 | canvas.save();
394 | int left, right, offset;
395 | offset = (int) (mSelectorDrawable.getWidth() * openPercent);
396 | if (mMode == SlidingMenu.LEFT) {
397 | right = content.getLeft();
398 | left = right - offset;
399 | canvas.clipRect(left, 0, right, getHeight());
400 | canvas.drawBitmap(mSelectorDrawable, left, getSelectorTop(), null);
401 | } else if (mMode == SlidingMenu.RIGHT) {
402 | left = content.getRight();
403 | right = left + offset;
404 | canvas.clipRect(left, 0, right, getHeight());
405 | canvas.drawBitmap(mSelectorDrawable, right - mSelectorDrawable.getWidth(), getSelectorTop(), null);
406 | }
407 | canvas.restore();
408 | }
409 | }
410 | }
411 |
412 | public void setSelectorEnabled(boolean b) {
413 | mSelectorEnabled = b;
414 | }
415 |
416 | public void setSelectedView(View v) {
417 | if (mSelectedView != null) {
418 | mSelectedView.setTag(R.id.selected_view, null);
419 | mSelectedView = null;
420 | }
421 | if (v != null && v.getParent() != null) {
422 | mSelectedView = v;
423 | mSelectedView.setTag(R.id.selected_view, TAG+"SelectedView");
424 | invalidate();
425 | }
426 | }
427 |
428 | private int getSelectorTop() {
429 | int y = mSelectedView.getTop();
430 | y += (mSelectedView.getHeight() - mSelectorDrawable.getHeight()) / 2;
431 | return y;
432 | }
433 |
434 | public void setSelectorBitmap(Bitmap b) {
435 | mSelectorDrawable = b;
436 | refreshDrawableState();
437 | }
438 |
439 | }
440 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/MenuInterface.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib;
2 |
3 | import android.graphics.Canvas;
4 | import android.graphics.drawable.Drawable;
5 | import android.view.View;
6 |
7 | public interface MenuInterface {
8 |
9 | public abstract void scrollBehindTo(int x, int y,
10 | CustomViewBehind cvb, float scrollScale);
11 |
12 | public abstract int getMenuLeft(CustomViewBehind cvb, View content);
13 |
14 | public abstract int getAbsLeftBound(CustomViewBehind cvb, View content);
15 |
16 | public abstract int getAbsRightBound(CustomViewBehind cvb, View content);
17 |
18 | public abstract boolean marginTouchAllowed(View content, int x, int threshold);
19 |
20 | public abstract boolean menuOpenTouchAllowed(View content, int currPage, int x);
21 |
22 | public abstract boolean menuTouchInQuickReturn(View content, int currPage, int x);
23 |
24 | public abstract boolean menuClosedSlideAllowed(int x);
25 |
26 | public abstract boolean menuOpenSlideAllowed(int x);
27 |
28 | public abstract void drawShadow(Canvas canvas, Drawable shadow, int width);
29 |
30 | public abstract void drawFade(Canvas canvas, int alpha,
31 | CustomViewBehind cvb, View content);
32 |
33 | public abstract void drawSelector(View content, Canvas canvas, float percentOpen);
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/app/SlidingActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib.app;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.view.KeyEvent;
6 | import android.view.View;
7 | import android.view.ViewGroup.LayoutParams;
8 |
9 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
10 |
11 | public class SlidingActivity extends Activity implements SlidingActivityBase {
12 |
13 | private SlidingActivityHelper mHelper;
14 |
15 | /* (non-Javadoc)
16 | * @see android.app.Activity#onCreate(android.os.Bundle)
17 | */
18 | @Override
19 | public void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | mHelper = new SlidingActivityHelper(this);
22 | mHelper.onCreate(savedInstanceState);
23 | }
24 |
25 | /* (non-Javadoc)
26 | * @see android.app.Activity#onPostCreate(android.os.Bundle)
27 | */
28 | @Override
29 | public void onPostCreate(Bundle savedInstanceState) {
30 | super.onPostCreate(savedInstanceState);
31 | mHelper.onPostCreate(savedInstanceState);
32 | }
33 |
34 | /* (non-Javadoc)
35 | * @see android.app.Activity#findViewById(int)
36 | */
37 | @Override
38 | public View findViewById(int id) {
39 | View v = super.findViewById(id);
40 | if (v != null)
41 | return v;
42 | return mHelper.findViewById(id);
43 | }
44 |
45 | /* (non-Javadoc)
46 | * @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
47 | */
48 | @Override
49 | protected void onSaveInstanceState(Bundle outState) {
50 | super.onSaveInstanceState(outState);
51 | mHelper.onSaveInstanceState(outState);
52 | }
53 |
54 | /* (non-Javadoc)
55 | * @see android.app.Activity#setContentView(int)
56 | */
57 | @Override
58 | public void setContentView(int id) {
59 | setContentView(getLayoutInflater().inflate(id, null));
60 | }
61 |
62 | /* (non-Javadoc)
63 | * @see android.app.Activity#setContentView(android.view.View)
64 | */
65 | @Override
66 | public void setContentView(View v) {
67 | setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
68 | }
69 |
70 | /* (non-Javadoc)
71 | * @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
72 | */
73 | @Override
74 | public void setContentView(View v, LayoutParams params) {
75 | super.setContentView(v, params);
76 | mHelper.registerAboveContentView(v, params);
77 | }
78 |
79 | /* (non-Javadoc)
80 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
81 | */
82 | public void setBehindContentView(int id) {
83 | setBehindContentView(getLayoutInflater().inflate(id, null));
84 | }
85 |
86 | /* (non-Javadoc)
87 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
88 | */
89 | public void setBehindContentView(View v) {
90 | setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
91 | }
92 |
93 | /* (non-Javadoc)
94 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
95 | */
96 | public void setBehindContentView(View v, LayoutParams params) {
97 | mHelper.setBehindContentView(v, params);
98 | }
99 |
100 | /* (non-Javadoc)
101 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
102 | */
103 | public SlidingMenu getSlidingMenu() {
104 | return mHelper.getSlidingMenu();
105 | }
106 |
107 | /* (non-Javadoc)
108 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
109 | */
110 | public void toggle() {
111 | mHelper.toggle();
112 | }
113 |
114 | /* (non-Javadoc)
115 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
116 | */
117 | public void showContent() {
118 | mHelper.showContent();
119 | }
120 |
121 | /* (non-Javadoc)
122 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
123 | */
124 | public void showMenu() {
125 | mHelper.showMenu();
126 | }
127 |
128 | /* (non-Javadoc)
129 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
130 | */
131 | public void showSecondaryMenu() {
132 | mHelper.showSecondaryMenu();
133 | }
134 |
135 | /* (non-Javadoc)
136 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
137 | */
138 | public void setSlidingActionBarEnabled(boolean b) {
139 | mHelper.setSlidingActionBarEnabled(b);
140 | }
141 |
142 | /* (non-Javadoc)
143 | * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
144 | */
145 | @Override
146 | public boolean onKeyUp(int keyCode, KeyEvent event) {
147 | boolean b = mHelper.onKeyUp(keyCode, event);
148 | if (b) return b;
149 | return super.onKeyUp(keyCode, event);
150 | }
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/app/SlidingActivityBase.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib.app;
2 |
3 | import android.view.View;
4 | import android.view.ViewGroup.LayoutParams;
5 |
6 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
7 |
8 | public interface SlidingActivityBase {
9 |
10 | /**
11 | * Set the behind view content to an explicit view. This view is placed directly into the behind view 's view hierarchy.
12 | * It can itself be a complex view hierarchy.
13 | *
14 | * @param view The desired content to display.
15 | * @param layoutParams Layout parameters for the view.
16 | */
17 | public void setBehindContentView(View view, LayoutParams layoutParams);
18 |
19 | /**
20 | * Set the behind view content to an explicit view. This view is placed directly into the behind view 's view hierarchy.
21 | * It can itself be a complex view hierarchy. When calling this method, the layout parameters of the specified
22 | * view are ignored. Both the width and the height of the view are set by default to MATCH_PARENT. To use your
23 | * own layout parameters, invoke setContentView(android.view.View, android.view.ViewGroup.LayoutParams) instead.
24 | *
25 | * @param view The desired content to display.
26 | */
27 | public void setBehindContentView(View view);
28 |
29 | /**
30 | * Set the behind view content from a layout resource. The resource will be inflated, adding all top-level views
31 | * to the behind view.
32 | *
33 | * @param layoutResID Resource ID to be inflated.
34 | */
35 | public void setBehindContentView(int layoutResID);
36 |
37 | /**
38 | * Gets the SlidingMenu associated with this activity.
39 | *
40 | * @return the SlidingMenu associated with this activity.
41 | */
42 | public SlidingMenu getSlidingMenu();
43 |
44 | /**
45 | * Toggle the SlidingMenu. If it is open, it will be closed, and vice versa.
46 | */
47 | public void toggle();
48 |
49 | /**
50 | * Close the SlidingMenu and show the content view.
51 | */
52 | public void showContent();
53 |
54 | /**
55 | * Open the SlidingMenu and show the menu view.
56 | */
57 | public void showMenu();
58 |
59 | /**
60 | * Open the SlidingMenu and show the secondary (right) menu view. Will default to the regular menu
61 | * if there is only one.
62 | */
63 | public void showSecondaryMenu();
64 |
65 | /**
66 | * Controls whether the ActionBar slides along with the above view when the menu is opened,
67 | * or if it stays in place.
68 | *
69 | * @param slidingActionBarEnabled True if you want the ActionBar to slide along with the SlidingMenu,
70 | * false if you want the ActionBar to stay in place
71 | */
72 | public void setSlidingActionBarEnabled(boolean slidingActionBarEnabled);
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/app/SlidingActivityHelper.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib.app;
2 |
3 | import android.app.Activity;
4 | import android.os.Bundle;
5 | import android.os.Handler;
6 | import android.view.KeyEvent;
7 | import android.view.LayoutInflater;
8 | import android.view.View;
9 | import android.view.ViewGroup.LayoutParams;
10 |
11 | import com.jeremyfeinstein.slidingmenu.lib.R;
12 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
13 |
14 | public class SlidingActivityHelper {
15 |
16 | private Activity mActivity;
17 |
18 | private SlidingMenu mSlidingMenu;
19 |
20 | private View mViewAbove;
21 |
22 | private View mViewBehind;
23 |
24 | private boolean mBroadcasting = false;
25 |
26 | private boolean mOnPostCreateCalled = false;
27 |
28 | private boolean mEnableSlide = true;
29 |
30 | /**
31 | * Instantiates a new SlidingActivityHelper.
32 | *
33 | * @param activity the associated activity
34 | */
35 | public SlidingActivityHelper(Activity activity) {
36 | mActivity = activity;
37 | }
38 |
39 | /**
40 | * Sets mSlidingMenu as a newly inflated SlidingMenu. Should be called within the activitiy's onCreate()
41 | *
42 | * @param savedInstanceState the saved instance state (unused)
43 | */
44 | public void onCreate(Bundle savedInstanceState) {
45 | mSlidingMenu = (SlidingMenu) LayoutInflater.from(mActivity).inflate(R.layout.slidingmenumain, null);
46 | }
47 |
48 | /**
49 | * Further SlidingMenu initialization. Should be called within the activitiy's onPostCreate()
50 | *
51 | * @param savedInstanceState the saved instance state (unused)
52 | */
53 | public void onPostCreate(Bundle savedInstanceState) {
54 | if (mViewBehind == null || mViewAbove == null) {
55 | throw new IllegalStateException("Both setBehindContentView must be called " +
56 | "in onCreate in addition to setContentView.");
57 | }
58 |
59 | mOnPostCreateCalled = true;
60 |
61 | mSlidingMenu.attachToActivity(mActivity,
62 | mEnableSlide ? SlidingMenu.SLIDING_WINDOW : SlidingMenu.SLIDING_CONTENT);
63 |
64 | final boolean open;
65 | final boolean secondary;
66 | if (savedInstanceState != null) {
67 | open = savedInstanceState.getBoolean("SlidingActivityHelper.open");
68 | secondary = savedInstanceState.getBoolean("SlidingActivityHelper.secondary");
69 | } else {
70 | open = false;
71 | secondary = false;
72 | }
73 | new Handler().post(new Runnable() {
74 | public void run() {
75 | if (open) {
76 | if (secondary) {
77 | mSlidingMenu.showSecondaryMenu(false);
78 | } else {
79 | mSlidingMenu.showMenu(false);
80 | }
81 | } else {
82 | mSlidingMenu.showContent(false);
83 | }
84 | }
85 | });
86 | }
87 |
88 | /**
89 | * Controls whether the ActionBar slides along with the above view when the menu is opened,
90 | * or if it stays in place.
91 | *
92 | * @param slidingActionBarEnabled True if you want the ActionBar to slide along with the SlidingMenu,
93 | * false if you want the ActionBar to stay in place
94 | */
95 | public void setSlidingActionBarEnabled(boolean slidingActionBarEnabled) {
96 | if (mOnPostCreateCalled)
97 | throw new IllegalStateException("enableSlidingActionBar must be called in onCreate.");
98 | mEnableSlide = slidingActionBarEnabled;
99 | }
100 |
101 | /**
102 | * Finds a view that was identified by the id attribute from the XML that was processed in onCreate(Bundle).
103 | *
104 | * @param id the resource id of the desired view
105 | * @return The view if found or null otherwise.
106 | */
107 | public View findViewById(int id) {
108 | View v;
109 | if (mSlidingMenu != null) {
110 | v = mSlidingMenu.findViewById(id);
111 | if (v != null)
112 | return v;
113 | }
114 | return null;
115 | }
116 |
117 | /**
118 | * Called to retrieve per-instance state from an activity before being killed so that the state can be
119 | * restored in onCreate(Bundle) or onRestoreInstanceState(Bundle) (the Bundle populated by this method
120 | * will be passed to both).
121 | *
122 | * @param outState Bundle in which to place your saved state.
123 | */
124 | public void onSaveInstanceState(Bundle outState) {
125 | outState.putBoolean("SlidingActivityHelper.open", mSlidingMenu.isMenuShowing());
126 | outState.putBoolean("SlidingActivityHelper.secondary", mSlidingMenu.isSecondaryMenuShowing());
127 | }
128 |
129 | /**
130 | * Register the above content view.
131 | *
132 | * @param v the above content view to register
133 | * @param params LayoutParams for that view (unused)
134 | */
135 | public void registerAboveContentView(View v, LayoutParams params) {
136 | if (!mBroadcasting)
137 | mViewAbove = v;
138 | }
139 |
140 | /**
141 | * Set the activity content to an explicit view. This view is placed directly into the activity's view
142 | * hierarchy. It can itself be a complex view hierarchy. When calling this method, the layout parameters
143 | * of the specified view are ignored. Both the width and the height of the view are set by default to
144 | * MATCH_PARENT. To use your own layout parameters, invoke setContentView(android.view.View,
145 | * android.view.ViewGroup.LayoutParams) instead.
146 | *
147 | * @param v The desired content to display.
148 | */
149 | public void setContentView(View v) {
150 | mBroadcasting = true;
151 | mActivity.setContentView(v);
152 | }
153 |
154 | /**
155 | * Set the behind view content to an explicit view. This view is placed directly into the behind view 's view hierarchy.
156 | * It can itself be a complex view hierarchy.
157 | *
158 | * @param view The desired content to display.
159 | * @param layoutParams Layout parameters for the view. (unused)
160 | */
161 | public void setBehindContentView(View view, LayoutParams layoutParams) {
162 | mViewBehind = view;
163 | mSlidingMenu.setMenu(mViewBehind);
164 | }
165 |
166 | /**
167 | * Gets the SlidingMenu associated with this activity.
168 | *
169 | * @return the SlidingMenu associated with this activity.
170 | */
171 | public SlidingMenu getSlidingMenu() {
172 | return mSlidingMenu;
173 | }
174 |
175 | /**
176 | * Toggle the SlidingMenu. If it is open, it will be closed, and vice versa.
177 | */
178 | public void toggle() {
179 | mSlidingMenu.toggle();
180 | }
181 |
182 | /**
183 | * Close the SlidingMenu and show the content view.
184 | */
185 | public void showContent() {
186 | mSlidingMenu.showContent();
187 | }
188 |
189 | /**
190 | * Open the SlidingMenu and show the menu view.
191 | */
192 | public void showMenu() {
193 | mSlidingMenu.showMenu();
194 | }
195 |
196 | /**
197 | * Open the SlidingMenu and show the secondary menu view. Will default to the regular menu
198 | * if there is only one.
199 | */
200 | public void showSecondaryMenu() {
201 | mSlidingMenu.showSecondaryMenu();
202 | }
203 |
204 | /**
205 | * On key up.
206 | *
207 | * @param keyCode the key code
208 | * @param event the event
209 | * @return true, if successful
210 | */
211 | public boolean onKeyUp(int keyCode, KeyEvent event) {
212 | if (keyCode == KeyEvent.KEYCODE_BACK && mSlidingMenu.isMenuShowing()) {
213 | showContent();
214 | return true;
215 | }
216 | return false;
217 | }
218 |
219 | }
220 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/app/SlidingFragmentActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib.app;
2 |
3 | import android.os.Bundle;
4 | import android.support.v4.app.FragmentActivity;
5 | import android.view.KeyEvent;
6 | import android.view.View;
7 | import android.view.ViewGroup.LayoutParams;
8 |
9 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
10 |
11 | public class SlidingFragmentActivity extends FragmentActivity implements SlidingActivityBase {
12 |
13 | private SlidingActivityHelper mHelper;
14 |
15 | /* (non-Javadoc)
16 | * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
17 | */
18 | @Override
19 | public void onCreate(Bundle savedInstanceState) {
20 | super.onCreate(savedInstanceState);
21 | mHelper = new SlidingActivityHelper(this);
22 | mHelper.onCreate(savedInstanceState);
23 | }
24 |
25 | /* (non-Javadoc)
26 | * @see android.app.Activity#onPostCreate(android.os.Bundle)
27 | */
28 | @Override
29 | public void onPostCreate(Bundle savedInstanceState) {
30 | super.onPostCreate(savedInstanceState);
31 | mHelper.onPostCreate(savedInstanceState);
32 | }
33 |
34 | /* (non-Javadoc)
35 | * @see android.app.Activity#findViewById(int)
36 | */
37 | @Override
38 | public View findViewById(int id) {
39 | View v = super.findViewById(id);
40 | if (v != null)
41 | return v;
42 | return mHelper.findViewById(id);
43 | }
44 |
45 | /* (non-Javadoc)
46 | * @see android.support.v4.app.FragmentActivity#onSaveInstanceState(android.os.Bundle)
47 | */
48 | @Override
49 | protected void onSaveInstanceState(Bundle outState) {
50 | super.onSaveInstanceState(outState);
51 | mHelper.onSaveInstanceState(outState);
52 | }
53 |
54 | /* (non-Javadoc)
55 | * @see android.app.Activity#setContentView(int)
56 | */
57 | @Override
58 | public void setContentView(int id) {
59 | setContentView(getLayoutInflater().inflate(id, null));
60 | }
61 |
62 | /* (non-Javadoc)
63 | * @see android.app.Activity#setContentView(android.view.View)
64 | */
65 | @Override
66 | public void setContentView(View v) {
67 | setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
68 | }
69 |
70 | /* (non-Javadoc)
71 | * @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
72 | */
73 | @Override
74 | public void setContentView(View v, LayoutParams params) {
75 | super.setContentView(v, params);
76 | mHelper.registerAboveContentView(v, params);
77 | }
78 |
79 | /* (non-Javadoc)
80 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
81 | */
82 | public void setBehindContentView(int id) {
83 | setBehindContentView(getLayoutInflater().inflate(id, null));
84 | }
85 |
86 | /* (non-Javadoc)
87 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
88 | */
89 | public void setBehindContentView(View v) {
90 | setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
91 | }
92 |
93 | /* (non-Javadoc)
94 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
95 | */
96 | public void setBehindContentView(View v, LayoutParams params) {
97 | mHelper.setBehindContentView(v, params);
98 | }
99 |
100 | /* (non-Javadoc)
101 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
102 | */
103 | public SlidingMenu getSlidingMenu() {
104 | return mHelper.getSlidingMenu();
105 | }
106 |
107 | /* (non-Javadoc)
108 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
109 | */
110 | public void toggle() {
111 | mHelper.toggle();
112 | }
113 |
114 | /* (non-Javadoc)
115 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
116 | */
117 | public void showContent() {
118 | mHelper.showContent();
119 | }
120 |
121 | /* (non-Javadoc)
122 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
123 | */
124 | public void showMenu() {
125 | mHelper.showMenu();
126 | }
127 |
128 | /* (non-Javadoc)
129 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
130 | */
131 | public void showSecondaryMenu() {
132 | mHelper.showSecondaryMenu();
133 | }
134 |
135 | /* (non-Javadoc)
136 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
137 | */
138 | public void setSlidingActionBarEnabled(boolean b) {
139 | mHelper.setSlidingActionBarEnabled(b);
140 | }
141 |
142 | /* (non-Javadoc)
143 | * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
144 | */
145 | @Override
146 | public boolean onKeyUp(int keyCode, KeyEvent event) {
147 | boolean b = mHelper.onKeyUp(keyCode, event);
148 | if (b) return b;
149 | return super.onKeyUp(keyCode, event);
150 | }
151 |
152 | }
153 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/app/SlidingListActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib.app;
2 |
3 | import android.app.ListActivity;
4 | import android.os.Bundle;
5 | import android.view.KeyEvent;
6 | import android.view.View;
7 | import android.view.ViewGroup.LayoutParams;
8 | import android.widget.ListView;
9 |
10 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
11 |
12 | public class SlidingListActivity extends ListActivity implements SlidingActivityBase {
13 |
14 | private SlidingActivityHelper mHelper;
15 |
16 | /* (non-Javadoc)
17 | * @see android.app.Activity#onCreate(android.os.Bundle)
18 | */
19 | @Override
20 | public void onCreate(Bundle savedInstanceState) {
21 | super.onCreate(savedInstanceState);
22 | mHelper = new SlidingActivityHelper(this);
23 | mHelper.onCreate(savedInstanceState);
24 | ListView listView = new ListView(this);
25 | listView.setId(android.R.id.list);
26 | setContentView(listView);
27 | }
28 |
29 | /* (non-Javadoc)
30 | * @see android.app.Activity#onPostCreate(android.os.Bundle)
31 | */
32 | @Override
33 | public void onPostCreate(Bundle savedInstanceState) {
34 | super.onPostCreate(savedInstanceState);
35 | mHelper.onPostCreate(savedInstanceState);
36 | }
37 |
38 | /* (non-Javadoc)
39 | * @see android.app.Activity#findViewById(int)
40 | */
41 | @Override
42 | public View findViewById(int id) {
43 | View v = super.findViewById(id);
44 | if (v != null)
45 | return v;
46 | return mHelper.findViewById(id);
47 | }
48 |
49 | /* (non-Javadoc)
50 | * @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
51 | */
52 | @Override
53 | protected void onSaveInstanceState(Bundle outState) {
54 | super.onSaveInstanceState(outState);
55 | mHelper.onSaveInstanceState(outState);
56 | }
57 |
58 | /* (non-Javadoc)
59 | * @see android.app.Activity#setContentView(int)
60 | */
61 | @Override
62 | public void setContentView(int id) {
63 | setContentView(getLayoutInflater().inflate(id, null));
64 | }
65 |
66 | /* (non-Javadoc)
67 | * @see android.app.Activity#setContentView(android.view.View)
68 | */
69 | @Override
70 | public void setContentView(View v) {
71 | setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
72 | }
73 |
74 | /* (non-Javadoc)
75 | * @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
76 | */
77 | @Override
78 | public void setContentView(View v, LayoutParams params) {
79 | super.setContentView(v, params);
80 | mHelper.registerAboveContentView(v, params);
81 | }
82 |
83 | /* (non-Javadoc)
84 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
85 | */
86 | public void setBehindContentView(int id) {
87 | setBehindContentView(getLayoutInflater().inflate(id, null));
88 | }
89 |
90 | /* (non-Javadoc)
91 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
92 | */
93 | public void setBehindContentView(View v) {
94 | setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
95 | }
96 |
97 | /* (non-Javadoc)
98 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
99 | */
100 | public void setBehindContentView(View v, LayoutParams params) {
101 | mHelper.setBehindContentView(v, params);
102 | }
103 |
104 | /* (non-Javadoc)
105 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
106 | */
107 | public SlidingMenu getSlidingMenu() {
108 | return mHelper.getSlidingMenu();
109 | }
110 |
111 | /* (non-Javadoc)
112 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
113 | */
114 | public void toggle() {
115 | mHelper.toggle();
116 | }
117 |
118 | /* (non-Javadoc)
119 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
120 | */
121 | public void showContent() {
122 | mHelper.showContent();
123 | }
124 |
125 | /* (non-Javadoc)
126 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
127 | */
128 | public void showMenu() {
129 | mHelper.showMenu();
130 | }
131 |
132 | /*
133 | * (non-Javadoc)
134 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
135 | */
136 | public void showSecondaryMenu() {
137 | mHelper.showSecondaryMenu();
138 | }
139 |
140 | /* (non-Javadoc)
141 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
142 | */
143 | public void setSlidingActionBarEnabled(boolean b) {
144 | mHelper.setSlidingActionBarEnabled(b);
145 | }
146 |
147 | /* (non-Javadoc)
148 | * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
149 | */
150 | @Override
151 | public boolean onKeyUp(int keyCode, KeyEvent event) {
152 | boolean b = mHelper.onKeyUp(keyCode, event);
153 | if (b) return b;
154 | return super.onKeyUp(keyCode, event);
155 | }
156 |
157 | }
158 |
--------------------------------------------------------------------------------
/library/src/com/jeremyfeinstein/slidingmenu/lib/app/SlidingPreferenceActivity.java:
--------------------------------------------------------------------------------
1 | package com.jeremyfeinstein.slidingmenu.lib.app;
2 |
3 | import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu;
4 |
5 | import android.os.Bundle;
6 | import android.preference.PreferenceActivity;
7 | import android.view.KeyEvent;
8 | import android.view.View;
9 | import android.view.ViewGroup.LayoutParams;
10 |
11 | public class SlidingPreferenceActivity extends PreferenceActivity implements SlidingActivityBase {
12 |
13 | private SlidingActivityHelper mHelper;
14 |
15 | /* (non-Javadoc)
16 | * @see android.app.Activity#onCreate(android.os.Bundle)
17 | */
18 | @Override
19 | public void onCreate(Bundle savedInstanceState) {
20 | mHelper = new SlidingActivityHelper(this);
21 | super.onCreate(savedInstanceState);
22 | mHelper.onCreate(savedInstanceState);
23 | }
24 |
25 | /* (non-Javadoc)
26 | * @see android.app.Activity#onPostCreate(android.os.Bundle)
27 | */
28 | @Override
29 | public void onPostCreate(Bundle savedInstanceState) {
30 | super.onPostCreate(savedInstanceState);
31 | mHelper.onPostCreate(savedInstanceState);
32 | }
33 |
34 | /* (non-Javadoc)
35 | * @see android.app.Activity#findViewById(int)
36 | */
37 | @Override
38 | public View findViewById(int id) {
39 | View v = super.findViewById(id);
40 | if (v != null)
41 | return v;
42 | return mHelper.findViewById(id);
43 | }
44 |
45 | /* (non-Javadoc)
46 | * @see android.app.Activity#onSaveInstanceState(android.os.Bundle)
47 | */
48 | @Override
49 | protected void onSaveInstanceState(Bundle outState) {
50 | super.onSaveInstanceState(outState);
51 | mHelper.onSaveInstanceState(outState);
52 | }
53 |
54 | /* (non-Javadoc)
55 | * @see android.app.Activity#setContentView(int)
56 | */
57 | @Override
58 | public void setContentView(int id) {
59 | setContentView(getLayoutInflater().inflate(id, null));
60 | }
61 |
62 | /* (non-Javadoc)
63 | * @see android.app.Activity#setContentView(android.view.View)
64 | */
65 | @Override
66 | public void setContentView(View v) {
67 | setContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
68 | }
69 |
70 | /* (non-Javadoc)
71 | * @see android.app.Activity#setContentView(android.view.View, android.view.ViewGroup.LayoutParams)
72 | */
73 | @Override
74 | public void setContentView(View v, LayoutParams params) {
75 | super.setContentView(v, params);
76 | mHelper.registerAboveContentView(v, params);
77 | }
78 |
79 | /* (non-Javadoc)
80 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(int)
81 | */
82 | public void setBehindContentView(int id) {
83 | setBehindContentView(getLayoutInflater().inflate(id, null));
84 | }
85 |
86 | /* (non-Javadoc)
87 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View)
88 | */
89 | public void setBehindContentView(View v) {
90 | setBehindContentView(v, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
91 | }
92 |
93 | /* (non-Javadoc)
94 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setBehindContentView(android.view.View, android.view.ViewGroup.LayoutParams)
95 | */
96 | public void setBehindContentView(View v, LayoutParams params) {
97 | mHelper.setBehindContentView(v, params);
98 | }
99 |
100 | /* (non-Javadoc)
101 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#getSlidingMenu()
102 | */
103 | public SlidingMenu getSlidingMenu() {
104 | return mHelper.getSlidingMenu();
105 | }
106 |
107 | /* (non-Javadoc)
108 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#toggle()
109 | */
110 | public void toggle() {
111 | mHelper.toggle();
112 | }
113 |
114 | /* (non-Javadoc)
115 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showAbove()
116 | */
117 | public void showContent() {
118 | mHelper.showContent();
119 | }
120 |
121 | /* (non-Javadoc)
122 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showBehind()
123 | */
124 | public void showMenu() {
125 | mHelper.showMenu();
126 | }
127 |
128 | /* (non-Javadoc)
129 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#showSecondaryMenu()
130 | */
131 | public void showSecondaryMenu() {
132 | mHelper.showSecondaryMenu();
133 | }
134 |
135 | /* (non-Javadoc)
136 | * @see com.jeremyfeinstein.slidingmenu.lib.app.SlidingActivityBase#setSlidingActionBarEnabled(boolean)
137 | */
138 | public void setSlidingActionBarEnabled(boolean b) {
139 | mHelper.setSlidingActionBarEnabled(b);
140 | }
141 |
142 | /* (non-Javadoc)
143 | * @see android.app.Activity#onKeyUp(int, android.view.KeyEvent)
144 | */
145 | @Override
146 | public boolean onKeyUp(int keyCode, KeyEvent event) {
147 | boolean b = mHelper.onKeyUp(keyCode, event);
148 | if (b) return b;
149 | return super.onKeyUp(keyCode, event);
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 |
6 | org.sonatype.oss
7 | oss-parent
8 | 7
9 |
10 |
11 | com.jeremyfeinstein.slidingmenu
12 | parent
13 | pom
14 | 1.3-SNAPSHOT
15 |
16 | SlidingMenu (Parent)
17 | SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus like those made popular in the Google+, YouTube, and Facebook apps.
18 | https://github.com/jfeinstein10/SlidingMenu
19 | 2012
20 |
21 |
22 | library
23 | library-maps-support
24 |
25 |
26 |
27 | https://github.com/jfeinstein10/SlidingMenu
28 | scm:git:git://github.com/jfeinstein10/SlidingMenu.git
29 | scm:git:git@github.com:jfeinstein10/SlidingMenu.git
30 |
31 |
32 |
33 |
34 | Jeremy Feinstein
35 | jfeinstein10@gmail.com
36 | jfeinstein10
37 | http://jeremyfeinstein.com
38 | -5
39 |
40 | developer
41 |
42 |
43 |
44 |
45 |
46 |
47 | Apache License Version 2.0
48 | http://www.apache.org/licenses/LICENSE-2.0.txt
49 | repo
50 |
51 |
52 |
53 |
54 |
55 |
56 | com.jeremyfeinstein.slidingmenu
57 | slidingmenu
58 | ${project.version}
59 | jar
60 |
61 |
62 | com.google.android
63 | android
64 | 4.1.1.4
65 |
66 |
67 | com.google.android.maps
68 | maps
69 | 17_r1
70 |
71 |
72 | com.google.android
73 | support-v4
74 | r7
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | com.jayway.maven.plugins.android.generation2
84 | android-maven-plugin
85 | 3.6.0
86 |
87 |
88 |
89 | 16
90 |
91 | true
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------