Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Desenvolvendo para
Android
com componentes
Open Source
Por Adriel Café
ac@adrielcafe.com
http://github.com/adrielcafe
http...
ANTES DE COMEÇAR...
http://bit.do/s-task
Agenda
 Introdução rápida ao Android
 Views: nativas x open source
 Banco de Dados: nativo x open source
 O que vamos ...
Introdução Rápida ao
Android
O que é o Android?
 Sistema operacional para dispositivos móveis
 Desenvolvido pelo Google
 Baseado no Linux
 Open Sou...
Versões do Android
O Que Preciso Para
Desenvolver?
Linguagens
 Java
 XML
 SQL
Ferramentas
 Android Studio
 Android SDK
http://developer....
Views Nativas
Views:
Nativas x Open Source
Button
Nativo Alternativos
FlatButton
https://github.com/hoang8f/android-flat-button
CircleButton
https://github.com/marku...
Button
Nativo Alternativos
CircularProgressButton
https://github.com/dmytrodanylyk/circular-progress-button
ProcessButton
...
RadioButton
Nativo Alternativos
NoCircleRadioButton
https://github.com/Euphrates-Media/No-Circle-Radio-Button
SegmentedCon...
Switch
Nativo Alternativos
CoolSwitch
https://github.com/Serchinastico/CoolSwitch
SwitchButton
https://github.com/kyleduo/...
ProgressBar
Nativo Alternativos
SmoothProgressBar
https://github.com/castorflex/SmoothProgressBar
RoundCornerProgressBar
h...
ProgressBar
Nativo Alternativos
NumberProgressBar
https://github.com/daimajia/NumberProgressBar
RoundCornerProgressBar
htt...
SeekBar
Nativo Alternativos
DiscreteSeekBar
https://github.com/AnderWeb/discreteSeekBar
VerticalSeekBar
https://github.com...
Dialog
Nativo Alternativos
L-Dialogs
https://github.com/lewisjdeane/L-Dialogs
Material Dialogs
https://github.com/afollest...
Dialog
Nativo Alternativos
NiftyDialogEffects
https://github.com/sd6352051/NiftyDialogEffects
Dialog
Nativo Alternativos
Sweet Alert
https://github.com/pedant/sweet-alert-dialog
Dialog
Nativo Alternativos
DialogPlus
https://github.com/orhanobut/dialogplus
ListView
Nativo Alternativos
FlabbyListView
https://github.com/jpardogo/FlabbyListView
ListView
Nativo Alternativos
SwipeMenuListView
https://github.com/baoyongzhang/SwipeMenuListView
ListView
Nativo Alternativos
YoutubeListView
https://github.com/Laimiux/android-youtube-listview
Menu
Nativo Alternativos
ContextMenu
https://github.com/Yalantis/Context-Menu.Android
Menu
Nativo Alternativos
SideMenu
https://github.com/Yalantis/Side-Menu.Android
Pull to Refresh
Nativo Alternativos
Não tem SwipyRefreshLayout
https://github.com/OrangeGangsters/SwipyRefreshLayout
Pull to Refresh
Nativo Alternativos
Não tem Phoenix Pull-to-Refresh
https://github.com/Yalantis/Phoenix
Banco de Dados:
Nativo x Open Source
Banco de Dados:
Biblioteca Nativa
Criando uma tabela CRUD
db.execSQL(“CREATE TABLE IF NOT
EXISTS Category (
id INTEGER PRI...
Banco de Dados:
ActiveAndroid
Criando uma tabela CRUD
@Table(name = "Categories")
public class Category extends Model {
@C...
Banco de Dados:
Sugar ORM
Criando uma tabela CRUD
https://github.com/satyan/sugar
public class Category extends
SugarRecor...
O Que Vamos Desenvolver?
Lista de Tarefas
Wunderlist Evernote Any.DO
Lista de Tarefas
TodoistGoogle Keep J.Todo
Vamos desenvolver o
S-Task!
S-Task
S-Task
 Google Play
http://play.google.com/store/apps/details?id=com.
adrielcafe.stask
 GitHub
http://github.com/adrielc...
S-Task
Iremos usar os seguintes componentes open source:
 Sugar ORM
http://github.com/satyan/sugar
 NiftyDialogEffects
h...
Let’s Code!
1º - Configurar o Projeto
1. Baixar o projeto
http://bit.do/s-task
2. Abrir no Android Studio
2º - Entender o Projeto
 AndroidManifest.xml
Contém a declaração das Activities
 TasksActivity
Activity da tela principa...
3º - Configurar app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion ...
4º - Criar ListView em
activity_tasks.xml
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
andr...
5º - Implementar
FloatingActionButton em
activity_tasks.xml
<com.melnykov.fab.FloatingActionButton
android:id="@+id/fab"
a...
6º - Implementar
FloatingLabelEditText em
activity_task_edit.xml
<com.marvinlabs.widget.floatinglabel.edit
text.FloatingLa...
7º - Implementar Sugar ORM
Task TasksActivity
private void saveTask(){
task.title = “...";
task.description = “...";
task....
8º - Implementar TaskAdapter e
SwipeLayout em TasksActivity
private void loadTasks(){
...
if(!tasks.isEmpty()){
tasksAdapt...
9º - Implementar NiftyDialog em
TasksActivity
public void showTask(final Task task){
final NiftyDialogBuilder dialog =
Nif...
Desafio
Implementar novas funcionalidades:
Categorias
Lembrar
Anexos
...
http://github.com/adrielcafe/S-Task
Links
 Views open source
https://android-arsenal.com/free
 Banco de Dados ORM
https://android-arsenal.com/tag/69
 Gerad...
Obrigado!
Adriel Café
ac@adrielcafe.com
http://github.com/adrielcafe
http://pt.slideshare.net/adrielcafe
http://facebook.c...
Upcoming SlideShare
Loading in …5
×

Desenvolvendo para Android com componentes Open Source

954 views

Published on

Na primeira parte desta apresentação eu comparo os componentes nativos do Android com componentes de terceiros (projetos open source publicados no GitHub).
Na segunda parte demonstro como desenvolver um aplicativo (S-Task) utilizando alguns desses componentes.

App S-Task:
https://play.google.com/store/apps/details?id=com.adrielcafe.stask

Código-fonte do app:
https://github.com/adrielcafe/S-Task

Published in: Software
  • Login to see the comments

Desenvolvendo para Android com componentes Open Source

  1. 1. Desenvolvendo para Android com componentes Open Source Por Adriel Café ac@adrielcafe.com http://github.com/adrielcafe http://pt.slideshare.net/adrielcafe http://facebook.com/adrielcafe
  2. 2. ANTES DE COMEÇAR... http://bit.do/s-task
  3. 3. Agenda  Introdução rápida ao Android  Views: nativas x open source  Banco de Dados: nativo x open source  O que vamos desenvolver?  Let’s code!
  4. 4. Introdução Rápida ao Android
  5. 5. O que é o Android?  Sistema operacional para dispositivos móveis  Desenvolvido pelo Google  Baseado no Linux  Open Source http://source.android.com  Primeiro smartphone Android foi lançado em 2008
  6. 6. Versões do Android
  7. 7. O Que Preciso Para Desenvolver? Linguagens  Java  XML  SQL Ferramentas  Android Studio  Android SDK http://developer.android.com/sdk
  8. 8. Views Nativas
  9. 9. Views: Nativas x Open Source
  10. 10. Button Nativo Alternativos FlatButton https://github.com/hoang8f/android-flat-button CircleButton https://github.com/markushi/android-circlebutton
  11. 11. Button Nativo Alternativos CircularProgressButton https://github.com/dmytrodanylyk/circular-progress-button ProcessButton https://github.com/dmytrodanylyk/android-process-button
  12. 12. RadioButton Nativo Alternativos NoCircleRadioButton https://github.com/Euphrates-Media/No-Circle-Radio-Button SegmentedControl https://github.com/hoang8f/android-segmented-control
  13. 13. Switch Nativo Alternativos CoolSwitch https://github.com/Serchinastico/CoolSwitch SwitchButton https://github.com/kyleduo/SwitchButton
  14. 14. ProgressBar Nativo Alternativos SmoothProgressBar https://github.com/castorflex/SmoothProgressBar RoundCornerProgressBar https://github.com/akexorcist/Android-RoundCornerProgressBar
  15. 15. ProgressBar Nativo Alternativos NumberProgressBar https://github.com/daimajia/NumberProgressBar RoundCornerProgressBar https://github.com/akexorcist/Android-RoundCornerProgressBar
  16. 16. SeekBar Nativo Alternativos DiscreteSeekBar https://github.com/AnderWeb/discreteSeekBar VerticalSeekBar https://github.com/h6ah4i/android-verticalseekbar
  17. 17. Dialog Nativo Alternativos L-Dialogs https://github.com/lewisjdeane/L-Dialogs Material Dialogs https://github.com/afollestad/material-dialogs
  18. 18. Dialog Nativo Alternativos NiftyDialogEffects https://github.com/sd6352051/NiftyDialogEffects
  19. 19. Dialog Nativo Alternativos Sweet Alert https://github.com/pedant/sweet-alert-dialog
  20. 20. Dialog Nativo Alternativos DialogPlus https://github.com/orhanobut/dialogplus
  21. 21. ListView Nativo Alternativos FlabbyListView https://github.com/jpardogo/FlabbyListView
  22. 22. ListView Nativo Alternativos SwipeMenuListView https://github.com/baoyongzhang/SwipeMenuListView
  23. 23. ListView Nativo Alternativos YoutubeListView https://github.com/Laimiux/android-youtube-listview
  24. 24. Menu Nativo Alternativos ContextMenu https://github.com/Yalantis/Context-Menu.Android
  25. 25. Menu Nativo Alternativos SideMenu https://github.com/Yalantis/Side-Menu.Android
  26. 26. Pull to Refresh Nativo Alternativos Não tem SwipyRefreshLayout https://github.com/OrangeGangsters/SwipyRefreshLayout
  27. 27. Pull to Refresh Nativo Alternativos Não tem Phoenix Pull-to-Refresh https://github.com/Yalantis/Phoenix
  28. 28. Banco de Dados: Nativo x Open Source
  29. 29. Banco de Dados: Biblioteca Nativa Criando uma tabela CRUD db.execSQL(“CREATE TABLE IF NOT EXISTS Category ( id INTEGER PRIMARY KEY, name TEXT );”); // Select db.execSQL(“SELECT * FROM Category;"); // Insert db.execSQL("INSERT INTO Category Values (‘xyz’);"); // Update db.execSQL(“UPDATE Category SET name = “abc” WHERE id = 1;"); // Delete db.execSQL(“DELETE FROM Category WHERE id = 1;");
  30. 30. Banco de Dados: ActiveAndroid Criando uma tabela CRUD @Table(name = "Categories") public class Category extends Model { @Column(name = "Name") public String name; } // Select new Select() .from(Category.class) .execute(); // Insert & Update category.save(); // Delete category.delete(); https://github.com/pardom/ActiveAndroid
  31. 31. Banco de Dados: Sugar ORM Criando uma tabela CRUD https://github.com/satyan/sugar public class Category extends SugarRecord<Category> { public String name; } // Select Select .from(Category.class) .list(); // Insert & Update category.save(); // Delete category.delete();
  32. 32. O Que Vamos Desenvolver?
  33. 33. Lista de Tarefas Wunderlist Evernote Any.DO
  34. 34. Lista de Tarefas TodoistGoogle Keep J.Todo
  35. 35. Vamos desenvolver o S-Task!
  36. 36. S-Task
  37. 37. S-Task  Google Play http://play.google.com/store/apps/details?id=com. adrielcafe.stask  GitHub http://github.com/adrielcafe/S-Task
  38. 38. S-Task Iremos usar os seguintes componentes open source:  Sugar ORM http://github.com/satyan/sugar  NiftyDialogEffects http://github.com/sd6352051/NiftyDialogEffects  AndroidSwipeLayout http://github.com/daimajia/AndroidSwipeLayout  FloatingActionButton http://github.com/makovkastar/FloatingActionButton  FloatingLabelWidgets http://github.com/marvinlabs/android-floatinglabel-widgets
  39. 39. Let’s Code!
  40. 40. 1º - Configurar o Projeto 1. Baixar o projeto http://bit.do/s-task 2. Abrir no Android Studio
  41. 41. 2º - Entender o Projeto  AndroidManifest.xml Contém a declaração das Activities  TasksActivity Activity da tela principal, exibe a lista de tarefas  TaskEditActivity Activity da tela de criação e edição das tarefas  TaskAdapter Adapter responsável por criar as linhas da lista  Task Modelo que representa uma tarefa e a tabela no banco de dados  res/layout/ Contém as interfaces gráficas das Activities  build.gradle (Module: app) Arquivo de configuração do aplicativo
  42. 42. 3º - Configurar app/build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" ... } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.0.0' compile 'com.nineoldandroids:library:2.4.0' compile 'com.github.satyan:sugar:1.3.1@aar' compile 'com.github.sd6352051.niftydialogeffects:niftydialogeffects:1.0.0' compile "com.daimajia.swipelayout:library:1.2.0@aar" compile 'com.melnykov:floatingactionbutton:1.3.0@aar' compile 'com.marvinlabs:android-floatinglabel-widgets:1.6.1@aar'
  43. 43. 4º - Criar ListView em activity_tasks.xml <ListView android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/white" android:divider="@color/accent" android:dividerHeight="0.25dp"/>
  44. 44. 5º - Implementar FloatingActionButton em activity_tasks.xml <com.melnykov.fab.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:layout_margin="16dp" android:src="@drawable/ic_add" app:fab_colorNormal="@color/primary” />
  45. 45. 6º - Implementar FloatingLabelEditText em activity_task_edit.xml <com.marvinlabs.widget.floatinglabel.edit text.FloatingLabelEditText android:id="@+id/title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp" app:flw_inputWidgetTextSize="22sp" app:flw_labelTextSize="18sp" app:flw_labelText="@string/title" />
  46. 46. 7º - Implementar Sugar ORM Task TasksActivity private void saveTask(){ task.title = “..."; task.description = “..."; task.save(); } private void loadTasks(){ tasks = Select .from(Task.class) .orderBy("id DESC") .list(); } public void deleteTask(Task task){ task.delete(); tasks.remove(task); tasksAdapter.notifyDataSetChanged(); } public class Task extends SugarRecord<Task> { public String title; public String description; public boolean done; public Task(){ } } TaskEditActivity
  47. 47. 8º - Implementar TaskAdapter e SwipeLayout em TasksActivity private void loadTasks(){ ... if(!tasks.isEmpty()){ tasksAdapter = new TaskAdapter(this, tasks); tasksList.setAdapter(tasksAdapter); } } public void toggleTaskStatus(Task task, View statusView){ if(task.done){ task.done = false; statusView.setBackgroundColor(getResources() .getColor(R.color.gray)); } else { task.done = true; statusView.setBackgroundColor(getResources() .getColor(R.color.accent)); } task.save(); }
  48. 48. 9º - Implementar NiftyDialog em TasksActivity public void showTask(final Task task){ final NiftyDialogBuilder dialog = NiftyDialogBuilder.getInstance(this); dialog.withTitle(task.title) .withMessage(task.description) .withDialogColor(getResources() .getColor(R.color.primary)) .withEffect(Effectstype.SlideBottom) .withDuration(300) .withButton1Text(getString(R.string.close)) .setButton1Click(new View.OnClickListener() { @Override public void onClick(View v) { dialog.hide(); } }) .show();
  49. 49. Desafio Implementar novas funcionalidades: Categorias Lembrar Anexos ... http://github.com/adrielcafe/S-Task
  50. 50. Links  Views open source https://android-arsenal.com/free  Banco de Dados ORM https://android-arsenal.com/tag/69  Gerador de Ícones http://romannurik.github.io/AndroidAssetStudio  Gerador de Cores http://materialpalette.com
  51. 51. Obrigado! Adriel Café ac@adrielcafe.com http://github.com/adrielcafe http://pt.slideshare.net/adrielcafe http://facebook.com/adrielcafe

×