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

Commit e76e50d

Browse files
authored
Initial import of the Carousel helper (#30)
1 parent 6c69d5f commit e76e50d

File tree

69 files changed

+3336
-0
lines changed

Some content is hidden

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

69 files changed

+3336
-0
lines changed

constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/helper/widget/Carousel.java

Lines changed: 408 additions & 0 deletions
Large diffs are not rendered by default.

constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/motion/widget/MotionScene.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,6 +674,13 @@ public boolean isTransitionFlag(int flag) {
674674
return 0 != (mTransitionFlags & flag);
675675
}
676676

677+
public void setOnTouchUp(int touchUpMode) {
678+
TouchResponse touchResponse = getTouchResponse();
679+
if (touchResponse != null) {
680+
touchResponse.setTouchUpMode(touchUpMode);
681+
}
682+
}
683+
677684
static class TransitionOnClick implements View.OnClickListener {
678685
private final Transition mTransition;
679686
int mTargetId = UNSET;

constraintlayout/constraintlayout/src/main/java/androidx/constraintlayout/motion/widget/TouchResponse.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,4 +715,8 @@ public String toString() {
715715
public int getFlags() {
716716
return mFlags;
717717
}
718+
719+
public void setTouchUpMode(int touchUpMode) {
720+
mOnTouchUp = touchUpMode;
721+
}
718722
}

constraintlayout/constraintlayout/src/main/res/values/attrs.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,30 @@
231231

232232
<!-- =============================== End Flow =============================== -->
233233

234+
<!-- =============================== Start Carousel =============================== -->
235+
236+
<declare-styleable name="Carousel">
237+
<attr name="carousel_firstView" format="reference" />
238+
<attr name="carousel_lastView" format="reference" />
239+
<attr name="carousel_previousState" format="reference" />
240+
<attr name="carousel_nextState" format="reference" />
241+
<attr name="carousel_defaultTransition" format="reference" />
242+
<attr name="carousel_forwardTransition" format="reference" />
243+
<attr name="carousel_backwardTransition" format="reference" />
244+
<attr name="carousel_forwardStartTransition" format="reference" />
245+
<attr name="carousel_forwardEndTransition" format="reference" />
246+
<attr name="carousel_forwardMinEndTransition" format="reference" />
247+
<attr name="carousel_minEndThreshold" format="integer" />
248+
<attr name="carousel_touchUp_dampeningFactor" format="float" />
249+
<attr name="carousel_touchUpMode" format="enum">
250+
<enum name="immediateStop" value="1"/>
251+
<enum name="carryVelocity" value="2"/>
252+
</attr>
253+
<attr name="carousel_touchUp_velocityThreshold" format="float"/>
254+
</declare-styleable>
255+
256+
<!-- =============================== End Carousel =============================== -->
257+
234258
<!-- Used at design time to define to position the view -->
235259
<attr name="layout_editor_absoluteX" format="dimension" />
236260
<!-- Used at design time to define to position the view -->
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild
14+
.cxx
15+
local.properties

projects/CarouselExperiments/.idea/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
plugins {
2+
id 'com.android.application'
3+
id 'kotlin-android'
4+
}
5+
6+
android {
7+
compileSdkVersion 30
8+
buildToolsVersion "30.0.2"
9+
10+
defaultConfig {
11+
applicationId "com.example.developertemplate"
12+
minSdkVersion 16
13+
targetSdkVersion 30
14+
versionCode 1
15+
versionName "1.0"
16+
17+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
18+
}
19+
20+
buildTypes {
21+
release {
22+
minifyEnabled false
23+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
24+
}
25+
}
26+
compileOptions {
27+
sourceCompatibility JavaVersion.VERSION_1_8
28+
targetCompatibility JavaVersion.VERSION_1_8
29+
}
30+
kotlinOptions {
31+
jvmTarget = '1.8'
32+
}
33+
}
34+
35+
dependencies {
36+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
37+
implementation 'androidx.core:core-ktx:1.3.1'
38+
implementation 'androidx.appcompat:appcompat:1.2.0'
39+
implementation 'com.google.android.material:material:1.2.1'
40+
implementation project(path: ':constraintlayout')
41+
testImplementation 'junit:junit:4.13'
42+
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
43+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
44+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="androidx.constraintlayout.experiments">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.DeveloperTemplate">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>

0 commit comments

Comments
 (0)