-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);