Commit 15921d29 authored by Adrien Maglo's avatar Adrien Maglo

Audio player: to hide a view, use the visibility attribute instead of the zero height hack

parent 7c965f82
......@@ -58,7 +58,7 @@
<View
android:id="@+id/footer"
android:layout_width="match_parent"
android:layout_height="@dimen/audio_browser_item_footer_height"
android:layout_height="1dp"
android:background="@color/item_footer" />
</LinearLayout>
\ No newline at end of file
......@@ -2,5 +2,4 @@
<dimen name="shadow_width">6px</dimen>
<dimen name="widget_margin">10dp</dimen>
<dimen name="audio_browser_item_size">50dp</dimen>
<dimen name="audio_browser_item_footer_height">1dp</dimen>
</resources>
\ No newline at end of file
......@@ -188,25 +188,11 @@ public class AudioBrowserListAdapter extends BaseAdapter {
paramsCover = new RelativeLayout.LayoutParams(0, RelativeLayout.LayoutParams.WRAP_CONTENT);
holder.cover.setLayoutParams(paramsCover);
LinearLayout.LayoutParams paramsSubTitle;
if (item.mSubTitle == null)
paramsSubTitle = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 0);
else {
paramsSubTitle = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
holder.subtitle.setText(item.mSubTitle);
}
holder.subtitle.setLayoutParams(paramsSubTitle);
holder.subtitle.setVisibility(item.mSubTitle == null ? TextView.GONE : TextView.VISIBLE);
holder.subtitle.setText(item.mSubTitle);
// Remove the footer if the item is just above a separator.
LinearLayout.LayoutParams paramsFooter;
if (isMediaItemAboveASeparator(position))
paramsFooter = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0);
else {
int height = (int) mContext.getResources().getDimension(R.dimen.audio_browser_item_footer_height);
paramsFooter = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, height);
}
holder.footer.setLayoutParams(paramsFooter);
holder.footer.setVisibility(isMediaItemAboveASeparator(position) ? View.GONE : View.VISIBLE);
final int pos = position;
holder.more.setOnClickListener(new OnClickListener() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment