Android App === ###### tags: `Android` `Java` `Taekwondo` ## HW Submission Repository初始化設定 ``` git init git config --list git config user.name "John Doe" git config user.email johndoe@example.com git remote -v git remote add upstream https://github.com/CooperHW/kick-counter.git ``` 上傳作業 ``` git add -u git add --all git commit -m "something update..." git push upstream master ``` --- ## Homework ### HW1 - [ ] Two players' *head*, *body*, *leg* buttons with their ```onClick``` function implementation --- ### HW2 - [ ] Design ```Player``` class by implementing ```score``` private data field and public getter and setter - [ ] Upload to GitHub repository https://github.com/CooperHW --- ### HW3 - [ ] *Reset* button with their ```onClick``` function implementation - [ ] Review ArrayList methods --- ### HW4 - [ ] *Undo* button with their ```onClick``` function implementation - [ ] Add ```void delScore(int x)``` method on ```Player``` class - [ ] Design ```Pair<T1, T2>``` generic class - [ ] Design ```CounterStack``` class --- ### HW5 - [ ] Change icon - [ ] Complete 2 Activities - [ ] Complete CountDownTimer - [ ] Complete kick-counter layout --- ## Programming Concept ### Introduction - [Java Data Types](https://www.w3schools.com/java/java_data_types.asp) - [Java Operators](https://www.w3schools.com/java/java_operators.asp) - [Java If...Else](https://www.w3schools.com/JAVA/java_conditions.asp) - [Java For Loop](https://www.w3schools.com/JAVA/java_for_loop.asp) ### Object-Oriented Programming on Java - [OOP Concepts in Java with examples](https://raygun.com/blog/oop-concepts-java/) ```=java public class RPG { public static void main(String[] args) { Role swordsMan = new SwordsMan(); swordsMan.setName("Justin"); swordsMan.setLevel(5); swordsMan.setBlood(60); Role magician = new Magician(); magician.setName("Monica"); magician.setLevel(2); magician.setBlood(100); showRole(swordsMan); showRole(magician); System.out.println("\n共有"+Role.count+"個角色"); } public static void showRole(Role role) { System.out.printf("%s 血量:%d 等級:%d\n", role.getName(), role.getBlood(), role.getLevel()); if (role instanceof Magician) { ((Magician)role).fight(); ((Magician)role).cure(); } if (role instanceof SwordsMan) { ((SwordsMan)role).fight(); } } } class Role { private String name; // data field private int level; private int blood; public static int count; public void setName(String name) { // method this.name = name; } public String getName() { return this.name; } public void setBlood(int blood) { this.blood = blood; } public int getBlood() { return this.blood; } // level getter(accessor) and setter(mutator) public void setLevel(int level) { this.level = level; } public int getLevel() { return this.level; } } class SwordsMan extends Role { public SwordsMan() { count++; } public void fight() { System.out.println("揮劍攻擊"); } } class Magician extends Role { public Magician(){ count++; } public void fight() { System.out.println("魔法攻擊"); } public void cure() { System.out.println("魔法治療"); } } ``` * Generics ```= java package cc.openhome; import java.util.Arrays; public class ArrayList<E> { private Object[] list; private int next; public ArrayList(int capacity) { list = new Object[capacity]; } public ArrayList() { this(16); } public void add(E e) { if(next == list.length) { list = Arrays.copyOf(list, list.length * 2); } list[next++] = e; } public E get(int index) { return (E) list[index]; } public int size() { return next; } } ``` ### Data Structure ![](https://i.imgur.com/cmRp1Ai.png) * [ArrayList](https://www.w3schools.com/java/java_arraylist.asp) * [Stack](https://www.techiedelight.com/stack-implementation-in-java/) --- ## Android App Development - [撰寫第一支APP 計算BMI值 從1到2](http://learnexp.tw/%E3%80%90android%E3%80%91%E6%92%B0%E5%AF%AB%E7%AC%AC%E4%B8%80%E6%94%AFapp-%E8%A8%88%E7%AE%97bmi%E5%80%BC-%E5%BE%9E1%E5%88%B02-android-studio/) - [Android切換畫面](http://aiur3908.blogspot.com/2015/02/android.html) - [不同Activity之間的資料傳遞 (Bundle)](https://style77125tech.pixnet.net/blog/post/16330639) - [CountDownTimer](https://developer.android.com/reference/android/os/CountDownTimer) ## Integrated Development Environment - [安裝Android Studio](https://ithelp.ithome.com.tw/articles/10200176) - [我的第一個Android程式 - Hello Android!](https://ithelp.ithome.com.tw/articles/10200466) - [匯出APK檔](https://www.itread01.com/content/1544692567.html) * Debuggable APK: Build -> Build APK (MyApplication\app\build\outputs\apk) - [在 Android Studio 開設普通 Java 專案](https://medium.com/@jemmy1234/%E5%9C%A8-android-studio-%E9%96%8B%E8%A8%AD%E6%99%AE%E9%80%9A-java-%E5%B0%88%E6%A1%88-630655fc1406) - [Android Studio中Java控制台输出中文乱码](https://blog.csdn.net/tangxl2008008/article/details/54315486) - 變換Icon * Create PNG image file of size 512x512 pixels * In Android Studio, in project view, highlight a mipmap directory * In menu, go to File>New>Image Asset * Click Image Button in Asset type button row * Click on 3 Dot Box at right of Path Box. * Drag image to source asset box * Click Next (Note: Existing launcher files will be overwritten) * Click Finish --- ## Backlog ### Intel VT - [Windows 10 - How to enter BIOS configuration?](https://www.youtube.com/watch?v=HQXFd0CN4s8&feature=youtu.be) - [如何在我的電腦上啟用虛擬化技術(VT)?](https://support.bluestacks.com/hc/zh-tw/articles/115003174386-%E5%A6%82%E4%BD%95%E5%9C%A8%E6%88%91%E7%9A%84%E9%9B%BB%E8%85%A6%E4%B8%8A%E5%95%9F%E7%94%A8%E8%99%9B%E6%93%AC%E5%8C%96%E6%8A%80%E8%A1%93-VT-) ### XML (Extensible Markup Language) ![](https://i.imgur.com/NnMRSuc.png) - [XML namespaces](https://www.w3schools.com/xml/xml_namespaces.asp) - [Android的layout.xml檔中的xmlns是什麼呢?](https://medium.com/@z125617/android%E7%9A%84layout-xml%E6%AA%94%E4%B8%AD%E7%9A%84xmlns%E6%98%AF%E4%BB%80%E9%BA%BC%E5%91%A2-de8d3adf0771)