Use Framelayout instead of RelativeLayout in DialtactsActivity
Switch to FrameLayout instead of RelativeLayout since we don't need
the more complicated and expensive layout abilities of RelativeLayout.
This improves startup time (on hammerhead-eng, interpreted ART mode)
to about 1150ms on average from 1300ms originally.
Change-Id: I94400dcc58cc74497c71a7432a06a4dffe3b078d
diff --git a/res/layout/dialtacts_activity.xml b/res/layout/dialtacts_activity.xml
index 71e58cb..5727d8a 100644
--- a/res/layout/dialtacts_activity.xml
+++ b/res/layout/dialtacts_activity.xml
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<RelativeLayout
+<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialtacts_mainlayout"
android:layout_width="match_parent"
@@ -25,7 +25,7 @@
android:animateLayoutChanges="true"
android:background="@color/background_dialer_light"
>
- <RelativeLayout
+ <FrameLayout
android:id="@+id/dialtacts_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
@@ -36,15 +36,14 @@
android:layout_width="match_parent"
android:id="@+id/dialtacts_frame"
android:clipChildren="false" />
- </RelativeLayout>
+ </FrameLayout>
<FrameLayout
android:id="@+id/floating_action_button_container"
android:layout_width="@dimen/floating_action_button_width"
android:layout_height="@dimen/floating_action_button_height"
android:layout_marginRight="@dimen/floating_action_button_margin_right"
android:layout_marginBottom="@dimen/floating_action_button_margin_bottom"
- android:layout_centerHorizontal="true"
- android:layout_alignParentBottom="true">
+ android:layout_gravity="center_horizontal|bottom" >
<ImageButton
android:id="@+id/floating_action_button"
@@ -67,4 +66,4 @@
android:visibility="gone"
android:importantForAccessibility="no" />
</FrameLayout>
-</RelativeLayout>
+</FrameLayout>
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java
index a5b6999..4145690 100644
--- a/src/com/android/dialer/DialtactsActivity.java
+++ b/src/com/android/dialer/DialtactsActivity.java
@@ -56,6 +56,7 @@
import android.view.inputmethod.InputMethodManager;
import android.widget.AbsListView.OnScrollListener;
import android.widget.EditText;
+import android.widget.FrameLayout;
import android.widget.ImageButton;
import android.widget.PopupMenu;
import android.widget.RelativeLayout;
@@ -139,7 +140,7 @@
private static final int ACTIVITY_REQUEST_CODE_VOICE_SEARCH = 1;
- private RelativeLayout parentLayout;
+ private FrameLayout parentLayout;
/**
* Fragment containing the dialpad that slides into view
@@ -419,7 +420,7 @@
mSlideOut.setAnimationListener(mSlideOutListener);
- parentLayout = (RelativeLayout) findViewById(R.id.dialtacts_mainlayout);
+ parentLayout = (FrameLayout) findViewById(R.id.dialtacts_mainlayout);
parentLayout.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING);
parentLayout.setOnDragListener(new LayoutOnDragListener());
floatingActionButtonContainer.getViewTreeObserver().addOnGlobalLayoutListener(