summaryrefslogtreecommitdiffstats
path: root/core/java/com/android
diff options
context:
space:
mode:
authorRomain Guy <>2009-03-24 22:46:33 -0700
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-24 22:46:33 -0700
commit870a2b015645ef5086af6a5de31dc482e7193214 (patch)
tree270f7a9187db73fb43405338a1655a7d7cb71d0b /core/java/com/android
parent97d00b3150df9eb434f51f486a6104bb16a16cec (diff)
downloadframeworks_base-870a2b015645ef5086af6a5de31dc482e7193214.zip
frameworks_base-870a2b015645ef5086af6a5de31dc482e7193214.tar.gz
frameworks_base-870a2b015645ef5086af6a5de31dc482e7193214.tar.bz2
Automated import from //branches/donutburger/...@142470,142470
Diffstat (limited to 'core/java/com/android')
-rw-r--r--core/java/com/android/internal/app/AlertController.java32
-rw-r--r--core/java/com/android/internal/view/menu/MenuDialogHelper.java11
2 files changed, 34 insertions, 9 deletions
diff --git a/core/java/com/android/internal/app/AlertController.java b/core/java/com/android/internal/app/AlertController.java
index b330a18..57dbb44 100644
--- a/core/java/com/android/internal/app/AlertController.java
+++ b/core/java/com/android/internal/app/AlertController.java
@@ -17,7 +17,6 @@
package com.android.internal.app;
import static android.view.ViewGroup.LayoutParams.FILL_PARENT;
-import static android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
@@ -49,6 +48,7 @@ import android.widget.ScrollView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
+import android.util.AttributeSet;
import com.android.internal.R;
@@ -672,7 +672,28 @@ public class AlertController {
}
}
}
-
+
+ public static class RecycleListView extends ListView {
+ boolean mRecycleOnMeasure = true;
+
+ public RecycleListView(Context context) {
+ super(context);
+ }
+
+ public RecycleListView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public RecycleListView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ }
+
+ @Override
+ protected boolean recycleOnMeasure() {
+ return mRecycleOnMeasure;
+ }
+ }
+
public static class AlertParams {
public final Context mContext;
public final LayoutInflater mInflater;
@@ -711,7 +732,8 @@ public class AlertController {
public boolean mForceInverseBackground;
public AdapterView.OnItemSelectedListener mOnItemSelectedListener;
public OnPrepareListViewListener mOnPrepareListViewListener;
-
+ public boolean mRecycleOnMeasure = true;
+
/**
* Interface definition for a callback to be invoked before the ListView
* will be bound to an adapter.
@@ -787,7 +809,8 @@ public class AlertController {
}
private void createListView(final AlertController dialog) {
- final ListView listView = (ListView) mInflater.inflate(R.layout.select_dialog, null);
+ final RecycleListView listView = (RecycleListView)
+ mInflater.inflate(R.layout.select_dialog, null);
ListAdapter adapter;
if (mIsMultiChoice) {
@@ -886,6 +909,7 @@ public class AlertController {
} else if (mIsMultiChoice) {
listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
}
+ listView.mRecycleOnMeasure = mRecycleOnMeasure;
dialog.mListView = listView;
}
}
diff --git a/core/java/com/android/internal/view/menu/MenuDialogHelper.java b/core/java/com/android/internal/view/menu/MenuDialogHelper.java
index bc51cf3..88f7b2f 100644
--- a/core/java/com/android/internal/view/menu/MenuDialogHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuDialogHelper.java
@@ -67,6 +67,10 @@ public class MenuDialogHelper implements DialogInterface.OnKeyListener, DialogIn
// Set the key listener
builder.setOnKeyListener(this);
+
+ // Since this is for a menu, disable the recycling of views
+ // This is done by the menu framework anyway
+ builder.setRecycleOnMeasureEnabled(false);
// Show the menu
mDialog = builder.create();
@@ -97,11 +101,8 @@ public class MenuDialogHelper implements DialogInterface.OnKeyListener, DialogIn
}
// Menu shortcut matching
- if (mMenu.performShortcut(keyCode, event, 0)) {
- return true;
- }
-
- return false;
+ return mMenu.performShortcut(keyCode, event, 0);
+
}
/**