Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 2 agenda flip teaching install p4merge rename project packages review git review Android Studio (Vinny) layouts and resources java event model.

Similar presentations


Presentation on theme: "Lecture 2 agenda flip teaching install p4merge rename project packages review git review Android Studio (Vinny) layouts and resources java event model."— Presentation transcript:

1 Lecture 2 agenda flip teaching install p4merge rename project packages review git review Android Studio (Vinny) layouts and resources java event model labGeoQuizz chapters 1-3

2 flipping the classroom explained http://en.wikipedia.org/wiki/Flip_teaching Flip teaching (or flipped classroom) is a form of blended learning in which students watch lectures online and work on problem sets with other students in class. This approach allows teachers to spend more time interacting with students instead of lecturing. This is also known as backwards classroom, reverse instruction, flipping the classroom and reverse teaching

3 Installing an external diff/merge tool: http://www.perforce.com/downloads/Perforce- Software-Version-Management/complete_list/Customer http://www.perforce.com/downloads/ click on Software Version Managment click on Customer Downloads p4Merge + Mac: SourceTree || Preferences || Diff || P4Merge

4 Open each project and rename your package from jstudent to first-initial-last-name Then push your changes.

5 GIT architecture

6 git config --global user.name "Your Name" git config --global user.email "your_email@whatever.com"

7 add/reset/commit: move files from working-dir to stage-dir(aka index) git add. git add res/. git add src/. git add res/values/strings.xml move files from stage-dir(aka index) to working-dir git reset HEAD. git reset head res/. git reset head src/. git reset head res/values/strings.xml git commit -m “your commit message.”

8 Reverting (does the exact opposite) git revert 0da8 --no-edit git revert head --no-edit git revert head~3 --no-edit To clear all local changes since last push git reset --hard origin/master To delete a remote branch git push origin :branchName

9 Amending: Every commit is associated with a sha-1 hash. That hash is derived from 1/ the file changes in that commit and 2/ the previous commit. You can not change any commit unless that commit is at the head. Since no other commits depend on the head, you may safely change the head. To change the head, use git commit --amend -m “your message” git commit --amend --no-edit

10 Branching: To list the branches in a project: git branch git branch -r git branch --all To create a branch: git checkout -b branchName c39b git checkout -b branchName To delete a branch: git branch -D branchName To checkout a branch: git checkout 7afe git checkout master

11 Pushing to remotes: To see the remotes: git remote -v show To push to a remote: git push origin master git push --all To clear all local changes since last push git reset --hard origin/master

12 Android Studio Default keymap: http://android.cs.uchicago.edu/content/slides/keymap.pdf File || settings || keymap

13 Java Review

14 Class Objects

15

16 Spot the “class” here

17 Java Primitives (integers) TypeSigned?BitsBytesLowestHighest bytesigned81 -2 7 -128 2 7 -1 +127 shortsigned162 -2 15 -32,768 2 15 -1 32,767 intsigned324 -2 31 -2,147,483,648 2 31 -1 2,147,483,647 longsigned648 -2 63 -9, 223,372,036,854,775,808 2 63 -1 9,223,372,036,85 4,775,807

18 How Java Stores positive Integers -2 (bits -1) to 2 (bits -1) – 1 0001 0011 The above is a binary representation of the number 19 stored in a byte (8 bits). The range of a byte is: -128 to 127.

19 TypeSigned?BitsBytesLowestHighest booleann/a11falsetrue char unsigned Unicode 162 0 '\u0000' 2 16 -1 '\uffff' float signed exponent and mantissa 324 ±1.40129846432 481707e-45 ±3.40282346638 528860e+38 with 6 to 7 significant digits of accuracy. double signed exponent and mantissa 648 ±4.94065645841 246544e-324 ±1.79769313486 231570e+308 with 14 to 15 significant digits of accuracy. Java Primitives (others)

20 Primitives versus Objects memory PrimitivesObjects Variables store values and are allocated memory depending on their type. How much?...refer to Java Primitives slide. References store memory addresses. The size of the allocation for the object reference is VM specific, but is usually the native pointer size; 32bits in 32-bit VM, and 64bits in a 64- bit VM. Garbage collected when out-of-scope. Passed into methods by valuePassed into methods by reference (value of the address is passed)

21 primitive object pass by value pass by reference Action: Tell my accountant how much I intend to spend on a new car next year. Change in bank account: no change. Action: Swipe debit card and enter pin at the Bently dealership. Change in bank account: -125k.

22 Java version versus release number 1.5 Java 5 1.6 Java 6 1.7 Java 7 mix-up between engineering and marketing at Sun (now Oracle)

23 If a tree falls in a forest and no one is around to hear it, does it make a sound?

24

25 Event (onClick) No Event-Listener listening No Catcher Event-Source (Button) No Event Listener

26 Event (onClick) Event-Listener listening Catcher ready to catch Event-Source (Button) OnClick- Listener Any Object

27 Wrong Event

28 Event source not registered

29 Event (onClick) Event-Listener listening Catcher ready to catch OnClick- Listener Event-Source (Button) Any Object OnMouse -Listener Event (onMouse)

30 Resources in Android

31

32

33 R.java is a table

34 In Android, there's a res directory, which stands for resources. ldpi is 0.75x dimensions of mdpi mdpi is 1x dimensions of mdpi hdpi is 1.5x dimensions of mdpi xhdpi is 2x dimensinons of mdpi go to vidoes/resources01 time 3:50

35

36 Earth Moon @string/earth @string/moon strings.xml

37 #eaeaea #00abd7 #666666 #f00 #80ff0000 colors.xml #RGB #ARGB #RRGGBB #AARRGGBB

38 25dp 150dp 30dp 16sp dimens.xml

39 true true bools.xml

40 dp stands for density independent pixels It's relative to a 160 dpi screen. So 1dp is one pixel on a 160dpi screen. Don't worry about calculating the dp's. Android does that for you.

41 Add resources from the Add Resources from the graphical editor and also manually. #FFFFFF white getResources(). getStringArray(R.array.whatever)


Download ppt "Lecture 2 agenda flip teaching install p4merge rename project packages review git review Android Studio (Vinny) layouts and resources java event model."

Similar presentations


Ads by Google