Option to hide fully watched videos from History page #13260
This commit is contained in:
parent
52a9b60180
commit
3e7cd92bae
@ -57,6 +57,7 @@ public class StatisticsPlaylistFragment
|
||||
@State
|
||||
Parcelable itemsListState;
|
||||
private StatisticSortMode sortMode = StatisticSortMode.LAST_PLAYED;
|
||||
private boolean includeFullyWatched = true;
|
||||
|
||||
private StatisticPlaylistControlBinding headerBinding;
|
||||
private PlaylistControlBinding playlistControlBinding;
|
||||
@ -78,6 +79,14 @@ public class StatisticsPlaylistFragment
|
||||
return null;
|
||||
}
|
||||
Collections.sort(results, comparator.reversed());
|
||||
|
||||
// Filter Fully Watched
|
||||
if (!includeFullyWatched) {
|
||||
return results.stream()
|
||||
.filter(e -> e.getStreamEntity().getDuration() != e.getProgressMillis() / 1000)
|
||||
.toList();
|
||||
}
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
@ -277,6 +286,8 @@ public class StatisticsPlaylistFragment
|
||||
PlayButtonHelper.initPlaylistControlClickListener(activity, playlistControlBinding, this);
|
||||
|
||||
headerBinding.sortButton.setOnClickListener(view -> toggleSortMode());
|
||||
headerBinding.fullyWatchedFilterButtonCheckBox
|
||||
.setOnClickListener(view -> toggleIncludeFullyWatched());
|
||||
|
||||
hideLoading();
|
||||
}
|
||||
@ -313,6 +324,11 @@ public class StatisticsPlaylistFragment
|
||||
startLoading(true);
|
||||
}
|
||||
|
||||
private void toggleIncludeFullyWatched() {
|
||||
includeFullyWatched = !includeFullyWatched;
|
||||
startLoading(true);
|
||||
}
|
||||
|
||||
private PlayQueue getPlayQueueStartingAt(final StreamStatisticsEntry infoItem) {
|
||||
return getPlayQueue(Math.max(itemListAdapter.getItemsList().indexOf(infoItem), 0));
|
||||
}
|
||||
|
||||
@ -5,37 +5,73 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/sortButton"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/sortButtonIcon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginRight="12dp"
|
||||
android:src="@drawable/ic_filter_list"
|
||||
tools:ignore="ContentDescription,RtlHardcoded" />
|
||||
<RelativeLayout
|
||||
android:id="@+id/sortButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<org.schabi.newpipe.views.NewPipeTextView
|
||||
android:id="@+id/sortButtonText"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="50dp"
|
||||
android:layout_toRightOf="@id/sortButtonIcon"
|
||||
android:gravity="left|center"
|
||||
android:text="@string/title_most_played"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold"
|
||||
tools:ignore="RtlHardcoded" />
|
||||
</RelativeLayout>
|
||||
<ImageView
|
||||
android:id="@+id/sortButtonIcon"
|
||||
android:layout_width="48dp"
|
||||
android:layout_height="28dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:src="@drawable/ic_filter_list"
|
||||
tools:ignore="ContentDescription" />
|
||||
|
||||
<org.schabi.newpipe.views.NewPipeTextView
|
||||
android:id="@+id/sortButtonText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_toEndOf="@id/sortButtonIcon"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="@string/title_most_played"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/fullyWatchedFilterButton"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:clickable="true"
|
||||
android:focusable="true">
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/fullyWatchedFilterButtonCheckBox"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginStart="12dp"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:checked="true"/>
|
||||
|
||||
<org.schabi.newpipe.views.NewPipeTextView
|
||||
android:id="@+id/fullyWatchedFilterButtonText"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_toEndOf="@id/fullyWatchedFilterButtonCheckBox"
|
||||
android:gravity="start|center_vertical"
|
||||
android:text="@string/title_fully_watched"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<include
|
||||
android:id="@+id/playlist_control"
|
||||
|
||||
@ -882,4 +882,5 @@
|
||||
<string name="youtube_player_http_403">HTTP error 403 received from server while playing, likely caused by an IP ban or streaming URL deobfuscation issues</string>
|
||||
<string name="sign_in_confirm_not_bot_error">%1$s refused to provide data, asking for a login to confirm the requester is not a bot.\n\nYour IP might have been temporarily banned by %1$s, you can wait some time or switch to a different IP (for example by turning on/off a VPN, or by switching from WiFi to mobile data).</string>
|
||||
<string name="unsupported_content_in_country">This content is not available for the currently selected content country.\n\nChange your selection from \"Settings > Content > Default content country\".</string>
|
||||
<string name="title_fully_watched">Fully Watched</string>
|
||||
</resources>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user