Compare commits
57
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 | ||
|
|
1e0e432d57 | ||
|
|
3a1c93d4d0 | ||
|
|
378e6192c7 | ||
|
|
67d0a4c88d | ||
|
|
d59297d348 | ||
|
|
1da12a02b6 | ||
|
|
9ceee0b3d9 | ||
|
|
281b4d9773 | ||
|
|
18714288d7 | ||
|
|
8ac098e4f8 | ||
|
|
eda5ab139e | ||
|
|
ab3221cc01 | ||
|
|
92d4ff2027 | ||
|
|
cedf5d263a | ||
|
|
08909baf2f | ||
|
|
383bafae92 | ||
|
|
c2661e11ec | ||
|
|
9c4ccce409 | ||
|
|
c1b2409baa | ||
|
|
54ee9f6c5b | ||
|
|
d83033e983 | ||
|
|
92c0369332 | ||
|
|
d796455bbe | ||
|
|
dc4743f2a3 | ||
|
|
94c8736bc1 | ||
|
|
e05255263b | ||
|
|
e916b5fcc8 | ||
|
|
09e0dbd01d | ||
|
|
84e5ce6dc2 | ||
|
|
2520b709bd | ||
|
|
0ed16b0836 | ||
|
|
6e55514edf | ||
|
|
93d515b423 | ||
|
|
b88ecd97fc | ||
|
|
5c1b39c79f | ||
|
|
bae7263554 |
@@ -69,12 +69,11 @@
|
||||
* Результаты опросов без участия
|
||||
* Возможность указывать папку для загрузки фото/видео/музыки/всего
|
||||
* Интеграция с <a href="https://www.last.fm/">LAST.FM</a> (а также возможность скробблинга)
|
||||
* Новый раздел музыки
|
||||
* Возможность скачивать видео, очищать историю просмотра видео
|
||||
* Возможность найти фотографию через поисковые системы
|
||||
* Интеграция с <a href="https://vkx.app/">VK X</a>
|
||||
* Сообщения
|
||||
* ~Обои в сообщениях~ (временно недоступно из-за проблем с производительностью)
|
||||
* Обои в сообщениях
|
||||
* Возможность выключения кнопки записи голосовых сообщений
|
||||
* Возможность скрыть блок рекомендаций в сообщениях
|
||||
* Режим **VK Me**
|
||||
|
||||
+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'])
|
||||
|
||||
@@ -54,7 +54,13 @@ public class LibVKXClient {
|
||||
return getInstance().runOnService(action);
|
||||
}
|
||||
|
||||
public static void lambdaplay(List<MusicTrack> list, MusicTrack musicTrack, ILibVkxService iLibVkxService) {
|
||||
public static void lambdaplay(List<MusicTrack> list, MusicTrack musicTrack, ILibVkxService iLibVkxService, MusicPlaybackLaunchContext playerRefer) {
|
||||
var playbackContext = "";
|
||||
|
||||
if (playerRefer != null) {
|
||||
playbackContext = playerRefer.v0();
|
||||
}
|
||||
|
||||
int indexOf = list.indexOf(musicTrack);
|
||||
var ids = new ArrayList<String>();
|
||||
for (var track : list) {
|
||||
@@ -65,12 +71,16 @@ public class LibVKXClient {
|
||||
}
|
||||
|
||||
try {
|
||||
iLibVkxService.play(ids, indexOf, "");
|
||||
iLibVkxService.play(ids, indexOf, playbackContext);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void lambdaplay(List<MusicTrack> list, MusicTrack musicTrack, ILibVkxService iLibVkxService){
|
||||
lambdaplay(list, musicTrack, iLibVkxService, null);
|
||||
}
|
||||
|
||||
private static String asId(MusicTrack musicTrack) {
|
||||
String str = musicTrack.e + "_" + musicTrack.d;
|
||||
if (musicTrack.O == null || musicTrack.O.equals("")) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -116,8 +117,10 @@ public class DNRInjector {
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNT_ON, 2, im_ic_edit_msg, getIdentifier("DNT_ON", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.DNT_OFF, 2, im_ic_edit_msg, getIdentifier("DNT_OFF", "string"))); // DialogAction, Int, Icon, String
|
||||
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT, 3, im_ic_keyboard, getIdentifier("encryption", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT_SETT, 3, im_ic_more_vertical, getIdentifier("encryption_sett", "string"))); // DialogAction, Int, Icon, String
|
||||
if (!isTablet()) {
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT, 3, im_ic_keyboard, getIdentifier("encryption", "string"))); // DialogAction, Int, Icon, String
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT_SETT, 3, im_ic_more_vertical, getIdentifier("encryption_sett", "string"))); // DialogAction, Int, Icon, String
|
||||
}
|
||||
|
||||
list.add(new DialogActionsListView.b.a(DialogAction.MARK_AS_READ, 4, im_ic_done, getIdentifier("vkim_dialogs_list_option_mark_as_read", "string"))); // DialogAction, Int, Icon, String
|
||||
|
||||
@@ -302,37 +305,40 @@ public class DNRInjector {
|
||||
}
|
||||
|
||||
public static boolean onClickMsg(Context context, MsgAction action, Msg msg) {
|
||||
var text = ((MsgFromUser) msg).f();
|
||||
var peerId = msg.v1();
|
||||
var fullMsg = ((MsgFromUser) msg).j2(); // text + reply
|
||||
var reply = fullMsg.substring(text.length() + 1);
|
||||
|
||||
if (action == MsgAction.valueOf("READTO")) {
|
||||
DNRModule.hookReadStartMsgTo(msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
var isTextExist = !text.isEmpty() && !text.equals(" ");
|
||||
var isReplyExist = !reply.isEmpty() && !reply.equals(" ");
|
||||
if (msg instanceof MsgFromUser){
|
||||
var text = ((MsgFromUser) msg).f();
|
||||
var fullMsg = ((MsgFromUser) msg).j2(); // text + reply
|
||||
var reply = fullMsg.substring(text.length() + 1);
|
||||
|
||||
var isTextExist = !text.isEmpty() && !text.equals(" ");
|
||||
var isReplyExist = !reply.isEmpty() && !reply.equals(" ");
|
||||
|
||||
|
||||
if (isReplyExist) {
|
||||
reply = decryptMessage(reply, peerId);
|
||||
}
|
||||
if (isReplyExist) {
|
||||
reply = decryptMessage(reply, peerId);
|
||||
}
|
||||
|
||||
if (isTextExist) {
|
||||
text = decryptMessage(text, peerId);
|
||||
}
|
||||
if (isTextExist) {
|
||||
text = decryptMessage(text, peerId);
|
||||
}
|
||||
|
||||
if (action == MsgAction.valueOf("TRANSLATE")) {
|
||||
if (isTextExist && isReplyExist) {
|
||||
Translate.showTranslatedText(context, text + "\n\n" + getString("translator_reply") + "\n" + reply);
|
||||
} else if (isReplyExist) {
|
||||
Translate.showTranslatedText(context, getString("translator_reply") + "\n" + reply);
|
||||
} else if (isTextExist) {
|
||||
Translate.showTranslatedText(context, text);
|
||||
} else {
|
||||
sendToast(getString("translator_no_text"));
|
||||
if (action == MsgAction.valueOf("TRANSLATE")) {
|
||||
if (isTextExist && isReplyExist) {
|
||||
Translate.showTranslatedText(context, text + "\n\n" + getString("translator_reply") + "\n" + reply);
|
||||
} else if (isReplyExist) {
|
||||
Translate.showTranslatedText(context, getString("translator_reply") + "\n" + reply);
|
||||
} else if (isTextExist) {
|
||||
Translate.showTranslatedText(context, text);
|
||||
} else {
|
||||
sendToast(getString("translator_no_text"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,30 +236,12 @@ public class JsonInjectors {
|
||||
}
|
||||
|
||||
public static JSONObject musiclink(JSONObject json) {
|
||||
var oldItems = json.optJSONArray("links");
|
||||
var section = json.optJSONObject("section");
|
||||
var linksblock = section.optJSONArray("blocks");
|
||||
var newBlock = new JSONArray();
|
||||
var links = json.optJSONArray("links");
|
||||
|
||||
if (oldItems != null) {
|
||||
if (oldItems.optJSONObject(0).optString("url").contains("?section=recent")) {
|
||||
if (links != null) {
|
||||
if (links.optJSONObject(0).optString("url").contains("?section=recent")) {
|
||||
json.remove("links");
|
||||
|
||||
for (int i = 0; i < linksblock.length(); i++) {
|
||||
var item = linksblock.optJSONObject(i);
|
||||
var datatype = item.optString("data_type");
|
||||
var layname = item.optJSONObject("layout").optString("name");
|
||||
if (!datatype.equals("links") && !layname.equals("separator")) {
|
||||
newBlock.put(item);
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
section.putOpt("blocks", newBlock);
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Removed links buttons");
|
||||
}
|
||||
}
|
||||
@@ -465,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"
|
||||
@@ -579,8 +561,6 @@ public class JsonInjectors {
|
||||
}
|
||||
|
||||
public static boolean haveDonateButton() {
|
||||
int randomshower = new Random().nextInt(6);
|
||||
|
||||
return hasVerification() || randomshower != 1;
|
||||
return hasVerification() || new Random().nextInt(6) != 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,9 +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();
|
||||
@@ -37,6 +39,7 @@ public class MainActivityInjector{
|
||||
.putBoolean("isdark", isDarkTheme())
|
||||
.commit();
|
||||
|
||||
|
||||
VkExecutors.x.q().a(() -> {
|
||||
getInstance().autoCleaningCache();
|
||||
}); // slowTasksScheduler
|
||||
|
||||
@@ -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,7 +6,6 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
|
||||
import static ru.vtosters.lite.utils.Preferences.videonewcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import com.vk.apps.AppsFragment;
|
||||
@@ -15,7 +14,6 @@ import com.vk.fave.fragments.FaveTabFragment;
|
||||
import com.vk.menu.MenuFragment;
|
||||
import com.vk.menu.SearchMenuFragment;
|
||||
import com.vk.music.fragment.MusicCatalogFragment1;
|
||||
import com.vk.music.fragment.MusicFragment;
|
||||
import com.vk.newsfeed.HomeFragment;
|
||||
import com.vk.newsfeed.NewsfeedFragment;
|
||||
import com.vk.notifications.NotificationsContainerFragment;
|
||||
@@ -47,13 +45,13 @@ public class StartFragmentHook {
|
||||
case "groups":
|
||||
return milkshake() ? CommunitiesCatalogFragment.class : GroupsFragment1.class;
|
||||
case "music":
|
||||
return getBoolValue("musicnewcatalog", true) ? MusicCatalogFragment1.class : MusicFragment.class;
|
||||
return MusicCatalogFragment1.class;
|
||||
case "friends":
|
||||
return FriendsFragment.class;
|
||||
case "photos":
|
||||
return PhotosFragment.class;
|
||||
case "videos":
|
||||
return videonewcatalog() ? VideoCatalogFragment.class : VideosFragment.class;
|
||||
return VideoCatalogFragment.class;
|
||||
case "settings":
|
||||
return useNewSettings();
|
||||
case "apps":
|
||||
|
||||
@@ -4,7 +4,6 @@ import static ru.vtosters.lite.utils.Preferences.feedcache;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.miniapps;
|
||||
import static ru.vtosters.lite.utils.Preferences.musicnewcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.postsredesign;
|
||||
import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
|
||||
@@ -133,8 +132,6 @@ public class TogglesHook {
|
||||
case FEATURE_MILKSHAKE_FORCE_DISABLED:
|
||||
case FEATURE_MILKSHAKE_ACTIVATION_DISABLED:
|
||||
return !milkshake();
|
||||
case FEATURE_MUSIC_NEW_CATALOG:
|
||||
return musicnewcatalog();
|
||||
case AB_NEWS_VIDEO_LAYOUT_TEXT:
|
||||
case FEATURE_COMPACT_REPOST:
|
||||
case EXPERIMENT_NEWS_VIDEO_LAYOUT_TEXT:
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package ru.vtosters.lite.hooks.ui;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vk.dto.music.Playlist;
|
||||
import com.vk.music.bottomsheets.a.MusicAction;
|
||||
import com.vk.music.common.MusicPlaybackLaunchContext;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
|
||||
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class MusicBottomSheetHook {
|
||||
public static ArrayList<MusicAction> hook(ArrayList<MusicAction> actions) {
|
||||
if (LibVKXClient.isVkxInstalled()) {
|
||||
actions.add(getPlayInVKXAction());
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
public static boolean tryPlayInVKX(int actionId, MusicTrack track, MusicPlaybackLaunchContext context, Playlist playlist) {
|
||||
if (actionId != AndroidUtils.getIdentifier("play_in_vkx", "id")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var trackList = new ArrayList<MusicTrack>();
|
||||
|
||||
if (playlist != null) {
|
||||
trackList.addAll(playlist.R);
|
||||
} else {
|
||||
trackList.add(track);
|
||||
}
|
||||
|
||||
LibVKXClientImpl.LibVKXAction action = iLibVkxService -> LibVKXClient.lambdaplay(trackList, track, iLibVkxService, context);
|
||||
return LibVKXClient.getInstance().runOnService(action);
|
||||
}
|
||||
|
||||
private static MusicAction getPlayInVKXAction() {
|
||||
return new MusicAction(
|
||||
AndroidUtils.getIdentifier("play_in_vkx", "id"),
|
||||
R.drawable.ic_music_24,
|
||||
AndroidUtils.getIdentifier("play_in_vkx", "string"),
|
||||
R.color.caption_gray,
|
||||
R.string.music_talkback_empty,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package ru.vtosters.lite.hooks.ui;
|
||||
|
||||
import android.content.res.Configuration;
|
||||
|
||||
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()) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,11 +24,13 @@ import com.aefyr.tsg.g2.TelegramStickersPack;
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
|
||||
import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.ui.components.IItemMovingListener;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.StickerPackViewHolder> {
|
||||
public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.StickerPackViewHolder> implements IItemMovingListener {
|
||||
private static final TelegramStickersService sService = TelegramStickersService.getInstance(getGlobalContext());
|
||||
|
||||
@SuppressLint("UseCompatLoadingForDrawables")
|
||||
@@ -62,6 +64,26 @@ public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.
|
||||
return sService.getPacksListReference().size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDismiss(int index) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemMove(int fromPosition, int toPosition) {
|
||||
if (fromPosition < toPosition) {
|
||||
for (int i = fromPosition; i < toPosition; i++) {
|
||||
sService.swap(sService.getPacksListReference().get(i), sService.getPacksListReference().get(i + 1));
|
||||
}
|
||||
} else {
|
||||
for (int i = fromPosition; i > toPosition; i--) {
|
||||
sService.swap(sService.getPacksListReference().get(i), sService.getPacksListReference().get(i - 1));
|
||||
}
|
||||
}
|
||||
notifyItemMoved(fromPosition, toPosition);
|
||||
return true;
|
||||
}
|
||||
|
||||
public class StickerPackViewHolder extends RecyclerView.ViewHolder {
|
||||
private final LinearLayout mContainer;
|
||||
private final ImageView mStickerPreview;
|
||||
|
||||
@@ -6,7 +6,6 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
|
||||
import static ru.vtosters.lite.utils.Preferences.videonewcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme_notifs;
|
||||
|
||||
@@ -20,7 +19,6 @@ import com.vk.friends.catalog.FriendsCatalogFragment;
|
||||
import com.vk.menu.MenuFragment;
|
||||
import com.vk.menu.SearchMenuFragment;
|
||||
import com.vk.music.fragment.MusicCatalogFragment1;
|
||||
import com.vk.music.fragment.MusicFragment;
|
||||
import com.vk.newsfeed.HomeFragment;
|
||||
import com.vk.newsfeed.NewsfeedFragment;
|
||||
import com.vk.notifications.NotificationsContainerFragment;
|
||||
@@ -203,14 +201,14 @@ public class DockBarEditorManager {
|
||||
R.drawable.ic_music_outline_28,
|
||||
R.string.music,
|
||||
R.id.menu_audios,
|
||||
getBoolValue("musicnewcatalog", true) ? MusicCatalogFragment1.class : MusicFragment.class);
|
||||
MusicCatalogFragment1.class);
|
||||
case "tab_videos":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_videos",
|
||||
R.drawable.ic_video_outline_28,
|
||||
R.string.videos,
|
||||
R.id.menu_videos,
|
||||
videonewcatalog() ? VideoCatalogFragment.class : VideosFragment.class);
|
||||
VideoCatalogFragment.class);
|
||||
case "tab_lives":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_lives",
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package ru.vtosters.lite.ui.components;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
public class StickerTouchHelperCallback extends ItemTouchHelper.Callback {
|
||||
private final IItemMovingListener itemAdapter;
|
||||
|
||||
public StickerTouchHelperCallback(IItemMovingListener adapter) {
|
||||
itemAdapter = adapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLongPressDragEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemViewSwipeEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMovementFlags(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder) {
|
||||
int dragFlags = ItemTouchHelper.UP | ItemTouchHelper.DOWN |
|
||||
ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT;
|
||||
|
||||
int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
|
||||
return makeMovementFlags(dragFlags, swipeFlags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMove(@NonNull RecyclerView recyclerView, @NonNull RecyclerView.ViewHolder viewHolder, @NonNull RecyclerView.ViewHolder target) {
|
||||
itemAdapter.onItemMove(viewHolder.getAdapterPosition(), target.getAdapterPosition());
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSwiped(@NonNull RecyclerView.ViewHolder viewHolder, int i) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,12 @@ package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
@@ -26,11 +29,20 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("swipe").setOnPreferenceClickListener(new restart());
|
||||
findPreference("is_likes_on_right").setOnPreferenceClickListener(new restart());
|
||||
|
||||
if (isTablet()){
|
||||
findPreference("menusett").setVisible(false);
|
||||
findPreference("swipe").setVisible(false);
|
||||
}
|
||||
|
||||
findPreference("customrounding").setOnPreferenceClickListener(preference -> {
|
||||
RoundingSeekbarDialog.dialog(getContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 33){
|
||||
findPreference("anim_rtrn_type").setVisible(false);
|
||||
}
|
||||
|
||||
if (getPreferences().getInt("pic_rounding", 0) == 0) {
|
||||
findPreference("customrounding").setSummary(AndroidUtils.getString("disabled"));
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.isVkxInstalled;
|
||||
import static ru.vtosters.lite.music.Scrobbler.isLoggedIn;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
@@ -9,6 +10,7 @@ import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
|
||||
@@ -33,6 +35,8 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -43,6 +47,7 @@ import ru.vtosters.lite.downloaders.VideoDownloader;
|
||||
import ru.vtosters.lite.music.Scrobbler;
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
private final int REQUEST_CODE_SET_DOWNLOAD_DIRECTORY = 665;
|
||||
@@ -71,7 +76,7 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
private void prefs() {
|
||||
findPreference("download_video").setOnPreferenceClickListener(new MediaFragment.download());
|
||||
findPreference("clearvideohistory").setOnPreferenceClickListener(preference -> {
|
||||
deleteVideoHistory();
|
||||
deleteVideoHistoryDialog(requireContext());
|
||||
return true;
|
||||
});
|
||||
findPreference("dateformat").setOnPreferenceChangeListener(new MediaFragment.restart());
|
||||
@@ -90,6 +95,10 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("lastfm_enabled").setEnabled(false);
|
||||
}
|
||||
|
||||
if (!isVkxInstalled()){
|
||||
findPreference("vkx_sett").setVisible(false);
|
||||
}
|
||||
|
||||
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
|
||||
var items = Arrays.asList(
|
||||
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("yandex", "drawable"), "Yandex"),
|
||||
@@ -178,8 +187,15 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
.a();
|
||||
|
||||
try {
|
||||
var response = new OkHttpClient().a(request).execute().a().g();
|
||||
Log.d("VideoHistory", response);
|
||||
var response = new JSONObject(new OkHttpClient().a(request).execute().a().g());
|
||||
|
||||
if (response.optInt("response") == 1){
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> sendToast(AndroidUtils.getString("video_history_cleaned")));
|
||||
} else {
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> sendToast("Ошибка при очистке истории. Подробности в логах"));
|
||||
}
|
||||
|
||||
Log.d("VideoHistory", response.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -189,8 +205,18 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
thread.start();
|
||||
}
|
||||
|
||||
sendToast(AndroidUtils.getString("video_history_cleaned"));
|
||||
private void deleteVideoHistoryDialog(Context context){
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(context);
|
||||
builder.setTitle(AndroidUtils.getString("warning"));
|
||||
builder.setMessage("Вы действительно хотите очистить историю видео?");
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(AndroidUtils.getString("yes"), (dialogInterface, i) -> {
|
||||
deleteVideoHistory();
|
||||
});
|
||||
builder.setNegativeButton(AndroidUtils.getString("cancel"), (dialogInterface, i) -> dialogInterface.dismiss());
|
||||
builder.show();
|
||||
}
|
||||
|
||||
public static void download(Context ctx) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package ru.vtosters.lite.ui.fragments;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
@@ -69,6 +70,11 @@ public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("vkme_notifs").setEnabled(vkme());
|
||||
findPreference("wallpapers").setIcon(recolorDrawable(getGlobalContext().getDrawable(getIdentifier("ic_media_outline_28", "drawable"))));
|
||||
findPreference("vkme").setIcon(getIdentifier("ic_vkme_28", "drawable"));
|
||||
|
||||
if (isTablet()){
|
||||
findPreference("alteremoji").setVisible(false);
|
||||
findPreference("vkmesett").setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,6 +11,7 @@ import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.ContactsUtils.setContactsSync;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
@@ -55,6 +56,7 @@ import b.h.g.m.FileUtils;
|
||||
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
||||
import ru.vtosters.lite.ui.components.BackupManager;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ContactsUtils;
|
||||
|
||||
public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
private static final int VK_ADMIN_TOKEN_REQUEST_CODE = 1;
|
||||
@@ -94,6 +96,11 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("contacts_sync").setOnPreferenceClickListener((preference) -> {
|
||||
ContactsUtils.getContactsStatus(requireContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
var pref = getDefaultPrefs().getString("autoclearcache", "Default");
|
||||
switch (pref) {
|
||||
case "Default":
|
||||
|
||||
@@ -3,6 +3,7 @@ package ru.vtosters.lite.ui.fragments;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -32,13 +33,13 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
|
||||
findPreference("darktheme").setOnPreferenceChangeListener(new restartdark());
|
||||
findPreference("lighttheme").setOnPreferenceChangeListener(new restartlight());
|
||||
findPreference("iconmanager").setOnPreferenceClickListener(new openicons());
|
||||
findPreference("dockbar_tab_titles").setOnPreferenceChangeListener((preference, o) -> {
|
||||
getPreferences().edit().putBoolean("dockbar_tab_titles", (boolean) o).commit();
|
||||
LifecycleUtils.restartApplication();
|
||||
return false;
|
||||
});
|
||||
findPreference("dockbar_tab_titles").setOnPreferenceClickListener(new restart());
|
||||
findPreference("dockbar_accent").setOnPreferenceClickListener(new restart());
|
||||
findPreference("dockcounter").setOnPreferenceClickListener(new restart());
|
||||
|
||||
if (isTablet()){
|
||||
findPreference("dockbarsett").setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public class openicons implements Preference.OnPreferenceClickListener {
|
||||
|
||||
@@ -12,10 +12,12 @@ import static ru.vtosters.lite.utils.AccountManagerUtils.isVKTester;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.humanReadableByteCountBin;
|
||||
import static ru.vtosters.lite.utils.GmsUtils.isGmsInstalled;
|
||||
import static ru.vtosters.lite.utils.ImageUtils.getDrawableFromUrl;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.autotranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.devmenu;
|
||||
import static ru.vtosters.lite.utils.Preferences.disableSettingsSumms;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasSpecialVerif;
|
||||
@@ -44,6 +46,7 @@ import android.os.Bundle;
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
import com.vk.about.AboutAppFragment;
|
||||
import com.vk.balance.BalanceFragment;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
import com.vk.notifications.settings.NotificationsSettingsFragment;
|
||||
import com.vk.webapp.fragments.PrivacyFragment;
|
||||
@@ -56,13 +59,16 @@ import com.vtosters.lite.fragments.w2.BlacklistFragment;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
import com.vtosters.lite.general.fragments.SettingsAccountFragment;
|
||||
import com.vtosters.lite.general.fragments.SettingsGeneralFragment;
|
||||
import com.vtosters.lite.ui.MaterialSwitchPreference;
|
||||
|
||||
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
|
||||
import ru.vtosters.lite.ui.components.DockBarEditorManager;
|
||||
import ru.vtosters.lite.ui.components.SuperAppEditorManager;
|
||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.CacheUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.SSFSUtils;
|
||||
|
||||
public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
@@ -124,13 +130,18 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return AndroidUtils.getString("autoclearcachesumm") + " " + humanReadableByteCountBin(CacheUtils.getInstance().size);
|
||||
}
|
||||
|
||||
private void switchTheme(boolean isDarkTheme) {
|
||||
setTheme(isDarkTheme ? getDarkTheme() : getLightTheme(), requireActivity());
|
||||
edit().putBoolean("isdark", isDarkTheme).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
var feedsumm = getValAsString("vtlfeedsumm", ads());
|
||||
var docksumm = getDocksumm();
|
||||
var msgsumm = getValAsString("vtlmsgsumm", vkme());
|
||||
var msgsumm = isTablet() ? getValAsString("autotranslate_title", autotranslate()) : getValAsString("vtlmsgsumm", vkme());
|
||||
var activitysumm = getValAsString("vtlactivitysumm", offline());
|
||||
var themessumm = getValAsString("vtlthemessumm", navbar());
|
||||
var tgssumm = getTGSsumm();
|
||||
@@ -148,7 +159,8 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
addPreferenceDrawable(this, "", getUsername(), hasVerification() ? AndroidUtils.getString("thanksfordonate") : AndroidUtils.getString("getdonate"), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
|
||||
try {
|
||||
VKAuth.a("logout", false);
|
||||
} catch (Exception ignored) { }
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
var intent = new Intent(requireContext(), MainActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
@@ -162,23 +174,38 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
addPreferenceCategory(this, AndroidUtils.getString("vtsettdarktheme"));
|
||||
|
||||
addMaterialSwitchPreference(this, "", AndroidUtils.getString("vtsettdarktheme"), "", "ic_palette_outline_28", isDarkTheme(), (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
final var switchPreference = (MaterialSwitchPreference) preference;
|
||||
final var isDarkTheme = !switchPreference.isChecked();
|
||||
|
||||
if (!value) { // inverted
|
||||
setTheme(getLightTheme(), this.getActivity());
|
||||
} else {
|
||||
setTheme(getDarkTheme(), this.getActivity());
|
||||
if (Preferences.systemtheme()) {
|
||||
new VkAlertDialog.Builder(requireActivity())
|
||||
.setTitle("Внимание!")
|
||||
.setMessage("У вас включена системная тема \n" +
|
||||
"При переключении темы системная тема будет отключена \n\n" +
|
||||
"Вы действительно хотите отключить её?")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("Отключить", (dialogInterface, i) -> {
|
||||
switchPreference.setChecked(isDarkTheme);
|
||||
((MaterialSwitchPreference) findPreference("systemtheme")).setChecked(false);
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
switchTheme(isDarkTheme);
|
||||
});
|
||||
})
|
||||
.setNeutralButton("Отмена", null)
|
||||
.show();
|
||||
return false;
|
||||
}
|
||||
|
||||
edit().putBoolean("isdark", value).commit();
|
||||
switchTheme(isDarkTheme);
|
||||
return true;
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 28 && false) { // TODO refactoring system theme
|
||||
addMaterialSwitchPreference(this, "systemtheme", AndroidUtils.getString("appearance_theme_use_system"), AndroidUtils.getString("appearance_theme_use_system_summary"), "ic_recent_outline_28", true, (preference, o) -> {
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
addMaterialSwitchPreference(this, "systemtheme", AndroidUtils.getString("appearance_theme_use_system"), "", "ic_recent_outline_28", true, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
|
||||
edit().putBoolean("systemtheme", value).commit();
|
||||
|
||||
SystemThemeChangerHook.onThemeChanged(getResources().getConfiguration());
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@@ -313,22 +340,24 @@ public class VTSettings extends MaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", AndroidUtils.getString("dockbar_editor"), docksumm, "ic_list_outline_28", preference -> {
|
||||
Context context = requireContext();
|
||||
Intent intent = new Navigator(DockBarEditorFragment.class).b(context);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
return false;
|
||||
});
|
||||
|
||||
if (milkshake() && superapp()) {
|
||||
addPreference(this, "", AndroidUtils.getString("superapp_editor"), superapp, "ic_services_outline_28", (preference) -> {
|
||||
if (!isTablet()) {
|
||||
addPreference(this, "", AndroidUtils.getString("dockbar_editor"), docksumm, "ic_list_outline_28", preference -> {
|
||||
Context context = requireContext();
|
||||
Intent intent = new Navigator(SuperAppEditorFragment.class).b(context);
|
||||
Intent intent = new Navigator(DockBarEditorFragment.class).b(context);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (milkshake() && superapp()) {
|
||||
addPreference(this, "", AndroidUtils.getString("superapp_editor"), superapp, "ic_services_outline_28", (preference) -> {
|
||||
Context context = requireContext();
|
||||
Intent intent = new Navigator(SuperAppEditorFragment.class).b(context);
|
||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addPreference(this, "", AndroidUtils.getString("warning"), AndroidUtils.getString("vkme_mode_info"), "ic_about_outline_28", preference -> false);
|
||||
|
||||
@@ -31,6 +31,7 @@ import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
|
||||
|
||||
@@ -43,6 +44,7 @@ import java.io.File;
|
||||
|
||||
import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.ui.adapters.StickerPackAdapter;
|
||||
import ru.vtosters.lite.ui.components.StickerTouchHelperCallback;
|
||||
import ru.vtosters.lite.ui.fragments.BaseToolbarFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
@@ -120,6 +122,11 @@ public class StickersFragment extends BaseToolbarFragment {
|
||||
|
||||
mAdapter = new StickerPackAdapter();
|
||||
RecyclerView mRecycler = new RecyclerView(getContext());
|
||||
|
||||
var callback = new StickerTouchHelperCallback(mAdapter);
|
||||
var touchHelper = new ItemTouchHelper(callback);
|
||||
touchHelper.attachToRecyclerView(mRecycler);
|
||||
|
||||
mRecycler.setAdapter(mAdapter);
|
||||
mRecycler.setLayoutManager(new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL));
|
||||
layout.addView(mRecycler, new ViewGroup.LayoutParams(-1, -1));
|
||||
|
||||
@@ -14,6 +14,8 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.vk.core.util.Screen;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Locale;
|
||||
@@ -30,6 +32,10 @@ public class AndroidUtils {
|
||||
return PreferenceManager.getDefaultSharedPreferences(getGlobalContext());
|
||||
}
|
||||
|
||||
public static boolean isTablet() {
|
||||
return Screen.l(getGlobalContext());
|
||||
}
|
||||
|
||||
public static String getPrefsValue(String pref) {
|
||||
return getPreferences().getString(pref, "");
|
||||
} // Get pref value as string
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static androidx.core.app.ActivityCompat.requestPermissions;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.SyncResult;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.content.ContextCompat;
|
||||
|
||||
import com.vk.auth.VKAuthUtils;
|
||||
import com.vk.contacts.ContactsSyncAdapterService;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
public class ContactsUtils{
|
||||
public static void setContactsSync(boolean enabled){
|
||||
makeRequest("https://" + getApi() + "/method/account.setInfo?" + "name=im_user_name_type&value=" + (enabled ? "contact" : "vk") + "&https=1&v=5.153&access_token=" + getUserToken(),
|
||||
response -> {
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response);
|
||||
Log.d("ContactsUtils", "Result: " + mainJson + ", enabled sync: " + enabled);
|
||||
} catch (JSONException e) {
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
sendToast("Ошибка установки контактов");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void uploadContacts(Context ctx){
|
||||
try {
|
||||
if (ContextCompat.checkSelfPermission(ctx, Manifest.permission.READ_CONTACTS) != PackageManager.PERMISSION_GRANTED) {
|
||||
sendToast("Для работы данной функции необходимо выдать право на чтение контактов");
|
||||
requestPermissions(LifecycleUtils.getCurrentActivity(), new String[] {Manifest.permission.READ_CONTACTS}, 11111);
|
||||
} else {
|
||||
var account = VKAuthUtils.a.a(VKAccountManager.d().Z());
|
||||
ContactsSyncAdapterService.c(ctx, account, new Bundle(), new SyncResult());
|
||||
}
|
||||
} catch (Exception e){
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void getContactsStatus(Context ctx){
|
||||
final ProgressDialog progressDialog = new ProgressDialog(ctx);
|
||||
progressDialog.setMessage("Загрузка данных о контактах...");
|
||||
progressDialog.show();
|
||||
|
||||
var request = new okhttp3.Request.a()
|
||||
.b("https://" + getApi() + "/method/execute?https=1&v=5.153&code=return%20API.account.getInfo().settings%5B44%5D.value%3B&access_token=" + getUserToken())
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"))
|
||||
.a();
|
||||
|
||||
try {
|
||||
var response = new OkHttpClient().a(request).execute().a().g();
|
||||
progressDialog.cancel();
|
||||
|
||||
try {
|
||||
String resp = new JSONObject(response).optString("response");
|
||||
|
||||
Log.d("ContactsUtils", new JSONObject(response).toString());
|
||||
|
||||
boolean enabledsync = resp.equals("contact");
|
||||
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(ctx);
|
||||
builder.setTitle("Синхронизация контактов");
|
||||
builder.setMessage("Статус синхронизации: " + (enabledsync ? "Включена" : "Отключена"));
|
||||
builder.setCancelable(true);
|
||||
builder.setPositiveButton((!enabledsync ? "Включить" : "Отключить"), (dialog, which) -> {
|
||||
setContactsSync(!enabledsync);
|
||||
});
|
||||
// builder.setNegativeButton("Импортировать контакты", (dialog, which) -> {
|
||||
// uploadContacts(ctx);
|
||||
// });
|
||||
|
||||
builder.show();
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.d("ContactsUtils", e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.vtosters.lite.data.Users;
|
||||
@@ -60,7 +61,7 @@ public class Preferences {
|
||||
}
|
||||
|
||||
public static boolean systemtheme() {
|
||||
return false; //getBoolValue("systemtheme", true) && VERSION.SDK_INT >= 28;
|
||||
return Build.VERSION.SDK_INT >= 28 && getBoolValue("systemtheme", true);
|
||||
}
|
||||
|
||||
public static boolean authorsrecomm() {
|
||||
@@ -196,14 +197,6 @@ public class Preferences {
|
||||
return getBoolValue("milkshake", true);
|
||||
}
|
||||
|
||||
public static boolean musicnewcatalog() {
|
||||
return getBoolValue("musicnewcatalog", true);
|
||||
}
|
||||
|
||||
public static boolean videonewcatalog() {
|
||||
return getBoolValue("videonewcatalog", true);
|
||||
}
|
||||
|
||||
public static boolean postsredesign() {
|
||||
return getBoolValue("postsredesign", true);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package ru.vtosters.lite.utils;
|
||||
import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
|
||||
import static ru.vtosters.lite.hooks.VKUIHook.isLoaded;
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaper;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getCenterScreenCoords;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
@@ -12,14 +11,12 @@ import static ru.vtosters.lite.utils.Preferences.color_grishka;
|
||||
import static ru.vtosters.lite.utils.Preferences.dockbar_accent;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.navbar;
|
||||
import static ru.vtosters.lite.utils.Preferences.systemtheme;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
@@ -49,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) {
|
||||
@@ -329,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);
|
||||
}
|
||||
}
|
||||
@@ -384,34 +389,6 @@ public class ThemesUtils {
|
||||
);
|
||||
}
|
||||
|
||||
public static void systemThemeChanger(Activity activity) { // ded
|
||||
boolean isDarkTheme = isDarkTheme();
|
||||
|
||||
if (!isDarkTheme) {
|
||||
applyTheme(getDarkTheme());
|
||||
} else {
|
||||
applyTheme(getLightTheme());
|
||||
}
|
||||
|
||||
if (!systemtheme()) {
|
||||
edit().putBoolean("isdark", isDarkTheme).commit();
|
||||
return;
|
||||
}
|
||||
|
||||
int currentNightMode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
switch (currentNightMode) {
|
||||
case Configuration.UI_MODE_NIGHT_UNDEFINED:
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
edit().putBoolean("isdark", false).commit();
|
||||
setTheme(getLightTheme(), activity);
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
edit().putBoolean("isdark", true).commit();
|
||||
setTheme(getDarkTheme(), activity);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void getCurrentThemeID(VKTheme paramVKTheme) {
|
||||
Preference.b("vk_theme_helper", "current_theme", paramVKTheme.getId());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getOauth;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class VKMeHandler{
|
||||
public static void getVkMeToken(String username, String password){
|
||||
makeRequest("https://" +
|
||||
getOauth() +
|
||||
"/token?" +
|
||||
"grant_type=password&client_id=6146827&client_secret=qVxWRF1CwHERuIrKBnqe&username=" +
|
||||
username +
|
||||
"&password=" +
|
||||
password +
|
||||
"&v=5.131&2fa_supported=1",
|
||||
response -> {
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response);
|
||||
|
||||
if (mainJson.has("redirect_uri")){
|
||||
String redirect_uri = mainJson.getString("redirect_uri");
|
||||
// TODO open redirect_uri and get token
|
||||
} else if (mainJson.has("access_token")){
|
||||
setToken(mainJson.getString("access_token"));
|
||||
} else if (mainJson.has("error_description")){
|
||||
Log.d("VKMeHandler", mainJson.getString("error_description"));
|
||||
sendToast("Ошибка входа: " + mainJson.getString("error_description"));
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.d("VKMeHandler", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void setToken(String token){
|
||||
edit().putString("vkmetoken", token).commit();
|
||||
}
|
||||
|
||||
public static void removeToken(){
|
||||
edit().remove("vkmetoken").commit();
|
||||
}
|
||||
|
||||
public static String getToken(){
|
||||
return getPrefsValue("vkmetoken");
|
||||
}
|
||||
|
||||
public static void setPrivacyStatus(String status){
|
||||
// all, friends_and_contacts, only_me
|
||||
makeRequest("https://" + getApi() + "/method/account.setPrivacy?" + "v=5.140&key=online&value=" + status + "&https=1&access_token=" + getToken(),
|
||||
response -> {
|
||||
try {
|
||||
JSONObject mainJson = new JSONObject(response);
|
||||
} catch (JSONException e) {
|
||||
Log.d("VKMeHandler", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void getPrivacyStatus(){
|
||||
makeRequest("https://" + getApi() + "/method/execute?v=5.140&code=return API.account.getPrivacySettings().settings[22].value.category;&access_token=" + getToken(),
|
||||
response -> {
|
||||
try {
|
||||
String resp = new JSONObject(response).optString("response");
|
||||
|
||||
switch (resp){ // TODO make support for privacy
|
||||
case "all":
|
||||
case "friends_and_contacts":
|
||||
case "friends":
|
||||
case "only_me":
|
||||
}
|
||||
|
||||
} catch (JSONException e) {
|
||||
Log.d("VKMeHandler", e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
RED='\033[31m'
|
||||
GREEN='\033[92m'
|
||||
NC='\033[0m'
|
||||
BOLD='\033[1m'
|
||||
UNDERLINE='\033[4m'
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Сборка apk..${NC}"
|
||||
cd ../smali/
|
||||
java -jar ../scripts/apktool.jar b . -o VTLite.apk --use-aapt2 -p ../scripts/framework/
|
||||
if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}Успех!${NC}\n"
|
||||
else
|
||||
echo -e "${RED}Провал.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Распаковка dex'ов..${NC}"
|
||||
unzip -j VTLite.apk classes.dex classes2.dex classes3.dex classes4.dex classes5.dex -d ../app/libs
|
||||
|
||||
cd ../app/libs
|
||||
echo -e "${BOLD}${UNDERLINE}Удаление старых библиотек..${NC}"
|
||||
rm -r *.jar
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Сборка новых библиотек..${NC}"
|
||||
d2j-dex2jar classes*
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Удаляем говно..${NC}"
|
||||
rm -r *.dex
|
||||
@@ -194,7 +194,7 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name="com.vtosters.lite.MainActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
|
||||
android:finishOnTaskLaunch="true"
|
||||
android:label="@string/app_name"
|
||||
android:launchMode="singleTop"
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:opacity="opaque">
|
||||
<item android:drawable="@color/iclauncher" />
|
||||
<item>
|
||||
<nine-patch android:src="@drawable/bg_splash_screen_tablet" />
|
||||
<bitmap
|
||||
android:gravity="center"
|
||||
android:src="@drawable/vtlogo" />
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -24,10 +24,6 @@
|
||||
android:id="@id/menu_stickers"
|
||||
android:icon="@drawable/ic_smile_outline_28"
|
||||
android:title="@string/stickers" />
|
||||
<item
|
||||
android:id="@id/menu_shopping"
|
||||
android:icon="@drawable/ic_market_24_white"
|
||||
android:title="@string/sc_catalog_title" />
|
||||
<item
|
||||
android:id="@id/menu_lives"
|
||||
android:icon="@drawable/ic_live_24"
|
||||
|
||||
@@ -40,10 +40,6 @@
|
||||
android:id="@id/menu_stickers"
|
||||
android:icon="@drawable/ic_smile_outline_28"
|
||||
android:title="@string/stickers" />
|
||||
<item
|
||||
android:id="@id/menu_shopping"
|
||||
android:icon="@drawable/ic_market_24_white"
|
||||
android:title="@string/sc_catalog_title" />
|
||||
<item
|
||||
android:id="@id/menu_lives"
|
||||
android:icon="@drawable/ic_live_filter_24dp"
|
||||
|
||||
@@ -40,10 +40,6 @@
|
||||
android:id="@id/menu_stickers"
|
||||
android:icon="@drawable/ic_smile_outline_28"
|
||||
android:title="@string/stickers" />
|
||||
<item
|
||||
android:id="@id/menu_shopping"
|
||||
android:icon="@drawable/ic_market_outline_28"
|
||||
android:title="@string/sc_catalog_title" />
|
||||
<item
|
||||
android:id="@id/menu_lives"
|
||||
android:icon="@drawable/ic_live_outline_28"
|
||||
|
||||
@@ -552,8 +552,6 @@
|
||||
<item>Fade</item>
|
||||
<item>AndroidX</item>
|
||||
<item>Слайд</item>
|
||||
<item>Системный</item>
|
||||
<item>Системный (task)</item>
|
||||
</string-array>
|
||||
<string-array name="animations">
|
||||
<item>Без анимации</item>
|
||||
|
||||
@@ -5525,8 +5525,6 @@
|
||||
<string name="lastfm_enabled_summ">Полезный сервис по учету прослушивания песен</string>
|
||||
<string name="lastfm_credentials_empty">Логин или пароль не заданы</string>
|
||||
<string name="vtl_music_settings">Музыка</string>
|
||||
<string name="musicnewcatalog_title">Новый раздел музыки</string>
|
||||
<string name="musicnewcatalog_summ">Новый каталог музыкального раздела с динамическим контентом</string>
|
||||
<string name="musicdefcatalog_dialogTitle">Выберите раздел по умолчанию</string>
|
||||
<string name="musicdefcatalog_title">Раздел музыки по умолчанию</string>
|
||||
<string name="vtl_video_settings">Видео</string>
|
||||
@@ -5955,6 +5953,8 @@
|
||||
|
||||
<string name="download_mp3">Скачать как mp3</string>
|
||||
<string name="remove_from_cache">Удалить из кеша</string>
|
||||
<string name="play_in_vkx">Воспроизвести в VK X</string>
|
||||
|
||||
|
||||
<string name="thanksfordonate">Спасибо тебе за поддержку проекта!</string>
|
||||
<string name="getdonate">Поддержи проект донатом и получи бонусы</string>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
<item name="android:windowBackground">@drawable/bg_splash</item>
|
||||
<item name="android:navigationBarColor">@color/gray_20</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
</style>
|
||||
|
||||
<style name="StoryDialog" parent="@style/Theme.AppCompat.Light.Dialog">
|
||||
@@ -43,7 +42,6 @@
|
||||
<item name="android:navigationBarColor">@android:color/black</item>
|
||||
<item name="android:windowElevation">0.0px</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
</style>
|
||||
|
||||
<style name="VkLightStyle.WhiteToolbar" parent="@style/VkLightStyle">
|
||||
@@ -64,7 +62,6 @@
|
||||
<item name="android:windowBackground">@drawable/bg_splash_screen_me</item>
|
||||
<item name="android:navigationBarColor">@color/black</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
<item name="android:windowLightNavigationBar">false</item>
|
||||
<item name="im_bg_modal_dialog">@drawable/bg_modal_dialog</item>
|
||||
<item name="im_btn_accept_background">@color/azure_300_alpha10</item>
|
||||
<item name="im_btn_accept_background_dark">@color/azure_300_alpha15</item>
|
||||
@@ -91,7 +88,6 @@
|
||||
<item name="android:windowBackground">@drawable/bg_splash_screen_me</item>
|
||||
<item name="android:navigationBarColor">@color/transparent</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:windowLightNavigationBar">true</item>
|
||||
<item name="im_bg_modal_dialog">@drawable/list_dialog_bg</item>
|
||||
<item name="im_btn_accept_background">@color/azure_300_alpha10</item>
|
||||
<item name="im_btn_accept_background_dark">@color/azure_300_alpha15</item>
|
||||
|
||||
@@ -673,16 +673,12 @@
|
||||
<item>Fade</item>
|
||||
<item>AndroidX</item>
|
||||
<item>Slide</item>
|
||||
<item>System</item>
|
||||
<item>System task</item>
|
||||
</string-array>
|
||||
<string-array name="animations_values2">
|
||||
<item>noanim</item>
|
||||
<item>frag_fade</item>
|
||||
<item>frag_enter</item>
|
||||
<item>slide</item>
|
||||
<item>system</item>
|
||||
<item>system_task</item>
|
||||
</string-array>
|
||||
<string-array name="language">
|
||||
<item>System</item>
|
||||
|
||||
@@ -3914,4 +3914,5 @@
|
||||
<item name="btncopyid" type="id" />
|
||||
<item name="download_video" type="id" />
|
||||
<item name="savedmsg" type="id" />
|
||||
<item name="play_in_vkx" type="id" />
|
||||
</resources>
|
||||
|
||||
@@ -5659,8 +5659,6 @@ Expand text..."</string>
|
||||
<string name="lastfm_enabled_summ">Useful song tracking service</string>
|
||||
<string name="lastfm_credentials_empty">Username or password not set</string>
|
||||
<string name="vtl_music_settings">Music</string>
|
||||
<string name="musicnewcatalog_title">New music catalog</string>
|
||||
<string name="musicnewcatalog_summ">New music catalog with dynamic content</string>
|
||||
<string name="musicdefcatalog_dialogTitle">Select default section</string>
|
||||
<string name="musicdefcatalog_title">Default music section</string>
|
||||
<string name="vtl_video_settings">Video</string>
|
||||
@@ -6091,6 +6089,8 @@ May look like a fake leaving the online"</string>
|
||||
<string name="download_mp3">Download as mp3</string>
|
||||
<string name="remove_from_cache">Delete from cache</string>
|
||||
|
||||
<string name="play_in_vkx">Play the track in VK X</string>
|
||||
|
||||
<string name="thanksfordonate">Thank you for supporting the project!</string>
|
||||
<string name="getdonate">Support the project with a donation and get rewards</string>
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
android:summary="@string/postsredesign_summ"
|
||||
android:title="@string/postsredesign_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/menu">
|
||||
<PreferenceCategory android:title="@string/menu" android:key="menusett">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="miniapps"
|
||||
|
||||
@@ -48,11 +48,6 @@
|
||||
android:title="@string/lastfm_enabled_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vtl_music_settings">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="musicnewcatalog"
|
||||
android:summary="@string/musicnewcatalog_summ"
|
||||
android:title="@string/musicnewcatalog_title" />
|
||||
<com.vtosters.lite.ui.SummaryListPreference
|
||||
android:defaultValue="default"
|
||||
android:dialogTitle="@string/musicdefcatalog_dialogTitle"
|
||||
@@ -65,11 +60,6 @@
|
||||
<Preference
|
||||
android:key="download_video"
|
||||
android:title="@string/vtl_download_video_title" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="videonewcatalog"
|
||||
android:summary="@string/videonewcatalog_summ"
|
||||
android:title="@string/videonewcatalog_title" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="isEnableExternalOpening"
|
||||
@@ -90,7 +80,7 @@
|
||||
android:key="select_photo_search_engine"
|
||||
android:title="@string/photo_search_engine_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vkx_title">
|
||||
<PreferenceCategory android:title="@string/vkx_title" android:key="vkx_sett">
|
||||
<Preference
|
||||
android:enabled="false"
|
||||
android:summary="@string/vkx_why_summary"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
android:summary="@string/convBarRecomm_summ"
|
||||
android:title="@string/convBarRecomm_title" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vk_messenger">
|
||||
<PreferenceCategory android:title="@string/vk_messenger" android:key="vkmesett">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="vkme"
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory android:title="Синхронизация контактов">
|
||||
<Preference
|
||||
android:key="contacts_sync"
|
||||
android:title="Синхронизация контактов" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/other_fix_app">
|
||||
<Preference
|
||||
android:key="firebasefix"
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
android:key="lighttheme"
|
||||
android:title="@string/appearance_theme_light_theme" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vtl_settings_dockbar_title">
|
||||
<PreferenceCategory android:title="@string/vtl_settings_dockbar_title" android:key="dockbarsett">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="dockbar_tab_titles"
|
||||
|
||||
@@ -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
|
||||
|
||||
+14
-1
@@ -704,11 +704,24 @@
|
||||
|
||||
move-result-object v2
|
||||
|
||||
.line 7
|
||||
invoke-virtual {p1}, Lcom/vk/music/bottomsheets/a/MusicAction;->a()I
|
||||
|
||||
move-result p1
|
||||
|
||||
.line 7
|
||||
|
||||
iget-object v3, p0, Lcom/vk/music/bottomsheets/track/MusicTrackBottomSheetClickListener;->f:Lcom/vk/music/bottomsheets/track/MusicTrackBottomSheetModel1;
|
||||
|
||||
invoke-interface {v3}, Lcom/vk/music/bottomsheets/track/MusicTrackBottomSheetModel1;->i()Lcom/vk/dto/music/Playlist;
|
||||
|
||||
move-result-object v3
|
||||
|
||||
invoke-static {p1, v0, v2, v3}, Lru/vtosters/lite/hooks/ui/MusicBottomSheetHook;->tryPlayInVKX(ILcom/vk/dto/music/MusicTrack;Lcom/vk/music/common/MusicPlaybackLaunchContext;Lcom/vk/dto/music/Playlist;)Z
|
||||
|
||||
move-result v3
|
||||
|
||||
if-nez v3, :cond_7
|
||||
|
||||
const v3, 0x7f0a0870
|
||||
|
||||
const/4 v4, 0x0
|
||||
|
||||
+6
@@ -738,5 +738,11 @@
|
||||
|
||||
:cond_a
|
||||
:goto_3
|
||||
|
||||
# invoke static ru.vtosters.lite.hooks.ui.MusicBottomSheetHook.hook(ArrayList<MusicAction> actions)
|
||||
invoke-static {v3}, Lru/vtosters/lite/hooks/ui/MusicBottomSheetHook;->hook(Ljava/util/ArrayList;)Ljava/util/ArrayList;
|
||||
|
||||
move-result-object v3
|
||||
|
||||
return-object v3
|
||||
.end method
|
||||
|
||||
@@ -371,6 +371,8 @@
|
||||
|
||||
invoke-virtual {v0, p1}, Lcom/vk/navigation/NavigationDelegate;->a(Landroid/content/res/Configuration;)V
|
||||
|
||||
invoke-static {p1}, Lru/vtosters/lite/hooks/ui/SystemThemeChangerHook;->onThemeChanged(Landroid/content/res/Configuration;)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
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
const-class v0, Lcom/vtosters/lite/fragments/y2/VideosFragment;
|
||||
const-class v0, Lcom/vtosters/lite/fragments/y2/VideoCatalogFragment;
|
||||
|
||||
invoke-direct {p0, v0}, Lcom/vk/navigation/Navigator;-><init>(Ljava/lang/Class;)V
|
||||
|
||||
|
||||
Reference in New Issue
Block a user