-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update motionlayout primary usage and readme doc
- Loading branch information
Showing
40 changed files
with
1,030 additions
and
92 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 AFeng | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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 |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# ConstraintSample | ||
This project contains android ConstraintLayout2.0 usages and MotionLayout usage, includes xml tools attributes as well. | ||
|
||
> 主要用来练习和扩展一些关于 ***`ConstraintLayout`***、***`MotionLayout`*** 的用法,还包含 Google 新推的 Android 工具 — ***`sample data`*** 等。 | ||
## 最新进展 | ||
|
||
- **ConstraintLayout 1.x** 功能大致实践完毕 | ||
- **sample data** 用法应用完毕 | ||
- **MotionLayout** 入门版实践完毕 | ||
|
||
## 接下来 | ||
|
||
- **MotionLayout** 等进一步熟悉和进阶用法以及效果实现 | ||
- 将 **MotionLayout** 与 **Material design** 系列控件组合使用,实现复杂效果 | ||
- 实战demo的制作以及相关文章编撰 | ||
- 文档说明和相关效果图的实时跟进 | ||
|
||
##Learn more | ||
|
||
每日一到面试题,挖掘更加强大的自己:[**Android Daily Interview**](https://github.com/Moosphan/Android-Daily-Interview) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.moos.constraint | ||
|
||
import android.support.v7.app.AppCompatActivity | ||
import android.os.Bundle | ||
|
||
class DetailActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_detail) | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
app/src/main/java/com/moos/constraint/practice/MotionSampleActivity.kt
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,25 @@ | ||
package com.moos.constraint.practice | ||
|
||
import android.support.v7.app.AppCompatActivity | ||
import android.os.Bundle | ||
import android.support.constraint.motion.MotionLayout | ||
import android.support.design.widget.AppBarLayout | ||
import com.moos.constraint.R | ||
|
||
class MotionSampleActivity : AppCompatActivity() { | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_motion_sample_step5) | ||
initMotion() | ||
} | ||
|
||
private fun initMotion() { | ||
val appBarLayout = findViewById<AppBarLayout>(R.id.appBarLayout) | ||
val motionLayout = findViewById<MotionLayout>(R.id.motionLayout) | ||
appBarLayout.addOnOffsetChangedListener(AppBarLayout.OnOffsetChangedListener { _, verticalOffset -> | ||
val seekPosition = -verticalOffset / (appBarLayout.totalScrollRange.toFloat()/2) | ||
motionLayout.progress = seekPosition | ||
}) | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.motion.MotionLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:layoutDescription="@xml/step1" | ||
tools:context=".DetailActivity"> | ||
|
||
</android.support.constraint.motion.MotionLayout> |
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,42 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.motion.MotionLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:motionDebug="SHOW_PATH" | ||
app:layoutDescription="@xml/step2" | ||
tools:context=".practice.MotionSampleActivity"> | ||
<!--step1--> | ||
<!--<ImageView--> | ||
<!--android:id="@+id/windmill"--> | ||
<!--android:layout_width="wrap_content"--> | ||
<!--android:layout_height="wrap_content"--> | ||
<!--android:visibility="gone"--> | ||
<!--android:src="@drawable/timeory_logo"/>--> | ||
<ImageView | ||
android:id="@+id/ic_android_blue" | ||
android:layout_width="42dp" | ||
android:layout_height="42dp" | ||
android:src="@mipmap/android_icon_blue"/> | ||
<ImageView | ||
android:id="@+id/ic_android_left" | ||
android:layout_width="42dp" | ||
android:layout_height="42dp" | ||
android:src="@mipmap/android_icon_purple"/> | ||
<ImageView | ||
android:id="@+id/ic_android_right" | ||
android:layout_width="42dp" | ||
android:layout_height="42dp" | ||
android:src="@mipmap/android_icon_orange"/> | ||
<TextView | ||
android:id="@+id/tipText" | ||
android:text="android is very funny" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginTop="16dp" | ||
app:layout_constraintTop_toTopOf="parent"/> | ||
</android.support.constraint.motion.MotionLayout> |
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,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.motion.MotionLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" | ||
app:layoutDescription="@xml/step1" | ||
tools:context=".practice.MotionSampleActivity"> | ||
<ImageView | ||
android:id="@+id/windmill" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:visibility="gone" | ||
android:src="@drawable/timeory_logo"/> | ||
</android.support.constraint.motion.MotionLayout> |
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,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.motion.MotionLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:motionDebug="SHOW_PATH" | ||
app:layoutDescription="@xml/step2" | ||
tools:context=".practice.MotionSampleActivity"> | ||
<ImageView | ||
android:id="@+id/ic_android_blue" | ||
android:layout_width="42dp" | ||
android:layout_height="42dp" | ||
android:src="@mipmap/android_icon_blue"/> | ||
<ImageView | ||
android:id="@+id/ic_android_left" | ||
android:layout_width="42dp" | ||
android:layout_height="42dp" | ||
android:src="@mipmap/android_icon_purple"/> | ||
<ImageView | ||
android:id="@+id/ic_android_right" | ||
android:layout_width="42dp" | ||
android:layout_height="42dp" | ||
android:src="@mipmap/android_icon_orange"/> | ||
<TextView | ||
android:id="@+id/tipText" | ||
android:text="android is very funny" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
android:layout_marginEnd="16dp" | ||
android:layout_marginTop="16dp" | ||
app:layout_constraintTop_toTopOf="parent"/> | ||
</android.support.constraint.motion.MotionLayout> |
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,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!--可以是@xml/step3或者step5的布局--> | ||
<android.support.constraint.motion.MotionLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:motionDebug="SHOW_PATH" | ||
app:layoutDescription="@xml/step5" | ||
tools:context=".practice.MotionSampleActivity"> | ||
<ImageView | ||
android:id="@+id/windmill" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:src="@drawable/timeory_logo"/> | ||
|
||
<TextView | ||
android:id="@+id/tipText" | ||
android:text="android is very funny" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textSize="18sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"/> | ||
</android.support.constraint.motion.MotionLayout> |
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,26 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<android.support.constraint.motion.MotionLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
app:motionDebug="SHOW_PATH" | ||
app:layoutDescription="@xml/step4" | ||
tools:context=".practice.MotionSampleActivity"> | ||
<ImageView | ||
android:id="@+id/windmill" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:srcCompat="@mipmap/android_icon_blue" | ||
android:tint="@android:color/white"/> | ||
|
||
<TextView | ||
android:id="@+id/tipText" | ||
android:text="android is very funny" | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:textSize="18sp" | ||
app:layout_constraintEnd_toEndOf="parent" | ||
app:layout_constraintTop_toTopOf="parent"/> | ||
</android.support.constraint.motion.MotionLayout> |
Oops, something went wrong.