├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── LICENSE ├── ProcessingDemo.iml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── libs │ └── android-core.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── in │ │ └── omerjerk │ │ └── processingdemo │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── assets │ └── sprite.png │ ├── java │ └── in │ │ └── omerjerk │ │ └── processingdemo │ │ ├── MainActivity.java │ │ ├── NavigationDrawerFragment.java │ │ └── sketch │ │ ├── Directional.java │ │ ├── EmptySketch.java │ │ ├── Particles.java │ │ └── Reflection.java │ └── res │ ├── drawable-hdpi │ ├── drawer_shadow.9.png │ └── ic_drawer.png │ ├── drawable-mdpi │ ├── drawer_shadow.9.png │ └── ic_drawer.png │ ├── drawable-xhdpi │ ├── drawer_shadow.9.png │ └── ic_drawer.png │ ├── drawable-xxhdpi │ ├── drawer_shadow.9.png │ └── ic_drawer.png │ ├── drawable │ └── icon.png │ ├── layout │ ├── activity_main.xml │ ├── fragment_main.xml │ └── fragment_navigation_drawer.xml │ ├── menu │ ├── global.xml │ ├── main.xml │ └── menu_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | Processing Demo -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | {description} 294 | Copyright (C) {year} {fullname} 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | {signature of Ty Coon}, 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | 341 | -------------------------------------------------------------------------------- /ProcessingDemo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProcessingAndroidDemo 2 | This demo explains how to embed processing sketch in your own app. For a step by step guide, head over to this wiki - https://github.com/processing/processing-android/wiki/Using-Eclipse-or-Android-Studio-for-Development 3 | 4 | ##Screenshots: 5 | ![Directional Light](http://i.imgur.com/XLSMzSOl.png) 6 | ![Sketches](http://i.imgur.com/yvGolj6l.png) 7 | ![Particles](http://i.imgur.com/ZYDYUZYl.png) 8 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "in.omerjerk.processingdemo" 9 | minSdkVersion 11 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:appcompat-v7:22.2.0' 25 | } 26 | -------------------------------------------------------------------------------- /app/libs/android-core.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/libs/android-core.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/omerjerk/sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/in/omerjerk/processingdemo/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package in.omerjerk.processingdemo; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/assets/sprite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/assets/sprite.png -------------------------------------------------------------------------------- /app/src/main/java/in/omerjerk/processingdemo/MainActivity.java: -------------------------------------------------------------------------------- 1 | package in.omerjerk.processingdemo; 2 | 3 | import android.content.res.Configuration; 4 | import android.support.v7.app.ActionBarDrawerToggle; 5 | import android.support.v7.app.AppCompatActivity; 6 | import android.support.v7.app.ActionBar; 7 | import android.app.Fragment; 8 | import android.app.FragmentManager; 9 | import android.os.Bundle; 10 | import android.support.v4.widget.DrawerLayout; 11 | import android.view.Menu; 12 | import android.view.MenuItem; 13 | import android.view.View; 14 | 15 | import in.omerjerk.processingdemo.sketch.Directional; 16 | import in.omerjerk.processingdemo.sketch.Particles; 17 | import in.omerjerk.processingdemo.sketch.Reflection; 18 | import processing.core.PApplet; 19 | 20 | public class MainActivity extends AppCompatActivity 21 | implements NavigationDrawerFragment.NavigationDrawerCallbacks { 22 | 23 | /** 24 | * Fragment managing the behaviors, interactions and presentation of the navigation drawer. 25 | */ 26 | private NavigationDrawerFragment mNavigationDrawerFragment; 27 | private DrawerLayout mDrawerLayout; 28 | private ActionBarDrawerToggle mDrawerToggle; 29 | 30 | /** 31 | * Used to store the last screen title. For use in {@link #restoreActionBar()}. 32 | */ 33 | private CharSequence mTitle; 34 | 35 | @Override 36 | protected void onCreate(Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | setContentView(R.layout.activity_main); 39 | 40 | mNavigationDrawerFragment = (NavigationDrawerFragment) 41 | getSupportFragmentManager().findFragmentById(R.id.navigation_drawer); 42 | mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 43 | mTitle = getTitle(); 44 | 45 | // Set up the drawer. 46 | mNavigationDrawerFragment.setUp( 47 | R.id.navigation_drawer, 48 | (DrawerLayout) findViewById(R.id.drawer_layout)); 49 | 50 | mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, 51 | R.string.navigation_drawer_open, R.string.navigation_drawer_close) { 52 | 53 | /** Called when a drawer has settled in a completely closed state. */ 54 | public void onDrawerClosed(View view) { 55 | super.onDrawerClosed(view); 56 | getSupportActionBar().setTitle(mTitle); 57 | invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() 58 | } 59 | 60 | /** Called when a drawer has settled in a completely open state. */ 61 | public void onDrawerOpened(View drawerView) { 62 | super.onDrawerOpened(drawerView); 63 | getSupportActionBar().setTitle(mTitle); 64 | invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() 65 | } 66 | }; 67 | 68 | // Set the drawer toggle as the DrawerListener 69 | mDrawerLayout.setDrawerListener(mDrawerToggle); 70 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 71 | getSupportActionBar().setHomeButtonEnabled(true); 72 | } 73 | 74 | @Override 75 | public void onNavigationDrawerItemSelected(int position) { 76 | // update the main content by replacing fragments 77 | FragmentManager fragmentManager = getFragmentManager(); 78 | Fragment fragment; 79 | switch (position) { 80 | case 0: 81 | fragment = new Directional(); 82 | break; 83 | case 1: 84 | fragment = new Reflection(); 85 | break; 86 | case 2: 87 | fragment = new Particles(); 88 | break; 89 | case 3: 90 | fragment = new PApplet(); 91 | break; 92 | default: 93 | throw new UnsupportedOperationException("Invalid position"); 94 | } 95 | fragmentManager.beginTransaction() 96 | .replace(R.id.container, fragment) 97 | .commit(); 98 | } 99 | 100 | public void onSectionAttached(int number) { 101 | switch (number) { 102 | case 1: 103 | mTitle = getString(R.string.title_directional); 104 | break; 105 | case 2: 106 | mTitle = getString(R.string.title_empty); 107 | break; 108 | } 109 | } 110 | 111 | public void restoreActionBar() { 112 | ActionBar actionBar = getSupportActionBar(); 113 | actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); 114 | actionBar.setDisplayShowTitleEnabled(true); 115 | actionBar.setTitle(mTitle); 116 | } 117 | 118 | 119 | @Override 120 | public boolean onCreateOptionsMenu(Menu menu) { 121 | if (!mNavigationDrawerFragment.isDrawerOpen()) { 122 | // Only show items in the action bar relevant to this screen 123 | // if the drawer is not showing. Otherwise, let the drawer 124 | // decide what to show in the action bar. 125 | getMenuInflater().inflate(R.menu.main, menu); 126 | restoreActionBar(); 127 | return true; 128 | } 129 | return super.onCreateOptionsMenu(menu); 130 | } 131 | 132 | @Override 133 | protected void onPostCreate(Bundle savedInstanceState) { 134 | super.onPostCreate(savedInstanceState); 135 | // Sync the toggle state after onRestoreInstanceState has occurred. 136 | mDrawerToggle.syncState(); 137 | } 138 | 139 | @Override 140 | public void onConfigurationChanged(Configuration newConfig) { 141 | super.onConfigurationChanged(newConfig); 142 | mDrawerToggle.onConfigurationChanged(newConfig); 143 | } 144 | 145 | @Override 146 | public boolean onOptionsItemSelected(MenuItem item) { 147 | // Pass the event to ActionBarDrawerToggle, if it returns 148 | // true, then it has handled the app icon touch event 149 | if (mDrawerToggle.onOptionsItemSelected(item)) { 150 | return true; 151 | } 152 | // Handle your other action bar items... 153 | 154 | return super.onOptionsItemSelected(item); 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /app/src/main/java/in/omerjerk/processingdemo/NavigationDrawerFragment.java: -------------------------------------------------------------------------------- 1 | package in.omerjerk.processingdemo; 2 | 3 | import android.support.v7.app.AppCompatActivity; 4 | import android.app.Activity; 5 | import android.support.v7.app.ActionBar; 6 | import android.support.v4.app.Fragment; 7 | import android.support.v4.app.ActionBarDrawerToggle; 8 | import android.support.v4.view.GravityCompat; 9 | import android.support.v4.widget.DrawerLayout; 10 | import android.content.SharedPreferences; 11 | import android.content.res.Configuration; 12 | import android.os.Bundle; 13 | import android.preference.PreferenceManager; 14 | import android.view.LayoutInflater; 15 | import android.view.Menu; 16 | import android.view.MenuInflater; 17 | import android.view.MenuItem; 18 | import android.view.View; 19 | import android.view.ViewGroup; 20 | import android.widget.AdapterView; 21 | import android.widget.ArrayAdapter; 22 | import android.widget.ListView; 23 | import android.widget.Toast; 24 | 25 | /** 26 | * Fragment used for managing interactions for and presentation of a navigation drawer. 27 | * See the 28 | * design guidelines for a complete explanation of the behaviors implemented here. 29 | */ 30 | public class NavigationDrawerFragment extends Fragment { 31 | 32 | /** 33 | * Remember the position of the selected item. 34 | */ 35 | private static final String STATE_SELECTED_POSITION = "selected_navigation_drawer_position"; 36 | 37 | /** 38 | * Per the design guidelines, you should show the drawer on launch until the user manually 39 | * expands it. This shared preference tracks this. 40 | */ 41 | private static final String PREF_USER_LEARNED_DRAWER = "navigation_drawer_learned"; 42 | 43 | /** 44 | * A pointer to the current callbacks instance (the Activity). 45 | */ 46 | private NavigationDrawerCallbacks mCallbacks; 47 | 48 | /** 49 | * Helper component that ties the action bar to the navigation drawer. 50 | */ 51 | private ActionBarDrawerToggle mDrawerToggle; 52 | 53 | private DrawerLayout mDrawerLayout; 54 | private ListView mDrawerListView; 55 | private View mFragmentContainerView; 56 | 57 | private int mCurrentSelectedPosition = 0; 58 | private boolean mFromSavedInstanceState; 59 | private boolean mUserLearnedDrawer; 60 | 61 | public NavigationDrawerFragment() { 62 | } 63 | 64 | @Override 65 | public void onCreate(Bundle savedInstanceState) { 66 | super.onCreate(savedInstanceState); 67 | 68 | // Read in the flag indicating whether or not the user has demonstrated awareness of the 69 | // drawer. See PREF_USER_LEARNED_DRAWER for details. 70 | SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity()); 71 | mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false); 72 | 73 | if (savedInstanceState != null) { 74 | mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION); 75 | mFromSavedInstanceState = true; 76 | } 77 | 78 | // Select either the default item (0) or the last selected item. 79 | selectItem(mCurrentSelectedPosition); 80 | } 81 | 82 | @Override 83 | public void onActivityCreated(Bundle savedInstanceState) { 84 | super.onActivityCreated(savedInstanceState); 85 | // Indicate that this fragment would like to influence the set of actions in the action bar. 86 | setHasOptionsMenu(true); 87 | } 88 | 89 | @Override 90 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 91 | Bundle savedInstanceState) { 92 | mDrawerListView = (ListView) inflater.inflate( 93 | R.layout.fragment_navigation_drawer, container, false); 94 | mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { 95 | @Override 96 | public void onItemClick(AdapterView parent, View view, int position, long id) { 97 | selectItem(position); 98 | } 99 | }); 100 | mDrawerListView.setAdapter(new ArrayAdapter( 101 | getActionBar().getThemedContext(), 102 | android.R.layout.simple_list_item_1, 103 | android.R.id.text1, 104 | new String[]{ 105 | getString(R.string.title_directional), 106 | getString(R.string.title_reflection), 107 | getString(R.string.title_particles), 108 | getString(R.string.title_empty) 109 | })); 110 | mDrawerListView.setItemChecked(mCurrentSelectedPosition, true); 111 | return mDrawerListView; 112 | } 113 | 114 | public boolean isDrawerOpen() { 115 | return mDrawerLayout != null && mDrawerLayout.isDrawerOpen(mFragmentContainerView); 116 | } 117 | 118 | /** 119 | * Users of this fragment must call this method to set up the navigation drawer interactions. 120 | * 121 | * @param fragmentId The android:id of this fragment in its activity's layout. 122 | * @param drawerLayout The DrawerLayout containing this fragment's UI. 123 | */ 124 | public void setUp(int fragmentId, DrawerLayout drawerLayout) { 125 | mFragmentContainerView = getActivity().findViewById(fragmentId); 126 | mDrawerLayout = drawerLayout; 127 | 128 | // set a custom shadow that overlays the main content when the drawer opens 129 | mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); 130 | // set up the drawer's list view with items and click listener 131 | 132 | ActionBar actionBar = getActionBar(); 133 | actionBar.setDisplayHomeAsUpEnabled(true); 134 | actionBar.setHomeButtonEnabled(true); 135 | 136 | // ActionBarDrawerToggle ties together the the proper interactions 137 | // between the navigation drawer and the action bar app icon. 138 | mDrawerToggle = new ActionBarDrawerToggle( 139 | getActivity(), /* host Activity */ 140 | mDrawerLayout, /* DrawerLayout object */ 141 | R.drawable.ic_drawer, /* nav drawer image to replace 'Up' caret */ 142 | R.string.navigation_drawer_open, /* "open drawer" description for accessibility */ 143 | R.string.navigation_drawer_close /* "close drawer" description for accessibility */ 144 | ) { 145 | @Override 146 | public void onDrawerClosed(View drawerView) { 147 | super.onDrawerClosed(drawerView); 148 | if (!isAdded()) { 149 | return; 150 | } 151 | 152 | getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() 153 | } 154 | 155 | @Override 156 | public void onDrawerOpened(View drawerView) { 157 | super.onDrawerOpened(drawerView); 158 | if (!isAdded()) { 159 | return; 160 | } 161 | 162 | if (!mUserLearnedDrawer) { 163 | // The user manually opened the drawer; store this flag to prevent auto-showing 164 | // the navigation drawer automatically in the future. 165 | mUserLearnedDrawer = true; 166 | SharedPreferences sp = PreferenceManager 167 | .getDefaultSharedPreferences(getActivity()); 168 | sp.edit().putBoolean(PREF_USER_LEARNED_DRAWER, true).apply(); 169 | } 170 | 171 | getActivity().supportInvalidateOptionsMenu(); // calls onPrepareOptionsMenu() 172 | } 173 | }; 174 | 175 | // If the user hasn't 'learned' about the drawer, open it to introduce them to the drawer, 176 | // per the navigation drawer design guidelines. 177 | if (!mUserLearnedDrawer && !mFromSavedInstanceState) { 178 | mDrawerLayout.openDrawer(mFragmentContainerView); 179 | } 180 | 181 | // Defer code dependent on restoration of previous instance state. 182 | mDrawerLayout.post(new Runnable() { 183 | @Override 184 | public void run() { 185 | mDrawerToggle.syncState(); 186 | } 187 | }); 188 | 189 | mDrawerLayout.setDrawerListener(mDrawerToggle); 190 | } 191 | 192 | private void selectItem(int position) { 193 | mCurrentSelectedPosition = position; 194 | if (mDrawerListView != null) { 195 | mDrawerListView.setItemChecked(position, true); 196 | } 197 | if (mDrawerLayout != null) { 198 | mDrawerLayout.closeDrawer(mFragmentContainerView); 199 | } 200 | if (mCallbacks != null) { 201 | mCallbacks.onNavigationDrawerItemSelected(position); 202 | } 203 | } 204 | 205 | @Override 206 | public void onAttach(Activity activity) { 207 | super.onAttach(activity); 208 | try { 209 | mCallbacks = (NavigationDrawerCallbacks) activity; 210 | } catch (ClassCastException e) { 211 | throw new ClassCastException("Activity must implement NavigationDrawerCallbacks."); 212 | } 213 | } 214 | 215 | @Override 216 | public void onDetach() { 217 | super.onDetach(); 218 | mCallbacks = null; 219 | } 220 | 221 | @Override 222 | public void onSaveInstanceState(Bundle outState) { 223 | super.onSaveInstanceState(outState); 224 | outState.putInt(STATE_SELECTED_POSITION, mCurrentSelectedPosition); 225 | } 226 | 227 | @Override 228 | public void onConfigurationChanged(Configuration newConfig) { 229 | super.onConfigurationChanged(newConfig); 230 | // Forward the new configuration the drawer toggle component. 231 | mDrawerToggle.onConfigurationChanged(newConfig); 232 | } 233 | /* 234 | @Override 235 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 236 | // If the drawer is open, show the global app actions in the action bar. See also 237 | // showGlobalContextActionBar, which controls the top-left area of the action bar. 238 | if (mDrawerLayout != null && isDrawerOpen()) { 239 | inflater.inflate(R.menu.global, menu); 240 | showGlobalContextActionBar(); 241 | } 242 | super.onCreateOptionsMenu(menu, inflater); 243 | } 244 | 245 | @Override 246 | public boolean onOptionsItemSelected(MenuItem item) { 247 | if (mDrawerToggle.onOptionsItemSelected(item)) { 248 | return true; 249 | } 250 | 251 | if (item.getItemId() == R.id.action_example) { 252 | Toast.makeText(getActivity(), "Example action.", Toast.LENGTH_SHORT).show(); 253 | return true; 254 | } 255 | 256 | return super.onOptionsItemSelected(item); 257 | } 258 | */ 259 | /** 260 | * Per the navigation drawer design guidelines, updates the action bar to show the global app 261 | * 'context', rather than just what's in the current screen. 262 | */ 263 | private void showGlobalContextActionBar() { 264 | ActionBar actionBar = getActionBar(); 265 | actionBar.setDisplayShowTitleEnabled(true); 266 | actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD); 267 | actionBar.setTitle(R.string.app_name); 268 | } 269 | 270 | private ActionBar getActionBar() { 271 | return ((AppCompatActivity) getActivity()).getSupportActionBar(); 272 | } 273 | 274 | /** 275 | * Callbacks interface that all activities using this fragment must implement. 276 | */ 277 | public static interface NavigationDrawerCallbacks { 278 | /** 279 | * Called when an item in the navigation drawer is selected. 280 | */ 281 | void onNavigationDrawerItemSelected(int position); 282 | } 283 | } 284 | -------------------------------------------------------------------------------- /app/src/main/java/in/omerjerk/processingdemo/sketch/Directional.java: -------------------------------------------------------------------------------- 1 | package in.omerjerk.processingdemo.sketch; 2 | 3 | import android.app.Activity; 4 | 5 | import in.omerjerk.processingdemo.MainActivity; 6 | import processing.core.PApplet; 7 | 8 | /** 9 | * Created by root on 23/6/15. 10 | */ 11 | public class Directional extends PApplet { 12 | 13 | @Override 14 | public void setup() { 15 | // fullScreen(P3D); 16 | noStroke(); 17 | fill(204); 18 | } 19 | 20 | @Override 21 | public void draw() { 22 | noStroke(); 23 | background(0); 24 | float dirY = (mouseY / PApplet.parseFloat(height) - 0.5f) * 2; 25 | float dirX = (mouseX / PApplet.parseFloat(width) - 0.5f) * 2; 26 | directionalLight(204, 204, 204, -dirX, -dirY, -1); 27 | translate(width/2 - 100, height/2, 0); 28 | sphere(80); 29 | translate(200, 0, 0); 30 | sphere(80); 31 | } 32 | 33 | @Override 34 | public void onAttach(Activity activity) { 35 | super.onAttach(activity); 36 | ((MainActivity) activity).onSectionAttached(0); 37 | } 38 | 39 | @Override 40 | public void settings() { 41 | size(1000, 1000, P3D); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/java/in/omerjerk/processingdemo/sketch/EmptySketch.java: -------------------------------------------------------------------------------- 1 | package in.omerjerk.processingdemo.sketch; 2 | 3 | import android.app.Activity; 4 | 5 | import in.omerjerk.processingdemo.MainActivity; 6 | import processing.core.PApplet; 7 | 8 | /** 9 | * Created by root on 23/6/15. 10 | */ 11 | public class EmptySketch extends PApplet { 12 | 13 | @Override 14 | public void onAttach(Activity activity) { 15 | super.onAttach(activity); 16 | ((MainActivity) activity).onSectionAttached(1); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /app/src/main/java/in/omerjerk/processingdemo/sketch/Particles.java: -------------------------------------------------------------------------------- 1 | package in.omerjerk.processingdemo.sketch; 2 | 3 | import java.util.ArrayList; 4 | 5 | import processing.core.PApplet; 6 | import processing.core.PImage; 7 | import processing.core.PShape; 8 | import processing.core.PVector; 9 | 10 | /** 11 | * Created by root on 25/6/15. 12 | */ 13 | public class Particles extends PApplet { 14 | 15 | ParticleSystem ps; 16 | PImage sprite; 17 | 18 | @Override 19 | public void settings() { 20 | size(1000, 1000, P2D); 21 | } 22 | 23 | @Override 24 | public void setup() { 25 | sprite = loadImage("sprite.png"); 26 | ps = new ParticleSystem(2000); 27 | 28 | // Writing to the depth buffer is disabled to avoid rendering 29 | // artifacts due to the fact that the particles are semi-transparent 30 | // but not z-sorted. 31 | hint(DISABLE_DEPTH_MASK); 32 | } 33 | 34 | @Override 35 | public void draw() { 36 | background(0); 37 | ps.update(); 38 | ps.display(); 39 | 40 | ps.setEmitter(mouseX,mouseY); 41 | 42 | fill(255); 43 | textSize(16); 44 | text("Frame rate: " + PApplet.parseInt(frameRate),10,20); 45 | } 46 | 47 | class Particle { 48 | 49 | PVector velocity; 50 | float lifespan = 255; 51 | 52 | PShape part; 53 | float partSize; 54 | 55 | PVector gravity = new PVector(0,0.1f); 56 | 57 | 58 | Particle() { 59 | partSize = random(10,60); 60 | part = createShape(); 61 | part.beginShape(QUAD); 62 | part.noStroke(); 63 | part.texture(sprite); 64 | part.normal(0, 0, 1); 65 | part.vertex(-partSize/2, -partSize/2, 0, 0); 66 | part.vertex(+partSize/2, -partSize/2, sprite.width, 0); 67 | part.vertex(+partSize/2, +partSize/2, sprite.width, sprite.height); 68 | part.vertex(-partSize/2, +partSize/2, 0, sprite.height); 69 | part.endShape(); 70 | 71 | rebirth(width/2,height/2); 72 | lifespan = random(255); 73 | } 74 | 75 | PShape getShape() { 76 | return part; 77 | } 78 | 79 | void rebirth(float x, float y) { 80 | float a = random(TWO_PI); 81 | float speed = random(0.5f,4); 82 | velocity = new PVector(cos(a), sin(a)); 83 | velocity.mult(speed); 84 | lifespan = 255; 85 | part.resetMatrix(); 86 | part.translate(x, y); 87 | } 88 | 89 | boolean isDead() { 90 | if (lifespan < 0) { 91 | return true; 92 | } else { 93 | return false; 94 | } 95 | } 96 | 97 | 98 | public void update() { 99 | lifespan = lifespan - 1; 100 | velocity.add(gravity); 101 | 102 | part.setTint(color(255,lifespan)); 103 | part.translate(velocity.x, velocity.y); 104 | } 105 | } 106 | 107 | class ParticleSystem { 108 | ArrayList particles; 109 | 110 | PShape particleShape; 111 | 112 | ParticleSystem(int n) { 113 | particles = new ArrayList(); 114 | particleShape = createShape(PShape.GROUP); 115 | 116 | for (int i = 0; i < n; i++) { 117 | Particle p = new Particle(); 118 | particles.add(p); 119 | particleShape.addChild(p.getShape()); 120 | } 121 | } 122 | 123 | void update() { 124 | for (Particle p : particles) { 125 | p.update(); 126 | } 127 | } 128 | 129 | void setEmitter(float x, float y) { 130 | for (Particle p : particles) { 131 | if (p.isDead()) { 132 | p.rebirth(x, y); 133 | } 134 | } 135 | } 136 | 137 | void display() { 138 | 139 | shape(particleShape); 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /app/src/main/java/in/omerjerk/processingdemo/sketch/Reflection.java: -------------------------------------------------------------------------------- 1 | package in.omerjerk.processingdemo.sketch; 2 | 3 | import processing.core.PApplet; 4 | 5 | /** 6 | * Created by root on 24/6/15. 7 | */ 8 | public class Reflection extends PApplet { 9 | 10 | @Override 11 | public void settings() { 12 | size(1000, 1000, P3D); 13 | } 14 | 15 | @Override 16 | public void setup() { 17 | noStroke(); 18 | colorMode(RGB, 1); 19 | fill(0.4f); 20 | } 21 | 22 | @Override 23 | public void draw() { 24 | background(0); 25 | translate(width / 2, height / 2); 26 | // Set the specular color of lights that follow 27 | lightSpecular(1, 1, 1); 28 | directionalLight(0.8f, 0.8f, 0.8f, 0, 0, -1); 29 | float s = mouseX / PApplet.parseFloat(width); 30 | specular(s, s, s); 31 | sphere(120); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable-hdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable-hdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable-mdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable-mdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable-xhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable-xhdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable-xxhdpi/drawer_shadow.9.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_drawer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable-xxhdpi/ic_drawer.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/drawable/icon.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 11 | 12 | 17 | 19 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_navigation_drawer.xml: -------------------------------------------------------------------------------- 1 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/menu/global.xml: -------------------------------------------------------------------------------- 1 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_main.xml: -------------------------------------------------------------------------------- 1 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | 8 | 240dp 9 | 10 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Processing Demo 3 | 4 | Hello world! 5 | Settings 6 | MainActivity 7 | 8 | Directional 9 | Reflection 10 | Particles 11 | Empty 12 | 13 | Open navigation drawer 14 | Close navigation drawer 15 | 16 | Example action 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.2.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/omerjerk/ProcessingAndroidDemo/24121255828d285a343cb0ae686aba8b5bef590e/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jun 22 23:18:33 IST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------