Merge change If1e1fb39 into eclair-mr2

* changes:
  Draw dividers between <optgroup> and <option> elements.
This commit is contained in:
Android (Google) Code Review
2009-10-21 14:15:54 -04:00

View File

@@ -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;
}