People: Action bar tab refactoring
- Now ActionBarAdapter manages the action bar tabs.
- Now ActionBarAdapter.setCurrentTab() should always be used to select
a tab programmatically, rather than directly calling
ActionBar.setSelectedNavigationItem().
- Do not re-create/re-initialize ActionBarAdapter/ActionBar for new
intents.
- Simplify fragment visibility update logic in PeopleActivity.
- Do not clear ActionBarAdapter.Listener in PeopleActivity.onPause;
do this only in onDestroy.
Activity is paused when we're processing onNewIntent(), but we still want to
get callbacks during this.
Change-Id: I93ec35e569e1854923503734693b6404cff92f50
diff --git a/src/com/android/contacts/ContactsActivity.java b/src/com/android/contacts/ContactsActivity.java
index 1414f80..020d135 100644
--- a/src/com/android/contacts/ContactsActivity.java
+++ b/src/com/android/contacts/ContactsActivity.java
@@ -21,6 +21,7 @@
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
+import android.app.FragmentTransaction;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -117,4 +118,12 @@
}
return result;
}
+
+ protected static void showFragment(FragmentTransaction ft, Fragment f) {
+ if ((f != null) && f.isHidden()) ft.show(f);
+ }
+
+ protected static void hideFragment(FragmentTransaction ft, Fragment f) {
+ if ((f != null) && !f.isHidden()) ft.hide(f);
+ }
}