KShareViewActivityManager
????Android 5.0 ??Shared Element Transition ??????????????
???????
2016 1 25 ?? ??TextView ????????
????? http://image17-c.poco.cn/mypoco/myphoto/20160413/11/17425403720160413113956013.gif?415x620_110
???????APP ?????ToDo????????ToDoList???APP???????????????????????????????????:D?????????????
??????????Activity ????View ?wrap_content ??????????
?????
##A->B
1.????Activity??
img = (ImageView) findViewById(R.id.img);
title = (TextView) findViewById(R.id.title);
KShareViewActivityManager.getInstance(MainActivity.this).startActivity(MainActivity.this, SecondActivity.class,R.layout.activity_main,R.layout.activity_second, img, title);
????????????View ???layout ?xml ????????ListView ?Item ????????item ???xml?
????? R.layout.activity_second ???????Activity ???layout id?????????????????View
???Manager ??????View ?????????tag ???????activity_main ??
<ImageView
android:id="@+id/img"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_marginLeft="25dp"
android:layout_marginTop="25dp"
android:background="@drawable/splash"
android:tag="img" />
?activity_second ??
<ImageView
android:id="@+id/img_two"
android:layout_width="250dp"
android:layout_height="250dp"
android:layout_centerInParent="true"
android:background="@drawable/splash"
android:tag="img" />
tag????
##B->A ????
??ActivityB ????
@Override public void onBackPressed() {
KShareViewActivityManager.getInstance(SecondActivity.this).finish(SecondActivity.this);
}
##????
????????Content ?????????Activity ?Fragment ??????????????View????????
???????View ??????View?????inflate ????????????????????Manager ????TextView ?ImageView ????????View????????????View????????? changeViewProperty(View view) ??????????????????? ??
KShareViewActivityManager.getInstance(this).withAction(new KShareViewActivityAction() {
@Override
public void onAnimatorStart() {
}
@Override
public void onAnimatorEnd() {
}
@Override
public void changeViewProperty(View view) {
if(view.getTag().equals("text")){
((MyTextView)view).setOtherProperty(oringinTextView.getOtherProperty);
}
if(view.getTag().equals("xxx")){
...
}
}
}
)?
??
##????????????????????????????????
KShareViewActivityManager.getInstance(this).withAction(new KShareViewActivityAction() {
@Override
public void onAnimatorStart() {
}
@Override
public void onAnimatorEnd() {
}
@Override
public void changeViewProperty(View view) {
view.setBackgroundColor(0x00ffffff);
}
}
).setDuration(1000).startActivity(this, CountDownActivity.class, R.layout.list_item, R.layout.activity_count_down,
(View) ((CommandEvent) event).obj);
???????? withIntent ????Intent ,?? withIntentAndRequestCode(Intent intent,int requestCode) ?????startActivityForResult ????
License
Copyright 2015 Kot32 Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.