├── .gitignore ├── .idea ├── .name ├── compiler.xml ├── copyright │ └── profiles_settings.xml ├── encodings.xml ├── gradle.xml ├── misc.xml ├── modules.xml ├── runConfigurations.xml └── vcs.xml ├── Lab-Android-DesignLibrary.iml ├── README.md ├── app ├── .gitignore ├── app.iml ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── inthecheesefactory │ │ └── designlibrary │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── inthecheesefactory │ │ └── lab │ │ └── designlibrary │ │ ├── CodeLabActivity.java │ │ └── MainActivity.java │ └── res │ ├── drawable-xhdpi │ ├── header.jpg │ ├── ic_action_location_found_dark.png │ ├── ic_plus.png │ ├── nav_header_bg.jpg │ └── nuuneoi.png │ ├── layout │ ├── activity_code_lab.xml │ ├── activity_main.xml │ ├── long_content.xml │ └── nav_header.xml │ ├── menu │ ├── menu_code_lab.xml │ ├── menu_main.xml │ └── navigation_drawer_items.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-v21 │ └── dimens.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── promo.jpg └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | LabDesignLibrary -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 18 | 19 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Lab-Android-DesignLibrary.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Android Design Support Library Codelab 2 | 3 | A full tutorial on how to use Android Design Support Library. (60 mins) 4 | 5 | ![](https://raw.githubusercontent.com/nuuneoi/Lab-Android-DesignLibrary/master/promo.jpg) 6 | 7 | The target result is 8 | 9 | ![](http://inthecheesefactory.com/uploads/source/designlibrary/target.gif) 10 | 11 | Full tutorial in step by step is available at http://inthecheesefactory.com/blog/android-design-support-library-codelab 12 | 13 | # About Contributor 14 | 15 | Sittiphol Phanvilai (nuuneoi a.k.a. Nine) 16 | 17 | Android GDE from Thailand 18 | 19 | Know me more through an Interactive Resume: http://nuuneoi.com/profile 20 | 21 | Company Website: http://inthecheesefactory.com 22 | 23 | Personal Website: http://nuuneoi.com 24 | 25 | # License 26 | 27 | Developed and all right reserved by Sittiphol Phanvilai (nuuneoi) 28 | 29 | Please feel free to use it as your educational resource but please don't forget to give a credit or link back 30 | 31 | Thanks ! 32 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/app.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.inthecheesefactory.lab.designlibrary" 9 | minSdkVersion 15 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile 'com.android.support:design:23.1.0' 25 | } 26 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in D:\Neois\Installer\AndroidSDK\android-sdk-windows/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /app/src/androidTest/java/com/inthecheesefactory/designlibrary/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.inthecheesefactory.designlibrary; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 14 | 15 | 16 | 17 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /app/src/main/java/com/inthecheesefactory/lab/designlibrary/CodeLabActivity.java: -------------------------------------------------------------------------------- 1 | package com.inthecheesefactory.lab.designlibrary; 2 | 3 | import android.content.res.Configuration; 4 | import android.support.v4.widget.DrawerLayout; 5 | import android.support.v7.app.ActionBarDrawerToggle; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.os.Bundle; 8 | import android.view.Menu; 9 | import android.view.MenuItem; 10 | 11 | public class CodeLabActivity extends AppCompatActivity { 12 | 13 | DrawerLayout drawerLayout; 14 | ActionBarDrawerToggle drawerToggle; 15 | 16 | @Override 17 | protected void onCreate(Bundle savedInstanceState) { 18 | super.onCreate(savedInstanceState); 19 | setContentView(R.layout.activity_code_lab); 20 | 21 | initInstances(); 22 | } 23 | 24 | private void initInstances() { 25 | drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); 26 | drawerToggle = new ActionBarDrawerToggle(CodeLabActivity.this, drawerLayout, R.string.hello_world, R.string.hello_world); 27 | drawerLayout.setDrawerListener(drawerToggle); 28 | 29 | getSupportActionBar().setHomeButtonEnabled(true); 30 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 31 | } 32 | 33 | @Override 34 | public void onPostCreate(Bundle savedInstanceState) { 35 | super.onPostCreate(savedInstanceState); 36 | drawerToggle.syncState(); 37 | } 38 | 39 | @Override 40 | public void onConfigurationChanged(Configuration newConfig) { 41 | super.onConfigurationChanged(newConfig); 42 | drawerToggle.onConfigurationChanged(newConfig); 43 | } 44 | 45 | @Override 46 | public boolean onCreateOptionsMenu(Menu menu) { 47 | // Inflate the menu; this adds items to the action bar if it is present. 48 | getMenuInflater().inflate(R.menu.menu_code_lab, menu); 49 | return true; 50 | } 51 | 52 | @Override 53 | public boolean onOptionsItemSelected(MenuItem item) { 54 | if (drawerToggle.onOptionsItemSelected(item)) 55 | return true; 56 | 57 | // Handle action bar item clicks here. The action bar will 58 | // automatically handle clicks on the Home/Up button, so long 59 | // as you specify a parent activity in AndroidManifest.xml. 60 | int id = item.getItemId(); 61 | 62 | //noinspection SimplifiableIfStatement 63 | if (id == R.id.action_settings) { 64 | return true; 65 | } 66 | 67 | return super.onOptionsItemSelected(item); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /app/src/main/java/com/inthecheesefactory/lab/designlibrary/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.inthecheesefactory.lab.designlibrary; 2 | 3 | import android.content.res.Configuration; 4 | import android.support.design.widget.CollapsingToolbarLayout; 5 | import android.support.design.widget.CoordinatorLayout; 6 | import android.support.design.widget.FloatingActionButton; 7 | import android.support.design.widget.Snackbar; 8 | import android.support.v4.widget.DrawerLayout; 9 | import android.support.v7.app.ActionBarDrawerToggle; 10 | import android.support.v7.app.AppCompatActivity; 11 | import android.os.Bundle; 12 | import android.support.v7.widget.Toolbar; 13 | import android.view.Menu; 14 | import android.view.MenuItem; 15 | import android.view.View; 16 | 17 | public class MainActivity extends AppCompatActivity { 18 | 19 | Toolbar toolbar; 20 | CollapsingToolbarLayout collapsingToolbarLayout; 21 | 22 | DrawerLayout drawerLayout; 23 | ActionBarDrawerToggle drawerToggle; 24 | 25 | CoordinatorLayout rootLayout; 26 | FloatingActionButton fabBtn; 27 | 28 | @Override 29 | protected void onCreate(Bundle savedInstanceState) { 30 | super.onCreate(savedInstanceState); 31 | setContentView(R.layout.activity_main); 32 | 33 | initToolbar(); 34 | initInstances(); 35 | } 36 | 37 | private void initToolbar() { 38 | toolbar = (Toolbar) findViewById(R.id.toolbar); 39 | setSupportActionBar(toolbar); 40 | } 41 | 42 | private void initInstances() { 43 | drawerLayout = (DrawerLayout) findViewById(R.id.drawerLayout); 44 | drawerToggle = new ActionBarDrawerToggle(MainActivity.this, drawerLayout, R.string.hello_world, R.string.hello_world); 45 | drawerLayout.setDrawerListener(drawerToggle); 46 | 47 | getSupportActionBar().setHomeButtonEnabled(true); 48 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 49 | 50 | rootLayout = (CoordinatorLayout) findViewById(R.id.rootLayout); 51 | 52 | fabBtn = (FloatingActionButton) findViewById(R.id.fabBtn); 53 | fabBtn.setOnClickListener(new View.OnClickListener() { 54 | @Override 55 | public void onClick(View v) { 56 | Snackbar.make(rootLayout, "Hello. I am Snackbar!", Snackbar.LENGTH_SHORT) 57 | .setAction("Undo", new View.OnClickListener() { 58 | @Override 59 | public void onClick(View v) { 60 | 61 | } 62 | }) 63 | .show(); 64 | } 65 | }); 66 | 67 | collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsingToolbarLayout); 68 | collapsingToolbarLayout.setTitle("Design Library"); 69 | } 70 | 71 | @Override 72 | public void onPostCreate(Bundle savedInstanceState) { 73 | super.onPostCreate(savedInstanceState); 74 | drawerToggle.syncState(); 75 | } 76 | 77 | @Override 78 | public void onConfigurationChanged(Configuration newConfig) { 79 | super.onConfigurationChanged(newConfig); 80 | drawerToggle.onConfigurationChanged(newConfig); 81 | } 82 | 83 | @Override 84 | public boolean onCreateOptionsMenu(Menu menu) { 85 | // Inflate the menu; this adds items to the action bar if it is present. 86 | getMenuInflater().inflate(R.menu.menu_main, menu); 87 | return true; 88 | } 89 | 90 | @Override 91 | public boolean onOptionsItemSelected(MenuItem item) { 92 | if (drawerToggle.onOptionsItemSelected(item)) 93 | return true; 94 | 95 | // Handle action bar item clicks here. The action bar will 96 | // automatically handle clicks on the Home/Up button, so long 97 | // as you specify a parent activity in AndroidManifest.xml. 98 | int id = item.getItemId(); 99 | 100 | //noinspection SimplifiableIfStatement 101 | if (id == R.id.action_settings) { 102 | return true; 103 | } 104 | 105 | return super.onOptionsItemSelected(item); 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuuneoi/Lab-Android-DesignLibrary/e5d2e42b1ee3b112ade752c33e199fd9c7135b0a/app/src/main/res/drawable-xhdpi/header.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_location_found_dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuuneoi/Lab-Android-DesignLibrary/e5d2e42b1ee3b112ade752c33e199fd9c7135b0a/app/src/main/res/drawable-xhdpi/ic_action_location_found_dark.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuuneoi/Lab-Android-DesignLibrary/e5d2e42b1ee3b112ade752c33e199fd9c7135b0a/app/src/main/res/drawable-xhdpi/ic_plus.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/nav_header_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuuneoi/Lab-Android-DesignLibrary/e5d2e42b1ee3b112ade752c33e199fd9c7135b0a/app/src/main/res/drawable-xhdpi/nav_header_bg.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/nuuneoi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nuuneoi/Lab-Android-DesignLibrary/e5d2e42b1ee3b112ade752c33e199fd9c7135b0a/app/src/main/res/drawable-xhdpi/nuuneoi.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_code_lab.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 12 | 13 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 13 | 14 | 18 | 19 | 26 | 27 | 34 | 35 | 42 | 43 | 44 | 45 | 46 | 47 | 51 | 52 | 56 | 57 | 60 | 61 | 65 | 66 | 67 | 70 | 71 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 93 | 94 | 95 | 96 | 105 | 106 | 107 | -------------------------------------------------------------------------------- /app/src/main/res/layout/long_content.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 |