Compare commits
21
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b614f786d | ||
|
|
f3fda343d2 | ||
|
|
5c95ae3dd0 | ||
|
|
d1eed0fbd5 | ||
|
|
30886adc62 | ||
|
|
c441823d94 | ||
|
|
090c82dd40 | ||
|
|
a7a5a3cd4c | ||
|
|
24c41e5a6d | ||
|
|
22e12b6422 | ||
|
|
0efdefb207 | ||
|
|
80d2045fbb | ||
|
|
7bb0d69a96 | ||
|
|
96d71394fd | ||
|
|
371f9ae4a6 | ||
|
|
9d8533e066 | ||
|
|
84d2d583a3 | ||
|
|
f2c73c6ede | ||
|
|
59e92e30f2 | ||
|
|
be1bc8efbb | ||
|
|
e576fa0be5 |
+4
-2
@@ -77,10 +77,11 @@ android {
|
||||
targetSdkVersion 32
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
multiDexEnabled false
|
||||
multiDexEnabled true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
coreLibraryDesugaringEnabled true
|
||||
sourceCompatibility JavaVersion.VERSION_11
|
||||
targetCompatibility JavaVersion.VERSION_11
|
||||
}
|
||||
@@ -88,8 +89,9 @@ android {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
|
||||
implementation 'net.sourceforge.streamsupport:streamsupport-minifuture:1.7.4'
|
||||
implementation 'com.google.android.material:material:1.6.1'
|
||||
implementation 'androidx.exifinterface:exifinterface:1.3.3'
|
||||
implementation 'androidx.preference:preference:1.2.0'
|
||||
implementation fileTree(dir: 'libs', include: ['*.aar'])
|
||||
compileOnly fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
@@ -50,18 +50,30 @@ public class AudioDownloader {
|
||||
var downloadPath = musicPath + File.separator + tempId;
|
||||
|
||||
var notification = buildDownloadNotification(track, tempId);
|
||||
|
||||
|
||||
downloadM3U8(track, downloadPath, new Callback() {
|
||||
long startTime = 0;
|
||||
long elapsedTime = 0;
|
||||
|
||||
@Override
|
||||
public void onProgress(int progress) {
|
||||
notification.setProgress(100, progress, false);
|
||||
notificationManager.notify(tempId, notification.build());
|
||||
if (elapsedTime > 1000) {
|
||||
notification.setProgress(100, progress, false);
|
||||
notificationManager.notify(tempId, notification.build());
|
||||
|
||||
startTime = System.currentTimeMillis();
|
||||
elapsedTime = 0;
|
||||
} else {
|
||||
elapsedTime = System.currentTimeMillis() - startTime;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
try {
|
||||
var fileName = track.toString();
|
||||
var success = FFMpeg.convert(downloadPath, musicPath + File.separator + fileName + ".mp3");
|
||||
var success = FFMpeg.convert(downloadPath, musicPath + File.separator + fileName + ".mp3", track);
|
||||
if (success) {
|
||||
notification
|
||||
.setContentText(AndroidUtils.getString("player_download_finished"))
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package ru.vtosters.lite.feature.discover;
|
||||
|
||||
import com.vk.dto.discover.DiscoverItem;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class DiscoverTemplates {
|
||||
public static ArrayList<String> getTemplates() {
|
||||
var templates = DiscoverItem.Template.values();
|
||||
var arrayList = new ArrayList<String>();
|
||||
|
||||
for (var template : templates) {
|
||||
if (template != DiscoverItem.Template.GRID_MEDIA) {
|
||||
arrayList.add(template.b());
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package ru.vtosters.lite.feature.music;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.vk.music.fragment.MusicFragment;
|
||||
|
||||
public class MusicArtistSelectorHook {
|
||||
public static void navigateToSearch(Context context, String artist) {
|
||||
var fr = new MusicFragment.f();
|
||||
fr.a(artist);
|
||||
|
||||
// navigate
|
||||
fr.a(context);
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,6 @@ import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.exifinterface.media.ExifInterface;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
|
||||
@@ -165,7 +163,7 @@ public class FoafBase {
|
||||
}
|
||||
|
||||
private static String getNormalHumanDate(String str) {
|
||||
String[] split = str.split(ExifInterface.GPS_DIRECTION_TRUE);
|
||||
String[] split = str.split("T");
|
||||
return split[1].split("\\+")[0] + " " + split[0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -447,7 +447,7 @@ public class JsonInjectors {
|
||||
}
|
||||
|
||||
public static JSONObject fetchCatalogId(String section) {
|
||||
if (section == null) return null;
|
||||
if (section.isEmpty()) return null;
|
||||
|
||||
var request = new Request.a()
|
||||
.b("https://" + getApi() + "/method/catalog.getAudio"
|
||||
|
||||
@@ -14,7 +14,6 @@ import android.preference.PreferenceManager;
|
||||
import com.vk.core.concurrent.VkExecutors;
|
||||
|
||||
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
|
||||
import ru.vtosters.lite.ui.dialogs.DisableBattery;
|
||||
import ru.vtosters.lite.ui.dialogs.InstallGMS;
|
||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||
@@ -22,8 +21,11 @@ import ru.vtosters.lite.ui.dialogs.ServerDialog;
|
||||
import ru.vtosters.lite.ui.dialogs.Start;
|
||||
import ru.vtosters.lite.utils.DeletedMessagesHandler;
|
||||
|
||||
public class MainActivityInjector{
|
||||
public static void inject(Activity activity){
|
||||
/**
|
||||
* @
|
||||
*/
|
||||
public class MainActivityInjector {
|
||||
public static void inject(Activity activity) {
|
||||
setNeededTheme(activity);
|
||||
ServerDialog.activity = activity;
|
||||
sendRequest();
|
||||
@@ -36,7 +38,7 @@ public class MainActivityInjector{
|
||||
.edit()
|
||||
.putBoolean("isdark", isDarkTheme())
|
||||
.commit();
|
||||
SystemThemeChangerHook.onThemeChanged(activity.getResources().getConfiguration());
|
||||
|
||||
|
||||
VkExecutors.x.q().a(() -> {
|
||||
getInstance().autoCleaningCache();
|
||||
|
||||
@@ -7,6 +7,7 @@ import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.autotranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.savemsgsett;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
@@ -16,6 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.vtosters.lite.translators.BaseTranslator;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
public class MessagesHook {
|
||||
public static String injectOwnText(String oldText) {
|
||||
@@ -72,6 +74,14 @@ public class MessagesHook {
|
||||
});
|
||||
}
|
||||
|
||||
public static Context fixCTX(Context ctx) {
|
||||
if (ctx == null){
|
||||
return LifecycleUtils.getCurrentActivity();
|
||||
} else {
|
||||
return ctx;
|
||||
}
|
||||
}
|
||||
|
||||
public static void injRequest(MethodCall.a req) {
|
||||
var time = expireTime();
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package ru.vtosters.lite.hooks;
|
||||
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsslider;
|
||||
@@ -10,6 +11,9 @@ import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.PowerManager;
|
||||
|
||||
import com.vk.core.preference.Preference;
|
||||
import com.vtosters.lite.api.ExtendedCommunityProfile;
|
||||
|
||||
@@ -122,4 +126,10 @@ public class NewsfeedHook {
|
||||
hashSet.add("ads_post_pretty_cards");
|
||||
hashSet.add("ads_post_snippet_video");
|
||||
}
|
||||
|
||||
public static boolean isPowerSaveMode() {
|
||||
var pw = (PowerManager) getGlobalContext().getSystemService(Context.POWER_SERVICE);
|
||||
|
||||
return !getBoolValue("force_disable_psm", false) && pw.isPowerSaveMode();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,17 +6,24 @@ import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class SystemThemeChangerHook {
|
||||
private static int latestTheme = 0;
|
||||
|
||||
public static void onThemeChanged(Configuration configuration) {
|
||||
if (Preferences.systemtheme()) {
|
||||
switch (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK) {
|
||||
var theme = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (theme == latestTheme) return;
|
||||
|
||||
switch (theme) {
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
// Night mode is active, we're using dark theme
|
||||
ThemesUtils.applyTheme(ThemesUtils.getDarkTheme());
|
||||
latestTheme = theme;
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
case Configuration.UI_MODE_NIGHT_UNDEFINED:
|
||||
// Night mode is not active, we're using light theme
|
||||
ThemesUtils.applyTheme(ThemesUtils.getLightTheme());
|
||||
latestTheme = theme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
package ru.vtosters.lite.music;
|
||||
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import com.arthenica.ffmpegkit.FFmpegKit;
|
||||
import com.arthenica.ffmpegkit.ReturnCode;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.IOUtils;
|
||||
@@ -46,35 +51,81 @@ public class FFMpeg {
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean convert(String in, String out) {
|
||||
public static boolean convert(String in, String out, MusicTrack track) {
|
||||
checkFFMpegLibs();
|
||||
|
||||
// write the list of all .ts files to a txt file in "in" directory
|
||||
var list = new File(in);
|
||||
var listFile = new File(list, "list.txt");
|
||||
try {
|
||||
listFile.createNewFile();
|
||||
var writer = new java.io.FileWriter(listFile);
|
||||
for (var file : list.listFiles()) {
|
||||
if (file.getName().endsWith(".ts")) {
|
||||
writer.write("file " + file.getName() + "\n");
|
||||
var tsesList = new File(in).listFiles();
|
||||
|
||||
if (tsesList == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var mergedTsFile = new File(in, "all.ts");
|
||||
var mergedByteArrayStream = new ByteArrayOutputStream();
|
||||
|
||||
Arrays.sort(tsesList, (o1, o2) -> {
|
||||
var index1 = Integer.parseInt(o1.getName().split("-")[1]);
|
||||
var index2 = Integer.parseInt(o2.getName().split("-")[1]);
|
||||
return index1 - index2;
|
||||
});
|
||||
|
||||
for (var file : tsesList) {
|
||||
if (file.getName().endsWith(".ts")) {
|
||||
try {
|
||||
mergedByteArrayStream.write(IOUtils.readAllBytes(file));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
writer.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
try {
|
||||
Files.write(mergedTsFile.toPath(), mergedByteArrayStream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
try (FileOutputStream fos = new FileOutputStream(mergedTsFile)) {
|
||||
fos.write(mergedByteArrayStream.toByteArray());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// concatenate .ts files to a single .ts file
|
||||
FFmpegKit.execute("-f concat -safe 0 -i " + in + "/list.txt -c copy " + in + "/all.ts");
|
||||
|
||||
// convert .ts file to .mp3 file via ffmpeg
|
||||
var session = FFmpegKit.execute("-i " + in + "/all.ts -f mp3 -acodec mp3 -q:a 0 -y '" + out + "'");
|
||||
var sb = new StringBuilder();
|
||||
sb.append("-y -i ").append(in).append("/all.ts -map 0 -dn ");
|
||||
sb.append(" -loglevel error");
|
||||
sb.append(" -hide_banner");
|
||||
if (track.f != null) {
|
||||
sb.append(" -metadata title='").append(track.f).append("'");
|
||||
}
|
||||
if (track.C != null) {
|
||||
sb.append(" -metadata artist='").append(track.C).append("'");
|
||||
}
|
||||
if (track.I != null) {
|
||||
sb.append(" -metadata album='").append(track.I.getTitle()).append("'");
|
||||
}
|
||||
//
|
||||
// if (track.L != null) {
|
||||
// var artists = track.L.stream().map(Artist::w1).reduce((s, s2) -> s + ", " + s2).orElse("");
|
||||
// sb.append(" -metadata artist='").append(artists).append("'");
|
||||
// }
|
||||
|
||||
sb.append(" -c copy '").append(out).append("'");
|
||||
|
||||
var command = sb.toString();
|
||||
|
||||
var session = FFmpegKit.execute(command);
|
||||
var rc = session.getReturnCode();
|
||||
|
||||
IOUtils.deleteRecursive(new File(in));
|
||||
if (ReturnCode.isSuccess(rc)) {
|
||||
// remove temp files
|
||||
IOUtils.deleteRecursive(new File(in));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
package ru.vtosters.lite.music;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
|
||||
import java8.util.concurrent.CompletableFuture;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
@@ -40,31 +41,40 @@ public class M3UDownloader {
|
||||
}
|
||||
|
||||
private static void parse(String payload, File outDir, Callback callback) {
|
||||
try {
|
||||
VKM3UParser parser = new VKM3UParser(payload);
|
||||
List<TransportStream> tses = parser.getTransportStreams();
|
||||
callback.onProgress(5);
|
||||
for (TransportStream ts : tses) {
|
||||
String tsURL = parser.getBaseUrl() + ts.getName();
|
||||
Log.d("M3UDownloader", "Downloading " + tsURL);
|
||||
InputStream is = IOUtils.openStream(tsURL);
|
||||
byte[] content;
|
||||
if (TransportStream.METHOD_AES128.equals(ts.getMethod())) {
|
||||
String key = IOUtils.readAllLines(IOUtils.openStream(ts.getKeyURL()));
|
||||
content = IOUtils.decodeStream(is, key);
|
||||
} else {
|
||||
content = IOUtils.readAllBytes(is);
|
||||
VKM3UParser parser = new VKM3UParser(payload);
|
||||
List<TransportStream> tses = parser.getTransportStreams();
|
||||
AtomicInteger progress = new AtomicInteger(0);
|
||||
List<CompletableFuture<Void>> futures = new ArrayList<>();
|
||||
|
||||
callback.onProgress(5);
|
||||
for (TransportStream ts : tses) {
|
||||
String tsURL = parser.getBaseUrl() + ts.getName();
|
||||
|
||||
futures.add(CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
// Log.d("M3UDownloader", "Downloading " + tsURL);
|
||||
InputStream is = IOUtils.openStream(tsURL);
|
||||
byte[] content;
|
||||
if (TransportStream.METHOD_AES128.equals(ts.getMethod())) {
|
||||
String key = IOUtils.readAllLines(IOUtils.openStream(ts.getKeyURL()));
|
||||
content = IOUtils.decodeStream(is, key);
|
||||
} else {
|
||||
content = IOUtils.readAllBytes(is);
|
||||
}
|
||||
File tsDump = new File(outDir, ts.getName());
|
||||
IOUtils.writeToFile(tsDump, content);
|
||||
callback.onSizeReceived((long) content.length * tses.size(), parser.getHeapSize());
|
||||
} catch (IOException | NoSuchPaddingException | NoSuchAlgorithmException | InvalidAlgorithmParameterException | InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
callback.onFailure();
|
||||
}
|
||||
File tsDump = new File(outDir, ts.getName());
|
||||
IOUtils.writeToFile(tsDump, content);
|
||||
callback.onSizeReceived((long) content.length * tses.size(), parser.getHeapSize());
|
||||
callback.onProgress(10 + Math.round(80.0f * tses.indexOf(ts) / tses.size()));
|
||||
}
|
||||
} catch (IOException | NoSuchPaddingException | NoSuchAlgorithmException | InvalidAlgorithmParameterException | InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
callback.onFailure();
|
||||
return;
|
||||
}).thenRun(() -> callback.onProgress(10 + Math.round(80.0f * progress.addAndGet(1) / tses.size()))));
|
||||
}
|
||||
// wait for all futures
|
||||
for (var future: futures) {
|
||||
future.join();
|
||||
}
|
||||
|
||||
callback.onSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import android.app.Activity;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
|
||||
import ru.vtosters.lite.hooks.VKUIHook;
|
||||
|
||||
public class ThemeChanging{
|
||||
public static void changeTheme(Activity activity, float[] f){
|
||||
if (getBoolValue("systemtheme", true)) {
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle("Внимание!")
|
||||
.setMessage("У вас включена системная тема \n" +
|
||||
"При переключении темы системная тема будет отключена \n\n" +
|
||||
"Вы действительно хотите отключить её?")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Отключить", (dialogInterface, i) -> {
|
||||
edit().putBoolean("systemtheme", false).commit();
|
||||
VKThemeHelper.b(activity, f);
|
||||
VKUIHook.clearWebCache();
|
||||
})
|
||||
.setNeutralButton("Отмена", null)
|
||||
.show();
|
||||
} else {
|
||||
VKThemeHelper.b(activity, f);
|
||||
VKUIHook.clearWebCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,12 +59,12 @@ public class ExternalLinkParser {
|
||||
|
||||
if (checkVkVideo(file)) {
|
||||
if (qualities.size() == 1) {
|
||||
startExternalVideo((String) qualities.values().toArray()[0]);
|
||||
startExternalVideo((String) qualities.values().toArray()[0], context);
|
||||
} else {
|
||||
String[] titles = qualities.keySet().toArray(new String[0]);
|
||||
new AlertDialog.Builder(context)
|
||||
.setItems(titles, ((dialog, which) -> {
|
||||
startExternalVideo(qualities.get(titles[which]));
|
||||
startExternalVideo(qualities.get(titles[which]), context);
|
||||
}))
|
||||
.show();
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class ExternalLinkParser {
|
||||
return qualities.size() > 0;
|
||||
}
|
||||
|
||||
public static boolean startExternalVideo(String url) {
|
||||
public static boolean startExternalVideo(String url, Context ctx) {
|
||||
try {
|
||||
qualities.clear();
|
||||
|
||||
@@ -136,7 +136,7 @@ public class ExternalLinkParser {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
}
|
||||
getGlobalContext().startActivity(intent);
|
||||
ctx.startActivity(intent);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -26,7 +26,10 @@ public class IOUtils {
|
||||
|
||||
public static byte[] decodeStream(InputStream encIs, String keyURL) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException, IOException {
|
||||
CipherInputStream cip = new CipherInputStream(encIs, getCipher(keyURL));
|
||||
return readAllBytes(cip);
|
||||
var bytes = readAllBytes(cip);
|
||||
cip.close();
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static Cipher getCipher(String key) throws NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException, InvalidKeyException {
|
||||
@@ -46,7 +49,11 @@ public class IOUtils {
|
||||
}
|
||||
|
||||
public static String readAllLines(File file) throws IOException {
|
||||
return readAllLines(new FileInputStream(file));
|
||||
var is = new FileInputStream(file);
|
||||
var bytes = readAllBytes(is);
|
||||
is.close();
|
||||
|
||||
return new String(bytes, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
public static String readAllLines(InputStream is) throws IOException {
|
||||
@@ -54,7 +61,11 @@ public class IOUtils {
|
||||
}
|
||||
|
||||
public static byte[] readAllBytes(File file) throws IOException {
|
||||
return readAllBytes(new FileInputStream(file));
|
||||
var is = new FileInputStream(file);
|
||||
var bytes = readAllBytes(is);
|
||||
is.close();
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static byte[] readAllBytes(InputStream is) throws IOException {
|
||||
@@ -63,7 +74,11 @@ public class IOUtils {
|
||||
int len;
|
||||
while ((len = is.read(buffer)) > 0)
|
||||
bos.write(buffer, 0, len);
|
||||
return bos.toByteArray();
|
||||
|
||||
var bytes = bos.toByteArray();
|
||||
bos.close();
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static void writeToFile(File file, String content) throws IOException {
|
||||
@@ -73,6 +88,7 @@ public class IOUtils {
|
||||
public static void writeToFile(File file, byte[] content) throws IOException {
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
fos.write(content);
|
||||
fos.close();
|
||||
}
|
||||
|
||||
public static void deleteRecursive(File f) {
|
||||
|
||||
@@ -46,7 +46,14 @@ public class ThemesUtils {
|
||||
);
|
||||
|
||||
public static void applyTheme(VKTheme theme) {
|
||||
VKThemeHelper.theme(theme, LifecycleUtils.getCurrentActivity(), getCenterScreenCoords());
|
||||
var currentActivity = LifecycleUtils.getCurrentActivity();
|
||||
if (currentActivity != null) {
|
||||
try {
|
||||
VKThemeHelper.theme(theme, currentActivity, getCenterScreenCoords());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} // Apply VKTheme and ImTheme (hard applying without dynamic theme changing)
|
||||
|
||||
public static void setTheme(VKTheme theme, Activity activity) {
|
||||
@@ -326,20 +333,21 @@ public class ThemesUtils {
|
||||
}
|
||||
|
||||
public static void setNeededTheme(Activity activity) {
|
||||
var currentTheme = getCurrentTheme();
|
||||
if (milkshake()) {
|
||||
if (getCurrentTheme() == VKTheme.VKAPP_LIGHT) {
|
||||
if (currentTheme == VKTheme.VKAPP_LIGHT) {
|
||||
setTheme(VKTheme.VKAPP_MILK_LIGHT, activity);
|
||||
}
|
||||
|
||||
if (getCurrentTheme() == VKTheme.VKAPP_DARK) {
|
||||
if (currentTheme == VKTheme.VKAPP_DARK) {
|
||||
setTheme(VKTheme.VKAPP_MILK_DARK, activity);
|
||||
}
|
||||
} else {
|
||||
if (getCurrentTheme() == VKTheme.VKAPP_MILK_LIGHT) {
|
||||
if (currentTheme == VKTheme.VKAPP_MILK_LIGHT) {
|
||||
setTheme(VKTheme.VKAPP_LIGHT, activity);
|
||||
}
|
||||
|
||||
if (getCurrentTheme() == VKTheme.VKAPP_MILK_DARK) {
|
||||
if (currentTheme == VKTheme.VKAPP_MILK_DARK) {
|
||||
setTheme(VKTheme.VKAPP_DARK, activity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,5 +136,10 @@
|
||||
android:key="donotgetads"
|
||||
android:summary="Не запрашивать рекламу и рекомендации\n\nМогуть быть проблемы"
|
||||
android:title="Не пытаться получать рекламу" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="force_disable_psm"
|
||||
android:summary="Включение этой функции скроет информацию о состоянии вашего устройства в режиме экономии батареи и ВКонтакте будет отправлять вам медиаконтент без сильного сжатия и блюра"
|
||||
android:title="Не отправлять информацию о батарее" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
@@ -28,42 +28,50 @@
|
||||
|
||||
iput-object p1, p0, Lcom/vk/api/discover/DiscoverCategoriesGet;->F:Lcom/vk/dto/discover/DiscoverIntent;
|
||||
|
||||
# .line 2
|
||||
# invoke-static {}, Lcom/vk/dto/discover/DiscoverItem$Template;->values()[Lcom/vk/dto/discover/DiscoverItem$Template;
|
||||
#
|
||||
# move-result-object p1
|
||||
#
|
||||
# .line 3
|
||||
# new-instance v0, Ljava/util/ArrayList;
|
||||
#
|
||||
# array-length v1, p1
|
||||
#
|
||||
# invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V
|
||||
#
|
||||
# .line 4
|
||||
# array-length v1, p1
|
||||
#
|
||||
# const/4 v2, 0x0
|
||||
#
|
||||
# const/4 v3, 0x0
|
||||
#
|
||||
# :goto_0
|
||||
# if-ge v3, v1, :cond_0
|
||||
#
|
||||
# aget-object v4, p1, v3
|
||||
#
|
||||
# .line 5
|
||||
# invoke-virtual {v4}, Lcom/vk/dto/discover/DiscoverItem$Template;->b()Ljava/lang/String;
|
||||
#
|
||||
# move-result-object v4
|
||||
#
|
||||
# invoke-interface {v0, v4}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
||||
#
|
||||
# add-int/lit8 v3, v3, 0x1
|
||||
#
|
||||
# goto :goto_0
|
||||
#
|
||||
# :cond_0
|
||||
|
||||
.line 2
|
||||
invoke-static {}, Lcom/vk/dto/discover/DiscoverItem$Template;->values()[Lcom/vk/dto/discover/DiscoverItem$Template;
|
||||
# ru.vtosters.lite.feature.discover.DiscoverTemplates. ArrayList<DiscoverItem.Template> getTemplates()
|
||||
|
||||
move-result-object p1
|
||||
invoke-static {}, Lru/vtosters/lite/feature/discover/DiscoverTemplates;->getTemplates()Ljava/util/ArrayList;
|
||||
|
||||
.line 3
|
||||
new-instance v0, Ljava/util/ArrayList;
|
||||
move-result-object v0
|
||||
|
||||
array-length v1, p1
|
||||
|
||||
invoke-direct {v0, v1}, Ljava/util/ArrayList;-><init>(I)V
|
||||
|
||||
.line 4
|
||||
array-length v1, p1
|
||||
|
||||
const/4 v2, 0x0
|
||||
|
||||
const/4 v3, 0x0
|
||||
|
||||
:goto_0
|
||||
if-ge v3, v1, :cond_0
|
||||
|
||||
aget-object v4, p1, v3
|
||||
|
||||
.line 5
|
||||
invoke-virtual {v4}, Lcom/vk/dto/discover/DiscoverItem$Template;->b()Ljava/lang/String;
|
||||
|
||||
move-result-object v4
|
||||
|
||||
invoke-interface {v0, v4}, Ljava/util/Collection;->add(Ljava/lang/Object;)Z
|
||||
|
||||
add-int/lit8 v3, v3, 0x1
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
const-string p1, ","
|
||||
|
||||
invoke-static {p1, v0}, Landroid/text/TextUtils;->join(Ljava/lang/CharSequence;Ljava/lang/Iterable;)Ljava/lang/String;
|
||||
|
||||
@@ -814,6 +814,11 @@
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
|
||||
invoke-static {}, Lru/vtosters/lite/feature/discover/DiscoverTemplates;->getTemplates()Ljava/util/ArrayList;
|
||||
|
||||
move-result-object v1
|
||||
|
||||
const-string v0, ","
|
||||
|
||||
invoke-static {v0, v1}, Landroid/text/TextUtils;->join(Ljava/lang/CharSequence;Ljava/lang/Iterable;)Ljava/lang/String;
|
||||
|
||||
@@ -814,7 +814,13 @@
|
||||
.method private final e(Landroid/view/View;)Z
|
||||
.locals 1
|
||||
|
||||
.line 2
|
||||
if-nez p1, :cond_1
|
||||
|
||||
const/4 p1, 0x0
|
||||
|
||||
return p1
|
||||
|
||||
:cond_1
|
||||
sget v0, Lcom/vk/core/ui/themes/ThemeBinder;->b:I
|
||||
|
||||
invoke-virtual {p1, v0}, Landroid/view/View;->getTag(I)Ljava/lang/Object;
|
||||
|
||||
@@ -788,6 +788,11 @@
|
||||
|
||||
.line 99
|
||||
:cond_0
|
||||
if-nez p0, :cond_1
|
||||
|
||||
return-void
|
||||
|
||||
:cond_1
|
||||
sget-object v0, Lcom/vk/core/ui/themes/VKThemeHelper;->k:Lcom/vk/core/ui/themes/VKThemeHelper;
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/core/ui/themes/VKThemeHelper;->m()Lcom/vk/core/ui/themes/ThemeBinder;
|
||||
|
||||
@@ -1072,12 +1072,16 @@
|
||||
value = 0x15
|
||||
.end annotation
|
||||
|
||||
.line 1
|
||||
invoke-direct {p0}, Lcom/vk/core/util/DeviceState;->M()Landroid/os/PowerManager;
|
||||
# .line 1
|
||||
# invoke-direct {p0}, Lcom/vk/core/util/DeviceState;->M()Landroid/os/PowerManager;
|
||||
|
||||
move-result-object v0
|
||||
# move-result-object v0
|
||||
|
||||
invoke-virtual {v0}, Landroid/os/PowerManager;->isPowerSaveMode()Z
|
||||
# invoke-virtual {v0}, Landroid/os/PowerManager;->isPowerSaveMode()Z
|
||||
|
||||
# move-result v0
|
||||
|
||||
invoke-static {}, Lru/vtosters/lite/hooks/NewsfeedHook;->isPowerSaveMode()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
|
||||
@@ -4409,6 +4409,10 @@
|
||||
|
||||
move-result-object v6
|
||||
|
||||
invoke-static {v6}, Lru/vtosters/lite/hooks/MessagesHook;->fixCTX(Landroid/content/Context;)Landroid/content/Context;
|
||||
|
||||
move-result-object v6
|
||||
|
||||
iput-object v6, p0, Lcom/vk/im/ui/fragments/ChatFragment;->L:Landroid/content/Context;
|
||||
|
||||
.line 8
|
||||
@@ -6119,6 +6123,10 @@
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/im/ui/fragments/ChatFragment;->L:Landroid/content/Context;
|
||||
|
||||
invoke-static {v0}, Lru/vtosters/lite/hooks/MessagesHook;->fixCTX(Landroid/content/Context;)Landroid/content/Context;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
const/4 v1, 0x0
|
||||
|
||||
if-eqz v0, :cond_1
|
||||
|
||||
@@ -7272,10 +7272,14 @@
|
||||
.method public final setUIVisibility(Z)V
|
||||
.locals 7
|
||||
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/libvideo/ui/VideoView;->n0:Landroid/os/PowerManager;
|
||||
# .line 1
|
||||
# iget-object v0, p0, Lcom/vk/libvideo/ui/VideoView;->n0:Landroid/os/PowerManager;
|
||||
|
||||
invoke-virtual {v0}, Landroid/os/PowerManager;->isPowerSaveMode()Z
|
||||
# invoke-virtual {v0}, Landroid/os/PowerManager;->isPowerSaveMode()Z
|
||||
|
||||
# move-result v0
|
||||
|
||||
invoke-static {}, Lru/vtosters/lite/hooks/NewsfeedHook;->isPowerSaveMode()Z
|
||||
|
||||
move-result v0
|
||||
|
||||
|
||||
+11
-8
@@ -83,15 +83,18 @@
|
||||
.locals 1
|
||||
|
||||
.line 21
|
||||
new-instance v0, Lcom/vk/music/search/MusicSearchFragment$a;
|
||||
# ru.vtosters.lite.feature.music.MusicArtistSelectorHook.navigateToSearch(Context context, String artist)
|
||||
invoke-static {p1, p2}, Lru/vtosters/lite/feature/music/MusicArtistSelectorHook;->navigateToSearch(Landroid/content/Context;Ljava/lang/String;)V
|
||||
|
||||
invoke-direct {v0}, Lcom/vk/music/search/MusicSearchFragment$a;-><init>()V
|
||||
|
||||
.line 22
|
||||
invoke-virtual {v0, p2}, Lcom/vk/music/search/MusicSearchFragment$a;->b(Ljava/lang/String;)Lcom/vk/music/search/MusicSearchFragment$a;
|
||||
|
||||
.line 23
|
||||
invoke-virtual {v0, p1}, Lcom/vk/navigation/Navigator;->a(Landroid/content/Context;)V
|
||||
# new-instance v0, Lcom/vk/music/search/MusicSearchFragment$a;
|
||||
#
|
||||
# invoke-direct {v0}, Lcom/vk/music/search/MusicSearchFragment$a;-><init>()V
|
||||
#
|
||||
# .line 22
|
||||
# invoke-virtual {v0, p2}, Lcom/vk/music/search/MusicSearchFragment$a;->b(Ljava/lang/String;)Lcom/vk/music/search/MusicSearchFragment$a;
|
||||
#
|
||||
# .line 23
|
||||
# invoke-virtual {v0, p1}, Lcom/vk/navigation/Navigator;->a(Landroid/content/Context;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
@@ -242,9 +242,7 @@
|
||||
if-eqz v0, :cond_0
|
||||
|
||||
.line 6
|
||||
invoke-static {v0, p1}, Lcom/vk/core/ui/themes/VKThemeHelper;->b(Landroid/app/Activity;[F)V
|
||||
|
||||
invoke-static {}, Lru/vtosters/lite/hooks/VKUIHook;->clearWebCache()V
|
||||
invoke-static {v0, p1}, Lru/vtosters/lite/ui/dialogs/ThemeChanging;->changeTheme(Landroid/app/Activity;[F)V
|
||||
|
||||
:cond_0
|
||||
return-void
|
||||
|
||||
@@ -5871,12 +5871,14 @@
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/profile/ui/BaseProfileFragment;->P0:Landroid/view/View;
|
||||
|
||||
if-nez v0, :cond_229
|
||||
|
||||
return-void
|
||||
|
||||
:cond_229
|
||||
invoke-static {v0}, Lcom/vk/core/ui/themes/VKThemeHelper;->a(Landroid/view/View;)V
|
||||
|
||||
.line 2
|
||||
iget-object v0, p0, Lcom/vk/profile/ui/BaseProfileFragment;->P0:Landroid/view/View;
|
||||
|
||||
.line 3
|
||||
invoke-virtual {v0}, Landroid/view/View;->getContext()Landroid/content/Context;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
@@ -561,6 +561,18 @@
|
||||
invoke-virtual {p0, p1, v0}, Landroidx/fragment/app/FragmentActivity;->startActivityForResult(Landroid/content/Intent;I)V
|
||||
|
||||
:goto_1
|
||||
# ru.vtosters.lite.hooks.ui.SystemThemeChangerHook.onThemeChanged(activity.getResources().getConfiguration());
|
||||
|
||||
invoke-virtual {p0}, Lcom/vtosters/lite/MainActivity;->getResources()Landroid/content/res/Resources;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0}, Landroid/content/res/Resources;->getConfiguration()Landroid/content/res/Configuration;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-static {v0}, Lru/vtosters/lite/hooks/ui/SystemThemeChangerHook;->onThemeChanged(Landroid/content/res/Configuration;)V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
Reference in New Issue
Block a user