├── .gitignore ├── LICENSE ├── README.md ├── android.iml ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro ├── src │ ├── debug │ │ └── res │ │ │ └── values │ │ │ └── google_maps_api.xml │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── tormentaLabs │ │ │ └── riobus │ │ │ ├── EnvironmentConfig.java │ │ │ ├── MainActivity.java │ │ │ ├── adapter │ │ │ └── BusInfoWindowAdapter.java │ │ │ ├── asyncTasks │ │ │ └── BusSearchTask.java │ │ │ ├── common │ │ │ ├── BusDataReceptor.java │ │ │ ├── NetworkUtil.java │ │ │ └── Util.java │ │ │ ├── exception │ │ │ ├── CustomException.java │ │ │ └── HttpException.java │ │ │ ├── model │ │ │ ├── Bus.java │ │ │ ├── BusData.java │ │ │ ├── Itinerary.java │ │ │ ├── MapMarker.java │ │ │ └── Spot.java │ │ │ └── service │ │ │ └── HttpService.java │ │ └── res │ │ ├── drawable-hdpi │ │ ├── bus_green.png │ │ ├── bus_red.png │ │ ├── bus_yellow.png │ │ ├── ic_action_about.png │ │ ├── ic_action_search.png │ │ ├── ic_launcher.png │ │ ├── loading.gif │ │ └── man_maps.png │ │ ├── drawable-mdpi │ │ ├── ic_action_about.png │ │ ├── ic_action_search.png │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ ├── ic_action_about.png │ │ ├── ic_action_search.png │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ ├── ic_action_about.png │ │ ├── ic_action_search.png │ │ └── ic_launcher.png │ │ ├── drawable-xxxhdpi │ │ └── ic_launcher.png │ │ ├── drawable │ │ └── rounded_corners_white.xml │ │ ├── layout │ │ ├── about_dialog.xml │ │ ├── info_window_layout.xml │ │ ├── info_window_layout_client.xml │ │ ├── info_window_layout_itinerary.xml │ │ └── mapa.xml │ │ ├── values-v19 │ │ └── styles.xml │ │ └── values │ │ ├── google_maps_api.xml │ │ ├── strings.xml │ │ └── styles.xml └── tests │ ├── AndroidManifest.xml │ ├── project.properties │ └── src │ └── com │ └── tormentaLabs │ └── riobus │ └── tests │ └── MainTest.java ├── build.gradle ├── debug.keystore ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── riobusandroid.iml └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .DS_Store 3 | build/ 4 | build/ 5 | .idea/ 6 | .gradle/ 7 | local.properties 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | riobus-android 2 | ============== 3 | 4 | 5 | Rio de Janeiro Android app for bus geolocalization 6 | 7 | 8 | http://riob.us 9 | 10 | Os dados são oferecidos publicamente pela prefeitura do Rio de Janeiro, em parceria com a FETRANSPOR e Iplanrio. A posição dos ônibus são recuparadas pelo GPS embarcado neles, enviados para a FETRANSPOR e, por fim, a Iplanrio a disponibiliza na página do projeto de dados abertos Data.Rio. 11 | 12 | Para resolver dependências e compilar use o Android Studio. 13 | 14 | -------------------------------------------------------------------------------- /android.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /.idea 3 | -------------------------------------------------------------------------------- /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 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | buildscript { 4 | repositories { 5 | mavenCentral() 6 | } 7 | dependencies { 8 | // replace with the current version of the Android plugin 9 | classpath 'com.android.tools.build:gradle:1.5.0' 10 | } 11 | } 12 | 13 | repositories { 14 | maven { 15 | url "https://jitpack.io" 16 | } 17 | mavenCentral() 18 | mavenLocal() 19 | } 20 | 21 | 22 | 23 | dependencies { 24 | compile fileTree(dir: 'libs', include: ['*.jar']) 25 | compile 'com.android.support:support-v4:22.2.0' 26 | compile 'com.google.code.gson:gson:2.3' 27 | compile 'joda-time:joda-time:2.3' 28 | compile 'com.android.support:appcompat-v7:22.2.0' 29 | compile 'com.google.android.gms:play-services:7.5.0' 30 | compile 'com.github.kevinsawicki:http-request:http-request-6.0' 31 | compile 'com.squareup.retrofit:retrofit:1.9.0' 32 | } 33 | 34 | android { 35 | 36 | signingConfigs { 37 | 38 | debug{ 39 | storeFile file('../debug.keystore') 40 | storePassword 'android' 41 | keyAlias 'androiddebugkey' 42 | keyPassword 'android' 43 | } 44 | } 45 | 46 | compileSdkVersion 22 47 | buildToolsVersion "22.0.1" 48 | defaultConfig { 49 | applicationId "com.tormentaLabs.riobus" 50 | minSdkVersion 9 51 | targetSdkVersion 22 52 | versionCode 62 53 | versionName '2.0.2' 54 | } 55 | 56 | buildTypes { 57 | debug { 58 | minifyEnabled false 59 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | android{ 64 | sourceSets { 65 | androidTest { 66 | java.srcDirs = ['tests/src'] 67 | } 68 | main { 69 | java.srcDirs = [ 70 | 'src/main/java', 71 | // 'build/generated/source/apt/release' 72 | ] 73 | } 74 | } 75 | } 76 | lintOptions { 77 | abortOnError false 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /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 C:\AmbienteJava\adt-bundle-windows-x86_64-20130514\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/debug/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | AIzaSyCOOHUdi4xszdxQZPmb3TEwXnTWp9GHurk 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/EnvironmentConfig.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus; 2 | 3 | public class EnvironmentConfig { 4 | public static final String URL_ENDPOINT = "http://rest.riob.us/"; 5 | } 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus; 2 | 3 | import android.app.Activity; 4 | import android.app.Dialog; 5 | import android.content.Context; 6 | import android.graphics.Color; 7 | import android.location.Location; 8 | import android.os.Bundle; 9 | import android.support.v7.app.AppCompatActivity; 10 | import android.text.Html; 11 | import android.text.method.LinkMovementMethod; 12 | import android.util.Log; 13 | import android.view.KeyEvent; 14 | import android.view.View; 15 | import android.view.inputmethod.InputMethodManager; 16 | import android.widget.ArrayAdapter; 17 | import android.widget.AutoCompleteTextView; 18 | import android.widget.ImageButton; 19 | import android.widget.TextView; 20 | import android.widget.Toast; 21 | 22 | import com.google.android.gms.common.ConnectionResult; 23 | import com.google.android.gms.common.api.GoogleApiClient; 24 | import com.google.android.gms.location.LocationServices; 25 | import com.google.android.gms.maps.CameraUpdate; 26 | import com.google.android.gms.maps.CameraUpdateFactory; 27 | import com.google.android.gms.maps.GoogleMap; 28 | import com.google.android.gms.maps.OnMapReadyCallback; 29 | import com.google.android.gms.maps.SupportMapFragment; 30 | import com.google.android.gms.maps.model.BitmapDescriptorFactory; 31 | import com.google.android.gms.maps.model.LatLng; 32 | import com.google.android.gms.maps.model.LatLngBounds; 33 | import com.google.android.gms.maps.model.MarkerOptions; 34 | import com.google.android.gms.maps.model.Polyline; 35 | import com.google.android.gms.maps.model.PolylineOptions; 36 | import com.google.gson.Gson; 37 | import com.google.gson.GsonBuilder; 38 | import com.google.gson.internal.bind.DateTypeAdapter; 39 | import com.tormentaLabs.riobus.adapter.BusInfoWindowAdapter; 40 | import com.tormentaLabs.riobus.asyncTasks.BusSearchTask; 41 | import com.tormentaLabs.riobus.common.BusDataReceptor; 42 | import com.tormentaLabs.riobus.common.NetworkUtil; 43 | import com.tormentaLabs.riobus.common.Util; 44 | import com.tormentaLabs.riobus.model.Bus; 45 | import com.tormentaLabs.riobus.model.BusData; 46 | import com.tormentaLabs.riobus.model.Itinerary; 47 | import com.tormentaLabs.riobus.model.MapMarker; 48 | import com.tormentaLabs.riobus.model.Spot; 49 | import com.tormentaLabs.riobus.service.HttpService; 50 | 51 | import java.util.ArrayList; 52 | import java.util.Date; 53 | import java.util.List; 54 | import java.util.Random; 55 | 56 | import retrofit.Callback; 57 | import retrofit.RestAdapter; 58 | import retrofit.RetrofitError; 59 | import retrofit.client.Response; 60 | import retrofit.converter.GsonConverter; 61 | 62 | public class MainActivity extends AppCompatActivity implements OnMapReadyCallback, BusDataReceptor, 63 | GoogleApiClient.ConnectionCallbacks, 64 | GoogleApiClient.OnConnectionFailedListener { 65 | 66 | private AutoCompleteTextView search; 67 | private ImageButton info; 68 | 69 | Location currentLocation; 70 | 71 | MapMarker mapMarker; 72 | private GoogleMap map; 73 | private GoogleApiClient mGoogleApiClient; 74 | 75 | @Override 76 | protected void onCreate(Bundle savedInstanceState) { 77 | super.onCreate(savedInstanceState); 78 | setContentView(R.layout.mapa); 79 | 80 | buildGoogleApiClient(); 81 | setupSearch(); 82 | setupInfo(); 83 | setupMap(); 84 | getSupportActionBar().hide(); 85 | 86 | } 87 | 88 | @Override 89 | protected void onStart() { 90 | super.onStart(); 91 | if (!mGoogleApiClient.isConnecting() && !mGoogleApiClient.isConnected()) { 92 | mGoogleApiClient.connect(); 93 | } 94 | } 95 | 96 | @Override 97 | protected void onStop() { 98 | mGoogleApiClient.disconnect(); 99 | super.onStop(); 100 | } 101 | 102 | protected void buildGoogleApiClient() { 103 | 104 | mGoogleApiClient = new GoogleApiClient.Builder(this) 105 | .addConnectionCallbacks(this) 106 | .addOnConnectionFailedListener(this) 107 | .addApi(LocationServices.API) 108 | .build(); 109 | } 110 | 111 | private void setupInfo() { 112 | info = (ImageButton) findViewById(R.id.button_about); 113 | 114 | info.setOnClickListener(new View.OnClickListener() { 115 | @Override 116 | public void onClick(View view) { 117 | Dialog dialog = new Dialog(MainActivity.this); 118 | dialog.setContentView(R.layout.about_dialog); 119 | dialog.setTitle(getString(R.string.about_title)); 120 | TextView tv = (TextView) dialog.findViewById(R.id.content); 121 | tv.setText(Html.fromHtml(getString(R.string.about_text))); 122 | tv.setMovementMethod(LinkMovementMethod.getInstance()); 123 | dialog.show(); 124 | } 125 | }); 126 | } 127 | 128 | private void setupSearch() { 129 | 130 | search = (AutoCompleteTextView) findViewById(R.id.search); 131 | //Quando o usuario digita enter, ele faz a requisição procurando a posição daquela linha 132 | search.setOnKeyListener(new View.OnKeyListener() { 133 | @Override 134 | public boolean onKey(View v, int keyCode, KeyEvent event) { 135 | String searchContent = search.getText().toString(); 136 | Activity activity = MainActivity.this; 137 | 138 | if ((event.getAction() == KeyEvent.ACTION_DOWN) && 139 | (keyCode == KeyEvent.KEYCODE_ENTER) && 140 | Util.isValidString(searchContent)) { 141 | 142 | InputMethodManager imm = (InputMethodManager) getSystemService( 143 | Context.INPUT_METHOD_SERVICE); 144 | imm.hideSoftInputFromWindow(search.getWindowToken(), 0); 145 | 146 | if (NetworkUtil.checkInternetConnection(activity)) { 147 | 148 | new BusSearchTask(MainActivity.this).execute(searchContent); 149 | 150 | } else { 151 | Toast.makeText(activity, getString(R.string.error_connection_internet), Toast.LENGTH_SHORT).show(); 152 | } 153 | return true; 154 | } 155 | return false; 156 | } 157 | }); 158 | } 159 | 160 | private void setupMap() { 161 | SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() 162 | .findFragmentById(R.id.map); 163 | mapFragment.getMapAsync(this); 164 | 165 | map = mapFragment.getMap(); 166 | if(map.getUiSettings() != null) { 167 | map.getUiSettings().setMapToolbarEnabled(false); 168 | map.getUiSettings().setCompassEnabled(false); 169 | map.setTrafficEnabled(true); 170 | } 171 | map.setMyLocationEnabled(false); 172 | 173 | mapMarker = new MapMarker(map); 174 | } 175 | 176 | public void updateUserLocation() { 177 | currentLocation = LocationServices.FusedLocationApi.getLastLocation(mGoogleApiClient); 178 | if (currentLocation == null) 179 | return; 180 | LatLng position = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()); 181 | map.moveCamera(CameraUpdateFactory.newLatLngZoom(position, 13)); 182 | map.animateCamera(CameraUpdateFactory.zoomTo(16), 2000, null); 183 | mapMarker.markUserPosition(this, position); 184 | 185 | } 186 | 187 | protected void drawItineraryPolyline(Itinerary itinerary) { 188 | List spots = itinerary.getSpots(); 189 | if (spots != null && !spots.isEmpty()) { 190 | 191 | List spotsGoing = new ArrayList(); 192 | List spotsReturning = new ArrayList(); 193 | PolylineOptions line = new PolylineOptions(); 194 | PolylineOptions lineReturning = new PolylineOptions(); 195 | for(int i=0; i buses = busData.getBuses(); 241 | if (buses == null) { 242 | Toast.makeText(this, getString(R.string.error_connection_server), Toast.LENGTH_SHORT).show(); 243 | return; 244 | } 245 | if (buses.isEmpty()) { 246 | Toast.makeText(this, getString(R.string.error_bus_404), Toast.LENGTH_SHORT).show(); 247 | return; 248 | } 249 | 250 | map.clear(); 251 | 252 | List itineraries = busData.getItineraries(); 253 | if(itineraries != null && !itineraries.isEmpty()) { 254 | for(Itinerary itinerary: itineraries) 255 | drawItineraryPolyline(itinerary); 256 | } 257 | 258 | map.setInfoWindowAdapter(new BusInfoWindowAdapter(this)); 259 | MapMarker marker = new MapMarker(map); 260 | marker.addMarkers(buses); 261 | LatLngBounds.Builder builder = marker.getBoundsBuilder(); 262 | 263 | if (currentLocation != null) { 264 | LatLng userPosition = new LatLng(currentLocation.getLatitude(), currentLocation.getLongitude()); 265 | mapMarker.markUserPosition(this, userPosition); 266 | builder.include(userPosition); 267 | } 268 | 269 | LatLngBounds bounds = builder.build(); 270 | 271 | int padding = 100; // offset from edges of the map in pixels 272 | CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, padding); 273 | 274 | map.moveCamera(cu); 275 | map.animateCamera(cu); 276 | 277 | } 278 | 279 | @Override 280 | public void onMapReady(GoogleMap map) { 281 | } 282 | 283 | 284 | @Override 285 | public void onConnected(Bundle bundle) { 286 | updateUserLocation(); 287 | } 288 | 289 | @Override 290 | public void onConnectionSuspended(int i) { 291 | } 292 | 293 | @Override 294 | public void onConnectionFailed(ConnectionResult connectionResult) { 295 | } 296 | } 297 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/adapter/BusInfoWindowAdapter.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.adapter; 2 | 3 | import android.app.Activity; 4 | import android.view.View; 5 | import android.widget.TextView; 6 | 7 | import com.google.android.gms.maps.GoogleMap; 8 | import com.google.android.gms.maps.model.Marker; 9 | import com.google.gson.Gson; 10 | import com.tormentaLabs.riobus.R; 11 | import com.tormentaLabs.riobus.model.Bus; 12 | import com.tormentaLabs.riobus.model.Itinerary; 13 | 14 | import org.joda.time.DateTime; 15 | import org.joda.time.Days; 16 | import org.joda.time.Hours; 17 | import org.joda.time.Minutes; 18 | import org.joda.time.Seconds; 19 | 20 | import java.text.SimpleDateFormat; 21 | import java.util.Calendar; 22 | import java.util.Date; 23 | import java.util.TimeZone; 24 | 25 | public class BusInfoWindowAdapter implements GoogleMap.InfoWindowAdapter { 26 | 27 | 28 | private Activity context; 29 | 30 | public BusInfoWindowAdapter(Activity context) { 31 | this.context = context; 32 | } 33 | 34 | @Override 35 | public View getInfoWindow(Marker marker) { 36 | return null; 37 | } 38 | 39 | @Override 40 | public View getInfoContents(Marker marker) { 41 | View view; 42 | 43 | if(marker.getTitle()==null){ 44 | try { 45 | Bus bus = new Gson().fromJson(marker.getSnippet(), Bus.class); 46 | view = context.getLayoutInflater().inflate(R.layout.info_window_layout, null); 47 | 48 | TextView lineView = (TextView) view.findViewById(R.id.titulo); 49 | 50 | String line = bus.getLine(); 51 | try { 52 | int lineInteger = (int) Double.parseDouble(line); 53 | line = Integer.toString(lineInteger); 54 | } catch (Exception e) { 55 | } 56 | 57 | lineView.setText(context.getString(R.string.marker_title, bus.getOrder(), line)); 58 | 59 | TextView dateTime = (TextView) view.findViewById(R.id.hora); 60 | dateTime.setText(prepareDate(bus.getTimestamp())); 61 | 62 | TextView velocity = (TextView) view.findViewById(R.id.velocity); 63 | velocity.setText(context.getString(R.string.marker_velocity, String.valueOf(bus.getVelocity()))); 64 | 65 | TextView sense = (TextView) view.findViewById(R.id.sense); 66 | if (bus.getSense() == null || bus.getSense().trim().equals("")) { 67 | sense.setText(context.getString(R.string.marker_sense, context.getString(R.string.marker_sense_null))); 68 | } else { 69 | 70 | sense.setText(context.getString(R.string.marker_sense, String.valueOf(bus.getSense()))); 71 | } 72 | }catch (Exception exp){ 73 | String[] snippet = marker.getSnippet().split(">"); 74 | Itinerary it = new Gson().fromJson(snippet[0], Itinerary.class); 75 | view = context.getLayoutInflater().inflate(R.layout.info_window_layout_itinerary, null); 76 | 77 | TextView lineView = (TextView) view.findViewById(R.id.titulo); 78 | 79 | String line = it.getLine(); 80 | try { 81 | int lineInteger = (int) Double.parseDouble(line); 82 | line = Integer.toString(lineInteger); 83 | } catch (Exception e) { 84 | } 85 | 86 | lineView.setText(context.getString(R.string.marker_title_itinerary, line)); 87 | 88 | TextView descricao = (TextView) view.findViewById(R.id.descricao); 89 | if (it.getDescription() == null || it.getDescription().trim().equals("")) { 90 | descricao.setText(context.getString(R.string.marker_description, context.getString(R.string.marker_description_null))); 91 | } else { 92 | 93 | descricao.setText(context.getString(R.string.marker_description, String.valueOf(it.getDescription()))); 94 | } 95 | 96 | TextView retornando = (TextView) view.findViewById(R.id.retornando); 97 | if (snippet[1].equalsIgnoreCase("true")){ 98 | retornando.setText(context.getString(R.string.marker_returning_true)); 99 | } 100 | else{ 101 | retornando.setText(context.getString(R.string.marker_returning_false)); 102 | } 103 | 104 | } 105 | } 106 | else{ 107 | view = context.getLayoutInflater().inflate(R.layout.info_window_layout_client, null); 108 | } 109 | 110 | return view; 111 | } 112 | 113 | private String prepareDate(Date date){ 114 | DateTime busTimestamp = new DateTime(date); 115 | DateTime now = new DateTime(Calendar.getInstance()); 116 | 117 | int time = Seconds.secondsBetween(busTimestamp, now).getSeconds(); 118 | if(time < 60) return context.getString(R.string.marker_seconds, String.valueOf(time)); 119 | 120 | time = Minutes.minutesBetween(busTimestamp, now).getMinutes(); 121 | if(time < 60) return context.getString(R.string.marker_minutes, String.valueOf(time)); 122 | 123 | time = Hours.hoursBetween(busTimestamp, now).getHours(); 124 | if(time < 24) return context.getString(R.string.marker_hours, String.valueOf(time)); 125 | 126 | time = Days.daysBetween(busTimestamp, now).getDays(); 127 | return context.getString(R.string.marker_days, String.valueOf(time)); 128 | } 129 | } 130 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/asyncTasks/BusSearchTask.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.asyncTasks; 2 | 3 | import android.app.ProgressDialog; 4 | import android.content.Context; 5 | import android.os.AsyncTask; 6 | import android.widget.Toast; 7 | 8 | import com.google.gson.Gson; 9 | import com.google.gson.GsonBuilder; 10 | import com.tormentaLabs.riobus.EnvironmentConfig; 11 | import com.tormentaLabs.riobus.R; 12 | import com.tormentaLabs.riobus.common.BusDataReceptor; 13 | import com.tormentaLabs.riobus.model.Bus; 14 | import com.tormentaLabs.riobus.model.BusData; 15 | import com.tormentaLabs.riobus.model.Itinerary; 16 | import com.tormentaLabs.riobus.service.HttpService; 17 | 18 | import org.joda.time.DateTime; 19 | 20 | import java.util.ArrayList; 21 | import java.util.Date; 22 | import java.util.HashSet; 23 | import java.util.List; 24 | import java.util.Set; 25 | import java.util.TimeZone; 26 | 27 | import retrofit.RestAdapter; 28 | import retrofit.RetrofitError; 29 | import retrofit.converter.GsonConverter; 30 | 31 | public class BusSearchTask extends AsyncTask{ 32 | 33 | private Context context; 34 | private HttpService service; 35 | ProgressDialog dialog; 36 | 37 | public BusSearchTask(Context context){ 38 | this.context = context; 39 | } 40 | 41 | private BusData getNewAPI(String lines){ 42 | Gson gson = new GsonBuilder() 43 | .setDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") 44 | .create(); 45 | 46 | RestAdapter restAdapter = new RestAdapter.Builder() 47 | .setEndpoint(EnvironmentConfig.URL_ENDPOINT) 48 | .setConverter(new GsonConverter(gson)) 49 | .build(); 50 | service = restAdapter.create(HttpService.class); 51 | 52 | try{ 53 | 54 | List buses = service.getPage(lines); 55 | List itineraries = new ArrayList(); 56 | 57 | String[] busLines = lines.split(","); 58 | for(String line: busLines) { 59 | try { 60 | itineraries.add(service.getItineraryPage(line)); 61 | }catch(RetrofitError exp){exp.printStackTrace();} 62 | } 63 | 64 | //Codigo para que as diversas linhas de itinerario sejam plotadas quando se pesquisa linhas de onibus por bairro. 65 | //Resulta em visualizacao muito confusa por causa da quantidade de linhas plotadas ao mesmo tempo. 66 | /*if(itineraries.isEmpty()){ 67 | Set busLines2 = new HashSet(); 68 | for(Bus bus: buses) busLines2.add(bus.getLine()); 69 | for(String line: busLines2) { 70 | try { 71 | itineraries.add(service.getItineraryPage(line)); 72 | }catch(RetrofitError exp){exp.printStackTrace();} 73 | } 74 | }*/ 75 | 76 | return new BusData(buses,itineraries); 77 | 78 | } catch (RetrofitError e){ 79 | try{ 80 | return new BusData(service.getPage(lines)); 81 | } catch (RetrofitError e2){ 82 | e2.printStackTrace(); 83 | return new BusData(); 84 | } 85 | } 86 | } 87 | 88 | @Override 89 | protected void onPreExecute() { 90 | super.onPreExecute(); 91 | dialog = new ProgressDialog(context); 92 | dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); 93 | dialog.setMessage(context.getString(R.string.searching_data)); 94 | dialog.setCancelable(false); 95 | dialog.show(); 96 | } 97 | 98 | @Override 99 | protected BusData doInBackground(String... params) { 100 | String data = params[0].replaceAll("\\s", ""); 101 | 102 | BusData busData = getNewAPI(data); 103 | return busData; 104 | } 105 | 106 | @Override 107 | protected void onPostExecute(BusData busData){ 108 | super.onPostExecute(busData); 109 | TimeZone tz = TimeZone.getTimeZone("America/Sao_Paulo"); 110 | int offset = tz.getOffset(new Date().getTime())/1000/60/60; 111 | List buses = busData.getBuses(); 112 | for(int i=0; i 0){ 48 | lineHistory = lines.split(","); 49 | } 50 | return lineHistory; 51 | }; 52 | 53 | public static void saveOnHistory(Context context,String line , AutoCompleteTextView search) { 54 | StringBuilder sb = new StringBuilder(); 55 | boolean alreadyAdded = false; 56 | if (getHistory(context) != null){ 57 | List lines = Arrays.asList(getHistory(context)); 58 | for (String histLines: lines){ 59 | if (histLines.contains(line)){ 60 | alreadyAdded = true; 61 | }; 62 | sb.append(histLines).append(","); 63 | } 64 | } 65 | if (!alreadyAdded){ 66 | sb.insert(0,line+","); 67 | } 68 | SharedPreferences settings = context.getSharedPreferences(TAG,0); 69 | SharedPreferences.Editor editor = settings.edit(); 70 | editor.putString(LINE_HISTORY,sb.toString()); 71 | editor.commit(); 72 | 73 | }; 74 | 75 | } 76 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/exception/CustomException.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.exception; 2 | 3 | public class CustomException extends Exception { 4 | 5 | /** variavel de serial. */ 6 | private static final long serialVersionUID = 1L; 7 | 8 | private String msg; 9 | 10 | public CustomException(String msg) { 11 | super(msg); 12 | this.msg = msg; 13 | } 14 | 15 | public CustomException() { 16 | String erro ="Ocorreu um erro inesperado, contate o suporte."; 17 | this.msg = erro; 18 | } 19 | 20 | public String getMessage() { 21 | return msg; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/exception/HttpException.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.exception; 2 | 3 | public class HttpException extends CustomException { 4 | 5 | public HttpException(String mensagem) { 6 | super(mensagem); 7 | } 8 | 9 | public HttpException(int code) { 10 | super(handleLoginException(code)); 11 | } 12 | 13 | private static String handleLoginException(int code) { 14 | switch (code) { 15 | case 401: 16 | return "Usuário e/ou senha inválidos"; 17 | case 403: 18 | return "Usuário não tem autorização para realizar a ação."; 19 | case 408: 20 | return "Tempo limite para operação foi excedido."; 21 | case 500: 22 | return "Ocorreu um erro no servidor. Tente novamente mais tarde."; 23 | case 502: 24 | return "Dados enviados são inválidos."; 25 | case 503: 26 | return "Servidor fora do ar, tente novamente mais tarde."; 27 | default: 28 | break; 29 | } 30 | return "Ocorreu um erro inesperado, contate o suporte."; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/model/Bus.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.Date; 6 | 7 | public class Bus { 8 | 9 | @SerializedName(value = "timeStamp") 10 | private Date timestamp; 11 | private String order; 12 | private String line; 13 | private double latitude; 14 | private double longitude; 15 | @SerializedName(value = "speed") 16 | private double velocity; 17 | private String sense; 18 | 19 | public Bus() {} 20 | 21 | public Bus(Date timestamp, String order, String line, double latitude, double longitude, double velocity, String sense) { 22 | this.timestamp = timestamp; 23 | this.order = order; 24 | this.line = line; 25 | this.latitude = latitude; 26 | this.longitude = longitude; 27 | this.velocity = velocity; 28 | this.sense = sense; 29 | } 30 | 31 | public Date getTimestamp() { 32 | return timestamp; 33 | } 34 | 35 | public void setTimestamp(Date timestamp) { 36 | this.timestamp = timestamp; 37 | } 38 | 39 | public String getOrder() { 40 | return order; 41 | } 42 | 43 | public void setOrder(String order) { 44 | this.order = order; 45 | } 46 | 47 | public String getLine() { 48 | return line; 49 | } 50 | 51 | public void setLine(String line) { 52 | this.line = line; 53 | } 54 | 55 | public double getLatitude() { 56 | return latitude; 57 | } 58 | 59 | public void setLatitude(double latitude) { 60 | this.latitude = latitude; 61 | } 62 | 63 | public double getLongitude() { 64 | return longitude; 65 | } 66 | 67 | public void setLongitude(double longitude) { 68 | this.longitude = longitude; 69 | } 70 | 71 | public double getVelocity() { 72 | return velocity; 73 | } 74 | 75 | public void setVelocity(double velocity) { 76 | this.velocity = velocity; 77 | } 78 | 79 | public String getSense() { 80 | return sense; 81 | } 82 | 83 | public void setSense(String sense){ 84 | this.sense = sense; 85 | } 86 | 87 | @Override 88 | public String toString() { 89 | return "Object(Bus){" + 90 | "timestamp: " + timestamp + 91 | ", order: '" + order + "'" + 92 | ", line: " + line + 93 | ", latitude: " + latitude + 94 | ", longitude: " + longitude + 95 | ", velocity: " + velocity + 96 | ", sense: " + sense + 97 | "}"; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/model/BusData.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.model; 2 | 3 | import com.google.gson.annotations.SerializedName; 4 | 5 | import java.util.ArrayList; 6 | import java.util.Date; 7 | import java.util.List; 8 | 9 | public class BusData { 10 | 11 | private List buses = new ArrayList(); 12 | private List itineraries = new ArrayList(); 13 | 14 | public BusData() {} 15 | 16 | public BusData(List buses) { 17 | this.buses = buses; 18 | } 19 | 20 | public BusData(List buses, List itineraries) { 21 | this(buses); 22 | this.itineraries = itineraries; 23 | } 24 | 25 | public List getBuses() { 26 | return buses; 27 | } 28 | 29 | public void setBuses(List buses) { 30 | this.buses = buses; 31 | } 32 | 33 | public List getItineraries() { 34 | return itineraries; 35 | } 36 | 37 | public void setItineraries(List itineraries) { 38 | this.itineraries = itineraries; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/model/Itinerary.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.model; 2 | 3 | import java.util.List; 4 | 5 | public class Itinerary { 6 | 7 | private String line; 8 | private String description; 9 | private String agency; 10 | private String keywords; 11 | private List spots; 12 | 13 | public Itinerary() {} 14 | 15 | public Itinerary(String line, String description, String agency, String keywords, List spots) { 16 | this.line = line; 17 | this.description = description; 18 | this.agency = agency; 19 | this.keywords = keywords; 20 | this.spots = spots; 21 | } 22 | 23 | public String getLine() { 24 | return line; 25 | } 26 | 27 | public void setLine(String line) { 28 | this.line = line; 29 | } 30 | 31 | public String getDescription() { 32 | return description; 33 | } 34 | 35 | public void setDescription(String description) { 36 | this.description = description; 37 | } 38 | 39 | public String getAgency() { 40 | return agency; 41 | } 42 | 43 | public void setAgency(String agency) { 44 | this.agency = agency; 45 | } 46 | 47 | public String getKeywords() { 48 | return keywords; 49 | } 50 | 51 | public void setKeywords(String keywords) { 52 | this.keywords = keywords; 53 | } 54 | 55 | public List getSpots() { 56 | return spots; 57 | } 58 | 59 | public void setSpots(List spots) { 60 | this.spots = spots; 61 | } 62 | 63 | @Override 64 | public String toString() { 65 | return "Object(Itinerary){" + 66 | "line: " + line + 67 | ", description: '" + description + "'" + 68 | ", agency: " + agency + 69 | ", keywords: " + keywords + 70 | "}"; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/model/MapMarker.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.model; 2 | 3 | import android.content.Context; 4 | 5 | import com.google.android.gms.maps.GoogleMap; 6 | import com.google.android.gms.maps.model.BitmapDescriptor; 7 | import com.google.android.gms.maps.model.BitmapDescriptorFactory; 8 | import com.google.android.gms.maps.model.LatLng; 9 | import com.google.android.gms.maps.model.LatLngBounds; 10 | import com.google.android.gms.maps.model.Marker; 11 | import com.google.android.gms.maps.model.MarkerOptions; 12 | import com.google.gson.Gson; 13 | import com.tormentaLabs.riobus.R; 14 | 15 | import org.joda.time.DateTime; 16 | import org.joda.time.Minutes; 17 | 18 | import java.util.Calendar; 19 | import java.util.Date; 20 | import java.util.List; 21 | import java.util.Random; 22 | 23 | public class MapMarker { 24 | 25 | private GoogleMap map; 26 | private LatLngBounds.Builder builder; 27 | Marker userMarker; 28 | 29 | public MapMarker(GoogleMap map){ 30 | this.map = map; 31 | builder = new LatLngBounds.Builder(); 32 | } 33 | 34 | public void addMarkers(List buses) { 35 | for (Bus bus : buses) { 36 | map.addMarker(getMarker(bus)); 37 | builder.include(new LatLng(bus.getLatitude(), bus.getLongitude())); 38 | } 39 | } 40 | private MarkerOptions getMarker(Bus bus) { 41 | MarkerOptions options = new MarkerOptions(); 42 | LatLng position = new LatLng(bus.getLatitude(), bus.getLongitude()); 43 | options.position(position); 44 | options.anchor(0.0f, 1.0f); 45 | options.icon(getIcon(bus.getTimestamp())); 46 | options.snippet(new Gson().toJson(bus)); 47 | return options; 48 | } 49 | 50 | 51 | public void addMarkers(Spot spot, float hueColor, Itinerary itinerary) { 52 | map.addMarker(getMarker(spot, hueColor, itinerary)); 53 | builder.include(new LatLng(spot.getLatitude(), spot.getLongitude())); 54 | } 55 | private MarkerOptions getMarker(Spot spot, float hueColor, Itinerary itinerary) { 56 | MarkerOptions options = new MarkerOptions(); 57 | LatLng position = new LatLng(spot.getLatitude(), spot.getLongitude()); 58 | options.position(position); 59 | options.anchor(0.0f, 1.0f); 60 | options.icon(BitmapDescriptorFactory.defaultMarker(hueColor)); 61 | options.snippet(new Gson().toJson(itinerary)+">"+spot.getReturning()); 62 | return options; 63 | } 64 | 65 | 66 | public void markUserPosition(Context context, LatLng posicao) { 67 | 68 | if (userMarker != null) { 69 | userMarker.remove(); 70 | } 71 | 72 | userMarker = map.addMarker(new MarkerOptions() 73 | .position(posicao) 74 | .title(context.getString(R.string.marker_user)) 75 | .icon(BitmapDescriptorFactory 76 | .fromResource(R.drawable.man_maps))); 77 | } 78 | 79 | private BitmapDescriptor getIcon(Date data) { 80 | DateTime current = new DateTime(Calendar.getInstance()); 81 | DateTime last = new DateTime(data); 82 | int diff = Minutes.minutesBetween(last, current).getMinutes(); 83 | 84 | BitmapDescriptor bitmap; 85 | 86 | if(diff >= 5 && diff < 10 ) { 87 | bitmap = BitmapDescriptorFactory 88 | .fromResource(R.drawable.bus_yellow); 89 | } else if(diff >= 10 ) { 90 | bitmap = BitmapDescriptorFactory 91 | .fromResource(R.drawable.bus_red); 92 | } else { 93 | bitmap = BitmapDescriptorFactory 94 | .fromResource(R.drawable.bus_green); 95 | } 96 | return bitmap; 97 | } 98 | 99 | public LatLngBounds.Builder getBoundsBuilder(){ 100 | return builder; 101 | } 102 | 103 | } 104 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/model/Spot.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.model; 2 | 3 | public class Spot { 4 | 5 | private double latitude; 6 | private double longitude; 7 | private String returning; 8 | 9 | public Spot() {} 10 | 11 | public Spot(double latitude, double longitude, String returning) { 12 | this.latitude = latitude; 13 | this.longitude = longitude; 14 | this.returning = returning; 15 | } 16 | 17 | public double getLatitude() { 18 | return latitude; 19 | } 20 | 21 | public void setLatitude(double latitude) { 22 | this.latitude = latitude; 23 | } 24 | 25 | public double getLongitude() { 26 | return longitude; 27 | } 28 | 29 | public void setLongitude(double longitude) { 30 | this.longitude = longitude; 31 | } 32 | 33 | public String getReturning() { 34 | return returning; 35 | } 36 | 37 | public void setReturning(String returning) { 38 | this.returning = returning; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return "Object(Bus){" + 44 | "latitude: " + latitude + 45 | ", longitude: " + longitude + 46 | ", returning: " + returning + 47 | "}"; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /app/src/main/java/com/tormentaLabs/riobus/service/HttpService.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.service; 2 | 3 | import com.tormentaLabs.riobus.model.Bus; 4 | import com.tormentaLabs.riobus.model.Itinerary; 5 | 6 | import java.util.List; 7 | 8 | import retrofit.Callback; 9 | import retrofit.http.GET; 10 | import retrofit.http.Headers; 11 | import retrofit.http.Path; 12 | import retrofit.http.Query; 13 | 14 | /** 15 | * Created by Pedro on 7/14/15. 16 | */ 17 | public interface HttpService { 18 | 19 | @Headers({ 20 | "Accept:application/json", 21 | "Cache-Control: max-age=640000", 22 | "userAgent: riobus-android-2.0" 23 | }) 24 | @GET("/v3/search/{lines}") 25 | void getPage(@Path("lines")String lines, Callback< List > buses); 26 | 27 | @Headers({ 28 | "Accept:application/json", 29 | "Cache-Control: max-age=640000", 30 | "userAgent: riobus-android-2.0" 31 | }) 32 | @GET("/v3/search/{lines}") 33 | List getPage(@Path("lines")String lines); 34 | 35 | 36 | @Headers({ 37 | "Accept:application/json", 38 | "Cache-Control: max-age=640000", 39 | "userAgent: riobus-android-2.0" 40 | }) 41 | @GET("/v3/itinerary/{lines}") 42 | void getItineraryPage(@Path("lines")String line, Callback< Itinerary > itinerary); 43 | 44 | @Headers({ 45 | "Accept:application/json", 46 | "Cache-Control: max-age=640000", 47 | "userAgent: riobus-android-2.0" 48 | }) 49 | @GET("/v3/itinerary/{lines}") 50 | Itinerary getItineraryPage(@Path("lines")String line); 51 | } 52 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/bus_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-hdpi/bus_green.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/bus_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-hdpi/bus_red.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/bus_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-hdpi/bus_yellow.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-hdpi/ic_action_about.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-hdpi/ic_action_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-hdpi/loading.gif -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/man_maps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-hdpi/man_maps.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-mdpi/ic_action_about.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-mdpi/ic_action_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-xhdpi/ic_action_about.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-xhdpi/ic_action_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-xxhdpi/ic_action_about.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-xxhdpi/ic_action_search.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/app/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/rounded_corners_white.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/layout/about_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/info_window_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 14 | 15 | 20 | 21 | 26 | 27 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/layout/info_window_layout_client.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/layout/info_window_layout_itinerary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 14 | 15 | 20 | 21 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/layout/mapa.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | 19 | 20 | 21 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/values-v19/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 22 | 23 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/values/google_maps_api.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 17 | AIzaSyDx4V84gfoj_rSDaWwqg5aV75hGZPasGOk 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Rio Bus 5 | Rio Bus 6 | Buscando linha… 7 | Número da linha 8 | Sobre o RioBus 9 | 10 | Não foi encontrada uma conexão com a internet. 11 | Não foi possível identificar sua localização. 12 | Não foi possível conectar ao servidor. Ele pode estar fora do ar ou você pode estar sem conexão. 13 | O ônibus solicitado não foi encontrado. Talvez ele não exista ou os dados estão fora do ar temporariamente. 14 | 15 | Você está aqui 16 | %1$s (%2$s) 17 | Atualizado há %1$s segundo(s) 18 | Atualizado há %1$s minuto(s) 19 | Atualizado há %1$s hora(s) 20 | Atualizado há %1$s dia(s) 21 | Velocidade: %1$s Km/h 22 | Sentido: %1$s 23 | desconhecido 24 | 25 | Ponto final da linha: %1$s 26 | Sentido: %1$s 27 | Itinerário de retorno 28 | Itinerário de ida 29 | desconhecido 30 | 31 | 32 | O RioBus é um sistema colaborativo de monitoramento de ônibus em tempo real, que utiliza a API de dados abertos de mobilidade urbana fornecida pela parceria entre a Prefeitura do Rio de Janeiro e a FETRANSPOR. Seu objetivo principal é ajudar o cidadão do Rio de Janeiro, seja ele morador ou visitante, a se deslocar pela cidade.

