Fix FragmentTransaction replace() behavior

Bug 22174959

According to FragmentTransaction's reference, replace()
should be equivalent to remove()'ing every fragment in
a given container and then adding the specified fragment
to replace those that were removed.

Commit 5506618c80a292ac275d8b0c1046b446c7f58836 broke
this intended behavior in the support library.

This patch makes it so that the removal loop doesn't
end prematurely. It also fixes an issue where the
replace operation would remove fragments regardless
of their container after encountering the first fragment
with a matching container ID.

Relevant issues:
http://b.android.com/43265
http://b.android.com/52112
http://b.android.com/53393
http://b.android.com/68856
http://b.android.com/70803

Change-Id: Ieab4468fa7a2afb63bd5fd87a21bbd95d54d638f
Signed-off-by: Eddie Ringle <eddie.ringle@gmail.com>
1 file changed