This repository has been archived by the owner on Dec 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
237 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
...LayoutVerification/app/src/main/java/android/support/constraint/app/CheckSetProgress.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* | ||
* Copyright (C) 2021 The Android Open Source Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package android.support.constraint.app; | ||
|
||
import android.content.Context; | ||
import android.os.Bundle; | ||
import android.util.Log; | ||
|
||
import androidx.annotation.Nullable; | ||
import androidx.appcompat.app.AppCompatActivity; | ||
import androidx.constraintlayout.motion.widget.Debug; | ||
import androidx.constraintlayout.motion.widget.MotionLayout; | ||
import androidx.constraintlayout.motion.widget.TransitionAdapter; | ||
|
||
/** | ||
* Test transitionToState bug | ||
*/ | ||
public class OnCreateTransiton extends AppCompatActivity { | ||
private static final String TAG = "CustomSwipeClick"; | ||
String layout_name; | ||
MotionLayout mMotionLayout; | ||
|
||
@Override | ||
protected void onCreate(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
Bundle extra = getIntent().getExtras(); | ||
String prelayout = extra.getString(Utils.KEY); | ||
layout_name = prelayout; | ||
Context ctx = getApplicationContext(); | ||
int id = ctx.getResources().getIdentifier(prelayout, "layout", ctx.getPackageName()); | ||
setContentView(id); | ||
mMotionLayout = Utils.findMotionLayout(this); | ||
mMotionLayout.transitionToState(R.id.end); | ||
mMotionLayout.setTransitionListener(new TransitionAdapter() { | ||
@Override | ||
public void onTransitionCompleted(MotionLayout motionLayout, int currentId) { | ||
Log.v(TAG, Debug.getLoc()+" "); | ||
} | ||
|
||
@Override | ||
public void onTransitionTrigger(MotionLayout motionLayout, int triggerId, boolean positive, float progress) { | ||
Log.v(TAG, Debug.getLoc()+" "+progress); | ||
if (progress <= 0.001 || progress >= 0.999) { | ||
Debug.logStack(TAG, "",19); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
134 changes: 134 additions & 0 deletions
134
projects/MotionLayoutVerification/app/src/main/res/layout/verification_800.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.motion.widget.MotionLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:id="@+id/motionLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layoutDescription="@xml/verification_scene_800" | ||
app:motionDebug="SHOW_PATH" | ||
|
||
android:background="#FF003b60"> | ||
|
||
|
||
|
||
<ImageView | ||
android:id="@+id/earth" | ||
android:layout_width="100dp" | ||
android:layout_height="100dp" | ||
android:src="@drawable/earth" | ||
app:layout_constraintVertical_bias="0.5" | ||
app:layout_constraintHorizontal_bias="0.5" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" | ||
app:layout_constraintStart_toStartOf="parent" | ||
|
||
/> | ||
|
||
<androidx.constraintlayout.utils.widget.ImageFilterView | ||
android:id="@+id/moon" | ||
android:layout_width="20dp" | ||
android:layout_height="20dp" | ||
android:src="@drawable/moon" | ||
|
||
app:layout_constraintCircleRadius="30dp" | ||
app:layout_constraintCircleAngle="0" | ||
app:layout_constraintCircle="@id/earth" | ||
/> | ||
|
||
<Button | ||
android:id="@+id/b1" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginStart="35dp" | ||
android:layout_marginLeft="35dp" | ||
android:layout_marginTop="48dp" | ||
android:text="progressP0" | ||
android:onClick="progressP0" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
|
||
<Button | ||
android:id="@+id/b2" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="progressP1" | ||
android:onClick="progressP1" | ||
app:layout_constraintStart_toStartOf="@+id/b1" | ||
app:layout_constraintTop_toBottomOf="@+id/b1" /> | ||
<Button | ||
android:id="@+id/b3" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="progressP0V0" | ||
android:onClick="progressP0V0" | ||
app:layout_constraintStart_toStartOf="@+id/b2" | ||
app:layout_constraintTop_toBottomOf="@+id/b2" /> | ||
|
||
<Button | ||
android:id="@+id/b4" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="progressP0V1" | ||
android:onClick="progressP0V1" | ||
app:layout_constraintStart_toStartOf="@+id/b3" | ||
app:layout_constraintTop_toBottomOf="@+id/b3" /> | ||
|
||
<Button | ||
android:id="@+id/b5" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="progressP1V0" | ||
android:onClick="progressP1V0" | ||
app:layout_constraintStart_toStartOf="@+id/b4" | ||
app:layout_constraintTop_toBottomOf="@+id/b4" /> | ||
|
||
<Button | ||
android:id="@+id/b6" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="progressP1V_1" | ||
android:onClick="progressP1V_1" | ||
app:layout_constraintStart_toStartOf="@+id/b5" | ||
app:layout_constraintTop_toBottomOf="@+id/b5" /> | ||
|
||
<Button | ||
android:id="@+id/b7" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="progressP5V1" | ||
android:onClick="progressP5V1" | ||
app:layout_constraintStart_toStartOf="@+id/b6" | ||
app:layout_constraintTop_toBottomOf="@+id/b6" /> | ||
|
||
<Button | ||
android:id="@+id/b8" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="progressP5V_1" | ||
android:onClick="progressP5V_1" | ||
app:layout_constraintStart_toStartOf="@+id/b7" | ||
app:layout_constraintTop_toBottomOf="@+id/b7" /> | ||
|
||
<Button | ||
android:id="@+id/b9" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginTop="16dp" | ||
android:text="progressP5" | ||
android:onClick="progressP5" | ||
app:layout_constraintStart_toStartOf="@+id/b8" | ||
app:layout_constraintTop_toBottomOf="@+id/b8" /> | ||
|
||
|
||
|
||
</androidx.constraintlayout.motion.widget.MotionLayout> |
32 changes: 32 additions & 0 deletions
32
projects/MotionLayoutVerification/app/src/main/res/xml/verification_scene_800.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<MotionScene xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:motion="http://schemas.android.com/apk/res-auto" | ||
motion:defaultDuration="2000"> | ||
|
||
|
||
<ConstraintSet | ||
android:id="@+id/end" > | ||
<ConstraintOverride android:id="@+id/moon" motion:layout_constraintCircleRadius="300dp"/> | ||
|
||
</ConstraintSet> | ||
|
||
<ConstraintSet android:id="@+id/start"> | ||
|
||
</ConstraintSet> | ||
|
||
|
||
|
||
<Transition | ||
motion:constraintSetEnd="@+id/end" | ||
motion:constraintSetStart="@+id/start" | ||
motion:duration="1000" | ||
motion:motionInterpolator="linear" | ||
> | ||
<OnSwipe /> | ||
|
||
|
||
</Transition> | ||
|
||
|
||
|
||
</MotionScene> |