Skip to content

Instantly share code, notes, and snippets.

View nutchy's full-sized avatar
:octocat:

Chayanon Thongpila nutchy

:octocat:
View GitHub Profile
@nutchy
nutchy / MainActivity.java
Last active October 15, 2017 16:04
[MyLazyInstagram] - MainActivity.java
public class MainActivity extends AppCompatActivity {
public OkHttpClient client;
public Retrofit retrofit;
public LazyInstagramApi lazyInstagramApi;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.lazyinstagram_main);
@nutchy
nutchy / LazyInstagramApi.java
Last active October 15, 2017 16:06
[MyLazyInstagram] - LazyInstagramApi.java
public interface LazyInstagramApi {
// Host
String BASE_URL = "https://us-central1-retrofit-course.cloudfunctions.net";
@GET("/getProfile") // Call API via HTTP GET
Call<UserProfile> getProfile(@Query("user") String userName);
}
@nutchy
nutchy / lazyinstagram_json.json
Last active October 15, 2017 16:10
[MyLazyInstagram] - JSON File
{
"bio": "The official Instagram for Android.",
"follower": 5094,
"following": 7643,
"isFollow": "false",
"post": 23,
"posts": [
{
"comment": 322,
"like": 20,
@nutchy
nutchy / UserProfile.java
Created October 15, 2017 16:13
[MyLazyInstagram] - UserProfile.java
public class UserProfile {
private String user;
private String bio;
private String urlProfile;
private int follower;
private int following;
private boolean isFollow;
private int post;
private List<Post> posts;
@nutchy
nutchy / Post.java
Created October 15, 2017 16:14
[MyLazyInstagram] - Post.java
public class Post {
private int like;
private int comment;
private String url;
// Generate setter, getter
}
@nutchy
nutchy / rc_user_detail.xml
Created October 15, 2017 18:52
[MyLazyInstagram] - rc_user_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/rc_user"
android:layout_width="match_parent"
android:layout_height="wrap_content"></android.support.v7.widget.RecyclerView>
@nutchy
nutchy / rc_post_item.xml
Created October 15, 2017 18:56
[MyLazyInstagram] - rc_post_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@nutchy
nutchy / user_detail.xml
Created October 15, 2017 18:59
[MyLazyInstagram] - user_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
@nutchy
nutchy / post_item.xml
Created October 16, 2017 04:10
[MyLazyInstagram] - post_item.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:layout_editor_absoluteY="81dp"
tools:layout_editor_absoluteX="0dp">
<ImageView
@nutchy
nutchy / lazyinstagram_main.xml
Created October 16, 2017 04:12
[MyLazyInstagram] - lazyinstagram_main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="@+id/main_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>