Revert "Fixing ClassNotFoundException in JoinContactsActivity"
This reverts commit f8aaed83a9620f760b16b10d9b56a0c4a2454f66
as well as partially 4c08c999c422f84421c383d40f9315f001d593e8
I shouldn't have removed FullHeightLinearLayout. Its
functionality is still required.
Change-Id: I31ac11154feb8d33c667f29e38c076fb5e3928ae
diff --git a/res/layout/contact_picker.xml b/res/layout/contact_picker.xml
index 671b766..b226b4f 100644
--- a/res/layout/contact_picker.xml
+++ b/res/layout/contact_picker.xml
@@ -14,8 +14,9 @@
limitations under the License.
-->
-<LinearLayout
+<view
xmlns:android="http://schemas.android.com/apk/res/android"
+ class="com.android.contacts.widget.FullHeightLinearLayout"
style="@style/ContactPickerLayout"
android:paddingLeft="32dip"
android:paddingRight="32dip"
@@ -48,4 +49,4 @@
android:layout_height="wrap_content"
android:text="@android:string/cancel"/>
</LinearLayout>
-</LinearLayout>
+</view>
diff --git a/res/layout/join_contact_picker.xml b/res/layout/join_contact_picker.xml
index b45519e..e0a6c2a 100644
--- a/res/layout/join_contact_picker.xml
+++ b/res/layout/join_contact_picker.xml
@@ -14,8 +14,9 @@
limitations under the License.
-->
-<LinearLayout
+<view
xmlns:android="http://schemas.android.com/apk/res/android"
+ class="com.android.contacts.widget.FullHeightLinearLayout"
style="@style/ContactPickerLayout"
android:paddingLeft="20dip"
android:paddingRight="20dip"
@@ -25,4 +26,4 @@
android:layout_height="match_parent"
android:id="@+id/list_container">
</FrameLayout>
-</LinearLayout>
+</view>
diff --git a/src/com/android/contacts/widget/FullHeightLinearLayout.java b/src/com/android/contacts/widget/FullHeightLinearLayout.java
new file mode 100644
index 0000000..f9548a6
--- /dev/null
+++ b/src/com/android/contacts/widget/FullHeightLinearLayout.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.contacts.widget;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.widget.LinearLayout;
+
+/**
+ * A custom layout for dialogs that need to be stretched to the full height of the screen.
+ * It overrides the height measure specification to ignore "wrap_content" and
+ * do "match_parent" instead. The "wrap_content" part is hard-coded in the framework
+ * implementation of the dialog theme.
+ */
+public final class FullHeightLinearLayout extends LinearLayout {
+
+ public FullHeightLinearLayout(Context context) {
+ super(context);
+ }
+
+ public FullHeightLinearLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public FullHeightLinearLayout(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+ if (MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) {
+ heightMeasureSpec = MeasureSpec.makeMeasureSpec(
+ MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY);
+ }
+ super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+ }
+}