Last active
October 11, 2017 17:22
-
-
Save jonatasleon/324ba4a9d548df1b8fc750aea828e2ab to your computer and use it in GitHub Desktop.
Criando uma Pokedex com Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
app:layout_behavior="@string/appbar_scrolling_view_behavior" | |
tools:showIn="@layout/activity_main" | |
tools:context="com.jonatasleon.pokedex.MainActivity"> | |
<android.support.v7.widget.RecyclerView | |
android:id="@+id/rv_pokemons" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:scrollbars="vertical" /> | |
</RelativeLayout> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { | |
exclude group: 'com.android.support', module: 'support-annotations' | |
}) | |
testCompile 'junit:junit:4.12' | |
compile 'com.android.support:appcompat-v7:25.3.0' | |
// libs de compatibilidade | |
compile 'com.android.support:design:25.3.0' | |
compile 'com.android.support:recyclerview-v7:25.3.0' | |
// retrofit, gson, picasso | |
compile 'com.google.code.gson:gson:2.7' | |
compile 'com.squareup.retrofit2:retrofit:2.1.0' | |
compile 'com.squareup.retrofit2:converter-gson:2.1.0' | |
compile 'com.squareup.picasso:picasso:2.5.2' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.jonatasleon.pokedex; | |
public class Pokemon { | |
private String name; | |
private String type; | |
public Pokemon() { | |
} | |
public Pokemon(String name, String type) { | |
this.name = name; | |
this.type = type; | |
} | |
public String getName() { | |
return name; | |
} | |
public void setName(String name) { | |
this.name = name; | |
} | |
public String getType() { | |
return type; | |
} | |
public void setType(String type) { | |
this.type = type; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:focusable="true" | |
android:paddingLeft="16dp" | |
android:paddingRight="16dp" | |
android:paddingTop="10dp" | |
android:paddingBottom="10dp" | |
android:clickable="true" | |
android:background="?android:attr/selectableItemBackground" | |
android:orientation="vertical"> | |
<TextView | |
android:id="@+id/tv_name" | |
android:textSize="16sp" | |
android:textStyle="bold" | |
android:layout_alignParentTop="true" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" /> | |
<TextView | |
android:id="@+id/tv_type" | |
android:layout_below="@id/tv_name" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" /> | |
</RelativeLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment