Skip to content

Commit

Permalink
Update to gradle 4.1.1, kotlin 1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
QArtur99 committed Dec 30, 2020
1 parent 6805ebd commit 68fc00f
Show file tree
Hide file tree
Showing 18 changed files with 359 additions and 162 deletions.
125 changes: 125 additions & 0 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 6 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

buildscript {
ext {
version_appcompat = '1.1.0-rc01'
version_constraintLayout = '2.0.0-beta2'
version_core = '1.2.0-alpha02'
version_gradle = '3.4.1'
version_kotlin = "1.3.41"
version_material = '1.1.0-alpha07'
version_appcompat = '1.2.0'
version_constraintLayout = '2.0.4'
version_core = '1.5.0-alpha05'
version_gradle = '4.1.1'
version_kotlin = "1.4.21"
version_material = '1.2.1'
version_navigationHeader = '1.0.0'
}
repositories {
Expand All @@ -19,8 +19,6 @@ buildscript {
dependencies {
classpath "com.android.tools.build:gradle:$version_gradle"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$version_kotlin"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

Expand Down
16 changes: 8 additions & 8 deletions exampleMotionLayout/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'


android {
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
applicationId "com.artf.exampleMotionLayout"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand All @@ -19,11 +17,13 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
buildFeatures {
viewBinding true
}
}

dependencies {
Expand All @@ -34,7 +34,7 @@ dependencies {
implementation "androidx.constraintlayout:constraintlayout:$version_constraintLayout"
implementation "com.google.android.material:material:$version_material"

testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha01'
testImplementation 'junit:junit:4.13.1'
androidTestImplementation 'androidx.test:runner:1.3.1-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0-alpha02'
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,38 @@ import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import kotlinx.android.synthetic.main.activity_main.*
import kotlinx.android.synthetic.main.content.*
import kotlinx.android.synthetic.main.navigation_header.*
import com.artf.exampleMotionLayout.databinding.ActivityMainBinding


class MainActivity : AppCompatActivity() {

private val colorEvaluator = ArgbEvaluator()
private var contentList = mutableListOf<View>()
private var isMenuCollapsed: Boolean = false

private lateinit var binding: ActivityMainBinding

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
binding = ActivityMainBinding.inflate(layoutInflater)
val view: View = binding.root
setContentView(view)

val h1 = binding.motionLayout.h1
val h2 = binding.motionLayout.h2
val h3 = binding.motionLayout.h3
val h4 = binding.motionLayout.h4

setHeaderListener(h1, R.id.s2, R.id.s1, R.color.statusBar1, R.color.content1)
setHeaderListener(h2, R.id.s3, R.id.s1, R.color.statusBar2, R.color.content2)
setHeaderListener(h3, R.id.s4, R.id.s1, R.color.statusBar3, R.color.content3)
setHeaderListener(h4, R.id.s5, R.id.s1, R.color.statusBar4, R.color.content4)

contentList.apply {
add(c1)
add(c2)
add(c3)
add(c4)
add(binding.content.c1)
add(binding.content.c2)
add(binding.content.c3)
add(binding.content.c4)
}
}

Expand All @@ -43,19 +51,19 @@ class MainActivity : AppCompatActivity() {
) {
navigationHeader.setOnClickListener {
if (isMenuCollapsed) {
motionLayout.setTransition(outAnim, inAnim)
binding.motionLayout.motionLayout.setTransition(outAnim, inAnim)
expand()
} else {
motionLayout.setTransition(inAnim, outAnim)
binding.motionLayout.motionLayout.setTransition(inAnim, outAnim)
collapse(statusBarColor, contentColor)
}
motionLayout.transitionToEnd()
binding.motionLayout.motionLayout.transitionToEnd()
isMenuCollapsed = !isMenuCollapsed
}
}

private fun collapse(statusBarColor: Int, contentColor: Int) {
arrow?.isActivated = true
binding.motionLayout.arrow.isActivated = true
animateStatusBar(window, "statusBarColor", window.statusBarColor, statusBarColor)
for (view in contentList) {
val colorDrawable = view.background as ColorDrawable
Expand All @@ -64,7 +72,7 @@ class MainActivity : AppCompatActivity() {
}

private fun expand() {
arrow?.isActivated = false
binding.motionLayout.arrow.isActivated = false
animateStatusBar(window, "statusBarColor", window.statusBarColor, R.color.statusBar1)
}

Expand Down
26 changes: 13 additions & 13 deletions exampleMotionLayout/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<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:id="@+id/motion_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.artf.exampleMotionLayout.MainActivity"
app:layoutDescription="@xml/motion_scene">
app:layoutDescription="@xml/motion_scene"
tools:context="com.artf.exampleMotionLayout.MainActivity">

<include layout="@layout/content"/>
<include
android:id="@+id/content"
layout="@layout/content"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<androidx.constraintlayout.motion.widget.MotionLayout
<include
android:id="@+id/motionLayout"
layout="@layout/navigation_header"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layoutDescription="@xml/motion_scene">

<include layout="@layout/navigation_header"/>

</androidx.constraintlayout.motion.widget.MotionLayout>
android:layout_height="match_parent" />

</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit 68fc00f

Please sign in to comment.