Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and tools to target API 33 #680

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ENV ANDROID_SDK_ROOT /opt/android-sdk-linux
ENV ANDROID_HOME /opt/android-sdk-linux
ENV ANDROID_SDK /opt/android-sdk-linux

RUN echo "y\n" | cmdline-tools/bin/sdkmanager --sdk_root=/opt/android-sdk-linux "build-tools;30.0.0"
RUN echo "y\n" | cmdline-tools/bin/sdkmanager --sdk_root=/opt/android-sdk-linux "build-tools;33.0.0"

# apktool

Expand Down
10 changes: 5 additions & 5 deletions initworkspace
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ STEPS=5
[ -z "$BUILD_COMPANION" ] && BUILD_COMPANION=/opt/build-companion


DX_PATTERN="$ANDROID_SDK_ROOT/build-tools/*/dx"
DX_FILES=( $DX_PATTERN )
DX=${DX_FILES[0]}
D8_PATTERN="$ANDROID_SDK_ROOT/build-tools/*/d8"
D8_FILES=( $D8_PATTERN )
D8=${D8_FILES[0]}

echo "=== Verifing tools (1/$STEPS) ===" &&
echo "If an errr occurs during this step make" &&
Expand All @@ -35,8 +35,8 @@ echo "" && echo "apktool:" && echo "" &&
$JAVA_PATH -jar $APKTOOL_PATH --version &&
echo "" && echo "uber apk signer:" && echo "" &&
$JAVA_PATH -jar $UBER_APK_SIGNER_PATH --version &&
echo "" && echo "dx (android sdk build tools):" && echo "" &&
$DX --version &&
echo "" && echo "d8 (android sdk build tools):" && echo "" &&
$D8 --version &&
echo "" && echo "baksmali:" && echo "" &&
$JAVA_PATH -jar $BAKSMALI_PATH --version &&
echo "" &&
Expand Down
23 changes: 10 additions & 13 deletions mod/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ plugins {
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
compileSdkVersion 33
buildToolsVersion "33.0.0"

defaultConfig {
minSdkVersion 21
targetSdkVersion 30
minSdkVersion 23
targetSdkVersion 33
versionCode 1
versionName "1.0"

Expand All @@ -25,21 +25,18 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace "bttv.mod"
}

dependencies {
def GLIDE_VERSION = "4.12.0"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.9.0'
api "com.github.zjupure:webpdecoder:2.0.${GLIDE_VERSION}"
api "com.caverock:androidsvg-aar:1.4"
implementation project(path: ':twitch')
testImplementation 'junit:junit:4.+'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:1.10.19'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
5 changes: 2 additions & 3 deletions mod/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="bttv.mod">

<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
</manifest>
3 changes: 2 additions & 1 deletion mod/app/src/main/java/bttv/glide/svg/SvgDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static com.bumptech.glide.request.target.Target.SIZE_ORIGINAL;

import android.util.Log;
import android.util.TypedValue;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -45,6 +46,6 @@ public Resource<SVG> decode(@NonNull InputStream source, int width, int height,
}

private static float dpToPx(float f) {
return android.util.TypedValue.applyDimension(1, f, android.content.res.Resources.getSystem().getDisplayMetrics());
return android.util.TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, f, android.content.res.Resources.getSystem().getDisplayMetrics());
}
}
4 changes: 3 additions & 1 deletion mod/app/src/main/java/bttv/highlight/Blacklist.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import bttv.Res;
import bttv.settings.Settings;

import java.util.Locale;

public class Blacklist extends StringSetUI {
private static final String TAG = "LBTTVBlacklist";
private static Blacklist INSTANCE;
Expand All @@ -21,6 +23,6 @@ public static Blacklist getInstance() {
}
public static boolean shouldBlock(String word) {
getInstance().loadSet();
return INSTANCE.stringSet.contains(word.toLowerCase());
return INSTANCE.stringSet.contains(word.toLowerCase(Locale.getDefault()));
}
}
6 changes: 4 additions & 2 deletions mod/app/src/main/java/bttv/highlight/Highlight.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package bttv.highlight;

import java.util.Locale;

import android.util.Log;

import bttv.ChommentModelDelegateWrapper;
Expand Down Expand Up @@ -73,12 +75,12 @@ public static boolean shouldHighlight(String word) {
getInstance().loadSet();
if (word.startsWith("<") || word.endsWith(">"))
return false;
return INSTANCE.stringSet.contains(word.toLowerCase());
return INSTANCE.stringSet.contains(word.toLowerCase(Locale.getDefault()));
}

public static boolean shouldHighlightChannel(String name) {
getInstance().loadSet();
return INSTANCE.stringSet.contains("<" + name.toLowerCase() + ">");
return INSTANCE.stringSet.contains("<" + name.toLowerCase(Locale.getDefault()) + ">");
}

}
7 changes: 4 additions & 3 deletions mod/app/src/main/java/bttv/highlight/StringSetUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
import java.util.Locale;

