Shenkar
Amir Uval
- Android Developers YouTube Channel
- DevBites short videos
- Markdown The syntax used for this README.md file
Install Android SDK's
Recommended Plugins:
- .ignore
- Markdown Support (JetBrain)
- Grep Console
Useful Android Studio shortcuts: (And More Shortcuts)
Operation | Shortcut |
---|---|
Comment line | Ctrl+/ |
Duplicate line (or selection) | ctrl+d |
Go to last edited location | ctrl+shift+Backspace |
Jump to a particular type or file | Shift, Shift |
Move lines up or down | ctrl+shift+up or ctrl+shift+down arrow |
Navigate left | Alt+Left arrow (Mac: Command+Shift+[) |
Navigate right | Alt+right arrow (Mac: Command+Shift+]) |
Navigate to the source definition | Windows+Click (Linux: ctrl+click, Mac: Command+click) |
Open Settings | ctrl+alt+s |
Organize the import statements | Ctrl+Alt+O |
Reformat file | alt+ctrl+shit+L |
Rename an object | Shift+F6 |
Search through files | Ctrl+Shift+F (Mac: Command+Shift+F) |
Tips:
- Use middle button of the mouse to select across rows, and edit all.
Homework: Create a project in Android studio and upload it to your GitHub account.
Useful git commands:
- git status
- git log
- git show: Show various types of objects
- git tag: tag specific points in history as being important
- for example, these commits were tagged with annotation and comment:
- git tag -a 2 -m "lecture #2"
- git tag -a 2.1 -m "lecture #2.1"
- you can now jump between them using:
- git checkout 2 (..or 2.1)
- you can see the diff between 2 tags (or between branches) by adding
/compare
to the end of the github workspace URL.
- for example, these commits were tagged with annotation and comment:
- git add .
- adds all un-staged files to your local git index
####class exercise
- Make main menu for exercises
- Refactoring: rename MainActivity and related layout to Lesson2Activity and lesson2_layout
- Create a new MainActivity to serve as a high level menu for exercises
- Mark the new activity as MAIN in the manifest
- Adding action bar
- Adding settings
- Simply create a new "Settings Activity" from the
new > activity
command menu.
- Simply create a new "Settings Activity" from the
- Enabling "< Back" from settings
- By overriding
onOptionsItemSelected()
- By overriding
- Showing how to read values from SharedPreferences
- And using AsyncHandler and UiHandler on the way
- Showing how to write values to SharedPreferences from code
- Added SQL implementation and example
adb -s emulator-5554 shell 'cat /data/data/org.shenkar.auval.codesamples/shared_prefs/org.shenkar.auval.codesamples_preferences.xml'
-
clone this workspace to your local pc
- file -> new -> Project from version control -> GitHub
- paste https://github.com/auval/AndroidWorkshop.git
- define local directory for the workspace
- clone
-
creating App Toolbar activity
- Follow the tutorial
- It's missing some important steps, so read here as well.
- create an svg resource icon
- New > “Vector Asset” from the context menu
- define some menu options
- New > “Android resource directory” from the context menu
- Change the “Resource type” drop-down to be “menu”, then click OK to create the directory
- right-click over your new res/menu/ directory and choose New > “Menu resource file” from the context menu
- name it "lesson3.xml"
- add <item> resources, like the example in the tutorial or your own.
- Add
onCreateOptionsMenu(Menu menu) {}
to the activity, to inflate menu items
- Follow the tutorial
-
Settings walkthrough Every student implements on his/her pc during class.
- the resulting project - use this as a reference!
-
Scene transition
- example: SceneTransitionActivity
- diff
RecyclerView, Scene Transitions, Low Level Graphics
-
RecycleView (few words only + reference to code)
-
Low level graphics and animation
-
A lesson on Resources by Chaim Michael (with his permission)
Custom View Animation
Lots of examples:
- Animated view (rotating dot): MyAnimatedGraphicsView
- Animated view (rotating dot on offscreen Bitmap): MyBitmapAnimatedGraphicsView
- SpriteAnimationActivity
just puts a custom ViewGroup on the screen.
- Notice that instead of ConstraintsLayout as root in the xml I use SpriteAnimationView. custom ViewGroup.
- The animation happens in SpriteAnimationView
- SvgViewsActivity demonstrates using SVG as a background image,
and 4 svgs as frames for animation-list drawable.
- The drawable is set as src of ImageView, and started from the Activity.
- When touching a butterfly, it will fly elsewhere, using Scene Transition. This may be a useful reference for building your own game.
- Notice that this activity has fixed orientation set in AndroidManifest.xml.
- BmpAndSvgActivity is not animated. It demonstrates combining
simple Bitmap as a background and an SVG as a
srcCompat drawable of a view.
- Notice how the svg doesn't lose quality when scaled up or down.
- On the upper right corner there's a cool (but complex) hack: I took the SVG parsing code from the support library, and here I demonstrate how I turned a raw SVG to a Path object that Canvas can draw directly.
Note regarding working on the project: You should learn this method on how to collaborate using GitHub. Both students must contribute.
Sound & Music
- Help with projects
- Testing
- Firebase Analytics
- Building APK for production
testing from command line: gradlew test
####Download Project apk
####All the lessons slides
- Lesson #1: https://goo.gl/j8laap
- Lesson #2: https://goo.gl/4EHTQi
- Lesson #3: https://goo.gl/P2hWLP
- Lesson #4: https://goo.gl/CXtCcy
- Lesson #5: https://goo.gl/gVRMt2
- Homework Review Settings of activity transition
- Lesson #6: https://goo.gl/hY7ALc
- Homework Review Low level graphics: Stretched Hello
- Lesson #7: https://goo.gl/adGjJf
- Lesson #8: https://goo.gl/d8mepK
- Lesson #9: https://goo.gl/ekn88F
- Lesson #10: https://goo.gl/W8wHJx