Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
laboratoare:laborator01 [2015/02/23 03:50] Andrei Roșu-Cojocaru [Scurtătură] |
laboratoare:laborator01 [2015/02/24 09:18] (current) Andrei Roșu-Cojocaru |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Laborator 01. Introducere în Programarea Android ====== | ====== Laborator 01. Introducere în Programarea Android ====== | ||
| - | ===== Sistemul de Operare Android (recapitulare) ===== | + | ===== Materiale Ajutătoare ===== |
| + | |||
| + | * [[http://pdsd2015.andreirosucojocaru.ro/_media/laboratoare/laborator01/pdsd2015-lab01-slides.pdf|pdsd2015-lab01-slides.pdf]] | ||
| + | * [[http://pdsd2015.andreirosucojocaru.ro/_media/laboratoare/laborator01/pdsd2015-lab01-slides-3pp.pdf|pdsd2015-lab01-slides-3pp.pdf]] | ||
| + | |||
| + | ===== Sistemul de Operare Android ===== | ||
| ==== Android - Prezentare Generală ===== | ==== Android - Prezentare Generală ===== | ||
| Line 108: | Line 113: | ||
| * SDK-ul pentru Android - va fi instalat în ''/opt/android-sdk-linux'' <code> | * SDK-ul pentru Android - va fi instalat în ''/opt/android-sdk-linux'' <code> | ||
| student@pdsd2015:~$ cd /tmp | student@pdsd2015:~$ cd /tmp | ||
| - | student@pdsd2015:/tmp$ wgethttp://wi-fi.cs.pub.ro/~dniculescu/didactic/pdsd/eclipse/tgz/opt.android-sdk-linuz.tgz | + | student@pdsd2015:/tmp$ wgethttp://wi-fi.cs.pub.ro/~dniculescu/didactic/pdsd/eclipse/tgz/opt.android-sdk-linuz.zip |
| student@pdsd2015:/tmp$ sudo bash | student@pdsd2015:/tmp$ sudo bash | ||
| root@pdsd2015:/tmp# cd / | root@pdsd2015:/tmp# cd / | ||
| - | root@pdsd2015:/# tar xzvf opt.android-sdk-linuz.tgz | + | root@pdsd2015:/# unzip /tmp/opt.android-sdk-linuz.zip |
| root@pdsd2015:/# exit | root@pdsd2015:/# exit | ||
| - | student@pdsd2015:/tmp$ rm -f opt.android-sdk-linuz.tgz | + | student@pdsd2015:/tmp$ rm -f opt.android-sdk-linuz.zip |
| </code> | </code> | ||
| * mediul integrat de dezvoltare Eclipse Luna SR1a (4.4.1), cu plugin-uri pentru Android și Genymotion - va fi instalat în /opt/eclipse (configurările vor fi plasate în ''/home/student/.eclipse'') <code> | * mediul integrat de dezvoltare Eclipse Luna SR1a (4.4.1), cu plugin-uri pentru Android și Genymotion - va fi instalat în /opt/eclipse (configurările vor fi plasate în ''/home/student/.eclipse'') <code> | ||
| student@pdsd2015:~$ cd /tmp | student@pdsd2015:~$ cd /tmp | ||
| - | student@pdsd2015:/tmp$ wgethttp://wi-fi.cs.pub.ro/~dniculescu/didactic/pdsd/eclipse/tgz/opt.eclipse.tgz | + | student@pdsd2015:/tmp$ wgethttp://wi-fi.cs.pub.ro/~dniculescu/didactic/pdsd/eclipse/tgz/opt.eclipse.zip |
| student@pdsd2015:/tmp$ sudo bash | student@pdsd2015:/tmp$ sudo bash | ||
| root@pdsd2015:/tmp# cd / | root@pdsd2015:/tmp# cd / | ||
| - | root@pdsd2015:/# tar xzvf opt.eclipse.tgz | + | root@pdsd2015:/# unzip /tmp/opt.eclipse.zip |
| root@pdsd2015:/# exit | root@pdsd2015:/# exit | ||
| - | student@pdsd2015:/tmp$ rm -f opt.eclipse.tgz | + | student@pdsd2015:/tmp$ rm -f opt.eclipse.zip |
| - | student@pdsd2015:/tmp$ wgethttp://wi-fi.cs.pub.ro/~dniculescu/didactic/pdsd/eclipse/tgz/dot.eclipse.tgz | + | student@pdsd2015:/tmp$ wgethttp://wi-fi.cs.pub.ro/~dniculescu/didactic/pdsd/eclipse/tgz/dot.eclipse.zip |
| student@pdsd2015:/tmp$ sudo bash | student@pdsd2015:/tmp$ sudo bash | ||
| root@pdsd2015:/tmp# cd / | root@pdsd2015:/tmp# cd / | ||
| - | root@pdsd2015:/# tar xzvf dot.eclipse.tgz | + | root@pdsd2015:/# unzip /tmp/dot.eclipse.zip |
| root@pdsd2015:/# exit | root@pdsd2015:/# exit | ||
| - | student@pdsd2015:/tmp$ rm -f dot.eclipse.tgz | + | student@pdsd2015:/tmp$ rm -f dot.eclipse.zip |
| </code> | </code> | ||
| * emulatorul Genymotion - va fi instalat în ''/opt/genymotion'' <code> | * emulatorul Genymotion - va fi instalat în ''/opt/genymotion'' <code> | ||
| student@pdsd2015:~$ cd /tmp | student@pdsd2015:~$ cd /tmp | ||
| - | student@pdsd2015:/tmp$ wgethttp://wi-fi.cs.pub.ro/~dniculescu/didactic/pdsd/eclipse/tgz/opt.genymotion.tgz | + | student@pdsd2015:/tmp$ wgethttp://wi-fi.cs.pub.ro/~dniculescu/didactic/pdsd/eclipse/tgz/opt.genymotion.zip |
| student@pdsd2015:/tmp$ sudo bash | student@pdsd2015:/tmp$ sudo bash | ||
| root@pdsd2015:/tmp# cd / | root@pdsd2015:/tmp# cd / | ||
| - | root@pdsd2015:/# tar xzvf opt.genymotion.tgz | + | root@pdsd2015:/# unzip /tmp/opt.genymotion.zip |
| root@pdsd2015:/# exit | root@pdsd2015:/# exit | ||
| - | student@pdsd2015:/tmp$ rm -f opt.genymotion.tgz | + | student@pdsd2015:/tmp$ rm -f opt.genymotion.zip |
| </code> | </code> | ||
| Line 897: | Line 902: | ||
| ===== Activitate de Laborator ===== | ===== Activitate de Laborator ===== | ||
| + | - Să se instaleze toate instrumentele necesare pentru a putea dezvolta o aplicație Android. | ||
| + | - kit de dezvoltare pentru limbajul de programare Java; | ||
| + | - SDK pentru Android; | ||
| + | - mediu integrat de dezvoltare Eclipse Luna SR1a (4.4.1) cu plugin-uri pentru Android, Genymotion; | ||
| + | - emulator Genymotion în care se configurează un dispozitiv virtual Nexus S - 4.1.1 - API 16 - 400x800; | ||
| + | - Să se instaleze Git, în cazul în care nu există deja. | ||
| + | - Să se acceseze [[http://www.github.com|GitHub]] și să se creeze un cont. | ||
| + | - Să se realizeze configurațiile globale, specificând informații precum ''user.name'', ''user.email'', ''core.editor'', ''merge.tool''. Verificați faptul că informațiile au fost introduse corect, prin două metode diferite. <code> | ||
| + | student@pdsd2015:~$ git config --global user.name "Perfect Student" | ||
| + | student@pdsd2015:~$ git config --global user.email "perfect_student@cti.pub.ro" | ||
| + | student@pdsd2015:~$ git config --global core.editor gedit | ||
| + | student@pdsd2015:~$ git config --global merge.tool diff | ||
| + | </code> Verificarea valorii pe care o au variabilele de configurare poate fi realizată în mai multe moduri: <code> | ||
| + | student@pdsd2015:~$ git cofig --list | ||
| + | </code> <code> | ||
| + | student@pdsd2015:~$ cat .git/config | ||
| + | </code> <code> | ||
| + | student@pdsd2015:~$ git config user.name | ||
| + | student@pdsd2015:~$ git config user.email | ||
| + | student@pdsd2015:~$ git config core.editor | ||
| + | student@pdsd2015:~$ git config merge.tool | ||
| + | </code> | ||
| + | - Să se creeze un depozit pe contul Github creat, denumit 'Laborator01'. Inițial, acesta trebuie să fie gol (nu trebuie să bifați nici adăugarea unui fișier ''README.md'', nici a fișierului ''.gitignore'' sau a a fișierului ''LICENSE''). | ||
| + | - Să se cloneze în directorul de pe discul local conținutul depozitului la distanță de la [[https://www.github.com/pdsd2015/Laborator01|]]. În urma acestei operații, directorul Laborator01 va trebui să se conțină proiectul Eclipse denumit ''MyFirstAndroidApplication'', fișierul ''README.md'' și un fișier ''.gitignore'' care indică tipurile de fișiere (extensiile) ignorate. <code> | ||
| + | student@pdsd2015:~$ git init | ||
| + | student@pdsd2015:~$ git clone https://www.github.com/pdsd2015/Laborator01 | ||
| + | </code> | ||
| + | - Să se încarce conținutul descărcat în cadrul depozitului 'Laborator01' de pe contul Github personal. <code> | ||
| + | student@pdsd2015:~$ cd Laborator01 | ||
| + | student@pdsd2015:~/Laborator01$ git remote add Laborator01_perfectstudent https://github.com/perfectstudent/Laborator01 | ||
| + | student@pdsd2015:~/Laborator01$ git push Laborator01_perfectstudent master | ||
| + | </code> | ||
| + | - În fișierul ''MainActivity.java'' din pachetul ''ro.pub.cs.systems.pdsd.lab01'' (directorul ''src''), să se modifice metoda ''onClick'' a clasei interne ''ButtonClickListener'' astfel încât: | ||
| + | - mesajul afișat să includă numele utilizatorului, așa cum apare în widget-ul de tip ''EditBox''; <code java> | ||
| + | greetingTextView.setText(greetingTextView.getText().replace("xxx", "\n"+userNameEditText.getText())); | ||
| + | </code> | ||
| + | - să se aplice un efect de fade, astfel încât mesajul afișat să dispară treptat în decurs de ''TRANSPARENCY_EFFECT_DURATION'' milisecunde. <code java> | ||
| + | AlphaAnimation fadeEffect = new AlphaAnimation(1.0f, 0.0f); | ||
| + | fadeEffect.setDuration(TRANSPARENCY_EFFECT_DURATION); | ||
| + | fadeEffect.setFillAfter(true); | ||
| + | greetingTextView.setAnimation(fadeEffect); | ||
| + | </code> | ||
| + | - Să se încarce modificările realizate în cadrul depozitului 'Laborator01' de pe contul Github personal, folosind un mesaj sugestiv. <code> | ||
| + | student@pdsd2015:~/Laborator01$ git add MyFirstAndroidApplication/src/ro/pub/cs/systems/pdsd/lab01.MainActivity.java | ||
| + | student@pdsd2015:~/Laborator01$ git commit -m "implemented functionality for customized message and fade effect" | ||
| + | student@pdsd2015:~/Laborator01$ git push Laborator01_perfectstudent master | ||
| + | </code> | ||
| + | - Să se ruleze proiectul ''AccelerometerPlay'' din cadrul exemplelor corespunzătoare nivelului de API 16. Să se ruleze proiectul folosind emulatorul Genymotion. Să se simuleze un eveniment de tipul rotirea ecranului și să se observe modul în care se comportă aplicația. | ||
| ===== Resurse Utile ===== | ===== Resurse Utile ===== | ||
