Fix PR review
Make all of the uploader section on stream page navigate to the channel page Extract hard coded strings Remove redundant spaces Fix open streams from a channel Rename "ParentChannel" to "SubChannel" Config royosef:NewPipeExtractor in app/build.gradle
This commit is contained in:
parent
2d0bc05488
commit
cc8874b687
11 changed files with 87 additions and 97 deletions
|
|
@ -172,10 +172,11 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
private TextView videoUploadDateView;
|
||||
private TextView videoDescriptionView;
|
||||
|
||||
private View uploaderRootLayout;
|
||||
private TextView uploaderTextView;
|
||||
private ImageView uploaderThumb;
|
||||
private TextView parentChannelTextView;
|
||||
private ImageView parentChannelThumb;
|
||||
private TextView subChannelTextView;
|
||||
private ImageView subChannelThumb;
|
||||
|
||||
private TextView thumbsUpTextView;
|
||||
private ImageView thumbsUpImageView;
|
||||
|
|
@ -419,25 +420,16 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
this.openDownloadDialog();
|
||||
}
|
||||
break;
|
||||
case R.id.detail_parent_channel_text_view:
|
||||
case R.id.detail_parent_channel_thumbnail_view:
|
||||
if (TextUtils.isEmpty(currentInfo.getParentChannelUrl())) {
|
||||
Log.w(TAG, "Can't open parent's channel because we got no channel URL");
|
||||
case R.id.detail_uploader_root_layout:
|
||||
if (TextUtils.isEmpty(currentInfo.getSubChannelUrl())) {
|
||||
Log.w(TAG, "Can't open sub-channel because we got no channel URL");
|
||||
|
||||
if (!TextUtils.isEmpty(currentInfo.getUploaderUrl())) {
|
||||
openChannel(currentInfo.getUploaderUrl(), currentInfo.getUploaderName());
|
||||
}
|
||||
} else {
|
||||
openChannel(currentInfo.getParentChannelUrl(),
|
||||
currentInfo.getParentChannelName());
|
||||
}
|
||||
break;
|
||||
case R.id.detail_uploader_text_view:
|
||||
case R.id.detail_uploader_thumbnail_view:
|
||||
if (TextUtils.isEmpty(currentInfo.getUploaderUrl())) {
|
||||
Log.w(TAG, "Can't open channel because we got no channel URL");
|
||||
} else {
|
||||
openChannel(currentInfo.getUploaderUrl(), currentInfo.getUploaderName());
|
||||
openChannel(currentInfo.getSubChannelUrl(),
|
||||
currentInfo.getSubChannelName());
|
||||
}
|
||||
break;
|
||||
case R.id.detail_thumbnail_root_layout:
|
||||
|
|
@ -454,13 +446,13 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
}
|
||||
}
|
||||
|
||||
private void openChannel(final String parentChannelUrl, final String parentChannelName) {
|
||||
private void openChannel(final String subChannelUrl, final String subChannelName) {
|
||||
try {
|
||||
NavigationHelper.openChannelFragment(
|
||||
getFragmentManager(),
|
||||
currentInfo.getServiceId(),
|
||||
parentChannelUrl,
|
||||
parentChannelName);
|
||||
subChannelUrl,
|
||||
subChannelName);
|
||||
} catch (Exception e) {
|
||||
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||
}
|
||||
|
|
@ -541,10 +533,11 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
thumbsDownImageView = rootView.findViewById(R.id.detail_thumbs_down_img_view);
|
||||
thumbsDisabledTextView = rootView.findViewById(R.id.detail_thumbs_disabled_view);
|
||||
|
||||
uploaderRootLayout = rootView.findViewById(R.id.detail_uploader_root_layout);
|
||||
uploaderTextView = rootView.findViewById(R.id.detail_uploader_text_view);
|
||||
uploaderThumb = rootView.findViewById(R.id.detail_uploader_thumbnail_view);
|
||||
parentChannelTextView = rootView.findViewById(R.id.detail_parent_channel_text_view);
|
||||
parentChannelThumb = rootView.findViewById(R.id.detail_parent_channel_thumbnail_view);
|
||||
subChannelTextView = rootView.findViewById(R.id.detail_sub_channel_text_view);
|
||||
subChannelThumb = rootView.findViewById(R.id.detail_sub_channel_thumbnail_view);
|
||||
|
||||
appBarLayout = rootView.findViewById(R.id.appbarlayout);
|
||||
viewPager = rootView.findViewById(R.id.viewpager);
|
||||
|
|
@ -574,11 +567,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
protected void initListeners() {
|
||||
super.initListeners();
|
||||
|
||||
uploaderTextView.setOnClickListener(this);
|
||||
uploaderThumb.setOnClickListener(this);
|
||||
parentChannelTextView.setOnClickListener(this);
|
||||
parentChannelThumb.setOnClickListener(this);
|
||||
|
||||
uploaderRootLayout.setOnClickListener(this);
|
||||
videoTitleRoot.setOnClickListener(this);
|
||||
thumbnailBackgroundButton.setOnClickListener(this);
|
||||
detailControlsBackground.setOnClickListener(this);
|
||||
|
|
@ -627,8 +616,8 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
ImageDisplayConstants.DISPLAY_THUMBNAIL_OPTIONS, onFailListener);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(info.getParentChannelAvatarUrl())) {
|
||||
IMAGE_LOADER.displayImage(info.getParentChannelAvatarUrl(), parentChannelThumb,
|
||||
if (!TextUtils.isEmpty(info.getSubChannelAvatarUrl())) {
|
||||
IMAGE_LOADER.displayImage(info.getSubChannelAvatarUrl(), subChannelThumb,
|
||||
ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
|
||||
}
|
||||
|
||||
|
|
@ -993,7 +982,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
@NonNull final StreamInfo info,
|
||||
@NonNull final Stream selectedStream) {
|
||||
NavigationHelper.playOnExternalPlayer(context, currentInfo.getName(),
|
||||
currentInfo.getParentChannelName(), selectedStream);
|
||||
currentInfo.getSubChannelName(), selectedStream);
|
||||
|
||||
final HistoryRecordManager recordManager = new HistoryRecordManager(requireContext());
|
||||
disposables.add(recordManager.onViewed(info).onErrorComplete()
|
||||
|
|
@ -1126,9 +1115,9 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
}
|
||||
|
||||
IMAGE_LOADER.cancelDisplayTask(thumbnailImageView);
|
||||
IMAGE_LOADER.cancelDisplayTask(parentChannelThumb);
|
||||
IMAGE_LOADER.cancelDisplayTask(subChannelThumb);
|
||||
thumbnailImageView.setImageBitmap(null);
|
||||
parentChannelThumb.setImageBitmap(null);
|
||||
subChannelThumb.setImageBitmap(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -1156,17 +1145,17 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
animateView(thumbnailPlayButton, true, 200);
|
||||
videoTitleTextView.setText(name);
|
||||
|
||||
if (!TextUtils.isEmpty(info.getParentChannelName())) {
|
||||
displayBothUploaderAndParentChannel(info);
|
||||
if (!TextUtils.isEmpty(info.getSubChannelName())) {
|
||||
displayBothUploaderAndSubChannel(info);
|
||||
} else if (!TextUtils.isEmpty(info.getUploaderName())) {
|
||||
displayUploaderAsParentChannel(info);
|
||||
displayUploaderAsSubChannel(info);
|
||||
} else {
|
||||
parentChannelThumb.setVisibility(View.GONE);
|
||||
subChannelThumb.setVisibility(View.GONE);
|
||||
uploaderTextView.setVisibility(View.GONE);
|
||||
uploaderThumb.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
parentChannelThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy));
|
||||
subChannelThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy));
|
||||
uploaderThumb.setImageDrawable(ContextCompat.getDrawable(activity, R.drawable.buddy));
|
||||
|
||||
if (info.getViewCount() >= 0) {
|
||||
|
|
@ -1297,21 +1286,22 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo>
|
|||
viewPager.setVisibility(View.GONE);
|
||||
tabLayout.setVisibility(View.GONE);
|
||||
}
|
||||
private void displayUploaderAsParentChannel(final StreamInfo info) {
|
||||
parentChannelTextView.setText(info.getUploaderName());
|
||||
parentChannelTextView.setVisibility(View.VISIBLE);
|
||||
parentChannelTextView.setSelected(true);
|
||||
parentChannelThumb.setVisibility(View.GONE);
|
||||
private void displayUploaderAsSubChannel(final StreamInfo info) {
|
||||
subChannelTextView.setText(info.getUploaderName());
|
||||
subChannelTextView.setVisibility(View.VISIBLE);
|
||||
subChannelTextView.setSelected(true);
|
||||
subChannelThumb.setVisibility(View.GONE);
|
||||
uploaderTextView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void displayBothUploaderAndParentChannel(final StreamInfo info) {
|
||||
parentChannelTextView.setText(info.getParentChannelName());
|
||||
parentChannelTextView.setVisibility(View.VISIBLE);
|
||||
parentChannelTextView.setSelected(true);
|
||||
private void displayBothUploaderAndSubChannel(final StreamInfo info) {
|
||||
subChannelTextView.setText(info.getSubChannelName());
|
||||
subChannelTextView.setVisibility(View.VISIBLE);
|
||||
subChannelTextView.setSelected(true);
|
||||
|
||||
if (!TextUtils.isEmpty(info.getUploaderName())) {
|
||||
uploaderTextView.setText("By " + info.getUploaderName());
|
||||
uploaderTextView.setText(
|
||||
String.format(getString(R.string.video_detail_by), info.getUploaderName()));
|
||||
uploaderTextView.setVisibility(View.VISIBLE);
|
||||
uploaderTextView.setSelected(true);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
|||
private ImageView headerChannelBanner;
|
||||
private ImageView headerAvatarView;
|
||||
private TextView headerTitleView;
|
||||
private ImageView headerParentChannelAvatarView;
|
||||
private TextView headerParentChannelTitleView;
|
||||
private ImageView headerSubChannelAvatarView;
|
||||
private TextView headerSubChannelTitleView;
|
||||
private TextView headerSubscribersTextView;
|
||||
private Button headerSubscribeButton;
|
||||
private View playlistCtrl;
|
||||
|
|
@ -161,10 +161,10 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
|||
headerSubscribersTextView = headerRootLayout.findViewById(R.id.channel_subscriber_view);
|
||||
headerSubscribeButton = headerRootLayout.findViewById(R.id.channel_subscribe_button);
|
||||
playlistCtrl = headerRootLayout.findViewById(R.id.playlist_control);
|
||||
headerParentChannelAvatarView =
|
||||
headerRootLayout.findViewById(R.id.parent_channel_avatar_view);
|
||||
headerParentChannelTitleView =
|
||||
headerRootLayout.findViewById(R.id.parent_channel_title_view);
|
||||
headerSubChannelAvatarView =
|
||||
headerRootLayout.findViewById(R.id.sub_channel_avatar_view);
|
||||
headerSubChannelTitleView =
|
||||
headerRootLayout.findViewById(R.id.sub_channel_title_view);
|
||||
|
||||
headerPlayAllButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_all_button);
|
||||
headerPopupButton = headerRootLayout.findViewById(R.id.playlist_ctrl_play_popup_button);
|
||||
|
|
@ -175,8 +175,10 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
|||
|
||||
@Override
|
||||
protected void initListeners() {
|
||||
headerParentChannelTitleView.setOnClickListener(this);
|
||||
headerParentChannelAvatarView.setOnClickListener(this);
|
||||
super.initListeners();
|
||||
|
||||
headerSubChannelTitleView.setOnClickListener(this);
|
||||
headerSubChannelAvatarView.setOnClickListener(this);
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -408,28 +410,28 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
|||
return ExtractorHelper.getChannelInfo(serviceId, url, forceLoad);
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
/*//////////////////////////////////////////////////////////////////////////
|
||||
// OnClick
|
||||
//////////////////////////////////////////////////////////////////////////*/
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
if (isLoading.get() || currentInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (v.getId()) {
|
||||
case R.id.parent_channel_avatar_view:
|
||||
case R.id.parent_channel_title_view:
|
||||
if (TextUtils.isEmpty(currentInfo.getParentChannelUrl())) {
|
||||
Log.w(TAG, "Can't open parent's channel because we got no channel URL");
|
||||
case R.id.sub_channel_avatar_view:
|
||||
case R.id.sub_channel_title_view:
|
||||
if (TextUtils.isEmpty(currentInfo.getSubChannelUrl())) {
|
||||
Log.w(TAG, "Can't open sub-channel because we got no channel URL");
|
||||
} else {
|
||||
try {
|
||||
NavigationHelper.openChannelFragment(
|
||||
getFragmentManager(),
|
||||
currentInfo.getServiceId(),
|
||||
currentInfo.getParentChannelUrl(),
|
||||
currentInfo.getParentChannelName());
|
||||
currentInfo.getSubChannelUrl(),
|
||||
currentInfo.getSubChannelName());
|
||||
} catch (Exception e) {
|
||||
ErrorActivity.reportUiError((AppCompatActivity) getActivity(), e);
|
||||
}
|
||||
|
|
@ -448,7 +450,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
|||
|
||||
IMAGE_LOADER.cancelDisplayTask(headerChannelBanner);
|
||||
IMAGE_LOADER.cancelDisplayTask(headerAvatarView);
|
||||
IMAGE_LOADER.cancelDisplayTask(headerParentChannelAvatarView);
|
||||
IMAGE_LOADER.cancelDisplayTask(headerSubChannelAvatarView);
|
||||
animateView(headerSubscribeButton, false, 100);
|
||||
}
|
||||
|
||||
|
|
@ -461,7 +463,7 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
|||
ImageDisplayConstants.DISPLAY_BANNER_OPTIONS);
|
||||
IMAGE_LOADER.displayImage(result.getAvatarUrl(), headerAvatarView,
|
||||
ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
|
||||
IMAGE_LOADER.displayImage(result.getParentChannelAvatarUrl(), headerParentChannelAvatarView,
|
||||
IMAGE_LOADER.displayImage(result.getSubChannelAvatarUrl(), headerSubChannelAvatarView,
|
||||
ImageDisplayConstants.DISPLAY_AVATAR_OPTIONS);
|
||||
|
||||
headerSubscribersTextView.setVisibility(View.VISIBLE);
|
||||
|
|
@ -472,13 +474,15 @@ public class ChannelFragment extends BaseListInfoFragment<ChannelInfo>
|
|||
headerSubscribersTextView.setText(R.string.subscribers_count_not_available);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(currentInfo.getParentChannelName())) {
|
||||
headerParentChannelTitleView.setText(
|
||||
"Created by " + currentInfo.getParentChannelName());
|
||||
headerParentChannelTitleView.setVisibility(View.VISIBLE);
|
||||
if (!TextUtils.isEmpty(currentInfo.getSubChannelName())) {
|
||||
headerSubChannelTitleView.setText(String.format(
|
||||
getString(R.string.channel_created_by),
|
||||
currentInfo.getSubChannelName())
|
||||
);
|
||||
headerSubChannelTitleView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
headerParentChannelTitleView.setVisibility(View.GONE);
|
||||
headerParentChannelAvatarView.setVisibility(View.GONE);
|
||||
headerSubChannelTitleView.setVisibility(View.GONE);
|
||||
headerSubChannelAvatarView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if (menuRssButton != null) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue