diff options
| author | Leon Scroggins <scroggo@google.com> | 2009-10-21 13:39:33 -0400 |
|---|---|---|
| committer | Leon Scroggins <scroggo@google.com> | 2009-10-21 13:39:33 -0400 |
| commit | f1e1fb39763434d166371c2a62a0e6d8a4166940 (patch) | |
| tree | f2518a23ae25f4fda21f97c61d30308d5fcb46fa /core/java/android/webkit | |
| parent | a8da17356f9a385e097e3eef205358462d214538 (diff) | |
| download | frameworks_base-f1e1fb39763434d166371c2a62a0e6d8a4166940.zip frameworks_base-f1e1fb39763434d166371c2a62a0e6d8a4166940.tar.gz frameworks_base-f1e1fb39763434d166371c2a62a0e6d8a4166940.tar.bz2 | |
Draw dividers between <optgroup> and <option> elements.
Fix http://b/issue?id=2198355
Diffstat (limited to 'core/java/android/webkit')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index fa31ca9..47b12cb 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -66,6 +66,7 @@ import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.CheckedTextView; import android.widget.FrameLayout; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.Scroller; import android.widget.Toast; @@ -83,6 +84,8 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; +import junit.framework.Assert; + /** * <p>A View that displays web pages. This class is the basis upon which you * can roll your own web browser or simply display some online content within your Activity. @@ -5339,9 +5342,40 @@ public class WebView extends AbsoluteLayout // one. convertView = super.getView(position, null, parent); Container c = item(position); - if (c != null && Container.OPTGROUP == c.mEnabled - && convertView instanceof CheckedTextView) { - ((CheckedTextView) convertView).setCheckMarkDrawable(null); + if (c != null && Container.OPTION_ENABLED != c.mEnabled) { + // ListView does not draw dividers between disabled and + // enabled elements. Use a LinearLayout to provide dividers + LinearLayout layout = new LinearLayout(mContext); + layout.setOrientation(LinearLayout.VERTICAL); + if (position > 0) { + View dividerTop = new View(mContext); + dividerTop.setBackgroundResource( + android.R.drawable.divider_horizontal_bright); + layout.addView(dividerTop); + } + + if (Container.OPTGROUP == c.mEnabled) { + // Currently select_dialog_multichoice and + // select_dialog_singlechoice are CheckedTextViews. If + // that changes, the class cast will no longer be valid. + Assert.assertTrue( + convertView instanceof CheckedTextView); + ((CheckedTextView) convertView).setCheckMarkDrawable( + null); + } else { + // c.mEnabled == Container.OPTION_DISABLED + // Draw the disabled element in a disabled state. + convertView.setEnabled(false); + } + + layout.addView(convertView); + if (position < getCount() - 1) { + View dividerBottom = new View(mContext); + dividerBottom.setBackgroundResource( + android.R.drawable.divider_horizontal_bright); + layout.addView(dividerBottom); + } + return layout; } return convertView; } |
