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
================================================
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<Objective-C-extensions>
<file>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
</file>
<class>
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
</class>
<extensions>
<pair source="cpp" header="h" fileNamingConvention="NONE" />
<pair source="c" header="h" fileNamingConvention="NONE" />
</extensions>
</Objective-C-extensions>
</code_scheme>
</component>
================================================
FILE: .idea/compiler.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>
================================================
FILE: .idea/copyright/profiles_settings.xml
================================================
<component name="CopyrightManager">
<settings default="" />
</component>
================================================
FILE: .idea/gradle.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
<option value="$PROJECT_DIR$/boardview" />
</set>
</option>
<option name="resolveModulePerSourceSet" value="false" />
</GradleProjectSettings>
</option>
</component>
</project>
================================================
FILE: .idea/inspectionProfiles/Project_Default.xml
================================================
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="AndroidLintNewApi" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="LoggerInitializedWithForeignClass" enabled="false" level="WARNING" enabled_by_default="false">
<option name="loggerClassName" value="org.apache.log4j.Logger,org.slf4j.LoggerFactory,org.apache.commons.logging.LogFactory,java.util.logging.Logger" />
<option name="loggerFactoryMethodName" value="getLogger,getLogger,getLog,getLogger" />
</inspection_tool>
</profile>
</component>
================================================
FILE: .idea/inspectionProfiles/profiles_settings.xml
================================================
<component name="InspectionProjectProfileManager">
<settings>
<option name="PROJECT_PROFILE" value="Project Default" />
<option name="USE_PROJECT_PROFILE" value="true" />
<version value="1.0" />
</settings>
</component>
================================================
FILE: .idea/misc.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.2" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project>
================================================
FILE: .idea/modules.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/BoardView.iml" filepath="$PROJECT_DIR$/BoardView.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
<module fileurl="file://$PROJECT_DIR$/boardview/boardview.iml" filepath="$PROJECT_DIR$/boardview/boardview.iml" />
</modules>
</component>
</project>
================================================
FILE: .idea/runConfigurations.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>
================================================
FILE: .idea/vcs.xml
================================================
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
================================================
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/#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

## 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<SimpleBoardAdapter.SimpleColumn> data = new ArrayList<>();
ArrayList<String> list = new ArrayList<String>();
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@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
================================================
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.allyants.boardviewexample">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
================================================
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<Item> 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<SimpleBoardAdapter.SimpleColumn> 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<Item> empty = new ArrayList<>();
final ArrayList<Item> 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
================================================
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.allyants.boardview.BoardView
xmlns:boardview="http://schemas.android.com/apk/res-auto/com.allyants.boardview"
boardview:boardItemBackground="@color/colorPrimary"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/boardView" />
</RelativeLayout>
================================================
FILE: app/src/main/res/values/colors.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
<color name="colorPrimaryDark">#303F9F</color>
<color name="colorAccent">#FF4081</color>
</resources>
================================================
FILE: app/src/main/res/values/dimens.xml
================================================
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>
================================================
FILE: app/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">BoardViewExample</string>
</resources>
================================================
FILE: app/src/main/res/values/styles.xml
================================================
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
</resources>
================================================
FILE: app/src/main/res/values-w820dp/dimens.xml
================================================
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>
================================================
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@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
================================================
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.allyants.boardview">
<application android:allowBackup="true" android:label="@string/app_name"
android:supportsRtl="true">
</application>
</manifest>
================================================
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<Column> columns = new ArrayList<>();
public BoardAdapter(Context context){
this.context = context;
}
public BoardView boardView;
public void createColumns(){
ArrayList<Column> tmp = new ArrayList<>();
for(int i = 0; i < getColumnCount();i++){
ArrayList<View> 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<View> views = new ArrayList<>();
public ArrayList<Object> objects = new ArrayList<>();
public Column(){
this.footer_object = "Foot";
this.header_object = "Header";
}
public Column(View header, ArrayList<View> 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<View> 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<SimpleColumn> 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<Object> items){
super();
this.title = title;
this.header_object = new Item(title);
this.objects = items;
}
}
}
================================================
FILE: boardview/src/main/res/drawable/shadow_background.xml
================================================
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#CABBBBBB"/>
<corners android:radius="2dp" />
</shape>
</item>
<item
android:left="1dp"
android:right="1dp"
android:top="0dp"
android:bottom="2dp">
<shape android:shape="rectangle">
<solid android:color="@android:color/white"/>
<corners android:radius="2dp" />
</shape>
</item>
</layer-list>
================================================
FILE: boardview/src/main/res/layout/column_header.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white">
<TextView
android:text="Hello World this is a test"
android:layout_height="wrap_content"
android:id="@+id/textView"
android:textAlignment="center"
android:maxWidth="240dp"
android:layout_width="230dp"
android:textSize="20dp" />
</LinearLayout>
================================================
FILE: boardview/src/main/res/layout/column_item.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal">
<TextView
android:text="Hello World this is a test"
android:layout_height="wrap_content"
android:background="@drawable/shadow_background"
android:id="@+id/textView"
android:textAlignment="center"
android:maxWidth="240dp"
android:textSize="20dp"
android:layout_width="200dp" />
</LinearLayout>
================================================
FILE: boardview/src/main/res/values/attrs.xml
================================================
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="BoardView">
<attr name="boardItemBackground" format="color" />
</declare-styleable>
</resources>
================================================
FILE: boardview/src/main/res/values/strings.xml
================================================
<resources>
<string name="app_name">BoardView</string>
</resources>
================================================
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 <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
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'
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
SYMBOL INDEX (136 symbols across 10 files)
FILE: app/src/androidTest/java/com/allyants/boardviewexample/ExampleInstrumentedTest.java
class ExampleInstrumentedTest (line 17) | @RunWith(AndroidJUnit4.class)
method useAppContext (line 19) | @Test
FILE: app/src/main/java/com/allyants/boardviewexample/MainActivity.java
class MainActivity (line 15) | public class MainActivity extends AppCompatActivity {
method onCreate (line 18) | @Override
FILE: app/src/test/java/com/allyants/boardviewexample/ExampleUnitTest.java
class ExampleUnitTest (line 12) | public class ExampleUnitTest {
method addition_isCorrect (line 13) | @Test
FILE: boardview/src/androidTest/java/com/allyants/boardview/ExampleInstrumentedTest.java
class ExampleInstrumentedTest (line 17) | @RunWith(AndroidJUnit4.class)
method useAppContext (line 19) | @Test
FILE: boardview/src/main/java/com/allyants/boardview/BoardAdapter.java
class BoardAdapter (line 18) | public abstract class BoardAdapter{
method BoardAdapter (line 24) | public BoardAdapter(Context context){
method createColumns (line 29) | public void createColumns(){
method SetItemTransition (line 47) | public void SetItemTransition(Transition t){
method SetColumnTransition (line 51) | public void SetColumnTransition(Transition t){
class Column (line 55) | public static class Column{
method Column (line 65) | public Column(){
method Column (line 70) | public Column(View header, ArrayList<View> views,View footer){
method getHeaderObject (line 78) | public Object getHeaderObject(int column_position){
method getItemObject (line 82) | public Object getItemObject(int column_position,int item_position){
method addColumn (line 86) | public void addColumn(int index, Column column){
method removeColumn (line 102) | public void removeColumn(int index){
method removeItem (line 110) | public void removeItem(int column, int index){
method addItem (line 120) | public void addItem(int column,int index, Object item){
method getColumnCount (line 133) | public abstract int getColumnCount();
method getItemCount (line 134) | public abstract int getItemCount(int column_position);
method maxItemCount (line 135) | public abstract int maxItemCount(int column_position);
method createHeaderObject (line 136) | public abstract Object createHeaderObject(int column_position);
method createFooterObject (line 137) | public abstract Object createFooterObject(int column_position);
method createItemObject (line 138) | public abstract Object createItemObject(int column_position,int item_p...
method isColumnLocked (line 139) | public abstract boolean isColumnLocked(int column_position);
method isItemLocked (line 140) | public abstract boolean isItemLocked(int column_position);
method createItemView (line 141) | public abstract View createItemView(Context context,Object header_obje...
method createHeaderView (line 142) | public abstract View createHeaderView(Context context,Object header_ob...
method createFooterView (line 143) | public abstract View createFooterView(Context context,Object footer_ob...
FILE: boardview/src/main/java/com/allyants/boardview/BoardItem.java
class BoardItem (line 11) | public class BoardItem extends LinearLayout {
method BoardItem (line 15) | public BoardItem(Context context) {
method BoardItem (line 19) | public BoardItem(Context context, AttributeSet attrs) {
method BoardItem (line 23) | public BoardItem(Context context, AttributeSet attrs, int defStyleAttr) {
method init (line 27) | public void init(){
method setScale (line 32) | public void setScale(float scale){
method getScale (line 36) | public float getScale(){
method onMeasure (line 40) | @Override
FILE: boardview/src/main/java/com/allyants/boardview/BoardView.java
class BoardView (line 37) | public class BoardView extends FrameLayout {
method setBackgroundColor (line 59) | public void setBackgroundColor(int color){
method getBackgroundColor (line 63) | public int getBackgroundColor(){
method onDone (line 68) | @Override
method onClick (line 75) | @Override
method onClick (line 82) | @Override
method onClick (line 89) | @Override
method startDrag (line 96) | @Override
method changedPosition (line 101) | @Override
method dragging (line 106) | @Override
method endDrag (line 111) | @Override
method startDrag (line 118) | @Override
method changedPosition (line 123) | @Override
method dragging (line 128) | @Override
method endDrag (line 133) | @Override
type DragColumnStartCallback (line 150) | public interface DragColumnStartCallback{
method startDrag (line 151) | void startDrag(View itemView, int originalPosition);
method changedPosition (line 152) | void changedPosition(View itemView, int originalPosition, int newPos...
method dragging (line 153) | void dragging(View itemView, MotionEvent event);
method endDrag (line 154) | void endDrag(View itemView, int originalPosition, int newPosition);
type DragItemStartCallback (line 157) | public interface DragItemStartCallback{
method startDrag (line 158) | void startDrag(View itemView, int originalPosition,int originalColumn);
method changedPosition (line 159) | void changedPosition(View itemView, int originalPosition,int origina...
method dragging (line 160) | void dragging(View itemView, MotionEvent event);
method endDrag (line 161) | void endDrag(View itemView, int originalPosition,int originalColumn,...
type FooterClickListener (line 164) | public interface FooterClickListener{
method onClick (line 165) | void onClick(View v,int column_pos);
type HeaderClickListener (line 169) | public interface HeaderClickListener{
method onClick (line 170) | void onClick(View v,int column_pos);
type ItemClickListener (line 173) | public interface ItemClickListener{
method onClick (line 174) | void onClick(View v,int column_pos,int item_pos);
method setOnHeaderClickListener (line 177) | public void setOnHeaderClickListener(HeaderClickListener headerClickLi...
method setOnFooterClickListener (line 181) | public void setOnFooterClickListener(FooterClickListener footerClickLi...
method setOnItemClickListener (line 185) | public void setOnItemClickListener(ItemClickListener itemClickListener){
method setOnDragColumnListener (line 189) | public void setOnDragColumnListener(DragColumnStartCallback dragStartC...
method setOnDragItemListener (line 193) | public void setOnDragItemListener(DragItemStartCallback dragStartCallb...
method setOnDoneListener (line 197) | public void setOnDoneListener(DoneListener onDoneListener){
method BoardView (line 225) | public BoardView(Context context) {
method BoardView (line 229) | public BoardView(Context context, AttributeSet attrs) {
method BoardView (line 239) | public BoardView(Context context, AttributeSet attrs, int defStyleAttr) {
type DoneListener (line 249) | public interface DoneListener {
method onDone (line 250) | void onDone();
method setAdapter (line 253) | public void setAdapter(BoardAdapter boardAdapter){
method onFinishInflate (line 265) | @Override
method dispatchDraw (line 279) | @Override
method onInterceptTouchEvent (line 291) | @Override
method onTouchEvent (line 297) | @Override
method getStatusBarHeight (line 303) | public int getStatusBarHeight() {
method SetColumnSnap (line 313) | public void SetColumnSnap(boolean columnSnap){
method onScrollChange (line 348) | @Override
method scrollToColumn (line 369) | public void scrollToColumn(int column,boolean animate){
method handleColumnDragEvent (line 388) | public boolean handleColumnDragEvent(MotionEvent event){
method computeScroll (line 469) | @Override
method handleItemSwitchHorizontal (line 485) | private void handleItemSwitchHorizontal(){
method getPositionInListY (line 589) | public int getPositionInListY(int y,LinearLayout layout){
method getPositionInListX (line 602) | public int getPositionInListX(int x,LinearLayout layout){
method switchItemFromPosition (line 621) | private void switchItemFromPosition(int change,View view){
method handleColumnSwitchHorizontal (line 637) | private void handleColumnSwitchHorizontal(){
method switchColumnFromPosition (line 670) | private void switchColumnFromPosition(int change,View view){
method touchEventsCancelled (line 689) | private void touchEventsCancelled() {
method scaleView (line 736) | public void scaleView(final View v, final BoardItem parent, final floa...
method createRunnable (line 773) | private Runnable createRunnable(final BoardItem parent, final long sta...
method removeParent (line 794) | private ViewGroup removeParent(View view){
method notifyDataSetChanged (line 805) | public void notifyDataSetChanged(){
method createHeaderOnClickListener (line 824) | private OnClickListener createHeaderOnClickListener(final View parent_...
method createHeaderOnLongClickListener (line 835) | private OnLongClickListener createHeaderOnLongClickListener(final View...
method createFooterOnClickListener (line 864) | private OnClickListener createFooterOnClickListener(final View parent_...
method addColumnList (line 874) | public void addColumnList(@Nullable View header, ArrayList<View> items...
method addBoardItem (line 943) | public void addBoardItem(final View view, final int column_pos){
method calculatePixelFromDensity (line 974) | private int calculatePixelFromDensity(float dp){
method getAndAddHoverView (line 981) | private BitmapDrawable getAndAddHoverView(View v, float scale){
method getBitmapWithBorder (line 995) | private Bitmap getBitmapWithBorder(View v, float scale) {
method getBitmapFromView (line 1007) | private Bitmap getBitmapFromView(View v, float scale){
method rotatedBounds (line 1020) | private Rect rotatedBounds(Rect tmp,double radians){
FILE: boardview/src/main/java/com/allyants/boardview/Item.java
class Item (line 7) | public class Item{
method Item (line 11) | public Item(String item){
method toString (line 15) | public String toString(){
FILE: boardview/src/main/java/com/allyants/boardview/SimpleBoardAdapter.java
class SimpleBoardAdapter (line 13) | public class SimpleBoardAdapter extends BoardAdapter{
method SimpleBoardAdapter (line 18) | public SimpleBoardAdapter(Context context, ArrayList<SimpleColumn> dat...
method getColumnCount (line 26) | @Override
method getItemCount (line 31) | @Override
method createHeaderObject (line 36) | @Override
method createFooterObject (line 41) | @Override
method createItemObject (line 46) | @Override
method isColumnLocked (line 51) | @Override
method isItemLocked (line 56) | @Override
method createItemView (line 61) | @Override
method maxItemCount (line 69) | @Override
method createColumns (line 74) | @Override
method createHeaderView (line 79) | @Override
method createFooterView (line 87) | @Override
class SimpleColumn (line 95) | public static class SimpleColumn extends Column{
method SimpleColumn (line 97) | public SimpleColumn(String title, ArrayList<Object> items){
FILE: boardview/src/test/java/com/allyants/boardview/ExampleUnitTest.java
class ExampleUnitTest (line 12) | public class ExampleUnitTest {
method addition_isCorrect (line 13) | @Test
Condensed preview — 50 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (106K chars).
[
{
"path": ".gitignore",
"chars": 118,
"preview": "*.iml\n.gradle\n/local.properties\n/.idea/workspace.xml\n/.idea/libraries\n.DS_Store\n/build\n/captures\n.externalNativeBuild\n"
},
{
"path": ".idea/codeStyles/Project.xml",
"chars": 1775,
"preview": "<component name=\"ProjectCodeStyleConfiguration\">\n <code_scheme name=\"Project\" version=\"173\">\n <Objective-C-extension"
},
{
"path": ".idea/compiler.xml",
"chars": 686,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"CompilerConfiguration\">\n <resourceExt"
},
{
"path": ".idea/copyright/profiles_settings.xml",
"chars": 74,
"preview": "<component name=\"CopyrightManager\">\n <settings default=\"\" />\n</component>"
},
{
"path": ".idea/gradle.xml",
"chars": 681,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"GradleSettings\">\n <option name=\"linke"
},
{
"path": ".idea/inspectionProfiles/Project_Default.xml",
"chars": 660,
"preview": "<component name=\"InspectionProjectProfileManager\">\n <profile version=\"1.0\">\n <option name=\"myName\" value=\"Project De"
},
{
"path": ".idea/inspectionProfiles/profiles_settings.xml",
"chars": 235,
"preview": "<component name=\"InspectionProjectProfileManager\">\n <settings>\n <option name=\"PROJECT_PROFILE\" value=\"Project Defaul"
},
{
"path": ".idea/misc.xml",
"chars": 2044,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"NullableNotNullManager\">\n <option nam"
},
{
"path": ".idea/modules.xml",
"chars": 476,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"ProjectModuleManager\">\n <modules>\n "
},
{
"path": ".idea/runConfigurations.xml",
"chars": 564,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"RunConfigurationProducerService\">\n <o"
},
{
"path": ".idea/vcs.xml",
"chars": 180,
"preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project version=\"4\">\n <component name=\"VcsDirectoryMappings\">\n <mapping dire"
},
{
"path": "LICENSE",
"chars": 11357,
"preview": " Apache License\n Version 2.0, January 2004\n "
},
{
"path": "README.md",
"chars": 5862,
"preview": "[](https://jitpack.io/#jakebonk/BoardView)\n\n# BoardView\nBoardView is a c"
},
{
"path": "app/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "app/build.gradle",
"chars": 917,
"preview": "apply plugin: 'com.android.application'\n\nandroid {\n compileSdkVersion 25\n buildToolsVersion \"25.0.2\"\n defaultCo"
},
{
"path": "app/proguard-rules.pro",
"chars": 671,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in C:"
},
{
"path": "app/src/androidTest/java/com/allyants/boardviewexample/ExampleInstrumentedTest.java",
"chars": 762,
"preview": "package com.allyants.boardviewexample;\n\nimport android.content.Context;\nimport android.support.test.InstrumentationRegis"
},
{
"path": "app/src/main/AndroidManifest.xml",
"chars": 669,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package="
},
{
"path": "app/src/main/java/com/allyants/boardviewexample/MainActivity.java",
"chars": 2186,
"preview": "package com.allyants.boardviewexample;\n\nimport android.os.Bundle;\nimport android.support.v7.app.AppCompatActivity;\nimpor"
},
{
"path": "app/src/main/res/layout/activity_main.xml",
"chars": 617,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RelativeLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n xm"
},
{
"path": "app/src/main/res/values/colors.xml",
"chars": 208,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <color name=\"colorPrimary\">#3F51B5</color>\n <color name=\"color"
},
{
"path": "app/src/main/res/values/dimens.xml",
"chars": 211,
"preview": "<resources>\n <!-- Default screen margins, per the Android Design guidelines. -->\n <dimen name=\"activity_horizontal"
},
{
"path": "app/src/main/res/values/strings.xml",
"chars": 79,
"preview": "<resources>\n <string name=\"app_name\">BoardViewExample</string>\n</resources>\n"
},
{
"path": "app/src/main/res/values/styles.xml",
"chars": 383,
"preview": "<resources>\n\n <!-- Base application theme. -->\n <style name=\"AppTheme\" parent=\"Theme.AppCompat.Light.DarkActionBar"
},
{
"path": "app/src/main/res/values-w820dp/dimens.xml",
"chars": 358,
"preview": "<resources>\n <!-- Example customization of dimensions originally defined in res/values/dimens.xml\n (such as s"
},
{
"path": "app/src/test/java/com/allyants/boardviewexample/ExampleUnitTest.java",
"chars": 407,
"preview": "package com.allyants.boardviewexample;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Example local "
},
{
"path": "boardview/.gitignore",
"chars": 7,
"preview": "/build\n"
},
{
"path": "boardview/build.gradle",
"chars": 822,
"preview": "apply plugin: 'com.android.library'\n\nandroid {\n compileSdkVersion 25\n buildToolsVersion \"25.0.2\"\n\n defaultConfi"
},
{
"path": "boardview/proguard-rules.pro",
"chars": 671,
"preview": "# Add project specific ProGuard rules here.\n# By default, the flags in this file are appended to flags specified\n# in C:"
},
{
"path": "boardview/src/androidTest/java/com/allyants/boardview/ExampleInstrumentedTest.java",
"chars": 753,
"preview": "package com.allyants.boardview;\n\nimport android.content.Context;\nimport android.support.test.InstrumentationRegistry;\nim"
},
{
"path": "boardview/src/main/AndroidManifest.xml",
"chars": 254,
"preview": "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\"\n package=\"com.allyants.boardview\">\n\n <applica"
},
{
"path": "boardview/src/main/java/com/allyants/boardview/BoardAdapter.java",
"chars": 5925,
"preview": "package com.allyants.boardview;\n\nimport android.content.Context;\nimport android.transition.Fade;\nimport android.transiti"
},
{
"path": "boardview/src/main/java/com/allyants/boardview/BoardItem.java",
"chars": 1378,
"preview": "package com.allyants.boardview;\n\nimport android.content.Context;\nimport android.util.AttributeSet;\nimport android.widget"
},
{
"path": "boardview/src/main/java/com/allyants/boardview/BoardView.java",
"chars": 43190,
"preview": "package com.allyants.boardview;\n\nimport android.content.Context;\nimport android.content.res.TypedArray;\nimport android.g"
},
{
"path": "boardview/src/main/java/com/allyants/boardview/Item.java",
"chars": 241,
"preview": "package com.allyants.boardview;\n\n/**\n * Created by jbonk on 5/5/2018.\n */\n\npublic class Item{\n\n public String item;\n\n"
},
{
"path": "boardview/src/main/java/com/allyants/boardview/SimpleBoardAdapter.java",
"chars": 3059,
"preview": "package com.allyants.boardview;\n\nimport android.content.Context;\nimport android.view.View;\nimport android.widget.TextVie"
},
{
"path": "boardview/src/main/res/drawable/shadow_background.xml",
"chars": 555,
"preview": "<layer-list xmlns:android=\"http://schemas.android.com/apk/res/android\">\n <item>\n <shape android:shape=\"rectang"
},
{
"path": "boardview/src/main/res/layout/column_header.xml",
"chars": 611,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "boardview/src/main/res/layout/column_item.xml",
"chars": 625,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n andr"
},
{
"path": "boardview/src/main/res/values/attrs.xml",
"chars": 188,
"preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n <declare-styleable name=\"BoardView\">\n <attr name=\"boardIte"
},
{
"path": "boardview/src/main/res/values/strings.xml",
"chars": 72,
"preview": "<resources>\n <string name=\"app_name\">BoardView</string>\n</resources>\n"
},
{
"path": "boardview/src/test/java/com/allyants/boardview/ExampleUnitTest.java",
"chars": 400,
"preview": "package com.allyants.boardview;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Example local unit te"
},
{
"path": "build.gradle",
"chars": 498,
"preview": "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n\nbuildscript {\n r"
},
{
"path": "gradle/wrapper/gradle-wrapper.properties",
"chars": 233,
"preview": "#Mon Dec 28 10:00:20 PST 2015\ndistributionBase=GRADLE_USER_HOME\ndistributionPath=wrapper/dists\nzipStoreBase=GRADLE_USER_"
},
{
"path": "gradle.properties",
"chars": 730,
"preview": "# Project-wide Gradle settings.\n\n# IDE (e.g. Android Studio) users:\n# Gradle settings configured through the IDE *will o"
},
{
"path": "gradlew",
"chars": 4971,
"preview": "#!/usr/bin/env bash\n\n##############################################################################\n##\n## Gradle start "
},
{
"path": "gradlew.bat",
"chars": 2314,
"preview": "@if \"%DEBUG%\" == \"\" @echo off\n@rem ##########################################################################\n@rem\n@rem "
},
{
"path": "settings.gradle",
"chars": 29,
"preview": "include ':app', ':boardview'\n"
}
]
// ... and 2 more files (download for full content)
About this extraction
This page contains the full source code of the jakebonk/BoardView GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 50 files (97.4 KB), approximately 23.5k tokens, and a symbol index with 136 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.