am 8c789490: Merge "API Review: change fragment transition methods." into lmp-dev

* commit '8c78949019d0e0a35094dbeedd2c786e2e46acd3':
  API Review: change fragment transition methods.
This commit is contained in:
George Mount
2014-08-24 18:21:59 +00:00
committed by Android Git Automerger
3 changed files with 27 additions and 7 deletions

View File

@@ -4374,6 +4374,7 @@ package android.app {
method public abstract android.app.FragmentTransaction add(android.app.Fragment, java.lang.String);
method public abstract android.app.FragmentTransaction add(int, android.app.Fragment);
method public abstract android.app.FragmentTransaction add(int, android.app.Fragment, java.lang.String);
method public abstract android.app.FragmentTransaction addSharedElement(android.view.View, java.lang.String);
method public abstract android.app.FragmentTransaction addToBackStack(java.lang.String);
method public abstract android.app.FragmentTransaction attach(android.app.Fragment);
method public abstract int commit();
@@ -4393,8 +4394,6 @@ package android.app {
method public abstract android.app.FragmentTransaction setCustomAnimations(int, int);
method public abstract android.app.FragmentTransaction setCustomAnimations(int, int, int, int);
method public abstract android.app.FragmentTransaction setCustomTransition(int, int);
method public abstract android.app.FragmentTransaction setSharedElement(android.view.View, java.lang.String);
method public abstract android.app.FragmentTransaction setSharedElements(android.util.Pair<android.view.View, java.lang.String>...);
method public abstract android.app.FragmentTransaction setTransition(int);
method public abstract android.app.FragmentTransaction setTransitionStyle(int);
method public abstract android.app.FragmentTransaction show(android.app.Fragment);

View File

@@ -579,6 +579,23 @@ final class BackStackRecord extends FragmentTransaction implements
return this;
}
@Override
public FragmentTransaction addSharedElement(View sharedElement, String name) {
String transitionName = sharedElement.getTransitionName();
if (transitionName == null) {
throw new IllegalArgumentException("Unique transitionNames are required for all" +
" sharedElements");
}
if (mSharedElementSourceNames == null) {
mSharedElementSourceNames = new ArrayList<String>();
mSharedElementTargetNames = new ArrayList<String>();
}
mSharedElementSourceNames.add(transitionName);
mSharedElementTargetNames.add(name);
return this;
}
/** TODO: remove this */
@Override
public FragmentTransaction setSharedElement(View sharedElement, String name) {
String transitionName = sharedElement.getTransitionName();
@@ -594,6 +611,7 @@ final class BackStackRecord extends FragmentTransaction implements
return this;
}
/** TODO: remove this */
@Override
public FragmentTransaction setSharedElements(Pair<View, String>... sharedElements) {
if (sharedElements == null || sharedElements.length == 0) {

View File

@@ -190,14 +190,17 @@ public abstract class FragmentTransaction {
* @param name The transitionName for a View in an appearing Fragment to match to the shared
* element.
*/
public abstract FragmentTransaction addSharedElement(View sharedElement, String name);
/**
* TODO: remove from API
* @hide
*/
public abstract FragmentTransaction setSharedElement(View sharedElement, String name);
/**
* Used with {@link #setCustomTransition(int, int)} to map multiple Views from removed or hidden
* Fragments to a Views from a shown or added Fragments. Views in
* <var>sharedElements</var> must have unique transitionNames in the View hierarchy.
* @param sharedElements Pairs of Views in disappearing Fragments to transitionNames in
* appearing Fragments.
* TODO: remove from API
* @hide
*/
public abstract FragmentTransaction setSharedElements(Pair<View, String>... sharedElements);