Skip to content

Commit

Permalink
Bump and migrate material version to 1.2.0-beta01
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed May 29, 2020
1 parent 94d9b6b commit c6124d2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import com.google.android.material.appbar.AppBarLayout
import com.google.android.material.appbar.AppBarLayout.OnOffsetChangedListener
import com.google.android.material.bottomnavigation.BottomNavigationView
import com.google.android.material.floatingactionbutton.FloatingActionButton
import com.google.android.material.transition.MaterialArcMotion
import com.google.android.material.transition.MaterialContainerTransform
import com.google.android.material.transition.platform.MaterialArcMotion
import com.google.android.material.transition.platform.MaterialContainerTransform
import com.skydoves.disneymotions.R
import com.skydoves.disneymotions.extensions.gone
import com.skydoves.disneymotions.extensions.visible
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,26 @@

package com.skydoves.disneymotions.extensions

import android.view.View
import android.content.Context
import android.view.Window
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.core.view.ViewCompat
import com.google.android.material.transition.MaterialArcMotion
import com.google.android.material.transition.MaterialContainerTransform
import com.google.android.material.transition.MaterialContainerTransformSharedElementCallback
import com.google.android.material.transition.platform.MaterialArcMotion
import com.google.android.material.transition.platform.MaterialContainerTransform
import com.google.android.material.transition.platform.MaterialContainerTransformSharedElementCallback
import com.skydoves.disneymotions.R

/** get a material container arc transform. */
internal fun getContentTransform(): MaterialContainerTransform {
internal fun getContentTransform(context: Context): MaterialContainerTransform {
return MaterialContainerTransform().apply {
addTarget(android.R.id.content)
duration = 450
pathMotion = MaterialArcMotion()
isElevationShadowEnabled = true
startElevation = 9f
endElevation = 9f
startContainerColor = ContextCompat.getColor(context, R.color.colorPrimary)
}
}

Expand All @@ -43,10 +49,10 @@ fun AppCompatActivity.applyExitMaterialTransform() {
/** apply material entered container transformation. */
fun AppCompatActivity.applyMaterialTransform(transitionName: String) {
window.requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS)
ViewCompat.setTransitionName(findViewById<View>(android.R.id.content), transitionName)
ViewCompat.setTransitionName(findViewById(android.R.id.content), transitionName)

// set up shared element transition
setEnterSharedElementCallback(MaterialContainerTransformSharedElementCallback())
window.sharedElementEnterTransition = getContentTransform()
window.sharedElementReturnTransition = getContentTransform()
window.sharedElementEnterTransition = getContentTransform(this)
window.sharedElementReturnTransition = getContentTransform(this)
}
8 changes: 4 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ ext.versions = [
versionPlugin : '0.23.0',

// kotlin
kotlin : '1.3.70',
kotlin : '1.3.72',

// support library
materialVersion : '1.2.0-alpha06',
materialVersion : '1.2.0-beta01',
constraintVersion : '1.1.3',

// architecture components
lifecycleVersion : '2.2.0',
roomVersion : '2.2.5',
archCompomentVersion: '2.0.0',
archCompomentVersion: '2.1.0',

// di
koinVersion : '2.0.1',
Expand All @@ -46,7 +46,7 @@ ext.versions = [

// unit test
junitVersion : '4.12',
androidxTest : '1.1.0',
androidxTest : '1.2.0',
unitTestCoreVersion : '1.2.0',
robolectricVersion : '4.3',
androidxTestRules : '1.2.0-alpha04',
Expand Down

0 comments on commit c6124d2

Please sign in to comment.