Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Commit 09cee38

Browse files
committed
Add Compose version of Drag2D
Drag2D: - Moved android.support.drag2d.lib to a separate module, so that it may "easily" be referenced in other projects as a Java only source set Drag2DCompose: - Drag2D engine added as a module where the source is the relative path to Drag2d's engine directory - The engine is implemented as an AnimationSpec, that's the baseline definition to drive animations in Compose - Material2DMotionPreview shows usage of this AnimationSpec with a single draggable element
1 parent fdfe1c6 commit 09cee38

File tree

64 files changed

+1873
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1873
-3
lines changed

demoProjects/Drag2D/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ android {
2929
}
3030

3131
dependencies {
32-
32+
implementation project(':engine')
3333
implementation 'androidx.appcompat:appcompat:1.6.1'
3434
implementation 'com.google.android.material:material:1.8.0'
3535
}

demoProjects/Drag2D/app/src/main/java/android/support/drag2d/DragCardActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
import androidx.appcompat.app.AppCompatActivity;
4242
import androidx.appcompat.widget.AppCompatButton;
4343
import androidx.core.content.res.ResourcesCompat;
44-
import androidx.appcompat.widget.AppCompatSeekBar;
4544

4645
import com.google.android.material.slider.Slider;
4746

demoProjects/Drag2D/app/src/main/java/android/support/drag2d/MainActivity.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import android.graphics.Canvas;
2323
import android.graphics.Color;
2424
import android.graphics.Paint;
25-
import android.graphics.PorterDuff;
2625
import android.graphics.drawable.Drawable;
2726
import android.os.Bundle;
2827
import android.os.SystemClock;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
plugins {
2+
id 'java-library'
3+
}
4+
5+
java {
6+
sourceCompatibility = JavaVersion.VERSION_1_8
7+
targetCompatibility = JavaVersion.VERSION_1_8
8+
}

demoProjects/Drag2D/app/src/main/java/android/support/drag2d/lib/Velocity2D.java renamed to demoProjects/Drag2D/engine/src/main/java/android/support/drag2d/lib/Velocity2D.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,14 @@ public float getY(float t) {
9898
return mvY.getPos(t);
9999
}
100100

101+
public float getVX(float t) {
102+
return mvX.getV(t);
103+
}
104+
105+
public float getVY(float t) {
106+
return mvY.getV(t);
107+
}
108+
101109
public boolean isStillMoving(float t) {
102110
return mvX.getDuration() > t || mvY.getDuration() > t;
103111
}

demoProjects/Drag2D/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ dependencyResolutionManagement {
1414
}
1515
rootProject.name = "Drag2D"
1616
include ':app'
17+
include ':engine'

0 commit comments

Comments
 (0)