Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd7f3f8b52 | ||
|
|
4b57fa9414 | ||
|
|
9d3099f816 | ||
|
|
a0c02b2fd1 | ||
|
|
df8c86fe4c | ||
|
|
008a24bfff | ||
|
|
5484766ef1 | ||
|
|
b36a3bfbdb | ||
|
|
7fc842c9ef | ||
|
|
8615faff4a | ||
|
|
ba05c831cc | ||
|
|
3f11a14d92 | ||
|
|
0284dec33a | ||
|
|
8d376d9e5a | ||
|
|
ce731b1832 | ||
|
|
64a8552647 | ||
|
|
e0b06449ec | ||
|
|
64d62b10a1 | ||
|
|
1a3cf8695d | ||
|
|
1251dd1d2d | ||
|
|
06d5b1a779 | ||
|
|
c18a3dde9e | ||
|
|
6961bc073a | ||
|
|
e1b6f8d66f | ||
|
|
b95edec916 | ||
|
|
8756cd1f20 | ||
|
|
8122c92bbf | ||
|
|
3e53455a05 | ||
|
|
07ddb66264 | ||
|
|
4fef230a06 | ||
|
|
2d73131863 | ||
|
|
f90ae6bade | ||
|
|
b4a45a17c7 | ||
|
|
8767540164 | ||
|
|
fb8e327856 | ||
|
|
344b30aa62 | ||
|
|
d776693aea | ||
|
|
aaf2f9c6c9 | ||
|
|
5fbabfbe23 | ||
|
|
42645a5414 | ||
|
|
5af63e0adf | ||
|
|
ba430052de | ||
|
|
a81ebed663 | ||
|
|
920883ada1 | ||
|
|
41c5f57ccc | ||
|
|
2aa7862fe1 | ||
|
|
22795bab81 | ||
|
|
9ae1c0c1bb |
@@ -2,14 +2,17 @@ package com.vtosters.lite.ui.bottomnavigation;
|
||||
|
||||
import static ru.vtosters.lite.utils.Themes.getCSTDock;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -43,14 +46,12 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
private MenuItemImpl mItemData;
|
||||
private ColorStateList mColorStateList;
|
||||
private final int mMargin;
|
||||
private final int mDiff;
|
||||
private final float mSmallScale;
|
||||
private final float mLargeScale;
|
||||
private boolean mShiftingModeEnabled;
|
||||
private boolean mIconsModeEnabled;
|
||||
private boolean mStaticModeEnabled;
|
||||
private ImageView mIcon;
|
||||
private ImageView mActionIcon;
|
||||
private final ImageView mIcon;
|
||||
private final ImageView mActionIcon;
|
||||
|
||||
public BottomNavigationItemView(@NonNull Context context) {
|
||||
this(context, null);
|
||||
@@ -64,12 +65,9 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
super(context, attrs, defStyle);
|
||||
this.mItemPos = -1;
|
||||
|
||||
var textSize = (float) getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_text_size);
|
||||
var activeTextSize = (float) getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_active_text_size);
|
||||
this.mMargin = getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_margin);
|
||||
this.mDiff = (int) (textSize - activeTextSize);
|
||||
this.mSmallScale = activeTextSize / textSize;
|
||||
this.mLargeScale = textSize / activeTextSize;
|
||||
this.mSmallScale = 10.0f;
|
||||
float mLargeScale = 10.0f;
|
||||
|
||||
LayoutInflater.from(context).inflate(R.layout.design_bottom_navigation_item, this, true);
|
||||
this.setBackgroundResource(R.drawable.design_bottom_navigation_item_background);
|
||||
@@ -102,6 +100,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
this.mActionIcon.setVisibility(VISIBLE);
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public MenuItemImpl getItemData() {
|
||||
return this.mItemData;
|
||||
}
|
||||
@@ -110,6 +109,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
return this.mItemPos;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void initialize(MenuItemImpl impl, int i) {
|
||||
this.mItemData = impl;
|
||||
this.setCheckable(impl.isCheckable());
|
||||
@@ -121,6 +121,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
this.setContentDescription(impl.getTitle());
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public int[] onCreateDrawableState(int extraSpace) {
|
||||
int[] baseState = super.onCreateDrawableState(extraSpace + 1);
|
||||
if (this.mItemData != null && this.mItemData.isCheckable() && this.mItemData.isChecked()) {
|
||||
@@ -146,14 +147,17 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public boolean prefersCondensedTitle() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void setCheckable(boolean var1) {
|
||||
this.refreshDrawableState();
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void setChecked(boolean checked) {
|
||||
this.mItemData.setChecked(checked);
|
||||
|
||||
@@ -220,6 +224,14 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
// ViewCompat.setScaleY(mLargeLabel, !mStaticModeEnabled && !checked ? mLargeScale : 1.0f);
|
||||
ViewCompat.setScaleX(mSmallLabel, !mStaticModeEnabled && checked ? mSmallScale : 1.0f);
|
||||
ViewCompat.setScaleY(mSmallLabel, !mStaticModeEnabled && checked ? mSmallScale : 1.0f);
|
||||
// make mLargeLabel and mSmallLabel are bold
|
||||
mLargeLabel.setTypeface(null, Typeface.BOLD);
|
||||
mSmallLabel.setTypeface(null, Typeface.BOLD);
|
||||
|
||||
// make mLargeLabel and mSmallLabel text size is 10sp
|
||||
mLargeLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
|
||||
mSmallLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
|
||||
|
||||
mLargeLabel.setVisibility(/*checked ? VISIBLE :*/ INVISIBLE);
|
||||
mSmallLabel.setVisibility(VISIBLE);//checked ? INVISIBLE : VISIBLE);
|
||||
|
||||
@@ -264,6 +276,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
this.mIcon.setEnabled(b);
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void setIcon(Drawable drawable) {
|
||||
if (drawable != null) {
|
||||
if (drawable.getConstantState() != null)
|
||||
@@ -276,6 +289,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
this.mIcon.setImageDrawable(drawable);
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void setIconTintList(ColorStateList colorStateList) {
|
||||
this.mColorStateList = colorStateList;
|
||||
MenuItemImpl impl = this.mItemData;
|
||||
@@ -305,17 +319,20 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
||||
this.mShiftingModeEnabled = var1;
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void setShortcut(boolean b, char c) {
|
||||
}
|
||||
|
||||
public void setTextColor(ColorStateList colorStateList) {
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public void setTitle(CharSequence title) {
|
||||
this.mSmallLabel.setText(title);
|
||||
this.mLargeLabel.setText(title);
|
||||
}
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
public boolean showsIcon() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15,30 +15,40 @@ import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.music.Callback;
|
||||
import ru.vtosters.lite.music.FFMpeg;
|
||||
import ru.vtosters.lite.music.M3UDownloader;
|
||||
import ru.vtosters.lite.music.MP3Downloader;
|
||||
import ru.vtosters.lite.utils.Globals;
|
||||
|
||||
public class AudioDownloader{
|
||||
public class AudioDownloader {
|
||||
private static NotificationManagerCompat notificationManager = NotificationManagerCompat.from(Globals.getContext());
|
||||
|
||||
public static void downloadAudio(MusicTrack track){
|
||||
public static void downloadAudio(MusicTrack track) {
|
||||
if (Globals.getDefprefs().getBoolean("new_music_downloading_way", false)) {
|
||||
downloadMP3(track);
|
||||
} else {
|
||||
downloadM3U8(track);
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadM3U8(MusicTrack track) {
|
||||
if (track.D == null) {
|
||||
ToastUtils.a("Не удалось найти ссылку на аудиозапись");
|
||||
return;
|
||||
}
|
||||
|
||||
var musicPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath();
|
||||
var tempId = track.d;
|
||||
var downloadPath = musicPath + File.separator + tempId;
|
||||
var notification = buildDownloadNotification(track, tempId);
|
||||
|
||||
downloadM3U8(track, downloadPath, new Callback(){
|
||||
var notification = buildDownloadNotification(track, tempId);
|
||||
downloadM3U8(track, downloadPath, new Callback() {
|
||||
@Override
|
||||
public void onProgress(int progress){
|
||||
public void onProgress(int progress) {
|
||||
notification.setProgress(100, progress, false);
|
||||
notificationManager.notify(tempId, notification.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(){
|
||||
public void onSuccess() {
|
||||
try {
|
||||
var fileName = track.toString();
|
||||
var success = FFMpeg.convert(downloadPath, musicPath + File.separator + fileName + ".mp3");
|
||||
@@ -59,19 +69,19 @@ public class AudioDownloader{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(){
|
||||
public void onFailure() {
|
||||
notification.setContentText("Не удалось загрузить аудиозапись").setProgress(0, 0, false);
|
||||
notificationManager.notify(tempId, notification.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSizeReceived(long size, long header){
|
||||
public void onSizeReceived(long size, long header) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void downloadM3U8(MusicTrack track, String path, Callback callback){
|
||||
private static void downloadM3U8(MusicTrack track, String path, Callback callback) {
|
||||
File outDir = new File(path);
|
||||
if (!outDir.exists())
|
||||
if (outDir.mkdir())
|
||||
@@ -82,7 +92,11 @@ public class AudioDownloader{
|
||||
new M3UDownloader(track.D, outDir, callback).execute();
|
||||
}
|
||||
|
||||
private static NotificationCompat.Builder buildDownloadNotification(MusicTrack track, int id){
|
||||
private static void downloadMP3(MusicTrack track) {
|
||||
new MP3Downloader().execute(track);
|
||||
}
|
||||
|
||||
private static NotificationCompat.Builder buildDownloadNotification(MusicTrack track, int id) {
|
||||
var notificationBuilder = new NotificationCompat.Builder(Globals.getContext(), NotificationChannels.MUSIC_DOWNLOAD_CHANNEL_ID)
|
||||
.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
.setContentTitle("Загрузка аудиозаписи")
|
||||
|
||||
@@ -9,23 +9,26 @@ import static ru.vtosters.lite.utils.Proxy.getApi;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.exifinterface.media.ExifInterface;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.network.Network;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import ru.vtosters.lite.net.Request;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
public class FoafBase{
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
@@ -34,16 +37,29 @@ public class FoafBase{
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
|
||||
public static long getLastSeen(long origtime, int id) throws ParseException, IOException{
|
||||
if (!Preferences.foaf()) return origtime;
|
||||
var request = new okhttp3.Request.a()
|
||||
.b(getLink(id))
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
|
||||
String response = null;
|
||||
|
||||
try {
|
||||
response = client.a(request).execute().a().g();
|
||||
} catch (IOException e) {
|
||||
Log.e("FoafBase", e.getMessage());
|
||||
}
|
||||
|
||||
Matcher matcher = FOAF_REGEX_LAST_SEEN.matcher(response);
|
||||
|
||||
Matcher matcher = FOAF_REGEX_LAST_SEEN.matcher(
|
||||
client.a(
|
||||
new okhttp3.Request.a().a(getLink(id)).b().a()
|
||||
).execute().a().g());
|
||||
if (!matcher.find()) {
|
||||
return origtime;
|
||||
}
|
||||
return new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ss", Locale.getDefault()).parse(matcher.group(1)).getTime() / 1000;
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US);
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("Europe/Moscow"));
|
||||
Date date = sdf.parse(matcher.group(1));
|
||||
sdf.setTimeZone(TimeZone.getDefault());
|
||||
return sdf.parse(sdf.format(date)).getTime() / 1000;
|
||||
}
|
||||
|
||||
private static String getLink(int i){
|
||||
|
||||
@@ -3,62 +3,160 @@ package ru.vtosters.lite.hooks;
|
||||
import static ru.vtosters.lite.f0x1d.VTVerifications.isDeveloper;
|
||||
import static ru.vtosters.lite.f0x1d.VTVerifications.isPrometheus;
|
||||
import static ru.vtosters.lite.f0x1d.VTVerifications.isVerified;
|
||||
import static ru.vtosters.lite.foaf.FoafBase.getLastSeen;
|
||||
import static ru.vtosters.lite.hooks.DateHook.getLocale;
|
||||
import static ru.vtosters.lite.utils.Base64Utils.decode;
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserId;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
||||
import static ru.vtosters.lite.utils.Globals.isVKTester;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.checkCaption;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.checkCopyright;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isBadNews;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsgroup;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsstories;
|
||||
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsblock;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.network.Network;
|
||||
import com.vk.core.util.DeviceIdProvider;
|
||||
import com.vtosters.lite.fragments.messages.chat.vc.MsgSendVc;
|
||||
import com.vk.core.util.LangUtils;
|
||||
import com.vk.core.util.UriExt;
|
||||
import com.vk.webapp.VkUiFragment;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.ParseException;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.utils.Globals;
|
||||
import ru.vtosters.lite.utils.Newsfeed;
|
||||
|
||||
public class JsonInjectors{
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
|
||||
public static JSONObject profileButton(JSONObject orig) throws JSONException{
|
||||
if (haveDonateButton()) return orig;
|
||||
var id = orig.getInt("id");
|
||||
|
||||
var pic = "https://sun1-18.userapi.com/NLd_rNpGuSaBnPV6O-j5mqCGZk8BK8drAMd2LQ/5R-DEF37PFs.png";
|
||||
var newItem = new JSONArray();
|
||||
|
||||
if (orig.has("buttons")) {
|
||||
newItem = orig.getJSONArray("buttons");
|
||||
}
|
||||
|
||||
if (!haveDonateButton() && id == getUserId()) {
|
||||
newItem.put(donateRecomm());
|
||||
}
|
||||
|
||||
if (!orig.has("type") && isVKTester()) {
|
||||
newItem.put(vktesters(id));
|
||||
}
|
||||
|
||||
orig.put("buttons", newItem);
|
||||
|
||||
return orig;
|
||||
}
|
||||
|
||||
public static JSONObject donateRecomm() throws JSONException{
|
||||
var title = "Помоги проекту донатом и получи бонус!";
|
||||
var link = "https://vk.com/vtosters_official";
|
||||
var text_color = "2D81E0";
|
||||
|
||||
// JSONObject jsonObj = new JSONObject("{\"action\":{\"target\":\"internal\",\"type\":\"open_url\",\"url\":\"" + link + "\"},\"title\":\"" + title + "\",\"icons\":[{\"url\":\"" + pic + "\",\"width\":20,\"height\":20},{\"url\":\"" + pic + "\",\"width\":40,\"height\":40},{\"url\":\"" + pic + "\",\"width\":60,\"height\":60},{\"url\":\"" + pic + "\",\"width\":80,\"height\":80}],\"text_color\":\"" + text_color + "\"}");
|
||||
return new JSONObject(decode("eyJhY3Rpb24iOnsidGFyZ2V0IjoiaW50ZXJuYWwiLCJ0eXBlIjoib3Blbl91cmwiLCJ1cmwiOiI=")
|
||||
+ link + decode("In0sInRpdGxlIjoi")
|
||||
+ title + decode("IiwiaWNvbnMiOlt7InVybCI6Ig==")
|
||||
+ pic + decode("Iiwid2lkdGgiOjIwLCJoZWlnaHQiOjIwfSx7InVybCI6Ig==")
|
||||
+ pic + decode("Iiwid2lkdGgiOjQwLCJoZWlnaHQiOjQwfSx7InVybCI6Ig==")
|
||||
+ pic + decode("Iiwid2lkdGgiOjYwLCJoZWlnaHQiOjYwfSx7InVybCI6Ig==")
|
||||
+ pic + decode("Iiwid2lkdGgiOjgwLCJoZWlnaHQiOjgwfV0sInRleHRfY29sb3IiOiI=")
|
||||
+ text_color + decode("In0="));
|
||||
var json = new JSONObject();
|
||||
var icons = new JSONArray();
|
||||
|
||||
var action = new JSONObject();
|
||||
action.put("target", "internal");
|
||||
action.put("type", "open_url"); // may be open_url, open_internal_vkui, open_game, help_hint, show_full_post, open_vkapp, show_recommendations_for_post and groups_advertisement
|
||||
action.put("url", link);
|
||||
json.put("action", action);
|
||||
|
||||
json.put("title", title);
|
||||
|
||||
var icon1 = new JSONObject();
|
||||
icon1.put("url", "https://sun2-10.userapi.com/NLd_rNpGuSaBnPV6O-j5mqCGZk8BK8drAMd2LQ/5R-DEF37PFs.png");
|
||||
icon1.put("width", "20");
|
||||
icon1.put("height", "20");
|
||||
icons.put(icon1);
|
||||
|
||||
var icon2 = new JSONObject();
|
||||
icon2.put("url", "https://sun2-12.userapi.com/N8y9pU1meJq_eug-wB1u-HUuGyMqDfdq7A025w/A4Aio-xuLY8.png");
|
||||
icon2.put("width", "40");
|
||||
icon2.put("height", "40");
|
||||
icons.put(icon2);
|
||||
|
||||
var icon3 = new JSONObject();
|
||||
icon3.put("url", "https://sun2-9.userapi.com/3Hx4hff63_2Lt6wjjthJMF_3QLUswNNlQKoAXQ/oyzEu1NL9T8.png");
|
||||
icon3.put("width", "80");
|
||||
icon3.put("height", "80");
|
||||
icons.put(icon3);
|
||||
|
||||
json.put("icons", icons);
|
||||
|
||||
json.put("text_color", text_color);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject vktesters(int id) throws JSONException{
|
||||
var title = "Карточка Тестера";
|
||||
var text_color = "2D81E0";
|
||||
var link = "https://static.vk.com/bugs?lang=" + LangUtils.a() + "#/reporter" + id;
|
||||
|
||||
var json = new JSONObject();
|
||||
var icons = new JSONArray();
|
||||
|
||||
var action = new JSONObject();
|
||||
action.put("target", "internal");
|
||||
action.put("type", "open_internal_vkui");
|
||||
action.put("url", link);
|
||||
json.put("action", action);
|
||||
|
||||
json.put("title", title);
|
||||
|
||||
var icon1 = new JSONObject();
|
||||
icon1.put("url", "https://sun2-10.userapi.com/NLd_rNpGuSaBnPV6O-j5mqCGZk8BK8drAMd2LQ/5R-DEF37PFs.png");
|
||||
icon1.put("width", "20");
|
||||
icon1.put("height", "20");
|
||||
icons.put(icon1);
|
||||
|
||||
var icon2 = new JSONObject();
|
||||
icon2.put("url", "https://sun2-12.userapi.com/N8y9pU1meJq_eug-wB1u-HUuGyMqDfdq7A025w/A4Aio-xuLY8.png");
|
||||
icon2.put("width", "40");
|
||||
icon2.put("height", "40");
|
||||
icons.put(icon2);
|
||||
|
||||
var icon3 = new JSONObject();
|
||||
icon3.put("url", "https://sun2-9.userapi.com/3Hx4hff63_2Lt6wjjthJMF_3QLUswNNlQKoAXQ/oyzEu1NL9T8.png");
|
||||
icon3.put("width", "80");
|
||||
icon3.put("height", "80");
|
||||
icons.put(icon3);
|
||||
|
||||
json.put("icons", icons);
|
||||
|
||||
json.put("text_color", text_color);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject convBar(JSONObject orig) throws JSONException{
|
||||
if (!dev()) return orig.optJSONObject("conversation_bar"); // TODO Make it server-side
|
||||
var peerid = Objects.requireNonNull(orig.optJSONObject("peer")).optInt("id");
|
||||
|
||||
var pic = "https://image.pngaaa.com/641/326641-middle.png"; // can be null
|
||||
@@ -82,7 +180,15 @@ public class JsonInjectors{
|
||||
if (isVerified(peerid)) text = "Я купил VTosters Premium";
|
||||
if (isPrometheus(peerid)) text = "Я купил VTosters Premium Gold Prime Pro Plus";
|
||||
if (isDeveloper(peerid)) text = "Я создал говно";
|
||||
if (!isVerified(peerid) || text.equals("")) return orig.optJSONObject("conversation_bar");
|
||||
if (!isVerified(peerid) || text.equals("")) {
|
||||
if (getBoolValue("convBarRecomm", false)) {
|
||||
return null;
|
||||
} else {
|
||||
return orig.optJSONObject("conversation_bar");
|
||||
}
|
||||
}
|
||||
|
||||
if (!dev()) return orig.optJSONObject("conversation_bar");
|
||||
|
||||
// JSONObject("{\"name\":\"group_admin_welcome\",\"text\":\"" + textverif + "\",\"buttons\":[],\"icon\":\"" + pic + "\"}");
|
||||
return new JSONObject(decode("eyJuYW1lIjoiZ3JvdXBfYWRtaW5fd2VsY29tZSIsInRleHQiOiI=")
|
||||
@@ -104,8 +210,9 @@ public class JsonInjectors{
|
||||
return orig;
|
||||
}
|
||||
|
||||
public static JSONObject superapp(JSONObject json) throws JSONException {
|
||||
var superApps = Globals.getPreferences().getString("superapp_items", "").split(",");
|
||||
public static JSONObject superapp(JSONObject json) throws JSONException{
|
||||
var superApps = Globals.getPreferences().getString("superapp_items",
|
||||
"menu,promo,miniapps,vkpay_slim,greeting,holiday,weather,sport,games,informer,food,event,music,vk_run").split(",");
|
||||
if (superApps.length == 0) return json;
|
||||
|
||||
var oldItems = json.optJSONArray("items");
|
||||
@@ -138,14 +245,210 @@ public class JsonInjectors{
|
||||
if (oldItems != null) {
|
||||
if (oldItems.optJSONObject(0).optString("url").contains("?section=recent")) {
|
||||
json.remove("links");
|
||||
if (dev()) Log.d("VKMusic", "Removed links buttons");
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject setOnlineInfo(JSONObject json) throws ParseException, IOException, JSONException{
|
||||
var id = json.optInt("id");
|
||||
var onlineinfo = json.optJSONObject("online_info");
|
||||
var time = getLastSeen(0L, id);
|
||||
|
||||
if (time != 0L && onlineinfo != null && !onlineinfo.optBoolean("is_online") && id != getUserId()) {
|
||||
json.remove("online_info");
|
||||
|
||||
var online_info = new JSONObject()
|
||||
.put("visible", true)
|
||||
.put("last_seen", time)
|
||||
.put("is_online", false)
|
||||
.put("app_id", 0)
|
||||
.put("is_mobile", false);
|
||||
|
||||
var last_seen = new JSONObject()
|
||||
.put("platform", 4)
|
||||
.put("time", time);
|
||||
|
||||
json.put("last_seen", last_seen).put("online_info", online_info);
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject storiesads(JSONObject json, boolean isDeleteFix) throws JSONException{
|
||||
if (!adsstories()) {
|
||||
return json;
|
||||
}
|
||||
|
||||
if (json.has("ads")) {
|
||||
if (isDeleteFix) {
|
||||
json.optJSONObject("ads").optJSONObject("settings")
|
||||
.put("stories_interval", 0)
|
||||
.put("authors_interval", 0)
|
||||
.put("time_interval", 0)
|
||||
.put("stories_init", 0)
|
||||
.put("authors_init", 0)
|
||||
.put("time_init", 0);
|
||||
if (dev()) Log.d("StoriesAds", "Set ads settings at zero values");
|
||||
} else {
|
||||
json.remove("ads");
|
||||
if (dev()) Log.d("StoriesAds", "Removed ads block");
|
||||
}
|
||||
}
|
||||
|
||||
if (!json.has("items")) return json;
|
||||
|
||||
var items = json.optJSONArray("items");
|
||||
for (int i = 0; i < items.length(); i++) {
|
||||
var item = items.optJSONObject(i);
|
||||
if (item != null) {
|
||||
parseStoriesItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
private static void parseStoriesItem(JSONObject item) throws JSONException{
|
||||
var stories = item.optJSONArray("stories");
|
||||
var newStories = new JSONArray();
|
||||
|
||||
if (stories == null) return;
|
||||
|
||||
for (int j = 0; j < stories.length(); j++) {
|
||||
var story = stories.optJSONObject(j);
|
||||
|
||||
if (!story.optBoolean("is_ads") && !story.optBoolean("is_promo")) {
|
||||
newStories.put(story);
|
||||
} else {
|
||||
if (dev())
|
||||
Log.d("StoriesAds", "Fetched ad, owner id " + story.optString("owner_id") + ", caption " + story.optString("caption"));
|
||||
}
|
||||
}
|
||||
|
||||
item.put("stories", newStories);
|
||||
}
|
||||
|
||||
public static Boolean isAds(JSONObject list, String type) throws JSONException{
|
||||
if (list == null || type == null || !ads()) return false;
|
||||
|
||||
if (list.has("ads")
|
||||
|| type.equals("ads")
|
||||
|| type.equals("carousel")
|
||||
|| type.equals("html5_ad")
|
||||
|| type.equals("ads_easy_promote")) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: ads");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (type.equals("promo_button")
|
||||
|| type.equals("app_widget")
|
||||
|| type.equals("app_video")
|
||||
|| type.equals("app_slider")
|
||||
|| type.equals("tags_suggestions")) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: promo");
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static JSONArray newsfeedlist(JSONArray items) throws JSONException{
|
||||
for (int j = 0; j < items.length(); j++) {
|
||||
var list = items.optJSONObject(j);
|
||||
var name = list.optString("id");
|
||||
|
||||
if (!name.equals("kpop") && !name.equals("foryou") && !name.equals("qazaqstan")) {
|
||||
list.put("is_hidden", false).put("is_unavailable", false);
|
||||
if (dev()) Log.d("NewsfeedListInj", "Unlocked " + name + " in newsfeed list");
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public static JSONArray newsfeedadtest(JSONArray items) throws JSONException{
|
||||
if (!getBoolValue("newadblock", true)) return items;
|
||||
var newItems = new JSONArray();
|
||||
|
||||
for (int j = 0; j < items.length(); j++) {
|
||||
var list = items.optJSONObject(j);
|
||||
var type = list.optString("type");
|
||||
|
||||
if (isAds(list, type)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (authorsrecomm() && (type.equals("authors_rec")
|
||||
|| type.startsWith("recommended_") && (type.endsWith("audios")
|
||||
|| type.endsWith("artists")
|
||||
|| type.endsWith("playlists")
|
||||
|| type.endsWith("groups")))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: authorsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (postsrecomm() && (type.equals("inline_user_rec") || type.equals("live_recommended"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: postsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (friendsrecomm() && (type.equals("user_rec") || type.equals("friends_recomm"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: friendsrecomm");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (adsgroup() && list.optInt("marked_as_ads") == 1) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: marked_as_ads is true");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isBadNews(list.optString("text"))) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: text filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (checkCopyright(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: copyright filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (checkCaption(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: caption filters");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Newsfeed.injectFiltersReposts(list)) {
|
||||
if (dev())
|
||||
Log.d("NewsfeedAdBlockV2", "Removed post " + list.optInt("post_id") + " from feed, Reason: repost ad");
|
||||
continue;
|
||||
}
|
||||
|
||||
newItems.put(list);
|
||||
}
|
||||
|
||||
return newItems;
|
||||
}
|
||||
|
||||
public static JSONObject music(JSONObject json) throws JSONException{
|
||||
var oldItems = json.optJSONObject("catalog").optJSONArray("sections");
|
||||
var catalog = json.optJSONObject("catalog");
|
||||
|
||||
JSONArray oldItems = null;
|
||||
|
||||
if (catalog != null) {
|
||||
oldItems = catalog.optJSONArray("sections");
|
||||
}
|
||||
|
||||
if (oldItems != null) {
|
||||
var playlists = fetchCatalogId("https://vk.com/audio?section=my_playlists");
|
||||
@@ -156,6 +459,8 @@ public class JsonInjectors{
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
@@ -167,6 +472,8 @@ public class JsonInjectors{
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
@@ -178,14 +485,30 @@ public class JsonInjectors{
|
||||
var id = catalogarr.optString("id");
|
||||
var url = catalogarr.optString("url");
|
||||
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
|
||||
|
||||
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
|
||||
}
|
||||
|
||||
for (int i = 0; i < oldItems.length(); i++) {
|
||||
var item = oldItems.optJSONObject(i);
|
||||
var title = item.optString("title");
|
||||
var id = item.optString("id");
|
||||
var url = item.optString("url");
|
||||
var value = getPrefsValue("musicdefcatalog");
|
||||
|
||||
Log.d("VKMusic", "title: " + title + " id: " + id + " url: " + url + " value: " + value);
|
||||
|
||||
if (url.contains(value)) {
|
||||
catalog.put("default_section", id);
|
||||
if (dev()) Log.d("VKMusic", "Added " + title + " as default music section");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
|
||||
public static JSONObject fetchCatalogId(String section){
|
||||
if (section == null) return null;
|
||||
|
||||
@@ -253,11 +576,11 @@ public class JsonInjectors{
|
||||
skip = friendsblock();
|
||||
}
|
||||
|
||||
if (buttons.contains("friends_birthdays_list")){
|
||||
if (buttons.contains("friends_birthdays_list")) {
|
||||
hasBirthday = true;
|
||||
}
|
||||
|
||||
if (name.contains("separator") && hasBirthday){
|
||||
if (name.contains("separator") && hasBirthday) {
|
||||
skip = false;
|
||||
hasBirthday = false;
|
||||
}
|
||||
|
||||
@@ -6,13 +6,14 @@ import static ru.vtosters.lite.utils.Newsfeed.checkCopyright;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.injectFiltersReposts;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isAds;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isAuthorRecommendations;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isBadNew;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isBadNews;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isFriendsRecommendations;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isGroupAds;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isMusicBlock;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isNewsBlock;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isPostRecommendations;
|
||||
import static ru.vtosters.lite.utils.Newsfeed.isRecomsGroup;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import com.vk.core.preference.Preference;
|
||||
@@ -20,8 +21,13 @@ import com.vk.core.preference.Preference;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NewsfeedHook{
|
||||
public static boolean injectFilters(JSONObject obj) throws JSONException{
|
||||
if (getBoolValue("newadblock", true)) return true;
|
||||
|
||||
var optString = obj.optString("type", "");
|
||||
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString) || isRecomsGroup(optString) || isMusicBlock(optString) || isNewsBlock(optString)) {
|
||||
return false;
|
||||
@@ -37,7 +43,7 @@ public class NewsfeedHook{
|
||||
|
||||
if (checkCopyright(obj)) return false;
|
||||
|
||||
if (isBadNew(obj.optString("text", ""))) return false;
|
||||
if (isBadNews(obj.optString("text", ""))) return false;
|
||||
|
||||
if (checkCaption(obj)) return false;
|
||||
|
||||
@@ -59,4 +65,11 @@ public class NewsfeedHook{
|
||||
return Preference.b().getLong(refresh_timeout ? "refresh_timeout_top" : "refresh_timeout_recent", 600000L);
|
||||
}
|
||||
}
|
||||
|
||||
public static List hideElement(ArrayList list){
|
||||
if (!getBoolValue("whatsnew", true)) {
|
||||
list.clear();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
import static ru.vtosters.lite.hooks.JsonInjectors.setOnlineInfo;
|
||||
import static ru.vtosters.lite.net.Request.makeRequest;
|
||||
import static ru.vtosters.lite.utils.Globals.getString;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserId;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
||||
import static ru.vtosters.lite.utils.Globals.sendToast;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
@@ -8,10 +10,15 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.getPrefsFromFile;
|
||||
import static ru.vtosters.lite.utils.Proxy.getApi;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
||||
public class OnlineFormatterHook{
|
||||
private static String AppName;
|
||||
|
||||
@@ -159,5 +166,16 @@ public class OnlineFormatterHook{
|
||||
|
||||
return getString("custom_online") + " " + appname;
|
||||
}
|
||||
|
||||
public static JSONObject onlineHook(JSONObject json, boolean isGlobalHook) throws ParseException, IOException, JSONException{
|
||||
if (!getBoolValue("onlinefix", false)) return json;
|
||||
|
||||
if (isGlobalHook && !getBoolValue("globalUsersOnline", false)) {
|
||||
return json;
|
||||
}
|
||||
|
||||
setOnlineInfo(json);
|
||||
return json;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
|
||||
import static ru.vtosters.lite.utils.Preferences.videoewcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import com.vk.apps.AppsFragment;
|
||||
@@ -27,6 +28,7 @@ import com.vtosters.lite.fragments.money.MoneyTransfersFragment;
|
||||
import com.vtosters.lite.fragments.p2.DocumentsViewFragment;
|
||||
import com.vtosters.lite.fragments.s2.GroupsFragment1;
|
||||
import com.vtosters.lite.fragments.t2.c.DialogsFragment;
|
||||
import com.vtosters.lite.fragments.y2.VideoCatalogFragment;
|
||||
import com.vtosters.lite.fragments.y2.VideosFragment;
|
||||
import com.vtosters.lite.general.fragments.GamesFragment;
|
||||
import com.vtosters.lite.general.fragments.PhotosFragment;
|
||||
@@ -50,7 +52,7 @@ public class StartFragmentHook{
|
||||
case "photos":
|
||||
return PhotosFragment.class;
|
||||
case "videos":
|
||||
return VideosFragment.class;
|
||||
return videoewcatalog() ? VideoCatalogFragment.class : VideosFragment.class;
|
||||
case "settings":
|
||||
return useNewSettings();
|
||||
case "apps":
|
||||
|
||||
@@ -47,8 +47,6 @@ public class TogglesHook{
|
||||
case FEATURE_MOZJPEG:
|
||||
case FEATURE_MUSIC_ARTIST_CATALOG:
|
||||
case FEATURE_MUSIC_NEW_CATALOG:
|
||||
case FEATURE_MUSIC_STOP_PLAYER_ON_TASK_REMOVAL:
|
||||
case FEATURE_MUS_PUSH_RES_COUNT:
|
||||
case FEATURE_NARRATIVE_SNIPPET_TYPE:
|
||||
case FEATURE_NEWS_GAMES_IN_DISCOVER:
|
||||
case FEATURE_NEWS_HEADER_SCROLL:
|
||||
@@ -145,8 +143,6 @@ public class TogglesHook{
|
||||
return postsredesign();
|
||||
case FEATURE_IMAGE_QUALITY_UPGRADE:
|
||||
return !getBoolValue("compressPhotos", true);
|
||||
case FEATURE_MUSIC_STOP_PLAYER_ON_TASK_REMOVAL:
|
||||
return getBoolValue("musictask", false);
|
||||
case FEATURE_MENU_GAMES_CAROUSEL:
|
||||
return miniapps();
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
package ru.vtosters.lite.music;
|
||||
|
||||
import android.app.DownloadManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||
import ru.vtosters.lite.utils.Globals;
|
||||
|
||||
public class MP3Downloader {
|
||||
|
||||
private static final String URL_FORMAT = "https://api.vk.com/method/audio.getById?v=5.131&access_token=%s&audios=%s©right=https://vtosters.app/";
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
|
||||
public MP3Downloader() {
|
||||
}
|
||||
|
||||
public void execute(MusicTrack track) {
|
||||
var token = Globals.getPreferences().getString("vk_admin_token", "");
|
||||
if (token.isEmpty()) {
|
||||
Toast.makeText(Globals.getContext(), "Обновите токен VK Admin в настройках", Toast.LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
var request = new Request.a()
|
||||
.b(String.format(URL_FORMAT, token, track.y1()))
|
||||
.a();
|
||||
client.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d("MP3Downloader", e+"");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response) throws IOException {
|
||||
var payload = response.a().g();
|
||||
Log.d("MP3Downloader", payload);
|
||||
try {
|
||||
JSONObject jsonObj = new JSONObject(payload);
|
||||
if (jsonObj.has("response")) {
|
||||
JSONObject responseNode = new JSONObject(payload).getJSONArray("response")
|
||||
.getJSONObject(0);
|
||||
if (responseNode.has("url")) {
|
||||
var url = responseNode.optString("url");
|
||||
Log.d("MP3Downloader", url);
|
||||
if (url != null) {
|
||||
if (url.endsWith(".mp3")) {
|
||||
downloadMP3(track.toString(), url);
|
||||
} else if (VKM3UParser.isM3U8(url)) {
|
||||
AudioDownloader.downloadM3U8(track);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
Log.d("MP3Downloader", e+"");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void downloadMP3(String title, String url) {
|
||||
var downloadManager = Globals.getContext().getSystemService(DownloadManager.class);
|
||||
var request = new DownloadManager.Request(Uri.parse(url))
|
||||
.setAllowedOverRoaming(true)
|
||||
.setTitle("Downloading " + title)
|
||||
.setDestinationInExternalFilesDir(Globals.getContext(),
|
||||
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath(),
|
||||
title + ".mp3")
|
||||
.setVisibleInDownloadsUi(true);
|
||||
downloadManager.enqueue(request);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class VKM3UParser{
|
||||
} else if (line.startsWith("#EXTINF")) {
|
||||
if (mTransportStreams.size() == i)
|
||||
mTransportStreams.add(new TransportStream());
|
||||
} else if (line.endsWith(".ts") || line.endsWith(".tp") || line.endsWith(".mpeg-ts") || line.endsWith(".m2ts")) {
|
||||
} else if (isM3U8(line)) {
|
||||
mTransportStreams.get(i).setName(line);
|
||||
++i;
|
||||
}
|
||||
@@ -51,6 +51,10 @@ public class VKM3UParser{
|
||||
return directive.substring(directive.indexOf(":") + 1);
|
||||
}
|
||||
|
||||
public static boolean isM3U8(String str) {
|
||||
return str.endsWith(".ts") || str.endsWith(".tp") || str.endsWith(".mpeg-ts") || str.endsWith(".m2ts");
|
||||
}
|
||||
|
||||
public int getHeapSize(){
|
||||
return mHeapSize;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package ru.vtosters.lite.ui.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.webkit.WebResourceRequest;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import java.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import ru.vtosters.lite.utils.LayoutHelper;
|
||||
|
||||
public class VKAdminTokenActivity extends AppCompatActivity {
|
||||
|
||||
private static final String URL = "https://oauth.vk.com/authorize?client_id=6121396&scope=1073737727&redirect_uri=https://oauth.vk.com/blank.html&display=page&response_type=token&revoke=1";
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
|
||||
var container = new FrameLayout(this);
|
||||
container.setLayoutParams(LayoutHelper.createFrame(-1, -1));
|
||||
setContentView(container);
|
||||
|
||||
var webView = new WebView(this);
|
||||
container.addView(webView, LayoutHelper.createFrame(-1, -1));
|
||||
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||
var url = request.getUrl().toString();
|
||||
if (url.startsWith("https://oauth.vk.com/auth_redirect?")) {
|
||||
var redirectUri = Uri.parse(URLDecoder.decode(url));
|
||||
var authorizeUrl = redirectUri.getQueryParameter("authorize_url");
|
||||
var accessToken = authorizeUrl.substring(authorizeUrl.indexOf("=") + 1, authorizeUrl.indexOf("&"));
|
||||
|
||||
var data = new Intent();
|
||||
data.putExtra("token", accessToken);
|
||||
setResult(Activity.RESULT_OK, data);
|
||||
finish();
|
||||
|
||||
return false;
|
||||
}
|
||||
return super.shouldOverrideUrlLoading(view, request);
|
||||
}
|
||||
});
|
||||
|
||||
Map<String, String> headers = new HashMap<>();
|
||||
headers.put("User-Agent", System.getProperty("http.agent"));
|
||||
|
||||
webView.loadUrl(URL, headers);
|
||||
}
|
||||
}
|
||||
@@ -149,15 +149,10 @@ public class CategorizedAdapter extends RecyclerView.Adapter<CategorizedAdapter.
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull CategorizedViewHolder viewHolder, int i) {
|
||||
try {
|
||||
Log.d("TAG", i + "");
|
||||
if (getItemViewType(i) == MOVING_ITEM)
|
||||
mBinder.bind(viewHolder, i);
|
||||
else
|
||||
viewHolder.bindCategory(i == 0);
|
||||
} catch (Exception e) {
|
||||
Log.d("TAG", e + "");
|
||||
}
|
||||
if (getItemViewType(i) == MOVING_ITEM)
|
||||
mBinder.bind(viewHolder, i);
|
||||
else
|
||||
viewHolder.bindCategory(i == 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -171,13 +166,11 @@ public class CategorizedAdapter extends RecyclerView.Adapter<CategorizedAdapter.
|
||||
Object curr;
|
||||
if (getTabType(index) == SELECTED_STATE) {
|
||||
curr = mSelectedItems.get(index - 1);
|
||||
if (!mUnmovedItems.contains(curr)) return;
|
||||
mSelectedItems.remove(curr);
|
||||
mDisabledItems.add(0, curr);
|
||||
notifyItemMoved(index, mSelectedItems.size() + 1);
|
||||
} else {
|
||||
curr = mDisabledItems.get(index - mSelectedItems.size() - 2);
|
||||
if (!mUnmovedItems.contains(curr)) return;
|
||||
mDisabledItems.remove(curr);
|
||||
mSelectedItems.add(0, curr);
|
||||
notifyItemRemoved(index);
|
||||
@@ -197,8 +190,6 @@ public class CategorizedAdapter extends RecyclerView.Adapter<CategorizedAdapter.
|
||||
if (getTabType(toPosition) == DISABLED_STATE && min)
|
||||
return false;
|
||||
curr = mSelectedItems.get(fromPosition - 1);
|
||||
if (mUnmovedItems.contains(curr))
|
||||
return false;
|
||||
if (getItemViewType(toPosition) == CATEGORY_TITLE) {
|
||||
if (min)
|
||||
return false;
|
||||
@@ -212,8 +203,6 @@ public class CategorizedAdapter extends RecyclerView.Adapter<CategorizedAdapter.
|
||||
if (getTabType(toPosition) == SELECTED_STATE && max)
|
||||
return false;
|
||||
curr = mDisabledItems.get(fromPosition - mSelectedItems.size() - 2);
|
||||
if (mUnmovedItems.contains(curr))
|
||||
return false;
|
||||
if (getItemViewType(toPosition) == CATEGORY_TITLE) {
|
||||
if (max)
|
||||
return false;
|
||||
|
||||
@@ -6,6 +6,7 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.milkshake;
|
||||
import static ru.vtosters.lite.utils.Preferences.superapp;
|
||||
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
|
||||
import static ru.vtosters.lite.utils.Preferences.videoewcatalog;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme_notifs;
|
||||
|
||||
@@ -32,6 +33,7 @@ import com.vtosters.lite.fragments.money.MoneyTransfersFragment;
|
||||
import com.vtosters.lite.fragments.p2.DocumentsViewFragment;
|
||||
import com.vtosters.lite.fragments.s2.GroupsFragment1;
|
||||
import com.vtosters.lite.fragments.t2.c.DialogsFragment;
|
||||
import com.vtosters.lite.fragments.y2.VideoCatalogFragment;
|
||||
import com.vtosters.lite.fragments.y2.VideosFragment;
|
||||
import com.vtosters.lite.general.fragments.GamesFragment;
|
||||
import com.vtosters.lite.general.fragments.PhotosFragment;
|
||||
@@ -95,7 +97,7 @@ public class DockBarEditorManager {
|
||||
private void parseSelectedTabs(String[] selectedTabsTags) {
|
||||
List<String> allTags = new ArrayList<>(Arrays.asList( "tab_news", "tab_superapps", "tab_messages", "tab_feedback", "tab_profile",
|
||||
"tab_friends", "tab_groups", "tab_photos", "tab_audios", "tab_videos", "tab_lives", "tab_games", "tab_liked",
|
||||
"tab_fave", "tab_documents", "tab_payments", "tab_vk_apps", "tab_settings", "tab_menu", "tab_brtd" ));
|
||||
"tab_fave", "tab_documents", "tab_payments", "tab_vk_apps", "tab_settings", "tab_menu"));
|
||||
for (String tag : selectedTabsTags) {
|
||||
mSelectedTabs.add(getTabByTag(tag));
|
||||
allTags.remove(tag);
|
||||
@@ -137,7 +139,7 @@ public class DockBarEditorManager {
|
||||
case "tab_superapps":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_superapps",
|
||||
milkshake() ? R.drawable.ic_explore_outline_28 : R.drawable.ic_menu_search_outline_28,
|
||||
milkshake() ? R.drawable.ic_services_outline_28 : R.drawable.ic_menu_search_outline_28,
|
||||
milkshake() ? R.string.super_app_title : R.string.search,
|
||||
R.id.tab_discover,
|
||||
milkshake() ? (superapp() ? SuperAppFragment.class : SearchMenuFragment.class) : ThemedFeedFragment.class);
|
||||
@@ -152,7 +154,7 @@ public class DockBarEditorManager {
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_feedback",
|
||||
!milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
||||
!milkshake() ? R.string.friends : R.string.notification,
|
||||
!milkshake() ? R.string.friends : R.string.not_notifications,
|
||||
R.id.tab_feedback,
|
||||
!milkshake() ? FriendsFragment.class : NotificationsContainerFragment.class);
|
||||
case "tab_profile":
|
||||
@@ -166,7 +168,7 @@ public class DockBarEditorManager {
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_friends",
|
||||
milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
||||
milkshake() ? R.string.friends : R.string.notification,
|
||||
milkshake() ? R.string.friends : R.string.not_notifications,
|
||||
R.id.menu_friends,
|
||||
milkshake() ? FriendsCatalogFragment.class : NotificationsContainerFragment.class);
|
||||
case "tab_groups":
|
||||
@@ -196,7 +198,7 @@ public class DockBarEditorManager {
|
||||
R.drawable.ic_video_outline_28,
|
||||
R.string.videos,
|
||||
R.id.menu_videos,
|
||||
VideosFragment.class);
|
||||
videoewcatalog() ? VideoCatalogFragment.class : VideosFragment.class);
|
||||
case "tab_lives":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_lives",
|
||||
@@ -236,7 +238,7 @@ public class DockBarEditorManager {
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_payments",
|
||||
R.drawable.ic_money_transfer_outline_28,
|
||||
R.string.money_transfer_money_transfers,
|
||||
R.string.money_transfer_money,
|
||||
R.id.menu_payments,
|
||||
MoneyTransfersFragment.class);
|
||||
case "tab_vk_apps":
|
||||
@@ -246,13 +248,6 @@ public class DockBarEditorManager {
|
||||
R.string.menu_apps,
|
||||
R.id.menu_vk_apps,
|
||||
AppsFragment.class);
|
||||
case "tab_settings":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_settings",
|
||||
R.drawable.ic_settings_outline_28,
|
||||
R.string.menu_settings,
|
||||
R.id.menu_settings,
|
||||
useNewSettings());
|
||||
case "tab_menu":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_menu",
|
||||
@@ -260,15 +255,14 @@ public class DockBarEditorManager {
|
||||
milkshake() ? R.string.profile : R.string.menu,
|
||||
R.id.tab_menu,
|
||||
milkshake() ? ProfileFragment.class : MenuFragment.class);
|
||||
case "tab_brtd":
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_brtd",
|
||||
R.drawable.ic_menu_birthdays,
|
||||
R.string.birthdays_title,
|
||||
R.id.menu_birthdays,
|
||||
BirthdaysFragment.class);
|
||||
case "tab_settings":
|
||||
default:
|
||||
return null;
|
||||
return DockBarTab.valuesOf(
|
||||
"tab_settings",
|
||||
R.drawable.ic_settings_outline_28,
|
||||
R.string.menu_settings,
|
||||
R.id.menu_settings,
|
||||
useNewSettings());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,10 +27,10 @@ public class ItemMovingCallback extends ItemTouchHelper.Callback {
|
||||
@Override
|
||||
public int getMovementFlags(@NonNull RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder){
|
||||
int dragFlags = mAdapter.getItemViewType(viewHolder.getAdapterPosition()) == CategorizedAdapter.MOVING_ITEM
|
||||
&& !mAdapter.isUnmovedItem(viewHolder.getAdapterPosition())
|
||||
? ItemTouchHelper.UP | ItemTouchHelper.DOWN
|
||||
: 0;
|
||||
int swipeFlags = mAdapter.getItemViewType(viewHolder.getAdapterPosition()) == CategorizedAdapter.MOVING_ITEM
|
||||
&& mAdapter.isUnmovedItem(viewHolder.getAdapterPosition())
|
||||
? ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT
|
||||
: 0;
|
||||
return makeMovementFlags(dragFlags, swipeFlags);
|
||||
|
||||
@@ -14,6 +14,8 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.utils.OEMDetector;
|
||||
|
||||
public class DisableBattery{
|
||||
@@ -21,27 +23,21 @@ public class DisableBattery{
|
||||
if (OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && getBoolValue("showDoze", true)) {
|
||||
final Context context = getContext();
|
||||
if (!((PowerManager) context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("batteryissuetitle"));
|
||||
builder.setMessage(getString("batteryissuesumm"));
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(getString("batteryissuebtn1"), new DialogInterface.OnClickListener(){
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
Intent intent = new Intent("android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("package:");
|
||||
sb.append(context.getPackageName());
|
||||
intent.setData(Uri.parse(sb.toString()));
|
||||
context.startActivity(intent);
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(getString("batteryissuebtn2"), new DialogInterface.OnClickListener(){
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showDoze", false).apply();
|
||||
}
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setPositiveButton(getString("batteryissuebtn1"), (dialogInterface, i) -> {
|
||||
Intent intent = new Intent("android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("package:");
|
||||
sb.append(context.getPackageName());
|
||||
intent.setData(Uri.parse(sb.toString()));
|
||||
context.startActivity(intent);
|
||||
});
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setNeutralButton(getString("batteryissuebtn2"), (dialogInterface, i) -> edit().putBoolean("showDoze", false).apply());
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||
@@ -19,27 +20,17 @@ import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||
public class InstallGMS{
|
||||
public static void alert(final Activity activity){
|
||||
if (!isGmsInstalled()) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setMessage(getString("gmsissuesumm"));
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(getString("gmsissuebtn1"), new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(getString("gmsissuebtn2"), new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
Context context = getContext();
|
||||
Intent a2 = new Navigator(InstallGMSFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
}
|
||||
builder.setPositiveButton(getString("gmsissuebtn1"), (dialogInterface, i) -> edit().putBoolean("showAlertGms", false).apply());
|
||||
builder.setNeutralButton(getString("gmsissuebtn2"), (dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
Context context = getContext();
|
||||
Intent a2 = new Navigator(InstallGMSFragment.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
});
|
||||
if (getBoolValue("showAlertGms", true)) {
|
||||
builder.show();
|
||||
|
||||
@@ -11,6 +11,8 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import ru.vtosters.lite.utils.OEMDetector;
|
||||
|
||||
public class Start{
|
||||
@@ -18,24 +20,16 @@ public class Start{
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
activity.requestPermissions(new String[] {"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setMessage(getWelcome());
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton(getString("startbtn2"), new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton(getString("startbtn1"), new DialogInterface.OnClickListener(){
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i){
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
activity.startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/vtosters")));
|
||||
}
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setPositiveButton(getString("startbtn2"), (dialogInterface, i) -> edit().putBoolean("showAlert", false).apply());
|
||||
// android.content.DialogInterface.OnClickListener
|
||||
builder.setNeutralButton(getString("startbtn1"), (dialogInterface, i) -> {
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
activity.startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/vtosters")));
|
||||
});
|
||||
if (getBoolValue("showAlert", true)) {
|
||||
builder.show();
|
||||
|
||||
@@ -8,13 +8,14 @@ import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import ru.vtosters.lite.utils.VKUIwrapper;
|
||||
|
||||
public class VKIDProtection{
|
||||
public static void alert(final Activity activity){
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(getString("debug_warning"));
|
||||
builder.setMessage(getString("vkidsumm"));
|
||||
builder.setCancelable(false);
|
||||
|
||||
@@ -12,20 +12,27 @@ import static ru.vtosters.lite.utils.SettBackup.backupSettings;
|
||||
import static ru.vtosters.lite.utils.SettBackup.deletePrefs;
|
||||
import static ru.vtosters.lite.utils.SettBackup.restoreBackup;
|
||||
import static ru.vtosters.lite.utils.Themes.getAlertStyle;
|
||||
import static ru.vtosters.lite.utils.Themes.getTextAttr;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.vk.auth.api.VKAccount;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.im.ui.providers.audiomsg.ImAudioMsgPlayerProvider;
|
||||
import com.vk.im.ui.providers.audiomsg.PlayerActionSources;
|
||||
@@ -38,19 +45,36 @@ import com.vtosters.lite.im.ImEngineProvider;
|
||||
import java.io.IOException;
|
||||
|
||||
import b.h.g.m.FileUtils;
|
||||
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
||||
import ru.vtosters.lite.utils.Globals;
|
||||
import ru.vtosters.lite.utils.SettBackup;
|
||||
|
||||
public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
||||
public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
private static final int VK_ADMIN_TOKEN_REQUEST_CODE = 1;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle){
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(getIdentifier("preferences_other", "xml"));
|
||||
prefs();
|
||||
}
|
||||
|
||||
private void prefs(){
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (requestCode == VK_ADMIN_TOKEN_REQUEST_CODE) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
String token = data.getStringExtra("token");
|
||||
Globals.getPreferences().edit().putString("vk_admin_token", token).apply();
|
||||
Log.d("VkAdminToken", token);
|
||||
Toast.makeText(getContext(), "Токен успешно сохранён", LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void prefs() {
|
||||
findPreference("firebasefix").setOnPreferenceClickListener(new a());
|
||||
findPreference("applicationstop").setOnPreferenceClickListener(new b());
|
||||
findPreference("tokencopy").setOnPreferenceClickListener(new c());
|
||||
@@ -62,19 +86,30 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
||||
|
||||
findPreference("saveprefs").setOnPreferenceClickListener(new saveprefs());
|
||||
findPreference("restoreprefs").setOnPreferenceClickListener(new restoreprefs());
|
||||
|
||||
var vkAdminTokenPref = findPreference("vk_admin_token");
|
||||
vkAdminTokenPref.setVisible(Globals.getDefprefs().getBoolean("new_music_downloading_way", false));
|
||||
if (vkAdminTokenPref.isVisible()) {
|
||||
vkAdminTokenPref.setOnPreferenceClickListener(preference -> {
|
||||
|
||||
startActivityForResult(new Intent(getContext(), VKAdminTokenActivity.class), VK_ADMIN_TOKEN_REQUEST_CODE);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static class d implements Preference.OnPreferenceClickListener{
|
||||
public static class d implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
restartApplication();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class onlines implements Preference.OnPreferenceClickListener{
|
||||
public class onlines implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
try {
|
||||
backupOnlines();
|
||||
} catch (IOException e) {
|
||||
@@ -84,40 +119,40 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
||||
}
|
||||
}
|
||||
|
||||
public static class b implements Preference.OnPreferenceClickListener{
|
||||
public static class b implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
System.exit(0);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static class deleteprefs implements Preference.OnPreferenceClickListener{
|
||||
public static class deleteprefs implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
deletePrefs();
|
||||
restartApplication();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class c implements Preference.OnPreferenceClickListener{
|
||||
public void copy(Context context, String str){
|
||||
class c implements Preference.OnPreferenceClickListener {
|
||||
public void copy(Context context, String str) {
|
||||
((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", str));
|
||||
makeText(context, Globals.getString("copybtn"), LENGTH_SHORT).show();
|
||||
ToastUtils.a(Globals.getString("tokenwarning"));
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
copy(getContext(), getUserToken());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class e implements Preference.OnPreferenceClickListener{
|
||||
public class e implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||
prefs2.edit().clear().commit();
|
||||
new WebView(getActivity()).clearCache(true);
|
||||
@@ -132,9 +167,9 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
||||
}
|
||||
}
|
||||
|
||||
public class a implements Preference.OnPreferenceClickListener{
|
||||
public class a implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
VKAccount b = VKAccountManager.d();
|
||||
PushSubscriber.e.a();
|
||||
ToastUtils.a(Globals.getString("fcmtokenrem"));
|
||||
@@ -148,9 +183,9 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
||||
}
|
||||
}
|
||||
|
||||
public class f implements Preference.OnPreferenceClickListener{
|
||||
public class f implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||
prefs2.edit().clear().commit();
|
||||
deleteCache();
|
||||
@@ -159,23 +194,23 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
||||
}
|
||||
}
|
||||
|
||||
public class saveprefs implements Preference.OnPreferenceClickListener{
|
||||
saveprefs(){
|
||||
public class saveprefs implements Preference.OnPreferenceClickListener {
|
||||
saveprefs() {
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
backupSettings();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class restoreprefs implements Preference.OnPreferenceClickListener{
|
||||
public class restoreprefs implements Preference.OnPreferenceClickListener {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean onPreferenceClick(Preference preference){
|
||||
public boolean onPreferenceClick(Preference preference) {
|
||||
var arr = SettBackup.getBackupsNames();
|
||||
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr);
|
||||
new AlertDialog.Builder(getContext(), getAlertStyle())
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle("Выберите бэкап")
|
||||
.setAdapter(adapter, (dialog, which) -> {
|
||||
try {
|
||||
|
||||
@@ -33,11 +33,11 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment{
|
||||
findPreference("darktheme").setOnPreferenceChangeListener(new restartdark());
|
||||
findPreference("lighttheme").setOnPreferenceChangeListener(new restartlight());
|
||||
findPreference("iconmanager").setOnPreferenceClickListener(new openicons());
|
||||
// findPreference("dockbar_tab_titles").setOnPreferenceChangeListener((preference, o) -> {
|
||||
// getPreferences().edit().putBoolean("dockbar_tab_titles", (boolean) o).commit();
|
||||
// restartApplication();
|
||||
// return false;
|
||||
// });
|
||||
findPreference("dockbar_tab_titles").setOnPreferenceChangeListener((preference, o) -> {
|
||||
getPreferences().edit().putBoolean("dockbar_tab_titles", (boolean) o).commit();
|
||||
restartApplication();
|
||||
return false;
|
||||
});
|
||||
findPreference("dockbar_accent").setOnPreferenceClickListener(new restart());
|
||||
findPreference("dockcounter").setOnPreferenceClickListener(new restart());
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserPhoto;
|
||||
import static ru.vtosters.lite.utils.Globals.getUsername;
|
||||
import static ru.vtosters.lite.utils.Globals.isGmsInstalled;
|
||||
import static ru.vtosters.lite.utils.Globals.isVKTester;
|
||||
import static ru.vtosters.lite.utils.Globals.restartApplication;
|
||||
import static ru.vtosters.lite.utils.Preferences.DoNotUseOldIcons;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
@@ -148,7 +149,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
|
||||
int vtosterXml = getIdentifier("empty", "xml");
|
||||
this.addPreferencesFromResource(vtosterXml);
|
||||
|
||||
addPreferenceDrawable(this, "", "Аккаунты", getUsername() + (hasVerification() ? Globals.getString("thanksfordonate") : Globals.getString("getdonate")), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
|
||||
addPreferenceDrawable(this, "", getUsername(), hasVerification() ? Globals.getString("thanksfordonate") : Globals.getString("getdonate"), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
|
||||
logout();
|
||||
restartApplication();
|
||||
return false;
|
||||
@@ -233,14 +234,16 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
|
||||
return false;
|
||||
});
|
||||
|
||||
addPreference(this, "", Globals.getString("bugs"), "", !DoNotUseOldIcons() ? "ic_bug_24" : "ic_bug_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
VKUIwrapper.officalLinks("bugs");
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
return false;
|
||||
});
|
||||
if (isVKTester()) {
|
||||
addPreference(this, "", Globals.getString("bugs"), "", !DoNotUseOldIcons() ? "ic_bug_24" : "ic_bug_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
VKUIwrapper.officalLinks("bugs");
|
||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(a2);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
addPreference(this, "", Globals.getString("vtssfs"), ssfs, !DoNotUseOldIcons() ? "ic_link_24" : "ic_link_circle_outline_28", preference -> {
|
||||
Context context = getContext();
|
||||
|
||||
@@ -176,7 +176,7 @@ public class StickersFragment extends BaseToolbarFragment{
|
||||
margin.setMargins(convertDpToPixel(24f), 0, convertDpToPixel(24f), 0);
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
var dlg = new AlertDialog.Builder(getContext(), getAlertStyle());
|
||||
var dlg = new AlertDialog.Builder(getContext());
|
||||
dlg.setTitle(Globals.getString("stickershelp1"));
|
||||
dlg.setMessage(Globals.getString("stickershelp2"));
|
||||
dlg.setView(linearLayout);
|
||||
@@ -186,6 +186,7 @@ public class StickersFragment extends BaseToolbarFragment{
|
||||
mService.requestPackDownload(pack, new File(getContext().getFilesDir(), new File("VT-Stickers", pack).getAbsolutePath()));
|
||||
});
|
||||
dlg.setNeutralButton(android.R.string.cancel, null);
|
||||
|
||||
var alert = dlg.create();
|
||||
|
||||
alert.show();
|
||||
|
||||
@@ -41,7 +41,6 @@ import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.vk.dto.user.UserProfile;
|
||||
@@ -53,6 +52,9 @@ import com.vtosters.lite.api.ExtendedUserProfile;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
@@ -66,6 +68,11 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.ui.dialogs.DisableBattery;
|
||||
import ru.vtosters.lite.ui.dialogs.InstallGMS;
|
||||
@@ -77,6 +84,10 @@ public class Globals{
|
||||
|
||||
private static final List<Activity> activities = new ArrayList<>();
|
||||
|
||||
private static final OkHttpClient mClient = new OkHttpClient();
|
||||
|
||||
public static Bitmap bmp = null;
|
||||
|
||||
public static SharedPreferences getDefprefs(){
|
||||
if (preferences == null)
|
||||
preferences = PreferenceManager.getDefaultSharedPreferences(getContext());
|
||||
@@ -96,6 +107,7 @@ public class Globals{
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
NotificationChannels.createChannels();
|
||||
}
|
||||
|
||||
// VKIDProtection.alert(activity);
|
||||
}
|
||||
|
||||
@@ -131,6 +143,10 @@ public class Globals{
|
||||
return VKAccountManager.d().D0();
|
||||
} // Current UserId
|
||||
|
||||
public static boolean isVKTester(){
|
||||
return VKAccountManager.d().i();
|
||||
} // is vk tester
|
||||
|
||||
public static String getUserSecret(){
|
||||
return VKAccountManager.d().l0();
|
||||
}
|
||||
@@ -216,13 +232,28 @@ public class Globals{
|
||||
}
|
||||
|
||||
try {
|
||||
URL aryURI = new URL(url);
|
||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
StrictMode.setThreadPolicy(policy); // fix get pic
|
||||
|
||||
URLConnection conn = aryURI.openConnection();
|
||||
InputStream is = conn.getInputStream();
|
||||
Bitmap bmp = BitmapFactory.decodeStream(is);
|
||||
var request = new Request.a()
|
||||
.b(url)
|
||||
.a();
|
||||
mClient.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.e("Error", e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response){
|
||||
bmp = BitmapFactory.decodeStream(response.a().a());
|
||||
}
|
||||
});
|
||||
|
||||
if (bmp == null) {
|
||||
if (def == null) return null;
|
||||
return getDrawable(getContext(), getIdentifier(def, "drawable"));
|
||||
}
|
||||
|
||||
bmp = rounded ? getBitmapClippedCircle(bmp) : bmp; // rounding
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@ package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Globals.getContext;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||
import static ru.vtosters.lite.utils.Preferences.adsgroup;
|
||||
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
|
||||
import static ru.vtosters.lite.utils.Preferences.captions;
|
||||
import static ru.vtosters.lite.utils.Preferences.copyright_post;
|
||||
import static ru.vtosters.lite.utils.Preferences.dev;
|
||||
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
|
||||
@@ -15,21 +17,21 @@ import android.util.Log;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class Newsfeed{
|
||||
import ru.vtosters.lite.hooks.JsonInjectors;
|
||||
|
||||
public class Newsfeed {
|
||||
public static List<String> mFilters;
|
||||
public static List<String> mFiltersLinks;
|
||||
|
||||
public static void setupFilters(){
|
||||
mFilters = new ArrayList();
|
||||
mFiltersLinks = new ArrayList();
|
||||
public static void setupFilters() {
|
||||
mFilters = new ArrayList<>();
|
||||
mFiltersLinks = new ArrayList<>();
|
||||
|
||||
getFilter("refsfilter", "Referals.txt", mFilters);
|
||||
getFilter("shortlinkfilter", "LinkShorter.txt", mFilters);
|
||||
@@ -37,29 +39,25 @@ public class Newsfeed{
|
||||
getFilter("shitposting", "IDontWantToReadIt.txt", mFilters);
|
||||
getFilter("cringecopyright", "CopyrightAds.txt", mFiltersLinks);
|
||||
|
||||
var customfilters = getPrefsValue("spamfilters");
|
||||
if (!customfilters.isEmpty()) {
|
||||
mFilters.addAll(Arrays.asList(customfilters.split(", ")));
|
||||
var customFilters = getPrefsValue("spamfilters");
|
||||
if (!customFilters.isEmpty()) {
|
||||
mFilters.addAll(Arrays.asList(customFilters.split(", ")));
|
||||
}
|
||||
|
||||
var linkfilter = getPrefsValue("linkfilter");
|
||||
if (!linkfilter.isEmpty()) {
|
||||
mFiltersLinks.addAll(Arrays.asList(linkfilter.split(", ")));
|
||||
var linkFilter = getPrefsValue("linkfilter");
|
||||
if (!linkFilter.isEmpty()) {
|
||||
mFiltersLinks.addAll(Arrays.asList(linkFilter.split(", ")));
|
||||
}
|
||||
}
|
||||
|
||||
public static void getFilter(String boolname, String filename, List<String> list){
|
||||
public static void getFilter(String boolname, String filename, List<String> list) {
|
||||
if (getBoolValue(boolname, true)) {
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(getContext().getAssets().open(filename)));
|
||||
while(true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine != null) {
|
||||
list.add(readLine);
|
||||
} else {
|
||||
bufferedReader.close();
|
||||
return;
|
||||
}
|
||||
var scanner = new Scanner(getContext().getAssets().open(filename));
|
||||
while (scanner.hasNextLine()) {
|
||||
var line = scanner.nextLine();
|
||||
if (!line.isEmpty())
|
||||
list.add(line.toLowerCase());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -67,106 +65,122 @@ public class Newsfeed{
|
||||
}
|
||||
} // Get needed filter list from assets
|
||||
|
||||
public static boolean injectFiltersReposts(JSONObject obj){
|
||||
if (obj.optJSONArray("copy_history") == null) return false;
|
||||
public static boolean injectFiltersReposts(JSONObject obj) throws JSONException {
|
||||
if (getBoolValue("cringerepost", false) && obj.has("copy_history")) {
|
||||
var copyHistoryNode = obj.optJSONArray("copy_history");
|
||||
for (int i = 0; i < copyHistoryNode.length(); i++) {
|
||||
var item = copyHistoryNode.optJSONObject(i);
|
||||
var text = item.optString("text");
|
||||
|
||||
var Array = Objects.requireNonNull(obj.optJSONArray("copy_history")).toString();
|
||||
|
||||
if (Array.isEmpty()) return false;
|
||||
|
||||
if (getBoolValue("cringerepost", false)) {
|
||||
for (String linkfilters : mFiltersLinks) {
|
||||
if (Array.toLowerCase().contains(linkfilters.toLowerCase())) {
|
||||
if (isBadNews(text)) {
|
||||
if (dev())
|
||||
Log.d("RepostFilter", "Fetched repost ad (isBadNews), owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
return true;
|
||||
} else if (JsonInjectors.isAds(item, item.optString("post_type"))) {
|
||||
if (dev())
|
||||
Log.d("RepostFilter", "Fetched repost ad (ads), owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isBadNew(Array);
|
||||
} // get repost information and inject our text filters
|
||||
|
||||
public static boolean checkCopyright(JSONObject json) throws JSONException{
|
||||
if (json.opt("copyright") != null) {
|
||||
var copyright = json.getJSONObject("copyright");
|
||||
var copyrightlink = copyright.getString("link");
|
||||
|
||||
for (String linkfilters : mFiltersLinks) {
|
||||
if (copyrightlink.toLowerCase().contains(linkfilters.toLowerCase())) {
|
||||
return true;
|
||||
for (String filter : mFiltersLinks) {
|
||||
if (text.contains(filter)) {
|
||||
if (dev())
|
||||
Log.d("RepostFilter", "Fetched repost ad, owner id " + item.optString("owner_id") + ", text: " + text);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return copyright_post();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isRecomsGroup(String src){
|
||||
return src.equals("recommended_groups") && authorsrecomm();
|
||||
public static boolean checkCopyright(JSONObject json) throws JSONException {
|
||||
if (json.has("copyright")) {
|
||||
if (copyright_post()) return true;
|
||||
|
||||
var copyright = json.optJSONObject("copyright");
|
||||
var copyrightLink = copyright.getString("link").toLowerCase();
|
||||
for (String filter : mFiltersLinks) {
|
||||
if (copyrightLink.contains(filter)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isMusicBlock(String src){
|
||||
return (src.equals("recommended_audios") || src.equals("recommended_artists") || src.equals("recommended_playlists")) && authorsrecomm();
|
||||
public static boolean isRecomsGroup(String src) {
|
||||
return authorsrecomm() && src.equals("recommended_groups");
|
||||
}
|
||||
|
||||
public static boolean isNewsBlock(String src){
|
||||
return (src.equals("tags_suggestions")) && Preferences.ads();
|
||||
public static boolean isMusicBlock(String src) {
|
||||
return authorsrecomm() && (src.equals("recommended_audios") || src.equals("recommended_artists") || src.equals("recommended_playlists"));
|
||||
}
|
||||
|
||||
public static String getAllFilters(){
|
||||
public static boolean isNewsBlock(String src) {
|
||||
return ads() && src.equals("tags_suggestions");
|
||||
}
|
||||
|
||||
public static String getAllFilters() {
|
||||
return getPrefsValue("spamfilters");
|
||||
}
|
||||
|
||||
public static boolean isBadNew(String text){
|
||||
public static boolean isBadNews(String text) {
|
||||
var textInLowerCase = text.toLowerCase();
|
||||
for (String filter : mFilters) {
|
||||
if (text.toLowerCase().contains(filter.toLowerCase())) {
|
||||
if (dev()) Log.d("VTLite", text.toLowerCase());
|
||||
if (textInLowerCase.contains(filter)) {
|
||||
if (dev())
|
||||
Log.d("VTLite", text);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkCaption(JSONObject postJson){
|
||||
try {
|
||||
var captionJson = postJson.getJSONObject("caption");
|
||||
if (Preferences.captions())
|
||||
return true;
|
||||
|
||||
boolean postAds = postsrecomm();
|
||||
return (captionJson.getString("type").equals("explorebait") && postAds) || // Может быть интересно
|
||||
(captionJson.getString("type").equals("shared") && postAds) || // Поделился записью
|
||||
(postJson.getString("type").equals("digest") && postAds) || // Рекомедации
|
||||
(captionJson.getString("type").equals("commented") && postAds) || // Комментирует
|
||||
(captionJson.getString("type").equals("voted") && postAds); // Проголосовал в опросе
|
||||
|
||||
} catch (JSONException e) {
|
||||
return false;
|
||||
public static boolean checkCaption(JSONObject postJson) {
|
||||
if (postJson.has("caption")) {
|
||||
if (captions()) return true;
|
||||
var caption = postJson.optJSONObject("caption");
|
||||
if (postsrecomm()) {
|
||||
try {
|
||||
var type = caption.getString("type");
|
||||
return type.equals("explorebait") || // Может быть интересно
|
||||
type.equals("shared") || // Поделился записью
|
||||
type.equals("digest") || // Рекомедации
|
||||
type.equals("commented") || // Комментирует
|
||||
type.equals("voted"); // Проголосовал в опросе
|
||||
} catch (JSONException e) {
|
||||
Log.d("checkCaption", "Caption error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isAds(String optString){
|
||||
return (optString.equals("ads_easy_promote") ||
|
||||
public static boolean isAds(String optString) {
|
||||
return ads() && (optString.equals("ads_easy_promote") ||
|
||||
optString.equals("promo_button") ||
|
||||
optString.equals("app_widget") ||
|
||||
optString.equals("ads")) && Preferences.ads();
|
||||
optString.equals("ads"));
|
||||
}
|
||||
|
||||
public static boolean isAuthorRecommendations(String optString){
|
||||
return optString.equals("authors_rec") && authorsrecomm();
|
||||
public static boolean isAuthorRecommendations(String optString) {
|
||||
return authorsrecomm() && optString.equals("authors_rec");
|
||||
}
|
||||
|
||||
public static boolean isPostRecommendations(String optString){
|
||||
return (optString.equals("live_recommended") ||
|
||||
optString.equals("inline_user_rec")) && postsrecomm();
|
||||
public static boolean isPostRecommendations(String optString) {
|
||||
return postsrecomm() && (optString.equals("live_recommended") ||
|
||||
optString.equals("inline_user_rec"));
|
||||
}
|
||||
|
||||
public static boolean isFriendsRecommendations(String optString){
|
||||
return (optString.equals("user_rec") ||
|
||||
public static boolean isFriendsRecommendations(String optString) {
|
||||
return friendsrecomm() && (optString.equals("user_rec") ||
|
||||
optString.equals("friends_recommendations") ||
|
||||
optString.equals("friends_recomm")) && friendsrecomm();
|
||||
optString.equals("friends_recomm"));
|
||||
}
|
||||
|
||||
public static boolean isGroupAds(JSONObject obj){
|
||||
return (obj.optInt("marked_as_ads", 0) == 1) && adsgroup();
|
||||
public static boolean isGroupAds(JSONObject obj) {
|
||||
return adsgroup() && obj.optInt("marked_as_ads", 0) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ public class Preferences{
|
||||
return getBoolValue("calls", false);
|
||||
}
|
||||
|
||||
public static boolean convUsersOnline(){
|
||||
return getBoolValue("convUsersOnline", false);
|
||||
public static boolean globalUsersOnline(){
|
||||
return getBoolValue("globalUsersOnline", false);
|
||||
}
|
||||
|
||||
public static boolean dev(){
|
||||
@@ -214,6 +214,10 @@ public class Preferences{
|
||||
return getBoolValue("musicnewcatalog", true);
|
||||
}
|
||||
|
||||
public static boolean videoewcatalog(){
|
||||
return getBoolValue("videoewcatalog", true);
|
||||
}
|
||||
|
||||
public static boolean postsredesign(){
|
||||
return getBoolValue("postsredesign", true);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -95,7 +97,7 @@ public class ServerDialog{
|
||||
|
||||
if (activity != null) {
|
||||
activity.runOnUiThread(() -> {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
VkAlertDialog.Builder builder = new VkAlertDialog.Builder(activity);
|
||||
builder.setTitle(title);
|
||||
builder.setMessage(message);
|
||||
builder.setCancelable(cancelable);
|
||||
|
||||
@@ -376,8 +376,8 @@ public class Themes{
|
||||
new int[]{-android.R.attr.state_checked}
|
||||
},
|
||||
new int[]{
|
||||
dockbar_accent() ? parseColor("#ff528bcc") : (isDarkTheme() ? parseColor("#ffefefef") : parseColor("#ff545454")),
|
||||
dockbar_accent() ? parseColor("#ffaaaeb3") : (isDarkTheme() ? parseColor("#ff8a8d92") : parseColor("#ffaaaeb3"))
|
||||
dockbar_accent() ? getAccentColor() : (isDarkTheme() ? getResources().getColor(R.color.white) : getResources().getColor(R.color.gray_700)),
|
||||
isDarkTheme() ? getResources().getColor(R.color.gray_500) : getResources().getColor(R.color.vk_steel_gray_300)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1463,10 +1463,6 @@
|
||||
</service>
|
||||
<service android:name="com.vk.voip.VoipService" />
|
||||
|
||||
<activity
|
||||
android:name="com.my.target.common.MyTargetActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode" />
|
||||
|
||||
<receiver android:name="com.vk.music.broadcast.MediaButtonEventReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MEDIA_BUTTON" />
|
||||
|
||||
@@ -9,4 +9,5 @@ bitmain
|
||||
cents-apps
|
||||
cent-app
|
||||
centapp
|
||||
/?a=
|
||||
/?a=
|
||||
minerx
|
||||
@@ -90,4 +90,6 @@ cкорее подписывайся
|
||||
Промокоды сливают сами сотрудники заведений
|
||||
Промокоды сливают сотрудники
|
||||
напиши Нашему боту
|
||||
пиши Нашему боту
|
||||
пиши Нашему боту
|
||||
Подписывайтесь👇
|
||||
Подписывайся👇
|
||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 534 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 588 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 959 B After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 680 B After Width: | Height: | Size: 659 B |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 4.9 KiB |
|
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 626 B After Width: | Height: | Size: 631 B |
|
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 25 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 388 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 979 B After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 274 B After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 405 B After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 617 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 428 B After Width: | Height: | Size: 386 B |
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 295 B After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 403 B After Width: | Height: | Size: 367 B |
|
Before Width: | Height: | Size: 455 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 777 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 735 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 38 KiB After Width: | Height: | Size: 41 KiB |
|
Before Width: | Height: | Size: 7.4 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 674 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 717 B After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 748 B After Width: | Height: | Size: 714 B |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 6.2 KiB |
|
Before Width: | Height: | Size: 477 B After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 762 B After Width: | Height: | Size: 740 B |
|
Before Width: | Height: | Size: 754 B After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 66 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 973 B After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 642 B After Width: | Height: | Size: 2.0 KiB |