Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6eb88e678f | ||
|
|
4aee200214 | ||
|
|
b6e7d24979 | ||
|
|
d10d5eca4b | ||
|
|
67f1477907 | ||
|
|
18ef4eda21 | ||
|
|
84cf9ba10a | ||
|
|
b05a239b90 | ||
|
|
8959558c64 | ||
|
|
e19ed8845d | ||
|
|
b5ae2662db | ||
|
|
d4710663ff | ||
|
|
18f40e0da9 | ||
|
|
9ff8c1d9fe | ||
|
|
91440e4f8b | ||
|
|
a195e05d7b | ||
|
|
8866bf90c7 | ||
|
|
eab5b7074e | ||
|
|
bdee6c08c0 | ||
|
|
0744613aa0 | ||
|
|
f6de4c5bc9 | ||
|
|
f59e93aab6 | ||
|
|
2d97341886 | ||
|
|
b247c5c090 | ||
|
|
fd6e866f6f | ||
|
|
780ebce3ff |
+29
-38
@@ -49,6 +49,7 @@ import com.vk.im.ui.views.msg.bubble.MsgBubbleView;
|
||||
import com.vk.im.ui.views.sticker.StickerAnimationState;
|
||||
import kotlin.Unit;
|
||||
import kotlin.jvm.b.Functions;
|
||||
import ru.vtosters.lite.themes.ThemesHacks;
|
||||
|
||||
public class VhMsg extends VhBase implements SwipeToReplyItemTouchCallback.b {
|
||||
public static final int h0 = Screen.a(124);
|
||||
@@ -133,7 +134,7 @@ public class VhMsg extends VhBase implements SwipeToReplyItemTouchCallback.b {
|
||||
this.h = itemView.findViewById(com.vk.im.ui.h.status_space);
|
||||
this.P = itemView.findViewById(com.vk.im.ui.h.bomb);
|
||||
this.B = vhBase;
|
||||
this.H = new ColorDrawable(context.getResources().getColor(com.vk.im.ui.d.msg_search_selection));
|
||||
this.H = new ColorDrawable(ThemesHacks.getColors(context, com.vk.im.ui.d.msg_search_selection));
|
||||
this.I = ContextExtKt.b(context, com.vk.im.ui.e.msg_bubble_max_width);
|
||||
this.J = ContextExtKt.b(context, com.vk.im.ui.e.msg_reply_max_width);
|
||||
this.K = ContextExtKt.b(context, com.vk.im.ui.e.msg_sticker_max_width);
|
||||
@@ -150,49 +151,39 @@ public class VhMsg extends VhBase implements SwipeToReplyItemTouchCallback.b {
|
||||
var6.right = var7.rightMargin;
|
||||
var6.top = var7.topMargin;
|
||||
var6.bottom = var7.bottomMargin;
|
||||
ViewExtKt.b(this.c, new View.OnClickListener() {
|
||||
public void onClick(View var1) {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.a(VhMsg.this.d0.getFrom());
|
||||
}
|
||||
|
||||
ViewExtKt.b(this.c, var1 -> {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.a(VhMsg.this.d0.getFrom());
|
||||
}
|
||||
});
|
||||
this.c.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
public boolean onLongClick(View var1) {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.a(VhMsg.this.d0.getFrom());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
ViewExtKt.b(this.g, new View.OnClickListener() {
|
||||
public void onClick(View var1) {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.a(VhMsg.this.d0);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
ViewExtKt.b(this.itemView, new View.OnClickListener() {
|
||||
public void onClick(View var1) {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.a(VhMsg.this.d0.getLocalId());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.itemView.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
public boolean onLongClick(View var1) {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.b(VhMsg.this.d0.getLocalId());
|
||||
}
|
||||
|
||||
this.c.setOnLongClickListener(var1 -> {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.a(VhMsg.this.d0.getFrom());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
ViewExtKt.b(this.g, var1 -> {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.a(VhMsg.this.d0);
|
||||
}
|
||||
|
||||
});
|
||||
ViewExtKt.b(this.itemView, (View.OnClickListener) var1 -> {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.a(VhMsg.this.d0.getLocalId());
|
||||
}
|
||||
|
||||
});
|
||||
this.itemView.setOnLongClickListener((View.OnLongClickListener) var1 -> {
|
||||
if (VhMsg.this.c0 != null && VhMsg.this.d0 != null) {
|
||||
VhMsg.this.c0.b(VhMsg.this.d0.getLocalId());
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
this.R = ContextExtKt.i(context, com.vk.im.ui.c.im_msg_part_corner_radius_small);
|
||||
this.S = ContextExtKt.i(context, com.vk.im.ui.c.im_msg_part_corner_radius_big);
|
||||
this.c0 = null;
|
||||
|
||||
@@ -13025,7 +13025,7 @@ public final class R {
|
||||
public static final int ic_launcher_shine = 0x7f0f005d; // 2131689565
|
||||
public static final int ic_launcher_shine_background = 0x7f0f005e; // 2131689566
|
||||
public static final int ic_launcher_shine_foreground = 0x7f0f005f; // 2131689567
|
||||
public static final int vt_adaptive_launcher_foneground = 0x7f0f0043; // 2131689539
|
||||
public static final int vt_adaptive_launcher_foreground = 0x7f0f0043; // 2131689539
|
||||
public static final int vt_launcher_round = 0x7f0f0046; // 2131689542
|
||||
public static final int ic_logo_facebook_28 = 0x7f0f0003; // 2131689475
|
||||
public static final int ic_logo_google_28 = 0x7f0f0004; // 2131689476
|
||||
|
||||
+2
-2
@@ -69,10 +69,10 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
this.mIcon.getLayoutParams().height = V.a(28.0F);
|
||||
|
||||
this.mSmallLabel = this.findViewById(R.id.smallLabel);
|
||||
mSmallLabel.setTextColor(getCSTDock());
|
||||
mSmallLabel.setTextColor(getCSTDock(this.getContext()));
|
||||
|
||||
this.mLargeLabel = this.findViewById(R.id.largeLabel);
|
||||
mLargeLabel.setTextColor(getCSTDock());
|
||||
mLargeLabel.setTextColor(getCSTDock(this.getContext()));
|
||||
|
||||
LayoutInflater.from(this.getContext()).inflate(R.layout.navigation_bottom_counter, this, true);
|
||||
this.mCounterContainer = this.findViewById(R.id.counter_container);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class DockBarInjector {
|
||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
||||
MenuItem add = menu.add(0, tab.id, 0, tab.titleID);
|
||||
|
||||
add.setIcon(new RecoloredDrawable(getResources().getDrawable(tab.iconID), getCSTDock()));
|
||||
add.setIcon(new RecoloredDrawable(getResources().getDrawable(tab.iconID), getCSTDock(navigationView.getContext())));
|
||||
add.setTitle(getGlobalContext().getString(tab.titleID));
|
||||
add.setCheckable(true);
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class DockBarInjector {
|
||||
item.setStaticMode(true);
|
||||
item.setIconsMode(false);
|
||||
item.setShiftingMode(false);
|
||||
item.setTextColor(getCSTDock());
|
||||
item.setTextColor(getCSTDock(item.getContext()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package ru.vtosters.hooks;
|
||||
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
|
||||
public class GroupCoverHook {
|
||||
public static boolean needToDisableCovers() {
|
||||
return Preferences.getBoolValue("disablevideoscovers", false);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,9 @@
|
||||
package ru.vtosters.hooks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.NetworkInfo;
|
||||
import android.os.PowerManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.vk.core.preference.Preference;
|
||||
@@ -83,18 +85,18 @@ public class NewsfeedHook {
|
||||
}
|
||||
|
||||
public static void adsParams(HashSet<String> hashSet) {
|
||||
String[] adsParams = {"ads_disabled", "ads_app_slider", "ads_site_slider", "ads_app", "ads_site", "ads_post", "ads_app_video", "ads_post_pretty_cards", "ads_post_snippet_video"};
|
||||
String[] adsParams = {"ads_app_slider", "ads_site_slider", "ads_app", "ads_site", "ads_post", "ads_app_video", "ads_post_pretty_cards", "ads_post_snippet_video"};
|
||||
String noAdParam = "ads_disabled";
|
||||
|
||||
if (ads()) {
|
||||
hashSet.add(adsParams[0]);
|
||||
hashSet.add(adsParams[1]);
|
||||
hashSet.add(noAdParam);
|
||||
|
||||
if (!Preferences.milkshake()) {
|
||||
hashSet.add(adsParams[0]);
|
||||
}
|
||||
} else {
|
||||
Collections.addAll(hashSet, adsParams);
|
||||
}
|
||||
|
||||
if (Preferences.milkshake()) {
|
||||
hashSet.remove(adsParams[1]);
|
||||
}
|
||||
}
|
||||
|
||||
public static void takeOwnerIdSponsorPost(int ownerid) {
|
||||
@@ -132,4 +134,12 @@ public class NewsfeedHook {
|
||||
// return !getBoolValue("force_disable_psm", false) && pw.isPowerSaveMode();
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isRoaming(NetworkInfo networkInfo) {
|
||||
return !Preferences.disableForceTrafficSaver() && networkInfo.isRoaming();
|
||||
}
|
||||
|
||||
public static boolean isNetworkRoaming(TelephonyManager telephonyManager) {
|
||||
return !Preferences.disableForceTrafficSaver() && telephonyManager.isNetworkRoaming();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import static ru.vtosters.hooks.other.Preferences.*;
|
||||
public class TogglesHook {
|
||||
public static boolean shouldPatch(Features.Type feature) {
|
||||
return switch (feature) {
|
||||
case AB_IM_LONGPOLL_MSG_BATCHING, AB_IM_VIEW_POOL, AB_MULTI_GIFTS, AB_NEWS_VIDEO_LAYOUT_TEXT, AB_STICKERS_DISCOVER, AB_GIFTS_FROM_KEYBOARD, FEATURE_FEED_DEFAULT_LIST_ALWAYS, EXPERIMENT_NEWS_VIDEO_LAYOUT_TEXT, FEATURE_DISCOVER_CATEGORIES, FEATURE_FAVE_PERF_IMPROVE, FEATURE_GROUP_ADMIN_MESSAGES, FEATURE_GROUP_MSG_PUSH_PARAM, FEATURE_IMAGE_QUALITY_UPGRADE, FEATURE_IM_AUDIO_MSG_TRANSCRIPT, FEATURE_IM_CASPER_MSGS, FEATURE_IM_DISABLE_FORCE_OPEN_VK_ME, FEATURE_IM_GIF_AUTOPLAY, FEATURE_IM_MR_IN_VKAPP, FEATURE_MEMORIES_ENABLED, FEATURE_MENU_GAMES_CAROUSEL, FEATURE_MILKSHAKE, FEATURE_MILKSHAKE_CHANGE_FEED_BY_TIMEOUT, FEATURE_MILKSHAKE_NEWS_SCROLL_ON_BACK, FEATURE_MILKSHAKE_SWITCH_THEME_ON_TAP, FEATURE_ML_BRANDS, FEATURE_ML_FEATURES, FEATURE_ML_MODELS_LOADING, FEATURE_MONEY_TRANSFERS_VKPAY, FEATURE_MUSIC_ARTIST_CATALOG, FEATURE_MUSIC_NEW_CATALOG, FEATURE_NARRATIVE_SNIPPET_TYPE, FEATURE_NEWS_GAMES_IN_DISCOVER, FEATURE_NEWS_HEADER_SCROLL, FEATURE_NEW_FORMAT_SHOW_WPB, FEATURE_PODCASTS_PAGE, FEATURE_QR_CREATE_QR, FEATURE_QR_DYNAMIC_FRAME, FEATURE_QR_SCAN_FROM_PHOTO, FEATURE_QR_VISION_DECODER, FEATURE_QUEUE_COUNTERS, FEATURE_REEF, FEATURE_ROAMING_AUTOPLAY, FEATURE_SHARE_MSGS_ON_INVITE, FEATURE_STICKERS_BOT_LINK, FEATURE_STICKERS_NEW_CATALOG, FEATURE_STORIES_AVATAR, FEATURE_STORIES_FEED_TYPE, FEATURE_STORIES_SHOW_ALWAYS, FEATURE_STORY_ANSWER_PUBLIC, FEATURE_STORY_APP_STICKER, FEATURE_STORY_ARCHIVE, FEATURE_STORY_ARCHIVE_POST, FEATURE_STORY_BAKGROUND_ALL, FEATURE_STORY_BOX, FEATURE_STORY_CADRE, FEATURE_STORY_CAMERA_TOOLTIP, FEATURE_STORY_EDITOR_GALLERY, FEATURE_STORY_EDITOR_TYPE, FEATURE_STORY_ENDLESS_VIDEO, FEATURE_STORY_FAST_REACTIONS, FEATURE_STORY_GIF, FEATURE_STORY_GROUPED, FEATURE_STORY_HIGH_QUALITY, FEATURE_STORY_MASKS_FRONTAL, FEATURE_STORY_MENTION_ICON, FEATURE_STORY_MODERN_PUBLISH, FEATURE_STORY_MUSIC_EDITOR, FEATURE_STORY_MUSIC_REPLIES, FEATURE_STORY_MUSIC_REPLIES_2, FEATURE_STORY_NEW_FRAME, FEATURE_STORY_ONE_TIME, FEATURE_STORY_PHOTO_SHARING, FEATURE_STORY_PHOTO_STICKER, FEATURE_STORY_POLLS, FEATURE_STORY_POST_REPOST, FEATURE_STORY_PRELOADING, FEATURE_STORY_QUESTION, FEATURE_STORY_QUESTION_STYLE, FEATURE_STORY_RLOTTIE, FEATURE_STORY_RLOTTIE_CACHE, FEATURE_STORY_SAVE_DEFAULT_ON, FEATURE_STORY_SEND_DIALOG_LIST, FEATURE_STORY_STICKER_PACK, FEATURE_STORY_TIME, FEATURE_STORY_VIEWER_CAMERA, FEATURE_STORY_VOICE_ANSWER, FEATURE_STORY_WITH_CONTEXT, FEATURE_SUPERAPP_MENU, FEATURE_TRAFFIC_SAVER, FEATURE_VKPAY_WIDGET, FEATURE_VKUI_INTERNAL_TO_MINI_APPS, FEATURE_VKUI_TOKEN_CACHE, FEATURE_VK_APPS_SEARCH, FEATURE_VOTES_BALANCE, FEATURE_WEBVIEW_TOKEN_ACTIVE, FEATURE_MILKSHAKE_FORCE_DISABLED, FEATURE_MILKSHAKE_ACTIVATION_DISABLED, EXPERIMENT_NEWS_DISABLE_CACHE ->
|
||||
case AB_MULTI_GIFTS, AB_NEWS_VIDEO_LAYOUT_TEXT, AB_STICKERS_DISCOVER, AB_GIFTS_FROM_KEYBOARD, EXPERIMENT_NEWS_VIDEO_LAYOUT_TEXT, FEATURE_DISCOVER_CATEGORIES, FEATURE_FAVE_PERF_IMPROVE, FEATURE_GROUP_ADMIN_MESSAGES, FEATURE_GROUP_MSG_PUSH_PARAM, FEATURE_IMAGE_QUALITY_UPGRADE, FEATURE_IM_AUDIO_MSG_TRANSCRIPT, FEATURE_IM_CASPER_MSGS, FEATURE_IM_DISABLE_FORCE_OPEN_VK_ME, FEATURE_IM_GIF_AUTOPLAY, FEATURE_IM_MR_IN_VKAPP, FEATURE_MEMORIES_ENABLED, FEATURE_MENU_GAMES_CAROUSEL, FEATURE_MILKSHAKE, FEATURE_MILKSHAKE_NEWS_SCROLL_ON_BACK, FEATURE_MILKSHAKE_SWITCH_THEME_ON_TAP, FEATURE_ML_BRANDS, FEATURE_ML_FEATURES, FEATURE_ML_MODELS_LOADING, FEATURE_MONEY_TRANSFERS_VKPAY, FEATURE_MUSIC_ARTIST_CATALOG, FEATURE_MUSIC_NEW_CATALOG, FEATURE_NARRATIVE_SNIPPET_TYPE, FEATURE_NEWS_GAMES_IN_DISCOVER, FEATURE_NEWS_HEADER_SCROLL, FEATURE_NEW_FORMAT_SHOW_WPB, FEATURE_PODCASTS_PAGE, FEATURE_QR_CREATE_QR, FEATURE_QR_DYNAMIC_FRAME, FEATURE_QR_SCAN_FROM_PHOTO, FEATURE_QR_VISION_DECODER, FEATURE_QUEUE_COUNTERS, FEATURE_REEF, FEATURE_ROAMING_AUTOPLAY, FEATURE_SHARE_MSGS_ON_INVITE, FEATURE_STICKERS_BOT_LINK, FEATURE_STICKERS_NEW_CATALOG, FEATURE_STORIES_AVATAR, FEATURE_STORIES_FEED_TYPE, FEATURE_STORIES_SHOW_ALWAYS, FEATURE_STORY_ANSWER_PUBLIC, FEATURE_STORY_APP_STICKER, FEATURE_STORY_ARCHIVE, FEATURE_STORY_ARCHIVE_POST, FEATURE_STORY_BAKGROUND_ALL, FEATURE_STORY_BOX, FEATURE_STORY_CADRE, FEATURE_STORY_CAMERA_TOOLTIP, FEATURE_STORY_EDITOR_GALLERY, FEATURE_STORY_EDITOR_TYPE, FEATURE_STORY_ENDLESS_VIDEO, FEATURE_STORY_FAST_REACTIONS, FEATURE_STORY_GIF, FEATURE_STORY_GROUPED, FEATURE_STORY_HIGH_QUALITY, FEATURE_STORY_MASKS_FRONTAL, FEATURE_STORY_MENTION_ICON, FEATURE_STORY_MODERN_PUBLISH, FEATURE_STORY_MUSIC_EDITOR, FEATURE_STORY_MUSIC_REPLIES, FEATURE_STORY_MUSIC_REPLIES_2, FEATURE_STORY_NEW_FRAME, FEATURE_STORY_ONE_TIME, FEATURE_STORY_PHOTO_SHARING, FEATURE_STORY_PHOTO_STICKER, FEATURE_STORY_POLLS, FEATURE_STORY_POST_REPOST, FEATURE_STORY_PRELOADING, FEATURE_STORY_QUESTION, FEATURE_STORY_QUESTION_STYLE, FEATURE_STORY_RLOTTIE, FEATURE_STORY_RLOTTIE_CACHE, FEATURE_STORY_SAVE_DEFAULT_ON, FEATURE_STORY_SEND_DIALOG_LIST, FEATURE_STORY_STICKER_PACK, FEATURE_STORY_TIME, FEATURE_STORY_VIEWER_CAMERA, FEATURE_STORY_VOICE_ANSWER, FEATURE_STORY_WITH_CONTEXT, FEATURE_SUPERAPP_MENU, FEATURE_TRAFFIC_SAVER, FEATURE_VKPAY_WIDGET, FEATURE_VKUI_INTERNAL_TO_MINI_APPS, FEATURE_VKUI_TOKEN_CACHE, FEATURE_VK_APPS_SEARCH, FEATURE_VOTES_BALANCE, FEATURE_WEBVIEW_TOKEN_ACTIVE, FEATURE_MILKSHAKE_FORCE_DISABLED, FEATURE_MILKSHAKE_ACTIVATION_DISABLED, EXPERIMENT_NEWS_DISABLE_CACHE ->
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package ru.vtosters.hooks;
|
||||
|
||||
import android.util.Log;
|
||||
import com.vk.core.network.Network;
|
||||
import com.vk.core.network.proxy.NetworkProxy;
|
||||
import com.vk.core.network.proxy.ProxyHost;
|
||||
import com.vk.core.network.proxy.ProxySettings;
|
||||
import com.vk.core.preference.Preference;
|
||||
import com.vtosters.lite.NetworkProxyPreferences;
|
||||
import okhttp3.*;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class VKProxy {
|
||||
private static final OkHttpClient sClient = VtOkHttpClient.getInstance();
|
||||
private static String nwProxy = Preferences.getPreferences().getString("configNetworkProxy", "");
|
||||
private static String nwProxyCerts = Preferences.getPreferences().getString("configNetworkProxyCerts", "");
|
||||
|
||||
public static boolean isProxyEnabled() {
|
||||
return Preferences.getBoolValue("useProxyServer", false);
|
||||
}
|
||||
|
||||
public static void setProxyStatus(boolean status) {
|
||||
Preferences.getPreferences().edit().putBoolean("useProxyServer", status).apply();
|
||||
}
|
||||
|
||||
public static String getConfigNetworkProxy() {
|
||||
if (nwProxyCerts.isEmpty()) {
|
||||
load();
|
||||
}
|
||||
return nwProxy;
|
||||
}
|
||||
|
||||
public static String getConfigNetworkProxyCerts() {
|
||||
if (nwProxyCerts.isEmpty()) {
|
||||
load();
|
||||
}
|
||||
return nwProxyCerts;
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
Request request = new Request.a()
|
||||
.b("https://firebaseremoteconfig.googleapis.com/v1/projects/api-project-841415684880/namespaces/firebase:fetch")
|
||||
.a(RequestBody.a(MediaType.b("application/json; charset=UTF-8"), "{\"appId\":\"1:841415684880:android:632f429381141121\",\"appInstanceId\":\"RB855168585SG\"}\n"))
|
||||
// .a("Content-Encoding", "gzip")
|
||||
// .a("Accept-Encoding", "gzip")
|
||||
.a("Connection", "Keep-Alive")
|
||||
.a("X-Android-Package", "com.vkontakte.android")
|
||||
.a("X-Android-Cert", "C8EAB7342DA62B4A229E1BFDEB27B029DD6788A1")
|
||||
.a("Host", "firebaseremoteconfig.googleapis.com")
|
||||
.a("x-goog-api-key", "AIzaSyCL17U2Q5i1NVwIcXgMOZMidSRFHyGYgwM")
|
||||
.a("User-Agent", Network.l.c().a())
|
||||
.a();
|
||||
|
||||
sClient.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("VKProxy", e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response) throws IOException {
|
||||
String payload = response.a().g();
|
||||
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(payload).getJSONObject("entries");
|
||||
String configNetworkProxy = jsonObject.getString("config_network_proxy");
|
||||
String configNetworkProxyCerts = jsonObject.getString("config_network_proxy_certs");
|
||||
|
||||
Log.d("VKProxy", configNetworkProxy);
|
||||
Log.d("VKProxy", configNetworkProxyCerts);
|
||||
|
||||
new ProxySettings().c(configNetworkProxy);
|
||||
new ProxySettings().b(configNetworkProxyCerts);
|
||||
|
||||
Preferences.getPreferences().edit().putString("configNetworkProxy", configNetworkProxy).putString("configNetworkProxyCerts", configNetworkProxyCerts).apply();
|
||||
|
||||
nwProxy = configNetworkProxy;
|
||||
nwProxyCerts = configNetworkProxyCerts;
|
||||
|
||||
AndroidUtils.sendToast("Инициализированы прокси");
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import com.vk.medianative.MediaNative;
|
||||
import com.vtosters.lite.data.Users;
|
||||
import com.vtosters.lite.fragments.SettingsListFragment;
|
||||
import ru.vtosters.hooks.GmsHook;
|
||||
import ru.vtosters.hooks.VKProxy;
|
||||
import ru.vtosters.hooks.VerificationsHook;
|
||||
import ru.vtosters.lite.BuildConfig;
|
||||
import ru.vtosters.lite.proxy.ProxyUtils;
|
||||
@@ -33,6 +34,7 @@ public class Preferences {
|
||||
LifecycleUtils.registerActivities(application);
|
||||
|
||||
AnalyticsHelper.start(application);
|
||||
VKProxy.load();
|
||||
} // VK Init
|
||||
|
||||
public static String getBuildName() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package ru.vtosters.hooks.other;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Color;
|
||||
@@ -73,7 +74,7 @@ public class ThemesUtils {
|
||||
}
|
||||
|
||||
public static boolean isMonetTheme() {
|
||||
return getBoolValue("monettheme", false) && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S;
|
||||
return getBoolValue("monettheme", false);
|
||||
}
|
||||
|
||||
public static boolean isAmoledTheme() {
|
||||
@@ -340,7 +341,7 @@ public class ThemesUtils {
|
||||
}
|
||||
|
||||
public static int getColor(int i) {
|
||||
return ThemesHacks.getHackedColor(getGlobalContext(), i);
|
||||
return ThemesHacks.getHackedColor(LifecycleUtils.getCurrentActivity(), i);
|
||||
} // Android Support color injector + accent color checker
|
||||
|
||||
public static int getAlertStyle() {
|
||||
@@ -391,14 +392,14 @@ public class ThemesUtils {
|
||||
return vkme() ? R.dimen.app_minimumsize_h : Default;
|
||||
}
|
||||
|
||||
public static ColorStateList getCSTDock() {
|
||||
public static ColorStateList getCSTDock(Context ctx) {
|
||||
return new ColorStateList(
|
||||
new int[][]{
|
||||
new int[]{android.R.attr.state_checked},
|
||||
new int[]{-android.R.attr.state_checked}
|
||||
},
|
||||
new int[]{
|
||||
dockbar_accent() ? getAccentColor() : (isDarkTheme() ? getResources().getColor(R.color.white) : getResources().getColor(R.color.gray_700)),
|
||||
dockbar_accent() ? getAccentColor() : (isDarkTheme() ? ThemesHacks.getColors(ctx, R.color.white) : ThemesHacks.getColors(ctx, R.color.gray_700)),
|
||||
getColorFromAttr(R.attr.tabbar_inactive_icon)
|
||||
}
|
||||
);
|
||||
|
||||
@@ -6,43 +6,43 @@ import android.util.Log;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.net.Request;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.format.DateTimeParseException;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Optional;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static android.widget.Toast.makeText;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
|
||||
public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"");
|
||||
private static final String DELETED = "<ya:profileState>deleted</ya:profileState>";
|
||||
private static final String API_VKNEXT = "https://api.vtosters.app/v1/getBypassedOnlineInfo?json=1&ids=";
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
|
||||
public static JSONObject getBypassedOnlineInfo(int id) throws JSONException {
|
||||
var request = new okhttp3.Request.a()
|
||||
Request request = new Request.a()
|
||||
.b(API_VKNEXT + id)
|
||||
.a();
|
||||
|
||||
String response;
|
||||
|
||||
var dummy = new JSONObject();
|
||||
JSONObject dummy = new JSONObject();
|
||||
dummy.put("last_seen", 0);
|
||||
|
||||
try {
|
||||
response = client.a(request).execute().a().g();
|
||||
var online_info = new JSONObject(response).optJSONObject("response").optJSONObject(Integer.toString(id));
|
||||
try (Response response = client.a(request).execute()) {
|
||||
JSONObject online_info = new JSONObject(response.a().g()).getJSONObject("response").optJSONObject(Integer.toString(id));
|
||||
return online_info == null ? dummy : online_info;
|
||||
} catch (Exception e) {
|
||||
Log.e("GetBypassedOnlineInfo", e.getMessage());
|
||||
@@ -51,17 +51,14 @@ public class FoafBase {
|
||||
}
|
||||
|
||||
public static JSONObject getBypassedOnlineInfo(String ids) {
|
||||
var request = new okhttp3.Request.a()
|
||||
Request request = new Request.a()
|
||||
.b(API_VKNEXT + ids)
|
||||
.a();
|
||||
|
||||
String response;
|
||||
JSONObject dummy = new JSONObject();
|
||||
|
||||
var dummy = new JSONObject();
|
||||
|
||||
try {
|
||||
response = client.a(request).execute().a().g();
|
||||
var online_info = new JSONObject(response).optJSONObject("response");
|
||||
try (Response response = client.a(request).execute()) {
|
||||
JSONObject online_info = new JSONObject(response.a().g()).getJSONObject("response").optJSONObject("response");
|
||||
return online_info == null ? dummy : online_info;
|
||||
} catch (Exception e) {
|
||||
Log.e("GetBypassedOnlineInfo1", e.getMessage());
|
||||
@@ -70,18 +67,8 @@ public class FoafBase {
|
||||
}
|
||||
|
||||
private static String getLink(int i) {
|
||||
String str;
|
||||
StringBuilder sb;
|
||||
if (isAnyProxyEnabled()) {
|
||||
sb = new StringBuilder();
|
||||
str = "https://" + getApi() + "/_/vk.com/foaf.php?id=";
|
||||
} else {
|
||||
sb = new StringBuilder();
|
||||
str = "https://vk.com/foaf.php?id=";
|
||||
}
|
||||
sb.append(str);
|
||||
sb.append(i);
|
||||
return sb.toString();
|
||||
String prefix = isAnyProxyEnabled() ? "https://" + getApi() + "/_/vk.com/foaf.php?id=" : "https://vk.com/foaf.php?id=";
|
||||
return prefix + i;
|
||||
}
|
||||
|
||||
public static void loadAndShow(Context context, int i) {
|
||||
@@ -90,49 +77,69 @@ public class FoafBase {
|
||||
progressDialog.setCancelable(false);
|
||||
progressDialog.show();
|
||||
|
||||
Request.RequestCallback callback = str -> FoafBase.lambdaLoadAndShow(progressDialog, context, i, str);
|
||||
Request.makeRequest(getLink(i), callback);
|
||||
Request request = new Request.a()
|
||||
.b(getLink(i))
|
||||
.a();
|
||||
|
||||
try (Response response = client.a(request).execute()) {
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> {
|
||||
try {
|
||||
showFoafInfo(progressDialog, context, i, response.a().g());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
});
|
||||
} catch (Exception e) {
|
||||
Log.e("FoafBase", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
static void lambdaLoadAndShow(ProgressDialog progressDialog, Context context, int i, String str) {
|
||||
try {
|
||||
progressDialog.cancel();
|
||||
Matcher matcher = FOAF_REGEX.matcher(str);
|
||||
matcher.find();
|
||||
private static void showFoafInfo(ProgressDialog progressDialog, Context context, int i, String str) {
|
||||
progressDialog.cancel();
|
||||
Optional<String> foafDate = findPattern(str, FOAF_REGEX);
|
||||
|
||||
String m = matcher.group(1);
|
||||
Log.e("FoafBase", str);
|
||||
|
||||
if (m == null) {
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> makeText(getGlobalContext(), context.getString(R.string.foaferr), LENGTH_SHORT).show());
|
||||
return;
|
||||
}
|
||||
|
||||
String normalHumanDate = getNormalHumanDate(m);
|
||||
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> new VkAlertDialog.Builder(context)
|
||||
.setTitle(R.string.addinf)
|
||||
.setMessage(context.getString(R.string.foafid) +
|
||||
" " + i + context.getString(R.string.foafregdate)
|
||||
+ " " + normalHumanDate + context.getString(R.string.foafdate)
|
||||
+ " " + daysPassedFromFoafDate(normalHumanDate))
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show());
|
||||
} catch (Exception e) {
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> makeText(getGlobalContext(), context.getString(R.string.foaferr), LENGTH_SHORT).show());
|
||||
if (foafDate.isPresent()) {
|
||||
String normalHumanDate = getNormalHumanDate(foafDate.get());
|
||||
long daysPassed = daysPassedFromFoafDate(normalHumanDate);
|
||||
showFoafDialog(context, i, normalHumanDate, daysPassed);
|
||||
} else if (str.contains(DELETED)) {
|
||||
AndroidUtils.sendToast("Профиль удален или не существует (аккаунт VK Мессенджера)");
|
||||
} else {
|
||||
AndroidUtils.sendToast(context.getString(R.string.foaferr));
|
||||
}
|
||||
}
|
||||
|
||||
private static Optional<String> findPattern(String str, Pattern pattern) {
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
if (matcher.find() && matcher.groupCount() != 0) {
|
||||
return Optional.ofNullable(matcher.group(1));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
||||
private static void showFoafDialog(Context context, int i, String normalHumanDate, long daysPassed) {
|
||||
String message = String.format("%s %d%s %s%s %d", context.getString(R.string.foafid), i, context.getString(R.string.foafregdate), normalHumanDate, context.getString(R.string.foafdate), daysPassed);
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(R.string.addinf)
|
||||
.setMessage(message)
|
||||
.setPositiveButton(android.R.string.ok, null)
|
||||
.show();
|
||||
}
|
||||
|
||||
private static long daysPassedFromFoafDate(String str) {
|
||||
try {
|
||||
Date parse = new SimpleDateFormat("yyyy-MM-dd").parse(str.split(" ")[1]);
|
||||
return TimeUnit.DAYS.convert(new Date().getTime() - parse.getTime(), TimeUnit.MILLISECONDS);
|
||||
} catch (ParseException e) {
|
||||
LocalDate foafDate = LocalDate.parse(str.split(" ")[1]);
|
||||
return ChronoUnit.DAYS.between(foafDate, LocalDate.now());
|
||||
} catch (DateTimeParseException e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
private static String getNormalHumanDate(String str) {
|
||||
String[] split = str.split("T");
|
||||
return split[1].split("\\+")[0] + " " + split[0];
|
||||
OffsetDateTime dateTime = OffsetDateTime.parse(str);
|
||||
return dateTime.format(DateTimeFormatter.ofPattern("HH:mm:ss yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,22 +31,30 @@ public class ThemesHacks {
|
||||
}
|
||||
}
|
||||
|
||||
if (ThemesCore.isCachedAccents() && ColorReferences.isAccentedColor(context.getResources().getColor(color))) {
|
||||
if (ThemesCore.isCachedAccents() && ColorReferences.isAccentedColor(getColors(context, color))) {
|
||||
return ThemesUtils.getAccentColor();
|
||||
}
|
||||
|
||||
if (ThemesCore.isCachedAccents() && ColorReferences.isMutedAccentedColor(context.getResources().getColor(color))) {
|
||||
if (ThemesCore.isCachedAccents() && ColorReferences.isMutedAccentedColor(getColors(context, color))) {
|
||||
return ThemesUtils.getMutedAccentColor();
|
||||
}
|
||||
}
|
||||
|
||||
return Build.VERSION.SDK_INT > 23 ? context.getColor(color) : context.getResources().getColor(color);
|
||||
return getColors(context, color);
|
||||
}
|
||||
|
||||
public static int getColors(Context context, int color) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
return context.getColor(color);
|
||||
} else {
|
||||
return context.getResources().getColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
// Фиксит селектор (все/свои/архив) в профиле
|
||||
public static void fixProfileSelector(View view) {
|
||||
if (!ThemesUtils.isMilkshake()) return;
|
||||
var id = view.getId();
|
||||
int id = view.getId();
|
||||
|
||||
if (id == R.id.profile_wall_owner_posts || id == R.id.profile_wall_all_posts || id == R.id.profile_wall_archived_posts) {
|
||||
StateListDrawable states = (StateListDrawable) ((LayerDrawable) view.getBackground()).getDrawable(0);
|
||||
|
||||
@@ -3,6 +3,7 @@ package ru.vtosters.lite.themes;
|
||||
import android.app.Application;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import com.google.devrel.gmscore.tools.apk.arsc.BinaryResourceFile;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
@@ -12,6 +13,8 @@ import ru.vtosters.lite.themes.utils.ArscEditor;
|
||||
import ru.vtosters.lite.utils.IOUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.zip.CRC32;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
@@ -123,7 +126,7 @@ public class ThemesManager {
|
||||
ResourcesLoader.load(app, modApk.getAbsolutePath(), false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,61 +155,72 @@ public class ThemesManager {
|
||||
}
|
||||
|
||||
public static void generateModApk(int accentColor) throws Throwable {
|
||||
try (var apk = new ZipFile(baseApkPath)) {
|
||||
var arscEntry = apk.getEntry("resources.arsc");
|
||||
var arscBis = new BufferedInputStream(apk.getInputStream(arscEntry));
|
||||
var arsc = BinaryResourceFile.fromInputStream(arscBis);
|
||||
try (ZipFile apk = new ZipFile(baseApkPath);
|
||||
ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(modApk)))) {
|
||||
|
||||
ZipEntry arscEntry = apk.getEntry("resources.arsc");
|
||||
BufferedInputStream arscBis = new BufferedInputStream(apk.getInputStream(arscEntry));
|
||||
BinaryResourceFile arsc = BinaryResourceFile.fromInputStream(arscBis);
|
||||
ArscEditor.changeColors(arsc, ACCENT_COLORS, accentColor);
|
||||
|
||||
try (var zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(modApk)))) {
|
||||
var arscBuff = arsc.toByteArray();
|
||||
var newArscEntry = new ZipEntry("resources.arsc");
|
||||
byte[] arscBuff = arsc.toByteArray();
|
||||
ZipEntry newArscEntry = new ZipEntry("resources.arsc");
|
||||
|
||||
var crc = new CRC32();
|
||||
crc.update(arscBuff);
|
||||
CRC32 crc = new CRC32();
|
||||
crc.update(arscBuff);
|
||||
|
||||
newArscEntry.setSize(arscBuff.length);
|
||||
newArscEntry.setMethod(ZipEntry.STORED);
|
||||
newArscEntry.setCrc(crc.getValue());
|
||||
newArscEntry.setSize(arscBuff.length);
|
||||
newArscEntry.setMethod(ZipEntry.STORED);
|
||||
newArscEntry.setCrc(crc.getValue());
|
||||
|
||||
zos.putNextEntry(newArscEntry);
|
||||
zos.write(arscBuff);
|
||||
zos.closeEntry();
|
||||
zos.putNextEntry(newArscEntry);
|
||||
zos.write(arscBuff);
|
||||
zos.closeEntry();
|
||||
|
||||
var entries = apk.entries();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
apk.stream()
|
||||
.filter(entry -> entry.getName().startsWith("res/") || entry.getName().startsWith("assets/") && !entry.getName().equals("resources.arsc"))
|
||||
.forEach(entry -> {
|
||||
try {
|
||||
String name = entry.getName();
|
||||
workWithApk(zos, name, apk.getInputStream(entry), entry.getSize(), entry.getCrc());
|
||||
} catch (IOException e) {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Enumeration<? extends ZipEntry> entries = apk.entries();
|
||||
while (entries.hasMoreElements()) {
|
||||
var entry = entries.nextElement();
|
||||
var name = entry.getName();
|
||||
|
||||
if (!name.startsWith("res/") && !name.startsWith("assets/") || name.equals("resources.arsc"))
|
||||
continue;
|
||||
|
||||
var doNotCompress = false;
|
||||
for (var suffix : DO_NOT_COMPRESS) {
|
||||
if (name.endsWith(suffix)) {
|
||||
doNotCompress = true;
|
||||
break;
|
||||
}
|
||||
ZipEntry entry = entries.nextElement();
|
||||
String name = entry.getName();
|
||||
if (name.startsWith("res/") || name.startsWith("assets/") && !name.equals("resources.arsc")) {
|
||||
workWithApk(zos, name, apk.getInputStream(entry), entry.getSize(), entry.getCrc());
|
||||
}
|
||||
|
||||
var entryBis = new BufferedInputStream(apk.getInputStream(entry));
|
||||
var newEntry = new ZipEntry(name);
|
||||
|
||||
if (doNotCompress) {
|
||||
newEntry.setMethod(ZipEntry.STORED);
|
||||
newEntry.setSize(entry.getSize());
|
||||
newEntry.setCrc(entry.getCrc());
|
||||
} else newEntry.setMethod(ZipEntry.DEFLATED);
|
||||
|
||||
zos.putNextEntry(newEntry);
|
||||
IOUtils.copy(entryBis, zos);
|
||||
entryBis.close();
|
||||
zos.closeEntry();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void workWithApk(ZipOutputStream zos, String name, InputStream inputStream, long size, long crc) throws IOException {
|
||||
boolean doNotCompress = Arrays.stream(DO_NOT_COMPRESS).anyMatch(name::endsWith);
|
||||
|
||||
BufferedInputStream entryBis = new BufferedInputStream(inputStream);
|
||||
ZipEntry newEntry = new ZipEntry(name);
|
||||
|
||||
if (doNotCompress) {
|
||||
newEntry.setMethod(ZipEntry.STORED);
|
||||
newEntry.setSize(size);
|
||||
newEntry.setCrc(crc);
|
||||
} else {
|
||||
newEntry.setMethod(ZipEntry.DEFLATED);
|
||||
}
|
||||
|
||||
zos.putNextEntry(newEntry);
|
||||
IOUtils.copy(entryBis, zos);
|
||||
entryBis.close();
|
||||
zos.closeEntry();
|
||||
}
|
||||
|
||||
public static void deleteModification() {
|
||||
modApk.delete();
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import ru.vtosters.hooks.other.ThemesUtils;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class VTLResources extends Resources {
|
||||
private static final String TAG = "VTLResources";
|
||||
@@ -32,12 +33,8 @@ public class VTLResources extends Resources {
|
||||
attributesToTheme.add(16843173);
|
||||
}
|
||||
|
||||
private final Context context;
|
||||
|
||||
public VTLResources(Context context, Resources parent) {
|
||||
super(parent.getAssets(), parent.getDisplayMetrics(), parent.getConfiguration());
|
||||
this.context = context;
|
||||
// Log.d(TAG, "VTLResources: init");
|
||||
}
|
||||
|
||||
private static boolean isAttrThemeable(int attrID) {
|
||||
@@ -49,42 +46,49 @@ public class VTLResources extends Resources {
|
||||
return (int[]) typedArrayField.get(arr);
|
||||
} catch (IllegalAccessException e) {
|
||||
Log.e(TAG, "getArrayData: ", e);
|
||||
e.printStackTrace();
|
||||
e.fillInStackTrace();
|
||||
return new int[0];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypedArray obtainAttributes(AttributeSet set, int[] attrs) {
|
||||
var typedArray = super.obtainAttributes(set, attrs);
|
||||
var data = getArrayData(typedArray);
|
||||
for (int i = 0; i < attrs.length; i++) {
|
||||
try {
|
||||
int attrID = attrs[i];
|
||||
if (attributesToTheme.contains(attrID)) {
|
||||
int type = data[i * 6];
|
||||
int cnt = data[(i * 6) + 1];
|
||||
TypedArray typedArray = super.obtainAttributes(set, attrs);
|
||||
|
||||
if (type == TypedValue.TYPE_ATTRIBUTE && isAttrThemeable(cnt)) {
|
||||
data[i * 6] = TypedValue.TYPE_INT_COLOR_RGB8;
|
||||
data[(i * 6) + 1] = ThemesUtils.getAccentColor();
|
||||
data[(i * 6) + 2] = 0; // clear reference content
|
||||
if (ThemesUtils.isMonetTheme()) {
|
||||
int[] data = getArrayData(typedArray);
|
||||
IntStream.range(0, attrs.length).forEach(i -> {
|
||||
try {
|
||||
int attrID = attrs[i];
|
||||
if (attributesToTheme.contains(attrID)) {
|
||||
int type = data[i * 6];
|
||||
int cnt = data[(i * 6) + 1];
|
||||
|
||||
if (type == TypedValue.TYPE_ATTRIBUTE && isAttrThemeable(cnt)) {
|
||||
data[i * 6] = TypedValue.TYPE_INT_COLOR_RGB8;
|
||||
data[(i * 6) + 1] = ThemesUtils.getAccentColor();
|
||||
data[(i * 6) + 2] = 0; // clear reference content
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "TAVzlom failed! (obtainAttributes)");
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "TAVzlom failed! (obtainAttributes)");
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
return typedArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getDrawable(int id, @Nullable Theme theme) throws NotFoundException {
|
||||
var drawable = super.getDrawable(id, theme);
|
||||
if (id == com.vtosters.lite.R.drawable.newsfeed_tab_dropdown_16) {
|
||||
ThemesHacks.fixDropdown(drawable);
|
||||
}
|
||||
Drawable drawable = super.getDrawable(id, theme);
|
||||
fixDropdown(id, drawable);
|
||||
return drawable;
|
||||
}
|
||||
|
||||
private void fixDropdown(int id, Drawable drawable) {
|
||||
if (id == com.vtosters.lite.R.drawable.newsfeed_tab_dropdown_16 && ThemesUtils.isMonetTheme()) {
|
||||
ThemesHacks.fixDropdown(drawable);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package ru.vtosters.lite.themes;
|
||||
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import ru.vtosters.hooks.other.ThemesUtils;
|
||||
import ru.vtosters.lite.themes.hooks.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class ViewInjector {
|
||||
public static ArrayList<BaseHook> hooks = new ArrayList<>();
|
||||
@@ -22,15 +24,19 @@ public class ViewInjector {
|
||||
|
||||
public static View inject(View view, int i, boolean z) {
|
||||
if (ThemesUtils.isMonetTheme()) {
|
||||
for (BaseHook hook : hooks) {
|
||||
hook.inject(view, i, z);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
hooks.forEach(hook -> hook.inject(view, i, z));
|
||||
} else {
|
||||
for (BaseHook hook : hooks) {
|
||||
hook.inject(view, i, z);
|
||||
}
|
||||
}
|
||||
|
||||
if (view instanceof ViewGroup) {
|
||||
var viewGroup = (ViewGroup) view;
|
||||
for (int i2 = 0; i2 < viewGroup.getChildCount(); i2++) {
|
||||
inject(viewGroup.getChildAt(i2), i, false);
|
||||
}
|
||||
ViewGroup viewGroup = (ViewGroup) view;
|
||||
IntStream.range(0, viewGroup.getChildCount())
|
||||
.mapToObj(viewGroup::getChildAt)
|
||||
.forEach(child -> inject(child, i, false));
|
||||
}
|
||||
}
|
||||
return view;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class TextViewHook implements BaseHook {
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof TextView) {
|
||||
if (view instanceof TextView && ThemesUtils.isMonetTheme()) {
|
||||
var textView = (TextView) view;
|
||||
|
||||
if (ColorReferences.isAccentedColor(textView.getCurrentTextColor())) {
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import com.vk.core.drawable.RecoloredDrawable;
|
||||
@@ -9,16 +12,17 @@ public class ToolbarHook implements BaseHook {
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof Toolbar) {
|
||||
var color = (ThemesUtils.isMilkshake() && !ThemesUtils.isDarkTheme()) ? ThemesUtils.getAccentColor() : ThemesUtils.getHeaderText();
|
||||
var menu = ((Toolbar) view).getMenu();
|
||||
int color = (ThemesUtils.isMilkshake() && !ThemesUtils.isDarkTheme()) ? ThemesUtils.getAccentColor() : ThemesUtils.getHeaderText();
|
||||
Menu menu = ((Toolbar) view).getMenu();
|
||||
for (int j = 0; j < menu.size(); ++j) {
|
||||
var item = menu.getItem(j);
|
||||
var icon = item.getIcon();
|
||||
MenuItem item = menu.getItem(j);
|
||||
Drawable icon = item.getIcon();
|
||||
if (icon != null) {
|
||||
if (icon instanceof RecoloredDrawable)
|
||||
if (icon instanceof RecoloredDrawable) {
|
||||
((RecoloredDrawable) icon).a(color);
|
||||
else
|
||||
} else {
|
||||
icon = new RecoloredDrawable(icon, color);
|
||||
}
|
||||
item.setIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package ru.vtosters.lite.themes.items;
|
||||
|
||||
import android.graphics.Color;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
public class VTLPalette {
|
||||
public String id;
|
||||
@@ -25,29 +27,38 @@ public class VTLPalette {
|
||||
}
|
||||
|
||||
public static VTLPalette fromJson(JSONObject json) throws JSONException {
|
||||
var palette = new VTLPalette()
|
||||
VTLPalette palette = new VTLPalette()
|
||||
.setId(json.optString("palette_id"))
|
||||
.setName(json.optString("name"))
|
||||
.setAuthor(json.optString("author"));
|
||||
var paletteNode = json.getJSONArray("palette");
|
||||
for (int i = 0; i < paletteNode.length(); i++) {
|
||||
var colorNode = paletteNode.getJSONObject(i);
|
||||
var name = colorNode.getString("name");
|
||||
if (colorNode.has("colors")) {
|
||||
var colorsNode = colorNode.getJSONArray("colors");
|
||||
for (int j = 0; j < colorsNode.length(); j++) {
|
||||
var subColorNode = colorsNode.getJSONObject(j);
|
||||
var index = subColorNode.getString("index");
|
||||
var subColor = subColorNode.getString("color");
|
||||
if (!subColor.startsWith("#")) subColor = "#" + subColor;
|
||||
palette.setColor(name + " " + index, Color.parseColor(subColor));
|
||||
}
|
||||
} else {
|
||||
var color = colorNode.getString("color");
|
||||
if (!color.startsWith("#")) color = "#" + color;
|
||||
palette.setColor(name, Color.parseColor(color));
|
||||
}
|
||||
}
|
||||
JSONArray paletteNode = json.getJSONArray("palette");
|
||||
IntStream.range(0, paletteNode.length())
|
||||
.mapToObj(paletteNode::optJSONObject)
|
||||
.forEach(colorNode -> {
|
||||
String name = colorNode.optString("name");
|
||||
if (colorNode.has("colors")) {
|
||||
JSONArray colorsNode;
|
||||
try {
|
||||
colorsNode = colorNode.getJSONArray("colors");
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
IntStream.range(0, colorsNode.length())
|
||||
.mapToObj(colorsNode::optJSONObject)
|
||||
.forEach(subColorNode -> {
|
||||
String index = subColorNode.optString("index");
|
||||
String subColor = subColorNode.optString("color");
|
||||
if (!subColor.startsWith("#")) subColor = "#" + subColor;
|
||||
palette.setColor(name + " " + index, Color.parseColor(subColor));
|
||||
});
|
||||
} else {
|
||||
String color = colorNode.optString("color");
|
||||
if (!color.startsWith("#")) {
|
||||
color = "#" + color;
|
||||
}
|
||||
palette.setColor(name, Color.parseColor(color));
|
||||
}
|
||||
});
|
||||
return palette;
|
||||
}
|
||||
|
||||
@@ -79,15 +90,15 @@ public class VTLPalette {
|
||||
return this;
|
||||
}
|
||||
|
||||
public VTLPalette setColor(String name, int color) {
|
||||
public void setColor(String name, int color) {
|
||||
this.colors.add(new VTLColor(name, 0, color));
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getColor(String name) {
|
||||
for (var item : colors)
|
||||
if (name.equals(item.resName))
|
||||
return item.color;
|
||||
return -1;
|
||||
return colors.stream()
|
||||
.filter(item -> name.equals(item.resName))
|
||||
.map(item -> item.color)
|
||||
.findFirst()
|
||||
.orElse(-1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,11 @@ package ru.vtosters.lite.themes.loaders;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.AssetManager;
|
||||
import ru.vtosters.lite.utils.ReflectionUtils;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
@SuppressLint("PrivateApi")
|
||||
public class AssetManagerHelper {
|
||||
public static String getApkPath(Object assetManager, String packagename) throws InvocationTargetException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException {
|
||||
Object[] apkAssetsArr = (Object[]) ReflectionUtils.findMethod(Class.forName("android.content.res.ApkAssets"), "getAssetPath").invoke(assetManager);
|
||||
// By default, base apk is the last element of array if is not, for execution speed, we should iterate array from the end to the beginning
|
||||
for (int i = apkAssetsArr.length - 1; i >= 0; i--) {
|
||||
String pathname = (String) ReflectionUtils.findMethod(AssetManager.class, "getApkAssets").invoke(apkAssetsArr[i]);
|
||||
if (pathname != null && pathname.contains(packagename)) return pathname;
|
||||
}
|
||||
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
//region Uses for adding own assets or getting existing cookies
|
||||
public static void addAssetPath(AssetManager manager, String path) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
|
||||
manager.getClass().getMethod("addAssetPath", String.class).invoke(manager, path);
|
||||
|
||||
@@ -171,8 +171,6 @@ public class ResourcesLoader {
|
||||
implAssets.set(resourceImpl, sAssetManager);
|
||||
}
|
||||
|
||||
clearPreloadTypedArrayIssue(resources);
|
||||
|
||||
resources.updateConfiguration(resources.getConfiguration(), resources.getDisplayMetrics());
|
||||
}
|
||||
|
||||
@@ -235,33 +233,6 @@ public class ResourcesLoader {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Why must I do these?
|
||||
* Resource has mTypedArrayPool field, which just like Message Poll to reduce gc
|
||||
* MiuiResource change TypedArray to MiuiTypedArray, but it get string block from offset instead of assetManager
|
||||
*/
|
||||
private static void clearPreloadTypedArrayIssue(Resources resources) {
|
||||
// Perform this trick not only in Miui system since we can't predict if any other
|
||||
// manufacturer would do the same modification to Android.
|
||||
// if (!isMiuiSystem) {
|
||||
// return;
|
||||
// }
|
||||
Log.w("ResourcesLoader", "try to clear typedArray cache!");
|
||||
// Clear typedArray cache.
|
||||
try {
|
||||
Field typedArrayPoolField = ReflectionUtils.findField(Resources.class, "mTypedArrayPool");
|
||||
Object origTypedArrayPool = typedArrayPoolField.get(resources);
|
||||
Method acquireMethod = ReflectionUtils.findMethod(origTypedArrayPool, "acquire");
|
||||
while (true) {
|
||||
if (acquireMethod.invoke(origTypedArrayPool) == null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
Log.e("ResourcesLoader", "clearPreloadTypedArrayIssue failed, ignore error: " + ignored);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean shouldAddSharedLibraryAssets(ApplicationInfo applicationInfo) {
|
||||
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && applicationInfo != null &&
|
||||
applicationInfo.sharedLibraryFiles != null;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ru.vtosters.lite.themes.palettes;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -15,8 +15,7 @@ import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import static android.widget.Toast.makeText;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
@@ -51,7 +50,7 @@ public class PalettesManager {
|
||||
return;
|
||||
}
|
||||
|
||||
var palettes = PALETTES_DIR.listFiles((dir, name) -> name.endsWith(".json"));
|
||||
File[] palettes = PALETTES_DIR.listFiles((dir, name) -> name.endsWith(".json"));
|
||||
if (palettes == null || palettes.length == 0)
|
||||
copyPaletteFromAssets();
|
||||
parsePalettes();
|
||||
@@ -59,45 +58,49 @@ public class PalettesManager {
|
||||
|
||||
private void copyPaletteFromAssets() {
|
||||
try {
|
||||
var manager = AndroidUtils.getGlobalContext().getAssets();
|
||||
var assets = manager.list(ASSETS_DIR);
|
||||
if (assets == null || assets.length == 0) return;
|
||||
for (var asset : assets) {
|
||||
try {
|
||||
IOUtils.copy(manager.open(ASSETS_DIR + asset), new File(PALETTES_DIR, asset));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
AssetManager manager = getGlobalContext().getAssets();
|
||||
Arrays.stream(manager.list(ASSETS_DIR))
|
||||
.filter(Objects::nonNull)
|
||||
.forEach(asset -> {
|
||||
try {
|
||||
IOUtils.copy(manager.open(ASSETS_DIR + asset), new File(PALETTES_DIR, asset));
|
||||
} catch (IOException e) {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
});
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void parsePalettes() {
|
||||
var arr = PALETTES_DIR.listFiles((dir, name) -> name.endsWith(".json"));
|
||||
|
||||
if (arr == null || arr.length == 0) {
|
||||
Log.d("PalettesManager", "arr.length null");
|
||||
return;
|
||||
}
|
||||
|
||||
for (var file : arr) {
|
||||
try {
|
||||
var json = new JSONObject(IOUtils.readAllLines(file));
|
||||
mPalettes.add(VTLPalette.fromJson(json));
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Optional.ofNullable(PALETTES_DIR.listFiles((dir, name) -> name.endsWith(".json")))
|
||||
.ifPresent(arr -> Arrays.stream(arr)
|
||||
.map(file -> {
|
||||
try {
|
||||
return new JSONObject(IOUtils.readAllLines(file));
|
||||
} catch (IOException | JSONException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.map(json -> {
|
||||
try {
|
||||
return json != null ? VTLPalette.fromJson(json) : null;
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
})
|
||||
.forEach(mPalettes::add));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VTLPalette getPalette(String id) {
|
||||
for (var palette : mPalettes)
|
||||
if (id.equals(palette.id))
|
||||
return palette;
|
||||
return null;
|
||||
return mPalettes.stream()
|
||||
.filter(palette -> id.equals(palette.id))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -108,4 +111,4 @@ public class PalettesManager {
|
||||
public int getPalettesCount() {
|
||||
return mPalettes.size();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,29 +4,30 @@ import com.google.devrel.gmscore.tools.apk.arsc.BinaryResourceFile;
|
||||
import com.google.devrel.gmscore.tools.apk.arsc.BinaryResourceValue;
|
||||
import com.google.devrel.gmscore.tools.apk.arsc.ResourceTableChunk;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ArscEditor {
|
||||
|
||||
public static void changeColors(BinaryResourceFile arsc, int[] colorIds, int color) {
|
||||
for (var chunk : arsc.getChunks()) {
|
||||
var resTableChunk = (ResourceTableChunk) chunk;
|
||||
for (var packageChunk : resTableChunk.getPackages()) {
|
||||
for (var typeChunk : packageChunk.getTypeChunks("color")) {
|
||||
for (var entry : typeChunk.getEntries().entrySet()) {
|
||||
var value = entry.getValue();
|
||||
if (value.isComplex()) continue;
|
||||
var binValue = value.value();
|
||||
if (!isColorResourceValue(binValue)) continue;
|
||||
var resId = packageChunk.getId() << 24 | typeChunk.getId() << 16 | entry.getKey();
|
||||
for (var colodId : colorIds) {
|
||||
if (resId == colodId) {
|
||||
binValue.data = color;
|
||||
break;
|
||||
arsc.getChunks().stream()
|
||||
.filter(chunk -> chunk instanceof ResourceTableChunk)
|
||||
.map(chunk -> (ResourceTableChunk) chunk)
|
||||
.flatMap(resTableChunk -> resTableChunk.getPackages().stream())
|
||||
.flatMap(packageChunk -> packageChunk.getTypeChunks("color").stream()
|
||||
.map(typeChunk -> new AbstractMap.SimpleEntry<>(packageChunk, typeChunk)))
|
||||
.forEach(entry -> entry.getValue().getEntries().entrySet().stream()
|
||||
.filter(e -> !e.getValue().isComplex())
|
||||
.filter(e -> isColorResourceValue(e.getValue().value()))
|
||||
.forEach(e -> {
|
||||
BinaryResourceValue binValue = e.getValue().value();
|
||||
int resId = entry.getKey().getId() << 24 | entry.getValue().getId() << 16 | e.getKey();
|
||||
if (Arrays.stream(colorIds).anyMatch(colorId -> resId == colorId)) {
|
||||
if (binValue != null) {
|
||||
binValue.data = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
private static boolean isColorResourceValue(BinaryResourceValue value) {
|
||||
@@ -35,4 +36,4 @@ public class ArscEditor {
|
||||
|| value.type == BinaryResourceValue.Type.INT_COLOR_ARGB4
|
||||
|| value.type == BinaryResourceValue.Type.INT_COLOR_RGB4;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,27 +3,55 @@ package ru.vtosters.lite.themes.utils;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.util.SparseArray;
|
||||
import android.util.TypedValue;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.res.ColorStateListInflaterCompat;
|
||||
import com.vk.core.drawable.RecoloredDrawable;
|
||||
import ru.vtosters.hooks.other.ThemesUtils;
|
||||
import ru.vtosters.lite.themes.ColorReferences;
|
||||
import ru.vtosters.lite.themes.ThemesManager;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
public class RecolorUtils {
|
||||
public static Drawable recolorDrawableToolbar(Drawable drawable) {
|
||||
if (drawable == null) return null;
|
||||
private static final ThreadLocal<TypedValue> TL_TYPED_VALUE = new ThreadLocal<>();
|
||||
private static final WeakHashMap<Context, SparseArray<ColorStateListCacheEntry>> sColorStateCaches = new WeakHashMap<>(0);
|
||||
private static final Object sColorStateCacheLock = new Object();
|
||||
|
||||
return new RecoloredDrawable(drawable, ThemesUtils.getHeaderText());
|
||||
} // Recolor toolbar drawable to accent color
|
||||
private static void addColorStateListToCache(@NonNull Context context, @ColorRes int i, @NonNull ColorStateList colorStateList) {
|
||||
synchronized (sColorStateCacheLock) {
|
||||
SparseArray<ColorStateListCacheEntry> sparseArray = sColorStateCaches.get(context);
|
||||
if (sparseArray == null) {
|
||||
sparseArray = new SparseArray<>();
|
||||
sColorStateCaches.put(context, sparseArray);
|
||||
}
|
||||
sparseArray.append(i, new ColorStateListCacheEntry(colorStateList, context.getResources().getConfiguration()));
|
||||
}
|
||||
}
|
||||
|
||||
public static Drawable recolorDrawableInt(int drawable) {
|
||||
return recolorDrawable(drawable, ThemesUtils.getAccentColor());
|
||||
} // Get res drawable via id and coloring to accent
|
||||
private static ColorStateList getCachedColorStateList(@NonNull Context context, @ColorRes int i) {
|
||||
ColorStateListCacheEntry colorStateListCacheEntry;
|
||||
synchronized (sColorStateCacheLock) {
|
||||
SparseArray<ColorStateListCacheEntry> sparseArray = sColorStateCaches.get(context);
|
||||
if (sparseArray != null && sparseArray.size() > 0 && (colorStateListCacheEntry = sparseArray.get(i)) != null) {
|
||||
if (colorStateListCacheEntry.configuration.equals(context.getResources().getConfiguration())) {
|
||||
return colorStateListCacheEntry.value;
|
||||
}
|
||||
sparseArray.remove(i);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Drawable recolorDrawable(int drawable, int color) {
|
||||
return new RecoloredDrawable(AndroidUtils.getResources().getDrawable(drawable), color);
|
||||
@@ -34,19 +62,19 @@ public class RecolorUtils {
|
||||
}
|
||||
|
||||
public static int getColor(TypedArray ta, int index, int defval) {
|
||||
return recolorHexColor(ta.getColor(index, defval));
|
||||
return ThemesUtils.isMonetTheme() ? ta.getColor(index, defval) : recolorHexColor(ta.getColor(index, defval));
|
||||
}
|
||||
|
||||
public static void recolorTextView(TextView tw) {
|
||||
if (ColorReferences.isAccentedColor(tw.getTextColors())) {
|
||||
if (ColorReferences.isAccentedColor(tw.getTextColors()) && ThemesUtils.isMonetTheme()) {
|
||||
tw.setTextColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
public static int recolorHexColor(int i) {
|
||||
if (!ThemesUtils.isMonetTheme() || !ThemesManager.canApplyCustomAccent()) return i;
|
||||
var accented = ColorReferences.isAccentedColor(i);
|
||||
var mutedaccented = ColorReferences.isMutedAccentedColor(i);
|
||||
boolean accented = ColorReferences.isAccentedColor(i);
|
||||
boolean mutedaccented = ColorReferences.isMutedAccentedColor(i);
|
||||
return (accented || mutedaccented) ? (accented ? ThemesUtils.getAccentColor() : ThemesUtils.getMutedAccentColor()) : i;
|
||||
}
|
||||
|
||||
@@ -56,9 +84,51 @@ public class RecolorUtils {
|
||||
return ColorStateList.valueOf(ThemesUtils.getAccentColor());
|
||||
} // Recolor ColorStateList to accent color
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
private static ColorStateList inflateColorStateList(Context context, int i) {
|
||||
if (isColorInt(context, i)) {
|
||||
return null;
|
||||
}
|
||||
Resources resources = context.getResources();
|
||||
try {
|
||||
return ColorStateListInflaterCompat.createFromXml(resources, resources.getXml(i), context.getTheme());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isColorInt(@NonNull Context context, @ColorRes int i) {
|
||||
Resources resources = context.getResources();
|
||||
TypedValue typedValue = getTypedValue();
|
||||
resources.getValue(i, typedValue, true);
|
||||
int i2 = typedValue.type;
|
||||
return i2 >= 28 && i2 <= 31;
|
||||
}
|
||||
|
||||
private static TypedValue getTypedValue() {
|
||||
TypedValue typedValue = TL_TYPED_VALUE.get();
|
||||
if (typedValue == null) {
|
||||
TypedValue typedValue2 = new TypedValue();
|
||||
TL_TYPED_VALUE.set(typedValue2);
|
||||
return typedValue2;
|
||||
}
|
||||
return typedValue;
|
||||
}
|
||||
|
||||
@SuppressLint("UseCompatLoadingForColorStateLists")
|
||||
public static ColorStateList themeCSL(Context context, int color) {
|
||||
if (!ThemesUtils.isMonetTheme()) {
|
||||
ColorStateList cachedColorStateList = getCachedColorStateList(context, color);
|
||||
if (cachedColorStateList != null) {
|
||||
return cachedColorStateList;
|
||||
}
|
||||
|
||||
ColorStateList inflateColorStateList = inflateColorStateList(context, color);
|
||||
if (inflateColorStateList != null) {
|
||||
addColorStateListToCache(context, color, inflateColorStateList);
|
||||
return inflateColorStateList;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
return context.getColorStateList(color);
|
||||
} else {
|
||||
@@ -72,15 +142,7 @@ public class RecolorUtils {
|
||||
return ColorStateList.valueOf(ThemesUtils.getMutedAccentColor());
|
||||
}
|
||||
|
||||
ColorStateList csl;
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
csl = context.getColorStateList(color);
|
||||
} else {
|
||||
csl = context.getResources().getColorStateList(color);
|
||||
}
|
||||
|
||||
return themeCSL(csl);
|
||||
return themeCSL(context.getColorStateList(color));
|
||||
} // Recolor ColorStateList
|
||||
|
||||
public static ColorStateList themeCSL(ColorStateList csl) {
|
||||
@@ -120,4 +182,14 @@ public class RecolorUtils {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
static class ColorStateListCacheEntry {
|
||||
final Configuration configuration;
|
||||
final ColorStateList value;
|
||||
|
||||
ColorStateListCacheEntry(@NonNull ColorStateList colorStateList, @NonNull Configuration configuration) {
|
||||
this.value = colorStateList;
|
||||
this.configuration = configuration;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class VkUiThemer {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// This must go wrong, so we ignore any exceptions that may occur
|
||||
e.printStackTrace(); // REMOVE THIS!
|
||||
e.fillInStackTrace(); // REMOVE THIS!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,10 +129,6 @@ public class MediaFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
|
||||
findPreference("invertCachedTracks").setVisible(!MusicCacheImpl.isEmpty());
|
||||
|
||||
if (!LibVKXClient.isVkxInstalled()) {
|
||||
findPreference("vkx_sett").setVisible(false);
|
||||
}
|
||||
|
||||
findPreference("musicdefcatalog").setVisible(!Preferences.getBoolValue("useOldAppVer", false));
|
||||
findPreference("useOldAppVer").setOnPreferenceClickListener(preference -> {
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
|
||||
@@ -1,25 +1,34 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
import com.vk.core.preference.Preference;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.hooks.VKProxy;
|
||||
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
||||
|
||||
public class ProxySettingsFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(R.xml.preferences_proxy);
|
||||
// findPreference("random_proxy").setOnPreferenceClickListener(preference -> {
|
||||
// try {
|
||||
// setupNewProxy();
|
||||
// } catch (IOException e) {
|
||||
// sendToast(requireContext().getString(R.string.get_proxy_error));
|
||||
// }
|
||||
// return true;
|
||||
// });
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Use VK Proxy Server",
|
||||
null,
|
||||
null,
|
||||
VKProxy.isProxyEnabled(),
|
||||
(preference, o) -> {
|
||||
VKProxy.setProxyStatus((Boolean) o);
|
||||
VKProxy.load();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return R.string.vtlproxy;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
|
||||
newsfeedNotificationsPreference.setVisible(Preferences.milkshake());
|
||||
|
||||
findPreference("accentprefs").setVisible(!ThemesUtils.isMonetTheme());
|
||||
findPreference("accentprefs").setVisible(!ThemesUtils.isMonetTheme() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.M);
|
||||
|
||||
findPreference("systememoji").setOnPreferenceClickListener(preference -> {
|
||||
restart();
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.Signature;
|
||||
import android.content.pm.SigningInfo;
|
||||
import android.os.Build;
|
||||
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import static android.content.pm.PackageManager.GET_SIGNATURES;
|
||||
import static android.content.pm.PackageManager.NameNotFoundException;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPackageName;
|
||||
@@ -36,11 +37,29 @@ public class SignatureChecker {
|
||||
}
|
||||
|
||||
public static boolean validateAppSignature() throws NameNotFoundException, NoSuchAlgorithmException {
|
||||
@SuppressLint("PackageManagerGetSignatures") PackageInfo packageInfo = getGlobalContext().getPackageManager().getPackageInfo(getPackageName(), GET_SIGNATURES);
|
||||
for (Signature signature : packageInfo.signatures) {
|
||||
String sha1 = getSHA1(signature.toByteArray());
|
||||
return Base64Utils.decode(APP_SIGNATURE).equals(sha1);
|
||||
String appSignature = Base64Utils.decode(APP_SIGNATURE);
|
||||
PackageManager pm = getGlobalContext().getPackageManager();
|
||||
if (Build.VERSION.SDK_INT >= 28) {
|
||||
PackageInfo packageInfo = pm.getPackageInfo(getPackageName(), PackageManager.GET_SIGNING_CERTIFICATES);
|
||||
SigningInfo signingInfo = packageInfo.signingInfo;
|
||||
if (signingInfo.hasMultipleSigners() || signingInfo.hasPastSigningCertificates()) {
|
||||
return false;
|
||||
} else {
|
||||
byte[] signatureBytes = signingInfo.getSigningCertificateHistory()[0].toByteArray();
|
||||
String sha1 = getSHA1(signatureBytes);
|
||||
return appSignature.equals(sha1);
|
||||
}
|
||||
} else {
|
||||
PackageInfo packageInfo = pm.getPackageInfo(getPackageName(), PackageManager.GET_SIGNATURES);
|
||||
Signature[] signatures = packageInfo.signatures;
|
||||
for (Signature signature : signatures) {
|
||||
byte[] signatureBytes = signature.toByteArray();
|
||||
String sha1 = getSHA1(signatureBytes);
|
||||
if (appSignature.equals(sha1)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
} // Sig check to detect actions builds and etc
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,74 +5,77 @@ import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class SuperAppUtils {
|
||||
public static JSONObject menu(JSONObject orig) throws JSONException {
|
||||
var Special = orig.optJSONArray("special");
|
||||
var Main = orig.getJSONArray("main");
|
||||
var Other = orig.optJSONArray("other");
|
||||
|
||||
if (Special != null) {
|
||||
orig.remove("special");
|
||||
}
|
||||
|
||||
public static JSONObject menu(JSONObject orig) {
|
||||
orig.remove("special");
|
||||
return orig;
|
||||
}
|
||||
|
||||
public static JSONObject superapp(JSONObject json) throws JSONException {
|
||||
var superApps = Preferences.getPreferences().getString("superapp_items", "menu,miniapps,vkpay_slim,greeting,promo,holiday,weather,sport,games,informer,food,event,music,vk_run").split(",");
|
||||
String[] superApps = Preferences.getPreferences().getString("superapp_items", "menu,miniapps,vkpay_slim,greeting,promo,holiday,weather,sport,games,informer,food,event,music,vk_run").split(",");
|
||||
|
||||
if (superApps.length == 0) return json;
|
||||
|
||||
var oldItems = json.optJSONArray("items");
|
||||
var newItems = new JSONArray();
|
||||
JSONArray oldItems = json.optJSONArray("items");
|
||||
JSONArray newItems = new JSONArray();
|
||||
if (oldItems != null) {
|
||||
for (int i = 0; i < oldItems.length(); i++) {
|
||||
var item = oldItems.optJSONObject(i);
|
||||
var type = item.optString("type");
|
||||
for (String superApp : superApps) {
|
||||
if (type.equals(superApp))
|
||||
if (superApp.equals("menu")) { // superapp menu fix
|
||||
String menuitems = "groups,audios,stickers,podcasts,shopping,lives,videos,games,vk_calls,vk_pay,ads_easy_promote,classifieds,events";
|
||||
JSONObject menuItem = new JSONObject();
|
||||
JSONArray menuItems = new JSONArray();
|
||||
Stream<JSONObject> streamOfItems = IntStream.range(0, oldItems.length())
|
||||
.mapToObj(oldItems::optJSONObject)
|
||||
.filter(item -> Arrays.asList(superApps).contains(item.optString("type")));
|
||||
|
||||
generateMenuItems(menuitems, menuItems);
|
||||
streamOfItems = streamOfItems.map(SuperAppUtils::apply);
|
||||
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("count", menuitems.split(",").length);
|
||||
object.put("items", menuItems);
|
||||
streamOfItems = streamOfItems.sorted(Comparator.comparingInt(item -> Arrays.asList(superApps).indexOf(item.optString("type"))));
|
||||
|
||||
menuItem.put("type", "menu");
|
||||
menuItem.put("object", object);
|
||||
|
||||
newItems.put(menuItem);
|
||||
} else {
|
||||
newItems.put(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < superApps.length; i++) {
|
||||
for (int j = i; j < newItems.length(); j++) {
|
||||
var item = newItems.optJSONObject(j);
|
||||
if (superApps[i].equals(item.optString("type")))
|
||||
newItems.put(j, newItems.getJSONObject(i))
|
||||
.put(i, item);
|
||||
}
|
||||
}
|
||||
streamOfItems.forEach(newItems::put);
|
||||
}
|
||||
|
||||
return json.putOpt("items", newItems);
|
||||
}
|
||||
|
||||
|
||||
private static void generateMenuItems(String str, JSONArray jsonArray) throws JSONException {
|
||||
String[] strings = str.split(",");
|
||||
Stream<String> streamOfStrings = Arrays.stream(str.split(","));
|
||||
|
||||
for (String string : strings) {
|
||||
streamOfStrings.map(string -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
try {
|
||||
jsonObject.put("name", string);
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return jsonObject;
|
||||
}).forEach(jsonArray::put);
|
||||
}
|
||||
|
||||
jsonObject.put("name", string);
|
||||
private static JSONObject apply(JSONObject item) {
|
||||
if (item.optString("type").equals("menu")) {
|
||||
String menuitems = "groups,audios,stickers,podcasts,shopping,lives,videos,games,vk_calls,ads_easy_promote,classifieds"; // vk_pay,events
|
||||
JSONObject menuItem = new JSONObject();
|
||||
JSONArray menuItems = new JSONArray();
|
||||
|
||||
jsonArray.put(jsonObject);
|
||||
try {
|
||||
JSONObject object = new JSONObject();
|
||||
|
||||
object.put("count", menuitems.split(",").length);
|
||||
object.put("items", menuItems);
|
||||
|
||||
menuItem.put("type", "menu");
|
||||
menuItem.put("object", object);
|
||||
|
||||
generateMenuItems(menuitems, menuItems);
|
||||
} catch (JSONException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return menuItem;
|
||||
} else {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,19 +70,22 @@ public class VKAccountDB {
|
||||
LifecycleUtils.getCurrentActivity().requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
|
||||
var db = getDatabase().getReadableDatabase();
|
||||
var dateFormat = new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss", Locale.getDefault());
|
||||
var dir = new File(getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS), "/VTLBackups/");
|
||||
var file = new File(dir, "saved_accounts_" + dateFormat.format(new Date()) + ".vtl");
|
||||
SQLiteDatabase db = getDatabase().getReadableDatabase();
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss", Locale.getDefault());
|
||||
File dir = new File(getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS), "/VTLBackups/");
|
||||
File file = new File(dir, "saved_accounts_" + dateFormat.format(new Date()) + ".vtl");
|
||||
|
||||
try (InputStream inputStream = new FileInputStream(db.getPath())) {
|
||||
dir.mkdirs();
|
||||
if (!dir.exists()) {
|
||||
dir.mkdirs();
|
||||
}
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(file);
|
||||
byte[] buff = new byte[1024];
|
||||
int read;
|
||||
while ((read = inputStream.read(buff, 0, buff.length)) > 0)
|
||||
while ((read = inputStream.read(buff, 0, buff.length)) > 0) {
|
||||
outputStream.write(buff, 0, read);
|
||||
}
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Log;
|
||||
import com.vk.navigation.NavigatorKeys;
|
||||
import okhttp3.*;
|
||||
@@ -13,6 +14,8 @@ import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||
|
||||
@@ -20,12 +23,11 @@ public class VTVerifications {
|
||||
public static final List<Integer> sVerifications = new ArrayList<>();
|
||||
public static final List<Integer> sPrometheuses = new ArrayList<>();
|
||||
public static final List<Integer> sDevelopers = new ArrayList<>();
|
||||
public static final List<Integer> sServiceAccounts = new ArrayList<>();
|
||||
private static final OkHttpClient sClient = VtOkHttpClient.getInstance();
|
||||
public static boolean isLoaded = false;
|
||||
|
||||
public static void load(Context context) {
|
||||
var prefs = context.getSharedPreferences("vt_another_data", 0);
|
||||
SharedPreferences prefs = context.getSharedPreferences("vt_another_data", 0);
|
||||
|
||||
if (isLoaded) {
|
||||
Log.d("VTVerifications", "already loaded");
|
||||
@@ -39,16 +41,16 @@ public class VTVerifications {
|
||||
return;
|
||||
}
|
||||
|
||||
var request = new Request.a()
|
||||
Request request = new Request.a()
|
||||
.b("https://vtosters.app/vktoaster/getGalo4kiBatch")
|
||||
.a(RequestBody.a(MediaType.b("application/json; charset=UTF-8"), "{\"types\":[0,228,404,1337]}"))
|
||||
.a(RequestBody.a(MediaType.b("application/json; charset=UTF-8"), "{\"types\":[0,228,404]}"))
|
||||
.a();
|
||||
|
||||
sClient.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, Response response) {
|
||||
try {
|
||||
var payload = response.a().g();
|
||||
String payload = response.a().g();
|
||||
parseJson(payload);
|
||||
prefs.edit()
|
||||
.putString("ids", payload)
|
||||
@@ -80,17 +82,15 @@ public class VTVerifications {
|
||||
* 0 - Verifications
|
||||
* 228 - Prometheus
|
||||
* 404 - Developer
|
||||
* 1337 - Service account
|
||||
*/
|
||||
private static void parseJson(String payload) {
|
||||
try {
|
||||
var json = new JSONObject(payload);
|
||||
JSONObject json = new JSONObject(payload);
|
||||
processIds(json.optJSONArray("0"), sVerifications);
|
||||
processIds(json.optJSONArray("228"), sPrometheuses);
|
||||
processIds(json.optJSONArray("404"), sDevelopers);
|
||||
processIds(json.optJSONArray("1337"), sServiceAccounts);
|
||||
} catch (JSONException e) {
|
||||
// ignored
|
||||
e.getStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,9 +100,9 @@ public class VTVerifications {
|
||||
|
||||
for (int i = 0; i < jsonIds.length(); i++) {
|
||||
try {
|
||||
member.add(jsonIds.optInt(i));
|
||||
} catch (Exception ignored) {
|
||||
// ignored
|
||||
member.add(jsonIds.getInt(i));
|
||||
} catch (JSONException e) {
|
||||
e.fillInStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -115,20 +115,13 @@ public class VTVerifications {
|
||||
return sDevelopers.contains(id);
|
||||
}
|
||||
|
||||
public static boolean isServiceAccount(int id) {
|
||||
return sServiceAccounts.contains(id);
|
||||
}
|
||||
|
||||
public static int getId(JSONObject json) {
|
||||
var id = json.optInt("id", 0);
|
||||
if (!json.optString(NavigatorKeys.e).equals("group") && !json.optString(NavigatorKeys.e).equals("page")
|
||||
|| json.optString(NavigatorKeys.e).isEmpty())
|
||||
return id;
|
||||
else
|
||||
return -id;
|
||||
int id = json.optInt("id", 0);
|
||||
String type = json.optString(NavigatorKeys.e);
|
||||
return isGroupOrPage(type) ? -id : id;
|
||||
}
|
||||
|
||||
// public static boolean haveDonateButton() {
|
||||
// return hasVerification() || new Random().nextInt(6) != 1;
|
||||
// }
|
||||
}
|
||||
private static boolean isGroupOrPage(String type) {
|
||||
return type.equals("group") || type.equals("page");
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package ru.vtosters.lite.utils;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import static ru.vtosters.hooks.other.ThemesUtils.*;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
@@ -13,25 +14,42 @@ public class WebViewColoringUtils {
|
||||
public static String loadedCSSAmoled = "";
|
||||
|
||||
private static String readCSS(String str) {
|
||||
try (var is = getGlobalContext().getAssets().open(str)) {
|
||||
return IOUtils.readAllLines(is)
|
||||
.replace("%header_background%", hex(getHeaderBackground()))
|
||||
.replace("%background_content%", hex(getBackgroundContent()))
|
||||
.replace("%header_text%", hex(getHeaderText()))
|
||||
.replace("%accent%", hex(getAccentColor()))
|
||||
.replace("%background_page%", hex(getBackgroundPage()))
|
||||
.replace("%content_tint_background%", hex(getColorFromAttr(com.vtosters.lite.R.attr.content_tint_background)))
|
||||
.replace("%button_primary_background%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_primary_background)))
|
||||
.replace("%button_outline_foreground%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_outline_foreground)))
|
||||
.replace("%button_outline_border%", hex(getColorFromAttr(com.vtosters.lite.R.attr.button_outline_border)))
|
||||
.replace("%field_background%", hex(getColorFromAttr(com.vtosters.lite.R.attr.field_background)))
|
||||
.replace("%field_border%", hex(getColorFromAttr(com.vtosters.lite.R.attr.field_border)))
|
||||
.replace("%text_primary%", hex(getTextAttr()));
|
||||
try (InputStream is = getGlobalContext().getAssets().open(str)) {
|
||||
return replaceWebAttrs(IOUtils.readAllLines(is));
|
||||
} catch (IOException e) {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private static String replaceWebAttrs(String css) {
|
||||
int headerBackground = getHeaderBackground();
|
||||
int backgroundContent = getBackgroundContent();
|
||||
int headerText = getHeaderText();
|
||||
int accentColor = getAccentColor();
|
||||
int backgroundPage = getBackgroundPage();
|
||||
int contentTintBackground = getColorFromAttr(com.vtosters.lite.R.attr.content_tint_background);
|
||||
int buttonPrimaryBackground = getColorFromAttr(com.vtosters.lite.R.attr.button_primary_background);
|
||||
int buttonOutlineForeground = getColorFromAttr(com.vtosters.lite.R.attr.button_outline_foreground);
|
||||
int buttonOutlineBorder = getColorFromAttr(com.vtosters.lite.R.attr.button_outline_border);
|
||||
int fieldBackground = getColorFromAttr(com.vtosters.lite.R.attr.field_background);
|
||||
int fieldBorder = getColorFromAttr(com.vtosters.lite.R.attr.field_border);
|
||||
int textPrimary = getTextAttr();
|
||||
|
||||
return css
|
||||
.replace("%header_background%", hex(headerBackground))
|
||||
.replace("%background_content%", hex(backgroundContent))
|
||||
.replace("%header_text%", hex(headerText))
|
||||
.replace("%accent%", hex(accentColor))
|
||||
.replace("%background_page%", hex(backgroundPage))
|
||||
.replace("%content_tint_background%", hex(contentTintBackground))
|
||||
.replace("%button_primary_background%", hex(buttonPrimaryBackground))
|
||||
.replace("%button_outline_foreground%", hex(buttonOutlineForeground))
|
||||
.replace("%button_outline_border%", hex(buttonOutlineBorder))
|
||||
.replace("%field_background%", hex(fieldBackground))
|
||||
.replace("%field_border%", hex(fieldBorder))
|
||||
.replace("%text_primary%", hex(textPrimary));
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
loadedCSS = readCSS("vt_ui_accent.css");
|
||||
loadedCSSAmoled = readCSS("vt_ui_oled.css");
|
||||
@@ -39,6 +57,8 @@ public class WebViewColoringUtils {
|
||||
}
|
||||
|
||||
public static void inject(WebView webView, String str) {
|
||||
webView.loadUrl("javascript:(function() {let parent = document.head || document.documentElement; let style = document.getElementById('custom-style'); if (!style) {style = parent.appendChild(document.createElement('style')); style.id = 'custom-style';} style.innerText = window.atob('" + str + "');})()");
|
||||
String injectOwnStyles = "javascript:(function() {let parent = document.head || document.documentElement; let style = document.getElementById('custom-style'); if (!style) {style = parent.appendChild(document.createElement('style')); style.id = 'custom-style';} style.innerText = window.atob('%s');})()";
|
||||
String jsStyleInjector = String.format(injectOwnStyles, str);
|
||||
webView.evaluateJavascript(jsStyleInjector, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,8 +31,14 @@ public class FiltersPreferences {
|
||||
return AndroidUtils.getGlobalContext().getSharedPreferences("ru.vtosters.sponsorpost.filters.prefs", Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
public static void clearAll() {
|
||||
preferences.edit().clear().apply();
|
||||
public static void clearAllCachedLists() {
|
||||
SharedPreferences.Editor editor = preferences.edit();
|
||||
|
||||
preferences.getAll().keySet().stream()
|
||||
.filter(key -> key.endsWith(":" + PREF_KEY_LIST))
|
||||
.forEach(editor::remove);
|
||||
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean getSavedKeyValue(int id) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package ru.vtosters.sponsorpost.utils;
|
||||
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.utils.NetworkUtils;
|
||||
import ru.vtosters.lite.utils.newsfeed.NewsFeedFiltersUtils;
|
||||
import ru.vtosters.sponsorpost.data.Filter;
|
||||
import ru.vtosters.sponsorpost.data.Post;
|
||||
import ru.vtosters.sponsorpost.services.FilterService;
|
||||
@@ -23,7 +24,7 @@ public class Updates {
|
||||
List<Filter> localFilters = FiltersPreferences.getAllDownloadedFilters();
|
||||
|
||||
if (!filters.isEmpty()) {
|
||||
FiltersPreferences.clearAll(); // removes deleted filters from server
|
||||
FiltersPreferences.clearAllCachedLists(); // removes deleted filters from server and cache
|
||||
|
||||
for (Filter filter : filters) {
|
||||
Filter localFilter = findLocalFilterById(localFilters, filter.getId());
|
||||
@@ -39,6 +40,8 @@ public class Updates {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NewsFeedFiltersUtils.updateFilters();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/iclauncher" />
|
||||
<foreground android:drawable="@mipmap/vt_adaptive_launcher_foneground" />
|
||||
<foreground android:drawable="@mipmap/vt_adaptive_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/vt_mono" />
|
||||
</adaptive-icon>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/iclauncher" />
|
||||
<foreground android:drawable="@mipmap/vt_adaptive_launcher_foneground" />
|
||||
<foreground android:drawable="@mipmap/vt_adaptive_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/vt_mono" />
|
||||
</adaptive-icon>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -12980,7 +12980,7 @@
|
||||
<public type="mipmap" name="ic_launcher_shine" id="0x7f0f005d" />
|
||||
<public type="mipmap" name="ic_launcher_shine_background" id="0x7f0f005e" />
|
||||
<public type="mipmap" name="ic_launcher_shine_foreground" id="0x7f0f005f" />
|
||||
<public type="mipmap" name="vt_adaptive_launcher_foneground" id="0x7f0f0043" />
|
||||
<public type="mipmap" name="vt_adaptive_launcher_foreground" id="0x7f0f0043" />
|
||||
<public type="mipmap" name="vt_launcher_round" id="0x7f0f0046" />
|
||||
<public type="mipmap" name="ic_logo_facebook_28" id="0x7f0f0003" />
|
||||
<public type="mipmap" name="ic_logo_google_28" id="0x7f0f0004" />
|
||||
|
||||
@@ -1,9 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<network-security-config>
|
||||
<debug-overrides>
|
||||
<trust-anchors>
|
||||
<certificates src="system"/>
|
||||
<certificates src="user"/>
|
||||
</trust-anchors>
|
||||
<trust-anchors>
|
||||
<!-- Trust user added CAs while debuggable only -->
|
||||
<certificates src="user" />
|
||||
<certificates src="system" />
|
||||
</trust-anchors>
|
||||
</debug-overrides>
|
||||
</network-security-config>
|
||||
|
||||
<base-config cleartextTrafficPermitted="true">
|
||||
<trust-anchors>
|
||||
<certificates src="system" />
|
||||
<certificates src="user" />
|
||||
</trust-anchors>
|
||||
</base-config>
|
||||
</network-security-config>
|
||||
@@ -2,7 +2,6 @@
|
||||
<network-security-config>
|
||||
<debug-overrides>
|
||||
<trust-anchors>
|
||||
<!-- Trust user added CAs while debuggable only -->
|
||||
<certificates src="user"/>
|
||||
<certificates src="system"/>
|
||||
</trust-anchors>
|
||||
@@ -13,18 +12,14 @@
|
||||
</trust-anchors>
|
||||
</base-config>
|
||||
<domain-config>
|
||||
<!-- Make sure your URL Server here -->
|
||||
<domain includeSubdomains="true">vk.com</domain>
|
||||
<trust-anchors>
|
||||
<certificates src="user"/>
|
||||
<certificates src="system"/>
|
||||
</trust-anchors>
|
||||
</domain-config>
|
||||
<domain-config>
|
||||
<!-- Make sure your URL Server here -->
|
||||
<domain includeSubdomains="true">api.vk.com</domain>
|
||||
<trust-anchors>
|
||||
<certificates src="user"/>
|
||||
<certificates src="system"/>
|
||||
</trust-anchors>
|
||||
</domain-config>
|
||||
|
||||
@@ -243,7 +243,7 @@
|
||||
android:key="__dbg_proxy_enable"
|
||||
android:title="@string/debug_proxy_enable_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:defaultValue="false"
|
||||
android:key="__dbg_use_libverify_for_auth"
|
||||
android:title="@string/debug_use_libverify_for_auth_title"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
android:key="trackInstalledApps"
|
||||
android:summary="@string/sett_mytracker_location_crap_summary"
|
||||
android:title="@string/sett_mytracker_apps"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="useProxyServer"
|
||||
android:title="@string/sett_use_proxy"
|
||||
android:visibility="gone" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="isRoamingState"
|
||||
|
||||
@@ -94,6 +94,10 @@
|
||||
android:key="pollresults"
|
||||
android:summary="@string/pollresults_summ"
|
||||
android:title="@string/pollresults_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="disablevideoscovers"
|
||||
android:title="Отключить видео обложки групп"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="disableForceTabletMode"
|
||||
|
||||
@@ -38,10 +38,10 @@
|
||||
.line 3
|
||||
invoke-virtual {p0, v0, p1}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
||||
|
||||
const-string p1, "count"
|
||||
# const-string p1, "count"
|
||||
|
||||
.line 4
|
||||
invoke-virtual {p0, p1, p2}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
||||
# .line 4
|
||||
# invoke-virtual {p0, p1, p2}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
||||
|
||||
const-string p1, "photo_sizes"
|
||||
|
||||
@@ -72,10 +72,10 @@
|
||||
.line 7
|
||||
invoke-virtual {p0, v0, p1}, Lcom/vk/api/base/ApiRequest;->c(Ljava/lang/String;Ljava/lang/String;)Lcom/vk/api/base/ApiRequest;
|
||||
|
||||
const-string p1, "count"
|
||||
# const-string p1, "count"
|
||||
|
||||
.line 8
|
||||
invoke-virtual {p0, p1, p2}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
||||
# .line 8
|
||||
# invoke-virtual {p0, p1, p2}, Lcom/vk/api/base/ApiRequest;->b(Ljava/lang/String;I)Lcom/vk/api/base/ApiRequest;
|
||||
|
||||
const/4 p1, 0x1
|
||||
|
||||
|
||||
@@ -575,7 +575,7 @@
|
||||
|
||||
const-string v1, "__dbg_use_libverify_for_auth"
|
||||
|
||||
const/4 v2, 0x1
|
||||
const/4 v2, 0x0
|
||||
|
||||
.line 2
|
||||
invoke-interface {v0, v1, v2}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z
|
||||
|
||||
@@ -1162,7 +1162,10 @@
|
||||
:try_start_0
|
||||
iput-object p1, p0, Lcom/vk/core/network/proxy/NetworkProxy;->c:Lcom/vk/core/network/proxy/NetworkProxy$c;
|
||||
|
||||
const p1, 0x0
|
||||
.line 7
|
||||
invoke-static {}, Lru/vtosters/hooks/VKProxy;->isProxyEnabled()Z
|
||||
|
||||
move-result p1
|
||||
|
||||
if-eqz p1, :cond_1
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
.class Lcom/vk/core/network/proxy/ProxyHost$a$a;
|
||||
.super Ljava/lang/Object;
|
||||
.source "ProxyHost.java"
|
||||
|
||||
# interfaces
|
||||
.implements Ljava/lang/Runnable;
|
||||
|
||||
|
||||
# annotations
|
||||
.annotation system Ldalvik/annotation/EnclosingMethod;
|
||||
value = Lcom/vk/core/network/proxy/ProxyHost$a;->a(Ljava/lang/Long;)V
|
||||
.end annotation
|
||||
|
||||
.annotation system Ldalvik/annotation/InnerClass;
|
||||
accessFlags = 0x0
|
||||
name = null
|
||||
.end annotation
|
||||
|
||||
|
||||
# instance fields
|
||||
.field final synthetic a:Lcom/vk/core/network/proxy/ProxyHost$a;
|
||||
|
||||
|
||||
# direct methods
|
||||
.method constructor <init>(Lcom/vk/core/network/proxy/ProxyHost$a;)V
|
||||
.locals 0
|
||||
|
||||
.line 1
|
||||
iput-object p1, p0, Lcom/vk/core/network/proxy/ProxyHost$a$a;->a:Lcom/vk/core/network/proxy/ProxyHost$a;
|
||||
|
||||
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
# virtual methods
|
||||
.method public run()V
|
||||
.locals 1
|
||||
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/core/network/proxy/ProxyHost$a$a;->a:Lcom/vk/core/network/proxy/ProxyHost$a;
|
||||
|
||||
iget-object v0, v0, Lcom/vk/core/network/proxy/ProxyHost$a;->a:Lcom/vk/core/network/proxy/ProxyHost;
|
||||
|
||||
invoke-virtual {v0}, Lcom/vk/core/network/proxy/ProxyHost;->i()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
@@ -52,6 +52,11 @@
|
||||
}
|
||||
.end annotation
|
||||
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/core/network/proxy/ProxyHost$a;->a:Lcom/vk/core/network/proxy/ProxyHost;
|
||||
|
||||
invoke-virtual {v0}, Lcom/vk/core/network/proxy/ProxyHost;->i()V
|
||||
|
||||
return-void
|
||||
.end method
|
||||
|
||||
|
||||
@@ -382,6 +382,8 @@
|
||||
|
||||
if-eqz p1, :cond_0
|
||||
|
||||
const/4 v3, 0x1
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
@@ -687,9 +689,13 @@
|
||||
.method public i()V
|
||||
.locals 3
|
||||
|
||||
const-string v1, ""
|
||||
invoke-static {}, Lru/vtosters/hooks/VKProxy;->getConfigNetworkProxy()Z
|
||||
|
||||
const-string v0, ""
|
||||
move-result-object v1
|
||||
|
||||
invoke-static {}, Lru/vtosters/hooks/VKProxy;->getConfigNetworkProxyCerts()Z
|
||||
|
||||
move-result-object v0
|
||||
|
||||
.line 3
|
||||
iget-object v2, p0, Lcom/vk/core/network/proxy/ProxyHost;->d:Lcom/vk/core/network/proxy/ProxySettings;
|
||||
|
||||
@@ -1101,7 +1101,7 @@
|
||||
|
||||
if-eqz v0, :cond_0
|
||||
|
||||
invoke-virtual {v0}, Landroid/net/NetworkInfo;->isRoaming()Z
|
||||
invoke-static {v0}, Lru/vtosters/hooks/NewsfeedHook;->isRoaming(Landroid/net/NetworkInfo;)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
@@ -1125,7 +1125,7 @@
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0}, Landroid/telephony/TelephonyManager;->isNetworkRoaming()Z
|
||||
invoke-static {v0}, Lru/vtosters/hooks/NewsfeedHook;->isNetworkRoaming(Landroid/telephony/TelephonyManager;)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@
|
||||
|
||||
if-eqz v0, :cond_0
|
||||
|
||||
invoke-virtual {v0}, Landroid/net/NetworkInfo;->isRoaming()Z
|
||||
invoke-static {v0}, Lru/vtosters/hooks/NewsfeedHook;->isRoaming(Landroid/net/NetworkInfo;)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
|
||||
move-result-object v0
|
||||
|
||||
invoke-virtual {v0}, Landroid/telephony/TelephonyManager;->isNetworkRoaming()Z
|
||||
invoke-static {v0}, Lru/vtosters/hooks/NewsfeedHook;->isNetworkRoaming(Landroid/telephony/TelephonyManager;)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
|
||||
@@ -622,7 +622,9 @@
|
||||
|
||||
.line 12
|
||||
:cond_1
|
||||
const p1, 0x0
|
||||
invoke-static {}, Lru/vtosters/hooks/VKProxy;->isProxyEnabled()Z
|
||||
|
||||
move-result p1
|
||||
|
||||
if-eqz p1, :cond_2
|
||||
|
||||
|
||||
+2
@@ -61,6 +61,8 @@
|
||||
.method private final a(Lcom/vk/dto/music/CurrentAccountInformation;)V
|
||||
.locals 2
|
||||
|
||||
return-void
|
||||
|
||||
.line 19
|
||||
invoke-virtual {p1}, Lcom/vk/dto/music/CurrentAccountInformation;->a()Z
|
||||
|
||||
|
||||
@@ -400,7 +400,7 @@
|
||||
|
||||
if-eqz v1, :cond_8
|
||||
|
||||
invoke-virtual {v1}, Landroid/telephony/TelephonyManager;->isNetworkRoaming()Z
|
||||
invoke-static {v1}, Lru/vtosters/hooks/NewsfeedHook;->isNetworkRoaming(Landroid/telephony/TelephonyManager;)Z
|
||||
|
||||
move-result v1
|
||||
|
||||
|
||||
@@ -1754,6 +1754,12 @@
|
||||
|
||||
if-eqz v2, :cond_32
|
||||
|
||||
invoke-static {}, Lru/vtosters/hooks/GroupCoverHook;->needToDisableCovers()Z
|
||||
|
||||
move-result v4
|
||||
|
||||
if-nez v4, :cond_32
|
||||
|
||||
const-string v2, "live_covers"
|
||||
|
||||
.line 153
|
||||
|
||||
+30
@@ -989,6 +989,36 @@
|
||||
|
||||
invoke-virtual {v0, p1}, Landroidx/preference/PreferenceGroup;->removePreference(Landroidx/preference/Preference;)Z
|
||||
|
||||
const-string p1, "useProxyServer"
|
||||
|
||||
.line 9
|
||||
invoke-virtual {p0, p1}, Lcom/vtosters/lite/fragments/u2/PreferenceFragmentCompat;->findPreference(Ljava/lang/CharSequence;)Landroidx/preference/Preference;
|
||||
|
||||
move-result-object p1
|
||||
|
||||
check-cast p1, Landroidx/preference/SwitchPreference;
|
||||
|
||||
.line 10
|
||||
sget-object v0, Lcom/vk/core/network/Network;->l:Lcom/vk/core/network/Network;
|
||||
|
||||
invoke-virtual {v0}, Lcom/vk/core/network/Network;->b()Lcom/vk/core/network/proxy/NetworkProxy;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
.line 11
|
||||
invoke-virtual {v0}, Lcom/vk/core/network/proxy/NetworkProxy;->d()Z
|
||||
|
||||
move-result v2
|
||||
|
||||
invoke-virtual {p1, v2}, Landroidx/preference/TwoStatePreference;->setChecked(Z)V
|
||||
|
||||
.line 12
|
||||
new-instance v2, Lcom/vtosters/lite/general/fragments/SettingsGeneralFragment$b;
|
||||
|
||||
invoke-direct {v2, p0, v0, p1}, Lcom/vtosters/lite/general/fragments/SettingsGeneralFragment$b;-><init>(Lcom/vtosters/lite/general/fragments/SettingsGeneralFragment;Lcom/vk/core/network/proxy/NetworkProxy;Landroidx/preference/SwitchPreference;)V
|
||||
|
||||
invoke-virtual {p1, v2}, Landroidx/preference/Preference;->setOnPreferenceChangeListener(Landroidx/preference/Preference$OnPreferenceChangeListener;)V
|
||||
|
||||
const-string p1, "isRoamingState"
|
||||
|
||||
.line 13
|
||||
|
||||
@@ -794,7 +794,7 @@
|
||||
|
||||
.line 3
|
||||
:cond_0
|
||||
invoke-virtual {v0}, Landroid/net/NetworkInfo;->isRoaming()Z
|
||||
invoke-static {v0}, Lru/vtosters/hooks/NewsfeedHook;->isRoaming(Landroid/net/NetworkInfo;)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
|
||||
@@ -277,7 +277,7 @@
|
||||
|
||||
iput-object v2, v1, Lru/mail/libverify/accounts/e;->m:Ljava/lang/String;
|
||||
|
||||
invoke-virtual {p0}, Landroid/telephony/TelephonyManager;->isNetworkRoaming()Z
|
||||
invoke-static {p0}, Lru/vtosters/hooks/NewsfeedHook;->isNetworkRoaming(Landroid/telephony/TelephonyManager;)Z
|
||||
|
||||
move-result v2
|
||||
|
||||
|
||||
@@ -1419,7 +1419,7 @@
|
||||
|
||||
check-cast p0, Landroid/telephony/TelephonyManager;
|
||||
|
||||
invoke-virtual {p0}, Landroid/telephony/TelephonyManager;->isNetworkRoaming()Z
|
||||
invoke-static {p0}, Lru/vtosters/hooks/NewsfeedHook;->isNetworkRoaming(Landroid/telephony/TelephonyManager;)Z
|
||||
|
||||
move-result p0
|
||||
|
||||
|
||||
@@ -441,7 +441,7 @@
|
||||
goto :goto_1
|
||||
|
||||
:cond_1
|
||||
invoke-virtual {v0}, Landroid/net/NetworkInfo;->isRoaming()Z
|
||||
invoke-static {v0}, Lru/vtosters/hooks/NewsfeedHook;->isRoaming(Landroid/net/NetworkInfo;)Z
|
||||
|
||||
move-result v0
|
||||
|
||||
|
||||
@@ -4055,7 +4055,7 @@
|
||||
iget-object v1, p0, Lvigo/sdk/Vigo;->tm:Landroid/telephony/TelephonyManager;
|
||||
|
||||
.line 13
|
||||
invoke-virtual {v1}, Landroid/telephony/TelephonyManager;->isNetworkRoaming()Z
|
||||
invoke-static {v1}, Lru/vtosters/hooks/NewsfeedHook;->isNetworkRoaming(Landroid/telephony/TelephonyManager;)Z
|
||||
|
||||
move-result v1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user