Draw the gradient line for the list dividers too

This commit is contained in:
Christopher Eby 2010-04-10 22:08:58 -05:00
parent b659888479
commit 99896331f5
2 changed files with 15 additions and 0 deletions

View File

@ -26,16 +26,19 @@
android:id="@+id/artist_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@null"
android:fastScrollEnabled="true" />
<ListView
android:id="@+id/album_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@null"
android:fastScrollEnabled="true" />
<ListView
android:id="@+id/song_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:divider="@null"
android:fastScrollEnabled="true" />
</FrameLayout>
</LinearLayout>

View File

@ -212,6 +212,7 @@ public class MediaAdapter extends CursorAdapter implements FilterQueryProvider {
int mViewHeight = -1;
RadialGradient mSeparatorGradient;
RadialGradient mDividerGradient;
public class MediaView extends View {
private long mId;
@ -276,6 +277,7 @@ public class MediaAdapter extends CursorAdapter implements FilterQueryProvider {
canvas.drawBitmap(expander, width + padding * 2, (height - expander.getHeight()) / 2, paint);
}
canvas.save();
canvas.clipRect(padding, 0, width - padding, height);
int allocatedHeight;
@ -291,6 +293,16 @@ public class MediaAdapter extends CursorAdapter implements FilterQueryProvider {
paint.setColor(Color.WHITE);
canvas.drawText(mTitle, padding, padding + (allocatedHeight - mTextSize) / 2 - paint.ascent(), paint);
width = getWidth();
if (mDividerGradient == null)
mDividerGradient = new RadialGradient(width / 2, height, width / 2, Color.WHITE, Color.BLACK, Shader.TileMode.CLAMP);
paint.setShader(mDividerGradient);
canvas.restore();
canvas.drawLine(0, height, width, height, paint);
paint.setShader(null);
}
public final int getFieldCount()