Updated deps + fixed player buttons and dislike formatting

This commit is contained in:
KevinX8 2022-02-16 01:05:23 +00:00
parent 1e115e1d69
commit dfb25653b2
6 changed files with 21 additions and 22 deletions

View File

@ -1,13 +1,12 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
compileSdkVersion 32
defaultConfig {
applicationId "vanced.integrations"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.0"
multiDexEnabled false
@ -33,6 +32,6 @@ android {
}
dependencies {
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.annotation:annotation:1.3.0'
}

View File

@ -24,7 +24,7 @@ public class VideoInformation {
if (debug) {
Log.d(TAG, "setCurrentVideoId - new id was null - currentVideoId was" + currentVideoId);
}
clearInformation();
clearInformation(true);
return;
}
@ -53,15 +53,17 @@ public class VideoInformation {
// Call hook in the YT code when the video ends
public static void videoEnded() {
saveTempInformation();
clearInformation();
clearInformation(false);
}
// Information is cleared once a video ends
// It's cleared because the setCurrentVideoId isn't called for Shorts
// so Shorts would otherwise use the information from the last watched video
private static void clearInformation() {
currentVideoId = null;
dislikeCount = null;
private static void clearInformation(boolean full) {
if (full) {
currentVideoId = null;
dislikeCount = null;
}
channelName = null;
}

View File

@ -17,6 +17,7 @@ import android.widget.TextView;
import com.google.android.apps.youtube.app.YouTubeTikTokRoot_Application;
import java.util.Locale;
import java.util.Objects;
import fi.vanced.libraries.youtube.ryd.requests.RYDRequester;
import fi.vanced.utils.SharedPrefUtils;
@ -36,7 +37,7 @@ public class ReturnYouTubeDislikes {
static {
Context context = YouTubeTikTokRoot_Application.getAppContext();
isEnabled = SharedPrefUtils.getBoolean(context, PREFERENCES_NAME, PREFERENCES_KEY_RYD_ENABLED, false);
isEnabled = SharedPrefUtils.getBoolean(Objects.requireNonNull(context), PREFERENCES_NAME, PREFERENCES_KEY_RYD_ENABLED, false);
if (isEnabled) {
registration = new Registration(context);
voting = new Voting(context, registration);
@ -51,9 +52,6 @@ public class ReturnYouTubeDislikes {
locale,
CompactDecimalFormat.CompactStyle.SHORT
);
compactNumberFormatter.setMaximumIntegerDigits(3);
compactNumberFormatter.setMaximumFractionDigits(1);
compactNumberFormatter.setSignificantDigitsUsed(false);
}
}
@ -199,7 +197,8 @@ public class ReturnYouTubeDislikes {
}
private static void handleOnClick(View view, boolean previousState) {
if (!isEnabled) return;
Context context = YouTubeTikTokRoot_Application.getAppContext();
if (!isEnabled || SharedPrefUtils.getBoolean(Objects.requireNonNull(context),"youtube","user_signed_out",true)) return;
try {
String tag = (String) view.getTag();
@ -210,7 +209,7 @@ public class ReturnYouTubeDislikes {
// If active status was removed, vote should be none
if (previousState) { votingValue = 0; }
if (tag == "like") {
if (tag.equals("like")) {
dislikeActive = false;
// Like was activated
@ -218,9 +217,9 @@ public class ReturnYouTubeDislikes {
else { likeActive = false; }
// Like was activated and dislike was previously activated
if (!previousState && dislikeActive) { dislikeCount--; trySetDislikes(formatDislikes(dislikeCount)); }
if (!previousState) { dislikeCount--; trySetDislikes(formatDislikes(dislikeCount)); }
}
else if (tag == "dislike") {
else if (tag.equals("dislike")) {
likeActive = false;
// Dislike was activated
@ -274,7 +273,6 @@ public class ReturnYouTubeDislikes {
}
catch (Exception ex) {
Log.e(TAG, "Failed to send vote", ex);
return;
}
});
_votingThread.start();

View File

@ -369,11 +369,11 @@
<string name="vanced_whitelisting_fetch_failed" formatted="false">Failed to retrieve channel details, received code %d</string>
<string name="vanced_button_location_entry_none">Hidden</string>
<string name="vanced_button_location_entry_player">In player</string>
<string name="vanced_button_location_entry_buttoncontainer">Under player</string>
<string name="vanced_button_location_entry_buttoncontainer">Under player (ALPHA)</string>
<string name="vanced_button_location_entry_both">Both</string>
<string name="vanced_ryd_settings_title">Return YouTube Dislike settings</string>
<string name="vanced_ryd_settings_summary">Uses the RYD API</string>
<string name="vanced_ryd_title">Enable RYD</string>
<string name="vanced_ryd_title">Enable RYD (ALPHA)</string>
<string name="vanced_ryd_summary">Switch this on to see the dislike counts again</string>
<string name="vanced_ryd_attribution_title">Return YouTube Dislike Integration</string>
<string name="vanced_ryd_attribution_summary">This integration uses the RYD API from https://returnyoutubedislike.com. Tap to learn more</string>

View File

@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Mon Jun 07 19:51:48 CEST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME