Repository: Commit451/ElasticDragDismissLayout Branch: main Commit: 47e82d9246d0 Files: 49 Total size: 96.9 KB Directory structure: gitextract_9oxfyu4l/ ├── .gitignore ├── .travis.yml ├── LICENSE.txt ├── README.md ├── app/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── commit451/ │ │ └── elasticdragdismisslayout/ │ │ └── sample/ │ │ ├── Cheese.java │ │ ├── CheeseAdapter.java │ │ ├── CheeseViewHolder.java │ │ ├── Cheeses.java │ │ ├── ColorUtils.java │ │ ├── DetailActivity.java │ │ ├── DetailRecyclerViewActivity.java │ │ ├── MainActivity.java │ │ └── SystemChromeFader.java │ └── res/ │ ├── drawable/ │ │ ├── ic_arrow_back_24dp.xml │ │ └── ic_favorite_24dp.xml │ ├── layout/ │ │ ├── activity_detail.xml │ │ ├── activity_detail_recyclerview.xml │ │ ├── activity_main.xml │ │ ├── item_cheese.xml │ │ └── viewholder_game.xml │ ├── menu/ │ │ └── main.xml │ ├── transition/ │ │ └── about_return_downward.xml │ └── values/ │ ├── colors.xml │ ├── dimens.xml │ ├── ids.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── elasticdragdismisslayout/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ └── main/ │ ├── AndroidManifest.xml │ ├── java/ │ │ └── com/ │ │ └── commit451/ │ │ └── elasticdragdismisslayout/ │ │ ├── ElasticDragDismissCallback.java │ │ ├── ElasticDragDismissDelegate.java │ │ ├── ElasticDragDismissFrameLayout.java │ │ ├── ElasticDragDismissLinearLayout.java │ │ ├── ElasticDragDismissRelativeLayout.java │ │ └── Util.java │ └── res/ │ └── values/ │ └── attrs_drag_dismissables.xml ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat └── settings.gradle ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Created by https://www.gitignore.io ### Android ### # Files for the Dalvik VM *.dex # Java class files *.class # Generated files bin/ gen/ # Gradle files .gradle/ build/ # Local configuration file (sdk path, etc) local.properties # Proguard folder generated by Eclipse proguard/ # Log Files *.log ### Intellij ### # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm *.iml ## Directory-based project format: .idea/ # if you remove the above rule, at least ignore the following: # User-specific stuff: # .idea/workspace.xml # .idea/tasks.xml # .idea/dictionaries # Sensitive or high-churn files: # .idea/dataSources.ids # .idea/dataSources.xml # .idea/sqlDataSources.xml # .idea/dynamic.xml # .idea/uiDesigner.xml # Gradle: # .idea/gradle.xml # .idea/libraries # Mongo Explorer plugin: # .idea/mongoSettings.xml ## File-based project format: *.ipr *.iws ## Plugin-specific files: # IntelliJ out/ # mpeltonen/sbt-idea plugin .idea_modules/ # JIRA plugin atlassian-ide-plugin.xml # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml # Ignore Gradle GUI config gradle-app.setting # Mobile Tools for Java (J2ME) .mtj.tmp/ # Package Files # *.war *.ear # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* *.DS_Store ================================================ FILE: .travis.yml ================================================ language: android jdk: - oraclejdk8 android: components: - tools - platform-tools before_install: - mkdir "$ANDROID_HOME/licenses" || true - echo "d56f5187479451eabf01fb78af6dfcb131a6481e\n24333f8a63b6825ea9c5514f83c2829b004d1fee" > "$ANDROID_HOME/licenses/android-sdk-license" - yes | sdkmanager tools - chmod +x gradlew script: "./gradlew build" ================================================ FILE: LICENSE.txt ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ # ElasticDragDismissLayout Standard ViewGroups which responds to nested scrolls to create drag-dismissable layouts. Original code taken from [Plaid](https://github.com/nickbutcher/plaid) and made backwards compatible. [![Build Status](https://travis-ci.org/Commit451/ElasticDragDismissLayout.svg?branch=master)](https://travis-ci.org/Commit451/ElasticDragDismissLayout) [![](https://jitpack.io/v/Commit451/ElasticDragDismissLayout.svg)](https://jitpack.io/#Commit451/ElasticDragDismissLayout) # Gradle Dependency Add this in your root `build.gradle` file (**not** your module `build.gradle` file): ```gradle allprojects { repositories { ... maven { url "https://jitpack.io" } } } ``` Then, add the library to your project `build.gradle` ```gradle dependencies { implementation 'com.github.Commit451:ElasticDragDismissLayout:1.0.4' } ``` # Usage See the sample project for a full example. Within XML: ```xml ``` In addition, you will probably want to have your new activity have a theme that allows for transparency. See `styles.xml` for an example. To allow for dismiss: ```java mDraggableFrame.addListener(new ElasticDragDismissListener() { @Override public void onDrag(float elasticOffset, float elasticOffsetPixels, float rawOffset, float rawOffsetPixels) {} @Override public void onDragDismissed() { //if you are targeting 21+ you might want to finish after transition finish(); } }); ``` # Supported ScrollViews - ScrollView (if 21+ and android:nestedScrollingEnabled="true") - RecyclerView - NestedScrollView (from support v4 library) # Currently Created Elastic Views - ElasticDragDismissFrameLayout - ElasticDragDismissLinearLayout - ElasticDragDismissRelativeLayout You can create your own by using the `ElasticDragDismissDelegate` and using one of the created views as a reference. License -------- Copyright 2015 Google, Inc. Copyright 2017 Commit 451 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: app/.gitignore ================================================ /build ================================================ FILE: app/build.gradle ================================================ apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.commit451.elasticdragdismisslayout.sample" minSdkVersion 15 targetSdkVersion 27 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } lintOptions { abortOnError false } compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } dependencies { implementation 'androidx.appcompat:appcompat:1.0.0' implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.recyclerview:recyclerview:1.0.0' implementation 'androidx.cardview:cardview:1.0.0' implementation 'com.jakewharton:butterknife:10.0.0' annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0' implementation 'com.github.bumptech.glide:glide:4.3.1' implementation 'com.github.Commit451:Viewtiful:1.0.3' implementation project(':elasticdragdismisslayout') } ================================================ FILE: app/proguard-rules.pro ================================================ # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in C:\Users\Jawn\Develop\Android\sdk/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles # directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} ================================================ FILE: app/src/main/AndroidManifest.xml ================================================ ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/Cheese.java ================================================ package com.commit451.elasticdragdismisslayout.sample; import java.io.Serializable; /** * A fake model to show usage * Created by John on 11/24/15. */ public class Cheese implements Serializable { int mDrawable; String mName; public Cheese(int drawable, String name) { mDrawable = drawable; mName = name; } public int getDrawable() { return mDrawable; } public String getName() { return mName; } } ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/CheeseAdapter.java ================================================ package com.commit451.elasticdragdismisslayout.sample; import android.content.Context; import android.view.View; import android.view.ViewGroup; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import java.util.Collection; /** * Adapter for the recyclerview, which holds cheeses */ public class CheeseAdapter extends RecyclerView.Adapter { private Listener mListener; private ArrayList mValues; private final View.OnClickListener mOnClickListener = new View.OnClickListener() { @Override public void onClick(View v) { int position = (int) v.getTag(R.id.list_position); Cheese cheese = getItemAt(position); //Communicate to the activity that the item was long pressed mListener.onItemClicked(cheese); } }; public CheeseAdapter(Context context, Listener listener) { mListener = listener; mValues = new ArrayList<>(); } public void setData(Collection cheeses) { mValues.addAll(cheeses); notifyDataSetChanged(); } @Override public CheeseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { CheeseViewHolder holder = CheeseViewHolder.newInstance(parent); holder.itemView.setOnClickListener(mOnClickListener); return holder; } @Override public void onBindViewHolder(final CheeseViewHolder holder, int position) { Cheese cheese = getItemAt(position); holder.bind(cheese); holder.itemView.setTag(R.id.list_position, position); holder.itemView.setTag(R.id.list_holder, holder); } @Override public int getItemCount() { return mValues.size(); } private Cheese getItemAt(int position) { return mValues.get(position); } public interface Listener { void onItemClicked(Cheese cheese); } } ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/CheeseViewHolder.java ================================================ package com.commit451.elasticdragdismisslayout.sample; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; /** * The view holder related to each Cheese item * Created by John on 11/24/15. */ public class CheeseViewHolder extends RecyclerView.ViewHolder { public static CheeseViewHolder newInstance(ViewGroup parent) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.item_cheese, parent, false); return new CheeseViewHolder(view); } public ImageView image; public TextView title; public CheeseViewHolder(View view) { super(view); image = view.findViewById(R.id.image); title = view.findViewById(R.id.name); } public void bind(Cheese cheese) { image.setImageResource(cheese.getDrawable()); title.setText(cheese.getName()); } } ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/Cheeses.java ================================================ package com.commit451.elasticdragdismisslayout.sample; import java.util.Random; public class Cheeses { private static final Random RANDOM = new Random(); public static int getRandomCheeseDrawable() { switch (RANDOM.nextInt(5)) { default: case 0: return R.drawable.cheese_1; case 1: return R.drawable.cheese_2; case 2: return R.drawable.cheese_3; case 3: return R.drawable.cheese_4; case 4: return R.drawable.cheese_5; } } public static final String[] sCheeseStrings = { "Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi", "Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale", "Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese", "Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell", "Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc", "Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss", "Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon", "Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase", "Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese", "Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy", "Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille", "Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore", "Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)", "Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves", "Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur", "Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon", "Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin", "Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)", "Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine", "Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza", "Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)", "Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta", "Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie", "Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat", "Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano", "Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain", "Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou", "Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar", "Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno", "Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack", "Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper", "Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)", "Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese", "Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza", "Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley", "Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino", "Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina", "Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby", "Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin", "Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester", "Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue", "Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz", "Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich", "Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue", "Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle", "Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia", "Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis", "Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus", "Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison", "Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois", "Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse", "Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese", "Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise", "Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra", "Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola", "Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost", "Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel", "Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve", "Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi", "Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti", "Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve", "Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster", "Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg", "Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa", "Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine", "Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese", "Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere", "La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire", "Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou", "Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger", "Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings", "Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse", "Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam", "Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego", "Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin", "Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)", "Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse", "Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda", "Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte", "Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio", "Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne", "Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)", "Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster", "Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel", "Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca", "Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre", "Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty", "Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela", "Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano", "Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage", "Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry", "Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid", "Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn", "Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse", "Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin", "Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin", "Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre", "Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone", "Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark", "Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit", "Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia", "Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)", "Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna", "Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera", "Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou", "Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder", "Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort", "Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr", "Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin", "Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre", "Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss", "Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela", "Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda", "Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain", "Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese", "Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale", "Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie", "Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri", "Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar", "Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance", "Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes", "Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet", "Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe", "Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa", "Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois", "Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue", "Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington", "Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou", "Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue", "Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano" }; public static String getRandomCheeseName() { return sCheeseStrings[RANDOM.nextInt(sCheeseStrings.length-1)]; } public static Cheese getRandomCheese() { return new Cheese(getRandomCheeseDrawable(), getRandomCheeseName()); } } ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/ColorUtils.java ================================================ /* * Copyright 2015 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.commit451.elasticdragdismisslayout.sample; import androidx.annotation.ColorInt; import androidx.annotation.FloatRange; import androidx.annotation.IntRange; /** * Utility methods for working with colors. */ public class ColorUtils { private ColorUtils() { } /** * Set the alpha component of {@code color} to be {@code alpha}. */ public static int modifyAlpha(@ColorInt int color, @IntRange(from = 0, to = 255) int alpha) { return (color & 0x00ffffff) | (alpha << 24); } /** * Set the alpha component of {@code color} to be {@code alpha}. */ public static int modifyAlpha(@ColorInt int color, @FloatRange(from = 0f, to = 1f) float alpha) { return modifyAlpha(color, (int) (255f * alpha)); } } ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/DetailActivity.java ================================================ package com.commit451.elasticdragdismisslayout.sample; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.transition.TransitionInflater; import android.view.View; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import com.commit451.elasticdragdismisslayout.ElasticDragDismissCallback; import com.commit451.elasticdragdismisslayout.ElasticDragDismissFrameLayout; import butterknife.BindView; import butterknife.ButterKnife; /** * Sample detail activity */ public class DetailActivity extends AppCompatActivity { private static final String KEY_CHEESE = "cheese"; public static Intent newIntent(Context context, Cheese cheese) { Intent intent = new Intent(context, DetailActivity.class); intent.putExtra(KEY_CHEESE, cheese); return intent; } @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.draggable_frame) ElasticDragDismissFrameLayout draggableFrame; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail); ButterKnife.bind(this); Cheese cheese = (Cheese) getIntent().getSerializableExtra(KEY_CHEESE); toolbar.setNavigationIcon(R.drawable.ic_arrow_back_24dp); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); toolbar.setTitle(cheese.getName()); draggableFrame.addListener(new ElasticDragDismissCallback() { @Override public void onDrag(float elasticOffset, float elasticOffsetPixels, float rawOffset, float rawOffsetPixels) { } @Override public void onDragDismissed() { // if we drag dismiss downward then the default reversal of the enter // transition would slide content upward which looks weird. So reverse it. if (draggableFrame.getTranslationY() > 0 && Build.VERSION.SDK_INT >= 21) { getWindow().setReturnTransition( TransitionInflater.from(DetailActivity.this) .inflateTransition(R.transition.about_return_downward)); } if (Build.VERSION.SDK_INT >= 21) { finishAfterTransition(); } else { finish(); } } }); if (Build.VERSION.SDK_INT >= 21) { draggableFrame.addListener(new SystemChromeFader(this)); } } } ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/DetailRecyclerViewActivity.java ================================================ package com.commit451.elasticdragdismisslayout.sample; import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.commit451.elasticdragdismisslayout.ElasticDragDismissCallback; import com.commit451.elasticdragdismisslayout.ElasticDragDismissLinearLayout; import butterknife.BindView; import butterknife.ButterKnife; /** * Testing using a RecyclerView */ public class DetailRecyclerViewActivity extends AppCompatActivity { public static Intent newIntent(Context context) { Intent intent = new Intent(context, DetailRecyclerViewActivity.class); return intent; } @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.draggable_frame) ElasticDragDismissLinearLayout dragLayout; @BindView(R.id.recyclerview) RecyclerView recyclerView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_detail_recyclerview); ButterKnife.bind(this); toolbar.setTitle("Countries"); toolbar.setNavigationIcon(R.drawable.ic_arrow_back_24dp); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); CountriesAdapter adapter = new CountriesAdapter(this); recyclerView.setAdapter(adapter); recyclerView.setLayoutManager(new LinearLayoutManager(this)); dragLayout.addListener(new ElasticDragDismissCallback() { @Override public void onDrag(float elasticOffset, float elasticOffsetPixels, float rawOffset, float rawOffsetPixels) { } @Override public void onDragDismissed() { // if we drag dismiss downward then the default reversal of the enter // transition would slide content upward which looks weird. So reverse it. if (dragLayout.getTranslationY() > 0) { //TODO // getWindow().setReturnTransition( // TransitionInflater.from(AboutActivity.this) // .inflateTransition(R.transition.about_return_downward)); } if (Build.VERSION.SDK_INT >= 21) { finishAfterTransition(); } else { finish(); } } }); if (Build.VERSION.SDK_INT >= 21) { dragLayout.addListener(new SystemChromeFader(this)); } } static class CountriesAdapter extends RecyclerView.Adapter { String[] countries; public CountriesAdapter(Context context) { countries = context.getResources().getStringArray(R.array.countries); } @Override public CountriesViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { return CountriesViewHolder.inflate(parent); } @Override public void onBindViewHolder(CountriesViewHolder holder, int position) { holder.bind(countries[position]); } @Override public int getItemCount() { return countries.length; } } static class CountriesViewHolder extends RecyclerView.ViewHolder { public static CountriesViewHolder inflate(ViewGroup parent) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.viewholder_game, parent, false); return new CountriesViewHolder(view); } @BindView(R.id.text) TextView mText; public CountriesViewHolder(View view) { super(view); ButterKnife.bind(this, view); } public void bind(String country) { mText.setText(country); } } } ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/MainActivity.java ================================================ package com.commit451.elasticdragdismisslayout.sample; import android.content.Intent; import android.os.Bundle; import android.view.MenuItem; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import java.util.ArrayList; import butterknife.BindView; import butterknife.ButterKnife; public class MainActivity extends AppCompatActivity { @BindView(R.id.toolbar) Toolbar toolbar; @BindView(R.id.recyclerview) RecyclerView recyclerView; CheeseAdapter cheeseAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ButterKnife.bind(this); toolbar.setTitle("ElasticDragDismissLayout"); toolbar.inflateMenu(R.menu.main); toolbar.setOnMenuItemClickListener(new Toolbar.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.action_recyclerview: Intent intent = DetailRecyclerViewActivity.newIntent(MainActivity.this); startActivity(intent); return true; } return false; } }); cheeseAdapter = new CheeseAdapter(MainActivity.this, new CheeseAdapter.Listener() { @Override public void onItemClicked(Cheese cheese) { startActivity(DetailActivity.newIntent(MainActivity.this, cheese)); } }); recyclerView.setAdapter(cheeseAdapter); recyclerView.setLayoutManager(new GridLayoutManager(this, 2)); load(); } private void load() { ArrayList cheeses = new ArrayList<>(); for (int i = 0; i < 20; i++) { cheeses.add(Cheeses.getRandomCheese()); } cheeseAdapter.setData(cheeses); } } ================================================ FILE: app/src/main/java/com/commit451/elasticdragdismisslayout/sample/SystemChromeFader.java ================================================ package com.commit451.elasticdragdismisslayout.sample; import android.annotation.TargetApi; import android.app.Activity; import android.graphics.Color; import com.commit451.elasticdragdismisslayout.ElasticDragDismissCallback; import com.commit451.viewtiful.Viewtiful; /** * An {@link ElasticDragDismissCallback} which fades system chrome (i.e. status bar and * navigation bar) when elastic drags are performed. Consuming classes must provide the * implementation for {@link ElasticDragDismissCallback#onDragDismissed()}. */ @TargetApi(21) public class SystemChromeFader extends ElasticDragDismissCallback { private final Activity activity; private final int statusBarAlpha; private final int navBarAlpha; private final boolean fadeNavBar; public SystemChromeFader(Activity activity) { this.activity = activity; statusBarAlpha = Color.alpha(activity.getWindow().getStatusBarColor()); navBarAlpha = Color.alpha(activity.getWindow().getNavigationBarColor()); fadeNavBar = Viewtiful.isNavigationBarOnBottom(activity); } @Override public void onDrag(float elasticOffset, float elasticOffsetPixels, float rawOffset, float rawOffsetPixels) { if (elasticOffsetPixels > 0) { // dragging downward, fade the status bar in proportion activity.getWindow().setStatusBarColor(ColorUtils.modifyAlpha(activity.getWindow() .getStatusBarColor(), (int) ((1f - rawOffset) * statusBarAlpha))); } else if (elasticOffsetPixels == 0) { // reset activity.getWindow().setStatusBarColor(ColorUtils.modifyAlpha( activity.getWindow().getStatusBarColor(), statusBarAlpha)); activity.getWindow().setNavigationBarColor(ColorUtils.modifyAlpha( activity.getWindow().getNavigationBarColor(), navBarAlpha)); } else if (fadeNavBar) { // dragging upward, fade the navigation bar in proportion activity.getWindow().setNavigationBarColor( ColorUtils.modifyAlpha(activity.getWindow().getNavigationBarColor(), (int) ((1f - rawOffset) * navBarAlpha))); } } public void onDragDismissed() { activity.finishAfterTransition(); } } ================================================ FILE: app/src/main/res/drawable/ic_arrow_back_24dp.xml ================================================ ================================================ FILE: app/src/main/res/drawable/ic_favorite_24dp.xml ================================================ ================================================ FILE: app/src/main/res/layout/activity_detail.xml ================================================ ================================================ FILE: app/src/main/res/layout/activity_detail_recyclerview.xml ================================================ ================================================ FILE: app/src/main/res/layout/activity_main.xml ================================================ ================================================ FILE: app/src/main/res/layout/item_cheese.xml ================================================ ================================================ FILE: app/src/main/res/layout/viewholder_game.xml ================================================ ================================================ FILE: app/src/main/res/menu/main.xml ================================================ ================================================ FILE: app/src/main/res/transition/about_return_downward.xml ================================================ ================================================ FILE: app/src/main/res/values/colors.xml ================================================ #3F51B5 #303F9F #FF4081 #99323232 ================================================ FILE: app/src/main/res/values/dimens.xml ================================================ 16dp 16dp 112dp 256dp 16dp 16dp ================================================ FILE: app/src/main/res/values/ids.xml ================================================ ================================================ FILE: app/src/main/res/values/strings.xml ================================================ ElasticDragDismissLayout Jarlsberg lancashire edam. Dolcelatte hard cheese brie st. agur blue cheese caerphilly bavarian bergkase cheese and biscuits mascarpone. Cheeseburger swiss bavarian bergkase cream cheese fromage frais cheesy feet port-salut airedale. St. agur blue cheese rubber cheese caerphilly cheddar cheesecake cream cheese manchego lancashire. Roquefort squirty cheese the big cheese. RecyclerView Example Afghanistan Albania Algeria American Samoa Andorra Angola Anguilla Antarctica Antigua and Barbuda Argentina Armenia Aruba Australia Austria Azerbaijan Bahamas Bahrain Bangladesh Barbados Belarus Belgium Belize Benin Bermuda Bhutan Bolivia Bosnia and Herzegovina Botswana Brazil British Indian Ocean Territory British Virgin Islands Brunei Bulgaria Burkina Faso Burundi Cambodia Cameroon Canada Cape Verde Cayman Islands Central African Republic Chad Chile China Christmas Island Cocos Islands Colombia Comoros Cook Islands Costa Rica Croatia Cuba Cyprus Czech Republic Democratic Republic of the Congo Denmark Djibouti Dominica Dominican Republic East Timor Ecuador Egypt El Salvador Equatorial Guinea Eritrea Estonia Ethiopia Falkland Islands Faroe Islands Fiji Finland France French Polynesia Gabon Gambia Georgia Germany Ghana Gibraltar Greece Greenland Grenada Guam Guatemala Guinea Guinea-Bissau Guyana Haiti Honduras Hong Kong Hungary Iceland India Indonesia Iran Iraq Ireland Isle of Man Israel Italy Ivory Coast Jamaica Japan Jersey Jordan Kazakhstan Kenya Kiribati Kuwait Kyrgyzstan Laos Latvia Lebanon Lesotho Liberia Libya Liechtenstein Lithuania Luxembourg Macao Macedonia Madagascar Malawi Malaysia Maldives Mali Malta Marshall Islands Mauritania Mauritius Mayotte Mexico Micronesia Moldova Monaco Mongolia Montenegro Montserrat Morocco Mozambique Myanmar Namibia Nauru Nepal Netherlands Netherlands Antilles New Caledonia New Zealand Nicaragua Niger Nigeria Niue North Korea Northern Mariana Islands Norway Oman Pakistan Palau Panama Papua New Guinea Paraguay Peru Philippines Pitcairn Poland Portugal Puerto Rico Qatar Republic of the Congo Romania Russia Rwanda Saint Barthelemy Saint Helena Saint Kitts and Nevis Saint Lucia Saint Martin Saint Pierre and Miquelon Saint Vincent and the Grenadines Samoa San Marino Sao Tome and Principe Saudi Arabia Senegal Serbia Seychelles Sierra Leone Singapore Slovakia Slovenia Solomon Islands Somalia South Africa South Georgia and the South Sandwich Islands South Korea Spain Sri Lanka Sudan Suriname Svalbard and Jan Mayen Swaziland Sweden Switzerland Syria Taiwan Tajikistan Tanzania Thailand Togo Tokelau Tonga Trinidad and Tobago Tunisia Turkey Turkmenistan Turks and Caicos Islands Tuvalu U.S. Virgin Islands Uganda Ukraine United Arab Emirates United Kingdom United States Uruguay Uzbekistan Vanuatu Vatican Venezuela Vietnam Wallis and Futuna Western Sahara Yemen Zambia Zimbabwe ================================================ FILE: app/src/main/res/values/styles.xml ================================================ ================================================ FILE: build.gradle ================================================ buildscript { repositories { jcenter() google() } dependencies { classpath 'com.android.tools.build:gradle:3.4.1' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' } } allprojects { repositories { jcenter() google() maven { url "https://jitpack.io" } } } task clean(type: Delete) { delete rootProject.buildDir } ================================================ FILE: elasticdragdismisslayout/.gitignore ================================================ /build ================================================ FILE: elasticdragdismisslayout/build.gradle ================================================ apply plugin: 'com.android.library' android { compileSdkVersion 28 defaultConfig { minSdkVersion 14 targetSdkVersion 27 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } lintOptions { abortOnError false } } dependencies { api 'androidx.legacy:legacy-support-v4:1.0.0' } apply from: 'https://raw.githubusercontent.com/Commit451/gradle-android-javadocs/1.0.0/gradle-android-javadocs.gradle' ================================================ FILE: elasticdragdismisslayout/proguard-rules.pro ================================================ # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in C:\Users\Jawn\Develop\Android\sdk/tools/proguard/proguard-android.txt # You can edit the include path and order by changing the proguardFiles # directive in build.gradle. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html # Add any project specific keep options here: # If your project uses WebView with JS, uncomment the following # and specify the fully qualified class name to the JavaScript interface # class: #-keepclassmembers class fqcn.of.javascript.interface.for.webview { # public *; #} ================================================ FILE: elasticdragdismisslayout/src/main/AndroidManifest.xml ================================================ ================================================ FILE: elasticdragdismisslayout/src/main/java/com/commit451/elasticdragdismisslayout/ElasticDragDismissCallback.java ================================================ package com.commit451.elasticdragdismisslayout; /** * Callbacks for listening for drag events on ElasticLayouts */ public abstract class ElasticDragDismissCallback { /** * Called for each drag event. * * @param elasticOffset Indicating the drag offset with elasticity applied i.e. may * exceed 1. * @param elasticOffsetPixels The elastically scaled drag distance in pixels. * @param rawOffset Value from [0, 1] indicating the raw drag offset i.e. * without elasticity applied. A value of 1 indicates that the * dismiss distance has been reached. * @param rawOffsetPixels The raw distance the user has dragged */ public void onDrag(float elasticOffset, float elasticOffsetPixels, float rawOffset, float rawOffsetPixels) { } /** * Called when dragging is released and has exceeded the threshold dismiss distance. */ public void onDragDismissed() { } } ================================================ FILE: elasticdragdismisslayout/src/main/java/com/commit451/elasticdragdismisslayout/ElasticDragDismissDelegate.java ================================================ package com.commit451.elasticdragdismisslayout; import android.content.Context; import android.content.res.TypedArray; import android.view.View; import android.view.ViewGroup; import android.view.ViewPropertyAnimator; import androidx.interpolator.view.animation.FastOutSlowInInterpolator; import java.util.ArrayList; import java.util.List; /** * Defer all the things to this class, so that we can create the layouts easily. Use this * to create your own ViewGroups */ public class ElasticDragDismissDelegate { //copied from View in API 21 private static final int SCROLL_AXIS_VERTICAL = 1 << 1; private static final long DRAG_DURATION_BUFFER = 150L; // configurable attribs private float dragDismissDistance = Float.MAX_VALUE; private float dragDismissFraction = -1f; private float dragDismissScale = 1f; private boolean shouldScale = false; private float dragElacticity = 0.8f; private long scrollStartTimestamp; private boolean enableScaleX = true; private boolean enableBottomDrag = false; // state private float totalDrag; private boolean draggingDown = false; private boolean draggingUp = false; private List callbacks; private ViewGroup mViewGroup; public ElasticDragDismissDelegate(ViewGroup viewGroup) { mViewGroup = viewGroup; } public void init(Context context, TypedArray a) { Util.checkParent(mViewGroup, a); if (a.hasValue(R.styleable.ElasticDragDismissFrameLayout_dragDismissDistance)) { dragDismissDistance = a.getDimensionPixelSize(R.styleable .ElasticDragDismissFrameLayout_dragDismissDistance, 0); } else if (a.hasValue(R.styleable.ElasticDragDismissFrameLayout_dragDismissFraction)) { dragDismissFraction = a.getFloat(R.styleable .ElasticDragDismissFrameLayout_dragDismissFraction, dragDismissFraction); } if (a.hasValue(R.styleable.ElasticDragDismissFrameLayout_dragDismissScale)) { dragDismissScale = a.getFloat(R.styleable .ElasticDragDismissFrameLayout_dragDismissScale, dragDismissScale); shouldScale = dragDismissScale != 1f; } if (a.hasValue(R.styleable.ElasticDragDismissFrameLayout_dragElasticity)) { dragElacticity = a.getFloat(R.styleable.ElasticDragDismissFrameLayout_dragElasticity, dragElacticity); } if (a.hasValue(R.styleable.ElasticDragDismissFrameLayout_enableScaleX)) { enableScaleX = a.getBoolean(R.styleable.ElasticDragDismissFrameLayout_enableScaleX, true); } if (a.hasValue(R.styleable.ElasticDragDismissFrameLayout_dragDismissEnableBottomDrag)) { enableBottomDrag = a.getBoolean(R.styleable.ElasticDragDismissFrameLayout_dragDismissEnableBottomDrag, true); } } public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) { scrollStartTimestamp = System.currentTimeMillis(); return (nestedScrollAxes & SCROLL_AXIS_VERTICAL) != 0; } public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) { // if we're in a drag gesture and the user reverses up the we should take those events if (draggingDown && dy > 0 || draggingUp && dy < 0) { dragScale(dy); consumed[1] = dy; } } public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { dragScale(dyUnconsumed); } public void onStopNestedScroll(View child) { // if the drag is too fast it probably was not an intentional drag but a fling, don't dismiss final long dragTime = System.currentTimeMillis() - scrollStartTimestamp; if (Math.abs(totalDrag) >= dragDismissDistance && dragTime > DRAG_DURATION_BUFFER) { dispatchDismissCallback(); } else { // settle back to natural position ViewPropertyAnimator animator = mViewGroup.animate() .translationY(0f) .scaleY(1f) .setDuration(200L) .setInterpolator(new FastOutSlowInInterpolator()) .setListener(null); if (enableScaleX) { animator.scaleX(1f); } animator.start(); totalDrag = 0; draggingDown = draggingUp = false; dispatchDragCallback(0f, 0f, 0f, 0f); } } private void dragScale(int scroll) { boolean draggingUp = enableBottomDrag && this.draggingUp; if (scroll == 0) return; if (draggingUp || scroll < 0) totalDrag += scroll; // track the direction & set the pivot point for scaling // don't double track i.e. if start dragging down and then reverse, keep tracking as // dragging down until they reach the 'natural' position if (scroll < 0 && !draggingUp && !draggingDown) { draggingDown = true; if (shouldScale) mViewGroup.setPivotY(mViewGroup.getHeight()); } else if (scroll > 0 && !draggingDown && !draggingUp) { this.draggingUp = true; if (shouldScale) mViewGroup.setPivotY(0f); } // how far have we dragged relative to the distance to perform a dismiss // (0–1 where 1 = dismiss distance). Decreasing logarithmically as we approach the limit float dragFraction = (float) Math.log10(1 + (Math.abs(totalDrag) / dragDismissDistance)); // calculate the desired translation given the drag fraction float dragTo = dragFraction * dragDismissDistance * dragElacticity; if (draggingUp) { // as we use the absolute magnitude when calculating the drag fraction, need to // re-apply the drag direction dragTo *= -1; } mViewGroup.setTranslationY(dragTo); if (shouldScale) { final float scale = 1 - ((1 - dragDismissScale) * dragFraction); if (enableScaleX) { mViewGroup.setScaleX(scale); } mViewGroup.setScaleY(scale); } // if we've reversed direction and gone past the settle point then clear the flags to // allow the list to get the scroll events & reset any transforms if ((draggingDown && totalDrag >= 0) || (draggingUp && totalDrag <= 0)) { totalDrag = dragTo = dragFraction = 0; draggingDown = this.draggingUp = false; mViewGroup.setTranslationY(0f); if (enableScaleX) { mViewGroup.setScaleX(1f); } mViewGroup.setScaleY(1f); } dispatchDragCallback(dragFraction, dragTo, Math.min(1f, Math.abs(totalDrag) / dragDismissDistance), totalDrag); } public void onSizeChanged(int w, int h, int oldw, int oldh) { if (dragDismissFraction > 0f) { dragDismissDistance = h * dragDismissFraction; } } private void dispatchDragCallback(float elasticOffset, float elasticOffsetPixels, float rawOffset, float rawOffsetPixels) { if (callbacks != null && !callbacks.isEmpty()) { for (ElasticDragDismissCallback callback : callbacks) { callback.onDrag(elasticOffset, elasticOffsetPixels, rawOffset, rawOffsetPixels); } } } private void dispatchDismissCallback() { if (callbacks != null && !callbacks.isEmpty()) { for (ElasticDragDismissCallback callback : callbacks) { callback.onDragDismissed(); } } } public void addListener(ElasticDragDismissCallback listener) { if (callbacks == null) { callbacks = new ArrayList<>(); } callbacks.add(listener); } public void removeListener(ElasticDragDismissCallback listener) { if (callbacks != null && callbacks.size() > 0) { callbacks.remove(listener); } } } ================================================ FILE: elasticdragdismisslayout/src/main/java/com/commit451/elasticdragdismisslayout/ElasticDragDismissFrameLayout.java ================================================ /* * Copyright 2015 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.commit451.elasticdragdismisslayout; import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.widget.FrameLayout; import androidx.core.view.NestedScrollingParent; /** * A {@link FrameLayout} which responds to nested scrolls to create drag-dismissable layouts. * Applies an elasticity factor to reduce movement as you approach the given dismiss distance. * Optionally also scales down content during drag. */ public class ElasticDragDismissFrameLayout extends FrameLayout implements NestedScrollingParent { private ElasticDragDismissDelegate delegate; public ElasticDragDismissFrameLayout(Context context) { this(context, null, 0); } public ElasticDragDismissFrameLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public ElasticDragDismissFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } @TargetApi(21) public ElasticDragDismissFrameLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(context, attrs); } private void init(Context context, AttributeSet attrs) { final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ElasticDragDismissFrameLayout, 0, 0); delegate = new ElasticDragDismissDelegate(this); delegate.init(context, a); a.recycle(); } @Override public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) { return delegate.onStartNestedScroll(child, target, nestedScrollAxes); } @Override public void onNestedPreScroll(View target, int dx, int dy, int[] consumed) { delegate.onNestedPreScroll(target, dx, dy, consumed); } @Override public void onNestedScroll(View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { delegate.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); } @Override public void onStopNestedScroll(View child) { delegate.onStopNestedScroll(child); } @Override public void onNestedScrollAccepted(View child, View target, int nestedScrollAxes) { } @Override public boolean onNestedFling(View target, float velocityX, float velocityY, boolean consumed) { return false; } @Override public boolean onNestedPreFling(View target, float velocityX, float velocityY) { return false; } @Override public int getNestedScrollAxes() { return 0; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); delegate.onSizeChanged(w, h, oldw, oldh); } public void addListener(ElasticDragDismissCallback listener) { delegate.addListener(listener); } public void removeListener(ElasticDragDismissCallback listener) { delegate.removeListener(listener); } } ================================================ FILE: elasticdragdismisslayout/src/main/java/com/commit451/elasticdragdismisslayout/ElasticDragDismissLinearLayout.java ================================================ package com.commit451.elasticdragdismisslayout; import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.widget.LinearLayout; import androidx.annotation.NonNull; import androidx.core.view.NestedScrollingParent; /** * Like {@link ElasticDragDismissFrameLayout} but its parent is a {@link android.widget.LinearLayout} */ public class ElasticDragDismissLinearLayout extends LinearLayout implements NestedScrollingParent { private ElasticDragDismissDelegate delegate; public ElasticDragDismissLinearLayout(Context context) { this(context, null, 0); } public ElasticDragDismissLinearLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public ElasticDragDismissLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } @TargetApi(21) public ElasticDragDismissLinearLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(context, attrs); } private void init(Context context, AttributeSet attrs) { final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ElasticDragDismissFrameLayout, 0, 0); delegate = new ElasticDragDismissDelegate(this); delegate.init(context, a); a.recycle(); } @Override public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int nestedScrollAxes) { return delegate.onStartNestedScroll(child, target, nestedScrollAxes); } @Override public void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed) { delegate.onNestedPreScroll(target, dx, dy, consumed); } @Override public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { delegate.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); } @Override public void onStopNestedScroll(@NonNull View child) { delegate.onStopNestedScroll(child); } @Override public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int nestedScrollAxes) { } @Override public boolean onNestedFling(@NonNull View target, float velocityX, float velocityY, boolean consumed) { return false; } @Override public boolean onNestedPreFling(@NonNull View target, float velocityX, float velocityY) { return false; } @Override public int getNestedScrollAxes() { return 0; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); delegate.onSizeChanged(w, h, oldw, oldh); } public void addListener(ElasticDragDismissCallback listener) { delegate.addListener(listener); } public void removeListener(ElasticDragDismissCallback listener) { delegate.removeListener(listener); } } ================================================ FILE: elasticdragdismisslayout/src/main/java/com/commit451/elasticdragdismisslayout/ElasticDragDismissRelativeLayout.java ================================================ package com.commit451.elasticdragdismisslayout; import android.annotation.TargetApi; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.View; import android.widget.RelativeLayout; import androidx.annotation.NonNull; import androidx.core.view.NestedScrollingParent; /** * Like {@link ElasticDragDismissFrameLayout} but its parent is a {@link android.widget.RelativeLayout} */ public class ElasticDragDismissRelativeLayout extends RelativeLayout implements NestedScrollingParent { private ElasticDragDismissDelegate delegate; public ElasticDragDismissRelativeLayout(Context context) { this(context, null, 0); } public ElasticDragDismissRelativeLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public ElasticDragDismissRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } @TargetApi(21) public ElasticDragDismissRelativeLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); init(context, attrs); } private void init(Context context, AttributeSet attrs) { final TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.ElasticDragDismissFrameLayout, 0, 0); delegate = new ElasticDragDismissDelegate(this); delegate.init(context, a); a.recycle(); } @Override public boolean onStartNestedScroll(@NonNull View child, @NonNull View target, int nestedScrollAxes) { return delegate.onStartNestedScroll(child, target, nestedScrollAxes); } @Override public void onNestedPreScroll(@NonNull View target, int dx, int dy, @NonNull int[] consumed) { delegate.onNestedPreScroll(target, dx, dy, consumed); } @Override public void onNestedScroll(@NonNull View target, int dxConsumed, int dyConsumed, int dxUnconsumed, int dyUnconsumed) { delegate.onNestedScroll(target, dxConsumed, dyConsumed, dxUnconsumed, dyUnconsumed); } @Override public void onStopNestedScroll(@NonNull View child) { delegate.onStopNestedScroll(child); } @Override public void onNestedScrollAccepted(@NonNull View child, @NonNull View target, int nestedScrollAxes) { } @Override public boolean onNestedFling(@NonNull View target, float velocityX, float velocityY, boolean consumed) { return false; } @Override public boolean onNestedPreFling(@NonNull View target, float velocityX, float velocityY) { return false; } @Override public int getNestedScrollAxes() { return 0; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); delegate.onSizeChanged(w, h, oldw, oldh); } public void addListener(ElasticDragDismissCallback listener) { delegate.addListener(listener); } public void removeListener(ElasticDragDismissCallback listener) { delegate.removeListener(listener); } } ================================================ FILE: elasticdragdismisslayout/src/main/java/com/commit451/elasticdragdismisslayout/Util.java ================================================ package com.commit451.elasticdragdismisslayout; import android.content.res.TypedArray; import android.os.Build; import android.view.ViewGroup; import android.widget.ScrollView; import androidx.core.widget.NestedScrollView; class Util { static void checkParent(ViewGroup viewGroup, TypedArray a) { boolean checkParent = true; if (a.hasValue(R.styleable.ElasticDragDismissFrameLayout_ignoreNestedScrollWarnings)) { checkParent = a.getBoolean(R.styleable.ElasticDragDismissFrameLayout_ignoreNestedScrollWarnings, false); } if (!checkParent) { return; } if (viewGroup.getParent() instanceof NestedScrollView) { if (!((NestedScrollView) viewGroup.getParent()).isNestedScrollingEnabled()) { throw new IllegalStateException("You need to set nestedScrollingEnabled on the NestedScrollView"); } } else if (viewGroup.getParent() instanceof ScrollView) { if (Build.VERSION.SDK_INT >= 21) { if (!((ScrollView) viewGroup.getParent()).isNestedScrollingEnabled()) { throw new IllegalStateException("You need to set nestedScrollingEnabled on the ScrollView"); } } } } } ================================================ FILE: elasticdragdismisslayout/src/main/res/values/attrs_drag_dismissables.xml ================================================ ================================================ FILE: gradle/wrapper/gradle-wrapper.properties ================================================ #Mon Jun 24 18:18:05 JST 2019 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip ================================================ FILE: gradle.properties ================================================ # Project-wide Gradle settings. # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true android.useAndroidX=true android.enableJetifier=true ================================================ FILE: gradlew ================================================ #!/usr/bin/env bash ############################################################################## ## ## Gradle start up script for UN*X ## ############################################################################## # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS="" APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" warn ( ) { echo "$*" } die ( ) { echo echo "$*" echo exit 1 } # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false case "`uname`" in CYGWIN* ) cygwin=true ;; Darwin* ) darwin=true ;; MINGW* ) msys=true ;; esac # Attempt to set APP_HOME # Resolve links: $0 may be a link PRG="$0" # Need this for relative symlinks. while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG=`dirname "$PRG"`"/$link" fi done SAVED="`pwd`" cd "`dirname \"$PRG\"`/" >/dev/null APP_HOME="`pwd -P`" cd "$SAVED" >/dev/null CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables JAVACMD="$JAVA_HOME/jre/sh/java" else JAVACMD="$JAVA_HOME/bin/java" fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else JAVACMD="java" which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi # Increase the maximum file descriptors if we can. if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then MAX_FD="$MAX_FD_LIMIT" fi ulimit -n $MAX_FD if [ $? -ne 0 ] ; then warn "Could not set maximum file descriptor limit: $MAX_FD" fi else warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" fi fi # For Darwin, add options to specify how the application appears in the dock if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi # For Cygwin, switch paths to Windows format before running java if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` SEP="" for dir in $ROOTDIRSRAW ; do ROOTDIRS="$ROOTDIRS$SEP$dir" SEP="|" done OURCYGPATTERN="(^($ROOTDIRS))" # Add a user-defined pattern to the cygpath arguments if [ "$GRADLE_CYGPATTERN" != "" ] ; then OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" fi # Now convert the arguments - kludge to limit ourselves to /bin/sh i=0 for arg in "$@" ; do CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` else eval `echo args$i`="\"$arg\"" fi i=$((i+1)) done case $i in (0) set -- ;; (1) set -- "$args0" ;; (2) set -- "$args0" "$args1" ;; (3) set -- "$args0" "$args1" "$args2" ;; (4) set -- "$args0" "$args1" "$args2" "$args3" ;; (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules function splitJvmOpts() { JVM_OPTS=("$@") } eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" ================================================ FILE: gradlew.bat ================================================ @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @rem @rem ########################################################################## @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS= set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 if "%ERRORLEVEL%" == "0" goto init echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. goto fail :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe if exist "%JAVA_EXE%" goto init echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% echo. echo Please set the JAVA_HOME variable in your environment to match the echo location of your Java installation. goto fail :init @rem Get command-line arguments, handling Windowz variants if not "%OS%" == "Windows_NT" goto win9xME_args if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. set CMD_LINE_ARGS= set _SKIP=2 :win9xME_args_slurp if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* goto execute :4NT_args @rem Get arguments from the 4NT Shell from JP Software set CMD_LINE_ARGS=%$ :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% :end @rem End local scope for the variables with windows NT shell if "%ERRORLEVEL%"=="0" goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 exit /b 1 :mainEnd if "%OS%"=="Windows_NT" endlocal :omega ================================================ FILE: settings.gradle ================================================ include ':app', ':elasticdragdismisslayout'