├── .gitignore ├── LICENSE.txt ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── example │ │ └── development │ │ └── androidmsample │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── example │ │ └── development │ │ └── androidmsample │ │ ├── MainActivity.java │ │ ├── adapter │ │ ├── FooterBarAdapter.java │ │ ├── SampleAdapter.java │ │ └── ViewPagerAdapter.java │ │ ├── fragments │ │ ├── BaseFragment.java │ │ ├── FooterBarFragment.java │ │ ├── PercentRelativeLayoutFragment.java │ │ ├── SampleFragment.java │ │ ├── TabLayoutFragment.java │ │ └── ToolbarFragment.java │ │ └── utils │ │ ├── Constants.java │ │ ├── Navigator.java │ │ ├── behaviors │ │ ├── FooterBarBehavior.java │ │ ├── QuickHideBehavior.java │ │ ├── ScrollAwareFABBehavior.java │ │ └── SlidingCardBehavior.java │ │ ├── helper │ │ ├── ItemTouchHelperAdapter.java │ │ ├── ItemTouchHelperViewHolder.java │ │ └── SimpleItemTouchHelperCallback.java │ │ └── widget │ │ ├── FooterBarLayout.java │ │ └── SlidingCardLayout.java │ └── res │ ├── anim │ ├── fab_in.xml │ ├── fab_out.xml │ ├── snackbar_in.xml │ └── snackbar_out.xml │ ├── drawable-hdpi │ ├── default_bg.jpg │ ├── gradient.xml │ ├── ic_action_done.png │ ├── ic_action_reorder.png │ ├── ic_action_tick.png │ ├── ic_android.png │ ├── ic_email.png │ ├── ic_folder.png │ ├── ic_layers_black_18dp.png │ ├── ic_location.png │ ├── ic_menu.png │ ├── ic_phone.png │ ├── ic_plus_one_black_18dp.png │ └── ic_tab_black_24dp.png │ ├── drawable-ldpi │ └── ic_action_tick.png │ ├── drawable-mdpi │ ├── ic_action_done.png │ ├── ic_action_reorder.png │ ├── ic_action_tick.png │ ├── ic_android.png │ ├── ic_email.png │ ├── ic_folder.png │ ├── ic_layers_black_18dp.png │ ├── ic_location.png │ ├── ic_menu.png │ ├── ic_phone.png │ ├── ic_plus_one_black_18dp.png │ └── ic_tab_black_24dp.png │ ├── drawable-xhdpi │ ├── ic_action_done.png │ ├── ic_action_reorder.png │ ├── ic_action_tick.png │ ├── ic_android.png │ ├── ic_email.png │ ├── ic_folder.png │ ├── ic_layers_black_18dp.png │ ├── ic_location.png │ ├── ic_menu.png │ ├── ic_phone.png │ ├── ic_plus_one_black_18dp.png │ └── ic_tab_black_24dp.png │ ├── drawable-xxhdpi │ ├── ic_action_done.png │ ├── ic_action_reorder.png │ ├── ic_action_tick.png │ ├── ic_android.png │ ├── ic_email.png │ ├── ic_folder.png │ ├── ic_layers_black_18dp.png │ ├── ic_location.png │ ├── ic_menu.png │ ├── ic_phone.png │ ├── ic_plus_one_black_18dp.png │ └── ic_tab_black_24dp.png │ ├── drawable-xxxhdpi │ ├── ic_action_done.png │ ├── ic_action_reorder.png │ ├── ic_layers_black_18dp.png │ ├── ic_plus_one_black_18dp.png │ └── ic_tab_black_24dp.png │ ├── drawable │ ├── BlackPanther.jpg │ ├── activated_background.xml │ ├── aquaman.jpg │ ├── avatar.jpeg │ ├── b1.jpg │ ├── b10.jpg │ ├── b11.jpg │ ├── b2.jpg │ ├── b3.jpg │ ├── b4.jpg │ ├── b5.jpg │ ├── b6.jpg │ ├── b7.jpg │ ├── b8.jpg │ ├── b9.jpg │ ├── backgrounds.png │ ├── barryallen.jpeg │ ├── batman.png │ ├── captainamerica.jpg │ ├── daredevil.jpg │ ├── dickgrayson.jpg │ ├── donatello.jpg │ ├── greenarrow.jpg │ ├── halJordan.jpg │ ├── hercules.jpg │ ├── humantorch.jpg │ ├── invisiblewoman.jpg │ ├── ironman.jpg │ ├── kylerayner.jpg │ ├── leonardo.jpg │ ├── martinmanhunter.jpg │ ├── michelangelo.jpg │ ├── mrFantatstic.jpg │ ├── orion.png │ ├── raphael.jpg │ ├── silversurfer.jpg │ ├── spiderman.jpg │ ├── superboy.jpg │ ├── supergirl.jpg │ ├── superman.jpg │ ├── supersurfer.jpg │ ├── thing.jpg │ ├── thor.jpg │ ├── timdrake.jpg │ ├── wallywest.jpg │ ├── wolverine.jpg │ └── wonderwoman.jpg │ ├── layout │ ├── activity_main.xml │ ├── collapsing_toolbar_with_image.xml │ ├── coordinator_layout.xml │ ├── drawer_header.xml │ ├── fab_action.xml │ ├── footer_bar_layout.xml │ ├── percent_relative_layout.xml │ ├── sample_fragment.xml │ ├── sample_list_item.xml │ ├── tab_layout.xml │ └── toolbar_layout.xml │ ├── menu │ ├── drawer.xml │ ├── tablayout_menu.xml │ └── toolbar_menu.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-v21 │ └── styles.xml │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── color.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── screenshots ├── 1.png └── Demo.gif └── 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 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # IDEA files 26 | .idea/ 27 | *.iml 28 | 29 | # Mac files 30 | .DS_Store -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 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 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Android M Samples 2 | ============== 3 | 4 | Sample app to demonstrate the features of the new [Android Design Support Library](http://android-developers.blogspot.in/2015/05/android-design-support-library.html) 5 | 6 | ![Screenshot](/screenshots/1.png) 7 | 8 | -------------------------------------------------------------------------------- /app/.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 | # Generated files 12 | bin/ 13 | gen/ 14 | 15 | # Gradle files 16 | .gradle/ 17 | build/ 18 | 19 | # Local configuration file (sdk path, etc) 20 | local.properties 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # IDEA files 26 | .idea/ 27 | *.iml 28 | 29 | # Mac files 30 | .DS_Store -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.example.development.androidmsample" 9 | minSdkVersion 14 10 | targetSdkVersion 22 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 | ext { 23 | // Pro-tip : https://twitter.com/manidesto/status/669195097947377664 24 | supportLibVersion = '23.3.0' 25 | } 26 | 27 | dependencies { 28 | compile fileTree(dir: 'libs', include: ['*.jar']) 29 | compile "com.android.support:appcompat-v7:${supportLibVersion}" 30 | compile "com.android.support:support-v4:${supportLibVersion}" 31 | compile "com.android.support:design:${supportLibVersion}" 32 | compile "com.android.support:cardview-v7:${supportLibVersion}" 33 | compile "com.android.support:recyclerview-v7:${supportLibVersion}" 34 | compile "com.android.support:percent:${supportLibVersion}" 35 | compile 'com.jakewharton:butterknife:7.0.0' 36 | compile 'de.hdodenhof:circleimageview:1.3.0' 37 | compile 'com.github.bumptech.glide:glide:3.6.0' 38 | } 39 | -------------------------------------------------------------------------------- /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 /Users/Development/Library/Android/sdk/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/example/development/androidmsample/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample; 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 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample; 2 | 3 | import android.os.Bundle; 4 | import android.support.design.widget.NavigationView; 5 | import android.support.v4.widget.DrawerLayout; 6 | import android.support.v7.app.ActionBarDrawerToggle; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.view.Gravity; 9 | import android.view.MenuItem; 10 | import android.view.View; 11 | 12 | import com.example.development.androidmsample.fragments.BaseFragment; 13 | import com.example.development.androidmsample.fragments.FooterBarFragment; 14 | import com.example.development.androidmsample.fragments.PercentRelativeLayoutFragment; 15 | import com.example.development.androidmsample.fragments.TabLayoutFragment; 16 | import com.example.development.androidmsample.fragments.ToolbarFragment; 17 | import com.example.development.androidmsample.utils.Navigator; 18 | 19 | import butterknife.Bind; 20 | import butterknife.ButterKnife; 21 | 22 | public class MainActivity extends AppCompatActivity implements DrawerLayout.DrawerListener 23 | , NavigationView.OnNavigationItemSelectedListener { 24 | 25 | @Bind(R.id.drawer_layout) 26 | DrawerLayout mDrawerLayout; 27 | 28 | @Bind(R.id.navigation_view) 29 | NavigationView mNavigationView; 30 | 31 | 32 | private ActionBarDrawerToggle mDrawerToggle; 33 | private int mCurrentMenuItem; 34 | private static Navigator mNavigator; 35 | 36 | @Override 37 | protected void onCreate(Bundle savedInstanceState) { 38 | super.onCreate(savedInstanceState); 39 | setContentView(R.layout.activity_main); 40 | ButterKnife.bind(this); 41 | initNavigator(); 42 | setupNavDrawer(); 43 | if(savedInstanceState==null){ 44 | setRootFragment(ToolbarFragment.newInstance()); 45 | } 46 | } 47 | 48 | @Override 49 | protected void onResumeFragments() { 50 | super.onResumeFragments(); 51 | } 52 | 53 | @Override 54 | protected void onPostResume() { 55 | super.onPostResume(); 56 | } 57 | 58 | @Override 59 | protected void onSaveInstanceState(Bundle outState) { 60 | super.onSaveInstanceState(outState); 61 | } 62 | 63 | @Override 64 | protected void onPostCreate(Bundle savedInstanceState) { 65 | super.onPostCreate(savedInstanceState); 66 | // Sync the toggle state after onRestoreInstanceState has occurred. 67 | mDrawerToggle.syncState(); 68 | } 69 | 70 | private void initNavigator() { 71 | if (mNavigator != null) return; 72 | mNavigator = new Navigator(getSupportFragmentManager(), R.id.container); 73 | } 74 | 75 | private void setRootFragment(BaseFragment fragment) { 76 | mNavigator.setRootFragment(fragment); 77 | mDrawerLayout.closeDrawers(); 78 | } 79 | 80 | private void setupNavDrawer() { 81 | mDrawerLayout.setDrawerListener(this); 82 | mDrawerToggle = new ActionBarDrawerToggle(this 83 | , mDrawerLayout 84 | , null 85 | , R.string.navigation_drawer_open 86 | , R.string.navigation_drawer_close); 87 | mDrawerToggle.syncState(); 88 | mNavigationView.setNavigationItemSelectedListener(this); 89 | } 90 | 91 | @Override 92 | public void onDrawerSlide(View drawerView, float slideOffset) { 93 | mDrawerToggle.onDrawerSlide(drawerView, slideOffset); 94 | } 95 | 96 | @Override 97 | public void onDrawerOpened(View drawerView) { 98 | mDrawerToggle.onDrawerOpened(drawerView); 99 | } 100 | 101 | public void openDrawer(){ 102 | mDrawerLayout.openDrawer(Gravity.LEFT); 103 | } 104 | 105 | @Override 106 | public void onDrawerClosed(View drawerView) { 107 | mDrawerToggle.onDrawerClosed(drawerView); 108 | } 109 | 110 | @Override 111 | public void onDrawerStateChanged(int newState) { 112 | mDrawerToggle.onDrawerStateChanged(newState); 113 | } 114 | 115 | @Override 116 | public boolean onNavigationItemSelected(MenuItem menuItem) { 117 | int id = menuItem.getItemId(); 118 | if (id == mCurrentMenuItem) { 119 | mDrawerLayout.closeDrawers(); 120 | return false; 121 | } 122 | switch (id) { 123 | case R.id.toolbarLayout: 124 | setRootFragment(ToolbarFragment.newInstance()); 125 | break; 126 | case R.id.tabLayout: 127 | setRootFragment(TabLayoutFragment.newInstance()); 128 | break; 129 | case R.id.percentRelativeLayout: 130 | setRootFragment(PercentRelativeLayoutFragment.newInstance()); 131 | break; 132 | case R.id.footerQuickReturn: 133 | setRootFragment(FooterBarFragment.newInstance()); 134 | break; 135 | } 136 | mCurrentMenuItem = id; 137 | menuItem.setChecked(true); 138 | return false; 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/adapter/FooterBarAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.adapter; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.support.v7.widget.RecyclerView; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.ImageView; 10 | import android.widget.TextView; 11 | 12 | import com.bumptech.glide.Glide; 13 | import com.example.development.androidmsample.R; 14 | import com.example.development.androidmsample.utils.helper.ItemTouchHelperAdapter; 15 | import com.example.development.androidmsample.utils.helper.ItemTouchHelperViewHolder; 16 | 17 | import java.util.ArrayList; 18 | import java.util.Arrays; 19 | import java.util.Collections; 20 | import java.util.List; 21 | 22 | public class FooterBarAdapter 23 | extends RecyclerView.Adapter implements ItemTouchHelperAdapter { 24 | 25 | private List mValues= new ArrayList<>(); 26 | private List mDrawables = new ArrayList<>(); 27 | 28 | 29 | public interface OnStartDragListener { 30 | 31 | void onStartDrag(RecyclerView.ViewHolder viewHolder); 32 | } 33 | 34 | @Override 35 | public void onItemDismiss(int position) { 36 | mValues.remove(position); 37 | mDrawables.remove(position); 38 | notifyItemRemoved(position); 39 | } 40 | 41 | @Override 42 | public void onItemMove(int fromPosition, int toPosition) { 43 | Collections.swap(mValues, fromPosition, toPosition); 44 | Collections.swap(mDrawables, fromPosition, toPosition); 45 | notifyItemMoved(fromPosition, toPosition); 46 | } 47 | public FooterBarAdapter(Context context) { 48 | mValues.addAll(Arrays.asList(context.getResources().getStringArray(R.array.superheros))); 49 | setDrawables(); 50 | } 51 | 52 | private void setDrawables() { 53 | mDrawables.add(0, R.drawable.superman); 54 | mDrawables.add(1, R.drawable.batman); 55 | mDrawables.add(2, R.drawable.spiderman); 56 | mDrawables.add(3, R.drawable.thor); 57 | mDrawables.add(4, R.drawable.haljordan); 58 | mDrawables.add(5, R.drawable.wonderwoman); 59 | mDrawables.add(6, R.drawable.captainamerica); 60 | mDrawables.add(7, R.drawable.martinmanhunter); 61 | mDrawables.add(8, R.drawable.dickgrayson); 62 | mDrawables.add(9, R.drawable.thing); 63 | mDrawables.add(10, R.drawable.humantorch); 64 | mDrawables.add(11, R.drawable.mrfantatstic); 65 | mDrawables.add(12, R.drawable.invisiblewoman); 66 | mDrawables.add(13, R.drawable.wallywest); 67 | mDrawables.add(14, R.drawable.kylerayner); 68 | mDrawables.add(15, R.drawable.superboy); 69 | mDrawables.add(16, R.drawable.leonardo); 70 | mDrawables.add(17, R.drawable.raphael); 71 | mDrawables.add(18, R.drawable.donatello); 72 | mDrawables.add(19, R.drawable.michelangelo); 73 | mDrawables.add(20, R.drawable.silversurfer); 74 | mDrawables.add(21, R.drawable.aquaman); 75 | mDrawables.add(22, R.drawable.greenarrow); 76 | mDrawables.add(23, R.drawable.barryallen); 77 | mDrawables.add(24, R.drawable.timdrake); 78 | mDrawables.add(25, R.drawable.supergirl); 79 | mDrawables.add(26, R.drawable.ironman); 80 | mDrawables.add(27, R.drawable.hercules); 81 | mDrawables.add(28, R.drawable.daredevil); 82 | mDrawables.add(29, R.drawable.orion); 83 | mDrawables.add(30, R.drawable.blackpanther); 84 | mDrawables.add(31, R.drawable.wolverine); 85 | 86 | } 87 | 88 | @Override 89 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 90 | View view = LayoutInflater.from(parent.getContext()) 91 | .inflate(R.layout.sample_list_item, parent, false); 92 | return new ViewHolder(view); 93 | } 94 | 95 | @Override 96 | public void onBindViewHolder(final ViewHolder holder, int position) { 97 | holder.mTextView.setText(mValues.get(position)); 98 | // Start a drag whenever the handle view it touched 99 | Glide.with(holder.mImageView.getContext()) 100 | .load(mDrawables.get(position)) 101 | .into(holder.mImageView); 102 | } 103 | 104 | public static class ViewHolder extends RecyclerView.ViewHolder implements 105 | ItemTouchHelperViewHolder { 106 | 107 | public final View mView; 108 | public final ImageView mImageView; 109 | public final ImageView mHandleView; 110 | public final TextView mTextView; 111 | 112 | public ViewHolder(View view) { 113 | super(view); 114 | mView = view; 115 | mImageView = (ImageView) view.findViewById(R.id.avatar); 116 | mHandleView = (ImageView) view.findViewById(R.id.handleview); 117 | mTextView = (TextView) view.findViewById(R.id.name); 118 | 119 | } 120 | @Override 121 | public void onItemSelected() { 122 | itemView.setBackgroundColor(Color.LTGRAY); 123 | } 124 | 125 | @Override 126 | public void onItemClear() { 127 | itemView.setBackgroundColor(0); 128 | } 129 | 130 | @Override 131 | public String toString() { 132 | return super.toString() + " '" + mTextView.getText(); 133 | } 134 | } 135 | 136 | 137 | @Override 138 | public int getItemCount() { 139 | return mValues.size(); 140 | } 141 | } 142 | 143 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/adapter/SampleAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.adapter; 2 | 3 | import android.content.Context; 4 | import android.graphics.Color; 5 | import android.support.v4.view.MotionEventCompat; 6 | import android.support.v7.widget.RecyclerView; 7 | import android.view.LayoutInflater; 8 | import android.view.MotionEvent; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.ImageView; 12 | import android.widget.TextView; 13 | 14 | import com.bumptech.glide.Glide; 15 | import com.example.development.androidmsample.R; 16 | import com.example.development.androidmsample.utils.helper.ItemTouchHelperAdapter; 17 | import com.example.development.androidmsample.utils.helper.ItemTouchHelperViewHolder; 18 | 19 | import java.util.ArrayList; 20 | import java.util.Arrays; 21 | import java.util.Collections; 22 | import java.util.List; 23 | 24 | public class SampleAdapter 25 | extends RecyclerView.Adapter implements ItemTouchHelperAdapter { 26 | 27 | private List mValues= new ArrayList<>(); 28 | private List mDrawables = new ArrayList<>(); 29 | private final OnStartDragListener mDragStartListener; 30 | 31 | 32 | public interface OnStartDragListener { 33 | 34 | void onStartDrag(RecyclerView.ViewHolder viewHolder); 35 | } 36 | 37 | @Override 38 | public void onItemDismiss(int position) { 39 | mValues.remove(position); 40 | mDrawables.remove(position); 41 | notifyItemRemoved(position); 42 | } 43 | 44 | @Override 45 | public void onItemMove(int fromPosition, int toPosition) { 46 | Collections.swap(mValues, fromPosition, toPosition); 47 | Collections.swap(mDrawables, fromPosition, toPosition); 48 | notifyItemMoved(fromPosition, toPosition); 49 | } 50 | public SampleAdapter(Context context,OnStartDragListener dragStartListener) { 51 | mDragStartListener = dragStartListener; 52 | mValues.addAll(Arrays.asList(context.getResources().getStringArray(R.array.superheros))); 53 | setDrawables(); 54 | } 55 | 56 | private void setDrawables() { 57 | mDrawables.add(0, R.drawable.superman); 58 | mDrawables.add(1, R.drawable.batman); 59 | mDrawables.add(2, R.drawable.spiderman); 60 | mDrawables.add(3, R.drawable.thor); 61 | mDrawables.add(4, R.drawable.haljordan); 62 | mDrawables.add(5, R.drawable.wonderwoman); 63 | mDrawables.add(6, R.drawable.captainamerica); 64 | mDrawables.add(7, R.drawable.martinmanhunter); 65 | mDrawables.add(8, R.drawable.dickgrayson); 66 | mDrawables.add(9, R.drawable.thing); 67 | mDrawables.add(10, R.drawable.humantorch); 68 | mDrawables.add(11, R.drawable.mrfantatstic); 69 | mDrawables.add(12, R.drawable.invisiblewoman); 70 | mDrawables.add(13, R.drawable.wallywest); 71 | mDrawables.add(14, R.drawable.kylerayner); 72 | mDrawables.add(15, R.drawable.superboy); 73 | mDrawables.add(16, R.drawable.leonardo); 74 | mDrawables.add(17, R.drawable.raphael); 75 | mDrawables.add(18, R.drawable.donatello); 76 | mDrawables.add(19, R.drawable.michelangelo); 77 | mDrawables.add(20, R.drawable.silversurfer); 78 | mDrawables.add(21, R.drawable.aquaman); 79 | mDrawables.add(22, R.drawable.greenarrow); 80 | mDrawables.add(23, R.drawable.barryallen); 81 | mDrawables.add(24, R.drawable.timdrake); 82 | mDrawables.add(25, R.drawable.supergirl); 83 | mDrawables.add(26, R.drawable.ironman); 84 | mDrawables.add(27, R.drawable.hercules); 85 | mDrawables.add(28, R.drawable.daredevil); 86 | mDrawables.add(29, R.drawable.orion); 87 | mDrawables.add(30, R.drawable.blackpanther); 88 | mDrawables.add(31, R.drawable.wolverine); 89 | 90 | } 91 | 92 | @Override 93 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 94 | View view = LayoutInflater.from(parent.getContext()) 95 | .inflate(R.layout.sample_list_item, parent, false); 96 | return new ViewHolder(view); 97 | } 98 | 99 | @Override 100 | public void onBindViewHolder(final ViewHolder holder, int position) { 101 | holder.mTextView.setText(mValues.get(position)); 102 | // Start a drag whenever the handle view it touched 103 | holder.mHandleView.setOnTouchListener(new View.OnTouchListener() { 104 | @Override 105 | public boolean onTouch(View v, MotionEvent event) { 106 | if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) { 107 | mDragStartListener.onStartDrag(holder); 108 | } 109 | return false; 110 | } 111 | }); 112 | Glide.with(holder.mImageView.getContext()) 113 | .load(mDrawables.get(position)) 114 | .into(holder.mImageView); 115 | } 116 | 117 | public static class ViewHolder extends RecyclerView.ViewHolder implements 118 | ItemTouchHelperViewHolder { 119 | 120 | public final View mView; 121 | public final ImageView mImageView; 122 | public final ImageView mHandleView; 123 | public final TextView mTextView; 124 | 125 | public ViewHolder(View view) { 126 | super(view); 127 | mView = view; 128 | mImageView = (ImageView) view.findViewById(R.id.avatar); 129 | mHandleView = (ImageView) view.findViewById(R.id.handleview); 130 | mTextView = (TextView) view.findViewById(R.id.name); 131 | 132 | } 133 | @Override 134 | public void onItemSelected() { 135 | itemView.setBackgroundColor(Color.LTGRAY); 136 | } 137 | 138 | @Override 139 | public void onItemClear() { 140 | itemView.setBackgroundColor(0); 141 | } 142 | 143 | @Override 144 | public String toString() { 145 | return super.toString() + " '" + mTextView.getText(); 146 | } 147 | } 148 | 149 | 150 | @Override 151 | public int getItemCount() { 152 | return mValues.size(); 153 | } 154 | } 155 | 156 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/adapter/ViewPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.adapter; 2 | 3 | import android.os.Bundle; 4 | import android.support.v4.app.Fragment; 5 | import android.support.v4.app.FragmentManager; 6 | import android.support.v4.app.FragmentStatePagerAdapter; 7 | 8 | import com.example.development.androidmsample.fragments.SampleFragment; 9 | 10 | public class ViewPagerAdapter extends FragmentStatePagerAdapter { 11 | int mNumOfTabs; 12 | 13 | public ViewPagerAdapter(FragmentManager fm, int NumOfTabs) { 14 | super(fm); 15 | this.mNumOfTabs = NumOfTabs; 16 | } 17 | 18 | @Override 19 | public Fragment getItem(int position) { 20 | SampleFragment tab; 21 | Bundle args = new Bundle(); 22 | 23 | switch (position) { 24 | case 0: 25 | tab = new SampleFragment(); 26 | args.putString("name","Tab1"); 27 | tab.setArguments(args); 28 | return tab; 29 | case 1: 30 | tab = new SampleFragment(); 31 | args.putString("name","Tab2"); 32 | tab.setArguments(args); 33 | return tab; 34 | case 2: 35 | tab = new SampleFragment(); 36 | args.putString("name","Tab3"); 37 | tab.setArguments(args); 38 | return tab; 39 | case 3: 40 | tab = new SampleFragment(); 41 | args.putString("name","Tab1"); 42 | tab.setArguments(args); 43 | return tab; 44 | case 4: 45 | tab = new SampleFragment(); 46 | args.putString("name","Tab2"); 47 | tab.setArguments(args); 48 | return tab; 49 | case 5: 50 | tab = new SampleFragment(); 51 | args.putString("name","Tab3"); 52 | tab.setArguments(args); 53 | return tab; 54 | default: 55 | return null; 56 | } 57 | } 58 | 59 | @Override 60 | public int getCount() { 61 | return mNumOfTabs; 62 | } 63 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/fragments/BaseFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.LayoutRes; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.support.v7.widget.Toolbar; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | 12 | import com.example.development.androidmsample.MainActivity; 13 | import com.example.development.androidmsample.R; 14 | 15 | import butterknife.Bind; 16 | import butterknife.ButterKnife; 17 | 18 | 19 | /** 20 | * Created by Shekar on 6/14/15. 21 | */ 22 | 23 | public abstract class BaseFragment extends Fragment { 24 | 25 | 26 | @Bind(R.id.toolbar) 27 | Toolbar mToolbar; 28 | @Override 29 | public View onCreateView(LayoutInflater inflater, ViewGroup container, 30 | Bundle savedInstanceState) { 31 | View view = inflater.inflate(getLayout(), container, false); 32 | ButterKnife.bind(this, view); 33 | return view; 34 | } 35 | 36 | protected void setupToolbar(String title) { 37 | ((AppCompatActivity)getActivity()).setSupportActionBar(mToolbar); 38 | mToolbar.setTitle(title); 39 | mToolbar.setNavigationIcon(R.drawable.ic_menu); 40 | mToolbar.setNavigationOnClickListener(new View.OnClickListener() { 41 | @Override 42 | public void onClick(View v) { 43 | ((MainActivity) getActivity()).openDrawer(); 44 | } 45 | }); 46 | } 47 | 48 | @Override 49 | public void onViewCreated(View view, Bundle savedInstanceState) { 50 | super.onViewCreated(view, savedInstanceState); 51 | } 52 | 53 | protected abstract @LayoutRes int getLayout(); 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/fragments/FooterBarFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.fragments; 2 | 3 | /** 4 | * Created by Shekar on 4/20/16. 5 | */ 6 | 7 | import android.os.Bundle; 8 | import android.support.design.widget.AppBarLayout; 9 | import android.support.v7.widget.LinearLayoutManager; 10 | import android.support.v7.widget.RecyclerView; 11 | import android.support.v7.widget.helper.ItemTouchHelper; 12 | import android.view.View; 13 | 14 | import com.example.development.androidmsample.R; 15 | import com.example.development.androidmsample.adapter.FooterBarAdapter; 16 | import com.example.development.androidmsample.utils.helper.SimpleItemTouchHelperCallback; 17 | 18 | import butterknife.Bind; 19 | 20 | public class FooterBarFragment extends BaseFragment { 21 | 22 | private ItemTouchHelper mItemTouchHelper; 23 | 24 | @Bind(R.id.recyclerview) 25 | RecyclerView mRecyclerView; 26 | 27 | @Bind(R.id.appbar) 28 | AppBarLayout mAppBarLayout; 29 | 30 | public static FooterBarFragment newInstance() { 31 | return new FooterBarFragment(); 32 | } 33 | 34 | @Override 35 | protected int getLayout() { 36 | return R.layout.footer_bar_layout; 37 | } 38 | 39 | @Override 40 | public void onViewCreated(View view, Bundle savedInstanceState) { 41 | super.onViewCreated(view, savedInstanceState); 42 | setupToolbar(getString(R.string.toolbarLayout)); 43 | setupRecyclerView(); 44 | } 45 | 46 | private void setupRecyclerView() { 47 | mRecyclerView.setHasFixedSize(true); 48 | mRecyclerView.setLayoutManager(new LinearLayoutManager(mRecyclerView.getContext())); 49 | FooterBarAdapter adapter = new FooterBarAdapter(getActivity()); 50 | mRecyclerView.setAdapter(adapter); 51 | ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(adapter); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/fragments/PercentRelativeLayoutFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.fragments; 2 | 3 | /** 4 | * Created by Shekar on 6/28/15. 5 | */ 6 | 7 | import android.os.Bundle; 8 | import android.support.annotation.Nullable; 9 | import android.view.Menu; 10 | import android.view.MenuInflater; 11 | import android.view.View; 12 | 13 | import com.example.development.androidmsample.R; 14 | 15 | 16 | /** 17 | * Created by Shekar on 6/26/15. 18 | */ 19 | public class PercentRelativeLayoutFragment extends BaseFragment { 20 | 21 | 22 | public static PercentRelativeLayoutFragment newInstance() { 23 | return new PercentRelativeLayoutFragment(); 24 | } 25 | 26 | @Override 27 | public void onCreate(@Nullable Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | setHasOptionsMenu(true); 30 | } 31 | 32 | @Override 33 | protected int getLayout() { 34 | return R.layout.percent_relative_layout; 35 | } 36 | 37 | @Override 38 | public void onViewCreated(View view, Bundle savedInstanceState) { 39 | super.onViewCreated(view, savedInstanceState); 40 | setupToolbar(getString(R.string.percent_relative_layout)); 41 | } 42 | 43 | @Override 44 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 45 | getActivity().getMenuInflater().inflate(R.menu.tablayout_menu, menu); 46 | super.onCreateOptionsMenu(menu, inflater); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/fragments/SampleFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v7.widget.LinearLayoutManager; 7 | import android.support.v7.widget.RecyclerView; 8 | import android.support.v7.widget.helper.ItemTouchHelper; 9 | import android.view.LayoutInflater; 10 | import android.view.View; 11 | import android.view.ViewGroup; 12 | 13 | import com.example.development.androidmsample.R; 14 | import com.example.development.androidmsample.adapter.SampleAdapter; 15 | 16 | import butterknife.Bind; 17 | import butterknife.ButterKnife; 18 | 19 | public class SampleFragment extends Fragment implements SampleAdapter.OnStartDragListener { 20 | 21 | private ItemTouchHelper mItemTouchHelper; 22 | @Bind(R.id.recyclerview) 23 | RecyclerView mRecyclerView; 24 | @Override 25 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 26 | View view = inflater.inflate(R.layout.sample_fragment, container, false); 27 | ButterKnife.bind(this, view); 28 | return view; 29 | 30 | } 31 | 32 | @Override 33 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 34 | super.onViewCreated(view, savedInstanceState); 35 | Bundle args = this.getArguments(); 36 | setupRecyclerView(); 37 | } 38 | 39 | @Override 40 | public void onSaveInstanceState(Bundle outState) { 41 | } 42 | 43 | @Override 44 | public void onViewStateRestored(@Nullable Bundle savedInstanceState) { 45 | super.onViewStateRestored(savedInstanceState); 46 | 47 | } 48 | 49 | private void setupRecyclerView() { 50 | mRecyclerView.setLayoutManager(new LinearLayoutManager(mRecyclerView.getContext())); 51 | mRecyclerView.setAdapter(new SampleAdapter(getActivity() 52 | ,this)); 53 | } 54 | @Override 55 | public void onStartDrag(RecyclerView.ViewHolder viewHolder) { 56 | mItemTouchHelper.startDrag(viewHolder); 57 | } 58 | 59 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/fragments/TabLayoutFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.design.widget.AppBarLayout; 6 | import android.support.design.widget.TabLayout; 7 | import android.support.v4.view.ViewPager; 8 | import android.view.Menu; 9 | import android.view.MenuInflater; 10 | import android.view.MenuItem; 11 | import android.view.View; 12 | 13 | import com.example.development.androidmsample.R; 14 | import com.example.development.androidmsample.adapter.ViewPagerAdapter; 15 | 16 | import butterknife.Bind; 17 | 18 | /** 19 | * Created by Shekar on 6/26/15. 20 | */ 21 | public class TabLayoutFragment extends BaseFragment { 22 | 23 | @Bind(R.id.tabs) 24 | TabLayout mTabLayout; 25 | 26 | @Bind(R.id.viewpager) 27 | ViewPager mViewPager; 28 | 29 | 30 | public static TabLayoutFragment newInstance() { 31 | return new TabLayoutFragment(); 32 | } 33 | 34 | @Override 35 | public void onCreate(@Nullable Bundle savedInstanceState) { 36 | super.onCreate(savedInstanceState); 37 | setHasOptionsMenu(true); 38 | } 39 | 40 | @Override 41 | protected int getLayout() { 42 | return R.layout.tab_layout; 43 | } 44 | 45 | @Override 46 | public void onViewCreated(View view, Bundle savedInstanceState) { 47 | super.onViewCreated(view, savedInstanceState); 48 | setupToolbar(getString(R.string.tabLayout)); 49 | setupTabLayout(); 50 | } 51 | 52 | @Override 53 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 54 | getActivity().getMenuInflater().inflate(R.menu.tablayout_menu, menu); 55 | super.onCreateOptionsMenu(menu, inflater); 56 | } 57 | 58 | @Override 59 | public boolean onOptionsItemSelected(MenuItem item) { 60 | AppBarLayout.LayoutParams params = 61 | (AppBarLayout.LayoutParams) mToolbar.getLayoutParams(); 62 | AppBarLayout.LayoutParams tabParams = 63 | (AppBarLayout.LayoutParams) mTabLayout.getLayoutParams(); 64 | switch (item.getItemId()) { 65 | case R.id.menu_tab_pin_scroll: 66 | tabParams.setScrollFlags(0); 67 | params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS); 68 | getActivity().supportInvalidateOptionsMenu(); 69 | return true; 70 | case R.id.menu_tab_unpin_scroll: 71 | tabParams.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL| AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS); 72 | params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS); 73 | getActivity().supportInvalidateOptionsMenu(); 74 | return true; 75 | default: 76 | return super.onOptionsItemSelected(item); 77 | } 78 | } 79 | 80 | private void setupTabLayout() { 81 | mTabLayout.addTab(mTabLayout.newTab().setText("Tab 1")); 82 | mTabLayout.addTab(mTabLayout.newTab().setText("Tab 2")); 83 | mTabLayout.addTab(mTabLayout.newTab().setText("Tab 3")); 84 | mTabLayout.addTab(mTabLayout.newTab().setText("Tab 1")); 85 | mTabLayout.addTab(mTabLayout.newTab().setText("Tab 2")); 86 | mTabLayout.addTab(mTabLayout.newTab().setText("Tab 3")); 87 | mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL); 88 | setupViewPager(); 89 | } 90 | 91 | private void setupViewPager() { 92 | mViewPager.setAdapter(new ViewPagerAdapter 93 | (getChildFragmentManager(), mTabLayout.getTabCount())); 94 | mViewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(mTabLayout)); 95 | mTabLayout.setOnTabSelectedListener(tabSelectedListener); 96 | } 97 | 98 | private TabLayout.OnTabSelectedListener tabSelectedListener = new TabLayout.OnTabSelectedListener() { 99 | @Override 100 | public void onTabSelected(TabLayout.Tab tab) { 101 | mViewPager.setCurrentItem(tab.getPosition()); 102 | } 103 | 104 | @Override 105 | public void onTabUnselected(TabLayout.Tab tab) { 106 | } 107 | 108 | @Override 109 | public void onTabReselected(TabLayout.Tab tab) { 110 | } 111 | }; 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/fragments/ToolbarFragment.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.fragments; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.design.widget.AppBarLayout; 6 | import android.support.design.widget.CoordinatorLayout; 7 | import android.support.design.widget.FloatingActionButton; 8 | import android.support.design.widget.Snackbar; 9 | import android.support.v7.widget.LinearLayoutManager; 10 | import android.support.v7.widget.RecyclerView; 11 | import android.support.v7.widget.helper.ItemTouchHelper; 12 | import android.view.Menu; 13 | import android.view.MenuInflater; 14 | import android.view.MenuItem; 15 | import android.view.View; 16 | 17 | import com.example.development.androidmsample.R; 18 | import com.example.development.androidmsample.adapter.SampleAdapter; 19 | import com.example.development.androidmsample.utils.Constants; 20 | import com.example.development.androidmsample.utils.behaviors.ScrollAwareFABBehavior; 21 | import com.example.development.androidmsample.utils.helper.SimpleItemTouchHelperCallback; 22 | 23 | import butterknife.Bind; 24 | 25 | public class ToolbarFragment extends BaseFragment implements SampleAdapter.OnStartDragListener { 26 | 27 | private ItemTouchHelper mItemTouchHelper; 28 | 29 | @Bind(R.id.recyclerview) 30 | RecyclerView mRecyclerView; 31 | 32 | @Bind(R.id.appbar) 33 | AppBarLayout mAppBarLayout; 34 | 35 | @Bind(R.id.fab) 36 | FloatingActionButton mFab; 37 | 38 | public static ToolbarFragment newInstance() { 39 | return new ToolbarFragment(); 40 | } 41 | 42 | @Override 43 | public void onCreate(@Nullable Bundle savedInstanceState) { 44 | super.onCreate(savedInstanceState); 45 | setHasOptionsMenu(true); 46 | } 47 | 48 | @Override 49 | protected int getLayout() { 50 | return R.layout.toolbar_layout; 51 | } 52 | 53 | @Override 54 | public void onViewCreated(View view, Bundle savedInstanceState) { 55 | super.onViewCreated(view, savedInstanceState); 56 | setupToolbar(getString(R.string.toolbarLayout)); 57 | setupRecyclerView(); 58 | mFab.setOnClickListener(new View.OnClickListener() { 59 | @Override 60 | public void onClick(View v) { 61 | Snackbar.make(mRecyclerView, "Snackbar With Action!", Snackbar.LENGTH_SHORT) 62 | .setAction("Undo", new View.OnClickListener() { 63 | @Override 64 | public void onClick(View v) { 65 | } 66 | }) 67 | .show(); 68 | } 69 | }); 70 | } 71 | 72 | @Override 73 | public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { 74 | getActivity().getMenuInflater().inflate(R.menu.toolbar_menu, menu); 75 | super.onCreateOptionsMenu(menu, inflater); 76 | } 77 | 78 | @Override 79 | public boolean onOptionsItemSelected(MenuItem item) { 80 | //mAppBarLayout.addOnOffsetChangedListener(null); 81 | AppBarLayout.LayoutParams toolbarParams = 82 | (AppBarLayout.LayoutParams) mToolbar.getLayoutParams(); 83 | CoordinatorLayout.LayoutParams fabParams = (CoordinatorLayout.LayoutParams)mFab.getLayoutParams(); 84 | 85 | switch (item.getItemId()) { 86 | case R.id.menu_toolbar_pin: 87 | fabParams.setBehavior(new ScrollAwareFABBehavior(Constants.NONE)); 88 | mFab.setLayoutParams(fabParams); 89 | toolbarParams.setScrollFlags(0); 90 | getActivity().supportInvalidateOptionsMenu(); 91 | case R.id.menu_scroll: 92 | fabParams.setBehavior(new ScrollAwareFABBehavior(Constants.NONE)); 93 | mFab.setLayoutParams(fabParams); 94 | toolbarParams.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL); 95 | getActivity().supportInvalidateOptionsMenu(); 96 | return true; 97 | case R.id.menu_scroll_enteralways: 98 | fabParams.setBehavior(new ScrollAwareFABBehavior(Constants.NONE)); 99 | mFab.setLayoutParams(fabParams); 100 | toolbarParams.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS); 101 | getActivity().supportInvalidateOptionsMenu(); 102 | return true; 103 | case R.id.menu_snakbar_fab_scale_anim: 104 | fabParams.setBehavior(new ScrollAwareFABBehavior(Constants.SCALE)); 105 | mFab.setLayoutParams(fabParams); 106 | return true; 107 | case R.id.menu_snakbar_fab_translate_anim: 108 | fabParams.setBehavior(new ScrollAwareFABBehavior(Constants.TRANSLATE)); 109 | mFab.setLayoutParams(fabParams); 110 | // case R.id.menu_scroll_rotate: 111 | // mFab.setLayoutParams(null); 112 | // mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { 113 | // @Override 114 | // public void onOffsetChanged(AppBarLayout appBarLayout, int i) { 115 | //// float deltaY = mFab.getHeight()*1.5f; 116 | //// if(i <0)animFab(deltaY); 117 | //// else animFab(-deltaY); 118 | // } 119 | // }); 120 | return true; 121 | default: 122 | return super.onOptionsItemSelected(item); 123 | } 124 | } 125 | 126 | private void animFab(final float deltaY){ 127 | // ViewCompat.animate(mFab) 128 | // .translationYBy(deltaY) 129 | // .withLayer() 130 | // .start(); 131 | } 132 | 133 | private void setupRecyclerView() { 134 | mRecyclerView.setHasFixedSize(true); 135 | mRecyclerView.setLayoutManager(new LinearLayoutManager(mRecyclerView.getContext())); 136 | SampleAdapter adapter=new SampleAdapter(getActivity(),this); 137 | mRecyclerView.setAdapter(adapter); 138 | ItemTouchHelper.Callback callback = new SimpleItemTouchHelperCallback(adapter); 139 | mItemTouchHelper = new ItemTouchHelper(callback); 140 | mItemTouchHelper.attachToRecyclerView(mRecyclerView); 141 | } 142 | 143 | @Override 144 | public void onStartDrag(RecyclerView.ViewHolder viewHolder) { 145 | mItemTouchHelper.startDrag(viewHolder); 146 | } 147 | 148 | } 149 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/Constants.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.utils; 2 | 3 | /** 4 | * Created by Shekar on 6/26/15. 5 | */ 6 | public class Constants { 7 | public static final int NONE=0; 8 | public static final int SCALE=1; 9 | public static final int TRANSLATE=2; 10 | 11 | } 12 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/Navigator.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.utils; 2 | 3 | import android.support.annotation.IdRes; 4 | import android.support.annotation.NonNull; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v4.app.FragmentManager; 7 | 8 | public class Navigator{ 9 | @NonNull 10 | protected final FragmentManager mFragmentManager; 11 | 12 | @IdRes 13 | protected final int mDefaultContainer; 14 | 15 | public Navigator(@NonNull final FragmentManager fragmentManager, @IdRes final int defaultContainer){ 16 | mFragmentManager = fragmentManager; 17 | mDefaultContainer =defaultContainer; 18 | } 19 | 20 | public void setRootFragment(final Fragment startFragment){ 21 | if(getSize() > 0){ 22 | this.clearHistory(); 23 | } 24 | this.replaceFragment(startFragment); 25 | } 26 | 27 | private void replaceFragment(final Fragment fragment) { 28 | mFragmentManager.beginTransaction() 29 | .replace(mDefaultContainer, fragment, fragment.getClass().getSimpleName()) 30 | .commitAllowingStateLoss(); 31 | } 32 | 33 | public int getSize() { 34 | return mFragmentManager.getBackStackEntryCount(); 35 | } 36 | 37 | 38 | public void clearHistory() { 39 | //noinspection StatementWithEmptyBody - it works as wanted 40 | while(mFragmentManager.popBackStackImmediate()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/behaviors/FooterBarBehavior.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.utils.behaviors; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.AppBarLayout; 5 | import android.support.design.widget.CoordinatorLayout; 6 | import android.util.AttributeSet; 7 | import android.util.Log; 8 | import android.view.View; 9 | 10 | import com.example.development.androidmsample.utils.widget.FooterBarLayout; 11 | 12 | /** 13 | * Simple layout behavior that will track the state of the AppBarLayout 14 | * and match its offset for a corresponding footer. 15 | */ 16 | public class FooterBarBehavior extends CoordinatorLayout.Behavior { 17 | 18 | //Track offset for determining dependency changes 19 | private int mDependencyOffset; 20 | //Track initial layout position to properly offset child 21 | private int mChildInitialOffset; 22 | 23 | //Required to instantiate as a default behavior 24 | public FooterBarBehavior() { 25 | } 26 | 27 | //Required to attach behavior via XML 28 | public FooterBarBehavior(Context context, AttributeSet attrs) { 29 | super(context, attrs); 30 | } 31 | 32 | //This is called to determine which views this behavior depends on 33 | @Override 34 | public boolean layoutDependsOn(CoordinatorLayout parent, 35 | FooterBarLayout child, 36 | View dependency) { 37 | //We are watching changes in the AppBarLayout 38 | return dependency instanceof AppBarLayout; 39 | } 40 | 41 | //This is called for each change to a dependent view 42 | @Override 43 | public boolean onDependentViewChanged(CoordinatorLayout parent, 44 | FooterBarLayout child, 45 | View dependency) { 46 | //Check if the view position has actually changed 47 | if (mDependencyOffset != dependency.getTop()) { 48 | mDependencyOffset = dependency.getTop(); 49 | 50 | child.offsetTopAndBottom( 51 | mChildInitialOffset - child.getTop() - mDependencyOffset); 52 | //Notify that we changed our attached child 53 | return true; 54 | } 55 | 56 | return false; 57 | } 58 | 59 | //This is called on each layout request. 60 | @Override 61 | public boolean onLayoutChild(CoordinatorLayout parent, 62 | FooterBarLayout child, 63 | int layoutDirection) { 64 | Log.d("=====",child.getTop()+""); 65 | // if(mChildInitialOffset==0) { 66 | // parent.onLayoutChild(child, layoutDirection); 67 | // } 68 | //Gather initial state 69 | mChildInitialOffset = child.getTop(); 70 | 71 | //Let the framework lay out the view 72 | return false; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/behaviors/QuickHideBehavior.java: -------------------------------------------------------------------------------- 1 | //package com.example.development.androidmsample.utils.behaviors; 2 | // 3 | //import android.animation.ObjectAnimator; 4 | //import android.content.Context; 5 | //import android.content.res.TypedArray; 6 | //import android.support.design.widget.AppBarLayout; 7 | //import android.support.design.widget.CoordinatorLayout; 8 | //import android.support.design.widget.FloatingActionButton; 9 | //import android.support.v4.view.ViewCompat; 10 | //import android.util.AttributeSet; 11 | //import android.view.View; 12 | //import android.view.ViewGroup; 13 | // 14 | //import com.example.android.coordinatedeffort.R; 15 | // 16 | ///** 17 | // * Simple scrolling behavior that monitors nested events in the scrolling 18 | // * container to implement a quick hide/show for the attached view. 19 | // */ 20 | //public class QuickHideBehavior extends CoordinatorLayout.Behavior { 21 | // 22 | // private static final int DIRECTION_UP = 1; 23 | // private static final int DIRECTION_DOWN = -1; 24 | // 25 | // /* Tracking direction of user motion */ 26 | // private int mScrollingDirection; 27 | // /* Tracking last threshold crossed */ 28 | // private int mScrollTrigger; 29 | // 30 | // /* Accumulated scroll distance */ 31 | // private int mScrollDistance; 32 | // /* Distance threshold to trigger animation */ 33 | // private int mScrollThreshold; 34 | // 35 | // 36 | // private ObjectAnimator mAnimator; 37 | // 38 | // //Required to instantiate as a default behavior 39 | // public QuickHideBehavior() { 40 | // } 41 | // 42 | // //Required to attach behavior via XML 43 | // public QuickHideBehavior(Context context, AttributeSet attrs) { 44 | // super(context, attrs); 45 | // 46 | // TypedArray a = context.getTheme() 47 | // .obtainStyledAttributes(new int[] {R.attr.actionBarSize}); 48 | // //Use half the standard action bar height 49 | // mScrollThreshold = a.getDimensionPixelSize(0, 0) / 2; 50 | // a.recycle(); 51 | // } 52 | // 53 | // //Called before a nested scroll event. Return true to declare interest 54 | // @Override 55 | // public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, 56 | // View child, View directTargetChild, View target, 57 | // int nestedScrollAxes) { 58 | // //We have to declare interest in the scroll to receive further events 59 | // return (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0; 60 | // } 61 | // 62 | // //Called before the scrolling child consumes the event 63 | // // We can steal all/part of the event by filling in the consumed array 64 | // @Override 65 | // public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, 66 | // View child, View target, 67 | // int dx, int dy, 68 | // int[] consumed) { 69 | // //Determine direction changes here 70 | // if (dy > 0 && mScrollingDirection != DIRECTION_UP) { 71 | // mScrollingDirection = DIRECTION_UP; 72 | // mScrollDistance = 0; 73 | // } else if (dy < 0 && mScrollingDirection != DIRECTION_DOWN) { 74 | // mScrollingDirection = DIRECTION_DOWN; 75 | // mScrollDistance = 0; 76 | // } 77 | // } 78 | // 79 | // //Called after the scrolling child consumes the event, with amount consumed 80 | // @Override 81 | // public void onNestedScroll(CoordinatorLayout coordinatorLayout, 82 | // View child, View target, 83 | // int dxConsumed, int dyConsumed, 84 | // int dxUnconsumed, int dyUnconsumed) { 85 | // //Consumed distance is the actual distance traveled by the scrolling view 86 | // mScrollDistance += dyConsumed; 87 | // if (mScrollDistance > mScrollThreshold 88 | // && mScrollTrigger != DIRECTION_UP) { 89 | // //Hide the target view 90 | // mScrollTrigger = DIRECTION_UP; 91 | // restartAnimator(child, getTargetHideValue(coordinatorLayout, child)); 92 | // } else if (mScrollDistance < -mScrollThreshold 93 | // && mScrollTrigger != DIRECTION_DOWN) { 94 | // //Return the target view 95 | // mScrollTrigger = DIRECTION_DOWN; 96 | // restartAnimator(child, 0f); 97 | // } 98 | // } 99 | // 100 | // //Called after the scrolling child handles the fling 101 | // @Override 102 | // public boolean onNestedFling(CoordinatorLayout coordinatorLayout, 103 | // View child, View target, 104 | // float velocityX, float velocityY, 105 | // boolean consumed) { 106 | // //We only care when the target view is already handling the fling 107 | // if (consumed) { 108 | // if (velocityY > 0 && mScrollTrigger != DIRECTION_UP) { 109 | // mScrollTrigger = DIRECTION_UP; 110 | // restartAnimator(child, getTargetHideValue(coordinatorLayout, child)); 111 | // } else if (velocityY < 0 && mScrollTrigger != DIRECTION_DOWN) { 112 | // mScrollTrigger = DIRECTION_DOWN; 113 | // restartAnimator(child, 0f); 114 | // } 115 | // } 116 | // 117 | // return false; 118 | // } 119 | // 120 | // /* Helper Methods */ 121 | // 122 | // //Helper to trigger hide/show animation 123 | // private void restartAnimator(View target, float value) { 124 | // if (mAnimator != null) { 125 | // mAnimator.cancel(); 126 | // mAnimator = null; 127 | // } 128 | // 129 | // mAnimator = ObjectAnimator 130 | // .ofFloat(target, View.TRANSLATION_Y, value) 131 | // .setDuration(250); 132 | // mAnimator.start(); 133 | // } 134 | // 135 | // private float getTargetHideValue(ViewGroup parent, View target) { 136 | // if (target instanceof AppBarLayout) { 137 | // return -target.getHeight(); 138 | // } else if (target instanceof FloatingActionButton) { 139 | // return parent.getHeight() - target.getTop(); 140 | // } 141 | // 142 | // return 0f; 143 | // } 144 | //} 145 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/behaviors/ScrollAwareFABBehavior.java: -------------------------------------------------------------------------------- 1 | 2 | package com.example.development.androidmsample.utils.behaviors; 3 | 4 | import android.content.Context; 5 | import android.os.Build; 6 | import android.support.design.widget.CoordinatorLayout; 7 | import android.support.design.widget.FloatingActionButton; 8 | import android.support.v4.view.ViewCompat; 9 | import android.support.v4.view.ViewPropertyAnimatorListener; 10 | import android.support.v4.view.animation.FastOutSlowInInterpolator; 11 | import android.util.AttributeSet; 12 | import android.util.Log; 13 | import android.view.View; 14 | import android.view.animation.Animation; 15 | import android.view.animation.AnimationUtils; 16 | import android.view.animation.Interpolator; 17 | 18 | import com.example.development.androidmsample.R; 19 | import com.example.development.androidmsample.utils.Constants; 20 | 21 | public class ScrollAwareFABBehavior extends FloatingActionButton.Behavior { 22 | private static final Interpolator INTERPOLATOR = new FastOutSlowInInterpolator(); 23 | private int mAnimType; 24 | private boolean mIsAnimatingOut = false; 25 | private boolean isNestedScrollStoped=false; 26 | private String LOGTAG="====="; 27 | 28 | public ScrollAwareFABBehavior(Context context, AttributeSet attrs) { 29 | super(); 30 | } 31 | 32 | public ScrollAwareFABBehavior(int animType) { 33 | super(); 34 | mAnimType=animType; 35 | } 36 | 37 | @Override 38 | public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionButton child, View dependency) { 39 | Log.d(LOGTAG,"layoutDependsOn"); 40 | return super.layoutDependsOn(parent, child, dependency); 41 | } 42 | 43 | @Override 44 | public boolean onDependentViewChanged(CoordinatorLayout parent, FloatingActionButton child, View dependency) { 45 | Log.d(LOGTAG,"onDependentViewChanged"); 46 | return super.onDependentViewChanged(parent, child, dependency); 47 | } 48 | 49 | @Override 50 | public boolean onStartNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, 51 | final View directTargetChild, final View target, final int nestedScrollAxes) { 52 | // Ensure we react to vertical scrolling 53 | Log.d(LOGTAG,"onStartNestedScroll"); 54 | isNestedScrollStoped=false; 55 | return nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL 56 | || super.onStartNestedScroll(coordinatorLayout, child, directTargetChild, target, nestedScrollAxes); 57 | } 58 | 59 | @Override 60 | public void onNestedScroll(final CoordinatorLayout coordinatorLayout, final FloatingActionButton child, 61 | final View target, final int dxConsumed, final int dyConsumed, 62 | final int dxUnconsumed, final int dyUnconsumed) { 63 | super.onNestedScroll(coordinatorLayout, child, target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); 64 | Log.d(LOGTAG,"onNestedScroll"); 65 | if ( !this.mIsAnimatingOut && child.getVisibility() == View.VISIBLE) { 66 | // User scrolled down and the FAB is currently visible -> hide the FAB 67 | animateOut(child); 68 | } 69 | } 70 | 71 | @Override 72 | public void onStopNestedScroll(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target) { 73 | super.onStopNestedScroll(coordinatorLayout, child, target); 74 | Log.d(LOGTAG,"onStopNestedScroll"); 75 | if(mIsAnimatingOut){ 76 | isNestedScrollStoped=true; 77 | } 78 | else if( child.getVisibility() != View.VISIBLE){ 79 | animateIn(child); 80 | } 81 | } 82 | 83 | @Override 84 | public boolean blocksInteractionBelow(CoordinatorLayout parent, FloatingActionButton child) { 85 | Log.d(LOGTAG,"blocksInteractionBelow"); 86 | return super.blocksInteractionBelow(parent, child); 87 | } 88 | 89 | @Override 90 | public boolean onNestedFling(CoordinatorLayout coordinatorLayout, FloatingActionButton child, View target, float velocityX, float velocityY, boolean consumed) { 91 | Log.d(LOGTAG,"onNestedFling Y="+velocityY+" =consumed="+consumed); 92 | return super.onNestedFling(coordinatorLayout, child, target, velocityX, velocityY, consumed); 93 | } 94 | private ViewPropertyAnimatorListener animListner=new ViewPropertyAnimatorListener() { 95 | public void onAnimationStart(View view) { 96 | ScrollAwareFABBehavior.this.mIsAnimatingOut = true; 97 | } 98 | 99 | public void onAnimationCancel(View view) { 100 | ScrollAwareFABBehavior.this.mIsAnimatingOut = false; 101 | } 102 | 103 | public void onAnimationEnd(View view) { 104 | ScrollAwareFABBehavior.this.mIsAnimatingOut = false; 105 | view.setVisibility(View.GONE); 106 | if(isNestedScrollStoped&&view.getVisibility() != View.VISIBLE){ 107 | animateIn((FloatingActionButton)view); 108 | } 109 | } 110 | }; 111 | // Same animation that FloatingActionButton.Behavior uses to hide the FAB when the AppBarLayout exits 112 | private void animateOut(final FloatingActionButton button) { 113 | Log.d(LOGTAG,"animateOut"); 114 | if (Build.VERSION.SDK_INT >= 14) { 115 | if(mAnimType== Constants.SCALE) { 116 | ViewCompat.animate(button).scaleX(0.0F).scaleY(0.0F).alpha(0.0F).setInterpolator(INTERPOLATOR).withLayer() 117 | .setListener(animListner).start(); 118 | }else if(mAnimType==Constants.TRANSLATE){ 119 | ViewCompat.animate(button).translationY(100F).alpha(0.0F).setInterpolator(INTERPOLATOR).withLayer() 120 | .setListener(animListner).start(); 121 | } 122 | } else { 123 | Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_out); 124 | anim.setInterpolator(INTERPOLATOR); 125 | anim.setDuration(200L); 126 | anim.setAnimationListener(new Animation.AnimationListener() { 127 | public void onAnimationStart(Animation animation) { 128 | ScrollAwareFABBehavior.this.mIsAnimatingOut = true; 129 | } 130 | 131 | public void onAnimationEnd(Animation animation) { 132 | ScrollAwareFABBehavior.this.mIsAnimatingOut = false; 133 | button.setVisibility(View.GONE); 134 | } 135 | 136 | @Override 137 | public void onAnimationRepeat(final Animation animation) { 138 | } 139 | }); 140 | button.startAnimation(anim); 141 | } 142 | } 143 | 144 | // Same animation that FloatingActionButton.Behavior uses to show the FAB when the AppBarLayout enters 145 | private void animateIn(FloatingActionButton button) { 146 | Log.d(LOGTAG,"animateIn"); 147 | button.setVisibility(View.VISIBLE); 148 | if (Build.VERSION.SDK_INT >= 14) { 149 | if(mAnimType==Constants.SCALE) { 150 | ViewCompat.animate(button).scaleX(1.0F).scaleY(1.0F).alpha(1.0F) 151 | .setInterpolator(INTERPOLATOR).withLayer().setListener(null) 152 | .start(); 153 | } 154 | else if (mAnimType==Constants.TRANSLATE){ 155 | ViewCompat.animate(button).translationY(0F).alpha(1.0F) 156 | .setInterpolator(INTERPOLATOR).withLayer().setListener(null) 157 | .start(); 158 | } 159 | } else { 160 | if(mAnimType==Constants.SCALE) { 161 | Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.fab_in); 162 | anim.setDuration(200L); 163 | anim.setInterpolator(INTERPOLATOR); 164 | button.startAnimation(anim); 165 | } 166 | else if (mAnimType==Constants.TRANSLATE){ 167 | Animation anim = AnimationUtils.loadAnimation(button.getContext(), R.anim.snackbar_in); 168 | anim.setDuration(200L); 169 | anim.setInterpolator(INTERPOLATOR); 170 | button.startAnimation(anim); 171 | } 172 | 173 | } 174 | } 175 | } -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/behaviors/SlidingCardBehavior.java: -------------------------------------------------------------------------------- 1 | //package com.example.development.androidmsample.utils.behaviors; 2 | // 3 | //import android.support.design.widget.CoordinatorLayout; 4 | //import android.support.v4.view.ViewCompat; 5 | //import android.support.v4.widget.ScrollerCompat; 6 | //import android.view.View; 7 | // 8 | //import com.example.android.coordinatedeffort.widget.SlidingCardLayout; 9 | // 10 | ///** 11 | // * Complex custom behavior used to accomplish the following: 12 | // * - Lay out attached views in a staggered offset pattern 13 | // * - Capture scrolling events to drag/slide attached views 14 | // * - Shift sibling views as a result of movement in the captured view 15 | // */ 16 | //public class SlidingCardBehavior extends CoordinatorLayout.Behavior { 17 | // 18 | // private int mInitialOffset; 19 | // 20 | // private ScrollerCompat mScroller; 21 | // private FlingRunnable mFlingRunnable; 22 | // 23 | // public SlidingCardBehavior() { 24 | // } 25 | // 26 | // /* Sibling View Layout Methods */ 27 | // 28 | // @Override 29 | // public boolean onMeasureChild(CoordinatorLayout parent, SlidingCardLayout child, 30 | // int parentWidthMeasureSpec, int widthUsed, 31 | // int parentHeightMeasureSpec, int heightUsed) { 32 | // final int offset = getChildMeasureOffset(parent, child); 33 | // final int measuredHeight = View.MeasureSpec.getSize(parentHeightMeasureSpec) - heightUsed - offset; 34 | // int childMeasureSpec = View.MeasureSpec.makeMeasureSpec(measuredHeight, View.MeasureSpec.EXACTLY); 35 | // child.measure(parentWidthMeasureSpec, childMeasureSpec); 36 | // 37 | // return true; 38 | // } 39 | // 40 | // @Override 41 | // public boolean onLayoutChild(CoordinatorLayout parent, 42 | // SlidingCardLayout child, int layoutDirection) { 43 | // parent.onLayoutChild(child, layoutDirection); 44 | // 45 | // SlidingCardLayout previous = getPreviousChild(parent, child); 46 | // if (previous != null) { 47 | // int offset = previous.getTop() + previous.getHeaderHeight(); 48 | // child.offsetTopAndBottom(offset); 49 | // } 50 | // 51 | // mInitialOffset = child.getTop(); 52 | // return true; 53 | // } 54 | // 55 | // /* Scrolling View Handlers */ 56 | // 57 | // //Called before a nested scroll event. Return true to declare interest 58 | // @Override 59 | // public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, 60 | // SlidingCardLayout child, View directTargetChild, 61 | // View target, int nestedScrollAxes) { 62 | // //We have to declare interest in the scroll to receive further events 63 | // boolean isVertical = (nestedScrollAxes & ViewCompat.SCROLL_AXIS_VERTICAL) != 0; 64 | // //Only capture on the view currently being scrolled 65 | // return isVertical && child == directTargetChild; 66 | // } 67 | // 68 | // //Called before the scrolling child consumes the event 69 | // // We can steal all/part of the event by filling in the consumed array 70 | // @Override 71 | // public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, 72 | // SlidingCardLayout child, View target, 73 | // int dx, int dy, 74 | // int[] consumed) { 75 | // //When not at the top, consume all scrolling for the card 76 | // if (child.getTop() > mInitialOffset) { 77 | // //Tell the parent what we've consumed 78 | // consumed[1] = scroll(child, dy, 79 | // mInitialOffset, 80 | // mInitialOffset + child.getHeight() - child.getHeaderHeight()); 81 | // shiftSiblings(coordinatorLayout, child, consumed[1]); 82 | // } 83 | // } 84 | // 85 | // //Called after the scrolling child consumes the event, with amount consumed 86 | // @Override 87 | // public void onNestedScroll(CoordinatorLayout coordinatorLayout, 88 | // SlidingCardLayout child, View target, 89 | // int dxConsumed, int dyConsumed, 90 | // int dxUnconsumed, int dyUnconsumed) { 91 | // //Use any unconsumed distance to scroll the card layout 92 | // int shift = scroll(child, dyUnconsumed, 93 | // mInitialOffset, 94 | // mInitialOffset + child.getHeight() - child.getHeaderHeight()); 95 | // shiftSiblings(coordinatorLayout, child, shift); 96 | // } 97 | // 98 | // //Scroll the view and return back the actual distance scrolled 99 | // private int scroll(View child, int dy, int minOffset, int maxOffset) { 100 | // final int initialOffset = child.getTop(); 101 | // //Clamped new position - initial position = offset change 102 | // int delta = clamp(initialOffset - dy, minOffset, maxOffset) - initialOffset; 103 | // child.offsetTopAndBottom(delta); 104 | // 105 | // return -delta; 106 | // } 107 | // 108 | // private void shiftSiblings(CoordinatorLayout parent, SlidingCardLayout child, int shift) { 109 | // if (shift == 0) return; 110 | // 111 | // if (shift > 0) { 112 | // //Push siblings up if overlapping 113 | // SlidingCardLayout current = child; 114 | // SlidingCardLayout card = getPreviousChild(parent, current); 115 | // while (card != null) { 116 | // int delta = getHeaderOverlap(card, current); 117 | // if (delta > 0) { 118 | // card.offsetTopAndBottom(-delta); 119 | // } 120 | // 121 | // current = card; 122 | // card = getPreviousChild(parent, current); 123 | // } 124 | // } else { 125 | // //Push siblings down if overlapping 126 | // SlidingCardLayout current = child; 127 | // SlidingCardLayout card = getNextChild(parent, current); 128 | // while (card != null) { 129 | // int delta = getHeaderOverlap(current, card); 130 | // if (delta > 0) { 131 | // card.offsetTopAndBottom(delta); 132 | // } 133 | // 134 | // current = card; 135 | // card = getNextChild(parent, current); 136 | // } 137 | // } 138 | // } 139 | // 140 | // private int getHeaderOverlap(SlidingCardLayout above, SlidingCardLayout below) { 141 | // return (above.getTop() + above.getHeaderHeight()) - below.getTop(); 142 | // } 143 | // 144 | // /* Fling Scroll Handlers */ 145 | // 146 | // //Called before the scrolling child consumes the fling. 147 | // // We can steal the event here by returning true. 148 | // @Override 149 | // public boolean onNestedPreFling(CoordinatorLayout coordinatorLayout, 150 | // SlidingCardLayout child, View target, 151 | // float velocityX, float velocityY) { 152 | // if (child.getTop() > mInitialOffset) { 153 | // return fling(coordinatorLayout, 154 | // child, 155 | // mInitialOffset, 156 | // mInitialOffset + child.getHeight() - child.getHeaderHeight(), 157 | // -velocityY); 158 | // } 159 | // 160 | // return false; 161 | // } 162 | // 163 | // //Called after the scrolling child handles the fling 164 | // @Override 165 | // public boolean onNestedFling(CoordinatorLayout coordinatorLayout, 166 | // SlidingCardLayout child, View target, 167 | // float velocityX, float velocityY, boolean consumed) { 168 | // if (!consumed) { 169 | // return fling(coordinatorLayout, 170 | // child, 171 | // mInitialOffset, 172 | // mInitialOffset + child.getHeight() - child.getHeaderHeight(), 173 | // -velocityY); 174 | // } 175 | // 176 | // return false; 177 | // } 178 | // 179 | // //Attempt to fling and return if successfully started 180 | // private boolean fling(CoordinatorLayout parent, SlidingCardLayout layout, 181 | // int minOffset, int maxOffset, float velocityY) { 182 | // if (mFlingRunnable != null) { 183 | // layout.removeCallbacks(mFlingRunnable); 184 | // } 185 | // 186 | // if (mScroller == null) { 187 | // mScroller = ScrollerCompat.create(layout.getContext()); 188 | // } 189 | // 190 | // mScroller.fling( 191 | // 0, layout.getTop(), // curr 192 | // 0, Math.round(velocityY), // velocity. 193 | // 0, 0, // x 194 | // minOffset, maxOffset); // y 195 | // 196 | // if (mScroller.computeScrollOffset()) { 197 | // mFlingRunnable = new FlingRunnable(parent, layout); 198 | // ViewCompat.postOnAnimation(layout, mFlingRunnable); 199 | // return true; 200 | // } else { 201 | // mFlingRunnable = null; 202 | // return false; 203 | // } 204 | // } 205 | // 206 | // private class FlingRunnable implements Runnable { 207 | // private final CoordinatorLayout mParent; 208 | // private final SlidingCardLayout mLayout; 209 | // 210 | // FlingRunnable(CoordinatorLayout parent, SlidingCardLayout layout) { 211 | // mParent = parent; 212 | // mLayout = layout; 213 | // } 214 | // 215 | // @Override 216 | // public void run() { 217 | // if (mLayout != null && mScroller != null && mScroller.computeScrollOffset()) { 218 | // int delta = mScroller.getCurrY() - mLayout.getTop(); 219 | // mLayout.offsetTopAndBottom(delta); 220 | // shiftSiblings(mParent, mLayout, -delta); 221 | // 222 | // // Post ourselves so that we run on the next animation 223 | // ViewCompat.postOnAnimation(mLayout, this); 224 | // } 225 | // } 226 | // } 227 | // 228 | // /* Helper Methods */ 229 | // 230 | // private int clamp(int value, int min, int max) { 231 | // if (value > max) { 232 | // return max; 233 | // } else if (value < min) { 234 | // return min; 235 | // } else { 236 | // return value; 237 | // } 238 | // } 239 | // 240 | // private SlidingCardLayout getPreviousChild(CoordinatorLayout parent, View child) { 241 | // int cardIndex = parent.indexOfChild(child); 242 | // for (int i = cardIndex - 1; i >= 0; i--) { 243 | // View v = parent.getChildAt(i); 244 | // if (v instanceof SlidingCardLayout) { 245 | // return (SlidingCardLayout) v; 246 | // } 247 | // } 248 | // 249 | // return null; 250 | // } 251 | // 252 | // private SlidingCardLayout getNextChild(CoordinatorLayout parent, View child) { 253 | // int cardIndex = parent.indexOfChild(child); 254 | // for (int i = cardIndex + 1; i < parent.getChildCount(); i++) { 255 | // View v = parent.getChildAt(i); 256 | // if (v instanceof SlidingCardLayout) { 257 | // return (SlidingCardLayout) v; 258 | // } 259 | // } 260 | // 261 | // return null; 262 | // } 263 | // 264 | // private int getChildMeasureOffset(CoordinatorLayout parent, View child) { 265 | // //Offset is the sum of all header heights except the target 266 | // int offset = 0; 267 | // for (int i=0; i < parent.getChildCount(); i++) { 268 | // View view = parent.getChildAt(i); 269 | // if (view != child && view instanceof SlidingCardLayout) { 270 | // offset += ((SlidingCardLayout) view).getHeaderHeight(); 271 | // } 272 | // } 273 | // 274 | // return offset; 275 | // } 276 | //} 277 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/helper/ItemTouchHelperAdapter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Paul Burke 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.example.development.androidmsample.utils.helper; 18 | 19 | import android.support.v7.widget.RecyclerView; 20 | import android.support.v7.widget.helper.ItemTouchHelper; 21 | 22 | /** 23 | * Interface to listen for a move or dismissal event from a {@link ItemTouchHelper.Callback}. 24 | * 25 | * @author Paul Burke (ipaulpro) 26 | */ 27 | public interface ItemTouchHelperAdapter { 28 | 29 | /** 30 | * Called when an item has been dragged far enough to trigger a move. This is called every time 31 | * an item is shifted, and not at the end of a "drop" event.
32 | *
33 | * Implementations should call {@link RecyclerView.Adapter#notifyItemMoved(int, int)} after 34 | * adjusting the underlying data to reflect this move. 35 | * 36 | * @param fromPosition The start position of the moved item. 37 | * @param toPosition Then resolved position of the moved item. 38 | * 39 | * @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder) 40 | * @see RecyclerView.ViewHolder#getAdapterPosition() 41 | */ 42 | void onItemMove(int fromPosition, int toPosition); 43 | 44 | 45 | /** 46 | * Called when an item has been dismissed by a swipe.
47 | *
48 | * Implementations should call {@link RecyclerView.Adapter#notifyItemRemoved(int)} after 49 | * adjusting the underlying data to reflect this removal. 50 | * 51 | * @param position The position of the item dismissed. 52 | * 53 | * @see RecyclerView#getAdapterPositionFor(RecyclerView.ViewHolder) 54 | * @see RecyclerView.ViewHolder#getAdapterPosition() 55 | */ 56 | void onItemDismiss(int position); 57 | } 58 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/helper/ItemTouchHelperViewHolder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Paul Burke 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.example.development.androidmsample.utils.helper; 18 | 19 | import android.support.v7.widget.helper.ItemTouchHelper; 20 | 21 | /** 22 | * Interface to notify an item ViewHolder of relevant callbacks from {@link 23 | * android.support.v7.widget.helper.ItemTouchHelper.Callback}. 24 | * 25 | * @author Paul Burke (ipaulpro) 26 | */ 27 | public interface ItemTouchHelperViewHolder { 28 | 29 | /** 30 | * Called when the {@link ItemTouchHelper} first registers an item as being moved or swiped. 31 | * Implementations should update the item view to indicate it's active state. 32 | */ 33 | void onItemSelected(); 34 | 35 | 36 | /** 37 | * Called when the {@link ItemTouchHelper} has completed the move or swipe, and the active item 38 | * state should be cleared. 39 | */ 40 | void onItemClear(); 41 | } 42 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/helper/SimpleItemTouchHelperCallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2015 Paul Burke 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.example.development.androidmsample.utils.helper; 18 | 19 | import android.graphics.Canvas; 20 | import android.support.v7.widget.RecyclerView; 21 | import android.support.v7.widget.helper.ItemTouchHelper; 22 | import android.view.View; 23 | 24 | /** 25 | * An implementation of {@link ItemTouchHelper.Callback} that enables basic drag & drop and 26 | * swipe-to-dismiss. Drag events are automatically started by an item long-press.
27 | *
28 | * Expects the RecyclerView.Adapter to listen for {@link 29 | * ItemTouchHelperAdapter} callbacks and the RecyclerView.ViewHolder to implement 30 | * {@link ItemTouchHelperViewHolder}. 31 | * 32 | * @author Paul Burke (ipaulpro) 33 | */ 34 | public class SimpleItemTouchHelperCallback extends ItemTouchHelper.Callback { 35 | 36 | public static final float ALPHA_FULL = 1.0f; 37 | 38 | private final ItemTouchHelperAdapter mAdapter; 39 | 40 | public SimpleItemTouchHelperCallback(ItemTouchHelperAdapter adapter) { 41 | mAdapter = adapter; 42 | } 43 | 44 | @Override 45 | public boolean isLongPressDragEnabled() { 46 | return true; 47 | } 48 | 49 | @Override 50 | public boolean isItemViewSwipeEnabled() { 51 | return true; 52 | } 53 | 54 | @Override 55 | public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { 56 | // Enable drag and swipe in both directions 57 | final int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN; 58 | final int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END; 59 | return makeMovementFlags(dragFlags, swipeFlags); 60 | } 61 | 62 | @Override 63 | public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder source, RecyclerView.ViewHolder target) { 64 | if (source.getItemViewType() != target.getItemViewType()) { 65 | return false; 66 | } 67 | 68 | // Notify the adapter of the move 69 | mAdapter.onItemMove(source.getAdapterPosition(), target.getAdapterPosition()); 70 | return true; 71 | } 72 | 73 | @Override 74 | public void onSwiped(RecyclerView.ViewHolder viewHolder, int i) { 75 | // Notify the adapter of the dismissal 76 | mAdapter.onItemDismiss(viewHolder.getAdapterPosition()); 77 | } 78 | 79 | @Override 80 | public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) { 81 | super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive); 82 | 83 | // Fade out the view as it is swiped out of the parent's bounds 84 | if (actionState == ItemTouchHelper.ACTION_STATE_SWIPE) { 85 | View itemView = viewHolder.itemView; 86 | final float alpha = ALPHA_FULL - Math.abs(dX) / (float) itemView.getWidth(); 87 | itemView.setAlpha(alpha); 88 | } 89 | } 90 | 91 | @Override 92 | public void onSelectedChanged(RecyclerView.ViewHolder viewHolder, int actionState) { 93 | if (actionState != ItemTouchHelper.ACTION_STATE_IDLE) { 94 | // Let the view holder know that this item is being moved or dragged 95 | ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder; 96 | itemViewHolder.onItemSelected(); 97 | } 98 | 99 | super.onSelectedChanged(viewHolder, actionState); 100 | } 101 | 102 | @Override 103 | public void clearView(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) { 104 | super.clearView(recyclerView, viewHolder); 105 | 106 | viewHolder.itemView.setAlpha(ALPHA_FULL); 107 | 108 | // Tell the view holder it's time to restore the idle state 109 | ItemTouchHelperViewHolder itemViewHolder = (ItemTouchHelperViewHolder) viewHolder; 110 | itemViewHolder.onItemClear(); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/widget/FooterBarLayout.java: -------------------------------------------------------------------------------- 1 | package com.example.development.androidmsample.utils.widget; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.CoordinatorLayout; 5 | import android.util.AttributeSet; 6 | import android.widget.FrameLayout; 7 | 8 | import com.example.development.androidmsample.utils.behaviors.FooterBarBehavior; 9 | 10 | /** 11 | * Simple FrameLayout container extension that applies the FooterBarBehavior 12 | * as the default. 13 | */ 14 | @CoordinatorLayout.DefaultBehavior(FooterBarBehavior.class) 15 | public class FooterBarLayout extends FrameLayout { 16 | public FooterBarLayout(Context context) { 17 | super(context); 18 | } 19 | 20 | public FooterBarLayout(Context context, AttributeSet attrs) { 21 | super(context, attrs); 22 | } 23 | 24 | public FooterBarLayout(Context context, AttributeSet attrs, int defStyleAttr) { 25 | super(context, attrs, defStyleAttr); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /app/src/main/java/com/example/development/androidmsample/utils/widget/SlidingCardLayout.java: -------------------------------------------------------------------------------- 1 | //package com.example.development.androidmsample.utils.widget; 2 | // 3 | //import android.content.Context; 4 | //import android.content.res.TypedArray; 5 | //import android.graphics.Color; 6 | //import android.support.design.widget.CoordinatorLayout; 7 | //import android.support.v7.widget.LinearLayoutManager; 8 | //import android.support.v7.widget.RecyclerView; 9 | //import android.util.AttributeSet; 10 | //import android.view.LayoutInflater; 11 | //import android.widget.FrameLayout; 12 | //import android.widget.TextView; 13 | // 14 | //import com.example.android.coordinatedeffort.R; 15 | //import com.example.android.coordinatedeffort.SimpleAdapter; 16 | //import com.example.android.coordinatedeffort.behaviors.SlidingCardBehavior; 17 | // 18 | ///** 19 | // * Custom container to centralize the common logic for the sliding 20 | // * card views. Includes state accessors that the behavior will 21 | // * access to properly do a layout pass. 22 | // */ 23 | // 24 | //@CoordinatorLayout.DefaultBehavior(SlidingCardBehavior.class) 25 | //public class SlidingCardLayout extends FrameLayout { 26 | // 27 | // private int mHeaderViewHeight; 28 | // 29 | // public SlidingCardLayout(Context context) { 30 | // this(context, null); 31 | // } 32 | // 33 | // public SlidingCardLayout(Context context, AttributeSet attrs) { 34 | // this(context, attrs, 0); 35 | // } 36 | // 37 | // public SlidingCardLayout(Context context, AttributeSet attrs, int defStyleAttr) { 38 | // super(context, attrs, defStyleAttr); 39 | // 40 | // LayoutInflater.from(context).inflate(R.layout.widget_card, this); 41 | // 42 | // RecyclerView list = (RecyclerView) findViewById(R.id.list); 43 | // TextView header = (TextView) findViewById(R.id.header); 44 | // 45 | // SimpleAdapter adapter = new SimpleAdapter(list); 46 | // list.setAdapter(adapter); 47 | // list.setLayoutManager(new LinearLayoutManager(getContext())); 48 | // 49 | // TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.SlidingCardLayout, defStyleAttr, 0); 50 | // header.setBackgroundColor(a.getColor(R.styleable.SlidingCardLayout_android_colorBackground, Color.BLACK)); 51 | // header.setText(a.getText(R.styleable.SlidingCardLayout_android_text)); 52 | // a.recycle(); 53 | // } 54 | // 55 | // @Override 56 | // protected void onSizeChanged(int w, int h, int oldw, int oldh) { 57 | // if (w != oldw || h != oldh) { 58 | // mHeaderViewHeight = findViewById(R.id.header).getMeasuredHeight(); 59 | // } 60 | // } 61 | // 62 | // public int getHeaderHeight() { 63 | // return mHeaderViewHeight; 64 | // } 65 | //} 66 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fab_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 22 | 23 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/anim/fab_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 22 | 23 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/anim/snackbar_in.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/anim/snackbar_out.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/default_bg.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/default_bg.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/gradient.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_action_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_reorder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_action_reorder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_action_tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_action_tick.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_layers_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_layers_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_plus_one_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_plus_one_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_tab_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-hdpi/ic_tab_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-ldpi/ic_action_tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-ldpi/ic_action_tick.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_action_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_reorder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_action_reorder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_action_tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_action_tick.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_layers_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_layers_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_plus_one_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_plus_one_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_tab_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-mdpi/ic_tab_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_action_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_reorder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_action_reorder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_action_tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_action_tick.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_layers_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_layers_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_plus_one_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_plus_one_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_tab_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xhdpi/ic_tab_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_action_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_reorder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_action_reorder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_action_tick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_action_tick.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_android.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_email.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_email.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_folder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_layers_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_layers_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_location.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_menu.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_phone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_phone.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_plus_one_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_plus_one_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_tab_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxhdpi/ic_tab_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxxhdpi/ic_action_done.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_action_reorder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxxhdpi/ic_action_reorder.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_layers_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxxhdpi/ic_layers_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_plus_one_black_18dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxxhdpi/ic_plus_one_black_18dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_tab_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable-xxxhdpi/ic_tab_black_24dp.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/BlackPanther.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/BlackPanther.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/activated_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/aquaman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/aquaman.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/avatar.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/avatar.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b1.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b10.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b11.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b11.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b2.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b3.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b4.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b5.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b6.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b7.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b7.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b8.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b8.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/b9.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/b9.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/backgrounds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/backgrounds.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/barryallen.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/barryallen.jpeg -------------------------------------------------------------------------------- /app/src/main/res/drawable/batman.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/batman.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/captainamerica.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/captainamerica.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/daredevil.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/daredevil.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/dickgrayson.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/dickgrayson.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/donatello.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/donatello.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/greenarrow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/greenarrow.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/halJordan.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/halJordan.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/hercules.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/hercules.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/humantorch.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/humantorch.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/invisiblewoman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/invisiblewoman.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/ironman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/ironman.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/kylerayner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/kylerayner.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/leonardo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/leonardo.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/martinmanhunter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/martinmanhunter.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/michelangelo.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/michelangelo.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/mrFantatstic.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/mrFantatstic.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/orion.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/orion.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/raphael.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/raphael.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/silversurfer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/silversurfer.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/spiderman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/spiderman.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/superboy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/superboy.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/supergirl.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/supergirl.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/superman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/superman.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/supersurfer.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/supersurfer.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/thing.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/thing.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/thor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/thor.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/timdrake.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/timdrake.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/wallywest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/wallywest.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/wolverine.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/wolverine.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable/wonderwoman.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/drawable/wonderwoman.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 13 | 14 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/layout/collapsing_toolbar_with_image.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 10 | 11 | 20 | 21 | 22 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 46 | 47 | 52 | 53 | 57 | 58 | 62 | 63 | 68 | 69 | 73 | 74 | 75 | 76 | 77 | 78 | 84 | 85 | 89 | 90 | 95 | 96 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 112 | 116 | 117 | 122 | 123 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 144 | -------------------------------------------------------------------------------- /app/src/main/res/layout/coordinator_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 12 | 13 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/layout/drawer_header.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 18 | 22 | 28 | 34 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fab_action.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 10 | 21 | 22 | 30 | 31 | 39 | 40 | 45 | 46 | 47 | 54 | 55 | 62 | 63 | 70 | 71 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /app/src/main/res/layout/footer_bar_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 40 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /app/src/main/res/layout/percent_relative_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 31 | 32 | 40 | 41 | 49 | 50 | 58 | 59 | 66 | 67 | 75 | 76 | 85 | 86 | 94 | 95 | 104 | 105 | 113 | 114 | 123 | 124 | 132 | 133 | 142 | 143 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /app/src/main/res/layout/sample_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /app/src/main/res/layout/sample_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 19 | 20 | 26 | 27 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/tab_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | 22 | 23 | 26 | 27 | 28 | 29 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 11 | 12 | 16 | 17 | 22 | 23 | 24 | 25 | 26 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/menu/drawer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 13 | 17 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/menu/tablayout_menu.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/menu/toolbar_menu.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 11 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/res/values-w820dp/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 64dp 6 | 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #9C27B0 4 | #7B1FA2 5 | #E1BEE7 6 | #FFC107 7 | #212121 8 | #727272 9 | #FFFFFF 10 | #B6B6B6 11 | #FFFFFF 12 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 16dp 6 | 16dp 7 | 256dp 8 | 56dp 9 | 40dp 10 | 11 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AndroidMSample 3 | 4 | Hello world! 5 | Settings 6 | 7 | 8 | Design Support library 9 | FloatingActionButton 10 | TabLayout 11 | ToolbarLayout 12 | AppBarLayout 13 | CollapsingToolbarLayout 14 | Snackbar 15 | NavigationView 16 | PercentRelativeLayout 17 | FooterQuickReturn 18 | 19 | 20 | Everyone has gone through some sort of struggle in their lives. 21 | Everyone has fears. Conquering them is what matters. 22 | It\'s okay if she doesn\'t love you back. Being there for that special person is what matters the most. 23 | Have your own values and morals. It defines you as a person. 24 | Everyone wears a mask. We only remove them in front of our loved ones. 25 | There will always be someone who hasn\'t given up on you. Don\'t let them down, and never back down. Ever. 26 | How will you learn to rise if you never fall? 27 | Enemies are a necessity. You keep fighting, you keep learning. It helps you grow. 28 | The climb might be steep, but you have to start somewhere. 29 | In the end, there\'s always a way out. 30 | May the spirit of Batman live on within you, forever. 31 | 32 | 33 | 34 | Superman 35 | Batman 36 | Spider-Man 37 | Thor 38 | Hal Jordan 39 | Wonder Woman 40 | Captian America 41 | Martian Manhunter 42 | Dick Grayson 43 | Thing 44 | Human Torch 45 | Mr Fantastic 46 | Invisible Woman 47 | Wally West 48 | Kyle Rayner 49 | Superboy 50 | Leonardo 51 | Raphale 52 | Donatello 53 | Michelangelo 54 | Silver Surfer 55 | Aquaman 56 | Green Arrow 57 | Barry Allen 58 | Tim Drake 59 | Supergirl 60 | Iron Man 61 | Hercules 62 | Daredevil 63 | Orion 64 | Black Panther 65 | Wolverine 66 | 67 | 68 | 69 | 70 | Jarlsberg lancashire edam. Dolcelatte hard cheese brie st. agur blue 71 | cheese caerphilly bavarian bergkase cheese and biscuits mascarpone. Cheeseburger swiss bavarian 72 | bergkase cream cheese fromage frais cheesy feet port-salut airedale. St. agur blue cheese rubber 73 | cheese caerphilly cheddar cheesecake cream cheese manchego lancashire. Roquefort squirty cheese 74 | the big cheese. 75 | Toolbar scroll 76 | Toolbar Pin 77 | Toolbar scroll enteralways 78 | Pin Tab on scroll 79 | UnPin Tab on scroll 80 | FAB Scale 81 | FAB Translate 82 | FAB Rotate 83 | 84 | 85 | scroll+enteralways 86 | scroll+enteralways 87 | scroll+enteralways+enteralwasyscollapsed 88 | 89 | 90 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 23 | 24 | 28 | 35 | 36 | 37 | 40 | 41 | 44 | 45 | 48 | 52 | 53 | 57 | 58 | 62 | 63 | 67 | 68 | 69 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 05 00:06:54 GMT+05:30 2015 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-2.4-all.zip 7 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /screenshots/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/screenshots/1.png -------------------------------------------------------------------------------- /screenshots/Demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shekaroppo/AndroidMSamples/bec41933ff9c735a9264a37c1aae63a3e57a6ad3/screenshots/Demo.gif -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | --------------------------------------------------------------------------------