You've already forked revanced-integrations
mirror of
https://github.com/revanced/revanced-integrations
synced 2025-11-19 03:23:27 +01:00
Compare commits
47 Commits
v0.94.0-de
...
v0.96.2-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a436153f3e | ||
|
|
39ac47cb8f | ||
|
|
5071082fde | ||
|
|
71b558ba6a | ||
|
|
9cea77ac59 | ||
|
|
b47b7cbc22 | ||
|
|
25d51179cc | ||
|
|
2e0758b3c8 | ||
|
|
cfb7aab779 | ||
|
|
0def31b2dd | ||
|
|
7225bc3c48 | ||
|
|
7d136e550c | ||
|
|
70170e24ce | ||
|
|
1864372298 | ||
|
|
1dd84a3785 | ||
|
|
512d747ec8 | ||
|
|
e16d3a7284 | ||
|
|
4469d1f3c4 | ||
|
|
43e419e6a6 | ||
|
|
f67216ad9d | ||
|
|
2e9d3fc63f | ||
|
|
d16153408c | ||
|
|
73d5400486 | ||
|
|
e698e8c524 | ||
|
|
d5bcef2cdb | ||
|
|
5ca042a602 | ||
|
|
319a234df6 | ||
|
|
293eae4a46 | ||
|
|
dc1faa94e0 | ||
|
|
2e6c73e4b5 | ||
|
|
f50346aff2 | ||
|
|
530260e248 | ||
|
|
db2e5eec71 | ||
|
|
27d1392a73 | ||
|
|
49aedae3fc | ||
|
|
5c5a42da40 | ||
|
|
bb8cdc494f | ||
|
|
42346ee3cf | ||
|
|
dbf1f3f0ce | ||
|
|
a70e80dfa0 | ||
|
|
7551f0104c | ||
|
|
d8bd27251c | ||
|
|
04147c17c9 | ||
|
|
84257a7348 | ||
|
|
32dc8a846c | ||
|
|
03764bcc65 | ||
|
|
6679e6ee45 |
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@@ -3,7 +3,7 @@ name: Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
pull_request:
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Cancel previou runs
|
||||
- name: Cancel previous runs
|
||||
uses: styfle/cancel-workflow-action@0.11.0
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
@@ -33,11 +33,11 @@ jobs:
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: "latest"
|
||||
node-version: "18"
|
||||
cache: 'npm'
|
||||
- name: Setup semantic-release
|
||||
run: npm install semantic-release@19.0.5 @saithodev/semantic-release-backmerge @semantic-release/git @semantic-release/changelog gradle-semantic-release-plugin@1.7.4 -D
|
||||
run: npm install
|
||||
- name: Release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||
run: npx semantic-release
|
||||
run: npm exec semantic-release
|
||||
|
||||
134
CHANGELOG.md
134
CHANGELOG.md
@@ -1,3 +1,137 @@
|
||||
## [0.96.2-dev.3](https://github.com/revanced/revanced-integrations/compare/v0.96.2-dev.2...v0.96.2-dev.3) (2023-02-14)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/general-ads:** block other kind of survey ([39ac47c](https://github.com/revanced/revanced-integrations/commit/39ac47cb8fccb1003a5cbba951fa77d25b0a2a96))
|
||||
|
||||
## [0.96.2-dev.2](https://github.com/revanced/revanced-integrations/compare/v0.96.2-dev.1...v0.96.2-dev.2) (2023-02-13)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/general-ads:** do not hide chapters when hiding preview comments ([cfb7aab](https://github.com/revanced/revanced-integrations/commit/cfb7aab77991e8a123fb6956e699df8ad53bf59d))
|
||||
|
||||
## [0.96.2-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.96.1...v0.96.2-dev.1) (2023-02-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/general-ads:** use correct setting for `BlockRule` ([#316](https://github.com/revanced/revanced-integrations/issues/316)) ([7225bc3](https://github.com/revanced/revanced-integrations/commit/7225bc3c48b2d8f94d21b5481e37d78a26f49544))
|
||||
|
||||
## [0.96.1](https://github.com/revanced/revanced-integrations/compare/v0.96.0...v0.96.1) (2023-02-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/minimized-playback:** disable when playing shorts ([1dd84a3](https://github.com/revanced/revanced-integrations/commit/1dd84a37851359143140d1d1df664c3eab680fa7))
|
||||
|
||||
## [0.96.1-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.96.0...v0.96.1-dev.1) (2023-02-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/minimized-playback:** disable when playing shorts ([1dd84a3](https://github.com/revanced/revanced-integrations/commit/1dd84a37851359143140d1d1df664c3eab680fa7))
|
||||
|
||||
# [0.96.0](https://github.com/revanced/revanced-integrations/compare/v0.95.0...v0.96.0) (2023-02-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/general-ads:** hide pill to view products ([43e419e](https://github.com/revanced/revanced-integrations/commit/43e419e6a6b7e6da372b5ec970a70ae86702b706))
|
||||
|
||||
# [0.96.0-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.95.0...v0.96.0-dev.1) (2023-02-10)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/general-ads:** hide pill to view products ([43e419e](https://github.com/revanced/revanced-integrations/commit/43e419e6a6b7e6da372b5ec970a70ae86702b706))
|
||||
|
||||
# [0.95.0](https://github.com/revanced/revanced-integrations/compare/v0.94.1...v0.95.0) (2023-02-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `spoof-wifi-connection` patch ([#297](https://github.com/revanced/revanced-integrations/issues/297)) ([293eae4](https://github.com/revanced/revanced-integrations/commit/293eae4a46ee8acf3484ac271a1ccf194853d42e))
|
||||
* spoof-wifi-connection patch ([6679e6e](https://github.com/revanced/revanced-integrations/commit/6679e6ee45385c8a3cf559f685dae7e6cf1f0c1f))
|
||||
* **youtube:** `hide-player-buttons` patch ([d5bcef2](https://github.com/revanced/revanced-integrations/commit/d5bcef2cdbe5dfdb1ad2552e7fde339cee1a3f27))
|
||||
|
||||
# [0.95.0-dev.2](https://github.com/revanced/revanced-integrations/compare/v0.95.0-dev.1...v0.95.0-dev.2) (2023-02-03)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube:** `hide-player-buttons` patch ([d5bcef2](https://github.com/revanced/revanced-integrations/commit/d5bcef2cdbe5dfdb1ad2552e7fde339cee1a3f27))
|
||||
|
||||
# [0.95.0-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.94.1...v0.95.0-dev.1) (2023-02-01)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* `spoof-wifi-connection` patch ([#297](https://github.com/revanced/revanced-integrations/issues/297)) ([293eae4](https://github.com/revanced/revanced-integrations/commit/293eae4a46ee8acf3484ac271a1ccf194853d42e))
|
||||
* spoof-wifi-connection patch ([6679e6e](https://github.com/revanced/revanced-integrations/commit/6679e6ee45385c8a3cf559f685dae7e6cf1f0c1f))
|
||||
|
||||
## [0.94.1](https://github.com/revanced/revanced-integrations/compare/v0.94.0...v0.94.1) (2023-01-29)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/sponsorblock:** fix saving and loading settings ([#304](https://github.com/revanced/revanced-integrations/issues/304)) ([49aedae](https://github.com/revanced/revanced-integrations/commit/49aedae3fcbb4ec1cfe6b9291c95ccac6935d1d0))
|
||||
* **youtube:** resolve duplicate preference keys ([#307](https://github.com/revanced/revanced-integrations/issues/307)) ([27d1392](https://github.com/revanced/revanced-integrations/commit/27d1392a73ba634e4d05c0c22849bb933a8f04b3))
|
||||
|
||||
## [0.94.1-dev.1](https://github.com/revanced/revanced-integrations/compare/v0.94.0...v0.94.1-dev.1) (2023-01-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/sponsorblock:** fix saving and loading settings ([#304](https://github.com/revanced/revanced-integrations/issues/304)) ([49aedae](https://github.com/revanced/revanced-integrations/commit/49aedae3fcbb4ec1cfe6b9291c95ccac6935d1d0))
|
||||
* **youtube:** resolve duplicate preference keys ([#307](https://github.com/revanced/revanced-integrations/issues/307)) ([27d1392](https://github.com/revanced/revanced-integrations/commit/27d1392a73ba634e4d05c0c22849bb933a8f04b3))
|
||||
|
||||
# [0.94.0](https://github.com/revanced/revanced-integrations/compare/v0.93.1...v0.94.0) (2023-01-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/return-youtube-dislike:** do not fetch voting stats when watching shorts ([#302](https://github.com/revanced/revanced-integrations/issues/302)) ([7551f01](https://github.com/revanced/revanced-integrations/commit/7551f0104c463714749acc6abedbea5cd7afb52f))
|
||||
* **youtube/return-youtube-dislike:** gracefully exit if Vanced MicroG is missing or not running ([#303](https://github.com/revanced/revanced-integrations/issues/303)) ([03764bc](https://github.com/revanced/revanced-integrations/commit/03764bcc651c6b723a999a58ed9cc9d253075905))
|
||||
* **youtube:** save new instead of default value ([#298](https://github.com/revanced/revanced-integrations/issues/298)) ([559bbf9](https://github.com/revanced/revanced-integrations/commit/559bbf9778f20ac0f5ce3af677230a1ec28a55ff))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/general-ads:** remove hiding video shelf ([04147c1](https://github.com/revanced/revanced-integrations/commit/04147c17c98bccea27e0293a71ffccc97f5a155d))
|
||||
* **youtube/microg-support:** check if Vanced MicroG is running in the background ([#301](https://github.com/revanced/revanced-integrations/issues/301)) ([6e31b78](https://github.com/revanced/revanced-integrations/commit/6e31b7889a2488b3d61042111437a6ed4eec019c))
|
||||
* **youtube:** `open-links-externally` patch ([4cbe833](https://github.com/revanced/revanced-integrations/commit/4cbe8338b3f4ab49139168d7a3d0c9ebebf68952))
|
||||
* **youtube:** show toasts along exceptions ([#293](https://github.com/revanced/revanced-integrations/issues/293)) ([dbf1f3f](https://github.com/revanced/revanced-integrations/commit/dbf1f3f0ce0500752e5d6c4ce49d7d2b27cc6dc4))
|
||||
|
||||
# [0.94.0-dev.6](https://github.com/revanced/revanced-integrations/compare/v0.94.0-dev.5...v0.94.0-dev.6) (2023-01-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube:** show toasts along exceptions ([#293](https://github.com/revanced/revanced-integrations/issues/293)) ([dbf1f3f](https://github.com/revanced/revanced-integrations/commit/dbf1f3f0ce0500752e5d6c4ce49d7d2b27cc6dc4))
|
||||
|
||||
# [0.94.0-dev.5](https://github.com/revanced/revanced-integrations/compare/v0.94.0-dev.4...v0.94.0-dev.5) (2023-01-28)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/return-youtube-dislike:** do not fetch voting stats when watching shorts ([#302](https://github.com/revanced/revanced-integrations/issues/302)) ([7551f01](https://github.com/revanced/revanced-integrations/commit/7551f0104c463714749acc6abedbea5cd7afb52f))
|
||||
|
||||
# [0.94.0-dev.4](https://github.com/revanced/revanced-integrations/compare/v0.94.0-dev.3...v0.94.0-dev.4) (2023-01-28)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **youtube/general-ads:** remove hiding video shelf ([04147c1](https://github.com/revanced/revanced-integrations/commit/04147c17c98bccea27e0293a71ffccc97f5a155d))
|
||||
|
||||
# [0.94.0-dev.3](https://github.com/revanced/revanced-integrations/compare/v0.94.0-dev.2...v0.94.0-dev.3) (2023-01-22)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **youtube/return-youtube-dislike:** gracefully exit if Vanced MicroG is missing or not running ([#303](https://github.com/revanced/revanced-integrations/issues/303)) ([03764bc](https://github.com/revanced/revanced-integrations/commit/03764bcc651c6b723a999a58ed9cc9d253075905))
|
||||
|
||||
# [0.94.0-dev.2](https://github.com/revanced/revanced-integrations/compare/v0.94.0-dev.1...v0.94.0-dev.2) (2023-01-22)
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@ final class CommentsPatch extends Filter {
|
||||
var comments = new BlockRule(SettingsEnum.HIDE_COMMENTS_SECTION, "video_metadata_carousel", "_comments");
|
||||
var previewComment = new BlockRule(
|
||||
SettingsEnum.HIDE_PREVIEW_COMMENT,
|
||||
"carousel_item",
|
||||
"|carousel_item",
|
||||
"comments_entry_point_teaser",
|
||||
"comments_entry_point_simplebox"
|
||||
);
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
public final class FixPlaybackPatch {
|
||||
private static Thread currentThread = null;
|
||||
private static String videoId;
|
||||
|
||||
public static void newVideoLoaded(final String videoId) {
|
||||
if (!SettingsEnum.FIX_PLAYBACK.getBoolean()) return;
|
||||
|
||||
if (videoId.equals(FixPlaybackPatch.videoId)) return;
|
||||
else FixPlaybackPatch.videoId = videoId;
|
||||
|
||||
if (currentThread != null) {
|
||||
currentThread.interrupt();
|
||||
}
|
||||
|
||||
currentThread = new Thread(() -> {
|
||||
try {
|
||||
while (true) {
|
||||
var currentVideoTime = VideoInformation.getVideoTime();
|
||||
|
||||
if (currentVideoTime > -1) {
|
||||
VideoInformation.seekTo(Integer.MAX_VALUE);
|
||||
VideoInformation.seekTo(currentVideoTime);
|
||||
return;
|
||||
}
|
||||
|
||||
Thread.sleep(10);
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
LogHelper.printDebug(() -> "Thread was interrupted");
|
||||
}
|
||||
});
|
||||
|
||||
currentThread.start();
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import app.revanced.integrations.adremover.AdRemoverAPI;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
@@ -27,17 +26,17 @@ public final class GeneralAdsPatch extends Filter {
|
||||
var subscribersCommunityGuidelines = new BlockRule(SettingsEnum.ADREMOVER_SUBSCRIBERS_COMMUNITY_GUIDELINES_REMOVAL, "sponsorships_comments_upsell");
|
||||
var channelMemberShelf = new BlockRule(SettingsEnum.ADREMOVER_CHANNEL_MEMBER_SHELF_REMOVAL, "member_recognition_shelf");
|
||||
var compactBanner = new BlockRule(SettingsEnum.ADREMOVER_COMPACT_BANNER_REMOVAL, "compact_banner");
|
||||
var inFeedSurvey = new BlockRule(SettingsEnum.ADREMOVER_FEED_SURVEY_REMOVAL, "in_feed_survey");
|
||||
var inFeedSurvey = new BlockRule(SettingsEnum.ADREMOVER_FEED_SURVEY_REMOVAL, "in_feed_survey", "slimline_survey");
|
||||
var medicalPanel = new BlockRule(SettingsEnum.ADREMOVER_MEDICAL_PANEL_REMOVAL, "medical_panel");
|
||||
var paidContent = new BlockRule(SettingsEnum.ADREMOVER_PAID_CONTENT_REMOVAL, "paid_content_overlay");
|
||||
var merchandise = new BlockRule(SettingsEnum.ADREMOVER_MERCHANDISE_REMOVAL, "product_carousel");
|
||||
var infoPanel = new BlockRule(SettingsEnum.ADREMOVER_INFO_PANEL_REMOVAL, "publisher_transparency_panel", "single_item_information_panel");
|
||||
var suggestions = new BlockRule(SettingsEnum.ADREMOVER_SUGGESTIONS_REMOVAL, "horizontal_video_shelf");
|
||||
var latestPosts = new BlockRule(SettingsEnum.ADREMOVER_HIDE_LATEST_POSTS, "post_shelf");
|
||||
var channelGuidelines = new BlockRule(SettingsEnum.ADREMOVER_HIDE_CHANNEL_GUIDELINES, "channel_guidelines_entry_banner");
|
||||
var artistCard = new BlockRule(SettingsEnum.HIDE_ARTIST_CARD, "official_card");
|
||||
var selfSponsor = new BlockRule(SettingsEnum.ADREMOVER_SELF_SPONSOR_REMOVAL, "cta_shelf_card");
|
||||
var chapterTeaser = new BlockRule(SettingsEnum.ADREMOVER_CHAPTER_TEASER_REMOVAL, "expandable_metadata");
|
||||
var viewProducts = new BlockRule(SettingsEnum.ADREMOVER_VIEW_PRODUCTS, "product_item", "products_in_video");
|
||||
var graySeparator = new BlockRule(SettingsEnum.ADREMOVER_GRAY_SEPARATOR,
|
||||
"cell_divider" // layout residue (gray line above the buttoned ad),
|
||||
);
|
||||
@@ -69,13 +68,13 @@ public final class GeneralAdsPatch extends Filter {
|
||||
buttonedAd,
|
||||
communityPosts,
|
||||
paidContent,
|
||||
suggestions,
|
||||
latestPosts,
|
||||
movieAds,
|
||||
chapterTeaser,
|
||||
communityGuidelines,
|
||||
compactBanner,
|
||||
inFeedSurvey,
|
||||
viewProducts,
|
||||
medicalPanel,
|
||||
merchandise,
|
||||
infoPanel,
|
||||
@@ -115,7 +114,7 @@ public final class GeneralAdsPatch extends Filter {
|
||||
else
|
||||
result = BlockResult.UNBLOCKED;
|
||||
|
||||
log(String.format("%s (ID: %s): %s", result.message, identifier, path));
|
||||
LogHelper.printDebug(() -> String.format("%s (ID: %s): %s", result.message, identifier, path));
|
||||
|
||||
return result.filter;
|
||||
}
|
||||
@@ -144,7 +143,7 @@ public final class GeneralAdsPatch extends Filter {
|
||||
private static void hideView(SettingsEnum condition, View view) {
|
||||
if (!condition.getBoolean()) return;
|
||||
|
||||
log("Hiding view with setting: " + condition);
|
||||
LogHelper.printDebug(() -> "Hiding view with setting: " + condition);
|
||||
|
||||
AdRemoverAPI.HideViewWithLayout1dp(view);
|
||||
}
|
||||
@@ -167,7 +166,4 @@ public final class GeneralAdsPatch extends Filter {
|
||||
hideView(SettingsEnum.ADREMOVER_SHORTS_REMOVAL, view);
|
||||
}
|
||||
|
||||
private static void log(String message) {
|
||||
LogHelper.printDebug(() -> message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,8 +10,7 @@ public class HideCreateButtonPatch {
|
||||
//Used by app.revanced.patches.youtube.layout.createbutton.patch.CreateButtonRemoverPatch
|
||||
public static void hideCreateButton(View view) {
|
||||
boolean hidden = SettingsEnum.HIDE_CREATE_BUTTON.getBoolean();
|
||||
String message = "Create button: " + (hidden ? "hidden" : "shown");
|
||||
LogHelper.printDebug(() -> message);
|
||||
LogHelper.printDebug(() -> "Create button: " + (hidden ? "hidden" : "shown"));
|
||||
view.setVisibility(hidden ? View.GONE : View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
|
||||
public final class HidePlayerButtonsPatch {
|
||||
|
||||
public static boolean hideButtons() {
|
||||
return SettingsEnum.HIDE_PLAYER_BUTTONS.getBoolean();
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,9 @@ public class HideShortsButtonPatch {
|
||||
public static void hideShortsButton(View view) {
|
||||
if (lastPivotTab != null && lastPivotTab.name() == "TAB_SHORTS") {
|
||||
boolean hide = SettingsEnum.HIDE_SHORTS_BUTTON.getBoolean();
|
||||
String message = hide ? "Shorts button: hidden" : "Shorts button: shown";
|
||||
LogHelper.printDebug(() -> message);
|
||||
LogHelper.printDebug(() -> hide ? "Shorts button: hidden" : "Shorts button: shown");
|
||||
if (hide) {
|
||||
view.setVisibility(hide ? View.GONE : View.VISIBLE);
|
||||
view.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,24 +1,23 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import static app.revanced.integrations.sponsorblock.StringRef.str;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import static app.revanced.integrations.sponsorblock.StringRef.str;
|
||||
|
||||
public class MicroGSupport {
|
||||
private static final String MICROG_VENDOR = "com.mgoogle";
|
||||
private static final String MICROG_PACKAGE_NAME = "com.mgoogle.android.gms";
|
||||
private static final String MICROG_PACKAGE_NAME = MICROG_VENDOR + ".android.gms";
|
||||
private static final String VANCED_MICROG_DOWNLOAD_LINK = "https://github.com/TeamVanced/VancedMicroG/releases/latest";
|
||||
private static final String DONT_KILL_MY_APP_LINK = "https://dontkillmyapp.com";
|
||||
private static final Uri VANCED_MICROG_PROVIDER = Uri.parse("content://com.mgoogle.android.gsf.gservices/prefix");
|
||||
private static final Uri VANCED_MICROG_PROVIDER = Uri.parse("content://" + MICROG_VENDOR + ".android.gsf.gservices/prefix");
|
||||
|
||||
private static void startIntent(Context context, String uriString, String message) {
|
||||
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
|
||||
@@ -35,13 +34,16 @@ public class MicroGSupport {
|
||||
try {
|
||||
context.getPackageManager().getPackageInfo(MICROG_PACKAGE_NAME, PackageManager.GET_ACTIVITIES);
|
||||
} catch (PackageManager.NameNotFoundException exception) {
|
||||
LogHelper.printException(() -> ("Vanced MicroG was not found"), exception);
|
||||
LogHelper.printInfo(() -> "Vanced MicroG was not found", exception);
|
||||
startIntent(context, VANCED_MICROG_DOWNLOAD_LINK, str("microg_not_installed_warning"));
|
||||
|
||||
// Gracefully exit the app, so it does not crash.
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
try (var client = context.getContentResolver().acquireContentProviderClient(VANCED_MICROG_PROVIDER)) {
|
||||
if (client != null) return;
|
||||
LogHelper.printException(() -> ("Vanced MicroG is not running in the background"));
|
||||
LogHelper.printInfo(() -> "Vanced MicroG is not running in the background");
|
||||
startIntent(context, DONT_KILL_MY_APP_LINK, str("microg_not_running_warning"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
package app.revanced.integrations.patches;
|
||||
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.shared.PlayerType;
|
||||
|
||||
public class MinimizedPlaybackPatch {
|
||||
|
||||
public static boolean isNotPlayingShorts(boolean isPipEnabled) {
|
||||
return !PlayerType.getCurrent().isNoneOrHidden() && isPipEnabled;
|
||||
}
|
||||
|
||||
public static boolean isMinimizedPlaybackEnabled() {
|
||||
return SettingsEnum.ENABLE_MINIMIZED_PLAYBACK.getBoolean();
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ package app.revanced.integrations.patches;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.shared.PlayerType;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
|
||||
/**
|
||||
* Hook receiver class for 'player-type-hook' patch
|
||||
@@ -24,7 +24,9 @@ public class PlayerTypeHookPatch {
|
||||
|
||||
// update current player type
|
||||
final PlayerType newType = PlayerType.safeParseFromString(type.toString());
|
||||
if (newType != null) {
|
||||
if (newType == null) {
|
||||
LogHelper.printException(() -> "Unknown PlayerType encountered: " + type);
|
||||
} else {
|
||||
PlayerType.setCurrent(newType);
|
||||
LogHelper.printDebug(() -> "YouTubePlayerOverlaysLayout player type was updated to " + newType);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class VideoInformation {
|
||||
seekMethod = thisRef.getClass().getMethod(SEEK_METHOD_NAME, Long.TYPE);
|
||||
seekMethod.setAccessible(true);
|
||||
} catch (NoSuchMethodException ex) {
|
||||
LogHelper.printDebug(() -> "Failed to initialize: " + ex.getMessage());
|
||||
LogHelper.printException(() -> "Failed to initialize", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public final class VideoInformation {
|
||||
LogHelper.printDebug(() -> "Seeking to " + millisecond);
|
||||
seekMethod.invoke(playerController.get(), millisecond);
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printDebug(() -> "Failed to seek: " + ex.getMessage());
|
||||
LogHelper.printException(() -> "Failed to seek", ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.revanced.integrations.patches.playback.quality;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
@@ -26,24 +27,25 @@ public class RememberVideoQualityPatch {
|
||||
if (isConnectedWifi(context)) {
|
||||
try {
|
||||
SharedPrefHelper.saveString(SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "wifi_quality", defaultQuality + "");
|
||||
String message = "Changing default Wi-Fi quality to: " + defaultQuality;
|
||||
LogHelper.printDebug(() -> message);
|
||||
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> ("Failed to change default WI-FI quality:" + ex));
|
||||
Toast.makeText(context, "Failed to change default WI-FI quality:", Toast.LENGTH_SHORT).show();
|
||||
LogHelper.printException(() -> "Failed to change default WI-FI quality", ex);
|
||||
}
|
||||
LogHelper.printDebug(() -> "Changing default Wi-Fi quality to: " + defaultQuality);
|
||||
Toast.makeText(context, "Changing default Wi-Fi quality to: " + defaultQuality, Toast.LENGTH_SHORT).show();
|
||||
} else if (isConnectedMobile(context)) {
|
||||
try {
|
||||
SharedPrefHelper.saveString(SharedPrefHelper.SharedPrefNames.REVANCED_PREFS, "mobile_quality", defaultQuality + "");
|
||||
String message = "Changing default mobile data quality to:" + defaultQuality;
|
||||
LogHelper.printDebug(() -> message);
|
||||
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printDebug(() -> "Failed to change default mobile data quality" + ex);
|
||||
Toast.makeText(context, "Failed to change default mobile data quality", Toast.LENGTH_SHORT).show();
|
||||
LogHelper.printException(() -> "Failed to change default mobile data quality", ex);
|
||||
}
|
||||
LogHelper.printDebug(() -> "Changing default mobile data quality to:" + defaultQuality);
|
||||
Toast.makeText(context, "Changing default mobile data quality to:" + defaultQuality, Toast.LENGTH_SHORT).show();
|
||||
} else {
|
||||
LogHelper.printDebug(() -> "No internet connection.");
|
||||
Toast.makeText(context, "No internet connection.", Toast.LENGTH_SHORT).show();
|
||||
String message = "No internet connection.";
|
||||
LogHelper.printDebug(() -> message);
|
||||
Toast.makeText(context, message, Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
userChangedQuality = false;
|
||||
}
|
||||
@@ -88,7 +90,7 @@ public class RememberVideoQualityPatch {
|
||||
LogHelper.printDebug(() -> "Quality: " + qualityToLog);
|
||||
Context context = ReVancedUtils.getContext();
|
||||
if (context == null) {
|
||||
LogHelper.printException(() -> ("Context is null or settings not initialized, returning quality: " + qualityToLog));
|
||||
LogHelper.printException(() -> "Context is null or settings not initialized, returning quality: " + qualityToLog);
|
||||
return quality;
|
||||
}
|
||||
if (isConnectedWifi(context)) {
|
||||
@@ -129,8 +131,7 @@ public class RememberVideoQualityPatch {
|
||||
LogHelper.printDebug(() -> "Quality changed to: " + qualityIndex);
|
||||
return qualityIndex;
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> ("Failed to set quality"), ex);
|
||||
Toast.makeText(context, "Failed to set quality", Toast.LENGTH_SHORT).show();
|
||||
LogHelper.printException(() -> "Failed to set quality", ex);
|
||||
return qualityIndex;
|
||||
}
|
||||
}
|
||||
@@ -147,6 +148,7 @@ public class RememberVideoQualityPatch {
|
||||
newVideo = true;
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission")
|
||||
private static NetworkInfo getNetworkInfo(Context context) {
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
return cm.getActiveNetworkInfo();
|
||||
|
||||
@@ -2,7 +2,6 @@ package app.revanced.integrations.returnyoutubedislike;
|
||||
|
||||
import static app.revanced.integrations.sponsorblock.StringRef.str;
|
||||
|
||||
import android.content.Context;
|
||||
import android.icu.text.CompactDecimalFormat;
|
||||
import android.os.Build;
|
||||
import android.text.Spannable;
|
||||
@@ -13,7 +12,6 @@ import android.text.style.CharacterStyle;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.text.style.RelativeSizeSpan;
|
||||
import android.text.style.ScaleXSpan;
|
||||
import android.util.DisplayMetrics;
|
||||
|
||||
import androidx.annotation.GuardedBy;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -31,6 +29,7 @@ import java.util.concurrent.atomic.AtomicReference;
|
||||
import app.revanced.integrations.returnyoutubedislike.requests.RYDVoteData;
|
||||
import app.revanced.integrations.returnyoutubedislike.requests.ReturnYouTubeDislikeApi;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.shared.PlayerType;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import app.revanced.integrations.utils.SharedPrefHelper;
|
||||
@@ -96,7 +95,16 @@ public class ReturnYouTubeDislike {
|
||||
private static NumberFormat dislikePercentageFormatter;
|
||||
|
||||
public static void onEnabledChange(boolean enabled) {
|
||||
isEnabled = enabled;
|
||||
synchronized (videoIdLockObject) {
|
||||
isEnabled = enabled;
|
||||
if (!enabled) {
|
||||
// must clear old values, to protect against using stale data
|
||||
// if the user re-enables RYD while watching a video
|
||||
LogHelper.printDebug(() -> "Clearing previously fetched RYD vote data");
|
||||
currentVideoId = null;
|
||||
voteFetchFuture = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String getCurrentVideoId() {
|
||||
@@ -117,8 +125,12 @@ public class ReturnYouTubeDislike {
|
||||
if (!isEnabled) return;
|
||||
try {
|
||||
Objects.requireNonNull(videoId);
|
||||
LogHelper.printDebug(() -> "New video loaded: " + videoId);
|
||||
|
||||
PlayerType currentPlayerType = PlayerType.getCurrent();
|
||||
if (currentPlayerType == PlayerType.INLINE_MINIMAL) {
|
||||
LogHelper.printDebug(() -> "Ignoring inline playback of video: "+ videoId);
|
||||
return;
|
||||
}
|
||||
LogHelper.printDebug(() -> " new video loaded: " + videoId + " playerType: " + currentPlayerType);
|
||||
synchronized (videoIdLockObject) {
|
||||
currentVideoId = videoId;
|
||||
// no need to wrap the call in a try/catch,
|
||||
@@ -157,6 +169,10 @@ public class ReturnYouTubeDislike {
|
||||
long fetchStartTime = 0;
|
||||
try {
|
||||
Future<RYDVoteData> fetchFuture = getVoteFetchFuture();
|
||||
if (fetchFuture == null) {
|
||||
LogHelper.printDebug(() -> "fetch future not available (user enabled RYD while video was playing?)");
|
||||
return;
|
||||
}
|
||||
if (SettingsEnum.DEBUG.getBoolean() && !fetchFuture.isDone()) {
|
||||
fetchStartTime = System.currentTimeMillis();
|
||||
}
|
||||
@@ -175,8 +191,7 @@ public class ReturnYouTubeDislike {
|
||||
if (updateDislike(textRef, isSegmentedButton, votingData)) {
|
||||
LogHelper.printDebug(() -> "Updated dislike span to: " + textRef.get());
|
||||
} else {
|
||||
LogHelper.printDebug(() -> "Ignoring dislike span: " + textRef.get()
|
||||
+ " that appears to already show voting data: " + votingData);
|
||||
LogHelper.printDebug(() -> "Ignoring already updated dislike span: " + textRef.get());
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> "Error while trying to update dislikes", ex);
|
||||
@@ -187,12 +202,24 @@ public class ReturnYouTubeDislike {
|
||||
if (!isEnabled) return;
|
||||
try {
|
||||
Objects.requireNonNull(vote);
|
||||
|
||||
if (PlayerType.getCurrent() == PlayerType.NONE) { // should occur if shorts is playing
|
||||
LogHelper.printDebug(() -> "Ignoring vote during Shorts playback");
|
||||
return;
|
||||
}
|
||||
if (SharedPrefHelper.getBoolean(SharedPrefHelper.SharedPrefNames.YOUTUBE, "user_signed_out", true)) {
|
||||
LogHelper.printDebug(() -> "User is logged out, ignoring voting");
|
||||
return;
|
||||
}
|
||||
|
||||
// Must make a local copy of videoId, since it may change between now and when the vote thread runs
|
||||
String videoIdToVoteFor = getCurrentVideoId();
|
||||
if (videoIdToVoteFor == null) {
|
||||
// user enabled RYD after starting playback of a video
|
||||
LogHelper.printException(() -> "Cannot vote, current video is is null (user enabled RYD while video was playing?)",
|
||||
null, str("revanced_ryd_failure_ryd_enabled_while_playing_video_then_user_voted"));
|
||||
return;
|
||||
}
|
||||
|
||||
voteSerialExecutor.execute(() -> {
|
||||
// must wrap in try/catch to properly log exceptions
|
||||
@@ -278,9 +305,6 @@ public class ReturnYouTubeDislike {
|
||||
//
|
||||
// Change the "Likes" string to show that likes and dislikes are hidden
|
||||
//
|
||||
LogHelper.printDebug(() -> "Like count is hidden by video creator. "
|
||||
+ "RYD does not provide data for videos with hidden likes.");
|
||||
|
||||
String hiddenMessageString = str("revanced_ryd_video_likes_hidden_by_video_owner");
|
||||
if (hiddenMessageString.equals(oldLikesString)) {
|
||||
return false;
|
||||
@@ -449,7 +473,6 @@ public class ReturnYouTubeDislike {
|
||||
|
||||
private static String formatDislikeCount(long dislikeCount) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
String formatted;
|
||||
synchronized (ReturnYouTubeDislike.class) { // number formatter is not thread safe, must synchronize
|
||||
if (dislikeCountFormatter == null) {
|
||||
// Note: Java number formatters will use the locale specific number characters.
|
||||
@@ -460,18 +483,15 @@ public class ReturnYouTubeDislike {
|
||||
LogHelper.printDebug(() -> "Locale: " + locale);
|
||||
dislikeCountFormatter = CompactDecimalFormat.getInstance(locale, CompactDecimalFormat.CompactStyle.SHORT);
|
||||
}
|
||||
formatted = dislikeCountFormatter.format(dislikeCount);
|
||||
return dislikeCountFormatter.format(dislikeCount);
|
||||
}
|
||||
LogHelper.printDebug(() -> "Dislike count: " + dislikeCount + " formatted as: " + formatted);
|
||||
return formatted;
|
||||
}
|
||||
|
||||
// never will be reached, as the oldest supported YouTube app requires Android N or greater
|
||||
// will never be reached, as the oldest supported YouTube app requires Android N or greater
|
||||
return String.valueOf(dislikeCount);
|
||||
}
|
||||
|
||||
private static String formatDislikePercentage(float dislikePercentage) {
|
||||
String formatted;
|
||||
synchronized (ReturnYouTubeDislike.class) { // number formatter is not thread safe, must synchronize
|
||||
if (dislikePercentageFormatter == null) {
|
||||
Locale locale = ReVancedUtils.getContext().getResources().getConfiguration().locale;
|
||||
@@ -483,10 +503,8 @@ public class ReturnYouTubeDislike {
|
||||
} else {
|
||||
dislikePercentageFormatter.setMaximumFractionDigits(1); // show up to 1 digit precision
|
||||
}
|
||||
formatted = dislikePercentageFormatter.format(dislikePercentage);
|
||||
return dislikePercentageFormatter.format(dislikePercentage);
|
||||
}
|
||||
LogHelper.printDebug(() -> "Dislike percentage: " + dislikePercentage + " formatted as: " + formatted);
|
||||
return formatted;
|
||||
}
|
||||
|
||||
|
||||
@@ -500,6 +518,7 @@ public class ReturnYouTubeDislike {
|
||||
*/
|
||||
private static volatile long totalTimeUIWaitedOnNetworkCalls;
|
||||
|
||||
@SuppressWarnings("NonAtomicOperationOnVolatileField")
|
||||
private static void recordTimeUISpentWaitingForNetworkCall(long timeUIWaitStarted) {
|
||||
if (timeUIWaitStarted == 0 || !SettingsEnum.DEBUG.getBoolean()) {
|
||||
return;
|
||||
|
||||
@@ -185,11 +185,15 @@ public class ReturnYouTubeDislikeApi {
|
||||
lastTimeRateLimitWasHit = System.currentTimeMillis();
|
||||
LogHelper.printDebug(() -> "API rate limit was hit. Stopping API calls for the next "
|
||||
+ RATE_LIMIT_BACKOFF_SECONDS + " seconds");
|
||||
ReVancedUtils.runOnMainThread(() -> { // must show toasts on main thread
|
||||
Toast.makeText(ReVancedUtils.getContext(), str("revanced_ryd_failure_client_rate_limit_requested"), Toast.LENGTH_LONG).show();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressWarnings("NonAtomicOperationOnVolatileField") // do not want to pay performance cost of full synchronization for debug fields that are only estimates anyways
|
||||
private static void updateStatistics(long timeNetworkCallStarted, long timeNetworkCallEnded, boolean connectionError, boolean rateLimitHit) {
|
||||
if (connectionError && rateLimitHit) {
|
||||
throw new IllegalArgumentException("both connection error and rate limit parameter were true");
|
||||
@@ -202,11 +206,9 @@ public class ReturnYouTubeDislikeApi {
|
||||
if (connectionError) {
|
||||
fetchCallResponseTimeLast = responseTimeOfFetchCall;
|
||||
fetchCallNumberOfFailures++;
|
||||
showToast("revanced_ryd_failure_connection_timeout");
|
||||
} else if (rateLimitHit) {
|
||||
fetchCallResponseTimeLast = FETCH_CALL_RESPONSE_TIME_VALUE_RATE_LIMIT;
|
||||
numberOfRateLimitRequestsEncountered++;
|
||||
showToast("revanced_ryd_failure_client_rate_limit_requested");
|
||||
} else {
|
||||
fetchCallResponseTimeLast = responseTimeOfFetchCall;
|
||||
}
|
||||
@@ -226,6 +228,7 @@ public class ReturnYouTubeDislikeApi {
|
||||
LogHelper.printDebug(() -> "Fetching votes for: " + videoId);
|
||||
final long timeNetworkCallStarted = System.currentTimeMillis();
|
||||
|
||||
String connectionErrorMessageStringKey = "revanced_ryd_failure_connection_timeout";
|
||||
try {
|
||||
HttpURLConnection connection = getRYDConnectionFromRoute(ReturnYouTubeDislikeRoutes.GET_DISLIKES, videoId);
|
||||
// request headers, as per https://returnyoutubedislike.com/docs/fetching
|
||||
@@ -261,12 +264,12 @@ public class ReturnYouTubeDislikeApi {
|
||||
// fall thru to update statistics
|
||||
}
|
||||
} else {
|
||||
LogHelper.printDebug(() -> "Failed to fetch votes for video: " + videoId
|
||||
+ " response code was: " + responseCode);
|
||||
LogHelper.printException(() -> "Failed to fetch votes for video: " + videoId
|
||||
+ " response code was: " + responseCode, null, str(connectionErrorMessageStringKey));
|
||||
connection.disconnect(); // something went wrong, might as well disconnect
|
||||
}
|
||||
} catch (Exception ex) { // connection timed out, response timeout, or some other network error
|
||||
LogHelper.printException(() -> "Failed to fetch votes", ex);
|
||||
LogHelper.printException(() -> "Failed to fetch votes", ex, str(connectionErrorMessageStringKey));
|
||||
}
|
||||
|
||||
updateStatistics(timeNetworkCallStarted, System.currentTimeMillis(), true, false);
|
||||
@@ -304,13 +307,12 @@ public class ReturnYouTubeDislikeApi {
|
||||
String solution = solvePuzzle(challenge, difficulty);
|
||||
return confirmRegistration(userId, solution);
|
||||
}
|
||||
LogHelper.printDebug(() -> "Failed to register new user: " + userId
|
||||
LogHelper.printException(() -> "Failed to register new user: " + userId
|
||||
+ " response code was: " + responseCode);
|
||||
connection.disconnect();
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> "Failed to register user", ex);
|
||||
}
|
||||
showToast("revanced_ryd_failure_register_user");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -344,10 +346,10 @@ public class ReturnYouTubeDislikeApi {
|
||||
LogHelper.printDebug(() -> "Registration confirmation successful for user: " + userId);
|
||||
return userId;
|
||||
}
|
||||
LogHelper.printDebug(() -> "Failed to confirm registration for user: " + userId
|
||||
LogHelper.printException(() -> "Failed to confirm registration for user: " + userId
|
||||
+ " solution: " + solution + " response string was: " + result);
|
||||
} else {
|
||||
LogHelper.printDebug(() -> "Failed to confirm registration for user: " + userId
|
||||
LogHelper.printException(() -> "Failed to confirm registration for user: " + userId
|
||||
+ " solution: " + solution + " response code was: " + responseCode);
|
||||
}
|
||||
connection.disconnect(); // something went wrong, might as well disconnect
|
||||
@@ -355,8 +357,6 @@ public class ReturnYouTubeDislikeApi {
|
||||
LogHelper.printException(() -> "Failed to confirm registration for user: " + userId
|
||||
+ "solution: " + solution, ex);
|
||||
}
|
||||
showToast("revanced_ryd_failure_confirm_user");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -395,14 +395,13 @@ public class ReturnYouTubeDislikeApi {
|
||||
String solution = solvePuzzle(challenge, difficulty);
|
||||
return confirmVote(videoId, userId, solution);
|
||||
}
|
||||
LogHelper.printDebug(() -> "Failed to send vote for video: " + videoId
|
||||
LogHelper.printException(() -> "Failed to send vote for video: " + videoId
|
||||
+ " userId: " + userId + " vote: " + vote + " response code was: " + responseCode);
|
||||
connection.disconnect(); // something went wrong, might as well disconnect
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> "Failed to send vote for video: " + videoId
|
||||
+ " user: " + userId + " vote: " + vote, ex);
|
||||
}
|
||||
showToast("revanced_ryd_failure_send_vote_failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -438,10 +437,10 @@ public class ReturnYouTubeDislikeApi {
|
||||
LogHelper.printDebug(() -> "Vote confirm successful for video: " + videoId);
|
||||
return true;
|
||||
}
|
||||
LogHelper.printDebug(() -> "Failed to confirm vote for video: " + videoId
|
||||
LogHelper.printException(() -> "Failed to confirm vote for video: " + videoId
|
||||
+ " user: " + userId + " solution: " + solution + " response string was: " + result);
|
||||
} else {
|
||||
LogHelper.printDebug(() -> "Failed to confirm vote for video: " + videoId
|
||||
LogHelper.printException(() -> "Failed to confirm vote for video: " + videoId
|
||||
+ " user: " + userId + " solution: " + solution + " response code was: " + responseCode);
|
||||
}
|
||||
connection.disconnect(); // something went wrong, might as well disconnect
|
||||
@@ -449,16 +448,9 @@ public class ReturnYouTubeDislikeApi {
|
||||
LogHelper.printException(() -> "Failed to confirm vote for video: " + videoId
|
||||
+ " user: " + userId + " solution: " + solution, ex);
|
||||
}
|
||||
showToast("revanced_ryd_failure_confirm_vote_failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void showToast(String toastTextStringKey) {
|
||||
ReVancedUtils.runOnMainThread(() -> { // must show toasts on main thread
|
||||
Toast.makeText(ReVancedUtils.getContext(), str(toastTextStringKey), Toast.LENGTH_LONG).show();
|
||||
});
|
||||
}
|
||||
|
||||
private static void applyCommonPostRequestSettings(HttpURLConnection connection) throws ProtocolException {
|
||||
connection.setRequestMethod("POST");
|
||||
connection.setRequestProperty("Content-Type", "application/json");
|
||||
@@ -477,7 +469,7 @@ public class ReturnYouTubeDislikeApi {
|
||||
byte[] decodedChallenge = Base64.decode(challenge, Base64.NO_WRAP);
|
||||
|
||||
byte[] buffer = new byte[20];
|
||||
for (int i = 4; i < 20; i++) {
|
||||
for (int i = 4; i < 20; i++) { // FIXME replace with System.arrayCopy
|
||||
buffer[i] = decodedChallenge[i - 4];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
package app.revanced.integrations.settings;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import app.revanced.integrations.utils.SharedPrefHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public enum SettingsEnum {
|
||||
//Download Settings
|
||||
// TODO: DOWNLOAD_PATH("revanced_download_path", Environment.getExternalStorageDirectory().getPath() + "/Download", ReturnType.STRING),
|
||||
DOWNLOADS_BUTTON_SHOWN("revanced_downloads", true, ReturnType.BOOLEAN, true),
|
||||
DOWNLOADS_BUTTON_SHOWN("revanced_downloads_enabled", true, ReturnType.BOOLEAN, true),
|
||||
DOWNLOADS_PACKAGE_NAME("revanced_downloads_package_name", "org.schabi.newpipe" /* NewPipe */, ReturnType.STRING),
|
||||
|
||||
// Copy video URL settings
|
||||
COPY_VIDEO_URL_BUTTON_SHOWN("revanced_copy_video_url", true, ReturnType.BOOLEAN, true),
|
||||
COPY_VIDEO_URL_TIMESTAMP_BUTTON_SHOWN("revanced_copy_video_url_timestamp", true, ReturnType.BOOLEAN, true),
|
||||
COPY_VIDEO_URL_BUTTON_SHOWN("revanced_copy_video_url_enabled", true, ReturnType.BOOLEAN, true),
|
||||
COPY_VIDEO_URL_TIMESTAMP_BUTTON_SHOWN("revanced_copy_video_url_timestamp_enabled", true, ReturnType.BOOLEAN, true),
|
||||
|
||||
// Video settings
|
||||
OLD_STYLE_VIDEO_QUALITY_PLAYER_SETTINGS("revanced_use_old_style_quality_settings", true, ReturnType.BOOLEAN),
|
||||
@@ -47,13 +46,13 @@ public enum SettingsEnum {
|
||||
ADREMOVER_INFO_PANEL_REMOVAL("revanced_adremover_info_panel", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_MEDICAL_PANEL_REMOVAL("revanced_adremover_medical_panel", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_PAID_CONTENT_REMOVAL("revanced_adremover_paid_content", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_SUGGESTIONS_REMOVAL("revanced_adremover_hide_suggestions", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_HIDE_LATEST_POSTS("revanced_adremover_hide_latest_posts", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_HIDE_CHANNEL_GUIDELINES("revanced_adremover_hide_channel_guidelines", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_SELF_SPONSOR_REMOVAL("revanced_adremover_self_sponsor", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_CHAPTER_TEASER_REMOVAL("revanced_adremover_chapter_teaser", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_BUTTONED_REMOVAL("revanced_adremover_buttoned", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_GRAY_SEPARATOR("revanced_adremover_separator", true, ReturnType.BOOLEAN),
|
||||
ADREMOVER_VIEW_PRODUCTS("revanced_adremover_view_products", true, ReturnType.BOOLEAN),
|
||||
|
||||
// Action buttons
|
||||
HIDE_LIKE_BUTTON("revanced_hide_like_button", false, ReturnType.BOOLEAN, false),
|
||||
@@ -90,6 +89,7 @@ public enum SettingsEnum {
|
||||
HIDE_TIME_AND_SEEKBAR("revanced_hide_time_and_seekbar", false, ReturnType.BOOLEAN),
|
||||
HIDE_WATCH_IN_VR("revanced_hide_watch_in_vr", false, ReturnType.BOOLEAN, true),
|
||||
HIDE_BREAKING_NEWS("revanced_hide_breaking_news", true, ReturnType.BOOLEAN, true),
|
||||
HIDE_PLAYER_BUTTONS("revanced_hide_player_buttons", false, ReturnType.BOOLEAN, false),
|
||||
|
||||
// Misc. Settings
|
||||
FIX_PLAYBACK("revanced_fix_playback", false, ReturnType.BOOLEAN, false),
|
||||
@@ -117,9 +117,10 @@ public enum SettingsEnum {
|
||||
PLAYBACK_MAX_BUFFER("revanced_pref_buffer_for_playback_ms", 2500, ReturnType.INTEGER),
|
||||
MAX_PLAYBACK_BUFFER_AFTER_REBUFFER("revanced_pref_buffer_for_playback_after_rebuffer_ms", 5000, ReturnType.INTEGER),
|
||||
|
||||
// ReVanced settings
|
||||
// Debug settings
|
||||
DEBUG("revanced_debug_enabled", false, ReturnType.BOOLEAN),
|
||||
DEBUG_STACKTRACE("revanced_debug_stacktrace_enabled", false, ReturnType.BOOLEAN),
|
||||
DEBUG_SHOW_TOAST_ON_ERROR("revanced_debug_toast_on_error_enabled", true, ReturnType.BOOLEAN),
|
||||
|
||||
USE_DARK_THEME("app_theme_dark", false, ReturnType.BOOLEAN),
|
||||
|
||||
@@ -145,8 +146,7 @@ public enum SettingsEnum {
|
||||
SB_IS_VIP("sb-is-vip", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||
SB_LAST_VIP_CHECK("sb-last-vip-check", 0L, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.LONG),
|
||||
SB_SHOW_BROWSER_BUTTON("sb-browser-button", false, SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.BOOLEAN),
|
||||
SB_API_URL("sb-api-url", "https://sponsor.ajay.app/api/", SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.STRING),
|
||||
|
||||
SB_API_URL("sb-api-host-url", "https://sponsor.ajay.app", SharedPrefHelper.SharedPrefNames.SPONSOR_BLOCK, ReturnType.STRING),
|
||||
|
||||
//
|
||||
// old deprecated settings, kept around to migrate user settings on existing installations
|
||||
@@ -181,7 +181,13 @@ public enum SettingsEnum {
|
||||
@Deprecated
|
||||
DEPRECATED_BRANDING_SHOWN("revanced_branding_watermark_enabled", false, ReturnType.BOOLEAN),
|
||||
@Deprecated
|
||||
DEPRECATED_REMEMBER_VIDEO_QUALITY("revanced_remember_video_quality_selection", false, ReturnType.BOOLEAN);
|
||||
DEPRECATED_REMEMBER_VIDEO_QUALITY("revanced_remember_video_quality_selection", false, ReturnType.BOOLEAN),
|
||||
@Deprecated
|
||||
DEPRECATED_DOWNLOADS_BUTTON_SHOWN("revanced_downloads", true, ReturnType.BOOLEAN, true),
|
||||
@Deprecated
|
||||
DEPRECATED_COPY_VIDEO_URL_BUTTON_SHOWN("revanced_copy_video_url", true, ReturnType.BOOLEAN, true),
|
||||
@Deprecated
|
||||
DEPRECATED_COPY_VIDEO_URL_TIMESTAMP_BUTTON_SHOWN("revanced_copy_video_url_timestamp", true, ReturnType.BOOLEAN, true);
|
||||
//
|
||||
// end deprecated settings
|
||||
//
|
||||
@@ -225,7 +231,7 @@ public enum SettingsEnum {
|
||||
//
|
||||
|
||||
// old/new settings where old is default off, and new has inverted value and is default on
|
||||
SettingsEnum invertedSettingsToMigrate[][] = {
|
||||
SettingsEnum[][] invertedSettingsToMigrate = {
|
||||
{DEPRECATED_FULLSCREEN_PANELS_SHOWN, HIDE_FULLSCREEN_PANELS},
|
||||
{DEPRECATED_CREATE_BUTTON_ENABLED, HIDE_CREATE_BUTTON},
|
||||
{DEPRECATED_SHORTS_BUTTON_SHOWN, HIDE_SHORTS_BUTTON},
|
||||
@@ -235,7 +241,7 @@ public enum SettingsEnum {
|
||||
{DEPRECATED_BRANDING_SHOWN, HIDE_VIDEO_WATERMARK},
|
||||
{DEPRECATED_REMEMBER_VIDEO_QUALITY, REMEMBER_VIDEO_QUALITY_LAST_SELECTED},
|
||||
};
|
||||
for (SettingsEnum oldNewSetting[] : invertedSettingsToMigrate) {
|
||||
for (SettingsEnum[] oldNewSetting : invertedSettingsToMigrate) {
|
||||
// by default, old setting was default off
|
||||
// migrate to new setting of default on
|
||||
SettingsEnum oldSetting = oldNewSetting[0];
|
||||
@@ -252,9 +258,9 @@ public enum SettingsEnum {
|
||||
}
|
||||
|
||||
//
|
||||
// migrate preference of prior 'default off' settings, into replacement setting with different path name but otherwise is identical
|
||||
// renamed settings with new path names, but otherwise the new and old settings are identical
|
||||
//
|
||||
SettingsEnum renamedSettings[][] = {
|
||||
SettingsEnum[][] renamedSettings = {
|
||||
{DEPRECATED_HIDE_MIX_PLAYLISTS, HIDE_MIX_PLAYLISTS},
|
||||
{DEPRECATED_HIDE_LIKE_BUTTON, HIDE_LIKE_BUTTON},
|
||||
{DEPRECATED_HIDE_DISLIKE_BUTTON, HIDE_DISLIKE_BUTTON},
|
||||
@@ -262,16 +268,19 @@ public enum SettingsEnum {
|
||||
{DEPRECATED_HIDE_PLAYLIST_BUTTON, HIDE_PLAYLIST_BUTTON},
|
||||
{DEPRECATED_HIDE_ACTION_BUTTON, HIDE_ACTION_BUTTON},
|
||||
{DEPRECATED_HIDE_SHARE_BUTTON, HIDE_SHARE_BUTTON},
|
||||
{DEPRECATED_DOWNLOADS_BUTTON_SHOWN, DOWNLOADS_BUTTON_SHOWN},
|
||||
{DEPRECATED_COPY_VIDEO_URL_BUTTON_SHOWN, COPY_VIDEO_URL_BUTTON_SHOWN},
|
||||
{DEPRECATED_COPY_VIDEO_URL_TIMESTAMP_BUTTON_SHOWN, COPY_VIDEO_URL_TIMESTAMP_BUTTON_SHOWN},
|
||||
};
|
||||
for (SettingsEnum oldNewSetting[] : renamedSettings) {
|
||||
for (SettingsEnum[] oldNewSetting : renamedSettings) {
|
||||
SettingsEnum oldSetting = oldNewSetting[0];
|
||||
SettingsEnum newSetting = oldNewSetting[1];
|
||||
|
||||
if (oldSetting.getBoolean()) {
|
||||
LogHelper.printInfo(() -> "Migrating enabled setting from: " + oldSetting
|
||||
+ " into replacement setting: " + newSetting);
|
||||
newSetting.saveValue(true);
|
||||
oldSetting.saveValue(false);
|
||||
if (!oldSetting.value.equals(oldSetting.defaultValue)) {
|
||||
LogHelper.printInfo(() -> "Migrating old setting of '" + oldSetting.value
|
||||
+ "' from: " + oldSetting + " into replacement setting: " + newSetting);
|
||||
newSetting.saveValue(oldSetting.value);
|
||||
oldSetting.saveValue(oldSetting.getDefaultValue()); // reset old value
|
||||
}
|
||||
}
|
||||
//
|
||||
@@ -305,7 +314,7 @@ public enum SettingsEnum {
|
||||
defaultValue = SharedPrefHelper.getString(setting.sharedPref, path, (String) defaultValue);
|
||||
break;
|
||||
default:
|
||||
LogHelper.printException(() -> ("Setting does not have a valid Type. Name is: " + setting.name()));
|
||||
LogHelper.printException(() -> "Setting does not have a valid Type. Name is: " + setting.name());
|
||||
break;
|
||||
}
|
||||
setting.setValue(defaultValue);
|
||||
@@ -338,7 +347,7 @@ public enum SettingsEnum {
|
||||
Context context = ReVancedUtils.getContext();
|
||||
|
||||
if (context == null) {
|
||||
LogHelper.printException(() -> ("Context on SaveValue is null!"));
|
||||
LogHelper.printException(() -> "Context on SaveValue is null!");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -359,33 +368,33 @@ public enum SettingsEnum {
|
||||
SharedPrefHelper.saveString(sharedPref, path, (String) newValue);
|
||||
break;
|
||||
default:
|
||||
LogHelper.printException(() -> ("Setting does not have a valid Type. Name is: " + name()));
|
||||
LogHelper.printException(() -> "Setting does not have a valid Type. Name is: " + name());
|
||||
break;
|
||||
}
|
||||
|
||||
value = newValue;
|
||||
}
|
||||
|
||||
public int getInt() {
|
||||
return (int) value;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return (String) value;
|
||||
}
|
||||
|
||||
public boolean getBoolean() {
|
||||
return (Boolean) value;
|
||||
}
|
||||
|
||||
public Long getLong() {
|
||||
public int getInt() {
|
||||
return (Integer) value;
|
||||
}
|
||||
|
||||
public long getLong() {
|
||||
return (Long) value;
|
||||
}
|
||||
|
||||
public Float getFloat() {
|
||||
public float getFloat() {
|
||||
return (Float) value;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
return (String) value;
|
||||
}
|
||||
|
||||
public Object getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.google.android.libraries.social.licenses.LicenseActivity;
|
||||
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
@@ -44,15 +46,23 @@ public class ReVancedSettingActivity {
|
||||
}
|
||||
|
||||
try {
|
||||
getTextView((ViewGroup) base.findViewById(getIdentifier("toolbar", "id"))).setText(preferenceIdentifier);
|
||||
TextView toolbar = getTextView((ViewGroup) base.findViewById(getIdentifier("toolbar", "id")));
|
||||
if (toolbar == null) {
|
||||
// FIXME
|
||||
// https://github.com/revanced/revanced-patches/issues/1384
|
||||
LogHelper.printDebug(() -> "Could not find toolbar");
|
||||
} else {
|
||||
toolbar.setText(preferenceIdentifier);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogHelper.printException(() -> ("Couldn't set Toolbar title"), e);
|
||||
LogHelper.printException(() -> "Could not set Toolbar title", e);
|
||||
}
|
||||
|
||||
base.getFragmentManager().beginTransaction().replace(getIdentifier("revanced_settings_fragments", "id"), preferenceFragment).commit();
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static <T extends View> T getView(Class<T> typeClass, ViewGroup viewGroup) {
|
||||
if (viewGroup == null) {
|
||||
return null;
|
||||
@@ -67,10 +77,12 @@ public class ReVancedSettingActivity {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ImageButton getImageButton(ViewGroup viewGroup) {
|
||||
return getView(ImageButton.class, viewGroup);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TextView getTextView(ViewGroup viewGroup) {
|
||||
return getView(TextView.class, viewGroup);
|
||||
}
|
||||
|
||||
@@ -66,12 +66,12 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
||||
value = Integer.parseInt(editPref.getText());
|
||||
break;
|
||||
default:
|
||||
LogHelper.printException(() -> ("Setting has no valid return type! " + setting.getReturnType()));
|
||||
LogHelper.printException(() -> "Setting has no valid return type! " + setting.getReturnType());
|
||||
break;
|
||||
}
|
||||
setting.setValue(value);
|
||||
} else {
|
||||
LogHelper.printException(() -> ("Setting cannot be handled! " + pref.toString()));
|
||||
LogHelper.printException(() -> "Setting cannot be handled: " + pref.getClass() + " " + pref.toString());
|
||||
}
|
||||
|
||||
if (ReVancedUtils.getContext() != null && settingsInitialized && setting.shouldRebootOnChange()) {
|
||||
@@ -96,7 +96,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
||||
|
||||
this.settingsInitialized = true;
|
||||
} catch (Throwable th) {
|
||||
LogHelper.printException(() -> ("Error during onCreate()"), th);
|
||||
LogHelper.printException(() -> "Error during onCreate()", th);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
||||
|
||||
private Preference findPreferenceOnScreen(CharSequence key) {
|
||||
if (key == null) {
|
||||
LogHelper.printException(() -> ("Key cannot be null!"));
|
||||
LogHelper.printException(() -> "Key cannot be null!");
|
||||
return null;
|
||||
}
|
||||
Preference pref = null;
|
||||
@@ -144,7 +144,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
||||
private String getPackageName() {
|
||||
Context context = ReVancedUtils.getContext();
|
||||
if (context == null) {
|
||||
LogHelper.printException(() -> ("Context is null, returning com.google.android.youtube!"));
|
||||
LogHelper.printException(() -> "Context is null, returning com.google.android.youtube!");
|
||||
return "com.google.android.youtube";
|
||||
}
|
||||
String PACKAGE_NAME = context.getPackageName();
|
||||
@@ -169,7 +169,7 @@ public class ReVancedSettingsFragment extends PreferenceFragment {
|
||||
Resources res = context.getResources();
|
||||
return res.getString(res.getIdentifier(name, "string", context.getPackageName()));
|
||||
} catch (Throwable exception) {
|
||||
LogHelper.printException(() -> ("Resource not found."), exception);
|
||||
LogHelper.printException(() -> "Resource not found.", exception);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,8 +62,6 @@ public class ReturnYouTubeDislikeSettingsFragment extends PreferenceFragment {
|
||||
setPreferenceScreen(preferenceScreen);
|
||||
|
||||
enabledPreference = new SwitchPreference(context);
|
||||
enabledPreference.setKey(SettingsEnum.RYD_ENABLED.getPath());
|
||||
enabledPreference.setDefaultValue(SettingsEnum.RYD_ENABLED.getDefaultValue());
|
||||
enabledPreference.setChecked(SettingsEnum.RYD_ENABLED.getBoolean());
|
||||
enabledPreference.setTitle(str("revanced_ryd_enable_title"));
|
||||
enabledPreference.setOnPreferenceChangeListener((pref, newValue) -> {
|
||||
@@ -77,8 +75,6 @@ public class ReturnYouTubeDislikeSettingsFragment extends PreferenceFragment {
|
||||
preferenceScreen.addPreference(enabledPreference);
|
||||
|
||||
percentagePreference = new SwitchPreference(context);
|
||||
percentagePreference.setKey(SettingsEnum.RYD_SHOW_DISLIKE_PERCENTAGE.getPath());
|
||||
percentagePreference.setDefaultValue(SettingsEnum.RYD_SHOW_DISLIKE_PERCENTAGE.getDefaultValue());
|
||||
percentagePreference.setChecked(SettingsEnum.RYD_SHOW_DISLIKE_PERCENTAGE.getBoolean());
|
||||
percentagePreference.setTitle(str("revanced_ryd_dislike_percentage_title"));
|
||||
percentagePreference.setOnPreferenceChangeListener((pref, newValue) -> {
|
||||
@@ -90,8 +86,6 @@ public class ReturnYouTubeDislikeSettingsFragment extends PreferenceFragment {
|
||||
preferenceScreen.addPreference(percentagePreference);
|
||||
|
||||
compactLayoutPreference = new SwitchPreference(context);
|
||||
compactLayoutPreference.setKey(SettingsEnum.RYD_USE_COMPACT_LAYOUT.getPath());
|
||||
compactLayoutPreference.setDefaultValue(SettingsEnum.RYD_USE_COMPACT_LAYOUT.getDefaultValue());
|
||||
compactLayoutPreference.setChecked(SettingsEnum.RYD_USE_COMPACT_LAYOUT.getBoolean());
|
||||
compactLayoutPreference.setTitle(str("revanced_ryd_compact_layout_title"));
|
||||
compactLayoutPreference.setOnPreferenceChangeListener((pref, newValue) -> {
|
||||
|
||||
@@ -171,6 +171,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
||||
screen.addPreference(colorPreference);
|
||||
colorPreference.setTitle(str("color_change"));
|
||||
colorPreference.setSummary(str("color_change_sum"));
|
||||
colorPreference.setSelectable(false);
|
||||
preferencesToDisableWhenSBDisabled.add(colorPreference);
|
||||
}
|
||||
|
||||
@@ -184,6 +185,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
||||
Preference preference = new Preference(context);
|
||||
category.addPreference(preference);
|
||||
preference.setTitle(str("stats_loading"));
|
||||
preference.setSelectable(false);
|
||||
|
||||
SBRequester.retrieveUserStats(category, preference);
|
||||
}
|
||||
@@ -211,6 +213,7 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
||||
Preference preference = new Preference(context);
|
||||
screen.addPreference(preference);
|
||||
preference.setTitle(str("about_madeby"));
|
||||
preference.setSelectable(false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -233,11 +236,14 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
||||
}
|
||||
|
||||
{
|
||||
Preference preference = new SwitchPreference(context);
|
||||
SwitchPreference preference = new SwitchPreference(context);
|
||||
preference.setTitle(str("general_skiptoast"));
|
||||
preference.setSummary(str("general_skiptoast_sum"));
|
||||
preference.setKey(SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.getPath());
|
||||
preference.setDefaultValue(SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.getDefaultValue());
|
||||
preference.setChecked(SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.getBoolean());
|
||||
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||
SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.saveValue(newValue);
|
||||
return true;
|
||||
});
|
||||
preference.setOnPreferenceClickListener(preference12 -> {
|
||||
Toast.makeText(preference12.getContext(), str("skipped_sponsor"), Toast.LENGTH_SHORT).show();
|
||||
return false;
|
||||
@@ -247,21 +253,28 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
||||
}
|
||||
|
||||
{
|
||||
Preference preference = new SwitchPreference(context);
|
||||
SwitchPreference preference = new SwitchPreference(context);
|
||||
preference.setTitle(str("general_skipcount"));
|
||||
preference.setSummary(str("general_skipcount_sum"));
|
||||
preference.setKey(SettingsEnum.SB_COUNT_SKIPS.getPath());
|
||||
preference.setDefaultValue(SettingsEnum.SB_COUNT_SKIPS.getDefaultValue());
|
||||
preference.setChecked(SettingsEnum.SB_COUNT_SKIPS.getBoolean());
|
||||
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||
SettingsEnum.SB_COUNT_SKIPS.saveValue(newValue);
|
||||
return true;
|
||||
});
|
||||
preferencesToDisableWhenSBDisabled.add(preference);
|
||||
screen.addPreference(preference);
|
||||
}
|
||||
|
||||
{
|
||||
Preference preference = new SwitchPreference(context);
|
||||
SwitchPreference preference = new SwitchPreference(context);
|
||||
preference.setTitle(str("general_time_without_sb"));
|
||||
preference.setSummary(str("general_time_without_sb_sum"));
|
||||
preference.setKey(SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getPath());
|
||||
preference.setDefaultValue(SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getDefaultValue());
|
||||
preference.setChecked(SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getBoolean());
|
||||
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||
SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.saveValue(newValue);
|
||||
return true;
|
||||
});
|
||||
|
||||
preferencesToDisableWhenSBDisabled.add(preference);
|
||||
screen.addPreference(preference);
|
||||
}
|
||||
@@ -271,8 +284,11 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
||||
preference.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER);
|
||||
preference.setTitle(str("general_adjusting"));
|
||||
preference.setSummary(str("general_adjusting_sum"));
|
||||
preference.setKey(SettingsEnum.SB_ADJUST_NEW_SEGMENT_STEP.getPath());
|
||||
preference.setDefaultValue(SettingsEnum.SB_ADJUST_NEW_SEGMENT_STEP.getDefaultValue() + "");
|
||||
preference.setText(String.valueOf(SettingsEnum.SB_ADJUST_NEW_SEGMENT_STEP.getInt()));
|
||||
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||
SettingsEnum.SB_ADJUST_NEW_SEGMENT_STEP.saveValue(Integer.valueOf(newValue.toString()));
|
||||
return true;
|
||||
});
|
||||
screen.addPreference(preference);
|
||||
preferencesToDisableWhenSBDisabled.add(preference);
|
||||
}
|
||||
@@ -282,18 +298,25 @@ public class SponsorBlockSettingsFragment extends PreferenceFragment implements
|
||||
preference.getEditText().setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
|
||||
preference.setTitle(str("general_min_duration"));
|
||||
preference.setSummary(str("general_min_duration_sum"));
|
||||
preference.setKey(SettingsEnum.SB_MIN_DURATION.getPath());
|
||||
preference.setDefaultValue(SettingsEnum.SB_MIN_DURATION.getDefaultValue() + "");
|
||||
preference.setText(String.valueOf(SettingsEnum.SB_MIN_DURATION.getFloat()));
|
||||
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||
SettingsEnum.SB_MIN_DURATION.saveValue(Float.valueOf(newValue.toString()));
|
||||
return true;
|
||||
});
|
||||
screen.addPreference(preference);
|
||||
preferencesToDisableWhenSBDisabled.add(preference);
|
||||
}
|
||||
|
||||
{
|
||||
Preference preference = new EditTextPreference(context);
|
||||
EditTextPreference preference = new EditTextPreference(context);
|
||||
preference.setTitle(str("general_uuid"));
|
||||
preference.setSummary(str("general_uuid_sum"));
|
||||
preference.setKey(SettingsEnum.SB_UUID.getPath());
|
||||
preference.setDefaultValue(SettingsEnum.SB_UUID.getDefaultValue() + "");
|
||||
preference.setText(SettingsEnum.SB_UUID.getString());
|
||||
preference.setOnPreferenceChangeListener((preference1, newValue) -> {
|
||||
SettingsEnum.SB_UUID.saveValue(newValue.toString());
|
||||
return true;
|
||||
});
|
||||
|
||||
screen.addPreference(preference);
|
||||
preferencesToDisableWhenSBDisabled.add(preference);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import app.revanced.integrations.utils.Event
|
||||
*/
|
||||
@Suppress("unused")
|
||||
enum class PlayerType {
|
||||
NONE,
|
||||
NONE, // this also includes when shorts are playing
|
||||
HIDDEN,
|
||||
WATCH_WHILE_MINIMIZED,
|
||||
WATCH_WHILE_MAXIMIZED,
|
||||
@@ -49,4 +49,11 @@ enum class PlayerType {
|
||||
*/
|
||||
val onChange = Event<PlayerType>()
|
||||
}
|
||||
|
||||
/**
|
||||
* Weather Shorts are being played.
|
||||
*/
|
||||
fun isNoneOrHidden(): Boolean {
|
||||
return this == NONE || this == HIDDEN
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -52,7 +52,7 @@ public class ShieldButton {
|
||||
isShowing = true;
|
||||
changeVisibilityImmediate(false);
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> ("Unable to set RelativeLayout"), ex);
|
||||
LogHelper.printException(() -> "Unable to set RelativeLayout", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,29 +69,33 @@ public class ShieldButton {
|
||||
}
|
||||
|
||||
public static void changeVisibility(boolean visible, boolean immediate) {
|
||||
if (isShowing == visible) return;
|
||||
isShowing = visible;
|
||||
try {
|
||||
if (isShowing == visible) return;
|
||||
isShowing = visible;
|
||||
|
||||
ImageView iView = _shieldBtn.get();
|
||||
if (_youtubeControlsLayout == null || iView == null) return;
|
||||
ImageView iView = _shieldBtn.get();
|
||||
if (_youtubeControlsLayout == null || iView == null) return;
|
||||
|
||||
if (visible && shouldBeShown()) {
|
||||
if (getLastKnownVideoTime() >= getCurrentVideoLength()) {
|
||||
if (visible && shouldBeShown()) {
|
||||
if (getLastKnownVideoTime() >= getCurrentVideoLength()) {
|
||||
return;
|
||||
}
|
||||
LogHelper.printDebug(() -> "Fading in");
|
||||
|
||||
iView.setVisibility(View.VISIBLE);
|
||||
if (!immediate)
|
||||
iView.startAnimation(fadeIn);
|
||||
return;
|
||||
}
|
||||
LogHelper.printDebug(() -> "Fading in");
|
||||
|
||||
iView.setVisibility(View.VISIBLE);
|
||||
if (!immediate)
|
||||
iView.startAnimation(fadeIn);
|
||||
return;
|
||||
}
|
||||
|
||||
if (iView.getVisibility() == View.VISIBLE) {
|
||||
LogHelper.printDebug(() -> "Fading out");
|
||||
if (!immediate)
|
||||
iView.startAnimation(fadeOut);
|
||||
iView.setVisibility(shouldBeShown() ? View.INVISIBLE : View.GONE);
|
||||
if (iView.getVisibility() == View.VISIBLE) {
|
||||
LogHelper.printDebug(() -> "Fading out");
|
||||
if (!immediate)
|
||||
iView.startAnimation(fadeOut);
|
||||
iView.setVisibility(shouldBeShown() ? View.INVISIBLE : View.GONE);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> "changeVisibility failure", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import static app.revanced.integrations.sponsorblock.player.ui.SponsorBlockView.hideSkipButton;
|
||||
import static app.revanced.integrations.sponsorblock.player.ui.SponsorBlockView.showSkipButton;
|
||||
|
||||
@SuppressLint({"RtlHardcoded", "SetTextI18n", "LongLogTag", "AppCompatCustomView"})
|
||||
@SuppressLint({"RtlHardcoded", "SetTextI18n", "AppCompatCustomView"})
|
||||
public class SkipSegmentView {
|
||||
|
||||
private static SponsorSegment lastNotifiedSegment;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class SponsorBlockSettings {
|
||||
sponsorBlockUrlCategories = "[%22" + TextUtils.join("%22,%22", enabledCategories) + "%22]";
|
||||
|
||||
String uuid = SettingsEnum.SB_UUID.getString();
|
||||
if (uuid == null) {
|
||||
if (uuid == null || uuid.length() == 0) {
|
||||
uuid = (UUID.randomUUID().toString() +
|
||||
UUID.randomUUID().toString() +
|
||||
UUID.randomUUID().toString())
|
||||
|
||||
@@ -46,12 +46,12 @@ import java.util.TimeZone;
|
||||
import app.revanced.integrations.settings.SettingsEnum;
|
||||
import app.revanced.integrations.sponsorblock.player.PlayerType;
|
||||
import app.revanced.integrations.utils.LogHelper;
|
||||
import app.revanced.integrations.utils.ReVancedUtils;
|
||||
import app.revanced.integrations.utils.SharedPrefHelper;
|
||||
import app.revanced.integrations.sponsorblock.objects.SponsorSegment;
|
||||
import app.revanced.integrations.sponsorblock.objects.UserStats;
|
||||
import app.revanced.integrations.sponsorblock.requests.SBRequester;
|
||||
|
||||
@SuppressWarnings({"LongLogTag"})
|
||||
public abstract class SponsorBlockUtils {
|
||||
public static final String DATE_FORMAT = "HH:mm:ss.SSS";
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
@@ -154,7 +154,7 @@ public abstract class SponsorBlockUtils {
|
||||
Toast.makeText(context, str("submit_started"), Toast.LENGTH_SHORT).show();
|
||||
|
||||
appContext = new WeakReference<>(context);
|
||||
new Thread(submitRunnable).start();
|
||||
ReVancedUtils.runOnBackgroundThread(submitRunnable);
|
||||
}
|
||||
};
|
||||
public static String messageToToast = "";
|
||||
@@ -233,13 +233,13 @@ public abstract class SponsorBlockUtils {
|
||||
final SponsorBlockSettings.SegmentInfo segmentType = SponsorBlockUtils.newSponsorBlockSegmentType;
|
||||
try {
|
||||
if (start < 0 || end < 0 || start >= end || segmentType == null || videoId == null || uuid == null) {
|
||||
LogHelper.printException(() -> ("Unable to submit times, invalid parameters"));
|
||||
LogHelper.printException(() -> "Unable to submit times, invalid parameters");
|
||||
return;
|
||||
}
|
||||
SBRequester.submitSegments(videoId, uuid, ((float) start) / 1000f, ((float) end) / 1000f, segmentType.key, toastRunnable);
|
||||
newSponsorSegmentEndMillis = newSponsorSegmentStartMillis = -1;
|
||||
} catch (Exception e) {
|
||||
LogHelper.printException(() -> ("Unable to submit segment"), e);
|
||||
LogHelper.printException(() -> "Unable to submit segment", e);
|
||||
}
|
||||
|
||||
if (videoId != null)
|
||||
@@ -403,11 +403,15 @@ public abstract class SponsorBlockUtils {
|
||||
}
|
||||
|
||||
public static String appendTimeWithoutSegments(String totalTime) {
|
||||
if (videoHasSegments && (SettingsEnum.SB_ENABLED.getBoolean() && SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getBoolean()) && !TextUtils.isEmpty(totalTime) && getCurrentVideoLength() > 1) {
|
||||
if (timeWithoutSegments.isEmpty()) {
|
||||
timeWithoutSegments = getTimeWithoutSegments(sponsorSegmentsOfCurrentVideo);
|
||||
try {
|
||||
if (videoHasSegments && (SettingsEnum.SB_ENABLED.getBoolean() && SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getBoolean()) && !TextUtils.isEmpty(totalTime) && getCurrentVideoLength() > 1) {
|
||||
if (timeWithoutSegments.isEmpty()) {
|
||||
timeWithoutSegments = getTimeWithoutSegments(sponsorSegmentsOfCurrentVideo);
|
||||
}
|
||||
return totalTime + timeWithoutSegments;
|
||||
}
|
||||
return totalTime + timeWithoutSegments;
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> "appendTimeWithoutSegments failure", ex);
|
||||
}
|
||||
|
||||
return totalTime;
|
||||
@@ -436,7 +440,7 @@ public abstract class SponsorBlockUtils {
|
||||
PlayerController.setCurrentVideoId(null);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> ("Player type changed caused a crash."), ex);
|
||||
LogHelper.printException(() -> "Player type changed caused a crash.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -470,6 +474,7 @@ public abstract class SponsorBlockUtils {
|
||||
category.addPreference(preference);
|
||||
String formatted = FORMATTER.format(stats.getSegmentCount());
|
||||
preference.setTitle(fromHtml(str("stats_submissions", formatted)));
|
||||
preference.setSelectable(false);
|
||||
}
|
||||
|
||||
{
|
||||
@@ -503,6 +508,7 @@ public abstract class SponsorBlockUtils {
|
||||
|
||||
preference.setTitle(fromHtml(str("stats_self_saved", formatted)));
|
||||
preference.setSummary(fromHtml(str("stats_self_saved_sum", formattedSaved)));
|
||||
preference.setSelectable(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -541,25 +547,18 @@ public abstract class SponsorBlockUtils {
|
||||
editor.putString(category.key, behaviour.key);
|
||||
}
|
||||
|
||||
SettingsEnum.SB_UUID.saveValue(settingsJson.getString("userID"));
|
||||
SettingsEnum.SB_IS_VIP.saveValue(settingsJson.getBoolean("isVip"));
|
||||
SettingsEnum.SB_API_URL.saveValue(settingsJson.getString("serverAddress"));
|
||||
SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.saveValue(!settingsJson.getBoolean("dontShowNotice"));
|
||||
SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.saveValue(settingsJson.getBoolean("showTimeWithSkips"));
|
||||
SettingsEnum.SB_COUNT_SKIPS.saveValue(settingsJson.getBoolean("trackViewCount"));
|
||||
SettingsEnum.SB_IS_VIP.saveValue(settingsJson.getBoolean("isVip"));
|
||||
SettingsEnum.SB_MIN_DURATION.saveValue(Float.valueOf(settingsJson.getString("minDuration")));
|
||||
SettingsEnum.SB_UUID.saveValue(settingsJson.getString("userID"));
|
||||
SettingsEnum.SB_LAST_VIP_CHECK.saveValue(settingsJson.getLong("lastIsVipUpdate"));
|
||||
|
||||
|
||||
String serverAddress = settingsJson.getString("serverAddress");
|
||||
if (serverAddress.equalsIgnoreCase("https://sponsor.ajay.app")) {
|
||||
serverAddress = (String) SettingsEnum.SB_API_URL.getDefaultValue();
|
||||
}
|
||||
SettingsEnum.SB_API_URL.saveValue(serverAddress);
|
||||
SettingsEnum.SB_COUNT_SKIPS.saveValue(settingsJson.getBoolean("trackViewCount"));
|
||||
|
||||
Toast.makeText(context, str("settings_import_successful"), Toast.LENGTH_SHORT).show();
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printInfo(() -> "failed to import settings", ex); // use info level, as we are showing our own toast
|
||||
Toast.makeText(context, str("settings_import_failed"), Toast.LENGTH_SHORT).show();
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,21 +584,20 @@ public abstract class SponsorBlockUtils {
|
||||
categorySelectionsArray.put(behaviorObject);
|
||||
}
|
||||
}
|
||||
json.put("userID", SettingsEnum.SB_UUID.getString());
|
||||
json.put("isVip", SettingsEnum.SB_IS_VIP.getBoolean());
|
||||
json.put("serverAddress", SettingsEnum.SB_API_URL.getString());
|
||||
json.put("dontShowNotice", !SettingsEnum.SB_SHOW_TOAST_WHEN_SKIP.getBoolean());
|
||||
json.put("barTypes", barTypesObject);
|
||||
json.put("showTimeWithSkips", SettingsEnum.SB_SHOW_TIME_WITHOUT_SEGMENTS.getBoolean());
|
||||
json.put("minDuration", SettingsEnum.SB_MIN_DURATION.getFloat());
|
||||
json.put("trackViewCount", SettingsEnum.SB_COUNT_SKIPS.getBoolean());
|
||||
json.put("categorySelections", categorySelectionsArray);
|
||||
json.put("userID", SettingsEnum.SB_UUID.getString());
|
||||
json.put("isVip", SettingsEnum.SB_IS_VIP.getBoolean());
|
||||
json.put("lastIsVipUpdate", SettingsEnum.SB_LAST_VIP_CHECK.getLong());
|
||||
json.put("serverAddress", SettingsEnum.SB_API_URL.getString());
|
||||
json.put("barTypes", barTypesObject);
|
||||
|
||||
return json.toString();
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printInfo(() -> "failed to export settings", ex); // use info level, as we are showing our own toast
|
||||
Toast.makeText(context, str("settings_export_failed"), Toast.LENGTH_SHORT).show();
|
||||
ex.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,11 +103,11 @@ public class StringRef {
|
||||
if (resources != null) {
|
||||
final int identifier = resources.getIdentifier(value, "string", packageName);
|
||||
if (identifier == 0)
|
||||
LogHelper.printException(() -> ("Resource not found: " + value));
|
||||
LogHelper.printException(() -> "Resource not found: " + value);
|
||||
else
|
||||
value = resources.getString(identifier);
|
||||
} else {
|
||||
LogHelper.printException(() -> ("Could not resolve resources!"));
|
||||
LogHelper.printException(() -> "Could not resolve resources!");
|
||||
}
|
||||
}
|
||||
return value;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class SwipeHelper {
|
||||
isTabletMode = true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogHelper.printException(() -> ("Unable to set FrameLayout"), e);
|
||||
LogHelper.printException(() -> "Unable to set FrameLayout", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class SwipeHelper {
|
||||
try {
|
||||
nextGenWatchLayout = (ViewGroup) obj;
|
||||
} catch (Exception e) {
|
||||
LogHelper.printException(() -> ("Unable to set _nextGenWatchLayout"), e);
|
||||
LogHelper.printException(() -> "Unable to set _nextGenWatchLayout", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SwipeHelper {
|
||||
}
|
||||
try {
|
||||
} catch (Exception e) {
|
||||
LogHelper.printException(() -> ("Unable to get related_endscreen_results visibility"), e);
|
||||
LogHelper.printException(() -> "Unable to get related_endscreen_results visibility", e);
|
||||
}
|
||||
if (_frameLayout.getChildCount() > 0) {
|
||||
return _frameLayout.getChildAt(0).getVisibility() == View.VISIBLE;
|
||||
@@ -61,7 +61,7 @@ public class SwipeHelper {
|
||||
LogHelper.printDebug(() -> "related_endscreen_results refreshed");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LogHelper.printException(() -> ("Unable to refresh related_endscreen_results layout"), e);
|
||||
LogHelper.printException(() -> "Unable to refresh related_endscreen_results layout", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class VotingButton {
|
||||
isShowing = true;
|
||||
changeVisibilityImmediate(false);
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> ("Unable to set RelativeLayout"), ex);
|
||||
LogHelper.printException(() -> "Unable to set RelativeLayout", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,28 +68,32 @@ public class VotingButton {
|
||||
}
|
||||
|
||||
public static void changeVisibility(boolean visible, boolean immediate) {
|
||||
if (isShowing == visible) return;
|
||||
isShowing = visible;
|
||||
try {
|
||||
if (isShowing == visible) return;
|
||||
isShowing = visible;
|
||||
|
||||
ImageView iView = _votingButton.get();
|
||||
if (_youtubeControlsLayout == null || iView == null) return;
|
||||
ImageView iView = _votingButton.get();
|
||||
if (_youtubeControlsLayout == null || iView == null) return;
|
||||
|
||||
if (visible && shouldBeShown()) {
|
||||
if (getLastKnownVideoTime() >= getCurrentVideoLength()) {
|
||||
if (visible && shouldBeShown()) {
|
||||
if (getLastKnownVideoTime() >= getCurrentVideoLength()) {
|
||||
return;
|
||||
}
|
||||
LogHelper.printDebug(() -> "Fading in");
|
||||
iView.setVisibility(View.VISIBLE);
|
||||
if (!immediate)
|
||||
iView.startAnimation(fadeIn);
|
||||
return;
|
||||
}
|
||||
LogHelper.printDebug(() -> "Fading in");
|
||||
iView.setVisibility(View.VISIBLE);
|
||||
if (!immediate)
|
||||
iView.startAnimation(fadeIn);
|
||||
return;
|
||||
}
|
||||
|
||||
if (iView.getVisibility() == View.VISIBLE) {
|
||||
LogHelper.printDebug(() -> "Fading out");
|
||||
if (!immediate)
|
||||
iView.startAnimation(fadeOut);
|
||||
iView.setVisibility(shouldBeShown() ? View.INVISIBLE : View.GONE);
|
||||
if (iView.getVisibility() == View.VISIBLE) {
|
||||
LogHelper.printDebug(() -> "Fading out");
|
||||
if (!immediate)
|
||||
iView.startAnimation(fadeOut);
|
||||
iView.setVisibility(shouldBeShown() ? View.INVISIBLE : View.GONE);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> "changeVisibility failure", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public abstract class SlimButton implements View.OnClickListener {
|
||||
}
|
||||
setContainerVisibility();
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> ("Error while changing button visibility"), ex);
|
||||
LogHelper.printException(() -> "Error while changing button visibility", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class SponsorBlockView {
|
||||
|
||||
addView();
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> ("Unable to set ViewGroup"), ex);
|
||||
LogHelper.printException(() -> "Unable to set ViewGroup", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class SponsorBlockView {
|
||||
setSkipBtnMargins(false);
|
||||
setNewSegmentLayoutMargins(false);
|
||||
} catch (Exception ex) {
|
||||
LogHelper.printException(() -> ("Player type changed caused a crash."), ex);
|
||||
LogHelper.printException(() -> "Player type changed caused a crash.", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,13 +87,13 @@ public class SponsorBlockView {
|
||||
private static void setSkipBtnMargins(boolean fullScreen) {
|
||||
SkipSponsorButton skipSponsorButton = _skipSponsorButton.get();
|
||||
if (skipSponsorButton == null) {
|
||||
LogHelper.printException(() -> ("Unable to setSkipBtnMargins"));
|
||||
LogHelper.printException(() -> "Unable to setSkipBtnMargins");
|
||||
return;
|
||||
}
|
||||
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) skipSponsorButton.getLayoutParams();
|
||||
if (params == null) {
|
||||
LogHelper.printException(() -> ("Unable to setSkipBtnMargins"));
|
||||
LogHelper.printException(() -> "Unable to setSkipBtnMargins");
|
||||
return;
|
||||
}
|
||||
params.bottomMargin = fullScreen ? skipSponsorButton.ctaBottomMargin : skipSponsorButton.defaultBottomMargin;
|
||||
@@ -103,7 +103,7 @@ public class SponsorBlockView {
|
||||
private static void skipSponsorButtonVisibility(boolean visible) {
|
||||
SkipSponsorButton skipSponsorButton = _skipSponsorButton.get();
|
||||
if (skipSponsorButton == null) {
|
||||
LogHelper.printException(() -> ("Unable to skipSponsorButtonVisibility"));
|
||||
LogHelper.printException(() -> "Unable to skipSponsorButtonVisibility");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -116,13 +116,13 @@ public class SponsorBlockView {
|
||||
private static void setNewSegmentLayoutMargins(boolean fullScreen) {
|
||||
NewSegmentLayout newSegmentLayout = _newSegmentLayout.get();
|
||||
if (newSegmentLayout == null) {
|
||||
LogHelper.printException(() -> ("Unable to setNewSegmentLayoutMargins"));
|
||||
LogHelper.printException(() -> "Unable to setNewSegmentLayoutMargins");
|
||||
return;
|
||||
}
|
||||
|
||||
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) newSegmentLayout.getLayoutParams();
|
||||
if (params == null) {
|
||||
LogHelper.printException(() -> ("Unable to setNewSegmentLayoutMargins"));
|
||||
LogHelper.printException(() -> "Unable to setNewSegmentLayoutMargins");
|
||||
return;
|
||||
}
|
||||
params.bottomMargin = fullScreen ? newSegmentLayout.ctaBottomMargin : newSegmentLayout.defaultBottomMargin;
|
||||
@@ -132,7 +132,7 @@ public class SponsorBlockView {
|
||||
private static void newSegmentLayoutVisibility(boolean visible) {
|
||||
NewSegmentLayout newSegmentLayout = _newSegmentLayout.get();
|
||||
if (newSegmentLayout == null) {
|
||||
LogHelper.printException(() -> ("Unable to newSegmentLayoutVisibility"));
|
||||
LogHelper.printException(() -> "Unable to newSegmentLayoutVisibility");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user