-Added icon for adding stream to playlist.

-Renamed HistoryPlaylistFragment to StatisticsPlaylistFragment.
This commit is contained in:
John Zhen Mo 2018-01-17 14:32:09 -08:00
parent 4ae81a2de4
commit 9bd26798b6
19 changed files with 40 additions and 10 deletions

View File

@ -58,6 +58,7 @@ import org.schabi.newpipe.extractor.stream.StreamInfoItem;
import org.schabi.newpipe.extractor.stream.VideoStream;
import org.schabi.newpipe.fragments.BackPressable;
import org.schabi.newpipe.fragments.BaseStateFragment;
import org.schabi.newpipe.fragments.local.PlaylistAppendDialog;
import org.schabi.newpipe.history.HistoryListener;
import org.schabi.newpipe.info_list.InfoItemBuilder;
import org.schabi.newpipe.info_list.InfoItemDialog;
@ -145,6 +146,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
private TextView detailControlsBackground;
private TextView detailControlsPopup;
private TextView detailControlsAddToPlaylist;
private TextView appendControlsDetail;
private LinearLayout videoDescriptionRootLayout;
@ -327,6 +329,11 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
case R.id.detail_controls_popup:
openPopupPlayer(false);
break;
case R.id.detail_controls_playlist_append:
if (getFragmentManager() != null && currentInfo != null) {
PlaylistAppendDialog.newInstance(currentInfo).show(getFragmentManager(), TAG);
}
break;
case R.id.detail_uploader_root_layout:
if (TextUtils.isEmpty(currentInfo.getUploaderUrl())) {
Log.w(TAG, "Can't open channel because we got no channel URL");
@ -429,6 +436,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
detailControlsBackground = rootView.findViewById(R.id.detail_controls_background);
detailControlsPopup = rootView.findViewById(R.id.detail_controls_popup);
detailControlsAddToPlaylist = rootView.findViewById(R.id.detail_controls_playlist_append);
appendControlsDetail = rootView.findViewById(R.id.touch_append_detail);
videoDescriptionRootLayout = rootView.findViewById(R.id.detail_description_root_layout);
@ -479,6 +487,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
thumbnailBackgroundButton.setOnClickListener(this);
detailControlsBackground.setOnClickListener(this);
detailControlsPopup.setOnClickListener(this);
detailControlsAddToPlaylist.setOnClickListener(this);
relatedStreamExpandButton.setOnClickListener(this);
detailControlsBackground.setLongClickable(true);

View File

@ -144,9 +144,8 @@ public class LocalPlaylistFragment extends BaseListFragment<List<StreamEntity>,
infoListAdapter.setOnStreamSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener<StreamInfoItem>() {
@Override
public void selected(StreamInfoItem selectedItem) {
if (getParentFragment() == null) return;
// Requires the parent fragment to find holder for fragment replacement
NavigationHelper.openVideoDetailFragment(getParentFragment().getFragmentManager(),
NavigationHelper.openVideoDetailFragment(getFragmentManager(),
selectedItem.getServiceId(), selectedItem.url, selectedItem.getName());
}

View File

@ -9,7 +9,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class MostPlayedFragment extends HistoryPlaylistFragment {
public class MostPlayedFragment extends StatisticsPlaylistFragment {
@Override
protected String getName() {
return getString(R.string.title_most_played);

View File

@ -35,7 +35,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers;
import static org.schabi.newpipe.util.AnimationUtils.animateView;
public abstract class HistoryPlaylistFragment
public abstract class StatisticsPlaylistFragment
extends BaseListFragment<List<StreamStatisticsEntry>, Void> {
private View headerRootLayout;
@ -130,9 +130,7 @@ public abstract class HistoryPlaylistFragment
infoListAdapter.setOnStreamSelectedListener(new InfoItemBuilder.OnInfoItemSelectedListener<StreamInfoItem>() {
@Override
public void selected(StreamInfoItem selectedItem) {
if (getParentFragment() == null) return;
// Requires the parent fragment to find holder for fragment replacement
NavigationHelper.openVideoDetailFragment(getParentFragment().getFragmentManager(),
NavigationHelper.openVideoDetailFragment(getFragmentManager(),
selectedItem.getServiceId(), selectedItem.url, selectedItem.getName());
}
@ -231,7 +229,7 @@ public abstract class HistoryPlaylistFragment
@Override
public void onError(Throwable exception) {
HistoryPlaylistFragment.this.onError(exception);
StatisticsPlaylistFragment.this.onError(exception);
}
@Override

View File

@ -11,7 +11,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class WatchHistoryFragment extends HistoryPlaylistFragment {
public class WatchHistoryFragment extends StatisticsPlaylistFragment {
@Override
protected String getName() {
return getString(R.string.title_watch_history);

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 B

View File

@ -273,7 +273,26 @@
android:paddingBottom="6dp"
android:paddingTop="6dp"
android:text="@string/controls_background_title"
android:textSize="12sp" />
android:textSize="12sp"/>
<TextView
android:id="@+id/detail_controls_playlist_append"
android:layout_width="60dp"
android:layout_height="55dp"
android:layout_alignParentTop="true"
android:layout_gravity="center_vertical"
android:layout_toLeftOf="@id/detail_controls_background"
android:layout_toStartOf="@id/detail_controls_background"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:contentDescription="@string/append_playlist"
android:drawableTop="?attr/playlist_add"
android:gravity="center"
android:paddingBottom="6dp"
android:paddingTop="6dp"
android:text="@string/controls_add_to_playlist_title"
android:textSize="12sp"/>
</RelativeLayout>
<!--UPLOADER-->

View File

@ -26,6 +26,7 @@
<attr name="play" format="reference"/>
<attr name="ic_hot" format="reference"/>
<attr name="ic_channel" format="reference"/>
<attr name="playlist_add" format="reference"/>
<!-- Can't refer to colors directly into drawable's xml-->
<attr name="toolbar_shadow_drawable" format="reference"/>

View File

@ -38,6 +38,7 @@
<string name="controls_background_title">Background</string>
<string name="controls_popup_title">Popup</string>
<string name="controls_add_to_playlist_title">Add To</string>
<string name="download_path_title">Video download path</string>
<string name="download_path_summary">Path to store downloaded videos in</string>
@ -375,4 +376,5 @@
<string name="create_playlist">Create New Playlist</string>
<string name="delete_playlist">Delete Playlist</string>
<string name="playlist_name_input">Name</string>
<string name="append_playlist">Add To Playlist</string>
</resources>

View File

@ -41,6 +41,7 @@
<item name="play">@drawable/ic_play_arrow_black_24dp</item>
<item name="ic_hot">@drawable/ic_whatshot_black_24dp</item>
<item name="ic_channel">@drawable/ic_channel_black_24dp</item>
<item name="playlist_add">@drawable/ic_playlist_add_black_24dp</item>
<item name="separator_color">@color/light_separator_color</item>
<item name="contrast_background_color">@color/light_contrast_background_color</item>
@ -88,6 +89,7 @@
<item name="play">@drawable/ic_play_arrow_white_24dp</item>
<item name="ic_hot">@drawable/ic_whatshot_white_24dp</item>
<item name="ic_channel">@drawable/ic_channel_white_24dp</item>
<item name="playlist_add">@drawable/ic_playlist_add_white_24dp</item>
<item name="separator_color">@color/dark_separator_color</item>
<item name="contrast_background_color">@color/dark_contrast_background_color</item>