23 |
24 |
25 |
--------------------------------------------------------------------------------
/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 | # IDE (e.g. Android Studio) users:
3 | # Gradle settings configured through the IDE *will override*
4 | # any settings specified in this file.
5 | # For more details on how to configure your build environment visit
6 | # http://www.gradle.org/docs/current/userguide/build_environment.html
7 | # Specifies the JVM arguments used for the daemon process.
8 | # The setting is particularly useful for tweaking memory settings.
9 | org.gradle.jvmargs=-Xmx2048m
10 | # When configured, Gradle will run in incubating parallel mode.
11 | # This option should only be used with decoupled projects. More details, visit
12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
13 | # org.gradle.parallel=true
14 | # AndroidX package structure to make it clearer which packages are bundled with the
15 | # Android operating system, and which are packaged with your app"s APK
16 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
17 | android.useAndroidX=true
18 | # Automatically convert third-party libraries to use AndroidX
19 | android.enableJetifier=true
20 | # Kotlin code style for this project: "official" or "obsolete":
21 | kotlin.code.style=official
--------------------------------------------------------------------------------
/app/src/main/res/drawable/shadow_bg.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
10 |
11 |
12 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
28 |
29 |
30 |
31 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/ozcanalasalvar/MotionLayoutExample/DummyRecyclerAdapter.kt:
--------------------------------------------------------------------------------
1 | package com.ozcanalasalvar.MotionLayoutExample
2 |
3 | import android.content.Context
4 | import android.view.LayoutInflater
5 | import android.view.View
6 | import android.view.ViewGroup
7 | import android.view.animation.Animation
8 | import android.view.animation.AnimationUtils
9 | import androidx.recyclerview.widget.RecyclerView
10 |
11 |
12 | class DummyRecyclerAdapter() :
13 | RecyclerView.Adapter() {
14 |
15 | class ViewHolder(view: View) : RecyclerView.ViewHolder(view)
16 |
17 | override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
18 | val inflater = LayoutInflater.from(parent.context)
19 | val view = inflater.inflate(R.layout.list_item, parent, false)
20 |
21 | view.setOnClickListener {
22 | setAnimation(view,parent.context)
23 | }
24 |
25 | return ViewHolder(view)
26 | }
27 |
28 | override fun getItemCount(): Int = 10
29 |
30 | override fun onBindViewHolder(holder: ViewHolder, position: Int) {
31 | }
32 |
33 | private fun setAnimation(viewToAnimate: View, context: Context) {
34 | val animation: Animation =
35 | AnimationUtils.loadAnimation(context, R.anim.bounce_anim)
36 | viewToAnimate.startAnimation(animation)
37 | }
38 | }
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 | apply plugin: 'kotlin-android'
3 | apply plugin: 'kotlin-android-extensions'
4 |
5 | android {
6 | compileSdkVersion 29
7 | buildToolsVersion "30.0.0"
8 |
9 | defaultConfig {
10 | applicationId "com.ozcanalasalvar.MotionLayoutExample"
11 | minSdkVersion 23
12 | targetSdkVersion 29
13 | versionCode 1
14 | versionName "1.0"
15 |
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 |
19 | buildTypes {
20 | release {
21 | minifyEnabled false
22 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
23 | }
24 | }
25 | }
26 |
27 | dependencies {
28 | implementation fileTree(dir: "libs", include: ["*.jar"])
29 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
30 | implementation 'androidx.core:core-ktx:1.3.0'
31 | implementation 'androidx.appcompat:appcompat:1.1.0'
32 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
33 | testImplementation 'junit:junit:4.12'
34 | androidTestImplementation 'androidx.test.ext:junit:1.1.1'
35 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
36 |
37 | implementation 'de.hdodenhof:circleimageview:3.1.0'
38 | implementation 'com.google.android.material:material:1.1.0'
39 | implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta7'
40 |
41 | }
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_content.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
11 |
12 |
20 |
21 |
22 |
23 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/content_scrolling.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
18 |
19 |
20 |
21 |
26 |
27 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/app/src/main/java/com/ozcanalasalvar/MotionLayoutExample/MotionActivity.kt:
--------------------------------------------------------------------------------
1 | package com.ozcanalasalvar.MotionLayoutExample
2 |
3 | import androidx.appcompat.app.AppCompatActivity
4 | import android.os.Bundle
5 | import android.util.Log
6 | import androidx.core.view.GravityCompat
7 | import androidx.drawerlayout.widget.DrawerLayout
8 | import kotlinx.android.synthetic.main.coordinatorlayout_header.*
9 | import kotlinx.android.synthetic.main.profile_layout.*
10 | import kotlinx.android.synthetic.main.profile_layout_v2.*
11 |
12 | class MotionActivity : AppCompatActivity() {
13 |
14 | private lateinit var drawer: DrawerLayout
15 |
16 | override fun onCreate(savedInstanceState: Bundle?) {
17 | super.onCreate(savedInstanceState)
18 | val key = intent.getIntExtra("key", 0);
19 | Log.e("key", "" + key)
20 |
21 | when (key) {
22 | 1 -> {
23 | setContentView(R.layout.profile_layout)
24 | recyclerView.adapter = DummyRecyclerAdapter()
25 | }
26 | 2 -> {
27 | setContentView(R.layout.profile_layout_v2)
28 | recyclerView2.adapter = DummyRecyclerAdapter()
29 |
30 | }
31 | 3 -> {
32 | setContentView(R.layout.activity_drawer)
33 | drawer = findViewById(R.id.motionLayout)
34 | menuImage.setOnClickListener {
35 | drawer.openDrawer(GravityCompat.START)
36 | }
37 | }
38 | else -> {
39 | setContentView(R.layout.box_layout)
40 | }
41 | }
42 |
43 |
44 | }
45 | }
--------------------------------------------------------------------------------
/app/src/main/res/drawable-v24/ic_launcher_foreground.xml:
--------------------------------------------------------------------------------
1 |
7 |
8 |
9 |
15 |
18 |
21 |
22 |
23 |
24 |
30 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/coordinatorlayout_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
19 |
20 |
26 |
27 |
36 |
37 |
45 |
46 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_box.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
11 |
15 |
16 |
17 |
23 |
28 |
29 |
30 |
31 |
32 |
33 |
41 |
44 |
45 |
46 |
47 |
48 |
56 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/drawerlayout_menu.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
23 |
24 |
37 |
38 |
51 |
52 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
25 |
26 |
39 |
40 |
53 |
54 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/acount_info_layout.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
10 |
11 |
17 |
18 |
24 |
25 |
30 |
31 |
32 |
38 |
39 |
45 |
46 |
51 |
52 |
53 |
59 |
60 |
66 |
67 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/app/src/main/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 | MotionLayoutExample
3 | Travel by day, adventure at night \n Seek to discomfort and live life at the fullest
4 | Budapest, Hungarian pronunciation: is the capital and the most populous city of Hungary, and the ninth-largest city in the European Union by population within city limits. The city has an estimated population of 1,752,286 over a land area of about 525 square kilometres (203 square miles).Budapest is both a city and county, and forms the centre of the Budapest metropolitan area, which has an area of 7,626 square kilometres (2,944 square miles) and a population of 3,303,786, comprising 33% of the population of Hungary.\n\nThe history of Budapest began when an early Celtic settlement transformed into the Roman town of Aquincum, the capital of Lower Pannonia. The Hungarians arrived in the territory in the late 9th century, but the area was pillaged by the Mongols in 1241–42. Re-established Buda became one of the centres of Renaissance humanist culture by the 15th century. The Battle of Mohács, in 1526, was followed by nearly 150 years of Ottoman rule. After the reconquest of Buda in 1686, the region entered a new age of prosperity, with Pest-Buda becoming a global city after the unification of Buda, Óbuda, and Pest on 17 November 1873, with the name Budapest given to the new capital. Budapest also became the co-capital of the Austro-Hungarian Empire, a great power that dissolved in 1918, following World War I. The city was the focal point of the Hungarian Revolution of 1848, the Battle of Budapest in 1945, and the Hungarian Revolution of 1956.\n\n Budapest is an Alpha − global city with strengths in commerce, finance, media, art, fashion, research, technology, education, and entertainment. It is Hungarys financial centre and was ranked as the second fastest-developing urban economy in Europe. Budapest is the headquarters of the European Institute of Innovation and Technology, the European Police College and the first foreign office of the China Investment Promotion Agency. Over 40 colleges and universities are located in Budapest, including the Eötvös Loránd University, the Semmelweis University and the Budapest University of Technology and Economics. Opened in 1896, the citys subway system, the Budapest Metro, serves 1.27 million, while the Budapest Tram Network serves 1.08 million passengers daily.\n\nThe central area of Budapest along the Danube River is classified as a UNESCO World Heritage Site and has several notable monuments, including the Hungarian Parliament and the Buda Castle. The city also has around 80 geothermal springs, the largest thermal water cave system, second largest synagogue, and third largest Parliament building in the world. Budapest attracts around 12 million international tourists per year, making it a highly popular destination in Europe. The city was chosen as the Best European Destination of 2019, a major poll conducted by EBD, a tourism organisation partnering with the European Commission. It also topped the Best European Destinations 2020 list by Big7Media. Budapest also ranks as the 3rd-best European city in a similar poll conducted by Which? Magazine.\n\n
5 | On this post, I will explain how to create effective interfaces, how to organize motionlayout and interface animations. We will see how we can organize the interface changes using Motionlayout.
6 |
7 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/list_item.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
17 |
18 |
19 |
25 |
26 |
27 |
32 |
33 |
37 |
38 |
44 |
45 |
46 |
50 |
51 |
55 |
56 |
62 |
63 |
64 |
69 |
70 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
101 |
102 |
--------------------------------------------------------------------------------
/app/src/main/res/xml/scene_header.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
10 |
14 |
15 |
16 |
17 |
25 |
33 |
40 |
41 |
42 |
51 |
52 |
53 |
54 |
62 |
72 |
79 |
80 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/.idea/codeStyles/Project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |