Skip to content

Commit

Permalink
DigitalCampus#566: Included download path to Media download list items
Browse files Browse the repository at this point in the history
  • Loading branch information
jjoseba committed Sep 6, 2016
1 parent 3990bfe commit 5014164
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 3 deletions.
Expand Up @@ -50,6 +50,7 @@ public DownloadMediaListAdapter(Activity context, ArrayList<Media> mediaList) {

static class DownloadMediaViewHolder{
TextView mediaTitle;
TextView mediaPath;
TextView mediaFileSize;
ImageButton downloadBtn;
ProgressBar downloadProgress;
Expand All @@ -65,6 +66,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
convertView = inflater.inflate(R.layout.media_download_row, parent, false);
viewHolder = new DownloadMediaViewHolder();
viewHolder.mediaTitle = (TextView) convertView.findViewById(R.id.media_title);
viewHolder.mediaPath = (TextView) convertView.findViewById(R.id.media_path);
viewHolder.mediaFileSize = (TextView) convertView.findViewById(R.id.media_file_size);
viewHolder.downloadBtn = (ImageButton) convertView.findViewById(R.id.action_btn);
viewHolder.downloadProgress = (ProgressBar) convertView.findViewById(R.id.download_progress);
Expand All @@ -77,6 +79,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
Media m = mediaList.get(position);

viewHolder.mediaTitle.setText(m.getFilename());
viewHolder.mediaPath.setText(m.getDownloadUrl());
if(m.getFileSize() != 0){
viewHolder.mediaFileSize.setText(ctx.getString(R.string.media_file_size,m.getFileSize()/(1024*1024)));
} else {
Expand Down
23 changes: 20 additions & 3 deletions app/src/main/res/layout/media_download_row.xml
Expand Up @@ -15,15 +15,30 @@
android:layout_toLeftOf="@+id/action_btn" />

<TextView
android:id="@+id/media_file_size"
style="@style/SmallTextDark"
android:id="@+id/media_path"
style="@style/SmallTextGrey"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="center_vertical"
android:layout_below="@+id/media_title"
android:paddingTop="5dp"
android:layout_toLeftOf="@+id/action_btn" />

<TextView
android:id="@+id/media_file_size"
style="@style/SmallTextDark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="-10dp"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:gravity="center_horizontal"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:layout_below="@+id/action_btn" />

<ProgressBar
android:layout_width="fill_parent"
android:layout_height="wrap_content"
Expand All @@ -46,6 +61,8 @@
android:src="@drawable/ic_action_download"
style="?android:attr/borderlessButtonStyle"
android:scaleType="fitCenter"
android:padding="10dp" />
android:paddingTop="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"/>

</RelativeLayout>
1 change: 1 addition & 0 deletions app/src/main/res/values/colors_oppia.xml
Expand Up @@ -6,6 +6,7 @@
<color name="list_divider">#222222</color>
<color name="list_divider_light">#cccccc</color>
<color name="text_dark">#222222</color>
<color name="text_grey">#666666</color>
<color name="text_light">#ffffff</color>
<color name="highlight_light">#74B042</color>
<color name="highlight_mid">#9aca3c</color>
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/values/styles.xml
Expand Up @@ -79,6 +79,12 @@
<item name="android:textColor">@color/text_dark</item>
</style>

<style name="SmallTextGrey">
<item name="android:textSize">11sp</item>
<item name="android:textStyle">normal</item>
<item name="android:textColor">@color/text_grey</item>
</style>

<style name="PointsText">
<item name="android:textSize">16sp</item>
<item name="android:textStyle">normal</item>
Expand Down

0 comments on commit 5014164

Please sign in to comment.