import bttv.Data;
import bttv.Res;
Expand Down Expand Up @@ -41,12 +42,12 @@ void loadSet() {


void remove(String word) {
stringSet.remove(word.toLowerCase());
stringSet.remove(word.toLowerCase(Locale.getDefault()));
stringSetSetting.entry.set(Data.ctx, new UserPreferences.Entry.StringSetValue(stringSet));
}

boolean add(String word) {
boolean val = stringSet.add(word.toLowerCase());
boolean val = stringSet.add(word.toLowerCase(Locale.getDefault()));
stringSetSetting.entry.set(Data.ctx, new UserPreferences.Entry.StringSetValue(stringSet));
return val;
}
Expand Down Expand Up @@ -122,7 +123,7 @@ public void onClick(View v) {

boolean dialogOnAdd(TextView v, StringSetUIAdapter adapter, ArrayList<String> asList, ListView list, TextView emptyTV) {
for (String w: v.getText().toString().split(" ")) {
String word = w.toLowerCase();
String word = w.toLowerCase(Locale.getDefault());
if (word.trim().isEmpty()) {
continue;
}
Expand Down
50 changes: 29 additions & 21 deletions mod/app/src/main/java/bttv/updater/UpdaterJobService.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.util.Log;
import android.Manifest;

import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.ContextCompat;

import bttv.Data;

Expand Down Expand Up @@ -94,27 +97,32 @@ public void onUpdate(String newVersion, String body, String apkUrl, String htmlU
Log.d("LBTTVUpdaterJob", "onUpdate");
try {
int icon = getResources().getIdentifier("ic_twitch_glitch_uv_alpha_only", "drawable", getPackageName());

NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
Notifications.createChannels(this);

NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(this, "bttv_android_updates")
.setSmallIcon(icon)
.setContentTitle("bttv-android update detected")
.setContentText(Data.getBttvVersion(this) + " -> " + newVersion)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(
PendingIntent.getActivity(
this,
0,
Updater.updateActivityIndent(this, newVersion, body, apkUrl)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK),
0
)
)
.setAutoCancel(true);

notificationManager.notify((int) (Math.random() * 10000), notifBuilder.build());
if (ContextCompat.checkSelfPermission(this, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED) {
// Permission is granted, proceed with notification
NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this);
Notifications.createChannels(this);

NotificationCompat.Builder notifBuilder = new NotificationCompat.Builder(this, "bttv_android_updates")
.setSmallIcon(icon)
.setContentTitle("bttv-android update detected")
.setContentText(Data.getBttvVersion(this) + " -> " + newVersion)
.setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setContentIntent(
PendingIntent.getActivity(
this,
0,
Updater.updateActivityIndent(this, newVersion, body, apkUrl)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK),
PendingIntent.FLAG_IMMUTABLE
)
)
.setAutoCancel(true);

notificationManager.notify((int) (Math.random() * 10000), notifBuilder.build());
} else {
Log.w("LBTTVUpdaterJob", "Permissions are not allowed, not showing notification");
// Twitch already asks on startup, we do not need to take care of this
}
jobFinished(params, false);
} catch (Throwable e) {
Log.e("LBTTVUpdaterJob", "err creating notif ", e);
Expand Down
2 changes: 1 addition & 1 deletion mod/app/src/main/res/values-pt/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<string name="bttv_updater_notice">Se esta é a primeira vez que você utiliza o atualizador, permita instalações desta fonte quando o assistente lhe pedir.</string>
<string name="bttv_updater_manual_update_start_toast">Verificando por atualizações…</string>
<string name="bttv_updater_manual_update_no_update_toast">Nenhuma atualização disponível</string>
<string name="bttv_updater_manual_update_update_toast">Atualização disponivel!</string>
<string name="bttv_updater_manual_update_update_toast">Atualização disponível!</string>
<string name="bttv_updater_manual_update_error_toast">Ocorreu um erro</string>
<string name="bttv_settings_open_highlights_dia_primary">Definir Palavras-Chave de Destaque</string>
<string name="bttv_settings_open_highlights_dia_secondary">Abrir Dialogo de Palavras-Chave</string>
Expand Down
2 changes: 1 addition & 1 deletion mod/app/src/test/java/bttv/mod/TokenizerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import bttv.Tokenizer;
import bttv.emote.Emote;
import bttv.emote.Emotes;
import tv.twitch.android.models.chat.AutoModMessageFlags;
import tv.twitch.android.shared.chat.pub.model.messages.MessageToken;
import tv.twitch.android.shared.chat.pub.model.messages.AutoModMessageFlags;

import static org.junit.Assert.*;
import static org.mockito.Mockito.when;
Expand Down
2 changes: 1 addition & 1 deletion mod/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.3"
classpath "com.android.tools.build:gradle:7.4.0"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
23 changes: 10 additions & 13 deletions mod/consumer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ plugins {
}

android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
compileSdkVersion 33
buildToolsVersion "33.0.0"

defaultConfig {
applicationId "app.consumer"
minSdkVersion 21
targetSdkVersion 30
minSdkVersion 23
targetSdkVersion 33
versionCode 1
versionName "1.0"

Expand All @@ -22,21 +22,18 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace "app.consumer"
}

dependencies {
def GLIDE_VERSION = "4.12.0"
// glide 4.10.0+
implementation "com.github.bumptech.glide:glide:${GLIDE_VERSION}"
annotationProcessor "com.github.bumptech.glide:compiler:${GLIDE_VERSION}"
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.appcompat:appcompat:1.6.0'
implementation 'com.google.android.material:material:1.9.0'
implementation project(path: ':app')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
7 changes: 4 additions & 3 deletions mod/consumer/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="app.consumer">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand All @@ -9,7 +8,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.BTTV">
<activity android:name=".MainActivity">
<activity
android:name=".MainActivity"
android:exported="True">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
2 changes: 1 addition & 1 deletion mod/consumer/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
2 changes: 1 addition & 1 deletion mod/consumer/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>
2 changes: 1 addition & 1 deletion mod/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading