Bug 925012 - Force execution of pending BrowserSearch fragment removals before re-adding. r=lucasr

This commit is contained in:
Brian Nicholson 2013-10-18 11:39:32 -07:00
Родитель 12386e2162
Коммит c4daf800a7
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -53,6 +53,7 @@ import android.nfc.NfcAdapter;
import android.nfc.NfcEvent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.InputDevice;
@ -1646,8 +1647,16 @@ abstract public class BrowserApp extends GeckoApp
mBrowserSearchContainer.setVisibility(View.VISIBLE);
getSupportFragmentManager().beginTransaction()
.add(R.id.search_container, mBrowserSearch, BROWSER_SEARCH_TAG).commitAllowingStateLoss();
final FragmentManager fm = getSupportFragmentManager();
// In certain situations, showBrowserSearch() can be called immediately after hideBrowserSearch()
// (see bug 925012). Because of an Android bug (http://code.google.com/p/android/issues/detail?id=61179),
// calling FragmentTransaction#add immediately after FragmentTransaction#remove won't add the fragment's
// view to the layout. Calling FragmentManager#executePendingTransactions before re-adding the fragment
// prevents this issue.
fm.executePendingTransactions();
fm.beginTransaction().add(R.id.search_container, mBrowserSearch, BROWSER_SEARCH_TAG).commitAllowingStateLoss();
mBrowserSearch.setUserVisibleHint(true);
}