├── .gitignore ├── LICENSE ├── README.md ├── TasksForCourseApply ├── 1-WebCrawler.md ├── 2-GlobExpressions.md ├── 3-StainedGlassFilter.md └── images │ ├── input.jpg │ └── output.jpg ├── start-here └── README.md ├── week0 ├── 1-Layouts │ ├── README.md │ └── agenda.md ├── 2-Widgets │ ├── README.md │ ├── Ronaldo_Dive_Moti.mp4 │ ├── next.png │ ├── pause.png │ ├── play.png │ └── prev.png ├── agenda.md └── materials.md ├── week1 ├── 0-PuzzleGame │ └── Solution │ │ └── Puzzle │ │ ├── .gradle │ │ └── 1.12 │ │ │ └── taskArtifacts │ │ │ ├── cache.properties │ │ │ ├── cache.properties.lock │ │ │ ├── fileHashes.bin │ │ │ ├── fileSnapshots.bin │ │ │ ├── outputFileStates.bin │ │ │ └── taskArtifacts.bin │ │ ├── .idea │ │ └── workspace.xml │ │ ├── app │ │ └── build │ │ │ ├── generated │ │ │ └── source │ │ │ │ ├── buildConfig │ │ │ │ ├── debug │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── georgi │ │ │ │ │ │ └── puzzle │ │ │ │ │ │ └── BuildConfig.java │ │ │ │ └── test │ │ │ │ │ └── debug │ │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── georgi │ │ │ │ │ └── puzzle │ │ │ │ │ └── test │ │ │ │ │ └── BuildConfig.java │ │ │ │ └── r │ │ │ │ └── debug │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── georgi │ │ │ │ └── puzzle │ │ │ │ └── R.java │ │ │ ├── intermediates │ │ │ ├── classes │ │ │ │ └── debug │ │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── georgi │ │ │ │ │ └── puzzle │ │ │ │ │ ├── BuildConfig.class │ │ │ │ │ ├── PuzzleActivity$1.class │ │ │ │ │ ├── PuzzleActivity$2.class │ │ │ │ │ ├── PuzzleActivity$3.class │ │ │ │ │ ├── PuzzleActivity.class │ │ │ │ │ ├── R$array.class │ │ │ │ │ ├── R$attr.class │ │ │ │ │ ├── R$dimen.class │ │ │ │ │ ├── R$drawable.class │ │ │ │ │ ├── R$id.class │ │ │ │ │ ├── R$layout.class │ │ │ │ │ ├── R$menu.class │ │ │ │ │ ├── R$string.class │ │ │ │ │ ├── R$style.class │ │ │ │ │ └── R.class │ │ │ ├── dex │ │ │ │ └── debug │ │ │ │ │ └── classes.dex │ │ │ ├── incremental │ │ │ │ ├── aidl │ │ │ │ │ ├── debug │ │ │ │ │ │ └── dependency.store │ │ │ │ │ └── test │ │ │ │ │ │ └── debug │ │ │ │ │ │ └── dependency.store │ │ │ │ ├── mergeAssets │ │ │ │ │ ├── debug │ │ │ │ │ │ └── merger.xml │ │ │ │ │ └── test │ │ │ │ │ │ └── debug │ │ │ │ │ │ └── merger.xml │ │ │ │ └── mergeResources │ │ │ │ │ ├── debug │ │ │ │ │ └── merger.xml │ │ │ │ │ └── test │ │ │ │ │ └── debug │ │ │ │ │ └── merger.xml │ │ │ ├── libs │ │ │ │ ├── app-debug-test.ap_ │ │ │ │ └── app-debug.ap_ │ │ │ ├── manifests │ │ │ │ ├── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ │ └── test │ │ │ │ │ └── debug │ │ │ │ │ └── AndroidManifest.xml │ │ │ └── res │ │ │ │ └── debug │ │ │ │ ├── drawable-hdpi-v4 │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-mdpi-v4 │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-xhdpi-v4 │ │ │ │ ├── a0.jpg │ │ │ │ ├── a1.jpg │ │ │ │ ├── a10.jpg │ │ │ │ ├── a11.jpg │ │ │ │ ├── a12.jpg │ │ │ │ ├── a13.jpg │ │ │ │ ├── a14.jpg │ │ │ │ ├── a15.jpg │ │ │ │ ├── a2.jpg │ │ │ │ ├── a3.jpg │ │ │ │ ├── a4.jpg │ │ │ │ ├── a5.jpg │ │ │ │ ├── a6.jpg │ │ │ │ ├── a7.jpg │ │ │ │ ├── a8.jpg │ │ │ │ ├── a9.jpg │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-xxhdpi-v4 │ │ │ │ └── ic_launcher.png │ │ │ │ ├── layout │ │ │ │ └── activity_puzzle.xml │ │ │ │ ├── menu │ │ │ │ └── puzzle.xml │ │ │ │ ├── values-w820dp-v13 │ │ │ │ └── values.xml │ │ │ │ └── values │ │ │ │ └── values.xml │ │ │ └── outputs │ │ │ └── apk │ │ │ ├── app-debug-unaligned.apk │ │ │ └── app-debug.apk │ │ ├── build │ │ └── intermediates │ │ │ └── model_data.bin │ │ └── local.properties ├── 1-PuzzleGame │ ├── ImageSlicer.jar │ ├── README.md │ ├── Solution │ │ └── Puzzle │ │ │ ├── .gitignore │ │ │ ├── .idea │ │ │ ├── .name │ │ │ ├── compiler.xml │ │ │ ├── copyright │ │ │ │ └── profiles_settings.xml │ │ │ ├── encodings.xml │ │ │ ├── gradle.xml │ │ │ ├── misc.xml │ │ │ ├── modules.xml │ │ │ ├── scopes │ │ │ │ └── scope_settings.xml │ │ │ └── vcs.xml │ │ │ ├── Puzzle.iml │ │ │ ├── app │ │ │ ├── .gitignore │ │ │ ├── app.iml │ │ │ ├── build.gradle │ │ │ ├── proguard-rules.pro │ │ │ └── src │ │ │ │ ├── androidTest │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── georgi │ │ │ │ │ └── puzzle │ │ │ │ │ └── ApplicationTest.java │ │ │ │ └── main │ │ │ │ ├── AndroidManifest.xml │ │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── georgi │ │ │ │ │ └── puzzle │ │ │ │ │ └── PuzzleActivity.java │ │ │ │ └── res │ │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ ├── a0.jpg │ │ │ │ ├── a1.jpg │ │ │ │ ├── a10.jpg │ │ │ │ ├── a11.jpg │ │ │ │ ├── a12.jpg │ │ │ │ ├── a13.jpg │ │ │ │ ├── a14.jpg │ │ │ │ ├── a15.jpg │ │ │ │ ├── a2.jpg │ │ │ │ ├── a3.jpg │ │ │ │ ├── a4.jpg │ │ │ │ ├── a5.jpg │ │ │ │ ├── a6.jpg │ │ │ │ ├── a7.jpg │ │ │ │ ├── a8.jpg │ │ │ │ ├── a9.jpg │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── layout │ │ │ │ └── activity_puzzle.xml │ │ │ │ ├── menu │ │ │ │ └── puzzle.xml │ │ │ │ ├── values-w820dp │ │ │ │ └── dimens.xml │ │ │ │ └── values │ │ │ │ ├── arrays.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── strings.xml │ │ │ │ └── styles.xml │ │ │ ├── build.gradle │ │ │ ├── gradle.properties │ │ │ ├── gradle │ │ │ └── wrapper │ │ │ │ ├── gradle-wrapper.jar │ │ │ │ └── gradle-wrapper.properties │ │ │ ├── gradlew │ │ │ ├── gradlew.bat │ │ │ └── settings.gradle │ └── kerrigan.jpg ├── 2-GestureImage │ ├── README.md │ └── Solution │ │ ├── .classpath │ │ ├── .project │ │ ├── .settings │ │ └── org.eclipse.jdt.core.prefs │ │ ├── AndroidManifest.xml │ │ ├── bin │ │ ├── AndroidManifest.xml │ │ ├── GestureImageView.apk │ │ ├── classes.dex │ │ ├── classes │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── gestureimageview │ │ │ │ ├── BuildConfig.class │ │ │ │ ├── GestureImageActivity.class │ │ │ │ ├── R$attr.class │ │ │ │ ├── R$dimen.class │ │ │ │ ├── R$drawable.class │ │ │ │ ├── R$id.class │ │ │ │ ├── R$layout.class │ │ │ │ ├── R$menu.class │ │ │ │ ├── R$string.class │ │ │ │ ├── R$style.class │ │ │ │ └── R.class │ │ ├── dexedLibs │ │ │ └── android-support-v4-237ffd70e5cc6d3f4a97bb5b5d0590d6.jar │ │ ├── jarlist.cache │ │ ├── res │ │ │ └── crunch │ │ │ │ ├── drawable-hdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-mdpi │ │ │ │ └── ic_launcher.png │ │ │ │ ├── drawable-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ │ └── drawable-xxhdpi │ │ │ │ └── ic_launcher.png │ │ └── resources.ap_ │ │ ├── gen │ │ └── com │ │ │ └── example │ │ │ └── gestureimageview │ │ │ ├── BuildConfig.java │ │ │ └── R.java │ │ ├── ic_launcher-web.png │ │ ├── libs │ │ └── android-support-v4.jar │ │ ├── proguard-project.txt │ │ ├── project.properties │ │ ├── res │ │ ├── drawable-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── primordia.jpg │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ ├── layout │ │ │ └── image_gestures.xml │ │ ├── menu │ │ │ └── main.xml │ │ ├── values-v11 │ │ │ └── styles.xml │ │ ├── values-v14 │ │ │ └── styles.xml │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ └── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── src │ │ └── com │ │ └── example │ │ └── gestureimageview │ │ └── GestureImageActivity.java ├── 3-SwipeAndZoom │ ├── README.md │ └── images │ │ ├── bro_christmas.jpg │ │ ├── bronar_jenson.jpg │ │ ├── broney_ross.jpg │ │ └── trent_broser.jpg ├── agenda.md └── materials.md ├── week2 ├── 1-AnimatedPuzzleGame │ └── README.md ├── 2-KeyFrameAnimator │ └── README.md ├── 3-DrawableBrush │ └── README.md ├── agenda.md └── materials.md ├── week3 ├── 1-Flappy │ ├── README.md │ ├── bird.png │ ├── clouds.png │ ├── index.html │ └── prey_overture.mp3 └── agenda.md ├── week4 ├── 1-FlappyHighScore │ └── README.md ├── 2-FlappyAsync │ └── README.md ├── README.md └── agenda.md ├── week5 ├── .gitignore ├── .idea │ ├── .name │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── inspectionProfiles │ │ ├── Project_Default.xml │ │ └── profiles_settings.xml │ ├── misc.xml │ ├── modules.xml │ ├── scopes │ │ └── scope_settings.xml │ └── vcs.xml ├── 1-SwipeGallery │ └── README.md ├── 2-ExpenseList │ └── README.md ├── 3-MultipleActivities │ └── README.md ├── 4-Camera2Email │ └── README.md ├── 5-Bonus-Disabled-For-Now │ └── README.md ├── Adapter-Scribbles │ └── MehADapter │ │ ├── .gitignore │ │ ├── .idea │ │ ├── .name │ │ ├── compiler.xml │ │ ├── copyright │ │ │ └── profiles_settings.xml │ │ ├── encodings.xml │ │ ├── gradle.xml │ │ ├── misc.xml │ │ ├── modules.xml │ │ ├── scopes │ │ │ └── scope_settings.xml │ │ └── vcs.xml │ │ ├── MehADapter.iml │ │ ├── app │ │ ├── .gitignore │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── georgi │ │ │ │ └── mehadapter │ │ │ │ └── ApplicationTest.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── georgi │ │ │ │ └── mehadapter │ │ │ │ ├── Contact.java │ │ │ │ ├── IvoAdapter.java │ │ │ │ └── MyActivity.java │ │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── layout │ │ │ ├── activity_my.xml │ │ │ └── linear_layout.xml │ │ │ ├── menu │ │ │ └── my.xml │ │ │ ├── values-v21 │ │ │ └── styles.xml │ │ │ ├── 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 ├── Intent-Scribbles │ ├── ResourcesRecreate.iml │ ├── agenda.md │ ├── app │ │ ├── .gitignore │ │ ├── app.iml │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── androidTest │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── georgi │ │ │ │ └── resourcesrecreate │ │ │ │ └── ApplicationTest.java │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── georgi │ │ │ │ └── resourcesrecreate │ │ │ │ ├── AppContext.java │ │ │ │ ├── LoginActivity.java │ │ │ │ ├── MyActivity.java │ │ │ │ └── PlusBaseActivity.java │ │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── drawable-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── layout-land │ │ │ └── activity_my.xml │ │ │ ├── layout │ │ │ ├── activity_login.xml │ │ │ └── activity_my.xml │ │ │ ├── menu │ │ │ └── my.xml │ │ │ ├── values-v21 │ │ │ └── styles.xml │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ ├── strings_activity_login.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── build │ │ └── intermediates │ │ │ └── model_data.bin │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── local.properties │ └── settings.gradle └── README.md ├── week6 ├── 1-FileDownloader │ └── README.md ├── 2-ListAllDevices │ └── README.md ├── 3-SplashScreen │ ├── README.md │ ├── Splash_Screen.png │ ├── Splash_Screen_2.png │ └── Splash_Screen_3.png ├── 4-FileBrowser │ ├── README.md │ └── shot.png ├── README.md └── agenda.md └── week7 ├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── scopes │ └── scope_settings.xml ├── vcs.xml └── workspace.xml ├── 1-ExpenseList └── README.md ├── 2-SensorFun ├── README.md ├── hell.mp3 ├── ray_gun.mp3 └── roar.mp3 ├── README.md ├── SQLiteExample ├── .gitignore ├── .idea │ ├── .name │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ ├── scopes │ │ └── scope_settings.xml │ └── vcs.xml ├── SQLiteExample.iml ├── app │ ├── .gitignore │ ├── app.iml │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── georgi │ │ │ └── sqliteexample │ │ │ └── ApplicationTest.java │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── georgi │ │ │ └── sqliteexample │ │ │ ├── FluentApiBuilder.java │ │ │ ├── Losers.java │ │ │ └── MyActivity.java │ │ └── res │ │ ├── drawable-hdpi │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ │ ├── layout │ │ └── activity_my.xml │ │ ├── menu │ │ └── my.xml │ │ ├── values-v21 │ │ └── styles.xml │ │ ├── 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 └── agenda.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.*~ 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 HackBulgaria 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Android-1 2 | ========= 3 | 4 | The repository for the Android course in http://hackbulgaria.com 5 | 6 | ### Course Program (Draft 27.08.2014) 7 | 8 | - Android platform introduction 9 | -- How is your code executed? What exactly is an app? Android Debug bridge, tooling, logs, build toolchain, etc. 10 | - Android View ecosystem 11 | -- View vs ViewGroup, ImageView, VideoView, Relative, Frame, Linear layouts, etc. Overriding and extending View classes. 12 | --Animation framework 13 | - Android Touch Events Handling 14 | -- Simple touch events processing 15 | -- More complex events handling - double tap, double finger swipe, doube finger rotate, etc. 16 | - List Views and Adapters in Android. 17 | -- Handling variable-length data 18 | - Intents, Shared Prefs, File Storage 19 | -- IPC via intents and bundles, intent-filters, subscribing for intents 20 | - Fun with sensors/hardware API/Geo Location 21 | - Fragments 22 | - Async Tasks/Broadcast Receivers 23 | - Loaders/Services 24 | - Working with network resources/servers. Application lifecycle problems and how to avoid them. 25 | - SQlite or Canvas-drawing/Android rendering pipeline 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /TasksForCourseApply/3-StainedGlassFilter.md: -------------------------------------------------------------------------------- 1 | **Important**. 2 | For the android course, you are required to solve **1 of the 3** tasks given. 3 | This is task3. 4 | 5 | ### The What? 6 | 7 | [This](http://www.lunapic.com/editor/premade/stained-glass.gif) was generated using [this](http://www170.lunapic.com/editor/?action=stained-glass). 8 | We need you to do better. No web interface, no black outlines and flexibility as to how the polygons are to be generated. 9 | 10 | ### The How? 11 | 12 | This task was inspired by the famous [Voronoi diagram](http://www.personal.kent.edu/~rmuhamma/Compgeometry/MyCG/CG-Applets/Images/vor_overlay_eg02.gif). 13 | 14 | There is a set of points on a 2D plane. Those points are centers of respective regions(1 region per point). Let's call those points the *center points*. 15 | 16 | Every *center point* has one *region* surrounding it, and every *region* has one *center point*. 17 | 18 | How are the regions of the *center points* determined? If you take any point from a region, let's say point *A* you will notice that the closest *center point* to A is the center point of the region from where A originates. 19 | This means that in order to determine which point is contained in which region all you have to do is find the nearest center point to that point. This is the way to do this filter. 20 | 21 | Given an input image, generate a number of *center points* and determine the *region* for every pixel in the input image. 22 | Calculate the average color from all pixels belonging in a certain region, and draw every pixel in that region in the averaged color. 23 | 24 | See? Simple. 25 | 26 | **Note:** Finding the closest point to another point is easy but the naive approach takes O(N) time. Use [K-D trees](http://en.wikipedia.org/wiki/K-d_tree) to reduce the complexity to O(log(N)). 27 | You can use any java library or code you want. Personally I used literary the [first google result](http://home.wlu.edu/~levys/software/kd/) that popped out on my first search. 28 | K-D trees are simple so any library is as good as the next, so don't worry about it ;) 29 | 30 | ### The Formalaties! 31 | 32 | Write a Java command line tool that takes one image as input and outputs that image with stained glass effect applied to it. 33 | Add an optional argument that determines how many regions the output image will be comprised of. 34 | For example `java stainedGlassFilter input.jpg output.jpg 10000` 35 | 36 | ### The Goal! 37 | **Example input** 38 | ![Heisenberg](images/input.jpg "Say my name...") 39 | 40 | **Example output** 41 | ![Heisenberg](images/output.jpg "Say my name...") 42 | -------------------------------------------------------------------------------- /TasksForCourseApply/images/input.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/TasksForCourseApply/images/input.jpg -------------------------------------------------------------------------------- /TasksForCourseApply/images/output.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/TasksForCourseApply/images/output.jpg -------------------------------------------------------------------------------- /start-here/README.md: -------------------------------------------------------------------------------- 1 | #### 0. Install (Oracle's) Java 8 2 | 3 | We will be using a Java 8 Oracle VM. 4 | While we will not code Android on Java 8, we will use the Java 8 VM (the one from Oracle), as it has some serious performance benefits. 5 | 6 | Please make sure you install the Oracle version of java 8. (JDK, not JRE) 7 | 8 | 9 | #### 1. Choose your ~~destiny~~ IDE 10 | We will be using the [Android Studio](https://developer.android.com/sdk/installing/studio.html). That is the IDE we recommend. 11 | 12 | If you have some experience with the Eclipse/ADT and prefer to use Eclipse over the Android Studio, that's okay with us. 13 | [Download Eclipse/ADT bundle](https://developer.android.com/sdk/index.html) 14 | 15 | Download one of the IDE bundles and install it to a location of your choosing. 16 | 17 | #### 2. Make sure your IDE is powered by Oracle's Java 8 18 | Whichever IDE you install, make sure it is powered by Java 8. 19 | The easiest way to do that is to **first install java 8** and make it the default java (for Linux distributions). (Remove/uninstall older java versions for Mac OS X or Windows). 20 | 21 | If you need more than one JDK installed, [point the location to your java VM in Eclipse.ini](http://wiki.eclipse.org/Eclipse.ini). 22 | See [File->Other Settings->Default Project Structure->SDKs. for Android Studio](http://stackoverflow.com/questions/16823790/android-studio-dont-know-where-is-java) 23 | 24 | #### 3. Fixing your $PATH 25 | 26 | When you install one of the IDE bundles, you also install **The Android SDK**, which contains some tools we will need. 27 | It will be a lot easier for us if we can summon them any time from the console without having to go to their folders... 28 | 29 | This is where $PATH (%PATH% if you are on Windows) comes in. 30 | You should add the following folders to your $PATH variable: 31 | - Eclipse: /path-to-adt-bundle-installation/sdk/platform-tools/ 32 | - Android Studio: /path-to-Android-Studio/sdk/platform-tools/ 33 | 34 | [Changing PATH in Linux](http://www.wikihow.com/Change-the-Path-Variable-in-Linux) 35 | [Changing PATH in Windows](http://www.computerhope.com/issues/ch000549.htm) 36 | [Changing PATH in MAC OS X](http://www.cyberciti.biz/faq/appleosx-bash-unix-change-set-path-environment-variable/) 37 | 38 | 39 | -------------------------------------------------------------------------------- /week0/1-Layouts/README.md: -------------------------------------------------------------------------------- 1 | #### Fun with flags 2 | Let's kick off the layout tasks with a simple 'flag' game. 3 | 4 | Create an application that draws a flag on the screen. 5 | Each of the flags should be in **a separate layout xml file** - this means you will end up having flags_easy.xml, flags_medium.xml, flags_hard.xml 6 | ##### Easy 7 | ![Easy](http://i.imgur.com/AgJTRCRl.jpg) 8 | - Start off with a simple flag - like Bulgaria's. 9 | - Use a [LinearLayout](http://developer.android.com/guide/topics/ui/layout/linear.html) for it. 10 | - Use a simple [View](http://developer.android.com/reference/android/view/View.html) and its [background](http://developer.android.com/reference/android/view/View.html#attr_android:background) xml property. 11 | 12 | ###### Bonus 1 13 | Make a horizontal-stripes flag, like Italy's: 14 | ![Italy]http://upload.wikimedia.org/wikipedia/en/0/03/Flag_of_Italy.svg 15 | 16 | ###### Bonus 2* 17 | Switch colors on touch. 18 | Prepare an array of colors in a resource file. Check this [hackoverflow thread](http://stackoverflow.com/questions/9114587/how-can-i-save-colors-in-array-xml-and-get-its-back-to-color-array for how you can do that) in order to see how it's done. 19 | 20 | Obtain the color array using `getResources().getIntArray(R.array.my_color_array);`, and when the user touches one of the flag colors, change that flag color to another from the array (Hint: keep a 'currentColor' pointer). This way you can achieve a number of flags, for instance [Russia's flag](http://upload.wikimedia.org/wikipedia/en/archive/f/f3/20120812153730!Flag_of_Russia.svg) 21 | 22 | 23 | ##### Medium 24 | ![Medium](http://i.imgur.com/Zzr2QwWl.jpg) 25 | - Use [FrameLayout] (http://developer.android.com/reference/android/widget/FrameLayout.html) 26 | - Use and combine `layout_marginTop` and `layout_marginLeft` properties. 27 | - Use exact dp values for width and height, e.g. `150dp` 28 | 29 | ##### Hard* 30 | ![Hard](http://i.imgur.com/mgtulWR.png) 31 | - RelativeLayout, FrameLayout and/or LinearLayout/GridLayout 32 | - Think and draw how you would compose the layers. 33 | - You will need to use exact dp values. 34 | - Better finish this one at home. 35 | 36 | ##### Über* 37 | ![Über](http://i.imgur.com/MFjxSyU.png) 38 | ![Über](http://i.imgur.com/V9Efq4V.png) 39 | - Why weights? 40 | - What problem does `adjustViewBounds` solve? 41 | - What is gravity? 42 | - The image width is set to `100dp` 43 | - Better finish this one at home. 44 | 45 | -------------------------------------------------------------------------------- /week0/1-Layouts/agenda.md: -------------------------------------------------------------------------------- 1 | - View classes and hierarchy 2 | - ViewGroup vs View 3 | - The visual (view) tree 4 | - layout_width, layout_height, id, match_parent, wrap_content, dp, sp 5 | - DP vs PX - basics 6 | - For the people in Georgi's group - ImageView, android:src 7 | - LinearLayout, FrameLayout, RelativeLayout 8 | -------------------------------------------------------------------------------- /week0/2-Widgets/README.md: -------------------------------------------------------------------------------- 1 | #### Color Previewer 2 | 3 | ![Image](http://i.imgur.com/83diMs5.jpg) 4 | 5 | Create a simple android application, containing an `EditText` and a button. 6 | The user enters a hexademical code of a color, e.g. `#FF0000` and clicks the button. 7 | 8 | Everything below the `EditText` should filled with the same color as entered. (Check the example above) 9 | 10 | ###### Bonus 11 | Update the color in real time, without clicking on the refresh button 12 | 13 | #### Help Ludogorets 14 | 15 | ![Imgur](http://i.imgur.com/MBeDkdn.jpg) 16 | 17 | Was it a penalty? Was it not? 18 | It's not easy to decide. 19 | 20 | Write an application, that has plays a *very specific video* (the `.mp4` file in this folder) 21 | Draw several buttons, like the ones below, with the following functionality: 22 | - If a user hits the **'Play'** button, the video starts/resumes playing **and the button 'play' image is replaced by a 'pause' image** 23 | - If a user hits the **'Pause'** button (seen after the user hits 'Play'), the video pauses and **the button image becomes 'play' again** 24 | - If a user hits the **'Seek Left'/'Prev'** button, the video goes back 3 seconds **(pauses playing state)** 25 | - If a user hits the **'Seek Right'/'Next'** button, the video goes forth 3 seconds **(pauses playing state)** 26 | 27 | Hints: 28 | - Use the assets provided in this github folder 29 | - You can play the video **directly** from github, but you should NOT do that 30 | - See `setVideoUri` method in VideoView. 31 | - See `Uri.fromFile` method 32 | - Copy/Download/`adb push` the video in the external storage of your device (the one your computer sees when you connect the USB cable). 33 | - Use `Environment.getExternalStorageDirectory()` -> this returns a file pointing to the external storage of your device. 34 | - - If your file is in /sdcard/A.mp4, you can obtain it doing `new File(Environment.getExternalStorageDirectory(), "A.mp4")` 35 | - - Add the 'READ_EXTERNAL_STORAGE' permission to your AndroidManifest.xml 36 | -------------------------------------------------------------------------------- /week0/2-Widgets/Ronaldo_Dive_Moti.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week0/2-Widgets/Ronaldo_Dive_Moti.mp4 -------------------------------------------------------------------------------- /week0/2-Widgets/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week0/2-Widgets/next.png -------------------------------------------------------------------------------- /week0/2-Widgets/pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week0/2-Widgets/pause.png -------------------------------------------------------------------------------- /week0/2-Widgets/play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week0/2-Widgets/play.png -------------------------------------------------------------------------------- /week0/2-Widgets/prev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week0/2-Widgets/prev.png -------------------------------------------------------------------------------- /week0/agenda.md: -------------------------------------------------------------------------------- 1 | - - Android Platform Introduction 2 | - - Mobile OS 3 | - - Not exactly Java 4 | - - - Dalvik VM vs ART 5 | - - One Play Store to rule them all 6 | - - Android's Play Store vs Apple's App Store 7 | - - Linux-based 8 | - - Every app is a process, separate VM 9 | - - Every app is a different Linux user 10 | - - Android Studio vs Eclipse/ADT 11 | - - ADB and SDK 12 | - - ADB + PATH configuration 13 | - - adb logcat 14 | - - adb shell, push, pull, install/uninstall,kill-server,start-server, devices, etc. 15 | - - adb run-as com.mycompany.myapp 16 | - - Hello World project in Eclise or Android Studio 17 | - - Strings.xml/resources concept in Android 18 | - - Folders/drawables 19 | - - TargetSDK vs MinimumSDK 20 | - - 4.0 and above 21 | - - AndroidManifest.xml overview 22 | - - ActivityLifecycle - http://developer.android.com/images/training/basics/basic-lifecycle.png 23 | - - Log Everything on onCreate, onResume, onStop, onStart, onRestart, etc and explain when do these happen. 24 | - - Toasting! 25 | - - Placing TextViews, ImageViews, placing onClickListener and toasting on click 26 | 27 | ------------------------------------------------------ 28 | - (First ask how many people can show an image on Android) - demonstrate the resource usage with an ImageView for the ones who can't 29 | - layout_width, layout_height, layout_marginLeft, layout_marginTop, padding, etc. => draw a box for paddings/margins 30 | - View vs ViewGroups: 31 | - - draw the "View" hierarchy 32 | - - draw the "ViewGroup" heierarchy 33 | - - draw an example Visual tree 34 | - - TextView, Button, EditText (getText), ImageView, VideoView 35 | - Talk about remembering Views in Activity 36 | - Do the first LinearLayout example 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /week0/materials.md: -------------------------------------------------------------------------------- 1 | #### Theoretical 2 | UI Overview 3 | http://developer.android.com/guide/topics/ui/overview.html 4 | 5 | Layouts (no need to cover Adapters just yet) 6 | http://developer.android.com/guide/topics/ui/declaring-layout.html 7 | 8 | LinearLayout 9 | http://developer.android.com/guide/topics/ui/layout/linear.html 10 | 11 | RelativeLayout 12 | http://developer.android.com/guide/topics/ui/layout/relative.html 13 | 14 | FrameLayout 15 | http://code.tutsplus.com/tutorials/android-user-interface-design-frame-layouts--mobile-4877 16 | 17 | #### Practical 18 | Show an Image and a button in your app. Make the button swap the image 19 | http://www.mkyong.com/android/android-imageview-example/ 20 | 21 | Building simple UI 22 | //Wherever it says anything about fragments, drop it - use my_activiy.xml in the /layout/ folder. 23 | https://developer.android.com/training/basics/firstapp/building-ui.html 24 | 25 | Relative Layout tutorial/example 26 | http://www.mkyong.com/android/android-relativelayout-example/ 27 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/cache.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 13 20:26:32 EEST 2014 2 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/cache.properties.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/cache.properties.lock -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/fileHashes.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/fileHashes.bin -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/fileSnapshots.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/fileSnapshots.bin -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/outputFileStates.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/outputFileStates.bin -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/taskArtifacts.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/.gradle/1.12/taskArtifacts/taskArtifacts.bin -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/generated/source/buildConfig/debug/com/example/georgi/puzzle/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Automatically generated file. DO NOT MODIFY 3 | */ 4 | package com.example.georgi.puzzle; 5 | 6 | public final class BuildConfig { 7 | public static final boolean DEBUG = Boolean.parseBoolean("true"); 8 | public static final String PACKAGE_NAME = "com.example.georgi.puzzle"; 9 | public static final String BUILD_TYPE = "debug"; 10 | public static final String FLAVOR = ""; 11 | public static final int VERSION_CODE = 1; 12 | public static final String VERSION_NAME = "1.0"; 13 | } 14 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/generated/source/buildConfig/test/debug/com/example/georgi/puzzle/test/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Automatically generated file. DO NOT MODIFY 3 | */ 4 | package com.example.georgi.puzzle.test; 5 | 6 | public final class BuildConfig { 7 | public static final boolean DEBUG = Boolean.parseBoolean("true"); 8 | public static final String PACKAGE_NAME = "com.example.georgi.puzzle.test"; 9 | public static final String BUILD_TYPE = "debug"; 10 | public static final String FLAVOR = ""; 11 | public static final int VERSION_CODE = 1; 12 | public static final String VERSION_NAME = "1.0"; 13 | } 14 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/generated/source/r/debug/com/example/georgi/puzzle/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.example.georgi.puzzle; 9 | 10 | public final class R { 11 | public static final class array { 12 | public static final int pictures=0x7f040000; 13 | } 14 | public static final class attr { 15 | } 16 | public static final class dimen { 17 | public static final int activity_horizontal_margin=0x7f050000; 18 | public static final int activity_vertical_margin=0x7f050001; 19 | } 20 | public static final class drawable { 21 | public static final int a0=0x7f020000; 22 | public static final int a1=0x7f020001; 23 | public static final int a10=0x7f020002; 24 | public static final int a11=0x7f020003; 25 | public static final int a12=0x7f020004; 26 | public static final int a13=0x7f020005; 27 | public static final int a14=0x7f020006; 28 | public static final int a15=0x7f020007; 29 | public static final int a2=0x7f020008; 30 | public static final int a3=0x7f020009; 31 | public static final int a4=0x7f02000a; 32 | public static final int a5=0x7f02000b; 33 | public static final int a6=0x7f02000c; 34 | public static final int a7=0x7f02000d; 35 | public static final int a8=0x7f02000e; 36 | public static final int a9=0x7f02000f; 37 | public static final int ic_launcher=0x7f020010; 38 | } 39 | public static final class id { 40 | public static final int action_settings=0x7f090001; 41 | public static final int super_parent=0x7f090000; 42 | } 43 | public static final class layout { 44 | public static final int activity_puzzle=0x7f030000; 45 | } 46 | public static final class menu { 47 | public static final int puzzle=0x7f080000; 48 | } 49 | public static final class string { 50 | public static final int action_settings=0x7f060000; 51 | public static final int app_name=0x7f060001; 52 | public static final int hello_world=0x7f060002; 53 | } 54 | public static final class style { 55 | /** Customize your theme here. 56 | */ 57 | public static final int AppTheme=0x7f070000; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/BuildConfig.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/PuzzleActivity$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/PuzzleActivity$1.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/PuzzleActivity$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/PuzzleActivity$2.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/PuzzleActivity$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/PuzzleActivity$3.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/PuzzleActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/PuzzleActivity.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$array.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$array.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$attr.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$dimen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$dimen.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$drawable.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$id.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$layout.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$menu.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$string.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R$style.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/classes/debug/com/example/georgi/puzzle/R.class -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/dex/debug/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/dex/debug/classes.dex -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/incremental/aidl/debug/dependency.store: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/incremental/aidl/test/debug/dependency.store: -------------------------------------------------------------------------------- 1 |  -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/incremental/mergeAssets/debug/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/incremental/mergeAssets/test/debug/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/incremental/mergeResources/test/debug/merger.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/libs/app-debug-test.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/libs/app-debug-test.ap_ -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/libs/app-debug.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/libs/app-debug.ap_ -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/manifests/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/manifests/test/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-hdpi-v4/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-hdpi-v4/ic_launcher.png -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-mdpi-v4/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-mdpi-v4/ic_launcher.png -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a0.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a1.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a10.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a11.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a12.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a13.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a14.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a15.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a2.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a3.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a4.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a5.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a6.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a7.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a8.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/a9.jpg -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xhdpi-v4/ic_launcher.png -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xxhdpi-v4/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/drawable-xxhdpi-v4/ic_launcher.png -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/layout/activity_puzzle.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/menu/puzzle.xml: -------------------------------------------------------------------------------- 1 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/values-w820dp-v13/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 64dp 8 | 9 | 10 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/intermediates/res/debug/values/values.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | @drawable/a0 9 | @drawable/a1 10 | @drawable/a2 11 | @drawable/a3 12 | @drawable/a4 13 | @drawable/a5 14 | @drawable/a6 15 | @drawable/a7 16 | @drawable/a8 17 | @drawable/a9 18 | @drawable/a10 19 | @drawable/a11 20 | @drawable/a12 21 | @drawable/a13 22 | @drawable/a14 23 | @drawable/a15 24 | 25 | 26 | 27 | 28 | 16dp 29 | 16dp 30 | 31 | 32 | 33 | Settings 34 | Puzzle 35 | Hello world! 36 | 37 | 38 | 39 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/outputs/apk/app-debug-unaligned.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/outputs/apk/app-debug-unaligned.apk -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/app/build/outputs/apk/app-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/app/build/outputs/apk/app-debug.apk -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/build/intermediates/model_data.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/0-PuzzleGame/Solution/Puzzle/build/intermediates/model_data.bin -------------------------------------------------------------------------------- /week1/0-PuzzleGame/Solution/Puzzle/local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file should *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=/home/georgi/Dev/AndroidStudio/android-studio/sdk -------------------------------------------------------------------------------- /week1/1-PuzzleGame/ImageSlicer.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/ImageSlicer.jar -------------------------------------------------------------------------------- /week1/1-PuzzleGame/README.md: -------------------------------------------------------------------------------- 1 | #### Puzzle 2 | 3 | ###### Preparing the pieces 4 | Make a cool puzzle game. 5 | ![Puzzle](http://i.imgur.com/8V7E0ef.jpg) 6 | 7 | What do you need to create a puzzle-like game for Android? 8 | First, you need to **choose an image**. You can either: 9 | - Choose one from google images (It would be good to use the resolution of the device you are going to work with. Easier.) 10 | - Use kerrigan.jpg from this folder 11 | 12 | Second, you need to **split the image** in little puzzle parts. 13 | - Use the provided ImageSlicer.jar. (For instance `java -jar ImageSlicer.jar kerrigan.jpg 4 4` will create 16 puzzle pieces for the image **kerrigan.jpg**) 14 | - Write your own (advanced) slicer (with curves and peaks) ([ImageSlicer.jar is the simplest slicer](https://gist.github.com/GeorgiPachov/cfe5027b1eca5dd97fa4)) 15 | 16 | 17 | Later we will migrate the slicing to be done on Android, when we know about Bitmaps and Storage. 18 | 19 | Now that you have 16 or more small .jpg files, you need to **get them to your drawable** folder. 20 | Once you've done that, create an **xml resource array** (just like the color array in [our last session](http://stackoverflow.com/questions/9114587/how-can-i-save-colors-in-array-xml-and-get-its-back-to-color-array)), but this time use a `TypedArray`, (obtain it using `getResources().obtainTypedArray(int arrayId)`). 21 | 22 | **Use the `getDrawable` method to obtain the drawables.** 23 | Don't forget to recycle the typed array! (`ta.recycle()`) 24 | 25 | ###### Building the layout 26 | This time, as you don't know how many puzzle pieces they will be in advance, you won't be able to just type all the layouts in an xml file. 27 | Create your views dynamically, in the `onCreate` method. [See the answers here](http://stackoverflow.com/questions/2395769/how-to-programmatically-add-views-to-views) 28 | Use whatever layout you like the most and is easiest for your. Don't worry about performance for the moment. 29 | 30 | You should use an [ImageView](http://developer.android.com/reference/android/widget/ImageView.html) to display all the pictures. Check out and read carefully the documentation around `setAdjustViewBounds` and `setScaleType` methods. They might come useful. 31 | 32 | ###### Dragging and dropping 33 | - See the [Drag and Drop developer guide](http://developer.android.com/guide/topics/ui/drag-drop.html) again. 34 | - You need to manually tell the Android system when a drag has started! 35 | See [startDrag](http://developer.android.com/reference/android/view/View.html#startDrag(android.content.ClipData, android.view.View.DragShadowBuilder, java.lang.Object, int)), [onDragEvent](http://developer.android.com/reference/android/view/View.html#onDragEvent(android.view.DragEvent)) and [DragEvent](http://developer.android.com/reference/android/view/DragEvent.html) 36 | 37 | 38 | ###### Finish the game. 39 | - Implement a random shuffling of the pictures 40 | - Implement an easy way to determine whether the puzzle is solved : ) 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/.name: -------------------------------------------------------------------------------- 1 | Puzzle -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/Puzzle.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "20.0.0" 6 | 7 | defaultConfig { 8 | applicationId "com.example.georgi.puzzle" 9 | minSdkVersion 15 10 | targetSdkVersion 20 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | runProguard false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | } 25 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/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/georgi/Dev/AndroidStudio/android-studio/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 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/androidTest/java/com/example/georgi/puzzle/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.puzzle; 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 | } -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a0.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a0.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a1.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a10.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a11.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a12.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a13.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a13.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a14.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a14.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a15.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a15.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a2.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a3.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a4.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a5.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a6.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a7.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a8.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/a9.jpg -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/layout/activity_puzzle.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/menu/puzzle.xml: -------------------------------------------------------------------------------- 1 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/values/arrays.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | @drawable/a0 5 | @drawable/a1 6 | @drawable/a2 7 | @drawable/a3 8 | @drawable/a4 9 | @drawable/a5 10 | @drawable/a6 11 | @drawable/a7 12 | @drawable/a8 13 | @drawable/a9 14 | @drawable/a10 15 | @drawable/a11 16 | @drawable/a12 17 | @drawable/a13 18 | @drawable/a14 19 | @drawable/a15 20 | 21 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Puzzle 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/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:0.12.2' 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 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/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 -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/Solution/Puzzle/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip 7 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/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 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/Solution/Puzzle/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /week1/1-PuzzleGame/kerrigan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/1-PuzzleGame/kerrigan.jpg -------------------------------------------------------------------------------- /week1/2-GestureImage/README.md: -------------------------------------------------------------------------------- 1 | #### Gesture Image 2 | 3 | ###### Description 4 | Insert an image which you can control with your fingers. 5 | The user has to be able to pan, rotate and scale the image. 6 | 7 | ![original](http://i.imgur.com/ywpFCGK.png) 8 | ![pan](http://i.imgur.com/cVqAkgg.png) 9 | ![rotate](http://i.imgur.com/ppFhc8v.png) 10 | ![scale](http://i.imgur.com/kwxIc65.png) 11 | 12 | Panning can be achieved by using one or two fingers. Rotate and scale require two fingers. If the user is moving the image with two of his finger and suddenly lifts one of them, the image should continue panning. If then the user decides to drop his second finger again, then he should again be able to rotate and scale the image. 13 | 14 | ###### Hints 15 | - Use `event.getMaskedAction()` to get the user action - `ACTION_DOWN`, `ACTION_MOVE`, `ACTION_UP`, `ACTION_CANCEL`, `ACTION_POINTER_DOWN`, `ACTION_POINTER_UP` 16 | - Gather data for all pointers at every touch event 17 | - At every touch event calculate the delta (the difference between the current and previous value of the property) of each property you are interested in 18 | - Use `ImageView`'s `setTranslationX`, `setTranslationY`, `setRotation`, `setScaleX`, `setScaleY` setters to set the respective properties 19 | - For panning with two fingers use the middle of the line between them as a reference point 20 | 21 | ###### Bonus 22 | - Detect if your finger/s is/are actually within the bounds of the image 23 | - Handle double tap gesture which resets the image into its original state 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | GestureImageView 4 | 5 | 6 | 7 | 8 | 9 | com.android.ide.eclipse.adt.ResourceManagerBuilder 10 | 11 | 12 | 13 | 14 | com.android.ide.eclipse.adt.PreCompilerBuilder 15 | 16 | 17 | 18 | 19 | org.eclipse.jdt.core.javabuilder 20 | 21 | 22 | 23 | 24 | com.android.ide.eclipse.adt.ApkBuilder 25 | 26 | 27 | 28 | 29 | 30 | com.android.ide.eclipse.adt.AndroidNature 31 | org.eclipse.jdt.core.javanature 32 | 33 | 34 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 3 | org.eclipse.jdt.core.compiler.compliance=1.6 4 | org.eclipse.jdt.core.compiler.source=1.6 5 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 10 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/GestureImageView.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/GestureImageView.apk -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes.dex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes.dex -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/BuildConfig.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/BuildConfig.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/GestureImageActivity.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/GestureImageActivity.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$attr.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$attr.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$dimen.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$dimen.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$drawable.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$drawable.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$id.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$id.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$layout.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$layout.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$menu.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$menu.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$string.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$string.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$style.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R$style.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/classes/com/example/gestureimageview/R.class -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/dexedLibs/android-support-v4-237ffd70e5cc6d3f4a97bb5b5d0590d6.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/dexedLibs/android-support-v4-237ffd70e5cc6d3f4a97bb5b5d0590d6.jar -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/jarlist.cache: -------------------------------------------------------------------------------- 1 | # cache for current jar dependency. DO NOT EDIT. 2 | # format is 3 | # Encoding is UTF-8 4 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/res/crunch/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/res/crunch/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/res/crunch/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/res/crunch/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/res/crunch/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/res/crunch/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/res/crunch/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/res/crunch/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/bin/resources.ap_: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/bin/resources.ap_ -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/gen/com/example/gestureimageview/BuildConfig.java: -------------------------------------------------------------------------------- 1 | /** Automatically generated file. DO NOT MODIFY */ 2 | package com.example.gestureimageview; 3 | 4 | public final class BuildConfig { 5 | public final static boolean DEBUG = true; 6 | } -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/gen/com/example/gestureimageview/R.java: -------------------------------------------------------------------------------- 1 | /* AUTO-GENERATED FILE. DO NOT MODIFY. 2 | * 3 | * This class was automatically generated by the 4 | * aapt tool from the resource data it found. It 5 | * should not be modified by hand. 6 | */ 7 | 8 | package com.example.gestureimageview; 9 | 10 | public final class R { 11 | public static final class attr { 12 | } 13 | public static final class dimen { 14 | /** Default screen margins, per the Android Design guidelines. 15 | 16 | Example customization of dimensions originally defined in res/values/dimens.xml 17 | (such as screen margins) for screens with more than 820dp of available width. This 18 | would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). 19 | 20 | */ 21 | public static final int activity_horizontal_margin=0x7f040000; 22 | public static final int activity_vertical_margin=0x7f040001; 23 | } 24 | public static final class drawable { 25 | public static final int ic_launcher=0x7f020000; 26 | public static final int primordia=0x7f020001; 27 | } 28 | public static final class id { 29 | public static final int action_settings=0x7f080002; 30 | public static final int image=0x7f080001; 31 | public static final int root=0x7f080000; 32 | } 33 | public static final class layout { 34 | public static final int image_gestures=0x7f030000; 35 | } 36 | public static final class menu { 37 | public static final int main=0x7f070000; 38 | } 39 | public static final class string { 40 | public static final int action_settings=0x7f050002; 41 | public static final int app_name=0x7f050000; 42 | public static final int hello_world=0x7f050001; 43 | } 44 | public static final class style { 45 | /** 46 | Base application theme, dependent on API level. This theme is replaced 47 | by AppBaseTheme from res/values-vXX/styles.xml on newer devices. 48 | 49 | 50 | Theme customizations available in newer API levels can go in 51 | res/values-vXX/styles.xml, while customizations related to 52 | backward-compatibility can go here. 53 | 54 | 55 | Base application theme for API 11+. This theme completely replaces 56 | AppBaseTheme from res/values/styles.xml on API 11+ devices. 57 | 58 | API 11 theme customizations can go here. 59 | 60 | Base application theme for API 14+. This theme completely replaces 61 | AppBaseTheme from BOTH res/values/styles.xml and 62 | res/values-v11/styles.xml on API 14+ devices. 63 | 64 | API 14 theme customizations can go here. 65 | */ 66 | public static final int AppBaseTheme=0x7f060000; 67 | /** Application theme. 68 | All customizations that are NOT specific to a particular API-level can go here. 69 | */ 70 | public static final int AppTheme=0x7f060001; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/ic_launcher-web.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/ic_launcher-web.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/libs/android-support-v4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/libs/android-support-v4.jar -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/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 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/drawable-hdpi/primordia.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/res/drawable-hdpi/primordia.jpg -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/2-GestureImage/Solution/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/layout/image_gestures.xml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/menu/main.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/values-v11/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/values-v14/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 64dp 9 | 10 | 11 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16dp 5 | 16dp 6 | 7 | 8 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GestureImageView 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /week1/2-GestureImage/Solution/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 14 | 15 | 16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /week1/3-SwipeAndZoom/README.md: -------------------------------------------------------------------------------- 1 | #### Swipe And Zoom 2 | 3 | ###### Description 4 | Create a minimalistic image gallery. The image is centred vertically and horizontally, and below it there is a text based progress indicator. The user navigates through the gallery with the left/right swipe gestures. When the user double taps the image should be upscaled (and downscaled when he double taps again). 5 | ![original](http://i.imgur.com/fSK0qac.png) 6 | ![upscaled](http://i.imgur.com/9jJsnxJ.png) 7 | 8 | ###### Hints 9 | - Extend `GestureDetector.SimpleOnGestureListener` and override the `onFling` and `onDoubleTap` methods 10 | - Don't recycle the `TypedArray` object, since you will always need all the images 11 | - The images are in the `images` folder in the repo 12 | 13 | ###### Bonus 14 | - Calculate the exact distance between your down and up events in `onFling` ... just be creative 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /week1/3-SwipeAndZoom/images/bro_christmas.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/3-SwipeAndZoom/images/bro_christmas.jpg -------------------------------------------------------------------------------- /week1/3-SwipeAndZoom/images/bronar_jenson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/3-SwipeAndZoom/images/bronar_jenson.jpg -------------------------------------------------------------------------------- /week1/3-SwipeAndZoom/images/broney_ross.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/3-SwipeAndZoom/images/broney_ross.jpg -------------------------------------------------------------------------------- /week1/3-SwipeAndZoom/images/trent_broser.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week1/3-SwipeAndZoom/images/trent_broser.jpg -------------------------------------------------------------------------------- /week1/agenda.md: -------------------------------------------------------------------------------- 1 | - Touch events propagation 2 | - ACTION_DOWN, ACTION_MOVE, ACTION_UP 3 | - Pointers vs Indices 4 | - `onTouchEvent` //return true, return false => the difference 5 | - `onInterceptTouchEvent` //return true, return false => the difference 6 | - Histories in TouchEvent class 7 | - GestureManager stuff 8 | - ScaleGestureManager 9 | - Drag and Drop API 10 | -------------------------------------------------------------------------------- /week1/materials.md: -------------------------------------------------------------------------------- 1 | On UI events 2 | http://developer.android.com/guide/topics/ui/ui-events.html 3 | 4 | Detecting complex gestures with GestureDetector 5 | http://developer.android.com/training/gestures/detector.html 6 | 7 | Drag and drop in Android 8 | http://developer.android.com/guide/topics/ui/drag-drop.html 9 | 10 | Double Tap 11 | http://stackoverflow.com/questions/13530937/how-to-listen-to-doubletap-on-a-view-in-android 12 | 13 | -------------------------------------------------------------------------------- /week2/1-AnimatedPuzzleGame/README.md: -------------------------------------------------------------------------------- 1 | #### Animated Puzzle 2 | 3 | ###### Description 4 | Build up on [Puzzle](https://github.com/HackBulgaria/Android-1/tree/master/week1/0-PuzzleGame) 5 | The only difference now is that when the user drops a piece, two animations should play simultaneously, each piece coming onto its new place. 6 | That's it. 7 | 8 | ###### Hints 9 | - Use a `GridLayout` instead of multiple `LinearLayout`s. 10 | - Don't swap the drawables this time, simply animate the `ImageView`s 11 | - You must do some extra bookkeeping to be able to check if the puzzle is solved 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /week2/2-KeyFrameAnimator/README.md: -------------------------------------------------------------------------------- 1 | #### Key Frame Animator 2 | 3 | ###### Description 4 | Build up on [GestureImage](https://github.com/HackBulgaria/Android-1/tree/master/week1/1-GestureImage) 5 | Now add two buttons - "save frame" and "play". When the "save" button is pressed, the current state of the image should be saved as a key frame. 6 | The user should be able to do this as many time as he wants. When he clicks the "play" button all in-between frames should be generated and played sequentially. 7 | All transformations should be saved - translation, rotation, scale. 8 | 9 | ###### Hints 10 | - Save each state as an `Animator` and each property of that state as a `PropertyValueHolder` 11 | - Play the animations sequentially using the `AnimatorSet` -------------------------------------------------------------------------------- /week2/3-DrawableBrush/README.md: -------------------------------------------------------------------------------- 1 | #### Drawable Brush 2 | 3 | ###### Description 4 | Let the user choose from an array of brushes and use them to draw on the canvas. 5 | The trick here is that the brushes are images. 6 | ![original](http://i.imgur.com/7WAokRk.png) 7 | 8 | ###### Hints 9 | - Use `Paint.setAlpha` to set the alpha of every drawn image, obviously they should be semi-transparent for aesthetical reasons 10 | - To force the canvas to redraw itself you must call `View.invalidate` 11 | - Every call to `View.invalidate` clears the canvas 12 | - Create a bitmap, use that bitmap to create a private canvas. At every touch event draw on that canvas. What you draw there will be drawn on the bitmap, for there draw the bitmap on the canvas in the `onDraw` method 13 | 14 | ###### Bonus 15 | - Highlight the selected brush in green and the other ones in red, using a gradient 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /week2/agenda.md: -------------------------------------------------------------------------------- 1 | ### Section 1: 2 | - Animators vs Animations 3 | - ValueAnimator, ObjectAnimator,ViewPropertyAnimator, 4 | - Interpolators - Linear, Decelarate, Accelarate Interpolatora, 5 | - Material Design and styles and themes 6 | - Styles and themes - NoActionBar, Fullscreen, HoloLight, HoloDark 7 | - Immersive mode 8 | 9 | ### Section 2: 10 | - Canvas 11 | - Drawable 12 | - onDraw, invalidate 13 | - measure/layout/draw phase 14 | - custom views 15 | - xml shapes, drawable states -------------------------------------------------------------------------------- /week2/materials.md: -------------------------------------------------------------------------------- 1 | ### Section 1 2 | Animation and graphics overview: 3 | http://developer.android.com/guide/topics/graphics/overview.html 4 | 5 | Property Animation Guide: 6 | http://developer.android.com/guide/topics/graphics/prop-animation.html 7 | 8 | Adding animations: 9 | http://developer.android.com/training/animation/index.html 10 | 11 | Vogella animations tutorial: 12 | http://www.vogella.com/tutorials/AndroidAnimation/article.html 13 | 14 | Styles and themes in Android: 15 | http://developer.android.com/guide/topics/ui/themes.html 16 | 17 | Throw a quick glance at **Material Design** 18 | http://www.google.com/design/spec/material-design/introduction.html 19 | 20 | Try to answer these questions: 21 | - What is the difference between `Animation` and `Animator`? 22 | - What is `ViewPropertyAnimator` and how is it different from `ObjectAnimator`? 23 | - What is an `AnimatorSet`? 24 | - How can you do something **at the end** of an animation? 25 | - How do styles and themes differ in Android? 26 | - What do you know about material design? 27 | 28 | ### Section 2 29 | Canvas and drawables guide: 30 | http://developer.android.com/guide/topics/graphics/2d-graphics.html 31 | 32 | Vogella tutorial on drawables 33 | http://www.vogella.com/tutorials/AndroidDrawables/article.html 34 | 35 | Custom Drawing in Android 36 | http://developer.android.com/training/custom-views/custom-drawing.html 37 | 38 | How Android draws views (Important!) 39 | https://developer.android.com/guide/topics/ui/how-android-draws.html 40 | 41 | Creating custom Views in Andorid (training) 42 | http://developer.android.com/training/custom-views/index.html 43 | 44 | Custom drawable states in Android 45 | http://charlesharley.com/2012/programming/custom-drawable-states-in-android/ 46 | 47 | XML shapes 48 | http://android-dev-tips-and-tricks.blogspot.com/2012/08/xml-drawables-part-i.html -------------------------------------------------------------------------------- /week3/1-Flappy/bird.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week3/1-Flappy/bird.png -------------------------------------------------------------------------------- /week3/1-Flappy/clouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week3/1-Flappy/clouds.png -------------------------------------------------------------------------------- /week3/1-Flappy/prey_overture.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week3/1-Flappy/prey_overture.mp3 -------------------------------------------------------------------------------- /week3/agenda.md: -------------------------------------------------------------------------------- 1 | - Canvas recall 2 | - Bitmaps recap 3 | - Custom views recap 4 | - onMeasure, onLayout, onDraw(Canvas systemCanvas) vs measure/layout/draw(Canvas systemCanvas) 5 | - immersiveMode 6 | - Activity and Context 7 | - Audio/MediaPlayer API 8 | - GameLoop/GameClock "pattern" 9 | - GameObject "pattern" 10 | WPF WO 11 | -------------------------------------------------------------------------------- /week4/1-FlappyHighScore/README.md: -------------------------------------------------------------------------------- 1 | #### Flappy High Score 2 | 3 | ###### Description 4 | ![login](http://i.imgur.com/0UiVo8t.png) 5 | 6 | Build up on FlappyBird. 7 | - Create a 'login' form and take the player's details - what is his name, what is his email, and where is he from - FMI, TU, UNWE or and on. 8 | - When the player enter's his details, begin the game. 9 | - When the game finishes, collect his score (if you don't count score in the game - use 0 for score) 10 | - When you have all the information needed, **send the player details - name, email, where he is from + score to our server to upload his score to our server.** 11 | Do this on the UI thread, for the moment. Later on we will see how and why this is a bad idea and will teach you the proper way to networking on Android. 12 | 13 | ###### Details: 14 | The game should be made of one activity, with two fragments - a `Login` fragment and a `Game` fragment 15 | You should make a `FragmentTransition` between the two when a player fills everything and presses `Play` or `login` or whatever you choose for your button text : ) 16 | 17 | Server and calls location: http://95.111.103.224:8080/Flappy/scores 18 | 19 | - `GET` all scores (you will need this just to test whether your `PUT` call has succeeded) 20 | ``` 21 | URL: http://95.111.103.224:8080/Flappy/scores 22 | Method: GET 23 | Response format: JSON 24 | Example response: [ { "name" : "Ceco" , "mail" : "ceco@abv.bg" , "whereFrom" : "FMI" , "score" : 21} , { "name" : "Todor" , "mail" : "teo_hacker@gmail.com" , "whereFrom" : "TU-Sofia" , "score" : 32} ] 25 | ``` 26 | 27 | - `PUT` a player score 28 | ``` 29 | URL: http://95.111.103.224:8080/Flappy/scores 30 | Method: PUT 31 | Content-type: application/json (don't forget to add this, please) 32 | Example request (entity) body: { "name" : "Dimitar" , "mail" : "phd@mitkoland.eu" , "whereFrom" : "Tijuana" , "score" : 96} 33 | ``` 34 | 35 | 36 | ###### Hints 37 | 38 | - Both fragments are contained in the same activity 39 | - Only one fragment is visible at a time 40 | - There are several ways to do REST on Android 41 | - - You can use the HTTP Connection components => see http://stackoverflow.com/questions/3649814/android-httpput-example-code 42 | - - You can use apache's `HttpClient` library (integrated in Android) => see http://developer.android.com/reference/org/apache/http/client/methods/HttpPut.html, http://hc.apache.org/httpclient-3.x/methods/put.html. 43 | - - Help for HttpClient (you may need this sentence): 44 | 45 | A **Client** executes a **HttpMethod** (HttpPut, for instance). The **execution** returns a **HttpResponse** which has an **Enity** which has **content**, which is the string that the server returned to you you. 46 | 47 | If you want to **make a server call with a body**, your **HttpMethod** should have an **Entity** set, which should be the content you want to send to the server. (You know, like for example, JSON) 48 | 49 | ###### Bonus (easy) 50 | - Do some cool transition between the switching of the fragments 51 | -------------------------------------------------------------------------------- /week4/2-FlappyAsync/README.md: -------------------------------------------------------------------------------- 1 | #### Flappy Async 2 | 3 | ###### Description 4 | ![progress bar](http://i.imgur.com/RBKGoBP.png) 5 | Build up on the original task. When sending the request to the server, display a progress bar, and close it when you get a response. 6 | 7 | ###### Bonus 8 | - Display an appropriate message if there is a network error 9 | - Handle lack of internet connection 10 | -------------------------------------------------------------------------------- /week4/README.md: -------------------------------------------------------------------------------- 1 | #### Fragments 2 | 3 | Fragments are a powerful UI concept in Android. They represent a self-contained UI portion of an Activity's layout and logic. 4 | 5 | Here's some stuff that you should read about them: 6 | - [Fragments Design Philosophy, Fragments Lifecycle](http://developer.android.com/guide/components/fragments.html) 7 | - [Dynamic UI with Fragments (see the three links below)](http://developer.android.com/training/basics/fragments/index.html) 8 | - [Check out the sample (Eclipse project)](http://developer.android.com/shareables/training/FragmentBasics.zip) 9 | 10 | 11 | Try to answer the following questions: 12 | - Why were fragments introduced in Android 3.0/4.0? 13 | - When should you use fragments? 14 | - What is a `FragmentManager`? What is a `FragmentTransaction`? 15 | - How would a `Fragment` communicate with it's host `Activity`? 16 | - Should Fragment A **know** about Fragment B? If not, how would they communicate? 17 | 18 | #### AsyncTasks 19 | Easily manage both background and UI calculations: 20 | - [AsyncTask reference](http://developer.android.com/reference/android/os/AsyncTask.html) 21 | - [AsyncTask tutorial](http://www.vogella.com/tutorials/AndroidBackgroundProcessing/article.html) 22 | - [AsyncTask retain configuration change](http://www.androiddesignpatterns.com/2013/04/retaining-objects-across-config-changes.html) 23 | 24 | Try to answer the following questions: 25 | - How would you implement AsyncTask yourself? 26 | - What would you use AsyncTask for? 27 | - How can an AsyncTask cause a leak? 28 | -------------------------------------------------------------------------------- /week4/agenda.md: -------------------------------------------------------------------------------- 1 | - Framgents instead of complicated ViewGroups 2 | -------------------------------------------------------------------------------- /week5/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /week5/.idea/.name: -------------------------------------------------------------------------------- 1 | ResourcesRecreate -------------------------------------------------------------------------------- /week5/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /week5/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /week5/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /week5/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /week5/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /week5/.idea/inspectionProfiles/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /week5/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Android API 19 Platform 14 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /week5/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /week5/.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /week5/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /week5/1-SwipeGallery/README.md: -------------------------------------------------------------------------------- 1 | #### Swipe Gallery 2 | 3 | ###### Description 4 | Create a horizontal swipe gallery out of the pictures in your external memory. 5 | 6 | ###### Details: 7 | Use a `ViewPager`. It implements the swipe gestures and the transition animations for you. You have to pass it an adapter which implements `FragmentStatePagerAdapter`. 8 | 9 | ###### Hints 10 | - To get your pictures folder use Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) 11 | - Use `FileFilter` to filter the files that are not directories, or maybe images with a specific extension 12 | - Don't forget to add an ID for your `ViewPager` otherwise you will crash and burn 13 | - `ViewPager` is in the support libraries, for details how to get them refer to the Android Developer website or your nearby lecturer 14 | -------------------------------------------------------------------------------- /week5/2-ExpenseList/README.md: -------------------------------------------------------------------------------- 1 | #### Expense List 2 | 3 | ###### Description 4 | ![Cash](http://i.imgur.com/T1p7FJd.png) 5 | 6 | Create an expense manager app. The user has to be able to view, add and delete his expenses. 7 | 8 | ###### Details: 9 | When the delete button is pressed the user should be prompted with a dialog confirming whether he wants to delete the expense. No persistence is required. 10 | 11 | ###### Hints 12 | - Optimize the adapter with reusable views and holder pattern 13 | - Try to set the height of the row to a fixed value, if you fail ask your respective lecturer 14 | 15 | ###### Bonus 16 | - Implement persistence #bipolar 17 | -------------------------------------------------------------------------------- /week5/3-MultipleActivities/README.md: -------------------------------------------------------------------------------- 1 | ### Multiple Activities 2 | ![Imgur](http://i.imgur.com/vSiW47v.png) 3 | 4 | Create google-like multifield: 5 | 6 | The users enter information and chooses what to do with it: 7 | He can make a call, open a web browser, or set the alarm clock. 8 | 9 | Format (using regex notation): 10 | - call: `[0-9\+]{3,20}` (for instance 088512131415) 11 | - open a webpage: `[a-z]+\.[a-z]+(\.[a-z])+` (for instance abv.bg or wearemorons.gov.bg) 12 | - set the alarm: `[0-9][0-9]:[0-9][0-9]` (for instance 05:30) 13 | 14 | Hints and clues (important!): 15 | - If you want to **call**, press the call button and **prepend the user input with `tel:`** 16 | - If you want to **open** a website, **prepend the user input with `https://`** 17 | - You will need a looot of permissions here. 18 | - You will need to search for the relevant intent "action" here. Some of them are **static fields** in `Intent`, but others are not - for instance, see the static field actions in `AlarmClock`... you might need one of them 19 | - Bonus: no more than 50 lines of code for all your `*.java` files 20 | 21 | 22 | -------------------------------------------------------------------------------- /week5/4-Camera2Email/README.md: -------------------------------------------------------------------------------- 1 | ### Camera2Email. 2 | 3 | ![Exam](http://static.guim.co.uk/sys-images/Guardian/Pix/cartoons/2012/6/20/1340194927119/students-taking-exams-008.jpg) 4 | 5 | You are on exam. And it is just starting. Everybody is still shuffling, people are still talking, footstep sounds everywhere. 6 | 7 | You roommate is outside the hall, he doesn't know a thing. 8 | He needs to receive the test, google a few answers first and then get in the exam hall and appologize for being late. 9 | You need to help him. 10 | 11 | Go back in time and create an Android application that: 12 | - When launched, goes **directly** in *Camera* application. 13 | - When a photo is taken, it goes **directly** to *email* application and adds the image as attachment. Email, text, and subject must be **preset**. 14 | - A photo must be taken and send to an email with **no more than 3 user interactions** 15 | - Bonus: **No more than 2 user interaction :)** - use Java Mail API - javax.mail 16 | 17 | Hints: 18 | - See this Android training: http://developer.android.com/training/camera/index.html 19 | 20 | -------------------------------------------------------------------------------- /week5/5-Bonus-Disabled-For-Now/README.md: -------------------------------------------------------------------------------- 1 | ### Flashlight 2 | 3 | ![Flashlight](http://www.geekalerts.com/u/Klarus-XT11-600-Lumen-Tactical-LED-Flashlight.jpg) 4 | 5 | This is really out of the scope of today's session, but some of you may find it interesting. 6 | 7 | Write an application that: 8 | - When entered turns the camera flash `on` 9 | - When exited turns the camera flash `off` 10 | 11 | Hints: 12 | - Use the `Camera` API - See http://www.mkyong.com/android/how-to-turn-onoff-camera-ledflashlight-in-android/ 13 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/.name: -------------------------------------------------------------------------------- 1 | MehADapter -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Android API 19 Platform 14 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/MehADapter.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 19 5 | buildToolsVersion "21.1.1" 6 | 7 | defaultConfig { 8 | applicationId "com.example.georgi.mehadapter" 9 | minSdkVersion 19 10 | targetSdkVersion 21 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | runProguard false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(include: ['*.jar'], dir: 'libs') 24 | compile 'com.android.support:support-v13:20.0.0' 25 | } 26 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/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/georgi/Dev/AndroidStudio/android-studio/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 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/androidTest/java/com/example/georgi/mehadapter/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.mehadapter; 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 | } -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/java/com/example/georgi/mehadapter/Contact.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.mehadapter; 2 | 3 | /** 4 | * Created by georgi on 11/19/14. 5 | */ 6 | public class Contact { 7 | private final String name; 8 | 9 | private final String number; 10 | 11 | private final long id; 12 | 13 | public Contact(String name, String number, long id) { 14 | this.name = name; 15 | this.number = number; 16 | this.id = id; 17 | } 18 | 19 | public String getName() { 20 | return name; 21 | } 22 | 23 | public String getNumber() { 24 | return number; 25 | } 26 | 27 | public long getId() { 28 | return id; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/java/com/example/georgi/mehadapter/MyActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.mehadapter; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.os.Environment; 6 | import android.view.LayoutInflater; 7 | import android.view.Menu; 8 | import android.view.MenuItem; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.BaseAdapter; 12 | import android.widget.LinearLayout; 13 | import android.widget.ListView; 14 | import android.widget.TextView; 15 | 16 | import java.io.File; 17 | import java.io.FilenameFilter; 18 | import java.util.ArrayList; 19 | import java.util.List; 20 | 21 | 22 | public class MyActivity extends Activity { 23 | private IvoAdapter baseAdapter; 24 | 25 | @Override 26 | protected void onCreate(Bundle savedInstanceState) { 27 | super.onCreate(savedInstanceState); 28 | setContentView(R.layout.activity_my); 29 | 30 | 31 | baseAdapter = new IvoAdapter(); 32 | 33 | ListView listView = (ListView) findViewById(R.id.list_view); 34 | listView.setAdapter(baseAdapter); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Adapter-Scribbles/MehADapter/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Adapter-Scribbles/MehADapter/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Adapter-Scribbles/MehADapter/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Adapter-Scribbles/MehADapter/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/layout/activity_my.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/layout/linear_layout.xml: -------------------------------------------------------------------------------- 1 | 12 | 13 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/menu/my.xml: -------------------------------------------------------------------------------- 1 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | MehADapter 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/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:0.12.2' 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 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/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 -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Adapter-Scribbles/MehADapter/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip 7 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/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 | -------------------------------------------------------------------------------- /week5/Adapter-Scribbles/MehADapter/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/ResourcesRecreate.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/agenda.md: -------------------------------------------------------------------------------- 1 | - ListView and AdapterView 2 | - Adapters as a concept, as a "Man in the middle" 3 | - Important methods: 4 | - - getView 5 | - - getCount 6 | - - notifyDataSetChanged 7 | 8 | - [Adapter hierarchy](http://cdn.intertech.com/Blog/wp-content/uploads/2014/06/HeirarchyOfAdapter.png) 9 | - [AdapterView hierarchy](http://cdn.intertech.com/Blog/wp-content/uploads/2014/06/AdapterViewHierarchy-480x396.png) 10 | 11 | - Convert view, recycling 12 | - Borko, show them this picture! http://www.edureka.in/blog/wp-content/uploads/2013/03/adapters1.jpg 13 | - http://www.edureka.co/blog/wp-content/uploads/2013/03/adapters.jpg 14 | - ViewPager 15 | - PagerADapter 16 | - Bootstrap: Show them how to show "A,B,C" using list view and ArrayAdapter 17 | - Bootstrap: show them how to get the files from the public `Pictures` folder 18 | 19 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 21 5 | buildToolsVersion "21.1.1" 6 | 7 | defaultConfig { 8 | applicationId "com.example.georgi.resourcesrecreate" 9 | minSdkVersion 19 10 | targetSdkVersion 21 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | runProguard 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.google.android.gms:play-services:6.1.11' 25 | compile 'com.android.support:appcompat-v7:21.+' 26 | } 27 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/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/georgi/Dev/AndroidStudio/android-studio/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 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/androidTest/java/com/example/georgi/resourcesrecreate/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.resourcesrecreate; 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 | } -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/java/com/example/georgi/resourcesrecreate/AppContext.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.resourcesrecreate; 2 | 3 | import android.app.Application; 4 | 5 | /** 6 | * Created by georgi on 11/22/14. 7 | */ 8 | public class AppContext extends Application{ 9 | private Object bluetoothGlobalListener; 10 | 11 | @Override 12 | public Object getSystemService(String name) { 13 | if (name.equals("BluetoothGlobalListtener")){ 14 | if (bluetoothGlobalListener == null){ 15 | bluetoothGlobalListener = new Object(); 16 | } 17 | return bluetoothGlobalListener; 18 | } 19 | return super.getSystemService(name); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/java/com/example/georgi/resourcesrecreate/MyActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.resourcesrecreate; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Bundle; 6 | import android.provider.MediaStore; 7 | import android.view.Menu; 8 | import android.view.MenuItem; 9 | 10 | import java.util.ArrayList; 11 | 12 | 13 | public class MyActivity extends Activity { 14 | 15 | private Intent result; 16 | 17 | @Override 18 | protected void onCreate(Bundle savedInstanceState) { 19 | super.onCreate(savedInstanceState); 20 | Intent getToMyOtherActivity = new Intent(this, LoginActivity.class); 21 | startActivity(getToMyOtherActivity); 22 | finish(); 23 | 24 | // setContentView(R.layout.activity_my); 25 | // 26 | // Intent i = new Intent(); 27 | // i.setType("text/plain"); 28 | // 29 | // 30 | // i.setClass("com.example.georgi.resourcesRecreate", MyOtherActivity.class); 31 | // i.setAction(MediaStore.ACTION_IMAGE_CAPTURE); 32 | //// i.setData(Uri.parse("mailto:ch_bg@abv.bg")); 33 | // i.putExtra(Intent.EXTRA_SUBJECT, "meh"); 34 | // i.putExtra(Intent.EXTRA_EMAIL, new String[] { "ch_bg@abv.bg" }); 35 | 36 | startActivity(i); 37 | 38 | int requestCode = 0xBABE; 39 | startActivityForResult(i, requestCode); 40 | 41 | getIntent().getStringExtra("photoLocation"); 42 | 43 | setResult(RESULT_OK, new Intent()); 44 | finish(); 45 | } 46 | 47 | @Override 48 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 49 | super.onActivityResult(requestCode, resultCode, data); 50 | 51 | switch (requestCode){ 52 | case 0xBABE: 53 | break; 54 | } 55 | 56 | } 57 | 58 | @Override 59 | protected void onSaveInstanceState(Bundle outState) { 60 | outState.putStringArrayList("contacts", new ArrayList()); 61 | super.onSaveInstanceState(outState); 62 | } 63 | 64 | 65 | @Override 66 | public boolean onCreateOptionsMenu(Menu menu) { 67 | // Inflate the menu; this adds items to the action bar if it is present. 68 | getMenuInflater().inflate(R.menu.my, menu); 69 | return true; 70 | } 71 | 72 | @Override 73 | public boolean onOptionsItemSelected(MenuItem item) { 74 | // Handle action bar item clicks here. The action bar will 75 | // automatically handle clicks on the Home/Up button, so long 76 | // as you specify a parent activity in AndroidManifest.xml. 77 | int id = item.getItemId(); 78 | if (id == R.id.action_settings) { 79 | return true; 80 | } 81 | return super.onOptionsItemSelected(item); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Intent-Scribbles/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Intent-Scribbles/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Intent-Scribbles/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Intent-Scribbles/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/layout-land/activity_my.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/layout/activity_my.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/menu/my.xml: -------------------------------------------------------------------------------- 1 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ResourcesRecreate 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/values/strings_activity_login.xml: -------------------------------------------------------------------------------- 1 | 2 | Sign in 3 | 4 | 5 | Email 6 | Password (optional) 7 | Sign in or register 8 | Sign in 9 | Switch Google+ account 10 | Disconnect from Google+ 11 | This email address is invalid 12 | This password is too short 13 | This password is incorrect 14 | This field is required 15 | 16 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/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:0.12.2' 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 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/build/intermediates/model_data.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Intent-Scribbles/build/intermediates/model_data.bin -------------------------------------------------------------------------------- /week5/Intent-Scribbles/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 -------------------------------------------------------------------------------- /week5/Intent-Scribbles/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week5/Intent-Scribbles/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /week5/Intent-Scribbles/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip 7 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/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 | -------------------------------------------------------------------------------- /week5/Intent-Scribbles/local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file should *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | sdk.dir=/home/georgi/Dev/AndroidStudio/android-studio/sdk -------------------------------------------------------------------------------- /week5/Intent-Scribbles/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /week5/README.md: -------------------------------------------------------------------------------- 1 | ### ListViews, Adapters and ViewPager ### 2 | 3 | ##### ListView and adapter- guide and example 4 | http://developer.android.com/guide/topics/ui/layout/listview.html 5 | (The example here accesses and shows all the contacts - neat, huh?) 6 | 7 | (More basic example here - http://androidexample.com/Create_A_Simple_Listview_-_Android_Example/index.php?view=article_discription&aid=65&aaid=90 ) 8 | 9 | (Even more basic example here - http://www.java-samples.com/showtutorial.php?tutorialid=1516 ) 10 | 11 | 12 | 13 | ##### Adapters, ConvertView, recycling 14 | https://www.youtube.com/watch?v=N6YdwzAvwOA - The first 11 minutes 15 | 16 | 17 | 18 | ##### ViewPager reference 19 | http://developer.android.com/reference/android/support/v4/view/ViewPager.html 20 | [What visually ViewPager looks like](http://developer.android.com/training/animation/screen-slide.html) 21 | 22 | 23 | 24 | ##### Try to answer the following questions: 25 | - You make a `getRegisteredUsers()` API call to your website. It will return a `List` - all the users regsitered. You don't know in advance how many are they. How would you visualize them? 26 | - How do `ListView`'s work on Android? Why can we scroll down and down and down through thousands of records (e.g. check your call logs) without any hiccup or gargabe collection? How does this happen? 27 | - What is the purpose of the `getView(...)` method in Android? Why does it return a `View`. Do we need this method? Can't we just return `null`? 28 | - Why makes Android's adapters like a "Man in the middle"? 29 | - What is is a `convertView`? Why should we care about `convertView`? 30 | - What is `ViewPager` usually used for? 31 | 32 | 33 | ### Rotation, Intents, Multiple Activities, ApplicationContext 34 | 35 | [All you need to know about configuration changes in Android (rotation)](http://developer.android.com/guide/topics/resources/runtime-changes.html) 36 | - What would you use `onSaveInstanceState` for? 37 | - When should you override `onConfigurationChanged`? 38 | 39 | [What is a "configuration change"?](http://developer.android.com/guide/topics/manifest/activity-element.html#config) 40 | - Why is it called `onConfigurationChanged` instead of just `onDeviceRotated`? 41 | 42 | [What is an intent?](http://developer.android.com/reference/android/content/Intent.html) 43 | - What is the differnce between `action` and `data` (as Intent members)? 44 | - What is an **Intent Resolution**? 45 | - Write down some example `ACTION`'s provided by the Android system 46 | 47 | [On Activities](http://developer.android.com/guide/components/activities.html) 48 | - How can you start another activity? 49 | - When would `onActivityResult` be called? What does the `startActivityForResult` method mean? 50 | 51 | [On ApplicationContext](http://developer.android.com/reference/android/app/Application.html) (not the Spring one :D ) 52 | - What is this used for? 53 | - Try to figure out a use case where you will need an ApplicationContext 54 | -------------------------------------------------------------------------------- /week6/1-FileDownloader/README.md: -------------------------------------------------------------------------------- 1 | #### Download manager 2 | 3 | ###### Description 4 | Create a file download manager. 5 | 6 | ###### Details: 7 | There is a file listing here: http://95.111.103.224:8080/static/ .Create a button for every file you want to be able to download. When the user clicks the button, start a service that downloads the file at a specified path in the external storage directory. I know some of you are rolling their eyes right now thinking "pff...casuals", so if you really feel like creating a dynamic list filled with the contents of this directory, then by all means do. 8 | 9 | ###### Hints 10 | - Don't bother extending a `Service`, use `IntentService` instead 11 | - Register a `BroadcastReceiver` in `onResume` and unregister it in `onPause` 12 | 13 | ###### Bonus 14 | - Create a progress report bar 15 | - Send a notification for every file download -------------------------------------------------------------------------------- /week6/2-ListAllDevices/README.md: -------------------------------------------------------------------------------- 1 | #### Bluetooth Hello World (BroadcastReceiver) 2 | 3 | ![Imgur](http://i.imgur.com/A3ZmSMh.png) 4 | 5 | This task is not an idiomatic service/broadcast one, but we thought you might want to check out the Bluetooth API. Also, you need to use a `BroadcastReceiver`. Bottom line => do the other task first! 6 | 7 | We want you to list all available (and **visible**) Bluetooth devices in HackBulgaria's rooms : ) and display them in a `ListView`. Once more, we don't care about styling, glossiness and stuff - use the most common styles `TextView`'s if you have to. 8 | 9 | 10 | Here is how to do it: 11 | - Obtain a `BluetoothAdapter` via `BluetoothAdapter.getDefaultAdapter()` 12 | - Register a `BroadcastReceiver` for the action `BluetoothDevice.ACTION_FOUND` 13 | - Whenever your `BroadcastReceiver` gets called, just add the device and it's name to the `ListView`'s `Adapter` (You can get the device from the intent like this ` BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);`) 14 | - Make sure you have your Bluetooth turned **on**, and **your device is visible**. 15 | 16 | -------------------------------------------------------------------------------- /week6/3-SplashScreen/README.md: -------------------------------------------------------------------------------- 1 | ### Splash Screen 2 | Show a simple splash screen on the first run. 3 | 4 | Here is what should happen: 5 | The user: 6 | - Enters your application. 7 | - Sees your splash screen for exactly **3 seconds** (Ahem, `handler.postDelayed`) 8 | - After 3 seconds have passed, your splash screen is removed and the user sees the default and awesome "Hello world" ui that your applicaion has! 9 | 10 | Choose one of the available below, or whatever .png you'd like. 11 | Using `SharedPreferences`, show the splash screen only the **first** time! 12 | 13 | ![Splash_screen_one](https://raw.githubusercontent.com/HackBulgaria/Android-1/master/week6/3-SplashScreen/Splash_Screen.png) 14 | ![Splash_screen_two](https://raw.githubusercontent.com/HackBulgaria/Android-1/master/week6/3-SplashScreen/Splash_Screen_2.png) 15 | ![Splash_screen_three](https://raw.githubusercontent.com/HackBulgaria/Android-1/master/week6/3-SplashScreen/Splash_Screen_3.png) 16 | 17 | Hints: 18 | - Use dark theme for the application - dark logos are good with dark themes 19 | - Use `getViewOverlay.add..` to implement the splash screen 20 | Oh and the way, force your app in landscape, so you'd be able to more properly show the splashscreens :D 21 | -------------------------------------------------------------------------------- /week6/3-SplashScreen/Splash_Screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week6/3-SplashScreen/Splash_Screen.png -------------------------------------------------------------------------------- /week6/3-SplashScreen/Splash_Screen_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week6/3-SplashScreen/Splash_Screen_2.png -------------------------------------------------------------------------------- /week6/3-SplashScreen/Splash_Screen_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week6/3-SplashScreen/Splash_Screen_3.png -------------------------------------------------------------------------------- /week6/4-FileBrowser/README.md: -------------------------------------------------------------------------------- 1 | ### File Browser 2 | 3 | Write a quick, but complete File Browser application in Android. 4 | 5 | ![shot](https://raw.githubusercontent.com/HackBulgaria/Android-1/master/week6/4-FileBrowser/shot.png) 6 | 7 | Feature set: 8 | - Starts at `Environment.getExternalStorageDirectory()` 9 | - Folders are listed in yellow color 10 | - Files are listed in white color. 11 | - If a folder is clicked, you "enter" in the folder and immediately display all of it's children in the list, forgetting about the previous ones. 12 | - If a file is clicked, the file gets opened - if it is an image, a Gallery is launched, if it is mp3/mp4, a player gets launched and etc. 13 | - - It is absolutely forbidden to write `switch(fileType)` of any case in order to guess what program to launch. Use: 14 | ``` java 15 | Intent intent = new Intent(); 16 | intent.setAction(Intent.ACTION_VIEW); 17 | MimeTypeMap map = MimeTypeMap.getSingleton(); 18 | String ext = MimeTypeMap.getFileExtensionFromUrl(files[position].getName()); 19 | String type = map.getMimeTypeFromExtension(ext); 20 | 21 | if (type == null) { 22 | type = "*/*"; 23 | } 24 | 25 | Uri data = Uri.fromFile(fileThatUserClickedOn); 26 | 27 | intent.setDataAndType(data, type); 28 | ``` 29 | ^^ start an activity with the above intent and the Android System will do all the magic of guessing what to launch. 30 | - When user presses **the back button**, you should go "back" to the parent of the currently viewed folder 31 | - When the user presses **the back button and the file browser is in the root directory** - `Environment.getExternalStorageDirectory()` - exit the application 32 | - Be careful with the adapter for folders with a lot of files : ) 33 | 34 | 35 | -------------------------------------------------------------------------------- /week6/4-FileBrowser/shot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week6/4-FileBrowser/shot.png -------------------------------------------------------------------------------- /week6/README.md: -------------------------------------------------------------------------------- 1 | ### Services and BroadcastReceiver ### 2 | 3 | ##### Services 4 | [Theory](http://developer.android.com/guide/components/services.html) 5 | [Tutorial](http://code.tutsplus.com/tutorials/android-fundamentals-intentservice-basics--mobile-6183) 6 | 7 | ##### BroadcastReceiver 8 | [Theory](http://developer.android.com/reference/android/content/BroadcastReceiver.html) 9 | [Tutorial](http://www.vogella.com/tutorials/AndroidBroadcastReceiver/article.html) 10 | 11 | -------------------------------------- 12 | ##### SharedPreferences and Data storage 13 | [Android's guide on Data Storage](http://developer.android.com/guide/topics/data/data-storage.html#pref) 14 | - Explain the difference between `MODE_PRIVATE`, `MODE_WORLD_READABLE` and `MODE_WORLD_WRITEABLE` to a yellow rubber duck named George. 15 | - What exactly is a `cacheDir` in Android? 16 | - Is it okay if your application crashes when the user pull out his sdcard? 17 | - What is the difference between `getDir` and `Environment.getExternalStorageDirectory(String type)`? 18 | - Try to explain the changes to external storage reading/writing from Android 4.4 to an orange friendly teddy-bear named Frank. 19 | - When would you use `SharedPreferences` and when would you prefer to use the file system? 20 | 21 | -------------------------------------------------------------------------------- /week6/agenda.md: -------------------------------------------------------------------------------- 1 | - Broadcast Receivers 2 | - - "subscribers" 3 | - - link between `IntentFilter` and `BroadcastReceiver` 4 | - - usually registered in `onResume` and unregistered in `onPause` => lead to a memory leak otherwise 5 | 6 | - Services 7 | - - `onStartCommand()` vs `onBind()` 8 | - - Service (when not bound) should stop itself!!! 9 | - - Bound services - automatically stopped 10 | - - `Service` vs `IntentService` 11 | - - `Services`s launch on the UI thread! 12 | - - `IntentService` has its own thread 13 | - - `BroadcastReceiver` for communication 14 | 15 | -------------------------------------------------------------------------------- /week7/.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Log Files 26 | *.log -------------------------------------------------------------------------------- /week7/.idea/.name: -------------------------------------------------------------------------------- 1 | ListBluetoothDevices -------------------------------------------------------------------------------- /week7/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /week7/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /week7/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /week7/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /week7/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /week7/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /week7/.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /week7/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /week7/1-ExpenseList/README.md: -------------------------------------------------------------------------------- 1 | #### Expense List with persistence 2 | 3 | ###### Description 4 | ![Cash](http://i.imgur.com/T1p7FJd.png) 5 | 6 | Build on the task from week 5. Add a SQLite persistence layer. 7 | 8 | ###### Details: 9 | You should support `getExpenses`, `addExpense` and `deleteExpense` API calls. 10 | 11 | ###### Hints 12 | - Checkout the tutorials from the prereading materials 13 | - Don't forget to do the calls to the database asynchronously 14 | 15 | ###### Bonus 16 | - Add an `updateExpense` API and use it 17 | -------------------------------------------------------------------------------- /week7/2-SensorFun/README.md: -------------------------------------------------------------------------------- 1 | ### Star Wars Gun 2 | ![gun](http://img4.wikia.nocookie.net/__cb20070424173851/starwars/images/a/af/GunOfCommand.jpg) 3 | Using the acceleration sensor, detect when the user has applied more force than `CONST`. 4 | Whenever this happens, play a sound - `ray_gun.mp3` or one of your choosing 5 | 6 | Note: `CONST` might be different for every device. 7 | 8 | ### Detect when something is near 9 | ![woman](https://chewychunks.files.wordpress.com/2010/10/frightened-woman-x11687653.jpg) 10 | Using the proximity sensor, make the phone play something scary when something is very close to the phone - for instance... the user's ear :) 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /week7/2-SensorFun/hell.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week7/2-SensorFun/hell.mp3 -------------------------------------------------------------------------------- /week7/2-SensorFun/ray_gun.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week7/2-SensorFun/ray_gun.mp3 -------------------------------------------------------------------------------- /week7/2-SensorFun/roar.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week7/2-SensorFun/roar.mp3 -------------------------------------------------------------------------------- /week7/README.md: -------------------------------------------------------------------------------- 1 | ### Using SQlite 2 | ![Sqlite](http://logonoid.com/images/sqlite-logo.png) 3 | 4 | [Using SQlite in Android](http://developer.android.com/guide/topics/data/data-storage.html#db) 5 | [SQlite cheatsheet](http://www.natontesting.com/2008/02/09/sqlite3-cheat-sheet/) 6 | [Debugging SQlite](http://developer.android.com/tools/help/adb.html#sqlite) 7 | [Saving Data in SQlite](http://developer.android.com/training/basics/data-storage/databases.html) 8 | 9 | Questions to think about: 10 | - How ugly is the database API in Android from 1 to 10? 11 | - Why have Google picked SQLite as a database in Android? 12 | - How much "safer" do you feel from SQL injections, now that you've witnessed some examples of the DB layer? 13 | - Why do you think so many years later on and we still don't have a nice [Fluent Interface](http://en.wikipedia.org/wiki/Fluent_interface) in Android? 14 | - Explain the difference between PHP's `mysql_query(...random_string...)` approach and `db.execQuery(...randomString...)` in Android 15 | 16 | ------------------------ 17 | ### Sensors API 18 | - Read the Sensors guide here 19 | http://developer.android.com/guide/topics/sensors/sensors_overview.html 20 | 21 | 22 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/.name: -------------------------------------------------------------------------------- 1 | SQLiteExample -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Android API 19 Platform 14 | 15 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /week7/SQLiteExample/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /week7/SQLiteExample/SQLiteExample.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 21 5 | buildToolsVersion "21.1.1" 6 | 7 | defaultConfig { 8 | applicationId "com.example.georgi.sqliteexample" 9 | minSdkVersion 19 10 | targetSdkVersion 21 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | runProguard false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | } 25 | -------------------------------------------------------------------------------- /week7/SQLiteExample/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/georgi/Dev/AndroidStudio/android-studio/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 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/androidTest/java/com/example/georgi/sqliteexample/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.sqliteexample; 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 | } -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/java/com/example/georgi/sqliteexample/FluentApiBuilder.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.sqliteexample; 2 | 3 | /** 4 | * Created by georgi on 12/3/14. 5 | */ 6 | public class FluentApiBuilder { 7 | public FluentApiBuilder(){ 8 | 9 | String string = new FluentApiBuilder().selectFrom("users").where("username").eq("213").build(); 10 | } 11 | 12 | public FluentApiBuilder selectFrom(String tableName){ 13 | this.tableName = tableName; 14 | return this; 15 | } 16 | 17 | 18 | } 19 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/java/com/example/georgi/sqliteexample/Losers.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.sqliteexample; 2 | 3 | import android.util.SparseArray; 4 | 5 | /** 6 | * Created by georgi on 12/3/14. 7 | */ 8 | public class Losers { 9 | public static final String TABLE_NAME = Losers.class.getSimpleName(); 10 | public enum TABLE { 11 | ID, LOSERNAME 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/java/com/example/georgi/sqliteexample/MyActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.georgi.sqliteexample; 2 | 3 | import android.app.Activity; 4 | import android.content.ContentValues; 5 | import android.database.Cursor; 6 | import android.database.sqlite.SQLiteDatabase; 7 | import android.database.sqlite.SQLiteOpenHelper; 8 | import android.database.sqlite.SQLiteQueryBuilder; 9 | import android.os.Bundle; 10 | import android.view.Menu; 11 | import android.view.MenuItem; 12 | import android.view.View; 13 | 14 | 15 | public class MyActivity extends Activity { 16 | 17 | private SQLiteDatabase database; 18 | 19 | @Override 20 | protected void onCreate(Bundle savedInstanceState) { 21 | super.onCreate(savedInstanceState); 22 | setContentView(R.layout.activity_my); 23 | MehSQLiteHelper sqLiteHelper = new MehSQLiteHelper(); 24 | database = sqLiteHelper.getWritableDatabase(); 25 | 26 | ContentValues contentValues = new ContentValues(); 27 | contentValues.put(Losers.TABLE.LOSERNAME.toString(), "gosho"); 28 | database.insert(Losers.TABLE_NAME, null, contentValues); 29 | int position = 5; 30 | database.delete(Losers.TABLE_NAME, "id = ? AND ", new String[]{position + ""}); 31 | 32 | Cursor c = database.rawQuery("SELECT ?,? FROM LOSERS;", new String[]{"LOSERNAME", "ID"}); 33 | while (c.moveToNext()) { 34 | String losername = c.getString(Losers.TABLE.LOSERNAME.ordinal()); 35 | int id = c.getInt(Losers.TABLE.ID.ordinal()); 36 | 37 | } 38 | 39 | c.close(); 40 | //DELETE FROM LOSERS; 41 | //(boolean distinct, String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit) 42 | database.query(true,Losers.TABLE_NAME, null, "ID = ?", new String[] {3 + ""}, null, null, null, null ); 43 | SQLiteQueryBuilder builder = new SQLiteQueryBuilder(); 44 | contentValues.put(Losers.TABLE.LOSERNAME.toString(), "lucho"); 45 | database.update(Losers.TABLE_NAME, contentValues, "id = ?", new String[] {3 + ""}); 46 | new View(MyActivity.this).animate().x(500).y(600).start(); 47 | } 48 | 49 | private class MehSQLiteHelper extends SQLiteOpenHelper { 50 | 51 | private static final String DB_NAME = "meh"; 52 | 53 | public MehSQLiteHelper() { 54 | super(MyActivity.this, DB_NAME, null, 0); 55 | } 56 | 57 | @Override 58 | public void onCreate(SQLiteDatabase sqLiteDatabase) { 59 | sqLiteDatabase.execSQL( 60 | "CREATE TABLE " + Losers.TABLE_NAME + 61 | " ( " + Losers.TABLE.ID + " integer auto_increment primary key, " 62 | + Losers.TABLE.LOSERNAME + " text " + " )"); 63 | } 64 | 65 | @Override 66 | public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i2) { 67 | sqLiteDatabase.execSQL("DROP DATABASE IF EXIST " + DB_NAME); 68 | onCreate(sqLiteDatabase); 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week7/SQLiteExample/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week7/SQLiteExample/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week7/SQLiteExample/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week7/SQLiteExample/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/layout/activity_my.xml: -------------------------------------------------------------------------------- 1 | 10 | 11 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/menu/my.xml: -------------------------------------------------------------------------------- 1 | 4 | 8 | 9 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | SQLiteExample 5 | Hello world! 6 | Settings 7 | 8 | 9 | -------------------------------------------------------------------------------- /week7/SQLiteExample/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /week7/SQLiteExample/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:0.12.2' 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 | -------------------------------------------------------------------------------- /week7/SQLiteExample/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 -------------------------------------------------------------------------------- /week7/SQLiteExample/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HackBulgaria/Android-1/9ae44683363673ba5896ec467d0c4997a7df6009/week7/SQLiteExample/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /week7/SQLiteExample/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Wed Apr 10 15:27:10 PDT 2013 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip 7 | -------------------------------------------------------------------------------- /week7/SQLiteExample/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 | -------------------------------------------------------------------------------- /week7/SQLiteExample/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /week7/agenda.md: -------------------------------------------------------------------------------- 1 | - SQLite 2 | - - Open source 3 | - - SMALL memory requirement. Your apps have ~64 megs available (*used to have*). That is the nubmer one reason for choosing SQlite. 4 | - - Default DB location is DATA/data/APP_NAME/databases/FILENAME 5 | - - Hate and flame 6 | 7 | - Sensors 8 | - - Sensor API: => `SensorManager`, `SensorEventListener`, `onSensorChanged` 9 | - - gravity/acceleration 10 | - - axises 11 | - - proximity sensor 12 | - - acceleration => force application sensor 13 | 14 | --------------------------------------------------------------------------------