Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions app/src/main/java/us/shandian/giga/ui/adapter/MissionAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Date;
import java.util.Locale;
import java.text.DateFormat;

import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers;
import io.reactivex.rxjava3.core.Observable;
Expand Down Expand Up @@ -208,11 +211,17 @@ public void onBindViewHolder(@NonNull ViewHolder view, @SuppressLint("RecyclerVi
h.pause.setTitle(mission.unknownLength ? R.string.stop : R.string.pause);
updateProgress(h);
mPendingDownloadsItems.add(h);

h.date.setText("");
} else {
h.progress.setMarquee(false);
h.status.setText("100%");
h.progress.setProgress(1.0f);
h.size.setText(Utility.formatBytes(item.mission.length));

DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.getDefault());
Date date = new Date(item.mission.timestamp);
h.date.setText(dateFormat.format(date));
}
}

Expand Down Expand Up @@ -832,6 +841,7 @@ class ViewHolderItem extends RecyclerView.ViewHolder {
ImageView icon;
TextView name;
TextView size;
TextView date;
ProgressDrawable progress;

PopupMenu popupMenu;
Expand Down Expand Up @@ -862,6 +872,7 @@ class ViewHolderItem extends RecyclerView.ViewHolder {
name = itemView.findViewById(R.id.item_name);
icon = itemView.findViewById(R.id.item_icon);
size = itemView.findViewById(R.id.item_size);
date = itemView.findViewById(R.id.item_date);

name.setSelected(true);

Expand Down
12 changes: 12 additions & 0 deletions app/src/main/res/layout/mission_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,18 @@
android:textColor="@color/white"
android:textSize="12sp" />

<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/item_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/item_name"
android:layout_alignParentRight="true"
android:padding="6dp"
android:singleLine="true"
android:text=""
android:textColor="@color/white"
android:textSize="12sp" />

</RelativeLayout>

</RelativeLayout>
12 changes: 12 additions & 0 deletions app/src/main/res/layout/mission_item_linear.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@
android:textSize="12sp"
android:textStyle="bold" />

<org.schabi.newpipe.views.NewPipeTextView
android:id="@+id/item_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/item_name"
android:layout_toLeftOf="@id/item_more"
android:padding="6dp"
android:singleLine="true"
android:text=""
android:textColor="@color/white"
android:textSize="12sp" />

<ImageView
android:id="@+id/item_more"
style="?attr/buttonBarButtonStyle"
Expand Down