Repository: jakebonk/BoardView Branch: master Commit: 6a3d0c2b4656 Files: 50 Total size: 97.4 KB Directory structure: gitextract_0uklpul4/ ├── .gitignore ├── .idea/ │ ├── caches/ │ │ └── build_file_checksums.ser │ ├── codeStyles/ │ │ └── Project.xml │ ├── compiler.xml │ ├── copyright/ │ │ └── profiles_settings.xml │ ├── gradle.xml │ ├── inspectionProfiles/ │ │ ├── Project_Default.xml │ │ └── profiles_settings.xml │ ├── misc.xml │ ├── modules.xml │ ├── runConfigurations.xml │ └── vcs.xml ├── LICENSE ├── README.md ├── app/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── com/ │ │ └── allyants/ │ │ └── boardviewexample/ │ │ └── ExampleInstrumentedTest.java │ ├── main/ │ │ ├── AndroidManifest.xml │ │ ├── java/ │ │ │ └── com/ │ │ │ └── allyants/ │ │ │ └── boardviewexample/ │ │ │ └── MainActivity.java │ │ └── res/ │ │ ├── layout/ │ │ │ └── activity_main.xml │ │ ├── values/ │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── values-w820dp/ │ │ └── dimens.xml │ └── test/ │ └── java/ │ └── com/ │ └── allyants/ │ └── boardviewexample/ │ └── ExampleUnitTest.java ├── boardview/ │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src/ │ ├── androidTest/ │ │ └── java/ │ │ └── com/ │ │ └── allyants/ │ │ └── boardview/ │ │ └── ExampleInstrumentedTest.java │ ├── main/ │ │ ├── AndroidManifest.xml │ │ ├── java/ │ │ │ └── com/ │ │ │ └── allyants/ │ │ │ └── boardview/ │ │ │ ├── BoardAdapter.java │ │ │ ├── BoardItem.java │ │ │ ├── BoardView.java │ │ │ ├── Item.java │ │ │ └── SimpleBoardAdapter.java │ │ └── res/ │ │ ├── drawable/ │ │ │ └── shadow_background.xml │ │ ├── layout/ │ │ │ ├── column_header.xml │ │ │ └── column_item.xml │ │ └── values/ │ │ ├── attrs.xml │ │ └── strings.xml │ └── test/ │ └── java/ │ └── com/ │ └── allyants/ │ └── boardview/ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle/ │ └── wrapper/ │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── gradlew ├── gradlew.bat └── settings.gradle ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ *.iml .gradle /local.properties /.idea/workspace.xml /.idea/libraries .DS_Store /build /captures .externalNativeBuild ================================================ FILE: .idea/codeStyles/Project.xml ================================================ ================================================ FILE: .idea/compiler.xml ================================================ ================================================ FILE: .idea/copyright/profiles_settings.xml ================================================ ================================================ FILE: .idea/gradle.xml ================================================ ================================================ FILE: .idea/inspectionProfiles/Project_Default.xml ================================================ ================================================ FILE: .idea/inspectionProfiles/profiles_settings.xml ================================================ ================================================ FILE: .idea/misc.xml ================================================ 1.8 ================================================ FILE: .idea/modules.xml ================================================ ================================================ FILE: .idea/runConfigurations.xml ================================================ ================================================ FILE: .idea/vcs.xml ================================================ ================================================ FILE: LICENSE ================================================ 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 ================================================ [![](https://jitpack.io/v/jakebonk/BoardView.svg)](https://jitpack.io/#jakebonk/BoardView) # BoardView BoardView is a custom view that allows you to be able to re-order items in a list as well as in a board. You can drag and drop items between columns as well as drag and drop columns. ## Example ![Basic Example](https://thumbs.gfycat.com/DeadUntidyHartebeest-size_restricted.gif) ## Download library with Jitpack.io Add this to your build.gradle file for your app. ```java allprojects { repositories { ... maven { url 'https://jitpack.io' } } } ``` Add this to your dependencies in build.gradle for your project. ```java dependencies { implementation 'com.github.jakebonk:BoardView:1.3.6' } ``` ## Usage BoardView utilizes a BoardAdapter, SimpleBoardAdapter is an example of how to extend BoardAdapter. ```java BoardView boardView = (BoardView)findViewById(R.id.boardview); ArrayList data = new ArrayList<>(); ArrayList list = new ArrayList(); list.add("Item 1"); list.add("Item 2"); list.add("Item 3"); list.add("Item 4"); data.add(new SimpleBoardAdapter.SimpleColumn("Column 1",list)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 2",list)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 3",list)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 4",list)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 5",list)); SimpleBoardAdapter boardAdapter = new SimpleBoardAdapter(this,data); boardView.setAdapter(boardAdapter); ``` To manipulate the BoardView simply call one of the new functions in BoardAdapter ```java void removeColumn(int index) void removeItem(int column, int index) void addItem(int column,int index, Object item) void addColumn(int index, Column column) ``` I also added the ability to set Transition animations when adding items/columns. ```java void SetColumnTransition(Transition t) void SetItemTransition(Transition t) ``` There are two types of drag listeners, the first is for columns ```java boardView.setOnDragColumnListener(new BoardView.DragColumnStartCallback() { @Override public void startDrag(View view, int startColumnPos) { } @Override public void changedPosition(View view, int startColumnPos, int newColumnPos) { } @Override public void dragging(View itemView, MotionEvent event) { } @Override public void endDrag(View view, int startColumnPos, int endColumnPos) { } }); ``` Similarly we can get the drag listener for items ```java boardView.setOnDragItemListener(new BoardView.DragItemStartCallback() { @Override public void startDrag(View view, int startItemPos, int startColumnPos) { } @Override public void changedPosition(View view, int startItemPos, int startColumnPos, int newItemPos, int newColumnPos) { } @Override public void dragging(View itemView, MotionEvent event) { } @Override public void endDrag(View view, int startItemPos, int startColumnPos, int endItemPos, int endColumnPos) { } }); ``` There is also a listener for when the BoardView has finished creating and assigning its views. ```java boardView.setOnDoneListener(new BoardView.DoneListener() { @Override public void onDone() { Log.e("ee","Done"); } }); ``` This is how to set the click listener for a item, header and footer, which gives their respective positions. ```java boardView.setOnItemClickListener(new BoardView.ItemClickListener() { @Override public void onClick(View v, int column_pos, int item_pos) { } }); boardView.setOnHeaderClickListener(new BoardView.HeaderClickListener() { @Override public void onClick(View v, int column_pos) { } }); boardView.setOnFooterClickListener(new BoardView.FooterClickListener() { @Override public void onClick(View v, int column_pos) { } }); ``` By setting SetColumnSnap you can allow the BoardView to snap to the closest column when scrolling, this is activated by default. To set it back to normal just set it to false ```java boardView.SetColumnSnap(true); or boardView.SetColumnSnap(false); ``` ### Creating your own BoardAdapter Creating a custom BoardAdapter is pretty similar to that of a BaseAdapter, the main focus being to create some type of object that help you create your custom views for both headers and items. The adapter also has two new abstract methods called, isColumnLocked when true prevents the column from being draggable. isItemLocked will not allow item to be dragged to or from this column. ```java @Override public boolean isColumnLocked(int column_position) { return false; } @Override public boolean isItemLocked(int column_position) { return false; } ``` You can also set the maximum amount of items you want in a list. If -1 is returned then there will be no cap otherwise the returned value will be the cap. The example below allow only 4 items inside any given column. ```java @Override public int maxItemCount(int column_position) { return 4; } ``` ### Things to fix There is a scaling issue when the column is beginning dragging or has ended dragging. I know this is an issue but I don't know of a good way to solve this at the moment. I eventually will fix it but for now I'm putting it on the back burners. ================================================ FILE: app/.gitignore ================================================ /build ================================================ FILE: app/build.gradle ================================================ apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { applicationId "com.allyants.boardviewexample" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.3.1' testCompile 'junit:junit:4.12' compile project(path: ':boardview') } ================================================ 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\jbonk\AppData\Local\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/androidTest/java/com/allyants/boardviewexample/ExampleInstrumentedTest.java ================================================ package com.allyants.boardviewexample; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see Testing documentation */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.allyants.boardviewexample", appContext.getPackageName()); } } ================================================ FILE: app/src/main/AndroidManifest.xml ================================================ ================================================ FILE: app/src/main/java/com/allyants/boardviewexample/MainActivity.java ================================================ package com.allyants.boardviewexample; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.view.MotionEvent; import android.view.View; import com.allyants.boardview.BoardView; import com.allyants.boardview.Item; import com.allyants.boardview.SimpleBoardAdapter; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { ArrayList list = new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final BoardView boardView = (BoardView)findViewById(R.id.boardView); boardView.SetColumnSnap(false); boardView.SetColumnSnap(true); final ArrayList data = new ArrayList<>(); list.add(new Item("I am a very long list that is not the same size as the others. I am a multiline")); list.add(new Item("Item 1")); final ArrayList empty = new ArrayList<>(); final ArrayList test = new ArrayList<>(); test.add(new Item("Item 1")); test.add(new Item("Item 1")); test.add(new Item("Item 1")); test.add(new Item("Item 1")); data.add(new SimpleBoardAdapter.SimpleColumn("Column 1",(ArrayList)list)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 2",(ArrayList)test)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 3",(ArrayList)empty)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 4",(ArrayList)empty)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 5",(ArrayList)empty)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 6",(ArrayList)empty)); data.add(new SimpleBoardAdapter.SimpleColumn("Column 7",(ArrayList)empty)); final SimpleBoardAdapter boardAdapter = new SimpleBoardAdapter(this,data); boardView.setAdapter(boardAdapter); boardView.setOnDoneListener(new BoardView.DoneListener() { @Override public void onDone() { Log.e("scroll","done"); } }); } } ================================================ FILE: app/src/main/res/layout/activity_main.xml ================================================ ================================================ FILE: app/src/main/res/values/colors.xml ================================================ #3F51B5 #303F9F #FF4081 ================================================ FILE: app/src/main/res/values/dimens.xml ================================================ 16dp 16dp ================================================ FILE: app/src/main/res/values/strings.xml ================================================ BoardViewExample ================================================ FILE: app/src/main/res/values/styles.xml ================================================ ================================================ FILE: app/src/main/res/values-w820dp/dimens.xml ================================================ 64dp ================================================ FILE: app/src/test/java/com/allyants/boardviewexample/ExampleUnitTest.java ================================================ package com.allyants.boardviewexample; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see Testing documentation */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } } ================================================ FILE: boardview/.gitignore ================================================ /build ================================================ FILE: boardview/build.gradle ================================================ apply plugin: 'com.android.library' android { compileSdkVersion 25 buildToolsVersion "25.0.2" defaultConfig { minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { exclude group: 'com.android.support', module: 'support-annotations' }) compile 'com.android.support:appcompat-v7:25.3.1' testCompile 'junit:junit:4.12' } ================================================ FILE: boardview/proguard-rules.pro ================================================ # Add project specific ProGuard rules here. # By default, the flags in this file are appended to flags specified # in C:\Users\jbonk\AppData\Local\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: boardview/src/androidTest/java/com/allyants/boardview/ExampleInstrumentedTest.java ================================================ package com.allyants.boardview; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see Testing documentation */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.allyants.boardview.test", appContext.getPackageName()); } } ================================================ FILE: boardview/src/main/AndroidManifest.xml ================================================ ================================================ FILE: boardview/src/main/java/com/allyants/boardview/BoardAdapter.java ================================================ package com.allyants.boardview; import android.content.Context; import android.transition.Fade; import android.transition.Transition; import android.transition.TransitionManager; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.ScrollView; import java.util.ArrayList; /** * Created by jbonk on 6/12/2017. */ public abstract class BoardAdapter{ Context context; Transition transition = new Fade(); Transition boardViewTransition = new Fade(); public ArrayList columns = new ArrayList<>(); public BoardAdapter(Context context){ this.context = context; } public BoardView boardView; public void createColumns(){ ArrayList tmp = new ArrayList<>(); for(int i = 0; i < getColumnCount();i++){ ArrayList views = new ArrayList<>(); Column column = new Column(createHeaderView(context,createHeaderObject(i),i),views,createFooterView(context,createFooterObject(i),i)); for(int j = 0; j < getItemCount(i);j++){ column.objects.add(createItemObject(i,j)); views.add(createItemView(context,createHeaderObject(i),createItemObject(i,j),i,j)); } column.items_locked = isItemLocked(i); column.column_locked = isColumnLocked(i); column.header_object = createHeaderObject(i); column.footer_object = createFooterObject(i); tmp.add(column); } columns = tmp; } public void SetItemTransition(Transition t){ transition = t; } public void SetColumnTransition(Transition t){ boardViewTransition = t; } public static class Column{ public View header; public Object header_object; public Object footer_object; public View footer; public Boolean column_locked = false; public Boolean items_locked = false; public ArrayList views = new ArrayList<>(); public ArrayList objects = new ArrayList<>(); public Column(){ this.footer_object = "Foot"; this.header_object = "Header"; } public Column(View header, ArrayList views,View footer){ this.header = header; this.views = views; this.footer = footer; } } public Object getHeaderObject(int column_position){ return columns.get(column_position).header_object; } public Object getItemObject(int column_position,int item_position){ return columns.get(column_position).objects.get(item_position); } public void addColumn(int index, Column column){ columns.add(index,column); for(int j = 0; j < getItemCount(index);j++){ column.objects.add(createItemObject(index,j)); column.views.add(createItemView(context,createHeaderObject(index),createItemObject(index,j),index,j)); } column.items_locked = isItemLocked(index); column.column_locked = isColumnLocked(index); column.header_object = createHeaderObject(index); column.footer_object = createFooterObject(index); column.header = createHeaderView(context,column.header_object,index); column.footer = createFooterView(context,column.footer_object,index); TransitionManager.beginDelayedTransition(boardView, boardViewTransition); boardView.addColumnList(column.header,column.views,column.footer,index); } public void removeColumn(int index){ BoardItem item = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(index); ViewGroup group = ((ViewGroup) item.getParent()); ((ViewGroup)item.getParent()).removeView(item); columns.remove(index); group.invalidate(); } public void removeItem(int column, int index){ BoardItem item = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(column); ScrollView scrollView = (ScrollView)item.getChildAt(1); LinearLayout llColumn = (LinearLayout)scrollView.getChildAt(0); llColumn.removeViewAt(index); llColumn.invalidate(); columns.get(column).objects.remove(index); columns.get(column).views.remove(index); } public void addItem(int column,int index, Object item){ BoardItem boardItem = (BoardItem)((ViewGroup)((ViewGroup)boardView.getChildAt(0)).getChildAt(0)).getChildAt(column); TransitionManager.beginDelayedTransition(boardItem, transition); ScrollView scrollView = (ScrollView)boardItem.getChildAt(1); LinearLayout llColumn = (LinearLayout)scrollView.getChildAt(0); columns.get(column).objects.add(index,item); View v = createItemView(context,columns.get(column).header_object,item,column,index); llColumn.addView(v,index); boardView.addBoardItem(v,column); llColumn.invalidate(); columns.get(column).views.add(index,v); } public abstract int getColumnCount(); public abstract int getItemCount(int column_position); public abstract int maxItemCount(int column_position); public abstract Object createHeaderObject(int column_position); public abstract Object createFooterObject(int column_position); public abstract Object createItemObject(int column_position,int item_position); public abstract boolean isColumnLocked(int column_position); public abstract boolean isItemLocked(int column_position); public abstract View createItemView(Context context,Object header_object, Object item,int column_position,int item_position); public abstract View createHeaderView(Context context,Object header_object,int column_position); public abstract View createFooterView(Context context,Object footer_object,int column_position); } ================================================ FILE: boardview/src/main/java/com/allyants/boardview/BoardItem.java ================================================ package com.allyants.boardview; import android.content.Context; import android.util.AttributeSet; import android.widget.LinearLayout; /** * Created by jbonk on 4/19/2017. */ public class BoardItem extends LinearLayout { int originalWidth = 0; int originalHeight = 0; private float scale = 1f; public BoardItem(Context context) { super(context); } public BoardItem(Context context, AttributeSet attrs) { super(context, attrs); } public BoardItem(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public void init(){ // originalHeight = 0; // originalWidth = 0; } public void setScale(float scale){ this.scale = scale; } public float getScale(){ return scale; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { if(getHeight() > 0 && getWidth() > 0 && scale != 1f) { if(originalWidth == 0){ originalWidth = getWidth(); } if(originalHeight == 0){ originalHeight = getHeight(); } this.setMeasuredDimension((int) (originalWidth * scale), (int) (originalHeight * scale)); }else { super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } } ================================================ FILE: boardview/src/main/java/com/allyants/boardview/BoardView.java ================================================ package com.allyants.boardview; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.os.Handler; import android.support.annotation.Nullable; import android.support.v4.view.ViewCompat; import android.util.AttributeSet; import android.util.DisplayMetrics; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.view.animation.Animation; import android.view.animation.DecelerateInterpolator; import android.view.animation.ScaleAnimation; import android.widget.FrameLayout; import android.widget.HorizontalScrollView; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.Scroller; import java.util.ArrayList; /** * Created by jbonk on 4/17/2017. */ public class BoardView extends FrameLayout { private static final float GLOBAL_SCALE = 0.6f; private static final int SCROLL_ANIMATION_DURATION = 325; private boolean mCellIsMobile = false; private BitmapDrawable mHoverCell; private Rect mHoverCellCurrentBounds; private Rect mHoverCellOriginalBounds; private boolean columnSnap; private boolean isTouched; private boolean isSnapping; private int HEADER_ID = generateViewId(); private int background_color; private HorizontalScrollView mRootLayout; private LinearLayout mParentLayout; private int originalPosition = -1; private int originalItemPosition = -1; public void setBackgroundColor(int color){ background_color = color; } public int getBackgroundColor(){ return background_color; } private DoneListener mDoneCallback = new DoneListener() { @Override public void onDone() { } }; private FooterClickListener footerClickListener = new FooterClickListener() { @Override public void onClick(View v, int column_pos) { } }; private HeaderClickListener headerClickListener = new HeaderClickListener() { @Override public void onClick(View v, int column_pos) { } }; private ItemClickListener itemClickListener = new ItemClickListener() { @Override public void onClick(View v, int column_pos, int item_pos) { } }; private DragColumnStartCallback mDragColumnStartCallback = new DragColumnStartCallback() { @Override public void startDrag(View itemView, int originalPosition) { } @Override public void changedPosition(View itemView, int originalPosition, int newPosition) { } @Override public void dragging(View itemView, MotionEvent event) { } @Override public void endDrag(View itemView, int originalPosition, int newPosition) { } }; private DragItemStartCallback mDragItemStartCallback = new DragItemStartCallback() { @Override public void startDrag(View itemView, int originalPosition,int originalColumn) { } @Override public void changedPosition(View itemView, int originalPosition,int originalColumn, int newPosition, int newColumn) { } @Override public void dragging(View itemView, MotionEvent event) { } @Override public void endDrag(View itemView, int originalPosition,int originalColumn, int newPosition, int newColumn) { } }; public boolean constWidth = true; private final int LINE_THICKNESS = 15; private boolean can_scroll = false; private boolean created = false; private int mLastEventX = -1; private int mLastEventY = -1; private Scroller mScroller; public interface DragColumnStartCallback{ void startDrag(View itemView, int originalPosition); void changedPosition(View itemView, int originalPosition, int newPosition); void dragging(View itemView, MotionEvent event); void endDrag(View itemView, int originalPosition, int newPosition); } public interface DragItemStartCallback{ void startDrag(View itemView, int originalPosition,int originalColumn); void changedPosition(View itemView, int originalPosition,int originalColumn, int newPosition, int newColumn); void dragging(View itemView, MotionEvent event); void endDrag(View itemView, int originalPosition,int originalColumn, int newPosition, int newColumn); } public interface FooterClickListener{ void onClick(View v,int column_pos); } public interface HeaderClickListener{ void onClick(View v,int column_pos); } public interface ItemClickListener{ void onClick(View v,int column_pos,int item_pos); } public void setOnHeaderClickListener(HeaderClickListener headerClickListener){ this.headerClickListener = headerClickListener; } public void setOnFooterClickListener(FooterClickListener footerClickListener){ this.footerClickListener = footerClickListener; } public void setOnItemClickListener(ItemClickListener itemClickListener){ this.itemClickListener = itemClickListener; } public void setOnDragColumnListener(DragColumnStartCallback dragStartCallback){ mDragColumnStartCallback = dragStartCallback; } public void setOnDragItemListener(DragItemStartCallback dragStartCallback){ mDragItemStartCallback = dragStartCallback; } public void setOnDoneListener(DoneListener onDoneListener){ mDoneCallback = onDoneListener; } long last_swap = System.currentTimeMillis(); long last_swap_item = System.currentTimeMillis(); final long ANIM_TIME = 300; long mDelaySwap = 400; long mDelaySwapItem = 400; private int mLastSwap = -1; private int mDownY = -1; private int mDownX = -1; private boolean mSwapped = false; private boolean canDragHorizontal = true; private boolean canDragVertical = true; private boolean mCellSubIsMobile = false; private int mTotalOffsetX = 0; private int mTotalOffsetY = 0; public BoardAdapter boardAdapter; private View mobileView; public BoardView(Context context) { super(context); } public BoardView(Context context, AttributeSet attrs) { super(context, attrs); TypedArray ta = context.obtainStyledAttributes(attrs,R.styleable.BoardView,0,0); try { background_color = ta.getColor(R.styleable.BoardView_boardItemBackground,Color.TRANSPARENT); }finally{ ta.recycle(); } } public BoardView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); TypedArray ta = context.obtainStyledAttributes(attrs,R.styleable.BoardView,0,0); try { background_color = ta.getColor(R.styleable.BoardView_boardItemBackground,Color.TRANSPARENT); }finally{ ta.recycle(); } } public interface DoneListener { void onDone(); } public void setAdapter(BoardAdapter boardAdapter){ this.boardAdapter = boardAdapter; Log.e("set","adapter"); boardAdapter.boardView = this; mParentLayout.removeAllViews(); boardAdapter.createColumns(); for(int i = 0;i < boardAdapter.columns.size();i++){ BoardAdapter.Column column = boardAdapter.columns.get(i); addColumnList(column.header,column.views,column.footer,i); } } @Override protected void onFinishInflate() { super.onFinishInflate(); mRootLayout = new HorizontalScrollView(getContext()); mRootLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT)); mParentLayout = new LinearLayout(getContext()); mParentLayout.setOrientation(LinearLayout.HORIZONTAL); mScroller = new Scroller(mRootLayout.getContext(), new DecelerateInterpolator(1.2f)); mParentLayout.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT)); mRootLayout.addView(mParentLayout); addView(mRootLayout); SetColumnSnap(true); } @Override protected void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); if(!created){ created = true; mDoneCallback.onDone(); } if(mHoverCell != null){ mHoverCell.draw(canvas); } } @Override public boolean onInterceptTouchEvent(MotionEvent event) { boolean colValue = handleColumnDragEvent(event); return colValue || super.onInterceptTouchEvent(event); } @Override public boolean onTouchEvent(MotionEvent event) { boolean colValue = handleColumnDragEvent(event); return colValue || super.onTouchEvent(event); } public int getStatusBarHeight() { int result = 0; int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); if (resourceId > 0) { result = getResources().getDimensionPixelSize(resourceId); } return result; } VelocityTracker mVelocityTracker = VelocityTracker.obtain(); public void SetColumnSnap(boolean columnSnap){ this.columnSnap = columnSnap; mRootLayout.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { isTouched = true; isSnapping = false; switch (event.getAction()){ case MotionEvent.ACTION_DOWN: mVelocityTracker.clear(); mVelocityTracker.addMovement(event); break; case MotionEvent.ACTION_MOVE: mVelocityTracker.addMovement(event); mVelocityTracker.computeCurrentVelocity(1000); break; case MotionEvent.ACTION_UP: isTouched = false; if(Math.abs(mVelocityTracker.getXVelocity()) < 230){ int pos = getPositionInListX(mRootLayout.getWidth()/2,mParentLayout); scrollToColumn(pos,true); } break; } return false; } }); if(this.columnSnap) { mRootLayout.setOnScrollChangeListener(onScrollChangeListener); }else{ mRootLayout.setOnScrollChangeListener(null); } } OnScrollChangeListener onScrollChangeListener = new OnScrollChangeListener() { @Override public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { if(!isTouched && !isSnapping && mParentLayout.getChildCount() > 0) { int deltaX = Math.abs(oldScrollX - scrollX); if(deltaX < 3){ //Scroll To closest column isSnapping = true; int[] location = new int[2]; mParentLayout.getLocationOnScreen(location); int offset = (mParentLayout.getChildAt(0).getWidth())/2; if(oldScrollX - scrollX <= 0){ offset *= 2; } int x = scrollX+location[0]+offset; int pos = getPositionInListX(x,mParentLayout); scrollToColumn(pos,true); } } } }; public void scrollToColumn(int column,boolean animate){ if(column >= 0) { View childView = mParentLayout.getChildAt(column); if(childView != null) { final int newX = childView.getLeft() - (int) (((getMeasuredWidth() - childView.getMeasuredWidth()) / 2)); if (animate) { mRootLayout.post(new Runnable() { @Override public void run() { mRootLayout.smoothScrollTo(newX, 0); } }); } else { mRootLayout.scrollTo(newX, 0); } } } } public boolean handleColumnDragEvent(MotionEvent event){ switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: mDownX = (int)event.getX(); mDownY = (int)event.getRawY(); break; case MotionEvent.ACTION_MOVE: if(mDownY == -1){ mDownY = (int)event.getRawY(); } if(mDownX == -1){ mDownX = (int)event.getX(); } mLastEventX = (int) event.getX(); mLastEventY = (int) event.getRawY(); int deltaX = mLastEventX - mDownX; int deltaY = mLastEventY - mDownY; if(mCellSubIsMobile){ if(mDragItemStartCallback != null) mDragItemStartCallback.dragging(mobileView,event); int offsetX = 0; if(canDragHorizontal){ offsetX = deltaX; } int offsetY = mHoverCellOriginalBounds.top; if(canDragVertical){ offsetY = mHoverCellOriginalBounds.top + deltaY; } mHoverCell.setBounds(rotatedBounds(mHoverCellCurrentBounds,0.0523599f)); mHoverCellCurrentBounds.offsetTo(offsetX, mLastEventY - 330); invalidate(); handleItemSwitchHorizontal(); return true; }else if (mCellIsMobile) { if(mDragColumnStartCallback != null) mDragColumnStartCallback.dragging(mobileView,event); int offsetX = 0; if(canDragHorizontal){ offsetX = deltaX; } int offsetY = mHoverCellOriginalBounds.top; if(canDragVertical){ offsetY = mHoverCellOriginalBounds.top + deltaY + mTotalOffsetY; } mHoverCell.setBounds(rotatedBounds(mHoverCellCurrentBounds,0.0523599f)); mHoverCellCurrentBounds.offsetTo(offsetX, offsetY); invalidate(); handleColumnSwitchHorizontal(); return true; } break; case MotionEvent.ACTION_UP: touchEventsCancelled(); break; case MotionEvent.ACTION_CANCEL: touchEventsCancelled(); break; case MotionEvent.ACTION_POINTER_UP: /* If a multitouch event took place and the original touch dictating * the movement of the hover cell has ended, then the dragging event * ends and the hover cell is animated to its corresponding position * in the listview. */ // pointerIndex = (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK) >> // MotionEvent.ACTION_POINTER_INDEX_SHIFT; // final int pointerId = event.getPointerId(pointerIndex); // if (pointerId == mActivePointerId) { // // } break; default: break; } return false; } @Override public void computeScroll() { if (!mScroller.isFinished() && mScroller.computeScrollOffset()) { int x = mScroller.getCurrX(); int y = mScroller.getCurrY(); if (getScrollX() != x || getScrollY() != y) { scrollTo(x, y); } ViewCompat.postInvalidateOnAnimation(this); } else { super.computeScroll(); } } //checks if item should be switched between columns private void handleItemSwitchHorizontal(){ int itemPos = ((LinearLayout)(mobileView.getParent())).indexOfChild(mobileView); View aboveView = ((LinearLayout)(mobileView.getParent())).getChildAt(itemPos - 1); View belowView = ((LinearLayout)(mobileView.getParent())).getChildAt(itemPos + 1); int[] location = new int[2]; mobileView.getLocationOnScreen(location); int[] parentLocation = new int[2]; ScrollView parent = ((ScrollView)((LinearLayout)mobileView.getParent()).getParent()); parent.getLocationOnScreen(parentLocation); if(mLastEventY < parentLocation[1]+200){ parent.smoothScrollBy(0,-10); } if(mLastEventY > parentLocation[1]+parent.getHeight()-200){ parent.smoothScrollBy(0,10); } int columnPos = mParentLayout.indexOfChild((View)(mobileView.getParent().getParent().getParent())); //swapping above if(aboveView != null){ int[] locationAbove = new int[2]; aboveView.getLocationInWindow(locationAbove); if(locationAbove[1]+aboveView.getHeight()/2 > mLastEventY){ switchItemFromPosition(-1,mobileView); } } //swapping below if(belowView != null){ int[] locationBelow = new int[2]; belowView.getLocationOnScreen(locationBelow); if(locationBelow[1] + belowView.getHeight()/2 < mLastEventY){ switchItemFromPosition(1,mobileView); } } int leftPos = 1; while (columnPos - leftPos > 0 && boardAdapter.columns.get(columnPos - leftPos).items_locked){ leftPos++; } if(columnPos-leftPos >= 0 && columnPos-leftPos < boardAdapter.columns.size()) { while (boardAdapter.maxItemCount(columnPos - leftPos) != -1 && boardAdapter.maxItemCount(columnPos - leftPos) <= boardAdapter.columns.get(columnPos - leftPos).objects.size() && columnPos - leftPos != 0) { leftPos++; } } View leftView = mParentLayout.getChildAt(columnPos - leftPos); View currentView = mParentLayout.getChildAt(columnPos); int rightPos = 1; while(boardAdapter.columns.size() > columnPos+rightPos && boardAdapter.columns.get(columnPos + rightPos).items_locked){ rightPos++; } if(columnPos + rightPos >= 0 && columnPos + rightPos < boardAdapter.columns.size()) { while (boardAdapter.maxItemCount(columnPos + rightPos) != -1 && columnPos + rightPos != boardAdapter.columns.size() && boardAdapter.maxItemCount(columnPos + rightPos) <= boardAdapter.columns.get(columnPos + rightPos).objects.size()) { rightPos++; } } View rightView = mParentLayout.getChildAt(columnPos + rightPos); View firstLeftView = mParentLayout.getChildAt(columnPos-1); View firstRightView = mParentLayout.getChildAt(columnPos+1); if(leftView != null){ int[] locationLeft = new int[2]; firstLeftView.getLocationOnScreen(locationLeft); if (locationLeft[0] + leftView.getWidth() > mLastEventX) { int pos = ((LinearLayout)mobileView.getParent()).indexOfChild(mobileView); if(last_swap_item <= System.currentTimeMillis() - mDelaySwapItem) { last_swap_item = System.currentTimeMillis(); if(((LinearLayout)mobileView.getParent()) != null) { scrollToColumn(columnPos-leftPos,true); if(boardAdapter.maxItemCount(columnPos-leftPos) == -1 || boardAdapter.maxItemCount(columnPos-leftPos) > boardAdapter.columns.get(columnPos-leftPos).objects.size()) { ((LinearLayout) mobileView.getParent()).removeViewAt(pos); LinearLayout layout = ((LinearLayout) ((ScrollView) ((ViewGroup) leftView).getChildAt(1)).getChildAt(0)); layout.addView(mobileView, getPositionInListY(mLastEventY, layout)); int newItemPos = ((LinearLayout) ((ViewGroup) leftView).getChildAt(0)).indexOfChild(mobileView) - 1; int newColumnPos = ((LinearLayout) mobileView.getParent().getParent().getParent()).indexOfChild((View) (mobileView.getParent().getParent())); mDragItemStartCallback.changedPosition(mobileView, originalItemPosition, originalPosition, newItemPos, newColumnPos); } } } } } if(rightView != null){ int[] locationRight = new int[2]; firstRightView.getLocationOnScreen(locationRight); if (locationRight[0] < mLastEventX) { int pos = ((LinearLayout)mobileView.getParent()).indexOfChild(mobileView); if(last_swap_item <= System.currentTimeMillis() - mDelaySwapItem) { last_swap_item = System.currentTimeMillis(); if(((LinearLayout)mobileView.getParent()) != null) { scrollToColumn(columnPos+rightPos,true); if(boardAdapter.maxItemCount(columnPos+rightPos) == -1 || boardAdapter.maxItemCount(columnPos+rightPos) > boardAdapter.columns.get(columnPos+rightPos).objects.size()) { ((LinearLayout) mobileView.getParent()).removeViewAt(pos); LinearLayout layout = ((LinearLayout) ((ScrollView) ((ViewGroup) rightView).getChildAt(1)).getChildAt(0)); layout.addView(mobileView, getPositionInListY(mLastEventY, layout)); int newItemPos = ((LinearLayout) ((ViewGroup) rightView).getChildAt(0)).indexOfChild(mobileView) - 1; int newColumnPos = ((LinearLayout) mobileView.getParent().getParent().getParent()).indexOfChild((View) (mobileView.getParent().getParent())); mDragItemStartCallback.changedPosition(mobileView, originalItemPosition, originalPosition, newItemPos, newColumnPos); } } } } } } //Gets the position of a item inside a list based on the y offset public int getPositionInListY(int y,LinearLayout layout){ for(int i = 0; i < layout.getChildCount();i++){ int[] location = new int[2]; View view = layout.getChildAt(i); view.getLocationOnScreen(location); if(y > location[1] && y < location[1]+view.getHeight()){ return i; } } return 0; } //Gets the position of a item inside a list based on the y offset public int getPositionInListX(int x,LinearLayout layout){ for(int i = 0; i < layout.getChildCount();i++){ int[] location = new int[2]; View view = layout.getChildAt(i); int end = layout.getWidth(); if(layout.getChildCount() > i+1){ int[] end_location = new int[2]; layout.getChildAt(i+1).getLocationOnScreen(end_location); end = end_location[0]; } view.getLocationOnScreen(location); if(x >= location[0] && x <= end){ return i; } } return 0; } //Change int change to position to fix problem with starting from the bottom private void switchItemFromPosition(int change,View view){ LinearLayout parentLayout = (LinearLayout)(view.getParent()); int columnPos = parentLayout.indexOfChild(view); if (columnPos + change >= 0 && columnPos + change < parentLayout.getChildCount()) { parentLayout.removeView(view); parentLayout.addView(view, columnPos + change); if (mDragItemStartCallback != null) { int newPos = parentLayout.indexOfChild(view); last_swap = System.currentTimeMillis(); mLastSwap = newPos; int newColumnPos = ((LinearLayout) mobileView.getParent().getParent().getParent().getParent()).indexOfChild((View) (mobileView.getParent().getParent().getParent())); mDragItemStartCallback.changedPosition(view, originalItemPosition, originalPosition, newPos, newColumnPos); } } } private void handleColumnSwitchHorizontal(){ if(can_scroll && last_swap <= System.currentTimeMillis()-mDelaySwap) { int columnPos = mParentLayout.indexOfChild(mobileView); View leftView = mParentLayout.getChildAt(columnPos - 1); View rightView = mParentLayout.getChildAt(columnPos + 1); int[] locationRight = new int[2]; if (rightView != null) { rightView.getLocationOnScreen(locationRight); if (locationRight[0] < mLastEventX) { //Scroll to the right switchColumnFromPosition(1,mobileView); if (locationRight[0] + (rightView.getWidth() / 2) < mLastEventX) { } } } int[] locationLeft = new int[2]; if (leftView != null) { leftView.getLocationOnScreen(locationLeft); if (locationLeft[0] + leftView.getWidth() > mLastEventX) { //Scroll to the right switchColumnFromPosition(-1,mobileView); //mRootLayout.scrollBy(-1 * 2, 0); if (locationLeft[0] + (leftView.getWidth() / 2) > mLastEventX) { } } } } } private void switchColumnFromPosition(int change,View view){ int columnPos = mParentLayout.indexOfChild(view); if(columnPos+change >= 0 && last_swap <= System.currentTimeMillis()-mDelaySwap) { mParentLayout.removeView(view); mParentLayout.addView(view, columnPos + change); if(mDragColumnStartCallback != null){ int newPos = mParentLayout.indexOfChild(view); last_swap = System.currentTimeMillis(); mLastSwap = newPos; Handler handlerTimer = new Handler(); handlerTimer.postDelayed(new Runnable(){ public void run() { scrollToColumn(mLastSwap,true); }}, 0); mDragColumnStartCallback.changedPosition(((LinearLayout)view).getChildAt(0),originalPosition,newPos); } } } private void touchEventsCancelled() { if(mCellSubIsMobile){ mobileView.setVisibility(VISIBLE); mHoverCell = null; invalidate(); LinearLayout parentLayout = (LinearLayout)(mobileView.getParent().getParent().getParent().getParent()); int columnPos = parentLayout.indexOfChild((View)(mobileView.getParent().getParent().getParent())); int pos = ((LinearLayout)mobileView.getParent()).indexOfChild(mobileView); View tmpView = boardAdapter.columns.get(originalPosition).views.get(originalItemPosition); boardAdapter.columns.get(originalPosition).views.remove(originalItemPosition); boardAdapter.columns.get(columnPos).views.add(pos, tmpView); Object tmpObject = boardAdapter.columns.get(originalPosition).objects.get(originalItemPosition); boardAdapter.columns.get(originalPosition).objects.remove(originalItemPosition); boardAdapter.columns.get(columnPos).objects.add(pos, tmpObject); if (mDragItemStartCallback != null) { mDragItemStartCallback.endDrag(mobileView, originalItemPosition,originalPosition, pos, columnPos); } }else if(mCellIsMobile){ for(int i = 0;i < mParentLayout.getChildCount();i++){ BoardItem parentView = (BoardItem)mParentLayout.getChildAt(i);//Gets the parent layout for(int j = 0;j < parentView.getChildCount();j++) { View childView = ((LinearLayout) parentView).getChildAt(j); scrollToColumn(originalPosition, true); scaleView(childView, parentView, GLOBAL_SCALE, 1f); } } mobileView.setVisibility(VISIBLE); mHoverCell = null; invalidate(); if(mDragColumnStartCallback != null){ int columnPos = mParentLayout.indexOfChild(mobileView); scrollToColumn(columnPos,true); BoardAdapter.Column column = boardAdapter.columns.get(originalPosition); boardAdapter.columns.remove(originalPosition); boardAdapter.columns.add(columnPos,column); mDragColumnStartCallback.endDrag(((LinearLayout)mobileView).getChildAt(0),originalPosition,columnPos); } } mDownX = -1; mDownY = -1; mCellSubIsMobile = false; mCellIsMobile = false; } Handler handler = new Handler(); public void scaleView(final View v, final BoardItem parent, final float startScale, final float endScale) { final Animation anim = new ScaleAnimation( startScale, endScale, // Start and end values for the X axis scaling startScale, endScale, // Start and end values for the Y axis scaling Animation.RELATIVE_TO_SELF,0f, // Pivot point of X scaling Animation.RELATIVE_TO_SELF, 0f); // Pivot point of Y scaling anim.setFillAfter(true); // Needed to keep the result of the animation anim.setFillBefore(false); anim.setFillEnabled(true); anim.setDuration(ANIM_TIME); v.startAnimation(anim); final long startTime = System.currentTimeMillis(); anim.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { handler.post(createRunnable(parent,startTime,startScale,endScale)); parent.init(); can_scroll = false; } @Override public void onAnimationEnd(Animation animation) { parent.setScale(endScale); scrollToColumn(mLastSwap,true); parent.requestLayout(); parent.invalidate(); can_scroll = true; } @Override public void onAnimationRepeat(Animation animation) { } }); } private Runnable createRunnable(final BoardItem parent, final long startTime, final float startScale, final float endScale){ Runnable runnable = new Runnable() { @Override public void run() { long time = System.currentTimeMillis()-startTime; float scale_time = time/(float)ANIM_TIME; if(scale_time > 1){ scale_time = 1; } scrollToColumn(mLastSwap,true); parent.setScale(startScale + (endScale - startScale)*scale_time); parent.requestLayout(); parent.invalidate(); if(scale_time != 1) { handler.postDelayed(this,10); } } }; return runnable; } private ViewGroup removeParent(View view){ if(view == null){ return null; } ViewGroup viewGroup = ((ViewGroup)view.getParent()); if(viewGroup != null){ viewGroup.removeView(view); } return viewGroup; } public void notifyDataSetChanged(){ for(int column_pos = 0; column_pos < boardAdapter.columns.size(); column_pos++) { if(boardAdapter.columns.get(column_pos).header != null) { ViewGroup parent_header = removeParent(boardAdapter.columns.get(column_pos).header); boardAdapter.columns.get(column_pos).header = boardAdapter.createHeaderView(getContext(), boardAdapter.columns.get(column_pos).header_object, column_pos); parent_header.addView(boardAdapter.columns.get(column_pos).header); ViewGroup layout = (ViewGroup)parent_header.getParent(); boardAdapter.columns.get(column_pos).header.setOnClickListener(createHeaderOnClickListener(layout)); boardAdapter.columns.get(column_pos).header.setOnLongClickListener(createHeaderOnLongClickListener(parent_header,layout)); } if(boardAdapter.columns.get(column_pos).footer != null) { ViewGroup parent_footer = removeParent(boardAdapter.columns.get(column_pos).footer); boardAdapter.columns.get(column_pos).footer = boardAdapter.createFooterView(getContext(), boardAdapter.columns.get(column_pos).footer_object, column_pos); parent_footer.addView(boardAdapter.columns.get(column_pos).footer); } } } private OnClickListener createHeaderOnClickListener(final View parent_layout){ return new OnClickListener() { @Override public void onClick(View v) { int pos = mParentLayout.indexOfChild(parent_layout); scrollToColumn(pos,true); headerClickListener.onClick(v,pos); } }; } private OnLongClickListener createHeaderOnLongClickListener(final ViewGroup layout,final View parent_layout){ return new OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mDragColumnStartCallback == null) { return false; } originalPosition = mParentLayout.indexOfChild(parent_layout); mDragColumnStartCallback.startDrag(layout, originalPosition); mLastSwap = originalPosition; for (int i = 0; i < mParentLayout.getChildCount(); i++) { BoardItem parentView = (BoardItem) mParentLayout.getChildAt(i);//Gets the parent layout for (int j = 0; j < parentView.getChildCount(); j++) { View childView = ((LinearLayout) parentView).getChildAt(j); scrollToColumn(originalPosition, true); scaleView(childView, parentView, 1f, GLOBAL_SCALE); } } scrollToColumn(originalPosition, false); mCellIsMobile = true; mobileView = (View) (parent_layout); mHoverCell = getAndAddHoverView(mobileView, GLOBAL_SCALE); mobileView.setVisibility(INVISIBLE); return false; } }; } private OnClickListener createFooterOnClickListener(final View parent_layout){ return new OnClickListener() { @Override public void onClick(View v) { int column_pos = mParentLayout.indexOfChild(parent_layout); footerClickListener.onClick(v,column_pos); } }; } public void addColumnList(@Nullable View header, ArrayList items, @Nullable final View footer,int column_pos){ final BoardItem parent_layout = new BoardItem(getContext()); parent_layout.setBackgroundColor(background_color); final LinearLayout layout = new LinearLayout(getContext()); final ScrollView scroll_view = new ScrollView(getContext()); ScrollView.LayoutParams scrollParams = new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT, ScrollView.LayoutParams.WRAP_CONTENT); scroll_view.setLayoutParams(scrollParams); final LinearLayout layout_children = new LinearLayout(getContext()); layout_children.setOrientation(LinearLayout.VERTICAL); layout.setOrientation(LinearLayout.VERTICAL); parent_layout.setOrientation(LinearLayout.VERTICAL); if(constWidth) { int margin = calculatePixelFromDensity(8); LayoutParams params = new LayoutParams(calculatePixelFromDensity(240), LayoutParams.WRAP_CONTENT); LayoutParams parent_params = new LayoutParams(calculatePixelFromDensity(240), LayoutParams.WRAP_CONTENT); layout.setLayoutParams(params); parent_params.setMargins(margin,margin,margin,margin); parent_layout.setLayoutParams(parent_params); }else { int margin = calculatePixelFromDensity(8); LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); LayoutParams parent_params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); layout.setLayoutParams(params); parent_params.setMargins(margin,margin,margin,margin); parent_layout.setLayoutParams(parent_params); } parent_layout.addView(layout); if(header != null){ header.setId(HEADER_ID); removeParent(header); layout.addView(header); header.setOnClickListener(createHeaderOnClickListener(parent_layout)); if(!boardAdapter.columns.get(column_pos).column_locked) { header.setOnLongClickListener(createHeaderOnLongClickListener(layout,parent_layout)); } } parent_layout.addView(scroll_view); scroll_view.addView(layout_children); for(int i = 0;i < items.size();i++){ final View view = items.get(i); removeParent(view); layout_children.addView(view); addBoardItem(view,column_pos); } if(footer != null) { removeParent(footer); final LinearLayout footer_layout = new LinearLayout(getContext()); footer_layout.setOrientation(LinearLayout.VERTICAL); final LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); params.setMargins(0,200*-1,0,0); layout.addView(footer); footer_layout.setLayoutParams(params); parent_layout.addView(footer_layout); footer.setOnClickListener(createFooterOnClickListener(parent_layout)); footer.post(new Runnable() { @Override public void run() { scroll_view.setPadding(0,0,0,footer.getHeight()); final LinearLayout.LayoutParams new_params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); new_params.setMargins(0,footer.getHeight()*-1,0,0); removeParent(footer); footer_layout.setLayoutParams(new_params); footer_layout.addView(footer); } }); } mParentLayout.addView(parent_layout,column_pos); } public void addBoardItem(final View view, final int column_pos){ view.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { LinearLayout layout = (LinearLayout)view.getParent(); BoardItem parent_layout = (BoardItem)layout.getParent().getParent(); int pos = mParentLayout.indexOfChild(parent_layout); int i = layout.indexOfChild(view); itemClickListener.onClick(view,pos, i); } }); if(!boardAdapter.columns.get(column_pos).items_locked) { view.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { if (mDragItemStartCallback == null) { return false; } originalPosition = mParentLayout.indexOfChild((LinearLayout) ((LinearLayout) view.getParent()).getParent().getParent()); originalItemPosition = ((LinearLayout) view.getParent()).indexOfChild(view); mDragItemStartCallback.startDrag(view, originalItemPosition,originalPosition); mCellSubIsMobile = true; mobileView = (View) (view); mHoverCell = getAndAddHoverView(mobileView, 1); mobileView.setVisibility(INVISIBLE); return false; } }); } } private int calculatePixelFromDensity(float dp){ DisplayMetrics metrics = getContext().getResources().getDisplayMetrics(); float fpixels = metrics.density * dp; int pixels = (int) (fpixels + 0.5f); return pixels; } private BitmapDrawable getAndAddHoverView(View v, float scale){ int w = v.getWidth(); int h = v.getHeight(); int top = v.getTop(); int left = v.getLeft(); Bitmap b = getBitmapWithBorder(v,scale); BitmapDrawable drawable = new BitmapDrawable(getResources(),b); mHoverCellOriginalBounds = new Rect(left,top,left+w,top+h); mHoverCellCurrentBounds = new Rect(mHoverCellOriginalBounds); drawable.setBounds(mHoverCellCurrentBounds); return drawable; } private Bitmap getBitmapWithBorder(View v, float scale) { Bitmap bitmap = getBitmapFromView(v,0); Bitmap b = getBitmapFromView(v,1); Canvas can = new Canvas(bitmap); Paint paint = new Paint(); paint.setAlpha(150); can.scale(scale,scale,mDownX,mDownY); can.rotate(3); can.drawBitmap(b,0,0,paint); return bitmap; } private Bitmap getBitmapFromView(View v, float scale){ double radians = 0.0523599f; double s = Math.abs(Math.sin(radians)); double c = Math.abs(Math.cos(radians)); int width = (int)(v.getHeight()*s + v.getWidth()*c); int height = (int)(v.getWidth()*s + v.getHeight()*c); Bitmap bitmap = Bitmap.createBitmap(width,height,Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); canvas.scale(scale,scale); v.draw(canvas); return bitmap; } private Rect rotatedBounds(Rect tmp,double radians){ double s = Math.abs(Math.sin(radians)); double c = Math.abs(Math.cos(radians)); int width = (int)(tmp.height()*s + tmp.width()*c); int height = (int)(tmp.width()*s + tmp.height()*c); return new Rect(tmp.left,tmp.top,tmp.left+width,tmp.top+height); } } ================================================ FILE: boardview/src/main/java/com/allyants/boardview/Item.java ================================================ package com.allyants.boardview; /** * Created by jbonk on 5/5/2018. */ public class Item{ public String item; public Item(String item){ this.item = item; } public String toString(){ return item; } } ================================================ FILE: boardview/src/main/java/com/allyants/boardview/SimpleBoardAdapter.java ================================================ package com.allyants.boardview; import android.content.Context; import android.view.View; import android.widget.TextView; import java.util.ArrayList; /** * Created by jbonk on 6/12/2017. */ public class SimpleBoardAdapter extends BoardAdapter{ int header_resource; int item_resource; public SimpleBoardAdapter instance; public SimpleBoardAdapter(Context context, ArrayList data) { super(context); instance = this; this.columns = (ArrayList)data; this.header_resource = R.layout.column_header; this.item_resource = R.layout.column_item; } @Override public int getColumnCount() { return columns.size(); } @Override public int getItemCount(int column_position) { return columns.get(column_position).objects.size(); } @Override public Object createHeaderObject(int column_position) { return columns.get(column_position).header_object; } @Override public Object createFooterObject(int column_position) { return "Footer "+ String.valueOf(column_position); } @Override public Object createItemObject(int column_position, int item_position) { return columns.get(column_position).objects.get(item_position); } @Override public boolean isColumnLocked(int column_position) { return false; } @Override public boolean isItemLocked(int column_position) { return false; } @Override public View createItemView(Context context,Object header_object,Object item_object,int column_position, int item_position) { View item = View.inflate(context, item_resource, null); TextView textView = (TextView)item.findViewById(R.id.textView); textView.setText(columns.get(column_position).objects.get(item_position).toString()); return item; } @Override public int maxItemCount(int column_position) { return 4; } @Override public void createColumns() { super.createColumns(); } @Override public View createHeaderView(Context context,Object header_object,int column_position) { View column = View.inflate(context, header_resource, null); TextView textView = (TextView)column.findViewById(R.id.textView); textView.setText(columns.get(column_position).header_object.toString()); return column; } @Override public View createFooterView(Context context, Object footer_object, int column_position) { View footer = View.inflate(context, header_resource, null); TextView textView = (TextView)footer.findViewById(R.id.textView); textView.setText((String)footer_object); return footer; } public static class SimpleColumn extends Column{ public String title; public SimpleColumn(String title, ArrayList items){ super(); this.title = title; this.header_object = new Item(title); this.objects = items; } } } ================================================ FILE: boardview/src/main/res/drawable/shadow_background.xml ================================================ ================================================ FILE: boardview/src/main/res/layout/column_header.xml ================================================ ================================================ FILE: boardview/src/main/res/layout/column_item.xml ================================================ ================================================ FILE: boardview/src/main/res/values/attrs.xml ================================================ ================================================ FILE: boardview/src/main/res/values/strings.xml ================================================ BoardView ================================================ FILE: boardview/src/test/java/com/allyants/boardview/ExampleUnitTest.java ================================================ package com.allyants.boardview; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see Testing documentation */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } } ================================================ FILE: build.gradle ================================================ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:2.2.3' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { jcenter() } } task clean(type: Delete) { delete rootProject.buildDir } ================================================ FILE: gradle/wrapper/gradle-wrapper.properties ================================================ #Mon Dec 28 10:00:20 PST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.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. org.gradle.jvmargs=-Xmx1536m # 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 ================================================ 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', ':boardview'