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 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add json dump getSceneString() to ConstraintLayout (#482)
- Loading branch information
Showing
8 changed files
with
326 additions
and
3 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
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
62 changes: 62 additions & 0 deletions
62
...ionLayoutVerification/app/src/main/java/android/support/constraint/app/CheckDumpJson.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,62 @@ | ||
/* | ||
* 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.widget.ConstraintLayout; | ||
|
||
// used with verification_057.xml | ||
public class CheckDumpJson extends AppCompatActivity { | ||
private static final String TAG = "CheckDumpJson"; | ||
String layout_name; | ||
ConstraintLayout mLayout; | ||
|
||
@Override | ||
protected void onCreate(@Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
int id = R.layout.basic_cl_001; | ||
Bundle extra = getIntent().getExtras(); | ||
if (extra != null) { | ||
String prelayout = extra.getString(Utils.KEY); | ||
setTitle(layout_name = prelayout); | ||
Context ctx = getApplicationContext(); | ||
id = ctx.getResources().getIdentifier(prelayout, "layout", ctx.getPackageName()); | ||
|
||
} | ||
setContentView(id); | ||
mLayout = Utils.findConstraintLayout(this); | ||
|
||
|
||
} | ||
|
||
@Override | ||
public void onAttachedToWindow() { | ||
super.onAttachedToWindow(); | ||
mLayout.postDelayed(()-> dumpJson(), 2000); | ||
} | ||
|
||
private void dumpJson() { | ||
Log.v(TAG, Debug.getLoc() +"\n"+mLayout.getSceneString() ); | ||
} | ||
} |
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
17 changes: 17 additions & 0 deletions
17
projects/MotionLayoutVerification/app/src/main/res/layout/basic_cl_001.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,17 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
|
||
android:orientation="vertical" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent"> | ||
|
||
<View | ||
android:id="@+id/simple" | ||
android:background="#718" | ||
android:layout_width="200dp" | ||
android:layout_height="200dp" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintBottom_toBottomOf="parent" /> | ||
</androidx.constraintlayout.widget.ConstraintLayout> |
86 changes: 86 additions & 0 deletions
86
projects/MotionLayoutVerification/app/src/main/res/layout/basic_cl_002.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,86 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:orientation="vertical"> | ||
|
||
<View | ||
android:id="@+id/simple0" | ||
android:layout_width="128dp" | ||
android:layout_height="105dp" | ||
android:background="#718" | ||
app:layout_constraintBottom_toTopOf="@+id/simple3" | ||
app:layout_constraintEnd_toStartOf="@+id/simple1" | ||
app:layout_constraintHorizontal_bias="0.5" | ||
app:layout_constraintHorizontal_chainStyle="spread" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toTopOf="parent" /> | ||
|
||
<View | ||
android:id="@+id/simple1" | ||
android:layout_width="128dp" | ||
android:layout_height="105dp" | ||
android:background="#718" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.5" | ||
app:layout_constraintStart_toEndOf="@+id/simple0" | ||
app:layout_constraintTop_toTopOf="@+id/simple0" /> | ||
|
||
<View | ||
android:id="@+id/simple3" | ||
android:layout_width="128dp" | ||
android:layout_height="105dp" | ||
android:background="#718" | ||
app:layout_constraintBottom_toTopOf="@+id/simple4" | ||
app:layout_constraintEnd_toStartOf="@+id/simple2" | ||
app:layout_constraintHorizontal_bias="0.5" | ||
app:layout_constraintHorizontal_chainStyle="spread_inside" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/simple0" /> | ||
|
||
<View | ||
android:id="@+id/simple2" | ||
android:layout_width="128dp" | ||
android:layout_height="105dp" | ||
android:background="#718" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.5" | ||
app:layout_constraintStart_toEndOf="@+id/simple3" | ||
app:layout_constraintTop_toTopOf="@+id/simple3" /> | ||
|
||
<View | ||
android:id="@+id/simple4" | ||
android:layout_width="128dp" | ||
android:layout_height="105dp" | ||
android:background="#718" | ||
app:layout_constraintBottom_toBottomOf="parent" | ||
app:layout_constraintEnd_toStartOf="@+id/simple6" | ||
app:layout_constraintHorizontal_bias="0.5" | ||
app:layout_constraintHorizontal_chainStyle="packed" | ||
app:layout_constraintStart_toStartOf="parent" | ||
app:layout_constraintTop_toBottomOf="@+id/simple3" /> | ||
|
||
<View | ||
android:id="@+id/simple6" | ||
android:layout_width="128dp" | ||
android:layout_height="105dp" | ||
android:background="#718" | ||
app:layout_constraintEnd_toStartOf="@+id/simple5" | ||
app:layout_constraintHorizontal_bias="0.5" | ||
app:layout_constraintStart_toEndOf="@+id/simple4" | ||
app:layout_constraintTop_toTopOf="@+id/simple4" /> | ||
|
||
<View | ||
android:id="@+id/simple5" | ||
android:layout_width="128dp" | ||
android:layout_height="105dp" | ||
android:background="#718" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintHorizontal_bias="0.5" | ||
app:layout_constraintStart_toEndOf="@+id/simple6" | ||
app:layout_constraintTop_toTopOf="@+id/simple6" /> | ||
|
||
</androidx.constraintlayout.widget.ConstraintLayout> |