Skip to content

Commit 276bf39

Browse files
authored
Merge pull request #12117 from malania02/dev
Show download date of downloaded videos
2 parents 756327d + f39eda0 commit 276bf39

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@
7171
import java.util.ArrayList;
7272
import java.util.Arrays;
7373
import java.util.Iterator;
74+
import java.util.Date;
75+
import java.util.Locale;
76+
import java.text.DateFormat;
7477

7578
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
7679
import io.reactivex.rxjava3.core.Observable;
@@ -208,11 +211,17 @@ public void onBindViewHolder(@NonNull ViewHolder view, @SuppressLint("RecyclerVi
208211
h.pause.setTitle(mission.unknownLength ? R.string.stop : R.string.pause);
209212
updateProgress(h);
210213
mPendingDownloadsItems.add(h);
214+
215+
h.date.setText("");
211216
} else {
212217
h.progress.setMarquee(false);
213218
h.status.setText("100%");
214219
h.progress.setProgress(1.0f);
215220
h.size.setText(Utility.formatBytes(item.mission.length));
221+
222+
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault());
223+
Date date = new Date(item.mission.timestamp);
224+
h.date.setText(dateFormat.format(date));
216225
}
217226
}
218227

@@ -832,6 +841,7 @@ class ViewHolderItem extends RecyclerView.ViewHolder {
832841
ImageView icon;
833842
TextView name;
834843
TextView size;
844+
TextView date;
835845
ProgressDrawable progress;
836846

837847
PopupMenu popupMenu;
@@ -862,6 +872,7 @@ class ViewHolderItem extends RecyclerView.ViewHolder {
862872
name = itemView.findViewById(R.id.item_name);
863873
icon = itemView.findViewById(R.id.item_icon);
864874
size = itemView.findViewById(R.id.item_size);
875+
date = itemView.findViewById(R.id.item_date);
865876

866877
name.setSelected(true);
867878

app/src/main/res/layout/mission_item.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@
8282
android:textColor="@color/white"
8383
android:textSize="12sp" />
8484

85+
<org.schabi.newpipe.views.NewPipeTextView
86+
android:id="@+id/item_date"
87+
android:layout_width="wrap_content"
88+
android:layout_height="wrap_content"
89+
android:layout_below="@id/item_name"
90+
android:layout_alignParentRight="true"
91+
android:padding="6dp"
92+
android:singleLine="true"
93+
android:text=""
94+
android:textColor="@color/white"
95+
android:textSize="12sp" />
96+
8597
</RelativeLayout>
8698

8799
</RelativeLayout>

app/src/main/res/layout/mission_item_linear.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@
6262
android:textSize="12sp"
6363
android:textStyle="bold" />
6464

65+
<org.schabi.newpipe.views.NewPipeTextView
66+
android:id="@+id/item_date"
67+
android:layout_width="wrap_content"
68+
android:layout_height="wrap_content"
69+
android:layout_below="@id/item_name"
70+
android:layout_toLeftOf="@id/item_more"
71+
android:padding="6dp"
72+
android:singleLine="true"
73+
android:text=""
74+
android:textColor="@color/white"
75+
android:textSize="12sp" />
76+
6577
<ImageView
6678
android:id="@+id/item_more"
6779
style="?attr/buttonBarButtonStyle"

0 commit comments

Comments
 (0)