├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── antonioleiva │ │ └── materializeyourapp │ │ ├── DetailActivity.java │ │ ├── MainActivity.java │ │ ├── RecyclerViewAdapter.java │ │ ├── ViewModel.java │ │ ├── picasso │ │ └── CircleTransform.java │ │ └── widgets │ │ ├── GridRecyclerView.java │ │ └── SquareImageView.java │ └── res │ ├── anim │ ├── grid_layout_animation.xml │ └── slide_in_bottom.xml │ ├── drawable-hdpi │ ├── ic_favorite_black_24dp.png │ ├── ic_file_download_black_24dp.png │ ├── ic_home_black_24dp.png │ ├── ic_menu_black_24dp.png │ ├── ic_more_horiz_black_24dp.png │ └── ic_settings_black_24dp.png │ ├── drawable-mdpi │ ├── ic_favorite_black_24dp.png │ ├── ic_file_download_black_24dp.png │ ├── ic_home_black_24dp.png │ ├── ic_menu_black_24dp.png │ ├── ic_more_horiz_black_24dp.png │ └── ic_settings_black_24dp.png │ ├── drawable-nodpi │ └── drawer_background.png │ ├── drawable-v21 │ ├── fab_background.xml │ └── selectable_item_background.xml │ ├── drawable-xhdpi │ ├── ic_favorite_black_24dp.png │ ├── ic_file_download_black_24dp.png │ ├── ic_home_black_24dp.png │ ├── ic_menu_black_24dp.png │ ├── ic_more_horiz_black_24dp.png │ └── ic_settings_black_24dp.png │ ├── drawable-xxhdpi │ ├── ic_add_black.png │ ├── ic_favorite_black_24dp.png │ ├── ic_file_download_black_24dp.png │ ├── ic_home_black_24dp.png │ ├── ic_menu_black_24dp.png │ ├── ic_more_horiz_black_24dp.png │ └── ic_settings_black_24dp.png │ ├── drawable-xxxhdpi │ ├── ic_favorite_black_24dp.png │ ├── ic_file_download_black_24dp.png │ ├── ic_home_black_24dp.png │ ├── ic_launcher.png │ ├── ic_menu_black_24dp.png │ ├── ic_more_horiz_black_24dp.png │ └── ic_settings_black_24dp.png │ ├── drawable │ └── selectable_item_background.xml │ ├── layout │ ├── activity_detail.xml │ ├── activity_main.xml │ ├── drawer_header.xml │ └── item_recycler.xml │ ├── menu │ └── drawer.xml │ ├── values-v21 │ └── styles.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── distribution └── debug.keystore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Sign info 12 | *.jks 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | 18 | # Gradle files 19 | .gradle/ 20 | gradlew.bat 21 | gradlew 22 | build/ 23 | gradle.properties 24 | 25 | # Mirror files 26 | mirror/ 27 | 28 | # Local configuration file (sdk path, etc) 29 | local.properties 30 | 31 | # Proguard folder generated by Eclipse 32 | proguard/ 33 | 34 | # Intellij project files 35 | *.iws 36 | .idea/workspace.xml 37 | .idea/tasks.xml 38 | .idea 39 | 40 | *.iml 41 | 42 | # OS 43 | .DS_Store -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Materialize Your App 2 | 3 | This app was the base example for a talk I did at [MaterialFest](http://materialfest.com/) on January 31st, 2015. 4 | 5 | After that, I've used this example in some other articles: 6 | 7 | - [Materialize your App](http://antonioleiva.com/materialize-app/) 8 | - [Design Support Library (I): Navigation View](http://antonioleiva.com/navigation-view/) 9 | - [Design Support Library (II): Floating Action Button](http://antonioleiva.com/floating-action-button/) 10 | - [Design Support Library (III): Coordinator Layout](http://antonioleiva.com/coordinator-layout/) 11 | - [Design Support Library (IV): Collapsing Toolbar Layout](http://antonioleiva.com/collapsing-toolbar-layout/) 12 | - [Layout animations on RecyclerView](http://antonioleiva.com/layout-animations-on-recyclerview/) 13 | 14 | [More info and tutorials @ antonioleiva.com](http://antonioleiva.com/) 15 | 16 | # License 17 | 18 | Copyright 2015 Antonio Leiva 19 | 20 | Licensed under the Apache License, Version 2.0 (the "License"); 21 | you may not use this file except in compliance with the License. 22 | You may obtain a copy of the License at 23 | 24 | http://www.apache.org/licenses/LICENSE-2.0 25 | 26 | Unless required by applicable law or agreed to in writing, software 27 | distributed under the License is distributed on an "AS IS" BASIS, 28 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 29 | See the License for the specific language governing permissions and 30 | limitations under the License. 31 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | apply plugin: 'com.android.application' 18 | 19 | android { 20 | compileSdkVersion rootProject.ext.compileSdkVersion 21 | buildToolsVersion rootProject.ext.buildToolsVersion 22 | 23 | defaultConfig { 24 | applicationId "com.antonioleiva.materializeyourapp" 25 | minSdkVersion rootProject.ext.minSdkVersion 26 | targetSdkVersion rootProject.ext.targetSdkVersion 27 | versionCode 3 28 | versionName "1.0" 29 | } 30 | } 31 | 32 | dependencies { 33 | compile "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion" 34 | compile "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion" 35 | compile "com.android.support:cardview-v7:$rootProject.supportLibraryVersion" 36 | compile "com.android.support:palette-v7:$rootProject.supportLibraryVersion" 37 | compile "com.android.support:design:$rootProject.supportLibraryVersion" 38 | compile "com.squareup.picasso:picasso:2.4.0" 39 | compile fileTree(dir: "libs", include: ["*.jar"]) 40 | } 41 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | 23 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 41 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/antonioleiva/materializeyourapp/DetailActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.antonioleiva.materializeyourapp; 18 | 19 | import android.content.Intent; 20 | import android.content.res.ColorStateList; 21 | import android.graphics.Bitmap; 22 | import android.graphics.drawable.BitmapDrawable; 23 | import android.os.Build; 24 | import android.os.Bundle; 25 | import android.support.design.widget.CollapsingToolbarLayout; 26 | import android.support.design.widget.FloatingActionButton; 27 | import android.support.v4.app.ActivityCompat; 28 | import android.support.v4.app.ActivityOptionsCompat; 29 | import android.support.v4.view.ViewCompat; 30 | import android.support.v7.app.AppCompatActivity; 31 | import android.support.v7.graphics.Palette; 32 | import android.support.v7.widget.Toolbar; 33 | import android.transition.Slide; 34 | import android.view.MotionEvent; 35 | import android.view.View; 36 | import android.widget.ImageView; 37 | import android.widget.TextView; 38 | 39 | import com.squareup.picasso.Callback; 40 | import com.squareup.picasso.Picasso; 41 | 42 | public class DetailActivity extends AppCompatActivity { 43 | 44 | private static final String EXTRA_IMAGE = "com.antonioleiva.materializeyourapp.extraImage"; 45 | private static final String EXTRA_TITLE = "com.antonioleiva.materializeyourapp.extraTitle"; 46 | private CollapsingToolbarLayout collapsingToolbarLayout; 47 | 48 | public static void navigate(AppCompatActivity activity, View transitionImage, ViewModel viewModel) { 49 | Intent intent = new Intent(activity, DetailActivity.class); 50 | intent.putExtra(EXTRA_IMAGE, viewModel.getImage()); 51 | intent.putExtra(EXTRA_TITLE, viewModel.getText()); 52 | 53 | ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, transitionImage, EXTRA_IMAGE); 54 | ActivityCompat.startActivity(activity, intent, options.toBundle()); 55 | } 56 | 57 | @SuppressWarnings("ConstantConditions") 58 | @Override protected void onCreate(Bundle savedInstanceState) { 59 | super.onCreate(savedInstanceState); 60 | initActivityTransitions(); 61 | setContentView(R.layout.activity_detail); 62 | 63 | ViewCompat.setTransitionName(findViewById(R.id.app_bar_layout), EXTRA_IMAGE); 64 | supportPostponeEnterTransition(); 65 | 66 | setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); 67 | getSupportActionBar().setDisplayHomeAsUpEnabled(true); 68 | 69 | String itemTitle = getIntent().getStringExtra(EXTRA_TITLE); 70 | collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar); 71 | collapsingToolbarLayout.setTitle(itemTitle); 72 | collapsingToolbarLayout.setExpandedTitleColor(getResources().getColor(android.R.color.transparent)); 73 | 74 | final ImageView image = (ImageView) findViewById(R.id.image); 75 | Picasso.with(this).load(getIntent().getStringExtra(EXTRA_IMAGE)).into(image, new Callback() { 76 | @Override public void onSuccess() { 77 | Bitmap bitmap = ((BitmapDrawable) image.getDrawable()).getBitmap(); 78 | Palette.from(bitmap).generate(new Palette.PaletteAsyncListener() { 79 | public void onGenerated(Palette palette) { 80 | applyPalette(palette); 81 | } 82 | }); 83 | } 84 | 85 | @Override public void onError() { 86 | 87 | } 88 | }); 89 | 90 | TextView title = (TextView) findViewById(R.id.title); 91 | title.setText(itemTitle); 92 | } 93 | 94 | @Override public boolean dispatchTouchEvent(MotionEvent motionEvent) { 95 | try { 96 | return super.dispatchTouchEvent(motionEvent); 97 | } catch (NullPointerException e) { 98 | return false; 99 | } 100 | } 101 | 102 | private void initActivityTransitions() { 103 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 104 | Slide transition = new Slide(); 105 | transition.excludeTarget(android.R.id.statusBarBackground, true); 106 | getWindow().setEnterTransition(transition); 107 | getWindow().setReturnTransition(transition); 108 | } 109 | } 110 | 111 | private void applyPalette(Palette palette) { 112 | int primaryDark = getResources().getColor(R.color.primary_dark); 113 | int primary = getResources().getColor(R.color.primary); 114 | collapsingToolbarLayout.setContentScrimColor(palette.getMutedColor(primary)); 115 | collapsingToolbarLayout.setStatusBarScrimColor(palette.getDarkMutedColor(primaryDark)); 116 | updateBackground((FloatingActionButton) findViewById(R.id.fab), palette); 117 | supportStartPostponedEnterTransition(); 118 | } 119 | 120 | private void updateBackground(FloatingActionButton fab, Palette palette) { 121 | int lightVibrantColor = palette.getLightVibrantColor(getResources().getColor(android.R.color.white)); 122 | int vibrantColor = palette.getVibrantColor(getResources().getColor(R.color.accent)); 123 | 124 | fab.setRippleColor(lightVibrantColor); 125 | fab.setBackgroundTintList(ColorStateList.valueOf(vibrantColor)); 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /app/src/main/java/com/antonioleiva/materializeyourapp/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.antonioleiva.materializeyourapp; 18 | 19 | import android.os.Build; 20 | import android.os.Bundle; 21 | import android.support.design.widget.NavigationView; 22 | import android.support.design.widget.Snackbar; 23 | import android.support.v4.view.GravityCompat; 24 | import android.support.v4.widget.DrawerLayout; 25 | import android.support.v7.app.ActionBar; 26 | import android.support.v7.app.AppCompatActivity; 27 | import android.support.v7.widget.GridLayoutManager; 28 | import android.support.v7.widget.RecyclerView; 29 | import android.support.v7.widget.Toolbar; 30 | import android.view.MenuItem; 31 | import android.view.View; 32 | import android.widget.ImageView; 33 | 34 | import com.antonioleiva.materializeyourapp.picasso.CircleTransform; 35 | import com.squareup.picasso.Picasso; 36 | 37 | import java.util.ArrayList; 38 | import java.util.List; 39 | 40 | 41 | public class MainActivity extends AppCompatActivity implements RecyclerViewAdapter.OnItemClickListener { 42 | 43 | public static final String AVATAR_URL = "http://lorempixel.com/200/200/people/1/"; 44 | 45 | private static List items = new ArrayList<>(); 46 | 47 | static { 48 | for (int i = 1; i <= 10; i++) { 49 | items.add(new ViewModel("Item " + i, "http://lorempixel.com/500/500/animals/" + i)); 50 | } 51 | } 52 | 53 | private DrawerLayout drawerLayout; 54 | private View content; 55 | private RecyclerView recyclerView; 56 | private NavigationView navigationView; 57 | 58 | @Override 59 | protected void onCreate(Bundle savedInstanceState) { 60 | super.onCreate(savedInstanceState); 61 | setContentView(R.layout.activity_main); 62 | 63 | initRecyclerView(); 64 | initFab(); 65 | initToolbar(); 66 | setupDrawerLayout(); 67 | 68 | content = findViewById(R.id.content); 69 | 70 | final ImageView avatar = (ImageView) navigationView.getHeaderView(0).findViewById(R.id.avatar); 71 | Picasso.with(this).load(AVATAR_URL).transform(new CircleTransform()).into(avatar); 72 | 73 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 74 | setRecyclerAdapter(recyclerView); 75 | } 76 | } 77 | 78 | @Override public void onEnterAnimationComplete() { 79 | super.onEnterAnimationComplete(); 80 | setRecyclerAdapter(recyclerView); 81 | recyclerView.scheduleLayoutAnimation(); 82 | } 83 | 84 | private void initRecyclerView() { 85 | recyclerView = (RecyclerView) findViewById(R.id.recycler); 86 | recyclerView.setLayoutManager(new GridLayoutManager(this, 2)); 87 | 88 | } 89 | 90 | private void setRecyclerAdapter(RecyclerView recyclerView) { 91 | RecyclerViewAdapter adapter = new RecyclerViewAdapter(items); 92 | adapter.setOnItemClickListener(this); 93 | recyclerView.setAdapter(adapter); 94 | } 95 | 96 | private void initFab() { 97 | findViewById(R.id.fab).setOnClickListener(new View.OnClickListener() { 98 | @Override public void onClick(View v) { 99 | Snackbar.make(content, "FAB Clicked", Snackbar.LENGTH_SHORT).show(); 100 | } 101 | }); 102 | } 103 | 104 | private void initToolbar() { 105 | final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 106 | setSupportActionBar(toolbar); 107 | final ActionBar actionBar = getSupportActionBar(); 108 | 109 | if (actionBar != null) { 110 | actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_black_24dp); 111 | actionBar.setDisplayHomeAsUpEnabled(true); 112 | } 113 | } 114 | 115 | private void setupDrawerLayout() { 116 | drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); 117 | 118 | navigationView = (NavigationView) findViewById(R.id.navigation_view); 119 | navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() { 120 | @Override public boolean onNavigationItemSelected(MenuItem menuItem) { 121 | Snackbar.make(content, menuItem.getTitle() + " pressed", Snackbar.LENGTH_LONG).show(); 122 | menuItem.setChecked(true); 123 | drawerLayout.closeDrawers(); 124 | return true; 125 | } 126 | }); 127 | } 128 | 129 | @Override 130 | public boolean onOptionsItemSelected(MenuItem item) { 131 | switch (item.getItemId()) { 132 | case android.R.id.home: 133 | drawerLayout.openDrawer(GravityCompat.START); 134 | return true; 135 | } 136 | 137 | return super.onOptionsItemSelected(item); 138 | } 139 | 140 | @Override public void onItemClick(View view, ViewModel viewModel) { 141 | DetailActivity.navigate(this, view.findViewById(R.id.image), viewModel); 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /app/src/main/java/com/antonioleiva/materializeyourapp/RecyclerViewAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.antonioleiva.materializeyourapp; 18 | 19 | import android.os.Handler; 20 | import android.support.v7.widget.RecyclerView; 21 | import android.view.LayoutInflater; 22 | import android.view.View; 23 | import android.view.ViewGroup; 24 | import android.widget.ImageView; 25 | import android.widget.TextView; 26 | 27 | import com.squareup.picasso.Picasso; 28 | 29 | import java.util.List; 30 | 31 | public class RecyclerViewAdapter extends RecyclerView.Adapter implements View.OnClickListener { 32 | 33 | private List items; 34 | private OnItemClickListener onItemClickListener; 35 | 36 | public RecyclerViewAdapter(List items) { 37 | this.items = items; 38 | } 39 | 40 | public void setOnItemClickListener(OnItemClickListener onItemClickListener) { 41 | this.onItemClickListener = onItemClickListener; 42 | } 43 | 44 | @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 45 | View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_recycler, parent, false); 46 | v.setOnClickListener(this); 47 | return new ViewHolder(v); 48 | } 49 | 50 | @Override public void onBindViewHolder(ViewHolder holder, int position) { 51 | ViewModel item = items.get(position); 52 | holder.text.setText(item.getText()); 53 | holder.image.setImageBitmap(null); 54 | Picasso.with(holder.image.getContext()).load(item.getImage()).into(holder.image); 55 | holder.itemView.setTag(item); 56 | } 57 | 58 | @Override public int getItemCount() { 59 | return items.size(); 60 | } 61 | 62 | @Override public void onClick(final View v) { 63 | onItemClickListener.onItemClick(v, (ViewModel) v.getTag()); 64 | } 65 | 66 | protected static class ViewHolder extends RecyclerView.ViewHolder { 67 | public ImageView image; 68 | public TextView text; 69 | 70 | public ViewHolder(View itemView) { 71 | super(itemView); 72 | image = (ImageView) itemView.findViewById(R.id.image); 73 | text = (TextView) itemView.findViewById(R.id.text); 74 | } 75 | } 76 | 77 | public interface OnItemClickListener { 78 | 79 | void onItemClick(View view, ViewModel viewModel); 80 | 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /app/src/main/java/com/antonioleiva/materializeyourapp/ViewModel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.antonioleiva.materializeyourapp; 18 | 19 | public class ViewModel { 20 | private String text; 21 | private String image; 22 | 23 | public ViewModel(String text, String image) { 24 | this. text = text; 25 | this.image = image; 26 | } 27 | 28 | public String getText() { 29 | return text; 30 | } 31 | 32 | public String getImage() { 33 | return image; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /app/src/main/java/com/antonioleiva/materializeyourapp/picasso/CircleTransform.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.antonioleiva.materializeyourapp.picasso; 18 | 19 | import android.graphics.Bitmap; 20 | import android.graphics.BitmapShader; 21 | import android.graphics.Canvas; 22 | import android.graphics.Paint; 23 | 24 | import com.squareup.picasso.Transformation; 25 | 26 | /** 27 | * https://gist.github.com/julianshen/5829333 28 | */ 29 | public class CircleTransform implements Transformation { 30 | 31 | @Override 32 | public Bitmap transform(Bitmap source) { 33 | int size = Math.min(source.getWidth(), source.getHeight()); 34 | 35 | int x = (source.getWidth() - size) / 2; 36 | int y = (source.getHeight() - size) / 2; 37 | 38 | Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size); 39 | if (squaredBitmap != source) { 40 | source.recycle(); 41 | } 42 | 43 | Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig()); 44 | 45 | Canvas canvas = new Canvas(bitmap); 46 | Paint paint = new Paint(); 47 | BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); 48 | paint.setShader(shader); 49 | paint.setAntiAlias(true); 50 | 51 | float r = size / 2f; 52 | canvas.drawCircle(r, r, r, paint); 53 | 54 | squaredBitmap.recycle(); 55 | return bitmap; 56 | } 57 | 58 | @Override 59 | public String key() { 60 | return "circle"; 61 | } 62 | } -------------------------------------------------------------------------------- /app/src/main/java/com/antonioleiva/materializeyourapp/widgets/GridRecyclerView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2014 Freddie (Musenkishi) Lust-Hed 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.antonioleiva.materializeyourapp.widgets; 18 | 19 | import android.content.Context; 20 | import android.support.annotation.NonNull; 21 | import android.support.v7.widget.GridLayoutManager; 22 | import android.support.v7.widget.RecyclerView; 23 | import android.util.AttributeSet; 24 | import android.view.View; 25 | import android.view.ViewGroup; 26 | import android.view.animation.GridLayoutAnimationController; 27 | 28 | /** 29 | * An extension of RecyclerView, focused more on resembling a GridView. 30 | * Unlike {@link android.support.v7.widget.RecyclerView}, this view can handle 31 | * {@code } as long as you provide it a 32 | * {@link android.support.v7.widget.GridLayoutManager} in 33 | * {@code setLayoutManager(LayoutManager layout)}. 34 | *

35 | * Created by Freddie (Musenkishi) Lust-Hed. 36 | */ 37 | public class GridRecyclerView extends RecyclerView { 38 | 39 | public GridRecyclerView(Context context) { 40 | super(context); 41 | } 42 | 43 | public GridRecyclerView(Context context, AttributeSet attrs) { 44 | super(context, attrs); 45 | } 46 | 47 | public GridRecyclerView(Context context, AttributeSet attrs, int defStyle) { 48 | super(context, attrs, defStyle); 49 | } 50 | 51 | @Override 52 | public void setLayoutManager(LayoutManager layout) { 53 | if (layout instanceof GridLayoutManager) { 54 | super.setLayoutManager(layout); 55 | } else { 56 | throw new ClassCastException("You should only use a GridLayoutManager with GridRecyclerView."); 57 | } 58 | } 59 | 60 | @Override 61 | protected void attachLayoutAnimationParameters(View child, @NonNull ViewGroup.LayoutParams params, int index, int count) { 62 | 63 | if (getAdapter() != null && getLayoutManager() instanceof GridLayoutManager) { 64 | 65 | GridLayoutAnimationController.AnimationParameters animationParams = 66 | (GridLayoutAnimationController.AnimationParameters) params.layoutAnimationParameters; 67 | 68 | if (animationParams == null) { 69 | animationParams = new GridLayoutAnimationController.AnimationParameters(); 70 | params.layoutAnimationParameters = animationParams; 71 | } 72 | 73 | int columns = ((GridLayoutManager) getLayoutManager()).getSpanCount(); 74 | 75 | animationParams.count = count; 76 | animationParams.index = index; 77 | animationParams.columnsCount = columns; 78 | animationParams.rowsCount = count / columns; 79 | 80 | final int invertedIndex = count - 1 - index; 81 | animationParams.column = columns - 1 - (invertedIndex % columns); 82 | animationParams.row = animationParams.rowsCount - 1 - invertedIndex / columns; 83 | 84 | } else { 85 | super.attachLayoutAnimationParameters(child, params, index, count); 86 | } 87 | } 88 | } -------------------------------------------------------------------------------- /app/src/main/java/com/antonioleiva/materializeyourapp/widgets/SquareImageView.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.antonioleiva.materializeyourapp.widgets; 18 | 19 | import android.content.Context; 20 | import android.util.AttributeSet; 21 | import android.widget.ImageView; 22 | 23 | public class SquareImageView extends ImageView { 24 | 25 | public SquareImageView(Context context) { 26 | super(context); 27 | } 28 | 29 | public SquareImageView(Context context, AttributeSet attrs) { 30 | super(context, attrs); 31 | } 32 | 33 | public SquareImageView(Context context, AttributeSet attrs, int defStyleAttr) { 34 | super(context, attrs, defStyleAttr); 35 | } 36 | 37 | @Override 38 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 39 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 40 | 41 | int width = getMeasuredWidth(); 42 | setMeasuredDimension(width, width); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /app/src/main/res/anim/grid_layout_animation.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/anim/slide_in_bottom.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_favorite_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-hdpi/ic_favorite_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_file_download_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-hdpi/ic_file_download_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_home_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-hdpi/ic_home_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-hdpi/ic_menu_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_more_horiz_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-hdpi/ic_more_horiz_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-hdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_favorite_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-mdpi/ic_favorite_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_file_download_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-mdpi/ic_file_download_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_home_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-mdpi/ic_home_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_menu_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-mdpi/ic_menu_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_more_horiz_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-mdpi/ic_more_horiz_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-mdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-nodpi/drawer_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-nodpi/drawer_background.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/fab_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v21/selectable_item_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 21 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_favorite_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xhdpi/ic_favorite_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_file_download_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xhdpi/ic_file_download_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_home_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xhdpi/ic_home_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_menu_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xhdpi/ic_menu_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_more_horiz_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xhdpi/ic_more_horiz_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xhdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_add_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxhdpi/ic_add_black.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_favorite_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxhdpi/ic_favorite_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_file_download_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxhdpi/ic_file_download_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_home_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxhdpi/ic_home_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_menu_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxhdpi/ic_menu_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_more_horiz_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxhdpi/ic_more_horiz_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxhdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_favorite_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxxhdpi/ic_favorite_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_file_download_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxxhdpi/ic_file_download_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_home_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxxhdpi/ic_home_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_menu_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxxhdpi/ic_menu_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_more_horiz_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxxhdpi/ic_more_horiz_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/app/src/main/res/drawable-xxxhdpi/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/selectable_item_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_detail.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 24 | 25 | 31 | 32 | 41 | 42 | 49 | 50 | 56 | 57 | 58 | 59 | 60 | 61 | 67 | 68 | 71 | 72 | 78 | 79 | 83 | 84 | 92 | 93 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 114 | 115 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 26 | 27 | 32 | 33 | 39 | 40 | 45 | 46 | 53 | 54 | 55 | 56 | 60 | 61 | 62 | 63 | 70 | 71 | -------------------------------------------------------------------------------- /app/src/main/res/layout/drawer_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 26 | 27 | 34 | 35 | 43 | 53 | 54 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item_recycler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 18 | 19 | 23 | 24 | 29 | 30 | 36 | 37 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/menu/drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 |

19 | 20 | 22 | 23 | 28 | 29 | 33 | 34 | 38 | 39 | 43 | 44 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 2dp 20 | 8dp 21 | 16dp 22 | 32dp 23 | 24 | 9dp 25 | 12dp 26 | 25dp 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | Materialize Your App 20 | Settings 21 | Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam efficitur ipsum in placerat molestie. Fusce quis mauris a enim sollicitudin ultrices non eget velit. Aliquam eu pulvinar enim. Praesent libero nisl, ultricies vel maximus eu, maximus et nisi. Phasellus pharetra nec ligula vitae mollis. Quisque porttitor ornare magna, quis dignissim libero aliquam id. Donec sollicitudin ultrices ante, a semper erat tristique in. Vivamus sodales in ligula at sodales. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla tempus bibendum nibh, ac tincidunt quam convallis non. Proin dolor nunc, egestas et tortor consequat, dignissim lacinia odio. Ut ut aliquet erat. Ut non scelerisque elit. Morbi dolor neque, iaculis eu justo rutrum, aliquet dictum mauris. Phasellus quis massa ut ligula feugiat congue a et dolor. Etiam a dui a sapien ornare accumsan ac ut lorem. Suspendisse vehicula lorem dapibus nibh rhoncus ultricies. Proin sem nulla, elementum quis pharetra quis, commodo vitae nisi. Donec urna orci, posuere et iaculis sit amet, fringilla quis sapien. Pellentesque nec posuere felis. Praesent malesuada tellus nisi, non dictum justo interdum eget. Quisque mollis euismod libero, non aliquam lorem interdum vitae. Aliquam vehicula efficitur purus eget rutrum. Sed pulvinar fermentum risus ac viverra. Cras laoreet ligula quam, ac lacinia nisl elementum in. Aenean velit arcu, euismod a venenatis non, pulvinar pulvinar massa. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam efficitur ipsum in placerat molestie. Fusce quis mauris a enim sollicitudin ultrices non eget velit. Aliquam eu pulvinar enim. Praesent libero nisl, ultricies vel maximus eu, maximus et nisi. Phasellus pharetra nec ligula vitae mollis. Quisque porttitor ornare magna, quis dignissim libero aliquam id. Donec sollicitudin ultrices ante, a semper erat tristique in. Vivamus sodales in ligula at sodales. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla tempus bibendum nibh, ac tincidunt quam convallis non. Proin dolor nunc, egestas et tortor consequat, dignissim lacinia odio. Ut ut aliquet erat. Ut non scelerisque elit. Morbi dolor neque, iaculis eu justo rutrum, aliquet dictum mauris. Phasellus quis massa ut ligula feugiat congue a et dolor. Etiam a dui a sapien ornare accumsan ac ut lorem. Suspendisse vehicula lorem dapibus nibh rhoncus ultricies. Proin sem nulla, elementum quis pharetra quis, commodo vitae nisi. Donec urna orci, posuere et iaculis sit amet, fringilla quis sapien. Pellentesque nec posuere felis. Praesent malesuada tellus nisi, non dictum justo interdum eget. Quisque mollis euismod libero, non aliquam lorem interdum vitae. Aliquam vehicula efficitur purus eget rutrum. Sed pulvinar fermentum risus ac viverra. Cras laoreet ligula quam, ac lacinia nisl elementum in. Aenean velit arcu, euismod a venenatis non, pulvinar pulvinar massa. 22 | Home 23 | Favourite 24 | Downloaded 25 | More 26 | Settings 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 29 | 30 | 40 | 41 | #00BCD4 42 | #0097A7 43 | #FFEB3B 44 | #80FFEB3B 45 | #FFF493 46 | 47 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) ${YEAR} Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 18 | 19 | buildscript { 20 | repositories { 21 | jcenter() 22 | } 23 | dependencies { 24 | classpath 'com.android.tools.build:gradle:2.3.0' 25 | 26 | // NOTE: Do not place your application dependencies here; they belong 27 | // in the individual module build.gradle files 28 | } 29 | } 30 | 31 | allprojects { 32 | repositories { 33 | jcenter() 34 | } 35 | } 36 | 37 | 38 | ext { 39 | // SDK and tools 40 | buildToolsVersion = '25.0.2' 41 | compileSdkVersion = 25 42 | minSdkVersion = 16 43 | targetSdkVersion = 25 44 | 45 | // Application dependencies 46 | supportLibraryVersion = '25.3.0' 47 | } 48 | -------------------------------------------------------------------------------- /distribution/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/distribution/debug.keystore -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/antoniolg/MaterializeYourApp/4b1f91bda6657703080eabc7be2ac211245ba332/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Mar 20 10:48:51 BRT 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip 7 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) ${YEAR} Antonio Leiva 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | include ':app' 18 | --------------------------------------------------------------------------------