├── .gitignore ├── LICENSE ├── README.md ├── allagi ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── hari │ │ └── allagi │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── hari │ │ │ └── allagi │ │ │ ├── Allagi.java │ │ │ ├── AllagiUtils.java │ │ │ ├── CustomPagerAdapter.java │ │ │ ├── CustomTabLayout.java │ │ │ ├── CustomTabLayoutText.java │ │ │ ├── MenuListActivity.java │ │ │ ├── ScrollableMenuActivity.java │ │ │ └── ScrollableMenuRecyclerViewAdapter.java │ └── res │ │ ├── drawable │ │ └── back_navigation.xml │ │ ├── layout │ │ ├── activity_menu_list.xml │ │ ├── activity_scrollable_menu.xml │ │ ├── menu_list_item.xml │ │ └── tab.xml │ │ └── values │ │ ├── colors.xml │ │ └── strings.xml │ └── test │ └── java │ └── hari │ └── allagi │ └── ExampleUnitTest.java ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── hari │ │ └── allagisample │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── hari │ │ │ └── allagisample │ │ │ ├── MainActivity.java │ │ │ └── SampleFragment.java │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ ├── events.png │ │ ├── guest_lectures.png │ │ ├── human_library.png │ │ ├── ic_launcher_background.xml │ │ ├── map.png │ │ ├── profile.png │ │ ├── schedule.png │ │ ├── upcoming.png │ │ └── visualise.png │ │ ├── layout │ │ ├── activity_main.xml │ │ └── fragment_sample.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ └── test │ └── java │ └── hari │ └── allagisample │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | 11 | # IntelliJ IDEA 12 | .idea 13 | *.iml 14 | *.ipl 15 | *.iws 16 | classes/ 17 | idea-classes/ 18 | coverage-error.log 19 | 20 | # Android 21 | gen 22 | bin 23 | project.properties 24 | out -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Google-NewsStand-Animation-Android 2 | 3 | Navigation pattern like in Google News Stand app with transitions 4 | 5 | [![Android Arsenal](https://img.shields.io/badge/Android%20Arsenal-Google%20NewsStand%20Animation%20Android-brightgreen.svg?style=flat)](https://android-arsenal.com/details/1/7154) 6 | 7 | ![Screenshots](https://media.giphy.com/media/wa9LB3wev3QYkNUh7N/giphy.gif) 8 | 9 | # Getting Started 10 |

In your build.gradle

11 | 12 | ```groovy 13 | dependencies { 14 | implementation 'hari.allagi:allagi:0.1.1' 15 | //or in lower versions: 16 | //compile 'hari.allagi:allagi:0.1.1' 17 | } 18 | ``` 19 |

Usage

20 | 21 | Choose one of the **NoActionBar** themes to use in `MenuListActivity` and override it to define your app color palette. 22 | 23 | ```xml 24 | 29 | ``` 30 | 31 | Define the colors for `ScrollableMenuActivity` too. 32 | 33 | ```xml 34 | 39 | ``` 40 | 41 | Declare the **Allagi** activities in `AndroidManifest.xml` file using your new app themes. 42 | 43 | ```xml 44 | 47 | 50 | ``` 51 | 52 | Set largeHeap to true in `AndroidManifest.xml`. 53 | 54 | ```xml 55 | 58 | ``` 59 | 60 | Open **Allagi** from a activity like so: 61 | 62 | ```java 63 | ArrayList menuList = new ArrayList<>(); //menu titles 64 | ArrayList imagesList = new ArrayList<>(); //menu backgrounds 65 | ArrayList fragmentsList = new ArrayList<>(); //fragments for each menu headers in second activity 66 | 67 | menuList.add("UPCOMING"); //add titles 68 | menuList.add("EVENTS"); //limit to 8 items for the animation to work 69 | ... 70 | 71 | imagesList.add(R.drawable.upcoming); //add background images 72 | imagesList.add(R.drawable.events); 73 | ... 74 | 75 | fragmentsList.add(UpcomingFragment.newInstance()); //add fragment instances 76 | fragmentsList.add(EventsFragment.newInstance()); 77 | ... 78 | 79 | Allagi allagi = Allagi.initialize(MainActivity.this, menuList, imagesList, fragmentsList); 80 | allagi.start(); //start the menu list activity 81 | ``` 82 | 83 | Change the duration of the animation: 84 | 85 | ```java 86 | allagi.setTransitionDuration(900); //default value is 1000 milliseconds 87 | ``` 88 | 89 | ## Libraries used in the project 90 | 91 | * [Jake Wharton's ViewPagerIndicator](https://github.com/JakeWharton/ViewPagerIndicator) Paging indicator widget that highlights the selected page of the viewpager 92 | 93 | ## Credits 94 | Inspired by and thanks to [Aurélien Salomon's Google Newsstand Navigation Pattern](https://dribbble.com/shots/2940231-Google-Newsstand-Navigation-Pattern) 95 | 96 | ## Show your support 97 | 98 | Give a :star: if this project helped you! 99 | 100 | ## License 101 | 102 | Copyright :copyright: 2018 [Hariprasanth S](https://github.com/hariprasanths) 103 | 104 | This project is licensed under [the Apache License, Version 2.0](https://github.com/hariprasanths/GoogleNewsStandAnimation-Android/blob/master/LICENSE) 105 |
You may also obtain a copy of the License at 106 | 107 | http://www.apache.org/licenses/LICENSE-2.0 -------------------------------------------------------------------------------- /allagi/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /allagi/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | ext { 4 | bintrayRepo = 'maven' 5 | bintrayName = 'allagi' 6 | 7 | publishedGroupId = 'hari.allagi' 8 | libraryName = 'GoogleNewsStandAnimation-Android' 9 | artifact = 'allagi' 10 | 11 | libraryDescription = 'Navigation pattern like in Google News Stand App with transitions' 12 | 13 | siteUrl = 'https://github.com/hariprasanths/GoogleNewsStandAnimation-Android' 14 | gitUrl = 'https://github.com/hariprasanths/GoogleNewsStandAnimation-Android.git' 15 | 16 | libraryVersion = '0.1.1' 17 | 18 | developerId = 'hariprasanths' 19 | developerName = 'Hariprasanth S' 20 | developerEmail = 'shhariprasanth@gmail.com' 21 | 22 | licenseName = 'The Apache Software License, Version 2.0' 23 | licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt' 24 | allLicenses = ["Apache-2.0"] 25 | } 26 | 27 | android { 28 | compileSdkVersion 29 29 | 30 | defaultConfig { 31 | minSdkVersion 15 32 | targetSdkVersion 29 33 | versionCode 1 34 | versionName "1.0" 35 | 36 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 37 | 38 | } 39 | 40 | buildTypes { 41 | release { 42 | minifyEnabled false 43 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 44 | } 45 | } 46 | 47 | } 48 | 49 | dependencies { 50 | implementation fileTree(dir: 'libs', include: ['*.jar']) 51 | 52 | implementation 'androidx.appcompat:appcompat:1.1.0' 53 | implementation 'com.google.android.material:material:1.1.0' 54 | implementation "com.github.JakeWharton:ViewPagerIndicator:2.4.1" 55 | testImplementation 'junit:junit:4.12' 56 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 57 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 58 | } 59 | 60 | apply plugin: 'com.github.dcendents.android-maven' 61 | 62 | group = publishedGroupId // Maven Group ID for the artifact 63 | 64 | install { 65 | repositories.mavenInstaller { 66 | // This generates POM.xml with proper parameters 67 | pom { 68 | project { 69 | packaging 'aar' 70 | groupId publishedGroupId 71 | artifactId artifact 72 | 73 | // Add your description here 74 | name libraryName 75 | description libraryDescription 76 | url siteUrl 77 | 78 | // Set your license 79 | licenses { 80 | license { 81 | name licenseName 82 | url licenseUrl 83 | } 84 | } 85 | developers { 86 | developer { 87 | id developerId 88 | name developerName 89 | email developerEmail 90 | } 91 | } 92 | scm { 93 | connection gitUrl 94 | developerConnection gitUrl 95 | url siteUrl 96 | 97 | } 98 | } 99 | } 100 | } 101 | } 102 | 103 | apply plugin: 'com.jfrog.bintray' 104 | 105 | version = libraryVersion 106 | 107 | if (project.hasProperty("android")) { // Android libraries 108 | task sourcesJar(type: Jar) { 109 | classifier = 'sources' 110 | from android.sourceSets.main.java.srcDirs 111 | } 112 | 113 | task javadoc(type: Javadoc) { 114 | source = android.sourceSets.main.java.srcDirs 115 | classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) 116 | } 117 | } else { // Java libraries 118 | task sourcesJar(type: Jar, dependsOn: classes) { 119 | classifier = 'sources' 120 | from sourceSets.main.allSource 121 | } 122 | } 123 | 124 | task javadocJar(type: Jar, dependsOn: javadoc) { 125 | classifier = 'javadoc' 126 | from javadoc.destinationDir 127 | } 128 | 129 | artifacts { 130 | archives javadocJar 131 | archives sourcesJar 132 | } 133 | 134 | // Bintray 135 | Properties properties = new Properties() 136 | properties.load(project.rootProject.file('local.properties').newDataInputStream()) 137 | 138 | bintray { 139 | user = properties.getProperty("bintray.user") 140 | key = properties.getProperty("bintray.apikey") 141 | 142 | configurations = ['archives'] 143 | pkg { 144 | repo = bintrayRepo 145 | name = bintrayName 146 | desc = libraryDescription 147 | websiteUrl = siteUrl 148 | vcsUrl = gitUrl 149 | licenses = allLicenses 150 | publish = true 151 | publicDownloadNumbers = true 152 | version { 153 | desc = libraryDescription 154 | gpg { 155 | sign = true //Determines whether to GPG sign the files. The default is false 156 | passphrase = properties.getProperty("bintray.gpg.password") 157 | //Optional. The passphrase for GPG signing' 158 | } 159 | } 160 | } 161 | } 162 | -------------------------------------------------------------------------------- /allagi/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /allagi/src/androidTest/java/hari/allagi/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("hari.allagi.test", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /allagi/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /allagi/src/main/java/hari/allagi/Allagi.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import android.app.Activity; 4 | import androidx.annotation.NonNull; 5 | import androidx.fragment.app.Fragment; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by hari on 15/4/18. 12 | */ 13 | 14 | public class Allagi { 15 | 16 | static List fragments; 17 | private Activity activity; 18 | private List list = new ArrayList<>(); 19 | private List imagesList = new ArrayList<>(); 20 | static long transitionDuration = 1000; 21 | 22 | private Allagi(@NonNull Activity activity, List list, 23 | List imagesList, List fragmentsList) { 24 | this.activity = activity; 25 | this.list = list; 26 | this.imagesList = imagesList; 27 | fragments = fragmentsList; 28 | } 29 | 30 | public static Allagi initialize(@NonNull Activity activity, List list, 31 | List imagesList, List fragmentsList) { 32 | return new Allagi(activity, list, imagesList, fragmentsList); 33 | } 34 | 35 | public static List getFragments() { 36 | return fragments; 37 | } 38 | 39 | public void start() { 40 | activity.finish(); 41 | MenuListActivity.startActivity(activity, list, imagesList); 42 | } 43 | 44 | public void setTransitionDuration(long milliSeconds) { 45 | transitionDuration = milliSeconds; 46 | } 47 | 48 | public static long getTransitionDuration() { 49 | return transitionDuration; 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /allagi/src/main/java/hari/allagi/AllagiUtils.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import android.content.Context; 4 | import android.content.res.Resources; 5 | import android.graphics.Point; 6 | import android.util.DisplayMetrics; 7 | import android.util.TypedValue; 8 | import android.view.Display; 9 | import android.view.WindowManager; 10 | 11 | /** 12 | * Created by hari on 19/4/18. 13 | */ 14 | 15 | public class AllagiUtils { 16 | 17 | private static final int WIDTH_INDEX = 0; 18 | private static final int HEIGHT_INDEX = 1; 19 | 20 | public static int[] getScreenSize(Context context) { 21 | int[] widthHeight = new int[2]; 22 | widthHeight[WIDTH_INDEX] = 0; 23 | widthHeight[HEIGHT_INDEX] = 0; 24 | 25 | WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 26 | Display display = windowManager.getDefaultDisplay(); 27 | 28 | Point size = new Point(); 29 | display.getSize(size); 30 | widthHeight[WIDTH_INDEX] = size.x; 31 | widthHeight[HEIGHT_INDEX] = size.y; 32 | 33 | if (!isScreenSizeRetrieved(widthHeight)) { 34 | DisplayMetrics metrics = new DisplayMetrics(); 35 | display.getMetrics(metrics); 36 | widthHeight[0] = metrics.widthPixels; 37 | widthHeight[1] = metrics.heightPixels; 38 | } 39 | 40 | if (!isScreenSizeRetrieved(widthHeight)) { 41 | widthHeight[0] = display.getWidth(); 42 | widthHeight[1] = display.getHeight(); 43 | } 44 | 45 | return widthHeight; 46 | } 47 | 48 | private static boolean isScreenSizeRetrieved(int[] widthHeight) { 49 | return widthHeight[WIDTH_INDEX] != 0 && widthHeight[HEIGHT_INDEX] != 0; 50 | } 51 | 52 | public static int getLineWidth(Context context) { 53 | WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); 54 | Display display = windowManager.getDefaultDisplay(); 55 | 56 | Point size = new Point(); 57 | display.getSize(size); 58 | int width = size.x; 59 | width = (((width * 8) / 10) - 70) / 8; 60 | return width; 61 | } 62 | 63 | public static double getViewItemsCount(Context context) { 64 | 65 | Resources r = context.getResources(); 66 | float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 50, r.getDisplayMetrics()); 67 | float itemHeight = ((AllagiUtils.getScreenSize(context)[0] - px) / 2); 68 | int screenHeight = AllagiUtils.getScreenSize(context)[1]; 69 | double itemCount = Math.floor(screenHeight / itemHeight); 70 | return itemCount; 71 | } 72 | 73 | public static int getThemeAccentColor(final Context context) { 74 | final TypedValue value = new TypedValue(); 75 | context.getTheme().resolveAttribute(R.attr.colorAccent, value, true); 76 | return value.data; 77 | } 78 | 79 | public static int getThemePrimaryColor(final Context context) { 80 | final TypedValue value = new TypedValue(); 81 | context.getTheme().resolveAttribute(R.attr.colorPrimary, value, true); 82 | return value.data; 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /allagi/src/main/java/hari/allagi/CustomPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import androidx.fragment.app.Fragment; 4 | import androidx.fragment.app.FragmentManager; 5 | import androidx.fragment.app.FragmentPagerAdapter; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | /** 11 | * Created by hari on 19/4/18. 12 | */ 13 | 14 | public class CustomPagerAdapter extends FragmentPagerAdapter { 15 | 16 | private List mFragments; 17 | private List mFragmentTitles; 18 | 19 | public CustomPagerAdapter(FragmentManager fm) { 20 | super(fm); 21 | mFragments = new ArrayList<>(); 22 | mFragmentTitles = new ArrayList<>(); 23 | } 24 | 25 | public void addFragment(Fragment fragment, String title) { 26 | mFragments.add(fragment); 27 | mFragmentTitles.add(title); 28 | } 29 | 30 | public void addFragmentsList(List fragments, List titles) { 31 | mFragments = fragments; 32 | mFragmentTitles = titles; 33 | } 34 | 35 | @Override 36 | public Fragment getItem(int position) { 37 | return mFragments.get(position); 38 | } 39 | 40 | @Override 41 | public int getCount() { 42 | return mFragments.size(); 43 | } 44 | 45 | @Override 46 | public CharSequence getPageTitle(int position) { 47 | return mFragmentTitles.get(position); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /allagi/src/main/java/hari/allagi/CustomTabLayout.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import android.content.Context; 4 | import com.google.android.material.tabs.TabLayout; 5 | import android.util.AttributeSet; 6 | 7 | import java.lang.reflect.Field; 8 | 9 | /** 10 | * Created by hari on 15/4/18. 11 | */ 12 | 13 | public class CustomTabLayout extends TabLayout { 14 | 15 | int screenWidth = 1080; 16 | 17 | public CustomTabLayout(Context context) { 18 | super(context); 19 | screenWidth = AllagiUtils.getScreenSize(context)[0]; 20 | initTabMinWidth(); 21 | } 22 | 23 | public CustomTabLayout(Context context, AttributeSet attrs) { 24 | super(context, attrs); 25 | screenWidth = AllagiUtils.getScreenSize(context)[0]; 26 | initTabMinWidth(); 27 | } 28 | 29 | public CustomTabLayout(Context context, AttributeSet attrs, int defStyleAttr) { 30 | super(context, attrs, defStyleAttr); 31 | screenWidth = AllagiUtils.getScreenSize(context)[0]; 32 | initTabMinWidth(); 33 | } 34 | 35 | private void initTabMinWidth() { 36 | 37 | Field field; 38 | try { 39 | field = TabLayout.class.getDeclaredField("scrollableTabMinWidth"); 40 | field.setAccessible(true); 41 | field.set(this, screenWidth); 42 | } catch (NoSuchFieldException e) { 43 | e.printStackTrace(); 44 | } catch (IllegalAccessException e) { 45 | e.printStackTrace(); 46 | } 47 | Field field2; 48 | try { 49 | field2 = TabLayout.class.getDeclaredField("requestedTabMaxWidth"); 50 | field2.setAccessible(true); 51 | field2.set(this, screenWidth); 52 | } catch (NoSuchFieldException e) { 53 | e.printStackTrace(); 54 | } catch (IllegalAccessException e) { 55 | e.printStackTrace(); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /allagi/src/main/java/hari/allagi/CustomTabLayoutText.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import android.content.Context; 4 | 5 | import com.google.android.material.tabs.TabLayout; 6 | import android.util.AttributeSet; 7 | 8 | import java.lang.reflect.Field; 9 | 10 | /** 11 | * Created by hari on 15/4/18. 12 | */ 13 | 14 | public class CustomTabLayoutText extends TabLayout { 15 | 16 | int screenWidth = 1080; 17 | 18 | public CustomTabLayoutText(Context context) { 19 | super(context); 20 | screenWidth = AllagiUtils.getScreenSize(context)[0]; 21 | initTabMinWidth(); 22 | } 23 | 24 | public CustomTabLayoutText(Context context, AttributeSet attrs) { 25 | super(context, attrs); 26 | screenWidth = AllagiUtils.getScreenSize(context)[0]; 27 | initTabMinWidth(); 28 | } 29 | 30 | public CustomTabLayoutText(Context context, AttributeSet attrs, int defStyleAttr) { 31 | super(context, attrs, defStyleAttr); 32 | screenWidth = AllagiUtils.getScreenSize(context)[0]; 33 | initTabMinWidth(); 34 | } 35 | 36 | private void initTabMinWidth() { 37 | 38 | Field field; 39 | try { 40 | field = TabLayout.class.getDeclaredField("scrollableTabMinWidth"); 41 | field.setAccessible(true); 42 | field.set(this, screenWidth); 43 | } catch (NoSuchFieldException e) { 44 | e.printStackTrace(); 45 | } catch (IllegalAccessException e) { 46 | e.printStackTrace(); 47 | } 48 | Field field2; 49 | try { 50 | field2 = TabLayout.class.getDeclaredField("requestedTabMaxWidth"); 51 | field2.setAccessible(true); 52 | field2.set(this, screenWidth); 53 | } catch (NoSuchFieldException e) { 54 | e.printStackTrace(); 55 | } catch (IllegalAccessException e) { 56 | e.printStackTrace(); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /allagi/src/main/java/hari/allagi/MenuListActivity.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import android.app.Activity; 4 | import android.content.Intent; 5 | import android.os.Build; 6 | import android.os.Bundle; 7 | import androidx.annotation.NonNull; 8 | import androidx.core.app.ActivityOptionsCompat; 9 | import androidx.core.util.Pair; 10 | import androidx.appcompat.app.AppCompatActivity; 11 | import androidx.recyclerview.widget.LinearLayoutManager; 12 | import androidx.recyclerview.widget.RecyclerView; 13 | import android.view.View; 14 | import android.view.ViewTreeObserver; 15 | 16 | import java.util.ArrayList; 17 | import java.util.List; 18 | 19 | /** 20 | * Created by hari on 15/4/18. 21 | */ 22 | 23 | public class MenuListActivity extends AppCompatActivity { 24 | 25 | RecyclerView recyclerView; 26 | ScrollableMenuRecyclerViewAdapter adapter; 27 | List list = new ArrayList<>(); 28 | List imagesList = new ArrayList<>(); 29 | 30 | boolean clickable = true; 31 | boolean firstTime = true; 32 | 33 | public static void startActivity(@NonNull Activity activity, 34 | List list, 35 | List imagesList) { 36 | Intent intent = new Intent(activity, MenuListActivity.class); 37 | intent.putStringArrayListExtra("list", (ArrayList) list); 38 | intent.putIntegerArrayListExtra("imagesList", (ArrayList) imagesList); 39 | activity.startActivity(intent); 40 | } 41 | 42 | @Override 43 | protected void onResume() { 44 | super.onResume(); 45 | } 46 | 47 | @Override 48 | protected void onCreate(Bundle savedInstanceState) { 49 | super.onCreate(savedInstanceState); 50 | setContentView(R.layout.activity_menu_list); 51 | 52 | recyclerView = findViewById(R.id.recycler_view); 53 | 54 | clickable = true; 55 | 56 | if (recyclerView != null && firstTime) { 57 | firstTime = false; 58 | list = getIntent().getStringArrayListExtra("list"); 59 | imagesList = getIntent().getIntegerArrayListExtra("imagesList"); 60 | adapter = new ScrollableMenuRecyclerViewAdapter(this, list, imagesList); 61 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 62 | recyclerView.setAdapter(adapter); 63 | recyclerView.smoothScrollToPosition(list.size() - 1); 64 | recyclerView.setHasFixedSize(true); 65 | } 66 | 67 | adapter.setOnClickListener(new ScrollableMenuRecyclerViewAdapter.OnClickListener() { 68 | @Override 69 | public void onClick(View view, int position, Pair[] pairs) { 70 | 71 | if (!clickable) { 72 | return; 73 | } 74 | 75 | clickable = false; 76 | 77 | System.gc(); 78 | 79 | Intent intent = new Intent(MenuListActivity.this, ScrollableMenuActivity.class); 80 | intent.putExtra("viewPagerInitialPosition", position); 81 | intent.putStringArrayListExtra("list", (ArrayList) list); 82 | intent.putIntegerArrayListExtra("imagesList", (ArrayList) imagesList); 83 | 84 | 85 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN && (list.size() <= 8)) { 86 | 87 | ActivityOptionsCompat options = ActivityOptionsCompat.makeSceneTransitionAnimation( 88 | MenuListActivity.this, pairs); 89 | startActivity(intent, options.toBundle()); 90 | } else { 91 | startActivity(intent); 92 | } 93 | } 94 | 95 | @Override 96 | public void scrollCallback(double pos) { 97 | recyclerView.smoothScrollToPosition(0); 98 | } 99 | 100 | }); 101 | 102 | } 103 | 104 | @Override 105 | public void onActivityReenter(int resultCode, Intent data) { 106 | 107 | clickable = true; 108 | 109 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 110 | postponeEnterTransition(); 111 | } 112 | 113 | final int position = ScrollableMenuActivity.getPosition(resultCode, data); 114 | 115 | if (position != -1) { 116 | recyclerView.scrollToPosition(position); 117 | } 118 | 119 | recyclerView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() { 120 | @Override 121 | public boolean onPreDraw() { 122 | recyclerView.getViewTreeObserver().removeOnPreDrawListener(this); 123 | 124 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 125 | startPostponedEnterTransition(); 126 | } 127 | return true; 128 | } 129 | }); 130 | 131 | } 132 | 133 | @Override 134 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { 135 | 136 | clickable = true; 137 | 138 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { 139 | 140 | onActivityReenter(resultCode, data); 141 | 142 | } else { 143 | super.onActivityResult(requestCode, resultCode, data); 144 | } 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /allagi/src/main/java/hari/allagi/ScrollableMenuActivity.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import android.content.Intent; 4 | import android.os.Build; 5 | import android.os.Bundle; 6 | import androidx.coordinatorlayout.widget.CoordinatorLayout; 7 | import com.google.android.material.tabs.TabLayout; 8 | import androidx.fragment.app.Fragment; 9 | import androidx.core.app.SharedElementCallback; 10 | import androidx.viewpager.widget.ViewPager; 11 | import androidx.appcompat.app.ActionBar; 12 | import androidx.appcompat.app.AppCompatActivity; 13 | import androidx.appcompat.widget.Toolbar; 14 | import android.transition.ChangeBounds; 15 | import android.view.GestureDetector; 16 | import android.view.LayoutInflater; 17 | import android.view.MotionEvent; 18 | import android.view.View; 19 | import android.view.ViewGroup; 20 | import android.view.animation.AlphaAnimation; 21 | import android.view.animation.TranslateAnimation; 22 | import android.widget.ImageButton; 23 | import android.widget.TextView; 24 | 25 | import com.viewpagerindicator.LinePageIndicator; 26 | 27 | import java.util.ArrayList; 28 | import java.util.List; 29 | 30 | /** 31 | * Created by hari on 15/4/18. 32 | */ 33 | 34 | public class ScrollableMenuActivity extends AppCompatActivity { 35 | 36 | private static final int SWIPE_THRESHOLD = 50; 37 | private static final int SWIPE_VELOCITY_THRESHOLD = 50; 38 | private static final int COLOR_TRUE_WHITE = -1; 39 | private static final int COLOR_GRADIENT_WHITE = -1275068417; 40 | private static final int STROKE_WIDTH = 5; 41 | private static final int STROKE_GAP = 10; 42 | 43 | CoordinatorLayout coordinatorLayout; 44 | int viewPagerInitialPosition = 0; 45 | ViewPager viewPager; 46 | CustomTabLayout tabLayout; 47 | CustomTabLayoutText tabLayoutText; 48 | LinePageIndicator linePageIndicator; 49 | List list = new ArrayList<>(); 50 | List imagesList = new ArrayList<>(); 51 | List fragmentsList = new ArrayList<>(); 52 | long transitionDuration = 1000; 53 | ImageButton backButton; 54 | View view; 55 | GestureDetector gestureDetector; 56 | boolean isSlideUp = false; 57 | 58 | public static int getPosition(int resultCode, Intent data) { 59 | if (resultCode == RESULT_OK && data != null && data.hasExtra("currentPosition")) { 60 | return data.getIntExtra("currentPosition", -1); 61 | } 62 | return -1; 63 | } 64 | 65 | @Override 66 | protected void onCreate(Bundle savedInstanceState) { 67 | super.onCreate(savedInstanceState); 68 | setContentView(R.layout.activity_scrollable_menu); 69 | 70 | isSlideUp = false; 71 | System.gc(); 72 | 73 | coordinatorLayout = findViewById(R.id.coordinatorLayout); 74 | backButton = findViewById(R.id.back_navigation_button); 75 | view = findViewById(R.id.view); 76 | Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); 77 | viewPager = (ViewPager) findViewById(R.id.viewpager); 78 | tabLayout = findViewById(R.id.tabs); 79 | tabLayoutText = findViewById(R.id.tabsText); 80 | linePageIndicator = (LinePageIndicator) findViewById(R.id.titles); 81 | 82 | setSupportActionBar(toolbar); 83 | 84 | final ActionBar ab = getSupportActionBar(); 85 | ab.setDisplayHomeAsUpEnabled(true); 86 | ab.setTitle(""); 87 | 88 | viewPagerInitialPosition = getIntent().getIntExtra("viewPagerInitialPosition", 0); 89 | list = getIntent().getStringArrayListExtra("list"); 90 | imagesList = getIntent().getIntegerArrayListExtra("imagesList"); 91 | 92 | fragmentsList = Allagi.getFragments(); 93 | transitionDuration = Allagi.getTransitionDuration(); 94 | 95 | if (viewPager != null) { 96 | setupViewPager(viewPager); 97 | } 98 | 99 | tabLayout.setupWithViewPager(viewPager); 100 | tabLayoutText.setupWithViewPager(viewPager); 101 | 102 | setUpLinePageIndicator(); 103 | 104 | onTouchTabLayout(); 105 | 106 | registerGestureDetector(); 107 | 108 | backButton.setOnClickListener(new View.OnClickListener() { 109 | @Override 110 | public void onClick(View v) { 111 | onBackPressed(); 112 | } 113 | }); 114 | 115 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 116 | postponeEnterTransition(); 117 | } 118 | 119 | initializeTabs(); 120 | 121 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 122 | getWindow().setSharedElementEnterTransition(new ChangeBounds().setDuration(transitionDuration)); 123 | startPostponedEnterTransition(); 124 | setSharedElementCallback(); 125 | } 126 | 127 | } 128 | 129 | @Override 130 | public void finish() { 131 | setResult(); 132 | super.finish(); 133 | } 134 | 135 | @Override 136 | public void finishAfterTransition() { 137 | setResult(); 138 | super.finishAfterTransition(); 139 | } 140 | 141 | @Override 142 | public void onBackPressed() { 143 | setResult(); 144 | super.onBackPressed(); 145 | } 146 | 147 | private void setResult() { 148 | 149 | slideDownView(viewPager); 150 | fadeOutView(linePageIndicator); 151 | fadeOutView(backButton); 152 | 153 | int position = viewPager.getCurrentItem(); 154 | Intent data = new Intent(); 155 | data.putExtra("currentPosition", position); 156 | setResult(RESULT_OK, data); 157 | } 158 | 159 | private void onTouchTabLayout() { 160 | tabLayout.setOnTouchListener(new View.OnTouchListener() { 161 | @Override 162 | public boolean onTouch(View view, MotionEvent motionEvent) { 163 | return true; 164 | } 165 | }); 166 | 167 | tabLayoutText.setOnTouchListener(new View.OnTouchListener() { 168 | @Override 169 | public boolean onTouch(View view, MotionEvent motionEvent) { 170 | return false; 171 | } 172 | }); 173 | 174 | view.setOnTouchListener(new View.OnTouchListener() { 175 | @Override 176 | public boolean onTouch(View v, MotionEvent event) { 177 | gestureDetector.onTouchEvent(event); 178 | return true; 179 | } 180 | }); 181 | } 182 | 183 | private void registerGestureDetector() { 184 | gestureDetector = new GestureDetector(ScrollableMenuActivity.this, new GestureDetector.SimpleOnGestureListener() { 185 | 186 | @Override 187 | public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { 188 | boolean result = false; 189 | try { 190 | float diffY = e2.getY() - e1.getY(); 191 | float diffX = e2.getX() - e1.getX(); 192 | if (Math.abs(diffX) > Math.abs(diffY)) { 193 | if (Math.abs(diffX) > SWIPE_THRESHOLD && Math.abs(velocityX) > SWIPE_VELOCITY_THRESHOLD) { 194 | if (diffX > 0) { 195 | viewPager.setCurrentItem(viewPager.getCurrentItem() - 1); 196 | } else { 197 | viewPager.setCurrentItem(viewPager.getCurrentItem() + 1); 198 | } 199 | result = true; 200 | } 201 | } else if (Math.abs(diffY) > SWIPE_THRESHOLD && Math.abs(velocityY) > SWIPE_VELOCITY_THRESHOLD) { 202 | if (diffY > 0) { 203 | } else { 204 | } 205 | result = true; 206 | } 207 | } catch (Exception exception) { 208 | exception.printStackTrace(); 209 | } 210 | return result; 211 | } 212 | }); 213 | } 214 | 215 | private void setUpLinePageIndicator() { 216 | 217 | linePageIndicator.setViewPager(viewPager); 218 | 219 | linePageIndicator.setStrokeWidth(STROKE_WIDTH); 220 | linePageIndicator.setLineWidth(AllagiUtils.getLineWidth(getApplicationContext())); 221 | linePageIndicator.setGapWidth(STROKE_GAP); 222 | linePageIndicator.setSelectedColor(COLOR_TRUE_WHITE); 223 | linePageIndicator.setCurrentItem(viewPager.getCurrentItem()); 224 | 225 | viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() { 226 | @Override 227 | public void onPageSelected(int arg0) { 228 | linePageIndicator.onPageSelected(arg0); 229 | } 230 | 231 | @Override 232 | public void onPageScrolled(int arg0, float arg1, int arg2) { 233 | linePageIndicator.onPageScrolled(arg0, arg1, arg2); 234 | } 235 | 236 | @Override 237 | public void onPageScrollStateChanged(int arg0) { 238 | linePageIndicator.onPageScrollStateChanged(arg0); 239 | } 240 | }); 241 | } 242 | 243 | private void setupViewPager(ViewPager viewPager) { 244 | 245 | CustomPagerAdapter adapter = new CustomPagerAdapter(getSupportFragmentManager()); 246 | 247 | adapter.addFragmentsList(fragmentsList, list); 248 | 249 | viewPager.setAdapter(adapter); 250 | viewPager.setCurrentItem(viewPagerInitialPosition, true); 251 | } 252 | 253 | private void initializeTabs() { 254 | for (int i = 0; i < tabLayout.getTabCount(); i++) { 255 | TabLayout.Tab tab = tabLayout.getTabAt(i); 256 | TabLayout.Tab tabText = tabLayoutText.getTabAt(i); 257 | View tabView = ((ViewGroup) tabLayout.getChildAt(0)).getChildAt(i); 258 | View tabViewText = ((ViewGroup) tabLayoutText.getChildAt(0)).getChildAt(i); 259 | 260 | tabView.requestLayout(); 261 | tabViewText.requestLayout(); 262 | 263 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { 264 | 265 | tabView.setBackgroundResource(imagesList.get(i)); 266 | 267 | } else 268 | tabView.setBackgroundColor(AllagiUtils.getThemePrimaryColor(getApplicationContext())); 269 | 270 | View view = LayoutInflater.from(this).inflate(R.layout.tab, null); 271 | TextView iv = view.findViewById(R.id.imageView); 272 | iv.setText(list.get(i)); 273 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 274 | iv.setTransitionName("text" + i); 275 | } 276 | tabText.setCustomView(view); 277 | 278 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 279 | tabView.setTransitionName("image" + i); 280 | } 281 | tab.setText(""); 282 | } 283 | 284 | } 285 | 286 | private void setSharedElementCallback() { 287 | setEnterSharedElementCallback(new SharedElementCallback() { 288 | @Override 289 | public void onSharedElementStart(List sharedElementNames, List sharedElements, List sharedElementSnapshots) { 290 | 291 | if (!isSlideUp) { 292 | slideUpView(viewPager); 293 | fadeInView(linePageIndicator); 294 | fadeInView(backButton); 295 | isSlideUp = true; 296 | } 297 | 298 | super.onSharedElementStart(sharedElementNames, sharedElements, sharedElementSnapshots); 299 | } 300 | 301 | @Override 302 | public void onSharedElementEnd(List sharedElementNames, List sharedElements, List sharedElementSnapshots) { 303 | super.onSharedElementEnd(sharedElementNames, sharedElements, sharedElementSnapshots); 304 | } 305 | }); 306 | } 307 | 308 | private void slideUpView(View view) { 309 | view.setVisibility(View.VISIBLE); 310 | TranslateAnimation animate = new TranslateAnimation( 311 | 0, 312 | 0, 313 | view.getHeight(), 314 | 0); 315 | animate.setDuration(transitionDuration); 316 | animate.setFillAfter(true); 317 | view.startAnimation(animate); 318 | } 319 | 320 | private void slideDownView(View view) { 321 | TranslateAnimation animate = new TranslateAnimation( 322 | 0, 323 | 0, 324 | 0, 325 | view.getHeight()); 326 | animate.setDuration(transitionDuration); 327 | animate.setFillAfter(true); 328 | view.startAnimation(animate); 329 | } 330 | 331 | private void fadeInView(View view) { 332 | AlphaAnimation anim = new AlphaAnimation(0.0f, 1.0f); 333 | anim.setDuration(transitionDuration); 334 | view.startAnimation(anim); 335 | } 336 | 337 | private void fadeOutView(View view) { 338 | AlphaAnimation anim = new AlphaAnimation(1.0f, 0.0f); 339 | anim.setDuration(transitionDuration); 340 | view.startAnimation(anim); 341 | } 342 | 343 | } -------------------------------------------------------------------------------- /allagi/src/main/java/hari/allagi/ScrollableMenuRecyclerViewAdapter.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import android.content.Context; 4 | import android.os.Build; 5 | import androidx.core.util.Pair; 6 | import androidx.core.view.ViewCompat; 7 | import androidx.recyclerview.widget.RecyclerView; 8 | import android.view.LayoutInflater; 9 | import android.view.View; 10 | import android.view.ViewGroup; 11 | import android.widget.ImageView; 12 | import android.widget.RelativeLayout; 13 | import android.widget.TextView; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | /** 19 | * Created by hari on 15/4/18. 20 | */ 21 | 22 | public class ScrollableMenuRecyclerViewAdapter extends RecyclerView.Adapter{ 23 | Context context; 24 | List menus; 25 | List menusImages; 26 | OnClickListener onClickListener; 27 | List> values; 28 | double itemCount = 4; 29 | 30 | public ScrollableMenuRecyclerViewAdapter(Context context, List list, List imagesList) { 31 | this.context = context; 32 | this.menus = list; 33 | values = new ArrayList<>(); 34 | itemCount = AllagiUtils.getViewItemsCount(context); 35 | this.menusImages = imagesList; 36 | } 37 | 38 | public void setOnClickListener(OnClickListener onClickListener){ 39 | this.onClickListener = onClickListener; 40 | } 41 | 42 | @Override 43 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 44 | View view = LayoutInflater.from(context).inflate(R.layout.menu_list_item,parent,false); 45 | return new ViewHolder(view); 46 | } 47 | 48 | @Override 49 | public void onBindViewHolder(ViewHolder holder, final int position) { 50 | 51 | holder.listItem.setOnClickListener(new View.OnClickListener() { 52 | @Override 53 | public void onClick(View view) { 54 | Pair[] result = new Pair[values.size()]; 55 | values.toArray(result); 56 | onClickListener.onClick(view, position, result); 57 | } 58 | }); 59 | holder.textView.setText(menus.get(position)); 60 | 61 | holder.imageView.setBackgroundResource(menusImages.get(position)); 62 | 63 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { 64 | holder.imageView.setTransitionName("image" + position); 65 | holder.textView.setTransitionName("text" + position); 66 | 67 | if(!values.contains(Pair.create((View) holder.imageView, ViewCompat.getTransitionName(holder.imageView)))) 68 | values.add(Pair.create((View) holder.imageView, ViewCompat.getTransitionName(holder.imageView))); 69 | if(!values.contains(Pair.create((View) holder.textView, ViewCompat.getTransitionName(holder.textView)))) 70 | values.add(Pair.create((View) holder.textView, ViewCompat.getTransitionName(holder.textView))); 71 | 72 | if(values.size() == 8) 73 | { 74 | onClickListener.scrollCallback(position - itemCount); 75 | } 76 | } 77 | } 78 | 79 | @Override 80 | public int getItemCount() { 81 | return menus.size(); 82 | } 83 | 84 | public class ViewHolder extends RecyclerView.ViewHolder { 85 | 86 | RelativeLayout listItem; 87 | ImageView imageView; 88 | TextView textView; 89 | 90 | public ViewHolder(View view) { 91 | super(view); 92 | 93 | listItem = view.findViewById(R.id.relative_layout_list_item); 94 | textView = view.findViewById(R.id.text_view_list_item); 95 | imageView = view.findViewById(R.id.image_view_list_item); 96 | 97 | } 98 | } 99 | 100 | public interface OnClickListener{ 101 | void onClick(View view, int position, Pair[] pairs); 102 | void scrollCallback(double position); 103 | } 104 | 105 | } -------------------------------------------------------------------------------- /allagi/src/main/res/drawable/back_navigation.xml: -------------------------------------------------------------------------------- 1 | 6 | 9 | 10 | -------------------------------------------------------------------------------- /allagi/src/main/res/layout/activity_menu_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /allagi/src/main/res/layout/activity_scrollable_menu.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 15 | 16 | 25 | 26 | 34 | 35 | 41 | 42 | 52 | 53 | 65 | 66 | 70 | 71 | 79 | 80 | 81 | 82 | 83 | 84 | 90 | 91 | 92 | 93 | 98 | 99 | 109 | 110 | -------------------------------------------------------------------------------- /allagi/src/main/res/layout/menu_list_item.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 30 | -------------------------------------------------------------------------------- /allagi/src/main/res/layout/tab.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 18 | 19 | -------------------------------------------------------------------------------- /allagi/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #232A43 4 | #0E1424 5 | #45B9E9 6 | 7 | 8 | #000000 9 | #ffffff 10 | #424242 11 | #bdbdbd 12 | #e0e0e0 13 | #808080 14 | #d3272727 15 | #00ffffff 16 | #0B141F 17 | 18 | 19 | -------------------------------------------------------------------------------- /allagi/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | allagi 3 | 4 | -------------------------------------------------------------------------------- /allagi/src/test/java/hari/allagi/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package hari.allagi; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 29 5 | defaultConfig { 6 | applicationId "hari.allagi" 7 | minSdkVersion 15 8 | targetSdkVersion 29 9 | versionCode 1 10 | versionName "1.0" 11 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | implementation fileTree(dir: 'libs', include: ['*.jar']) 23 | implementation 'androidx.appcompat:appcompat:1.1.0' 24 | testImplementation 'junit:junit:4.12' 25 | androidTestImplementation 'androidx.test.ext:junit:1.1.1' 26 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' 27 | implementation project(':allagi') 28 | } 29 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /app/src/androidTest/java/hari/allagisample/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package hari.allagisample; 2 | 3 | import android.content.Context; 4 | import androidx.test.platform.app.InstrumentationRegistry; 5 | import androidx.test.ext.junit.runners.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("hari.allagi", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 27 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /app/src/main/java/hari/allagisample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package hari.allagisample; 2 | 3 | import androidx.fragment.app.Fragment; 4 | import androidx.appcompat.app.AppCompatActivity; 5 | import android.os.Bundle; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | import hari.allagi.Allagi; 11 | 12 | public class MainActivity extends AppCompatActivity { 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | 19 | List menuList = new ArrayList<>(); //menu titles 20 | List imagesList = new ArrayList<>(); //menu backgrounds 21 | List fragmentsList = new ArrayList<>(); //fragments for each menu headers in second activity 22 | 23 | menuList.add("UPCOMING"); //add titles 24 | menuList.add("EVENTS"); 25 | menuList.add("GUEST LECTURES"); 26 | menuList.add("SCHEDULE"); 27 | menuList.add("PROFILE"); 28 | menuList.add("MAP"); 29 | menuList.add("VISUALIZE"); 30 | menuList.add("HUMAN LIBRARY"); 31 | 32 | imagesList.add(R.drawable.upcoming); //add background images 33 | imagesList.add(R.drawable.events); 34 | imagesList.add(R.drawable.guest_lectures); 35 | imagesList.add(R.drawable.schedule); 36 | imagesList.add(R.drawable.profile); 37 | imagesList.add(R.drawable.map); 38 | imagesList.add(R.drawable.visualise); 39 | imagesList.add(R.drawable.human_library); 40 | 41 | fragmentsList.add(SampleFragment.newInstance("Upcoming fragment")); //add fragment instances 42 | fragmentsList.add(SampleFragment.newInstance("Events fragment")); 43 | fragmentsList.add(SampleFragment.newInstance("Guest lectures fragment")); 44 | fragmentsList.add(SampleFragment.newInstance("Schedule fragment")); 45 | fragmentsList.add(SampleFragment.newInstance("Profile fragment")); 46 | fragmentsList.add(SampleFragment.newInstance("Map fragment")); 47 | fragmentsList.add(SampleFragment.newInstance("Visualize fragment")); 48 | fragmentsList.add(SampleFragment.newInstance("Human library fragment")); 49 | 50 | Allagi allagi = Allagi.initialize(MainActivity.this, menuList, imagesList, fragmentsList); 51 | allagi.start(); //start the menu list activity 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /app/src/main/java/hari/allagisample/SampleFragment.java: -------------------------------------------------------------------------------- 1 | package hari.allagisample; 2 | 3 | import android.content.Context; 4 | import android.os.Bundle; 5 | import androidx.fragment.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | import android.widget.TextView; 10 | 11 | public class SampleFragment extends Fragment{ 12 | 13 | Context context; 14 | TextView titleView; 15 | 16 | public SampleFragment() { 17 | super(); 18 | } 19 | 20 | @Override 21 | public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 22 | 23 | View view = inflater.inflate(R.layout.fragment_sample, container, false); 24 | String title = "Fragment"; 25 | if (getArguments() != null) { 26 | title = getArguments().getString("title"); 27 | } 28 | titleView = view.findViewById(R.id.fragmentTitle); 29 | titleView.setText(title); 30 | return view; 31 | } 32 | 33 | public static SampleFragment newInstance(String title) { 34 | 35 | Bundle args = new Bundle(); 36 | args.putString("title", title); 37 | SampleFragment fragment = new SampleFragment(); 38 | fragment.setArguments(args); 39 | return fragment; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/drawable/events.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/guest_lectures.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/drawable/guest_lectures.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/human_library.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/drawable/human_library.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/drawable/map.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/profile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/drawable/profile.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/schedule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/drawable/schedule.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/upcoming.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/drawable/upcoming.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/visualise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/drawable/visualise.png -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_sample.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 12 | 13 | 18 | 27 | 28 | 29 | 38 | 39 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #232A43 4 | #0E1424 5 | #45B9E9 6 | 7 | 8 | #000000 9 | #ffffff 10 | #424242 11 | #bdbdbd 12 | #e0e0e0 13 | #808080 14 | #d3272727 15 | #00ffffff 16 | #0B141F 17 | 18 | 19 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | GoogleNewsStandAnimation-Android 3 | 4 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 16 | 17 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/test/java/hari/allagisample/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package hari.allagisample; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | 5 | repositories { 6 | google() 7 | jcenter() 8 | } 9 | dependencies { 10 | classpath 'com.android.tools.build:gradle:3.5.3' 11 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' 12 | classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' 13 | 14 | 15 | // NOTE: Do not place your application dependencies here; they belong 16 | // in the individual module build.gradle files 17 | } 18 | } 19 | 20 | allprojects { 21 | repositories { 22 | google() 23 | jcenter() 24 | } 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /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 | android.enableJetifier=true 13 | android.useAndroidX=true 14 | org.gradle.jvmargs=-Xmx1536m 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hariprasanths/GoogleNewsStandAnimation-Android/57dbac2dd8d8e123c086a95aba0000262390bc06/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon May 18 11:37:17 IST 2020 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-5.4.1-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 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app', ':allagi' 2 | --------------------------------------------------------------------------------