diff --git a/BrowsePresenter_from_master.java b/BrowsePresenter_from_master.java new file mode 100644 index 0000000000..3ba6d0ec46 Binary files /dev/null and b/BrowsePresenter_from_master.java differ diff --git a/VideoMenuPresenter_from_master.java b/VideoMenuPresenter_from_master.java new file mode 100644 index 0000000000..746e93e313 Binary files /dev/null and b/VideoMenuPresenter_from_master.java differ diff --git a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java index 102c09d635..10218f5dc9 100644 --- a/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java +++ b/common/src/main/java/com/liskovsoft/smartyoutubetv2/common/app/models/data/Video.java @@ -29,7 +29,8 @@ import java.util.List; /** - * Video is an object that holds the various metadata associated with a single video. + * Video is an object that holds the various metadata associated with a single + * video. */ public final class Video { public static final String PLAYLIST_LIKED_MUSIC = "LM"; @@ -102,7 +103,7 @@ public final class Video { public List notificationStates; public Video() { - // NOP + // NOP } private Video( @@ -223,19 +224,20 @@ public static Video from(Item channel) { video.channelId = channel.getChannelId(); return video; } - ///** + /// ** // * Don't change the logic from equality by reference!
// * Or adapters won't work properly (same video may appear twice). // */ - //@Override - //public boolean equals(@Nullable Object obj) { - // return super.equals(obj); - //} + // @Override + // public boolean equals(@Nullable Object obj) { + // return super.equals(obj); + // } /** * Use with caution.
* Old logic is equality by reference!
- * Adapters may not work properly when detecting scroll position (same video may appear twice). + * Adapters may not work properly when detecting scroll position (same video may + * appear twice). */ @Override public boolean equals(@Nullable Object obj) { @@ -249,22 +251,25 @@ public boolean equals(@Nullable Object obj) { } /** - * NOTE: hashCode is used generate id that should be the same if contents of items is the same + * NOTE: hashCode is used generate id that should be the same if contents of + * items is the same */ @Override public int hashCode() { // NOTE: With full hash code won't jump to last known position - int hashCode = Helpers.hashCodeAny(videoId, playlistId, reloadPageKey, playlistParams, channelId, sectionId, channelGroupId, mediaItem); + int hashCode = Helpers.hashCodeAny(videoId, playlistId, reloadPageKey, playlistParams, channelId, sectionId, + channelGroupId, mediaItem); return hashCode != -1 ? hashCode : super.hashCode(); } public static void printDebugInfo(Context context, Video item) { MessageHelpers.showLongMessage(context, - String.format("videoId=%s, playlistId=%s, reloadPageKey=%s, playlistParams=%s, channelId=%s, mediaItem=%s, extra=%s", - item.videoId, item.playlistId, item.reloadPageKey, item.playlistParams, item.channelId, item.mediaItem, item.sectionId) - ); + String.format( + "videoId=%s, playlistId=%s, reloadPageKey=%s, playlistParams=%s, channelId=%s, mediaItem=%s, extra=%s", + item.videoId, item.playlistId, item.reloadPageKey, item.playlistParams, item.channelId, + item.mediaItem, item.sectionId)); } - + public static boolean equals(Video video1, Video video2) { if (video1 == null) { return false; @@ -317,7 +322,8 @@ public String getAuthor() { String mainTitle = metadataTitle != null ? metadataTitle : title; CharSequence subtitle = metadataSecondTitle != null ? metadataSecondTitle : secondTitle; - return hasVideo() ? extractAuthor(subtitle) : Helpers.toString(YouTubeHelper.createInfo(mainTitle, subtitle)); // BAD idea + return hasVideo() ? extractAuthor(subtitle) : Helpers.toString(YouTubeHelper.createInfo(mainTitle, subtitle)); // BAD + // idea } public VideoGroup getGroup() { @@ -347,13 +353,16 @@ private static String extractAuthor(String secondTitle) { result = secondTitle; } else { // First part may be a special label (4K, Stream, New etc) - // Two cases to detect label: 1) Description is long (4 items); 2) First item of info is too short (2 letters) + // Two cases to detect label: 1) Description is long (4 items); 2) First item of + // info is too short (2 letters) result = split.length < 4 && split[0].trim().length() > 2 ? split[0] : split[1]; } } // Skip subtitles starting with number of views (e.g. 1.4M views) - return !TextUtils.isEmpty(result) && !Helpers.isNumeric(result.substring(0, 1)) ? Helpers.abbreviate(result.trim(), MAX_AUTHOR_LENGTH_CHARS) : null; + return !TextUtils.isEmpty(result) && !Helpers.isNumeric(result.substring(0, 1)) + ? Helpers.abbreviate(result.trim(), MAX_AUTHOR_LENGTH_CHARS) + : null; } public static List