Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f887648f48 | ||
|
|
8ee29b4b83 | ||
|
|
a4c6af8ace | ||
|
|
9ec4e52eba | ||
|
|
b756bfa622 | ||
|
|
f96baa58ac | ||
|
|
d9f03a5d0e | ||
|
|
15d2daa887 |
@@ -1,6 +1,5 @@
|
||||
package com.vk.core.util;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.Preferences.getDownloadsDir;
|
||||
import static ru.vtosters.lite.utils.Preferences.getMusicDir;
|
||||
import static ru.vtosters.lite.utils.Preferences.getPhotosDir;
|
||||
@@ -13,10 +12,8 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteException;
|
||||
import android.media.MediaScannerConnection;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import com.facebook.common.i.MediaUtils;
|
||||
import com.facebook.x.g.EncodedImage;
|
||||
@@ -24,7 +21,6 @@ import com.vk.core.concurrent.VkExecutors;
|
||||
import com.vk.imageloader.VKImageLoader;
|
||||
import com.vk.log.L;
|
||||
import com.vk.metrics.eventtracking.VkTracker;
|
||||
import com.vtosters.lite.MainActivity;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.graphics.BitmapShader;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Shader;
|
||||
@@ -36,8 +35,6 @@ import com.vtosters.lite.a0;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
@UiThread
|
||||
public class TargetImageView extends VKMultiImageView {
|
||||
private static final int I = Screen.a(2);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.vk.stories.view;
|
||||
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getColor2;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -29,7 +27,6 @@ import com.facebook.imagepipeline.request.ImageRequest;
|
||||
import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
||||
import com.facebook.u.b.a.PipelineDraweeControllerBuilder;
|
||||
import com.facebook.x.g.CloseableImage;
|
||||
import com.vk.core.drawable.BorderDrawable;
|
||||
import com.vk.core.ui.themes.Themable;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.core.util.DrawableUtils;
|
||||
@@ -50,8 +47,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class StoryCircleImageView extends BorderedCircleImageView implements Themable{
|
||||
private static final HashSet<Integer> B0 = new HashSet<>();
|
||||
private final PipelineDraweeControllerBuilder f0;
|
||||
|
||||
+1
-2
@@ -1,6 +1,6 @@
|
||||
package com.vtosters.lite.ui.bottomnavigation;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.*;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getCSTDock;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
@@ -31,7 +31,6 @@ import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import me.grishka.appkit.utils.V;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
public class BottomNavigationItemView extends FrameLayout implements MenuView.ItemView {
|
||||
private final TextView mSmallLabel;
|
||||
|
||||
@@ -5,8 +5,6 @@ import static com.vk.im.engine.h.im_ic_edit_msg;
|
||||
import static com.vk.im.engine.h.im_ic_more_vertical;
|
||||
import static com.vk.im.engine.h.im_ic_pinned_msg_hide;
|
||||
import static com.vk.im.engine.h.im_ic_pinned_msg_show;
|
||||
import static com.vk.im.engine.h.im_ic_write_msg;
|
||||
import static com.vk.im.ui.c.im_ic_chat_settings;
|
||||
import static com.vk.im.ui.c.im_ic_keyboard;
|
||||
import static ru.vtosters.lite.dnr.DNRModule.hookDNR;
|
||||
import static ru.vtosters.lite.dnr.DNRModule.hookDNT;
|
||||
@@ -29,7 +27,6 @@ import com.vk.core.network.Network;
|
||||
import com.vk.im.engine.ImEngine1;
|
||||
import com.vk.im.engine.events.OnDialogUpdateEvent;
|
||||
import com.vk.im.engine.models.EntityIntMap;
|
||||
import com.vk.im.engine.models.ProfilesSimpleInfo;
|
||||
import com.vk.im.engine.models.dialogs.Dialog;
|
||||
import com.vk.im.engine.models.messages.Msg;
|
||||
import com.vk.im.engine.models.messages.MsgFromUser;
|
||||
@@ -52,7 +49,6 @@ import ru.vtosters.lite.encryption.EncryptProvider;
|
||||
import ru.vtosters.lite.encryption.base.IMProcessor;
|
||||
import ru.vtosters.lite.hooks.CryptImHook;
|
||||
import ru.vtosters.lite.ui.dialogs.Translate;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class DNRInjector {
|
||||
public static void inject(Dialog dialog, List<DialogAction> list) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ru.vtosters.lite.dnr;
|
||||
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.downloaders;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.getMusicDir;
|
||||
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.core.app.NotificationCompat;
|
||||
|
||||
@@ -33,6 +33,8 @@ public class MessagesDownloader{
|
||||
|
||||
private static SparseArray<MiniUser> usersArray;
|
||||
|
||||
private static final String VK_DOMAIN = "vk.ru";
|
||||
|
||||
public static String formatTime(long now){
|
||||
return sdformat.format(new Date(now));
|
||||
}
|
||||
@@ -264,6 +266,13 @@ public class MessagesDownloader{
|
||||
".msg-reply p.reply-content {\n" +
|
||||
" color: #000000;\n" +
|
||||
"}\n" +
|
||||
".vtex-milk-msg.poll {\n" +
|
||||
" width: 45%;\n" +
|
||||
" background: linear-gradient(to bottom right, #707c8c, #4d5565);\n" +
|
||||
" font-style: normal;" +
|
||||
"}\n" +
|
||||
".vtex-milk-msg.poll p { color: white; }\n" +
|
||||
".vtex-milk-msg.poll hr { border-top: 1px; background: #ffffff; }\n" +
|
||||
"\n" +
|
||||
"";
|
||||
|
||||
@@ -283,6 +292,7 @@ public class MessagesDownloader{
|
||||
@Override
|
||||
String provideMessage(MiniMsg message, MiniUser user) throws JSONException{
|
||||
String isOut = (user.id == getUserId()) ? " vtex-milk-msg-out" : "";
|
||||
|
||||
String geoPosition = "";
|
||||
if (message.geo != null) {
|
||||
var coordinates = message.geo.optJSONObject("coordinates");
|
||||
@@ -295,6 +305,7 @@ public class MessagesDownloader{
|
||||
"</a>";
|
||||
}
|
||||
}
|
||||
|
||||
String chatAction = (message.chat_action != null) ? getHtmlForChatAction(message.chat_action) : "";
|
||||
String attaches = (message.attachments.size() > 0) ? "<p class=\"msg-attaches\">Вложения: " + getHtmlForAttach(message.attachments) + "</p>" : "";
|
||||
String reply = (message.reply_message != null) ? provideReply(message.reply_message) : "";
|
||||
@@ -302,7 +313,7 @@ public class MessagesDownloader{
|
||||
String userLink = (user.isGroup ? "club" : "id") + user.id;
|
||||
|
||||
return "<div class=\"vtex-milk-msg" + isOut + "\" id=\"" + message.id + "\">" +
|
||||
"<p class=\"msg-from\">от <a href=\"https://vk.ru/" + userLink + "\">" + user.firstName + " " + user.lastName + "</a> <span class=\"msg-from-date\">" + formatTime(message.date) + "</span></p>" + // TODO photo100
|
||||
"<p class=\"msg-from\">от <a href=\"https://" + VK_DOMAIN + "/" + userLink + "\">" + user.firstName + " " + user.lastName + "</a> <span class=\"msg-from-date\">" + formatTime(message.date) + "</span></p>" + // TODO photo100
|
||||
"<p class=\"msg-body\">" + mentionsReplace(message.text) + "</p>" +
|
||||
geoPosition +
|
||||
chatAction +
|
||||
@@ -381,7 +392,7 @@ public class MessagesDownloader{
|
||||
|
||||
var userLink = ((userId < 0) ? "club" : "id") + Math.abs(userId);
|
||||
|
||||
fwdmsgs.append("<p class=\"reply-content\"><a class=\"msg-attach-link\" href=\"https://vk.ru/").append(userLink).append("\">@").append(userLink).append("</a>: ").append(text).append(attachesHtml).append(replyHtml).append(fwdsHtml);
|
||||
fwdmsgs.append("<p class=\"reply-content\"><a class=\"msg-attach-link\" href=\"https://" + VK_DOMAIN + "/").append(userLink).append("\">@").append(userLink).append("</a>: ").append(text).append(attachesHtml).append(replyHtml).append(fwdsHtml);
|
||||
}
|
||||
|
||||
return fwdmsgs.append("</div>").toString();
|
||||
@@ -390,7 +401,7 @@ public class MessagesDownloader{
|
||||
private String mentionsReplace(String text) {
|
||||
var matcher = Pattern.compile("\\[((?:club|id|public)\\d+)\\|([^]]+)\\]").matcher(text);
|
||||
|
||||
return matcher.replaceAll("<a class=\"msg-attach-link\" href=\"https://vk.ru/$1\">$2</a>");
|
||||
return matcher.replaceAll("<a class=\"msg-attach-link\" href=\"https://" + VK_DOMAIN + "/$1\">$2</a>");
|
||||
}
|
||||
|
||||
private String pluralMsg(int count) {
|
||||
@@ -431,7 +442,7 @@ public class MessagesDownloader{
|
||||
htmlAction.append("Добавил ").append((newUserId > 0) ? "пользователя" : "группу");
|
||||
if (newUserId != 0) {
|
||||
var userLink = ((newUserId < 0) ? "club" : "id") + Math.abs(newUserId);
|
||||
htmlAction.append(" <a href=\"https://vk.ru/").append(userLink).append("\" class=\"msg-attach-link\">@").append(userLink).append("</a>");
|
||||
htmlAction.append(" <a href=\"https://" + VK_DOMAIN + "/").append(userLink).append("\" class=\"msg-attach-link\">@").append(userLink).append("</a>");
|
||||
}
|
||||
break;
|
||||
case "chat_kick_user":
|
||||
@@ -439,7 +450,7 @@ public class MessagesDownloader{
|
||||
htmlAction.append("Исключил ").append((removedUserId > 0) ? "пользователя" : "группу");
|
||||
if (removedUserId != 0) {
|
||||
var userLink = ((removedUserId < 0) ? "club" : "id") + Math.abs(removedUserId);
|
||||
htmlAction.append(" <a href=\"https://vk.ru/").append(userLink).append("\" class=\"msg-attach-link\">@").append(userLink).append("</a>");
|
||||
htmlAction.append(" <a href=\"https://" + VK_DOMAIN + "/").append(userLink).append("\" class=\"msg-attach-link\">@").append(userLink).append("</a>");
|
||||
}
|
||||
break;
|
||||
case "chat_pin_message":
|
||||
@@ -466,17 +477,6 @@ public class MessagesDownloader{
|
||||
return htmlAction.append("</p>").toString();
|
||||
}
|
||||
|
||||
/*
|
||||
TODO:
|
||||
1) poll (опросы)
|
||||
2) mini_app (поделиться миниаппом)
|
||||
3) audio_playlist (плейлист песен)
|
||||
4) story (история)
|
||||
5) wall_reply (комментарий на стене)
|
||||
6) podcast (подкаст)
|
||||
7) gift (подарок)
|
||||
*/
|
||||
|
||||
private String getHtmlForAttach(List<JSONObject> attaches) throws JSONException{
|
||||
StringBuilder rs = new StringBuilder();
|
||||
|
||||
@@ -486,7 +486,7 @@ public class MessagesDownloader{
|
||||
|
||||
if (item == null) continue;
|
||||
|
||||
switch(type) {
|
||||
switch(type) { // market_album is not supported
|
||||
case "photo":
|
||||
var sizes = item.getJSONArray("sizes");
|
||||
rs.append("<a href=\"").append(sizes.getJSONObject(sizes.length() - 1).getString("url")).append("\" class=\"msg-attach-link\">фотография</a>");
|
||||
@@ -498,7 +498,7 @@ public class MessagesDownloader{
|
||||
rs.append("<a href=\"").append(item.getString("url")).append("\" class=\"msg-attach-link\">ссылка</a>");
|
||||
break;
|
||||
case "wall":
|
||||
rs.append("<a href=\"https://vk.ru/wall").append(item.optString("to_id", item.optString("owner_id"))).append("_").append(item.getString("id")).append("\" class=\"msg-attach-link\">запись на стене</a>");
|
||||
rs.append("<a href=\"https://" + VK_DOMAIN + "/wall").append(item.optString("to_id", item.optString("owner_id"))).append("_").append(item.getString("id")).append("\" class=\"msg-attach-link\">запись на стене</a>");
|
||||
break;
|
||||
case "sticker":
|
||||
rs.append("<img style=\"width:128px;height:128px;\" src=\"").append(item.getJSONArray("images").getJSONObject(1).getString("url")).append("\"/>");
|
||||
@@ -512,6 +512,43 @@ public class MessagesDownloader{
|
||||
case "video":
|
||||
rs.append("видеозапись ( ").append(getVideoHtml(item.optJSONObject("files"))).append(")");
|
||||
break;
|
||||
case "wall_reply":
|
||||
var link = "https://" + VK_DOMAIN + "/wall" + item.optString("owner_id") + "_" + item.optString("post_id") + "?reply=" + item.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(link).append("\">комментарий на стене</a>");
|
||||
break;
|
||||
case "story":
|
||||
var story_link = "https://" + VK_DOMAIN + "/story" + item.optString("owner_id") + "_" + item.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(story_link).append("\">история</a>");
|
||||
break;
|
||||
case "podcast":
|
||||
var podcast_link = "https://" + VK_DOMAIN + "/podcast" + item.optString("owner_id") + "_" + item.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(podcast_link).append("\">подкаст</a>");
|
||||
break;
|
||||
case "gift":
|
||||
rs.append("<img src=\"").append(item.optString("thumb_96")).append("\"/>");
|
||||
break;
|
||||
case "mini_app":
|
||||
var app = item.optJSONObject("app");
|
||||
|
||||
if (app != null) {
|
||||
var miniapp_link = "https://" + VK_DOMAIN + "/app" + app.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(miniapp_link).append("\">мини-приложение</a>");
|
||||
break;
|
||||
}
|
||||
|
||||
rs.append("ошибка");
|
||||
break;
|
||||
case "audio_playlist":
|
||||
var playlist_link = "https://" + VK_DOMAIN + "/music/album/" + item.optString("owner_id") + "_" + item.optString("id") + "_" + item.optString("access_key");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(playlist_link).append("\">плейлист (").append(item.optString("title")).append(")</a>");
|
||||
break;
|
||||
case "poll":
|
||||
rs.append((item.optBoolean("anonymous") ? "анонимный" : "публичный")).append(" опрос ").append(getPollHtml(item));
|
||||
break;
|
||||
case "market":
|
||||
var market_item_link = "https://" + VK_DOMAIN + "/market" + item.optString("owner_id") + "_" + item.optString("id");
|
||||
rs.append("<a class=\"msg-attach-link\" href=\"").append(market_item_link).append("\">товар</a>");
|
||||
break;
|
||||
default:
|
||||
rs.append("не поддерживается (").append(type).append(")");
|
||||
break;
|
||||
@@ -524,8 +561,26 @@ public class MessagesDownloader{
|
||||
}
|
||||
}
|
||||
|
||||
private static String getVideoHtml(JSONObject files) throws JSONException {
|
||||
private static String getPollHtml(JSONObject poll) throws JSONException {
|
||||
StringBuilder pollHtml = new StringBuilder(
|
||||
"<div class=\"vtex-milk-msg poll\">" +
|
||||
"<p style=\"text-align:center;\">" + poll.optString("question") + "</p>"
|
||||
);
|
||||
|
||||
var answers = poll.optJSONArray("answers");
|
||||
|
||||
for (int i = 0; i < answers.length(); i++) {
|
||||
var jsonObject = answers.optJSONObject(i);
|
||||
if (jsonObject != null)
|
||||
pollHtml.append("<hr><p>").append(jsonObject.optString("text")).append(" · ").append(jsonObject.optString("votes")).append(" (").append(jsonObject.optString("rate")).append("%)</p>");
|
||||
}
|
||||
|
||||
pollHtml.append("<hr><p style=\"text-align:center;\">Проголосовало ").append(poll.optString("votes")).append(" чел.</p>");
|
||||
|
||||
return pollHtml.append("</div>").toString();
|
||||
}
|
||||
|
||||
private static String getVideoHtml(JSONObject files) throws JSONException {
|
||||
if (files == null) return "ссылки отсутствуют";
|
||||
|
||||
Iterator< ? > keys = files.keys();
|
||||
@@ -539,7 +594,7 @@ public class MessagesDownloader{
|
||||
if (key.equals("mp4_" + quality[qualityIndex])) {
|
||||
videoHtml.append("<a class=\"msg-attach-link\" href=\"").append(files.get(key)).append("\">").append(quality[qualityIndex]).append("p</a>").append(" ");
|
||||
|
||||
if (qualityIndex == 7) break;
|
||||
if (qualityIndex == quality.length - 1) break;
|
||||
++qualityIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,12 +7,10 @@ import static ru.vtosters.lite.utils.Preferences.getPhotosDir;
|
||||
import android.app.DownloadManager;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
|
||||
import com.vk.dto.common.ImageSize;
|
||||
import com.vk.dto.stories.model.StoryEntry;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
public class StoryDownloader {
|
||||
|
||||
@@ -8,12 +8,10 @@ import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.Preferences.getVideosDir;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.DownloadManager;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
@@ -2,11 +2,11 @@ package ru.vtosters.lite.foaf;
|
||||
|
||||
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;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ProgressDialog;
|
||||
@@ -35,7 +35,6 @@ import java.util.regex.Pattern;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.vtosters.lite.net.Request;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
|
||||
public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
@@ -115,7 +114,7 @@ public class FoafBase {
|
||||
private static String getLink(int i) {
|
||||
String str;
|
||||
StringBuilder sb;
|
||||
if (isApiProxyEnabled()) {
|
||||
if (isAnyProxyEnabled()) {
|
||||
sb = new StringBuilder();
|
||||
str = "https://" + getApi() + "/_/vk.ru/foaf.php?id=";
|
||||
} else {
|
||||
|
||||
@@ -4,13 +4,10 @@ import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class DeviceInfoHook{
|
||||
public static String getDeviceInfo(String input) {
|
||||
Log.d("DeviceInfoHook", "getDeviceInfo: " + input);
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.vk.core.fragments.FragmentImpl;
|
||||
import com.vk.core.util.StringUtils;
|
||||
import com.vk.navigation.right.RightMenu;
|
||||
import com.vtosters.lite.MenuCountersState;
|
||||
import com.vtosters.lite.fragments.ProfileFragment;
|
||||
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationMenuView;
|
||||
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationView;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.foaf.FoafBase.getBypassedOnlineInfo;
|
||||
import static ru.vtosters.lite.hooks.OnlineFormatterHook.onlineHookProfiles;
|
||||
import static ru.vtosters.lite.hooks.DateHook.getLocale;
|
||||
import static ru.vtosters.lite.hooks.OnlineFormatterHook.onlineHookProfiles;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getStatic;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
|
||||
@@ -12,11 +12,10 @@ import android.view.View;
|
||||
|
||||
import com.vk.api.internal.MethodCall;
|
||||
|
||||
import ru.vtosters.lite.translators.BaseTranslator;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.vtosters.lite.translators.BaseTranslator;
|
||||
|
||||
public class MessagesHook {
|
||||
public static String injectOwnText(String oldText) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.*;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCaption;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCopyright;
|
||||
@@ -20,7 +20,6 @@ import static ru.vtosters.lite.utils.Preferences.adsslider;
|
||||
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import com.vk.core.preference.Preference;
|
||||
@@ -36,7 +35,6 @@ import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class NewsfeedHook {
|
||||
public static boolean injectFilters(JSONObject obj) throws JSONException {
|
||||
@@ -93,7 +91,7 @@ public class NewsfeedHook {
|
||||
params.add("photo");
|
||||
params.add("photo_tag");
|
||||
|
||||
if (!friendsrecomm()) {
|
||||
if (!friendsrecomm() && !getBoolValue("donotgetads", false)) {
|
||||
params.add("friends_recomm");
|
||||
}
|
||||
|
||||
@@ -102,7 +100,7 @@ public class NewsfeedHook {
|
||||
params.add("promo_button");
|
||||
}
|
||||
|
||||
if (!authorsrecomm()) {
|
||||
if (!authorsrecomm() && !getBoolValue("donotgetads", false)) {
|
||||
params.add("authors_rec");
|
||||
}
|
||||
|
||||
@@ -150,14 +148,15 @@ public class NewsfeedHook {
|
||||
public static void adsParams(HashSet<String> hashSet) {
|
||||
if (ads()) {
|
||||
hashSet.add("ads_disabled");
|
||||
hashSet.add("ads_app_slider");
|
||||
return;
|
||||
if (getBoolValue("donotgetads", false)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
hashSet.add("ads_app");
|
||||
hashSet.add("ads_site");
|
||||
hashSet.add("ads_post");
|
||||
if (adsslider()) {
|
||||
if (!adsslider()) {
|
||||
hashSet.add("ads_app_slider");
|
||||
}
|
||||
hashSet.add("ads_site_slider");
|
||||
|
||||
@@ -3,13 +3,13 @@ package ru.vtosters.lite.hooks;
|
||||
import static ru.vtosters.lite.hooks.JsonInjectors.setOnlineInfo;
|
||||
import static ru.vtosters.lite.hooks.JsonInjectors.setOnlineInfoUsers;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.getPrefsFromFile;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ClipData;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isRandomProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isVikaProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isZaboronaEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isRandomProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isZaboronaEnabled;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAccentColor;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
@@ -6,7 +6,6 @@ import static ru.vtosters.lite.utils.Preferences.getMusicDir;
|
||||
import android.app.DownloadManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package ru.vtosters.lite.proxy;
|
||||
|
||||
import static java.lang.System.clearProperty;
|
||||
import static ru.vtosters.lite.proxy.api.VikaMobile.getApiHost;
|
||||
import static ru.vtosters.lite.proxy.api.VikaMobile.getOauthHost;
|
||||
import static ru.vtosters.lite.proxy.api.VikaMobile.getStaticHost;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
@@ -23,7 +26,11 @@ public class ProxyUtils{
|
||||
public static String getApi(){
|
||||
var proxyapi = getPrefsValue("proxyapi");
|
||||
|
||||
if (isApiProxyEnabled() & !proxyapi.isEmpty()) {
|
||||
if (isVikaProxyEnabled()) {
|
||||
proxyapi = getApiHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() & !proxyapi.isEmpty()) {
|
||||
return proxyapi;
|
||||
}
|
||||
|
||||
@@ -33,7 +40,11 @@ public class ProxyUtils{
|
||||
public static String getOauth(){
|
||||
var oauth = getPrefsValue("proxyoauth");
|
||||
|
||||
if (isApiProxyEnabled() & !oauth.isEmpty()) {
|
||||
if (isVikaProxyEnabled()) {
|
||||
oauth = getOauthHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() & !oauth.isEmpty()) {
|
||||
return oauth;
|
||||
}
|
||||
|
||||
@@ -41,15 +52,23 @@ public class ProxyUtils{
|
||||
}
|
||||
|
||||
public static String getStatic(){
|
||||
var oauth = getPrefsValue("proxystatic");
|
||||
var staticapi = getPrefsValue("proxystatic");
|
||||
|
||||
if (isApiProxyEnabled() & !oauth.isEmpty()) {
|
||||
return oauth;
|
||||
if (isVikaProxyEnabled()) {
|
||||
staticapi = getStaticHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() & !staticapi.isEmpty()) {
|
||||
return staticapi;
|
||||
}
|
||||
|
||||
return "static.vk.ru";
|
||||
}
|
||||
|
||||
public static Boolean isAnyProxyEnabled(){
|
||||
return isApiProxyEnabled() || isVikaProxyEnabled();
|
||||
}
|
||||
|
||||
public static Boolean isZaboronaEnabled(){
|
||||
return getPrefsValue("proxy").equals("zaborona");
|
||||
}
|
||||
@@ -59,7 +78,7 @@ public class ProxyUtils{
|
||||
}
|
||||
|
||||
public static Boolean isApiProxyEnabled(){
|
||||
return getPrefsValue("proxy").equals("apiproxy") || getPrefsValue("proxy").equals("vika");
|
||||
return getPrefsValue("proxy").equals("apiproxy");
|
||||
}
|
||||
|
||||
public static Boolean isVikaProxyEnabled(){
|
||||
|
||||
@@ -2,7 +2,6 @@ package ru.vtosters.lite.proxy;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.resetProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.preferences;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package ru.vtosters.lite.proxy.api;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isVikaProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ApiProxy{
|
||||
proxystatic = VikaMobile.getStaticHost();
|
||||
}
|
||||
|
||||
if ((!isApiProxyEnabled() || !isVikaProxyEnabled()) || link.isEmpty()) {
|
||||
if (!isAnyProxyEnabled() || link.isEmpty()) {
|
||||
return link;
|
||||
}
|
||||
|
||||
@@ -67,15 +67,21 @@ public class ApiProxy{
|
||||
string = VikaMobile.getStaticHost();
|
||||
}
|
||||
|
||||
if ((isApiProxyEnabled() || isVikaProxyEnabled()) && string.isEmpty()) return str;
|
||||
if (isAnyProxyEnabled() && !string.isEmpty()) {
|
||||
return str.replaceAll(string, "static.vk.ru");
|
||||
}
|
||||
|
||||
return str.replaceAll(string, "static.vk.ru");
|
||||
return str;
|
||||
}
|
||||
|
||||
public static String getAwayPhpCom(){
|
||||
var proxyapi = getPrefsValue("proxyapi");
|
||||
|
||||
if ((isApiProxyEnabled() || isVikaProxyEnabled()) & !proxyapi.isEmpty()) {
|
||||
if (isVikaProxyEnabled()) {
|
||||
proxyapi = VikaMobile.getApiHost();
|
||||
}
|
||||
|
||||
if (isAnyProxyEnabled() && !proxyapi.isEmpty()) {
|
||||
return proxyapi;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import ru.vtosters.lite.ui.items.DockBarTab;
|
||||
import ru.vtosters.lite.ui.items.SuperAppItem;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import android.content.Context;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.SeekBar;
|
||||
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
@@ -25,7 +25,7 @@ public class VKIDProtection {
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setNeutralButton(getString("vkiddisable"), (dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlertVkId", false).apply();
|
||||
VKUIwrapper.setLink((isApiProxyEnabled() ? "https://id.vk.ru/account" : "https://" + getApi() + "/_/id.vk.ru/account"));
|
||||
VKUIwrapper.setLink((isAnyProxyEnabled() ? "https://id.vk.ru/account" : "https://" + getApi() + "/_/id.vk.ru/account"));
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(activity);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
activity.startActivity(a2);
|
||||
|
||||
@@ -22,8 +22,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
|
||||
import ru.vtosters.lite.ui.components.DockBarEditorManager;
|
||||
import ru.vtosters.lite.ui.components.ItemMovingCallback;
|
||||
|
||||
@@ -2,13 +2,10 @@ package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getString;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.copyright_post;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.*;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.*;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.recolorDrawable;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
@@ -22,12 +22,9 @@ import com.vk.navigation.Navigator;
|
||||
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.ui.wallpapers.WallpaperMenuFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,6 @@ import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getDefaultPrefs;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.deleteCache;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.proxy.RandomProxy.setupNewProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
|
||||
@@ -11,7 +10,6 @@ import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import ru.vtosters.lite.proxy.RandomProxy;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@@ -40,7 +40,6 @@ import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.ui.adapters.StickerPackAdapter;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.vtosters.lite.ui.wallpapers;
|
||||
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.removeWallpaper;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
@@ -13,6 +14,7 @@ import android.graphics.Matrix;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.medianative.MediaNative;
|
||||
|
||||
@@ -28,7 +30,23 @@ public class ImageFilters {
|
||||
public static Drawable getFilteredDrawable(Drawable orig) {
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
if (bm == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
if (instance == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
if (getPreferences().getBoolean("msg_invert", false)) {
|
||||
instance = applyInvertEffect(instance);
|
||||
@@ -61,7 +79,24 @@ public class ImageFilters {
|
||||
try {
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig; // we need only BitmapDrawable
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
if (bm == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
if (instance == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
MediaNative.blurBitmap(instance, radius);
|
||||
return new BitmapDrawable(getResources(), instance);
|
||||
} catch (Exception e) {
|
||||
@@ -75,7 +110,24 @@ public class ImageFilters {
|
||||
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
if (bm == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
if (instance == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
String radius = getPreferences().getString("msg_mosaic", "disabled");
|
||||
|
||||
switch (radius) {
|
||||
@@ -98,7 +150,24 @@ public class ImageFilters {
|
||||
public static Drawable getDimmed(Drawable orig) {
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
if (bm == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
if (instance == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
String radius = getPreferences().getString("msg_dim", "disabled");
|
||||
switch (radius) {
|
||||
case "dim_black":
|
||||
@@ -112,7 +181,23 @@ public class ImageFilters {
|
||||
public static Drawable getMonochrome(Drawable orig) {
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
Bitmap instance = ((BitmapDrawable) orig).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
|
||||
Bitmap bm = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
if (bm == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
Bitmap instance = bm.copy(Bitmap.Config.ARGB_8888, true);
|
||||
|
||||
if (instance == null) {
|
||||
Log.d("Wallpaper", "bitmap null");
|
||||
sendToast("Ошибка при установке фильтра. Сбрасываем настройки на по умолчанию");
|
||||
removeWallpaper();
|
||||
return orig;
|
||||
}
|
||||
|
||||
Bitmap bwBitmap = Bitmap.createBitmap(instance.getWidth(), instance.getHeight(), Bitmap.Config.RGB_565);
|
||||
float[] hsv = new float[3];
|
||||
@@ -138,7 +223,7 @@ public class ImageFilters {
|
||||
p.setColorFilter(filter);
|
||||
canvas.drawBitmap(bm, new Matrix(), p);
|
||||
} catch (Exception e) {
|
||||
sendToast("Ошибка при работе затемнения обоев");
|
||||
Log.d("WallpaperD", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +235,7 @@ public class ImageFilters {
|
||||
p.setColorFilter(filter);
|
||||
canvas.drawBitmap(bm, new Matrix(), p);
|
||||
} catch (Exception e) {
|
||||
sendToast("Ошибка при работе осветления обоев");
|
||||
Log.d("WallpaperL", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.removeWallpaper;
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.requestUpdateWallpaper;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.deleteCache;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
|
||||
|
||||
@@ -14,16 +14,17 @@ import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
@@ -73,13 +74,21 @@ public class WallpapersHooks {
|
||||
inputStream.close();
|
||||
|
||||
File outPutFile = File.createTempFile("wallpaper_temp","image");
|
||||
outPutFile.deleteOnExit();
|
||||
FileOutputStream outputStream = new FileOutputStream(outPutFile);
|
||||
selectedBitmap.compress(Bitmap.CompressFormat.PNG, 85 , outputStream);
|
||||
|
||||
try {
|
||||
selectedBitmap.compress(Bitmap.CompressFormat.PNG, 85 , outputStream);
|
||||
} catch (Exception e) {
|
||||
Log.e("WallpapersCompression", e.getMessage());
|
||||
}
|
||||
|
||||
outputStream.close();
|
||||
|
||||
return outPutFile;
|
||||
} catch (Exception e) {
|
||||
Log.d("Wallpapers", e.getMessage());
|
||||
return null;
|
||||
return file;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,24 +102,39 @@ public class WallpapersHooks {
|
||||
}
|
||||
|
||||
public static String getWallpaperUrl() {
|
||||
if (getWallpaperFile().exists() && eligibleWallpaperFile(getWallpaperFile()))
|
||||
if (compress(getWallpaperFile()) == null) {
|
||||
return "default";
|
||||
} else if (getBoolValue("compresswp", true)){
|
||||
return compress(getWallpaperFile()).getAbsolutePath();
|
||||
var file = getWallpaperFile();
|
||||
|
||||
if (file.exists() && eligibleWallpaperFile(file)) {
|
||||
if (getBoolValue("compresswp", true)) {
|
||||
return compress(file).getAbsolutePath();
|
||||
} else {
|
||||
return getWallpaperFile().getAbsolutePath();
|
||||
return file.getAbsolutePath();
|
||||
}
|
||||
else
|
||||
return "default";
|
||||
}
|
||||
|
||||
return "default";
|
||||
}
|
||||
|
||||
public static Drawable getWallpaper() {
|
||||
if (mWallpaper == null || mUpdateWallpaperRequested) {
|
||||
String url = getWallpaperUrl();
|
||||
|
||||
if (url.equals("default") || url.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Drawable drawable = Drawable.createFromPath(getWallpaperUrl());
|
||||
|
||||
if (drawable == null || ((BitmapDrawable) drawable).getBitmap() == null) {
|
||||
Log.d("Wallpaper", "drawable null");
|
||||
removeWallpaper();
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!getPreferences().getString("msg_blur_radius", "disabled").equals("disabled")) {
|
||||
mWallpaper = getBlurredWallpaper(Drawable.createFromPath(getWallpaperUrl()), getRadius());
|
||||
mWallpaper = getBlurredWallpaper(drawable, getRadius());
|
||||
} else {
|
||||
mWallpaper = Drawable.createFromPath(getWallpaperUrl());
|
||||
mWallpaper = drawable;
|
||||
}
|
||||
if (!getPreferences().getString("msg_dim", "off").equals("off")) {
|
||||
mWallpaper = getDimmed(mWallpaper);
|
||||
|
||||
@@ -13,9 +13,7 @@ import com.vk.im.ui.providers.audiomsg.ImAudioMsgPlayerProvider;
|
||||
import com.vk.im.ui.providers.audiomsg.PlayerActionSources;
|
||||
import com.vk.imageloader.VKImageLoader;
|
||||
import com.vk.media.player.cache.AutoPlayCacheHolder;
|
||||
import com.vk.mediastore.MediaStorage;
|
||||
import com.vk.stickers.Stickers;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
|
||||
import java.text.CharacterIterator;
|
||||
import java.text.StringCharacterIterator;
|
||||
|
||||
@@ -10,7 +10,6 @@ import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.RectF;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.setProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.edit;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPreferences;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.*;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.needToDelete;
|
||||
import static ru.vtosters.lite.utils.DeletedMessagesHandler.reloadMessagesList;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.setProxy;
|
||||
import static ru.vtosters.lite.utils.SignatureChecker.validateAppSignature;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isPrometheus;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.hooks.DateHook.getLocale;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.vksans;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.isApiProxyEnabled;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.isDarkTheme;
|
||||
|
||||
public class SSFSUtils {
|
||||
@@ -39,7 +39,7 @@ public class SSFSUtils {
|
||||
}
|
||||
|
||||
public static String getUserProxy() {
|
||||
return isApiProxyEnabled() ? "1" : "0";
|
||||
return isAnyProxyEnabled() ? "1" : "0";
|
||||
}
|
||||
|
||||
public static String isVKSansEnabled() {
|
||||
|
||||
@@ -131,5 +131,10 @@
|
||||
<Preference
|
||||
android:key="newsfeedlistmanager_reset"
|
||||
android:title="@string/newsfeedlistmanager_reset_title" />
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="donotgetads"
|
||||
android:summary="Не запрашивать рекламу и рекомендации\nМогуть быть проблемы"
|
||||
android:title="Не пытаться получать рекламу" />
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
||||
|
||||
Reference in New Issue
Block a user