35 |

O serviço é desenvolvido de forma colaborativa, e por isso depende da sua ajuda para melhorar, seja dando apenas um feedback ou aprimorando o código.

36 | 37 |

Como funciona?

38 |

Basta digitar a linha do ônibus que você deseja encontrar na caixa de busca e a posição de cada carro aparecerá no mapa. Além disso, você pode ver mais informações sobre o ônibus ao clicar sobre o marcador.

39 | 40 |

Legenda dos marcadores

41 |

42 | Verde: atualizado há menos de 5 min
43 | Amarelo: atualizado entre 5 e 10 min atrás
44 | Vermelho: atualizado há mais de 10 min 45 |

46 | 47 |

Gostou do projeto?

48 |

Você pode colaborar com o projeto sempre nos enviando suas críticas e sugestões através da nossa página no Facebook. Ou então, caso você seja o tipo que prefere pôr a mão na massa, pode nos ajudar a aprimorar o nosso código, que está hospedado publicamente no Github. O código está licensiado sob a licença GNU GPL v2, isso quer dizer que você pode alterar e reutilizar à vontade!

49 | 50 | ]]> 51 |
52 | 53 |
54 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 7 | 18 | 19 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/tests/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 14 | 15 | 16 | 17 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/tests/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-19 15 | -------------------------------------------------------------------------------- /app/tests/src/com/tormentaLabs/riobus/tests/MainTest.java: -------------------------------------------------------------------------------- 1 | package com.tormentaLabs.riobus.tests; 2 | 3 | import android.test.ActivityInstrumentationTestCase2; 4 | 5 | import com.google.android.gms.maps.GoogleMap; 6 | 7 | import junit.framework.TestCase; 8 | 9 | /** 10 | * Created by pedro on 20/07/2014. 11 | */ 12 | public class MainTest extends TestCase { 13 | 14 | GoogleMap mapa; 15 | 16 | @Override 17 | protected void setUp() throws Exception { 18 | super.setUp(); 19 | } 20 | 21 | public void testPreconditions() { 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /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 | mavenCentral() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.5.0' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | mavenCentral() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/debug.keystore -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Settings specified in this file will override any Gradle settings 5 | # configured through the IDE. 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/RioBus/android-app/268e2b355a6e9bea57c3c7e6470b3968c41e8784/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Feb 25 00:03:14 BRT 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.2.1-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 | -------------------------------------------------------------------------------- /riobusandroid.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------