Software Development/Application Develop

Android Window 전환 애니메이션 코드

huiyu 2020. 4. 7. 15:56

안드로이드 코드 살펴보다가 메모

아래 페이지에서 전체 코드를 살펴볼수있다. 코드를 보니... 역시나 크고 어려운데 그래도 페이지에서 쉽게 볼 수 있게 되어있어서 살펴보기엔 용이하다.

https://cs.android.com/android/platform/superproject/

 

https://cs.android.com/android/platform/superproject/

 

cs.android.com

 

관련해서 필요한 페이지들 메모..

 

1. activity 화면전환 설명
https://developer.android.com/training/transitions/start-activity

2. ActivityOptions Class
https://developer.android.com/reference/android/app/ActivityOptions#makeSceneTransitionAnimation(android.app.Activity,%20android.view.View,%20java.lang.String)

3. ActivityOptions 구현부
https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/ActivityOptions.java

4. ActivityAnimation Example
https://cs.android.com/android/platform/superproject/+/master:development/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ActivityAnimations.java


5. (ApplyOptionsLocked())  호출
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/services/core/java/com/android/server/wm/ActivityRecord.java;l=1661;bpv=1;bpt=1

-> AppTransition.java:LoadAnimation()
https://cs.android.com/android/platform/superproject/+/master:frameworks/base/services/core/java/com/android/server/wm/AppTransition.java;l=1614;bpv=1;bpt=1

AppWindowToken.java : LoadAnimation()->AppTransition.LoadAnimation()

WindowContainer.java : startAnimation(Transaction t, AnimationAdapter anim, boolean hidden)



6. StartAcitivy 호출
Activity.java: startAcvitity(intent, bundle)-> startActivityForResult(Intent, requestCode, Bundle)
Instrumentation.java: execStartActivity(Bundle options)
ActivityTaskmangerService.java:startActivity(Bundle)->StartActivityAsUser(Bundle)
ActivityStarter.java:setActivityOptions(Bundle) / execute() ->startActivity(ActivityOption)

https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/app/Instrumentation.java;bpv=1;bpt=1;l=1712
ActivityStart.java : new ActivityRecord() ->startActivity(ActivityRecord, AcitivityOptions)
->StartActivityUnchecked()

ActivityStack.java
 ->StartActivityLocked()

 

 

미리 정의된 xml파일
Color https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/res/color/

Animation https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/res/res/anim/

샘플코드
https://cs.android.com/android/platform/superproject/+/master:development/samples/devbytes/animation/ActivityAnimations/src/com/example/android/activityanim/ActivityAnimations.java

https://www.rightpoint.com/rplabs/make-scene-transition-animation

https://jhson5183.tistory.com/2

 

 

 

[참고코드]

ActivityOptions

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/ActivityOptions.java

ExitTransitionCoordinate

https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/ExitTransitionCoordinator.java

OverridePendingTransition(ActivityOptions의 custom animation은 이 코드를 호출)

https://jhshjs.tistory.com/entry/%EC%95%88%EB%93%9C%EB%A1%9C%EC%9D%B4%EB%93%9C-overridePendingTransition-%EC%95%88-%EB%90%A8-%EC%95%A1%ED%8B%B0%EB%B9%84%ED%8B%B0-%EC%A0%84%ED%99%98-%EC%95%A0%EB%8B%88%EB%A9%94%EC%9D%B4%EC%85%98?category=887048

 

Activity class

https://developer.android.com/reference/android/app/Activity#overridePendingTransition(int,%20int)

StartActivity

https://developer.android.com/training/transitions/start-activity#java

ActivityOptions

https://developer.android.com/reference/android/app/ActivityOptions#makeSceneTransitionAnimation(android.app.Activity,%20android.view.View,%20java.lang.String)

Window

https://developer.android.com/reference/android/view/Window#FEATURE_ACTIVITY_TRANSITIONS

Intent기초

https://hashcode.co.kr/questions/2125/string%EB%8D%B0%EC%9D%B4%ED%84%B0%EB%A5%BC-putextra-%EC%99%80-getextra-%EB%A1%9C-%EB%84%A3%EA%B3%A0-%EB%B0%9B%EC%9C%BC%EB%A0%A4%EB%A9%B4-%EC%96%B4%EB%96%BB%EA%B2%8C-%ED%95%B4%EC%95%BC%ED%95%98%EB%82%98%EC%9A%94

728x90