Compare commits

...
119 Commits
Author SHA1 Message Date
gdlbo cd7f3f8b52 fixed video catalog + deleted useless feature 2022-07-25 21:59:55 +03:00
Erik Kiznov 4b57fa9414 Add VK Video new icon 2022-07-25 21:49:54 +03:00
Erik Kiznov 9d3099f816 Updated VK Music icon for all DPI 2022-07-25 21:49:54 +03:00
Erik Kiznov a0c02b2fd1 VK Rebranding (Part 2.1)
Founded and updated some VK logos (in notification, in app-icon)
2022-07-25 21:49:54 +03:00
Erik Kiznov df8c86fe4c New "Music" logo in dockbar 2022-07-25 21:49:54 +03:00
Erik Kiznov 008a24bfff VK Rebranding (Part 2)
* Updated VK Logo
* Updated VK Music logo
* Updated VK Pay logo
2022-07-25 21:49:54 +03:00
gdlbo 5484766ef1 dockbar improved 2022-07-25 21:19:18 +03:00
gdlbo b36a3bfbdb speedup settings 2022-07-25 21:19:18 +03:00
gdlbo 7fc842c9ef fixed open music catalog 2022-07-25 21:19:18 +03:00
gdlbo 8615faff4a fixed tgs dialog 2022-07-25 21:19:18 +03:00
gdlbo ba05c831cc deleted getAdvertisingId check + deleted vigo tracker 2022-07-25 21:19:18 +03:00
gdlbo 3f11a14d92 deleted my target lib (fully) 2022-07-25 21:19:18 +03:00
gdlbo 0284dec33a del ad audio lib 2022-07-25 21:19:18 +03:00
Erik Kiznov 8d376d9e5a VK Rebranding
This commit updates VK logo in all (maybe) pictures
2022-07-25 18:50:25 +03:00
gdlbo ce731b1832 dockbar fixes 2022-07-25 01:53:12 +03:00
gdlbo 64a8552647 some migration to VkAlertDialog 2022-07-25 01:45:32 +03:00
gdlbo e0b06449ec dockbar fixes 2022-07-24 22:32:35 +03:00
gdlbo 64d62b10a1 size text labels 2022-07-24 20:35:56 +03:00
gdlbo 1a3cf8695d bold text labels 2022-07-24 20:11:11 +03:00
gdlbo 1251dd1d2d dockbar colors fix 2022-07-24 19:43:26 +03:00
gdlbo 06d5b1a779 some profile inj fixes 2022-07-24 16:16:17 +03:00
gdlbo c18a3dde9e new profile buttons injector 2022-07-24 15:24:21 +03:00
Vologhat 6961bc073a added new way of music downloading 2022-07-24 02:17:20 +03:00
gdlbo e1b6f8d66f unlocked dockbar_tab_titles 2022-07-24 00:31:21 +03:00
gdlbo b95edec916 fixes
foaf time is now with local timezone
fixed music starting
2022-07-24 00:02:46 +03:00
gdlbo 8756cd1f20 foaf online 2022-07-23 21:36:37 +03:00
Vologhat 8122c92bbf Update JsonInjectors.java 2022-07-22 15:52:04 +03:00
gdlbo 3e53455a05 Update StandartFilter.txt 2022-07-22 15:06:28 +03:00
gdlbo 07ddb66264 fixed parseRepostItem fetch bug 2022-07-22 15:01:09 +03:00
gdlbo 4fef230a06 speedup adblock 2022-07-22 14:42:25 +03:00
gdlbo 2d73131863 speedup adblock + logs 2022-07-22 13:55:43 +03:00
Vologhat f90ae6bade optimized new newsfeed adblocker 2022-07-22 02:31:20 +03:00
Vologhat b4a45a17c7 optimized new newsfeed adblocker 2022-07-22 01:42:32 +03:00
gdlbo 8767540164 speedup stories adblock 2022-07-22 00:34:47 +03:00
gdlbo fb8e327856 some fixes 2022-07-22 00:29:56 +03:00
gdlbo 344b30aa62 new adblock (alpha) 2022-07-21 23:35:03 +03:00
gdlbo d776693aea unlocked custom newsfeed 2022-07-21 22:08:26 +03:00
gdlbo aaf2f9c6c9 fuck vk 2022-07-21 21:45:23 +03:00
gdlbo 5fbabfbe23 some ad fixes 2022-07-21 19:38:20 +03:00
Vologhat 42645a5414 fixes in stories adblocker 2022-07-21 16:56:05 +03:00
gdlbo 5af63e0adf some ad fixes 2022-07-21 16:34:55 +03:00
gdlbo ba430052de some ad fixes 2022-07-21 15:35:13 +03:00
gdlbo a81ebed663 new stories adblock 2022-07-21 15:30:21 +03:00
gdlbo 920883ada1 def catalog music 2022-07-21 14:16:22 +03:00
gdlbo 41c5f57ccc convBarRecomm 2022-07-21 12:50:46 +03:00
gdlbo 2aa7862fe1 whatsnew block hide 2022-07-21 12:24:09 +03:00
Vologhat 22795bab81 added feature of item state changing by swipe to dockbar and superapp editors 2022-07-21 12:00:46 +03:00
gdlbo 9ae1c0c1bb fix superapp 2022-07-20 23:12:28 +03:00
Vologhat c155e560ba fixed chat preview 2022-07-20 22:30:23 +03:00
gdlbo f92dd71d35 some settings sorting 2022-07-20 18:40:19 +03:00
gdlbo 474f9f0197 vkme warn 2022-07-20 18:21:35 +03:00
gdlbo aee76ba2ff google moment fix 2022-07-20 18:08:07 +03:00
Vologhat 398b6fc37b added state changing by swipe for unmoved items to adapter 2022-07-20 17:55:54 +03:00
gdlbo 454cea3556 dockbar_accent is true 2022-07-20 16:50:00 +03:00
gdlbo 90816b5c67 some dockbar fixes + accent 2022-07-20 16:42:28 +03:00
gdlbo 7c1ac4b267 hide beta feature (need to rework tbh) 2022-07-20 15:54:32 +03:00
gdlbo c145b64441 some dockbar and superapp editor fixes 2022-07-20 15:50:37 +03:00
Vologhat 2ad5ab7a87 added superapp editor, added titles in dockbar and some changes
-Added new SuperApp editor
-Added titles in dockbar and option for it in settings
-Refactored DockBarAdapter
2022-07-20 15:05:17 +03:00
gdlbo 95fd69c5da vkpay/games/miniapps hide feature 2022-07-20 12:24:58 +03:00
gdlbo 1a3f18cbc2 fixed vkx cringe logging 2022-07-19 21:46:38 +03:00
gdlbo f4031ead02 updated some wrappers 2022-07-19 21:39:27 +03:00
gdlbo 37b7783b40 updated some wrappers 2022-07-19 21:38:17 +03:00
gdlbo 8059743e0b added playlists 2022-07-19 20:58:30 +03:00
gdlbo 2c1beedf8b disabled stats 2022-07-19 19:02:55 +03:00
gdlbo 484510da77 music tricks kekw 2022-07-19 19:02:30 +03:00
gdlbo ddf046cd20 music tricks 2022-07-19 16:52:59 +03:00
gdlbo 1c5316ba4e Update LogWriterService.java 2022-07-19 16:52:59 +03:00
aliveoutside 5503caed79 fix #453 2022-07-19 17:21:35 +03:00
aliveoutside 1f11530d04 update .gitignore 2022-07-19 15:58:57 +03:00
gdlbo 95b5fca205 IconsFragment fixes 2022-07-18 22:42:52 +03:00
gdlbo 7432fe7aba icooooooooons! 2022-07-18 22:27:28 +03:00
gdlbo c4630042c7 some fixes 2022-07-18 21:44:03 +03:00
gdlbo 16f4178e36 fix superappitems counter 2022-07-18 21:25:44 +03:00
gdlbo 421d080ec7 icons 2022-07-18 15:31:25 +03:00
Vologhat 381a759c4b temporary hooks disabling 2022-07-18 14:26:27 +03:00
gdlbo 08bb1e1174 fix proxy? 2022-07-18 12:50:41 +03:00
gdlbo 7fec602f34 fixed vk me mode 2022-07-18 10:38:05 +03:00
gdlbo 1f9aca7399 added some new counters 2022-07-18 03:21:48 +03:00
gdlbo 6b5c5bedea fixed friends hide with birthday 2022-07-18 01:53:56 +03:00
Vologhat 0901af5106 fixed dockbar counters #449 2022-07-18 01:35:26 +03:00
Vologhat 5ef7b85e87 fixed scroll to top feature 2022-07-18 01:13:14 +03:00
gdlbo 7facf974e6 fixed ExternalLinkHandler 2022-07-17 23:31:43 +03:00
Vologhat eb21d3d11c fix external player crash in vkplayer 2022-07-17 22:31:29 +03:00
gdlbo 03e8d7873e updated some strings 2022-07-17 21:18:27 +03:00
Vologhat 11faab902f added some features to photo viewer #411
-Added image searching in the internet with feature of selecting search engine
-Added copying image file url to the clipboard
-Added opening image file url in the browsers
2022-07-17 21:15:23 +03:00
gdlbo 9c1b00ef23 some settings summ fixes 2022-07-17 16:59:36 +03:00
gdlbo f40d3a5aac counters 2022-07-17 15:21:19 +03:00
gdlbo 07aa13d9b0 fixed stickers dialog 2022-07-17 15:21:06 +03:00
gdlbo 0b267091ba fixed live tab + imports 2022-07-17 13:54:23 +03:00
gdlbo ead6860674 some dockbar fixes 2022-07-17 13:21:46 +03:00
gdlbo a87c34f1fd updated StandartFilter.txt 2022-07-17 11:37:18 +03:00
gdlbo 4e4813fd5c some dockbar fixes 2022-07-17 11:14:45 +03:00
gdlbo 58e728f26c added tgsbotkey check if not valid 2022-07-17 11:08:32 +03:00
gdlbo 35282945cc some dockbar fixes 2022-07-17 11:03:45 +03:00
gdlbo 18965af7d8 fixed saving settings 2022-07-17 10:56:04 +03:00
Vologhat a3987abf11 make shorter external player string in action menu 2022-07-17 08:42:17 +03:00
gdlbo 58ab5cf4cf some settings fixes 2022-07-17 00:18:22 +03:00
gdlbo 6f115d1766 some settings fixes 2022-07-16 23:42:10 +03:00
gdlbo 568a489993 dockbar fixes 2022-07-16 23:26:19 +03:00
gdlbo 2e50607a90 added disabler of OnlineFormatter 2022-07-16 23:02:38 +03:00
Vologhat 560321f4a3 fix #443 2022-07-16 18:07:54 +03:00
aliveoutside afc0173423 [musicdownloader] increase the audio quality 2022-07-16 20:01:25 +03:00
aliveoutside da5ac90189 [musicdownloader] fix previous commit 2022-07-16 19:43:16 +03:00
aliveoutside d8d435c994 [musicdownloader] show the download progress in notifications 2022-07-16 19:39:10 +03:00
Vologhat 0e225db32d dockbar editor fixes 2022-07-15 17:39:25 +03:00
gdlbo e06e5ac3a7 some hooks refactoring 2022-07-15 11:09:15 +03:00
aliveoutside a073314c28 fix vkx integration 2022-07-15 02:39:17 +03:00
gdlbo c643776790 Update CopyrightAds.txt 2022-07-14 23:00:00 +03:00
gdlbo a67f3cd11e fix getVoiceListened 2022-07-14 22:33:13 +03:00
gdlbo 04087259c3 fixed dialog style in tgs and PreferencesUtil 2022-07-14 22:12:23 +03:00
Vologhat 3f6177150d changed dockbar editor logic
- Changed data storage method
- Added json config check
- Some optimizations
2022-07-14 22:10:37 +03:00
gdlbo 3f339821f7 Update MsgMarkAsListenedJob.smali 2022-07-14 21:50:40 +03:00
gdlbo 9abef592fb getVoiceListened inj 2022-07-14 21:48:58 +03:00
gdlbo a561f05b32 Fixed vkx inj + some fixes 2022-07-14 21:15:29 +03:00
Vologhat a8c4f0d505 fix #416 2022-07-14 20:09:46 +03:00
Vologhat 93551d6b2d added base fragment with toolbar implementation 2022-07-14 20:09:20 +03:00
Vologhat 6ff176e5d4 added layout helper 2022-07-14 20:08:52 +03:00
gdlbo cdec126f54 miniapps hide feature 2022-07-14 19:27:53 +03:00
gdlbo 2885129531 hide friends recomm in friends 2022-07-14 18:27:10 +03:00
882 changed files with 5035 additions and 136995 deletions
+1 -1
View File
@@ -28,4 +28,4 @@ smali2/build/resources.zip
/smali/VTLite.apk.cache/
smali/build/resources.zip
smali/assets/version.properties
smali/assets/version.properties
*.keystore
@@ -5,15 +5,14 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import android.content.Context;
import android.os.RemoteException;
import android.util.Log;
import com.vk.dto.music.MusicTrack;
import com.vk.music.common.MusicPlaybackLaunchContext;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import b.h.g.g.PackageManagerHelper;
import bruhcollective.itaysonlab.libvkx.ILibVkxService;
public class LibVKXClient{
@@ -32,8 +31,13 @@ public class LibVKXClient{
}
public static boolean isVkxInstalled(){
return PackageManagerHelper.a(ClientConstants.PACKAGE, 128) != null;
}
try {
getContext().getPackageManager().getPackageInfo("ua.itaysonlab.vkx", 0);
return true;
} catch (Exception unused) {
return false;
}
} // VKX check
public static boolean isIntegrationEnabled(){
return getBoolValue("libvkx_integration", false) && isVkxInstalled();
@@ -44,30 +48,30 @@ public class LibVKXClient{
return false;
}
LibVKXClientImpl.LibVKXAction action = iLibVkxService -> LibVKXClient.lambdaplay(list, musicTrack, playerRefer, iLibVkxService);
LibVKXClientImpl.LibVKXAction action = iLibVkxService -> LibVKXClient.lambdaplay(list, musicTrack, iLibVkxService);
return getInstance().runOnService(action);
}
public static void lambdaplay(List list, MusicTrack musicTrack, MusicPlaybackLaunchContext playerRefer, ILibVkxService iLibVkxService){
public static void lambdaplay(List<MusicTrack> list, MusicTrack musicTrack, ILibVkxService iLibVkxService){
int indexOf = list.indexOf(musicTrack);
ArrayList arrayList = new ArrayList();
Iterator it = list.iterator();
while(it.hasNext()) {
arrayList.add(asId((MusicTrack) it.next()));
var ids = new ArrayList<String>();
for (var track : list) {
ids.add(asId(track));
}
if (indexOf == -1) {
indexOf = 0;
}
try {
iLibVkxService.play(arrayList, indexOf, "");
iLibVkxService.play(ids, indexOf, "");
} catch (RemoteException e) {
e.printStackTrace();
}
}
private static String asId(MusicTrack musicTrack){
String str = musicTrack.d + "_" + musicTrack.e;
String str = musicTrack.e + "_" + musicTrack.d;
if (musicTrack.O == null || musicTrack.O.equals("")) {
return str;
}
@@ -0,0 +1,339 @@
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;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.view.menu.MenuItemImpl;
import androidx.appcompat.view.menu.MenuView;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.view.ViewCompat;
import com.vk.core.ui.themes.Themable;
import com.vk.core.ui.themes.VKThemeHelper;
import com.vtosters.lite.R;
import me.grishka.appkit.utils.V;
import ru.vtosters.lite.utils.Globals;
import ru.vtosters.lite.utils.Themes;
public class BottomNavigationItemView extends FrameLayout implements MenuView.ItemView {
private final TextView mSmallLabel;
private final TextView mLargeLabel;
private final View mCounterContainer;
private final TextView mCounter;
private final View mDot;
private int mItemPos;
private MenuItemImpl mItemData;
private ColorStateList mColorStateList;
private final int mMargin;
private final float mSmallScale;
private boolean mShiftingModeEnabled;
private boolean mIconsModeEnabled;
private boolean mStaticModeEnabled;
private final ImageView mIcon;
private final ImageView mActionIcon;
public BottomNavigationItemView(@NonNull Context context) {
this(context, null);
}
public BottomNavigationItemView(@NonNull Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public BottomNavigationItemView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
this.mItemPos = -1;
this.mMargin = getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_margin);
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);
this.mIcon = this.findViewById(R.id.icon);
this.mIcon.getLayoutParams().width = V.a(28.0F);
this.mIcon.getLayoutParams().height = V.a(28.0F);
var colorStateList = getCSTDock();
this.mSmallLabel = this.findViewById(R.id.smallLabel);
mSmallLabel.setTextColor(colorStateList);
this.mLargeLabel = this.findViewById(R.id.largeLabel);
mLargeLabel.setTextColor(colorStateList);
LayoutInflater.from(this.getContext()).inflate(R.layout.navigation_bottom_counter, this, true);
this.mCounterContainer = this.findViewById(R.id.counter_container);
this.mCounter = this.findViewById(R.id.counter);
this.mDot = this.findViewById(R.id.dot);
LayoutInflater.from(this.getContext()).inflate(R.layout.navigation_bottom_action, this, true);
this.mActionIcon = this.findViewById(R.id.action_icon);
VKThemeHelper.a(this.mActionIcon, R.attr.tabbar_active_icon, PorterDuff.Mode.MULTIPLY);
}
public void a() {
this.mActionIcon.setVisibility(GONE);
}
public void b() {
this.mActionIcon.setVisibility(VISIBLE);
}
@SuppressLint("RestrictedApi")
public MenuItemImpl getItemData() {
return this.mItemData;
}
public int getItemPosition() {
return this.mItemPos;
}
@SuppressLint("RestrictedApi")
public void initialize(MenuItemImpl impl, int i) {
this.mItemData = impl;
this.setCheckable(impl.isCheckable());
this.setChecked(impl.isChecked());
this.setEnabled(impl.isEnabled());
this.setIcon(impl.getIcon());
this.setTitle(impl.getTitle());
this.setId(impl.getItemId());
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()) {
FrameLayout.mergeDrawableStates(baseState, new int[]{android.R.attr.state_checked});
}
return baseState;
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
if (/*this.mShiftingModeEnabled &&*/ this.mCounterContainer.getVisibility() != GONE) {
left = this.mCounterContainer.getMeasuredWidth() / 2
+ V.a(4.0F)
+ Math.min(this.getMeasuredWidth() / 2
- this.mCounterContainer.getWidth()
- V.a(4.0F), 0);
this.mCounterContainer.layout(this.mCounterContainer.getLeft() + left,
this.mCounterContainer.getTop(),
this.mCounterContainer.getRight() + left,
this.mCounterContainer.getBottom());
}
}
@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);
ViewCompat.setPivotX(mLargeLabel, mLargeLabel.getWidth() / 2);
ViewCompat.setPivotY(mLargeLabel, mLargeLabel.getBaseline());
ViewCompat.setPivotX(mSmallLabel, mSmallLabel.getWidth() / 2);
ViewCompat.setPivotY(mSmallLabel, mSmallLabel.getBaseline());
if (this.mIconsModeEnabled) {
var iconParams = (LayoutParams) this.mIcon.getLayoutParams();
iconParams.gravity = Gravity.CENTER;
iconParams.topMargin = 0;
iconParams.bottomMargin = 0;
this.mIcon.setLayoutParams(iconParams);
var counterContainerParams = (LayoutParams) this.mCounterContainer.getLayoutParams();
counterContainerParams.gravity = Gravity.CENTER;
counterContainerParams.topMargin = this.mMargin + V.a(1.5F);
counterContainerParams.bottomMargin = this.mMargin + V.a(1.5F);
this.mCounterContainer.setLayoutParams(counterContainerParams);
this.mCounterContainer.setTranslationY((float)(-V.a(5.5F)));
this.mLargeLabel.setVisibility(GONE);
this.mSmallLabel.setVisibility(GONE);
} else {
if (mShiftingModeEnabled) {
if (checked) {
var iconParams = (LayoutParams)this.mIcon.getLayoutParams();
iconParams.gravity = Gravity.TOP|Gravity.CENTER_HORIZONTAL;
iconParams.topMargin = this.mMargin;
this.mIcon.setLayoutParams(iconParams);
var counterContainerParams = (LayoutParams)this.mCounterContainer.getLayoutParams();
counterContainerParams.gravity = Gravity.TOP|Gravity.CENTER_HORIZONTAL;
counterContainerParams.topMargin = this.mMargin + V.a(1.5F);
counterContainerParams.bottomMargin = this.mMargin + V.a(1.5F);
this.mCounterContainer.setLayoutParams(counterContainerParams);
this.mCounterContainer.setTranslationY(-V.a(5.5F));
this.mLargeLabel.setVisibility(VISIBLE);
ViewCompat.setScaleX(this.mLargeLabel, 1.0F);
ViewCompat.setScaleY(this.mLargeLabel, 1.0F);
} else {
var iconParams = (LayoutParams)this.mIcon.getLayoutParams();
iconParams.gravity = Gravity.CENTER;
iconParams.topMargin = this.mMargin;
this.mIcon.setLayoutParams(iconParams);
var counterContainerParams = (LayoutParams)this.mCounterContainer.getLayoutParams();
counterContainerParams.gravity = Gravity.CENTER;
counterContainerParams.topMargin = this.mMargin + V.a(1.5F);
counterContainerParams.bottomMargin = this.mMargin + V.a(1.5F);
this.mCounterContainer.setLayoutParams(counterContainerParams);
this.mCounterContainer.setTranslationY((float)(-V.a(5.5F)));
this.mLargeLabel.setVisibility(INVISIBLE);
ViewCompat.setScaleX(this.mLargeLabel, 0.5F);
ViewCompat.setScaleY(this.mLargeLabel, 0.5F);
}
mSmallLabel.setVisibility(INVISIBLE);
} else {
// ViewCompat.setScaleX(mLargeLabel, !mStaticModeEnabled && !checked ? mLargeScale : 1.0f);
// 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);
var iconParams = (LayoutParams) this.mIcon.getLayoutParams();
iconParams.gravity = Gravity.CENTER;
iconParams.topMargin = 0;
iconParams.bottomMargin = V.a(6);
this.mIcon.setLayoutParams(iconParams);
var counterContainerParams = (LayoutParams)this.mCounterContainer.getLayoutParams();
counterContainerParams.gravity = Gravity.CENTER;
counterContainerParams.topMargin = 0;
counterContainerParams.bottomMargin = V.a(8);
this.mCounterContainer.setLayoutParams(counterContainerParams);
this.mCounterContainer.setTranslationY(-V.a(5.5F));
}
}
this.refreshDrawableState();
}
public void setCounterText(@Nullable CharSequence text) {
this.mCounter.setText(text);
if (text == null) {
this.mCounterContainer.setVisibility(GONE);
} else if (TextUtils.isEmpty(text)) {
this.mCounterContainer.setVisibility(VISIBLE);
this.mCounter.setVisibility(GONE);
this.mDot.setVisibility(VISIBLE);
} else {
this.mCounterContainer.setVisibility(VISIBLE);
this.mCounter.setVisibility(VISIBLE);
this.mDot.setVisibility(mItemPos);
}
}
public void setEnabled(boolean b) {
super.setEnabled(b);
this.mSmallLabel.setEnabled(b);
this.mLargeLabel.setEnabled(b);
this.mIcon.setEnabled(b);
}
@SuppressLint("RestrictedApi")
public void setIcon(Drawable drawable) {
if (drawable != null) {
if (drawable.getConstantState() != null)
drawable = drawable.getConstantState().newDrawable();
drawable = DrawableCompat.wrap(drawable).mutate();
DrawableCompat.setTintList(drawable, this.mColorStateList);
}
this.mIcon.setImageDrawable(drawable);
}
@SuppressLint("RestrictedApi")
public void setIconTintList(ColorStateList colorStateList) {
this.mColorStateList = colorStateList;
MenuItemImpl impl = this.mItemData;
if (impl != null) {
this.setIcon(impl.getIcon());
}
}
public void setIconsMode(boolean enabled) {
this.mIconsModeEnabled = enabled;
}
public void setStaticMode(boolean enabled) {
this.mStaticModeEnabled = enabled;
}
public void setItemBackground(int resId) {
ViewCompat.setBackground(this, resId != 0 ? ContextCompat.getDrawable(this.getContext(), resId) : null);
}
public void setItemPosition(int pos) {
this.mItemPos = pos;
}
public void setShiftingMode(boolean var1) {
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;
}
}
@@ -6,6 +6,7 @@ import static ru.vtosters.lite.dnr.DNRModule.isDnrEnabledFor;
import static ru.vtosters.lite.dnr.DNRModule.isDntEnabledFor;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import com.vk.core.util.ToastUtils;
import com.vk.im.engine.models.dialogs.Dialog;
import com.vk.im.ui.components.common.DialogAction;
@@ -40,6 +41,10 @@ public class DNRInjector{
public static boolean onClick(Dialog dialog, DialogAction action){
var id = dialog.getId();
if (action == DialogAction.valueOf("MARK_AS_READ")) {
DNRModule.hookRead(dialog);
}
if (action == DialogAction.valueOf("DNR_ON")) {
setDnr(dialog, true);
return true;
@@ -51,8 +51,7 @@ public class DNRModule{
}
public static void hookRead(Dialog dialog){
makeRequest("https://" + getApi() + "/method/messages.markAsRead?start_message_id=" + dialog.F1() + "&peer_id=" + dialog.getId() + "&v=5.91&access_token=" + getUserToken(), response -> {
ToastUtils.a("Чат помечен как прочитанный!");
makeRequest("https://" + getApi() + "/method/messages.markAsRead?start_message_id=" + dialog.F1() + "&peer_id=" + dialog.getId() + "&v=5.119&access_token=" + getUserToken(), response -> {
});
}
@@ -7,6 +7,10 @@ public class DNRPrefs{
return getBoolValue("read_s", false);
}
public static boolean getVoiceListened(){
return getBoolValue("listen_v", false);
}
public static boolean getMarkAsReadWithoutExceptions(int peerId){
if (readPM(peerId))
return true;
@@ -10,35 +10,45 @@ import com.vk.core.util.ToastUtils;
import com.vk.dto.music.MusicTrack;
import java.io.File;
import java.util.Random;
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,8 +92,12 @@ public class AudioDownloader{
new M3UDownloader(track.D, outDir, callback).execute();
}
private static NotificationCompat.Builder buildDownloadNotification(MusicTrack track, int id){
var notificationBuilder = new NotificationCompat.Builder(Globals.getContext(), "music_downloads")
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("Загрузка аудиозаписи")
.setContentText(track.toString())
@@ -17,6 +17,7 @@ import android.widget.Toast;
import com.vk.core.dialogs.bottomsheet.MenuBottomSheetAction;
import com.vk.core.util.ToastUtils;
import com.vk.dto.common.VideoFile;
import com.vtosters.lite.R;
import org.json.JSONArray;
import org.json.JSONException;
@@ -26,10 +27,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.ExternalLinkHandler;
import ru.vtosters.lite.utils.Preferences;
public class VideoDownloader{
private static final int DOWNLOAD_ID = 0;
@@ -48,7 +46,7 @@ public class VideoDownloader{
public static void injectAction(ArrayList<MenuBottomSheetAction> list, VideoFile video){
if (!video.U && !video.I1()) {
addAction(list, DOWNLOAD_ID, R.drawable.ic_download_outline_24, R.string.download, 9);
addAction(list, OPEN_EXTERNAL_LINK_ID, R.drawable.ic_link_outline_28, getIdentifier("interfacevideoext", "string"), 9);
addAction(list, OPEN_EXTERNAL_LINK_ID, R.drawable.ic_link_outline_28, getIdentifier("interfacevideoext_short", "string"), 9);
}
}
@@ -0,0 +1,32 @@
package ru.vtosters.lite.downloaders.notifications;
import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.os.Build;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationManagerCompat;
import ru.vtosters.lite.utils.Globals;
public class NotificationChannels {
public static final String MUSIC_DOWNLOAD_CHANNEL_ID = "music_download_channel";
public static final String MUSIC_DOWNLOAD_CHANNEL_NAME = "Загрузка музыки";
public static final String MUSIC_DOWNLOAD_CHANNEL_DESCRIPTION = "Прогресс загрузки музыки";
@RequiresApi(api = Build.VERSION_CODES.O)
public static void createChannels() {
createMusicDownloadChannel();
}
@RequiresApi(api = Build.VERSION_CODES.O)
public static void createMusicDownloadChannel() {
var musicDownloadChannel = new NotificationChannel(MUSIC_DOWNLOAD_CHANNEL_ID, MUSIC_DOWNLOAD_CHANNEL_NAME, NotificationManager.IMPORTANCE_LOW);
musicDownloadChannel.setDescription(MUSIC_DOWNLOAD_CHANNEL_DESCRIPTION);
musicDownloadChannel.setShowBadge(true);
musicDownloadChannel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
var notificationManager = NotificationManagerCompat.from(Globals.getContext());
notificationManager.createNotificationChannel(musicDownloadChannel);
}
}
@@ -18,6 +18,9 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class LogWriterService extends Service{
public LogWriterService(){
@@ -28,7 +31,9 @@ public class LogWriterService extends Service{
super.onStartCommand(intent, flags, startId);
Log.d("LogWriterService", "The service has been started");
var file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/VTL_log.txt");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss", Locale.getDefault());
var file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/VTL_log_" + dateFormat.format(new Date()) + ".txt");
try {
var exists = file.createNewFile();
@@ -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){
@@ -1,4 +1,4 @@
package ru.vtosters.lite.utils;
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import static ru.vtosters.lite.utils.Globals.getString;
@@ -10,17 +10,7 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
public class LocaleUtils{
public static String getLocale(){
String string = getPrefsValue("lang_value");
if (string.equals("system")) {
return Locale.getDefault().getLanguage();
}
return string.isEmpty() ? Locale.getDefault().getLanguage() : string;
}
public class DateHook{
public static boolean fulltime(){
return getPrefsValue("dateformat").equals("noyear") || getPrefsValue("dateformat").equals("full") || getPrefsValue("dateformat").equals("noseconds");
}
@@ -53,4 +43,14 @@ public class LocaleUtils{
return null;
}
}
public static String getLocale(){
String string = getPrefsValue("lang_value");
if (string.equals("system")) {
return Locale.getDefault().getLanguage();
}
return string.isEmpty() ? Locale.getDefault().getLanguage() : string;
}
}
@@ -1,27 +1,41 @@
package ru.vtosters.lite.ui.fragments.dockbar;
package ru.vtosters.lite.hooks;
import static android.graphics.Color.*;
import static com.vtosters.lite.R.id.menu_fave;
import static com.vtosters.lite.R.id.menu_feedback;
import static com.vtosters.lite.R.id.menu_friends;
import static com.vtosters.lite.R.id.menu_games;
import static com.vtosters.lite.R.id.menu_groups;
import static com.vtosters.lite.R.id.menu_messages;
import static com.vtosters.lite.R.id.menu_newsfeed;
import static com.vtosters.lite.R.id.menu_photos;
import static com.vtosters.lite.R.id.menu_search;
import static com.vtosters.lite.R.id.menu_videos;
import static com.vtosters.lite.R.id.menu_vk_pay;
import static com.vtosters.lite.R.id.tab_discover;
import static com.vtosters.lite.R.id.tab_feedback;
import static com.vtosters.lite.R.id.tab_menu;
import static com.vtosters.lite.R.id.tab_messages;
import static com.vtosters.lite.R.id.tab_news;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getResources;
import static ru.vtosters.lite.utils.Preferences.*;
import static ru.vtosters.lite.utils.Themes.getCSTDock;
import android.annotation.SuppressLint;
import android.content.res.ColorStateList;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import com.vk.apps.AppsFragment;
import com.vk.core.drawable.RecoloredDrawable;
import com.vk.core.fragments.FragmentImpl;
import com.vk.core.util.StringUtils;
import com.vk.navigation.right.RightMenu;
import com.vtosters.lite.MenuCountersState;
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationMenuView;
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationView;
@@ -38,10 +52,15 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
public class DockBarInjector{
private static final DockBarManager sManager = DockBarManager.getInstance();
import ru.vtosters.lite.ui.components.DockBarEditorManager;
import ru.vtosters.lite.ui.items.DockBarTab;
import ru.vtosters.lite.utils.Globals;
import ru.vtosters.lite.utils.Preferences;
public static Map<Class<? extends FragmentImpl>, Integer> injectMap(){
public class DockBarInjector {
private static final DockBarEditorManager sManager = DockBarEditorManager.getInstance();
public static Map<Class<? extends FragmentImpl>, Integer> injectMap() {
LinkedHashMap<Class<? extends FragmentImpl>, Integer> map = new LinkedHashMap<>();
for (DockBarTab tab : sManager.getSelectedTabs()) {
map.put(tab.fragmentClass, tab.id);
@@ -49,7 +68,8 @@ public class DockBarInjector{
return map;
}
public static void inject(BottomNavigationView navigationView){
@SuppressLint("RestrictedApi")
public static void inject(BottomNavigationView navigationView) {
Menu menu = navigationView.getMenu();
menu.clear();
try {
@@ -62,7 +82,7 @@ public class DockBarInjector{
Method acquire = synchronisedPoolCls.getDeclaredMethod("acquire");
if (synchronizedPool != null) {
do {
} while(acquire.invoke(synchronizedPool) != null);
} while (acquire.invoke(synchronizedPool) != null);
}
} catch (NoSuchFieldException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
@@ -73,24 +93,31 @@ public class DockBarInjector{
MenuItem add = menu.add(0, tab.id, 0, tab.titleID);
Drawable drawable = getResources().getDrawable(tab.iconID);
ColorStateList dockcolors = new ColorStateList(
new int[][] {
new int[] {android.R.attr.state_checked},
new int[] {-android.R.attr.state_checked}
},
new int[] {
Color.parseColor("#ff528bcc"),
Color.parseColor("#ffaaaeb3")
}
);
add.setIcon(new RecoloredDrawable(drawable, dockcolors));
add.setShowAsAction(1);
add.setIcon(new RecoloredDrawable(drawable, getCSTDock()));
add.setTitle(getContext().getString(tab.titleID));
add.setCheckable(true);
}
if (getBoolValue("dockbar_tab_titles", false)) {
var menuView = (BottomNavigationMenuView) navigationView.getChildAt(0);
for (int i = 0; i < menuView.getChildCount(); i++) {
var item = (com.vtosters.lite.ui.bottomnavigation.BottomNavigationItemView) menuView.getChildAt(i);
item.setStaticMode(true);
item.setIconsMode(false);
item.setShiftingMode(false);
}
}
}
public static int injectId(String tag){
private static void removeAllChildren(ViewGroup view) {
for (int i = 0; i < view.getChildCount(); i++) {
if (view instanceof ViewGroup) {
removeAllChildren((ViewGroup) view.getChildAt(i));
view.removeAllViews();
}
}
}
public static int injectId(String tag) {
for (DockBarTab tab : sManager.getSelectedTabs()) {
if (tag.equals(tab.tag))
return tab.id;
@@ -98,7 +125,7 @@ public class DockBarInjector{
return 0;
}
public static void injectMenuFragment(Menu menu){
public static void injectMenuFragment(Menu menu) {
List<MenuItem> menuItems = new ArrayList<>();
for (int i = 0; i < menu.size(); i++) {
menuItems.add(menu.getItem(i));
@@ -155,7 +182,62 @@ public class DockBarInjector{
}
}
public static JSONArray injectMenuJSON(JSONArray arr){
public static void setCounter(int tabId, BottomNavigationView navigationView) {
navigationView.a(tabId, counters(tabId));
}
@SuppressLint("NonConstantResourceId")
private static CharSequence counters(int tabId) {
if (!dockcounter()) return null;
int val = 0;
switch (tabId) {
case tab_messages:
val = MenuCountersState.j();
break;
case menu_groups:
val = MenuCountersState.h();
break;
case menu_fave:
val = MenuCountersState.c();
break;
case menu_games:
val = MenuCountersState.a();
break;
case menu_photos:
val = MenuCountersState.l();
break;
case menu_videos:
val = MenuCountersState.n();
break;
case tab_feedback:
if (milkshake())
val = MenuCountersState.k();
break;
case menu_friends:
if (!milkshake())
val = MenuCountersState.k();
break;
}
//
// val = MenuCountersState.g(); // friends ?????? menu_friends
// val = MenuCountersState.j(); // messages
// val = MenuCountersState.k(); // notifications
// val = MenuCountersState.b(); // NewsfeedMarkDiscoverBadgeViewed
// val = MenuCountersState.c(); // fave
// val = MenuCountersState.a(); // games
// val = MenuCountersState.h(); // groups
// val = MenuCountersState.l(); // photos
// val = MenuCountersState.m(); // support
// val = MenuCountersState.n(); // videos
// val = MenuCountersState.o(); // vk_pay
// val = MenuCountersState.e(); // new friends
// val = MenuCountersState.f(); // suggested friends
return val > 0 ? StringUtils.a(val) : null;
}
public static JSONArray injectMenuJSON(JSONArray arr) {
List<String> arrayList = new ArrayList(Arrays.asList(
"news",
"messages",
@@ -188,25 +270,25 @@ public class DockBarInjector{
}
}
public static int getItemCount(){
public static int getItemCount() {
return sManager.getSelectedTabs().size();
}
public static boolean isDockOpenAllowed(FragmentImpl fragment){
public static boolean isDockOpenAllowed(FragmentImpl fragment) {
return isDockOpenAllowed(fragment.getClass());
}
public static boolean isDockOpenAllowed(Class<?> cls){
public static boolean isDockOpenAllowed(Class<?> cls) {
for (DockBarTab tab : sManager.getSelectedTabs())
if (tab.fragmentClass == cls)
return true;
return false;
for (DockBarTab tab : sManager.getDisabledTabs())
if (tab.fragmentClass == cls)
return true;
return false;
return false;
return true;
}
public static Class<?> interceptClick(int id, RightMenu rightMenu){
public static Class<?> interceptClick(int id, RightMenu rightMenu) {
if (id == tab_menu) {
rightMenu.a();
}
@@ -0,0 +1,17 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.FragAnimationKit.setAnimations;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import androidx.fragment.app.FragmentTransaction;
public class FragAnimationHook{
public static boolean animateOpen(FragmentTransaction transaction){
setAnimations(transaction);
return getPrefsValue("anim_rtrn_type").equals("noanim") || getPrefsValue("anim_rtrn_type").isEmpty();
}
public static void animateClose(FragmentTransaction transaction){
setAnimations(transaction);
}
}
@@ -1,4 +1,4 @@
package ru.vtosters.lite.audio.gcm;
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.musicFixNew;
@@ -27,7 +27,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
import javax.net.ssl.HttpsURLConnection;
public class GCMFix{
public class GcmHook{
private static final String agent = String.format("Android-GCM/1.5 (%s %s)", Build.MODEL, Build.MODEL);
public static ArrayList<String> langs = new ArrayList<>();
private static KeyPair pair;
@@ -38,12 +38,12 @@ public class GCMFix{
}
public static String requestTokenV2(String orig){
if (musicFixNew()) return "null"; // TODO FIX TOKENMOD v2 cyz vk shit
if (musicFixNew()) return "null";
return orig;
}
public static String requestToken(String orig){
if (musicFixNew()) return "{null}"; // TODO FIX TOKENMOD v2 cyz vk shit
if (musicFixNew()) return "{null}";
if (orig.equals("")) return requestToken();
return orig;
}
@@ -66,7 +66,7 @@ public class GCMFix{
List<String> params = new ArrayList<>();
fillParams(params, sig, pub2, xappide, Long.parseLong(aid.split(" ")[1].split(":")[0]), false);
Callback callback = str -> GCMFix.lambdaRequestToken(sb, wait, str);
Callback callback = str -> GcmHook.lambdaRequestToken(sb, wait, str);
doRequest("https://android.clients.google.com/c2dm/register3", "POST", params, aid, callback);
while(!wait.get()) {
@@ -81,7 +81,7 @@ public class GCMFix{
String sig2 = getSig(pub22);
params.clear();
fillParams(params, sig2, pub22, xappide, Long.parseLong(aid.split(" ")[1].split(":")[0]), true);
doRequest("https://android.clients.google.com/c2dm/register3", "POST", params, aid, GCMFix::lambda$requestToken$1);
doRequest("https://android.clients.google.com/c2dm/register3", "POST", params, aid, GcmHook::lambda$requestToken$1);
return token;
} catch (FileNotFoundException e2) {
return requestToken();
@@ -0,0 +1,610 @@
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.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.text.ParseException;
import java.util.Objects;
import java.util.Random;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
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{
var id = orig.getInt("id");
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";
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{
var peerid = Objects.requireNonNull(orig.optJSONObject("peer")).optInt("id");
var pic = "https://image.pngaaa.com/641/326641-middle.png"; // can be null
var text = "Я не загрузил данные (9(9((";
var link = "https://vtosters.app"; // can be null
var linktitle = "Test button"; // can be null
// "{\"layout\":\"tertiary\",\"text\":\"" + linktitle + "\",\"type\":\"link\",\"link\":\"" + link + "\"}";
var buttons = decode("eyJsYXlvdXQiOiJ0ZXJ0aWFyeSIsInRleHQiOiI=") + linktitle + decode("IiwidHlwZSI6ImxpbmsiLCJsaW5rIjoi") + link + decode("In0=");
// ,"icon":" + pic + "
var icon = decode("LCJpY29uIjoi") + pic + decode("Ig==");
var hasIcon = !pic.isEmpty();
var hasButton = !buttons.isEmpty();
var isPicture = pic.endsWith(".png") || pic.endsWith(".jpg") || pic.endsWith(".jpeg") || pic.endsWith(".webp");
if (!isPicture) hasIcon = false;
if (!hasIcon) icon = "";
if (!hasButton) buttons = "";
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("")) {
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=")
+ text + decode("IiwiYnV0dG9ucyI6Ww==")
+ buttons + decode("XQ==")
+ icon
+ decode("fQ=="));
}
public static JSONObject menu(JSONObject orig) throws JSONException{
var Special = orig.optJSONArray("special");
var Main = orig.getJSONArray("main");
var Other = orig.optJSONArray("other");
if (Special != null) {
orig.remove("special");
}
return orig;
}
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");
var newItems = new JSONArray();
if (oldItems != null) {
for (int i = 0; i < oldItems.length(); i++) {
var item = oldItems.optJSONObject(i);
var type = item.optString("type");
for (String superApp : superApps) {
if (type.equals(superApp))
newItems.put(item);
}
}
for (int i = 0; i < superApps.length; i++) {
for (int j = i; j < newItems.length(); j++) {
var item = newItems.optJSONObject(j);
if (superApps[i].equals(item.optString("type")))
newItems.put(j, newItems.getJSONObject(i))
.put(i, item);
}
}
}
return json.putOpt("items", newItems);
}
public static JSONObject musiclink(JSONObject json){
var oldItems = json.optJSONArray("links");
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 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");
if (playlists != null) {
var catalogarr = playlists.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
var title = catalogarr.optString("title");
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));
}
var albums = fetchCatalogId("https://vk.com/audio?section=albums");
if (albums != null) {
var catalogarr = albums.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
var title = catalogarr.optString("title");
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));
}
var recent = fetchCatalogId("https://vk.com/audio?section=recent");
if (recent != null) {
var catalogarr = recent.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
var title = catalogarr.optString("title");
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;
var request = new Request.a()
.b("https://api.vk.com/method/catalog.getAudio"
+ "?v=5.119"
+ "&https=1"
+ "&need_blocks=1"
+ "&lang="
+ getLocale()
+ "&device_id="
+ DeviceIdProvider.d(getContext())
+ "&url="
+ section
+ "&access_token="
+ getUserToken())
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
try {
return new JSONObject(mClient.a(request).execute().a().g()).getJSONObject("response");
} catch (JSONException | IOException e) {
Log.d("VTLMusic", "Error: " + e.getMessage());
}
return null;
}
public static JSONObject friends(JSONObject json) throws JSONException{
JSONObject catalog = json;
boolean sectionexecute = true;
boolean hasBirthday = false;
if (json.optJSONObject("catalog") != null) {
catalog = json.optJSONObject("catalog");
sectionexecute = false;
}
JSONArray section = null;
JSONObject sections = null;
if (sectionexecute) {
sections = catalog.optJSONObject("section");
} else {
section = catalog.optJSONArray("sections");
}
JSONArray oldItems;
if (sectionexecute) {
oldItems = sections.optJSONArray("blocks");
} else {
oldItems = section.optJSONObject(0).optJSONArray("blocks");
}
var newItems = new JSONArray();
if (oldItems != null) {
for (int i = 0; i < oldItems.length(); i++) {
var type = oldItems.optJSONObject(i);
var name = type.optJSONObject("layout").optString("name");
var buttons = "";
var skip = false;
if (type.optJSONArray("buttons") != null) {
buttons = type.optJSONArray("buttons").optJSONObject(0).optString("ref_layout_name");
}
if (name.contains("list_friend_suggests") || buttons.contains("list_friend_suggests") || name.contains("separator")) {
skip = friendsblock();
}
if (buttons.contains("friends_birthdays_list")) {
hasBirthday = true;
}
if (name.contains("separator") && hasBirthday) {
skip = false;
hasBirthday = false;
}
if (!skip) {
newItems.put(type);
}
}
}
if (sectionexecute) {
sections.putOpt("blocks", newItems);
} else {
section.optJSONObject(0).putOpt("blocks", newItems);
}
return json;
}
public static boolean haveDonateButton(){
int randomshower = new Random().nextInt(6);
return hasVerification() || randomshower != 1;
}
}
@@ -0,0 +1,75 @@
package ru.vtosters.lite.hooks;
import static java.lang.Long.MAX_VALUE;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import static ru.vtosters.lite.utils.Newsfeed.checkCaption;
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.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;
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;
}
optString = obj.optString("post_type", "");
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString) || isMusicBlock(optString) || isNewsBlock(optString)) {
return false;
}
optString = obj.optString("filters", "");
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString)) {
return false;
}
if (checkCopyright(obj)) return false;
if (isBadNews(obj.optString("text", ""))) return false;
if (checkCaption(obj)) return false;
if (isGroupAds(obj)) return false;
return !injectFiltersReposts(obj);
} // inject our filters to newsfeed, getpost and discover
public static long getUpdateNewsfeed(boolean refresh_timeout){
if (vkme()) {
return MAX_VALUE;
}
switch(getPrefsValue("newsupdate")) {
case "no_update":
return MAX_VALUE;
case "imd_update":
return 10000L;
default:
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,22 +1,29 @@
package ru.vtosters.lite.utils;
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;
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;
public class OnlineFormatter{
import java.io.IOException;
import java.text.ParseException;
public class OnlineFormatterHook{
private static String AppName;
public static String getAppName(int appid){ // thanks to egormetlitsky (vk mp3 mod) for helping with online ids
if (appid <= 3) return null;
if (appid <= 3 || !getBoolValue("onlineformatter", true)) return null;
switch(appid) {
case 2274003:
@@ -159,4 +166,16 @@ public class OnlineFormatter{
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;
}
}
@@ -0,0 +1,167 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getPreferences;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.net.Uri;
import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import com.vk.core.dialogs.actionspopup.ActionsPopup;
import com.vk.core.drawable.RecoloredDrawable;
import com.vk.dto.common.AttachmentWithMedia;
import com.vtosters.lite.R;
import com.vtosters.lite.attachments.PhotoAttachment;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.net.URLEncoder;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import ru.vtosters.lite.utils.Globals;
import ru.vtosters.lite.utils.Themes;
public class PhotoViewer {
static OkHttpClient client = new OkHttpClient();
public static boolean interceptClick(AttachmentWithMedia attachment, MenuItem item, View view) {
if (item.getItemId() == Globals.getIdentifier("search_photo", "id")) {
searchPhoto(getUrlFromAttachment((PhotoAttachment) attachment));
return true;
} else if (item.getItemId() == Globals.getIdentifier("copy_photo_url", "id")) {
copyPhotoUrl(getUrlFromAttachment((PhotoAttachment) attachment));
return true;
} else if (item.getItemId() == Globals.getIdentifier("open_original_photo", "id")) {
openUrl(getUrlFromAttachment((PhotoAttachment) attachment));
return true;
}
return true;
}
public static void addMenuItems(AttachmentWithMedia attachment, ActionsPopup.b actionPopup, int i, boolean z) {
actionPopup.a(getIdentifier("search_photo_content", "string"),
Themes.isDarkTheme()
? Globals.getContext().getDrawable(R.drawable.ic_menu_search_outline_28)
: new RecoloredDrawable(Globals.getContext().getDrawable(R.drawable.ic_menu_search_outline_28), Themes.getAccentColor()),
false,
() -> {
searchPhoto(getUrlFromAttachment((PhotoAttachment) attachment));
return null;
}
);
actionPopup.a(getIdentifier("copy_photo_url_content", "string"),
!Themes.isDarkTheme()
? new RecoloredDrawable(Globals.getContext().getDrawable(R.drawable.ic_copy_outline_28), Themes.getAccentColor())
: new RecoloredDrawable(Globals.getContext().getDrawable(R.drawable.ic_copy_outline_28), Color.WHITE),
false,
() -> {
copyPhotoUrl(getUrlFromAttachment((PhotoAttachment) attachment));
return null;
}
);
actionPopup.a(getIdentifier("open_original_photo_content", "string"),
Themes.isDarkTheme()
? Globals.getContext().getDrawable(R.drawable.ic_link_outline_28)
: new RecoloredDrawable(Globals.getContext().getDrawable(R.drawable.ic_link_outline_28),
Themes.getAccentColor()),
false,
() -> {
openUrl(getUrlFromAttachment((PhotoAttachment) attachment));
return null;
}
);
}
private static String getUrlFromAttachment(PhotoAttachment attachment) {
var imageSizes = attachment.D.Q.t1();
if (imageSizes.isEmpty())
return null;
var max = imageSizes.get(0);
for (int i = 1; i < imageSizes.size(); ++i) {
var size = imageSizes.get(i);
if (max != null && max.t1() < size.t1()) {
max = size;
}
}
return max.url;
}
private static void searchPhoto(String url) {
if (url == null || url.isEmpty()) return;
switch (getPreferences().getInt("search_engine", 0)) {
case 0:
searchWithYandex(url);
break;
case 1:
searchWithGoogle(url);
break;
case 2:
searchWithBing(url);
break;
}
}
private static void searchWithYandex(String url) {
var request = new Request.a()
.b(String.format("https://yandex.ru/images-apphost/image-download?url=%s&images_avatars_size=preview&images_avatars_namespace=images-cbir",
URLEncoder.encode(url)))
.a();
client.a(request).a(new Callback() {
@Override
public void a(Call call, IOException e) {
Log.d("PhotoViewer", e+"");
}
@Override
public void a(Call call, Response response) throws IOException {
try {
JSONObject payload = new JSONObject(response.a().g());
var cbirId = payload.optInt("image_shard") + "/" + payload.optString("image_id");
var imageUrl = String.format("https://avatars.mds.yandex.net/get-images-cbir/%s/orig", cbirId);
var searchUrl = String.format("https://yandex.ru/images/search?rpt=imageview&url=%s&cbir_id=%s", imageUrl, cbirId);
openUrl(searchUrl);
} catch (JSONException e) {
e.printStackTrace();
}
}
});
}
private static void searchWithGoogle(String url) {
openUrl("https://www.google.ru/searchbyimage?image_url=" +
URLEncoder.encode(url));
}
private static void searchWithBing(String url) {
openUrl("https://www.bing.com/images/search?view=detailv2&iss=SBI&form=SBIIDP&sbisrc=UrlPaste&q=imgurl:"
+ URLEncoder.encode(url));
}
private static void copyPhotoUrl(String url) {
if (url == null || url.isEmpty()) return;
ClipboardManager manager = (ClipboardManager) Globals.getContext().getSystemService(Context.CLIPBOARD_SERVICE);
manager.setPrimaryClip(ClipData.newPlainText("vk_photo_url", url));
Toast.makeText(Globals.getContext(), Globals.getIdentifier("copied_to_clipboard", "string"), Toast.LENGTH_SHORT).show();
}
private static void openUrl(String url) {
var uri = Uri.parse(url);
var intent = new Intent(Intent.ACTION_VIEW, uri);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Globals.getContext().startActivity(intent);
}
}
@@ -1,4 +1,4 @@
package ru.vtosters.lite.utils;
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
@@ -9,7 +9,7 @@ import android.widget.TextView;
import com.vk.dto.polls.PollOption;
import com.vk.polls.ui.views.PollOptionView;
public class PollUtils{
public class PollHook{
public static void show(PollOptionView view){
if (!getBoolValue("pollresults", false)) return;
@@ -1,7 +1,9 @@
package ru.vtosters.lite.utils;
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import static ru.vtosters.lite.utils.Globals.restartApplication;
import static ru.vtosters.lite.utils.Proxy.apiproxy;
import static ru.vtosters.lite.utils.Proxy.isZaboronaEnabled;
import static ru.vtosters.lite.utils.Themes.getAccentColor;
import static ru.vtosters.lite.utils.Themes.getAlertStyle;
@@ -11,6 +13,7 @@ import android.annotation.SuppressLint;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.util.Log;
import android.util.TypedValue;
import android.view.View;
import android.widget.RadioButton;
@@ -86,4 +89,47 @@ public class ProxyHook{
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getAccentColor());
}
public static String linkReplacer(String link){
var vkapi = "api.vk.com";
var oauth = "oauth.vk.com";
var vkstatic = "static.vk.com";
var proxyapi = getPrefsValue("proxyapi");
var proxyoauth = getPrefsValue("proxyoauth");
var proxystatic = getPrefsValue("proxystatic");
if (!apiproxy() || link.isEmpty()) {
return link;
}
if (proxyapi.isEmpty() || proxyoauth.isEmpty() || proxystatic.isEmpty()) {
Log.d("VTLite", "Proxy is not set" + " " + proxyapi + " " + proxyoauth + " " + proxystatic);
return link;
}
if (link.contains(vkapi)) {
return link.replace(proxyapi, vkapi);
}
if (link.contains(oauth)) {
return link.replace(proxyoauth, oauth);
}
if (link.contains(vkstatic)) {
return link.replace(proxystatic, vkstatic);
}
return link;
}
public static String getAwayPhpCom(){
var proxyapi = getPrefsValue("proxyapi");
if (apiproxy() & !proxyapi.isEmpty()) {
return proxyapi;
}
return "m.vk.com";
}
}
@@ -0,0 +1,84 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.ui.components.DockBarEditorManager.getInstance;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
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;
import com.vk.discover.ThemedFeedFragment;
import com.vk.fave.fragments.FaveTabFragment;
import com.vk.menu.MenuFragment;
import com.vk.menu.SearchMenuFragment;
import com.vk.music.fragment.MusicCatalogFragment1;
import com.vk.music.fragment.MusicFragment;
import com.vk.newsfeed.HomeFragment;
import com.vk.newsfeed.NewsfeedFragment;
import com.vk.notifications.NotificationsContainerFragment;
import com.vk.profile.catalog.CommunitiesCatalogFragment;
import com.vk.superapp.SuperAppFragment;
import com.vtosters.lite.fragments.ProfileFragment;
import com.vtosters.lite.fragments.friends.FriendsFragment;
import com.vtosters.lite.fragments.gifts.BirthdaysFragment;
import com.vtosters.lite.fragments.lives.LivesTabsFragment;
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;
public class StartFragmentHook{
public static Class getStartFragment(){
if (vkme()) {
return DialogsFragment.class;
}
switch(getPrefsValue("start_values")) {
case "newsfeed":
return milkshake() ? HomeFragment.class : NewsfeedFragment.class;
case "messenger":
return DialogsFragment.class;
case "groups":
return milkshake() ? CommunitiesCatalogFragment.class : GroupsFragment1.class;
case "music":
return getBoolValue("musicnewcatalog", true) ? MusicCatalogFragment1.class : MusicFragment.class;
case "friends":
return FriendsFragment.class;
case "photos":
return PhotosFragment.class;
case "videos":
return videoewcatalog() ? VideoCatalogFragment.class : VideosFragment.class;
case "settings":
return useNewSettings();
case "apps":
return AppsFragment.class;
case "discover":
return ThemedFeedFragment.class;
case "notifications":
return NotificationsContainerFragment.class;
case "money":
return MoneyTransfersFragment.class;
case "games":
return GamesFragment.class;
case "liked":
return FaveTabFragment.class;
case "menu":
return milkshake() ? (superapp() ? SuperAppFragment.class : SearchMenuFragment.class) : MenuFragment.class;
case "profile":
return ProfileFragment.class;
case "lives":
return LivesTabsFragment.class;
case "docs":
return DocumentsViewFragment.class;
case "brtd":
return BirthdaysFragment.class;
default:
return getInstance().getSelectedTabs().get(0).fragmentClass;
}
}
}
@@ -0,0 +1,13 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.adsstories;
import static ru.vtosters.lite.utils.Preferences.stories;
public class StoriesHook{
public static String ads(){
return adsstories() ? "null" : "ads";
}
public static boolean showstories(){
return stories();
}
}
@@ -1,5 +1,5 @@
package ru.vtosters.lite.utils;
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.*;
import static ru.vtosters.lite.utils.Preferences.feedcache;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.milkshake;
@@ -10,7 +10,9 @@ import static ru.vtosters.lite.utils.Preferences.superapp;
import com.vk.toggle.FeatureManager;
import com.vk.toggle.Features;
public class Toggles{
import ru.vtosters.lite.utils.Preferences;
public class TogglesHook{
public static boolean shouldPatch(Features.Type feature){
switch(feature) {
case AB_IM_LONGPOLL_MSG_BATCHING:
@@ -45,8 +47,6 @@ public class Toggles{
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:
@@ -143,8 +143,8 @@ public class Toggles{
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:
return true;
}
@@ -1,5 +1,4 @@
package ru.vtosters.lite.utils;
package ru.vtosters.lite.hooks;
import static android.util.Base64.encodeToString;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
@@ -14,13 +13,16 @@ import static ru.vtosters.lite.utils.Themes.hex;
import android.webkit.WebView;
import com.vk.articles.preload.WebCachePreloader;
import com.vtosters.lite.data.ThemeTracker;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
public class VKUIInjector{
public class VKUIHook{
public static boolean isLoaded = false;
private static String loadedCSS = "";
private static String loadedCSSAmoled = "";
@@ -90,4 +92,11 @@ public class VKUIInjector{
inject(webView, encodeToString(sb.toString().getBytes(), 2));
}
}
public static void clearWebCache(){
ThemeTracker.a();
isLoaded = false;
new WebView(getContext()).clearCache(true);
WebCachePreloader.e();
}
}
@@ -69,7 +69,7 @@ public class FFMpeg{
var concat = FFmpegKit.execute("-f concat -safe 0 -i " + in + "/list.txt -c copy " + in + "/all.ts");
// convert .ts file to .mp3 file via ffmpeg
var session = FFmpegKit.execute("-i " + in + "/all.ts -f mp3 -acodec mp3 -b 320 -y '" + out + "'");
var session = FFmpegKit.execute("-i " + in + "/all.ts -f mp3 -acodec mp3 -q:a 0 -y '" + out + "'");
var rc = session.getReturnCode();
if (ReturnCode.isSuccess(rc)) {
@@ -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&copyright=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;
}
@@ -3,7 +3,6 @@ package ru.vtosters.lite.ui;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Themes.getAccentColor;
import static ru.vtosters.lite.utils.Themes.getAlertStyle;
import static ru.vtosters.lite.utils.Themes.getSTextAttr;
import static ru.vtosters.lite.utils.Themes.getTextAttr;
@@ -184,7 +183,7 @@ public class PreferencesUtil{
margin.setMargins(convertDpToPixel(20f), 0, convertDpToPixel(20f), 0);
editText.setLayoutParams(margin);
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getContext(), getAlertStyle());
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.getContext());
builder.setTitle(title);
builder.setView(linearLayout);
builder.setPositiveButton("OK", (dialog, which) -> {
@@ -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);
}
}
@@ -0,0 +1,270 @@
package ru.vtosters.lite.ui.adapters;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getString;
import android.content.res.ColorStateList;
import android.graphics.Typeface;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import ru.vtosters.lite.ui.components.IItemMovingListener;
import ru.vtosters.lite.utils.Themes;
public class CategorizedAdapter extends RecyclerView.Adapter<CategorizedAdapter.CategorizedViewHolder> implements IItemMovingListener {
// Adapter item types
public static final int MOVING_ITEM = -0x1;
public static final int CATEGORY_TITLE = -0x2;
// Item states
public static final int SELECTED_STATE = -0x1;
public static final int DISABLED_STATE = -0x2;
private List mSelectedItems;
private List mDisabledItems;
private List mUnmovedItems;
private IViewHolderBinder mBinder;
private int mMinSelectedItems = -1;
private int mMaxSelectedItems = -1;
public CategorizedAdapter(List selectedItems, List disabledItems, IViewHolderBinder binder) {
this.mSelectedItems = selectedItems;
this.mDisabledItems = disabledItems;
this.mUnmovedItems = new ArrayList();
this.mBinder = binder;
}
public void setMinAndMaxCounts(int min, int max) {
this.mMinSelectedItems = min;
this.mMaxSelectedItems = max;
}
public void addUnmovedItem(Object item) {
mUnmovedItems.add(item);
}
public int getItemViewType(int i) {
return i == 0 || mSelectedItems.size() + 1 == i ? CATEGORY_TITLE : MOVING_ITEM;
}
public int getTabType(int i) {
return i <= mSelectedItems.size() ? SELECTED_STATE : DISABLED_STATE;
}
public boolean isUnmovedItem(int index) {
if (getItemViewType(index) == MOVING_ITEM) {
Object curr;
if (getTabType(index) == SELECTED_STATE) {
curr = mSelectedItems.get(index - 1);
return mUnmovedItems.contains(curr);
} else {
curr = mDisabledItems.get(index - mSelectedItems.size() - 2);
return mUnmovedItems.contains(curr);
}
}
return false;
}
@NonNull
@Override
public CategorizedViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
FrameLayout container = new FrameLayout(getContext());
container.addView(newCategoryTitle(), new FrameLayout.LayoutParams(-1, -2));
container.addView(newMovingItem(), new FrameLayout.LayoutParams(-1, -2));
return new CategorizedViewHolder(container);
}
private View newMovingItem() {
LinearLayout container = new LinearLayout(getContext());
container.setTag("container");
container.setGravity(Gravity.CENTER_VERTICAL);
container.setOrientation(LinearLayout.HORIZONTAL);
container.setPadding(
convertDpToPixel(12),
convertDpToPixel(12),
convertDpToPixel(12),
convertDpToPixel(12)
);
container.setLayoutParams(new LinearLayout.LayoutParams(-1, convertDpToPixel(48)));
container.setVisibility(View.INVISIBLE);
ImageView icon = new ImageView(getContext());
icon.setTag("icon");
icon.setImageTintList(ColorStateList.valueOf(Themes.getAccentColor()));
icon.setLayoutParams(new LinearLayout.LayoutParams(
convertDpToPixel(24),
convertDpToPixel(24)));
container.addView(icon);
TextView name = new TextView(getContext());
name.setTag("name");
name.setTextSize(16.0f);
name.setTypeface(Typeface.DEFAULT_BOLD);
name.setTextColor(Themes.getTextAttr());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(-1, -2);
params.weight = 1;
params.leftMargin = convertDpToPixel(16);
container.addView(name, params);
return container;
}
private View newCategoryTitle() {
LinearLayout container = new LinearLayout(getContext());
container.setTag("category_title_container");
container.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
container.setVisibility(View.INVISIBLE);
TextView title = new TextView(getContext());
title.setTag("category_title");
title.setTextSize(13.0f);
title.setPadding(
convertDpToPixel(16),
convertDpToPixel(13),
convertDpToPixel(16),
convertDpToPixel(13)
);
title.setAllCaps(true);
title.setTextColor(Themes.getTextAttr());
container.addView(title, new LinearLayout.LayoutParams(-2, -2));
return container;
}
@Override
public void onBindViewHolder(@NonNull CategorizedViewHolder viewHolder, int i) {
if (getItemViewType(i) == MOVING_ITEM)
mBinder.bind(viewHolder, i);
else
viewHolder.bindCategory(i == 0);
}
@Override
public int getItemCount() {
return mSelectedItems.size() + mDisabledItems.size() + 2;
}
@Override
public void onItemDismiss(int index) {
if (getItemViewType(index) == MOVING_ITEM ) {
Object curr;
if (getTabType(index) == SELECTED_STATE) {
curr = mSelectedItems.get(index - 1);
mSelectedItems.remove(curr);
mDisabledItems.add(0, curr);
notifyItemMoved(index, mSelectedItems.size() + 1);
} else {
curr = mDisabledItems.get(index - mSelectedItems.size() - 2);
mDisabledItems.remove(curr);
mSelectedItems.add(0, curr);
notifyItemRemoved(index);
notifyItemInserted(1);
}
}
}
@Override
public boolean onItemMove(int fromPosition, int toPosition) {
if (toPosition == 0 || isUnmovedItem(toPosition))
return false;
Object curr;
if (getTabType(fromPosition) == SELECTED_STATE) {
var min = mSelectedItems.size() == mMinSelectedItems;
if (getTabType(toPosition) == DISABLED_STATE && min)
return false;
curr = mSelectedItems.get(fromPosition - 1);
if (getItemViewType(toPosition) == CATEGORY_TITLE) {
if (min)
return false;
mSelectedItems.remove(fromPosition - 1);
mDisabledItems.add(0, curr);
} else {
Collections.swap(mSelectedItems, fromPosition - 1, toPosition - 1);
}
} else if (getTabType(fromPosition) == DISABLED_STATE) {
var max = mSelectedItems.size() == mMaxSelectedItems;
if (getTabType(toPosition) == SELECTED_STATE && max)
return false;
curr = mDisabledItems.get(fromPosition - mSelectedItems.size() - 2);
if (getItemViewType(toPosition) == CATEGORY_TITLE) {
if (max)
return false;
mDisabledItems.remove(0);
mSelectedItems.add(curr);
} else {
Collections.swap(mDisabledItems,
fromPosition - mSelectedItems.size() - 2,
toPosition - mSelectedItems.size() - 2);
}
}
notifyItemMoved(fromPosition, toPosition);
return true;
}
public static class CategorizedViewHolder extends RecyclerView.ViewHolder {
private final LinearLayout mMovingItemContainer;
private final ImageView mIcon;
private final TextView mName;
private final LinearLayout mCategoryTitleContainer;
private final TextView mCategoryTitle;
public CategorizedViewHolder(View itemView) {
super(itemView);
mMovingItemContainer = itemView.findViewWithTag("container");
mCategoryTitleContainer = itemView.findViewWithTag("category_title_container");
mIcon = mMovingItemContainer.findViewWithTag("icon");
mName = mMovingItemContainer.findViewWithTag("name");
mCategoryTitle = mCategoryTitleContainer.findViewWithTag("category_title");
}
public void bindMovingItem(int iconId, int textId) {
if (iconId != -1)
mIcon.setImageResource(iconId);
else
mIcon.setVisibility(View.GONE);
mName.setText(textId);
mMovingItemContainer.setVisibility(View.VISIBLE);
mCategoryTitleContainer.setVisibility(View.INVISIBLE);
}
public void bindMovingItem(String text) {
mIcon.setVisibility(View.GONE);
mName.setText(text);
mMovingItemContainer.setVisibility(View.VISIBLE);
mCategoryTitleContainer.setVisibility(View.INVISIBLE);
}
public void bindCategory(boolean fist) {
mCategoryTitle.setText(getString(fist ? "selected_items" : "unselected_items"));
mCategoryTitleContainer.setVisibility(View.VISIBLE);
mMovingItemContainer.setVisibility(View.INVISIBLE);
}
}
public interface IViewHolderBinder {
void bind(CategorizedViewHolder holder, int pos);
}
}
@@ -0,0 +1,172 @@
package ru.vtosters.lite.ui.adapters;
import static ru.vtosters.lite.utils.Themes.getTextAttr;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckedTextView;
import android.widget.ImageView;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import ru.vtosters.lite.utils.Globals;
import ru.vtosters.lite.utils.LayoutHelper;
public class ImagineArrayAdapter extends ArrayAdapter<ImagineArrayAdapter.ImagineArrayAdapterItem> {
private List<ImagineArrayAdapterItem> mItems = new ArrayList<>();
private OnClickListener mListener;
private int mSelectedIndex = -1;
public ImagineArrayAdapter(@NonNull Context context, OnClickListener listener) {
super(context, 0);
this.mListener = listener;
}
public ImagineArrayAdapter(@NonNull Context context, List<ImagineArrayAdapterItem> items, OnClickListener listener) {
super(context, 0, items);
mItems = items;
this.mListener = listener;
}
public void setSelected(int i) {
this.mSelectedIndex = i;
}
@Override
public int getCount() {
return mItems.size();
}
public void add(ImagineArrayAdapterItem item) {
mItems.add(item);
super.add(item);
}
public void add(Drawable icon, String text) {
var item = new ImagineArrayAdapterItem(icon, text);
mItems.add(item);
super.add(item);
}
public void add(int iconId, String text) {
var icon = Globals.getResources().getDrawable(iconId);
var item = new ImagineArrayAdapterItem(icon, text);
mItems.add(item);
super.add(item);
}
public void add(Drawable icon, int textId) {
var text = Globals.getResources().getString(textId);
var item = new ImagineArrayAdapterItem(icon, text);
mItems.add(item);
super.add(item);
}
public void add(int iconId, int textId) {
var icon = Globals.getResources().getDrawable(iconId);
var text = Globals.getResources().getString(textId);
var item = new ImagineArrayAdapterItem(icon, text);
mItems.add(item);
super.add(item);
}
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
var container = new LinearLayout(getContext());
container.setOrientation(LinearLayout.HORIZONTAL);
container.setGravity(Gravity.CENTER_VERTICAL);
container.setPadding(0, Globals.convertDpToPixel(5.0f), 0, Globals.convertDpToPixel(5.0f));
container.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
container.setOnClickListener(v -> {
if (position != mSelectedIndex) {
mListener.onClick(position);
}
});
// if make radiobutton without layout inflation it can't be unclickable
var checkedTextView = (CheckedTextView) LayoutInflater.from(getContext())
.inflate(Globals.getIdentifier("select_dialog_singlechoice_material", "layout"), parent, false);
checkedTextView.setChecked(position == mSelectedIndex);
container.addView(checkedTextView, LayoutHelper.createLinear(Globals.convertDpToPixel(50.0f), -2));
var item = mItems.get(position);
var imageView = new ImageView(getContext());
imageView.setImageDrawable(item.getIcon());
imageView.setPadding(
Globals.convertDpToPixel(13.0f),
0,
0,
0
);
var imageViewParams = LayoutHelper.createLinear(
Globals.convertDpToPixel(50.0f),
Globals.convertDpToPixel(50.0f)
);
container.addView(imageView, imageViewParams);
var textView = new CheckedTextView(getContext());
textView.setText(item.getText());
textView.setTextColor(getTextAttr());
textView.setPadding(
Globals.convertDpToPixel(13.0f),
Globals.convertDpToPixel(5.0f),
Globals.convertDpToPixel(5.0f),
Globals.convertDpToPixel(5.0f));
textView.setTextSize(18.0f);
textView.setGravity(Gravity.CENTER_VERTICAL);
var textViewParams = LayoutHelper.createLinear(-2, -1);
container.addView(textView, textViewParams);
return container;
}
public static class ImagineArrayAdapterItem {
private Drawable mIcon;
private String mText;
public ImagineArrayAdapterItem(Drawable icon, String text) {
this.mIcon = icon;
this.mText = text;
}
public ImagineArrayAdapterItem(int iconId, String text) {
this.mIcon = Globals.getResources().getDrawable(iconId);
this.mText = text;
}
public ImagineArrayAdapterItem(Drawable icon, int textId) {
this.mIcon = icon;
this.mText = Globals.getResources().getString(textId);
}
public ImagineArrayAdapterItem(int iconId, int textId) {
this.mIcon = Globals.getResources().getDrawable(iconId);
this.mText = Globals.getResources().getString(textId);
}
public Drawable getIcon() {
return mIcon;
}
public String getText() {
return mText;
}
}
public interface OnClickListener {
public void onClick(int i);
}
}
@@ -0,0 +1,96 @@
package ru.vtosters.lite.ui.adapters;
import static ru.vtosters.lite.utils.Themes.getTextAttr;
import android.content.Context;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.vk.core.widget.BubbleFluidLayout;
import com.vk.im.ui.views.msg.bubble.MsgBubbleView;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.Globals;
public class MessagesPreviewAdapter extends RecyclerView.Adapter<MessagesPreviewAdapter.MessagePreviewViewHolder> {
private static final int ME = 0x0;
private static final int ANONYMOUS = -0x1;
private final String[] mMessages = {
"Доброе время", "Доброе утро, день, вечер. ночь", "Как живёшь?", "Не мёртвый, и то хорошо"
};
@Override
public int getItemViewType(int i) {
return i % 2 == 0 ? ANONYMOUS : ME;
}
@NonNull
@Override
public MessagePreviewViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int viewType) {
Context context = viewGroup.getContext();
var bubbleFluidLayout = (BubbleFluidLayout) LayoutInflater.from(context).inflate(R.layout.vkim_msg_list_item_msg_from_user, viewGroup, false);
bubbleFluidLayout.findViewById(R.id.avatar).setVisibility(View.GONE);
bubbleFluidLayout.findViewById(R.id.avatar_space).setVisibility(View.GONE);
bubbleFluidLayout.findViewById(R.id.vkim_channel_share).setVisibility(View.GONE);
bubbleFluidLayout.findViewById(R.id.status).setVisibility(View.GONE);
bubbleFluidLayout.findViewById(R.id.status_space).setVisibility(View.GONE);
var messageBubbleView = (MsgBubbleView) bubbleFluidLayout.findViewById(R.id.bubble);
messageBubbleView.setContentPaddingLeft(Globals.convertDpToPixel(5));
messageBubbleView.setContentPaddingTop(Globals.convertDpToPixel(5));
messageBubbleView.setContentPaddingRight(Globals.convertDpToPixel(5));
messageBubbleView.setContentPaddingBottom(Globals.convertDpToPixel(5));
bubbleFluidLayout.setGravity(viewType == ME ? Gravity.RIGHT : Gravity.LEFT);
var message = new TextView(context);
message.setTag("message");
message.setGravity(Gravity.LEFT);
message.setTextColor(getTextAttr());
messageBubbleView.setContentView(message);
return new MessagePreviewViewHolder(bubbleFluidLayout);
}
@Override
public void onBindViewHolder(@NonNull MessagePreviewViewHolder viewHolder, int pos) {
viewHolder.bind(mMessages[pos]);
}
@Override
public int getItemCount() {
return mMessages.length;
}
private static int getColorFromAttribute(Context context, int attrId) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(attrId, typedValue, true);
return typedValue.data;
}
protected static class MessagePreviewViewHolder extends RecyclerView.ViewHolder {
private final TextView mMessage;
public MessagePreviewViewHolder(@NonNull View view) {
super(view);
mMessage = view.findViewWithTag("message");
}
public void bind(String text) {
mMessage.setText(text);
}
}
}
@@ -1,4 +1,4 @@
package ru.vtosters.lite.ui.fragments.tgstickers;
package ru.vtosters.lite.ui.adapters;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
@@ -0,0 +1,268 @@
package ru.vtosters.lite.ui.components;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getPreferences;
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;
import com.vk.apps.AppsFragment;
import com.vk.discover.ThemedFeedFragment;
import com.vk.fave.fragments.FaveTabFragment;
import com.vk.feedlikes.d.FeedLikesFragment;
import com.vk.friends.catalog.FriendsCatalogFragment;
import com.vk.menu.MenuFragment;
import com.vk.menu.SearchMenuFragment;
import com.vk.music.fragment.MusicCatalogFragment1;
import com.vk.music.fragment.MusicFragment;
import com.vk.newsfeed.HomeFragment;
import com.vk.newsfeed.NewsfeedFragment;
import com.vk.notifications.NotificationsContainerFragment;
import com.vk.profile.catalog.CommunitiesCatalogFragment;
import com.vk.superapp.SuperAppFragment;
import com.vtosters.lite.R;
import com.vtosters.lite.fragments.ProfileFragment;
import com.vtosters.lite.fragments.friends.FriendsFragment;
import com.vtosters.lite.fragments.gifts.BirthdaysFragment;
import com.vtosters.lite.fragments.lives.LivesTabsFragment;
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;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import ru.vtosters.lite.ui.items.DockBarTab;
import ru.vtosters.lite.utils.Globals;
public class DockBarEditorManager {
public static final int MIN_SELECTED_TABS = 3;
public static final int MAX_SELECTED_TABS = 9;
private final List<DockBarTab> mSelectedTabs = new ArrayList<>();
private final List<DockBarTab> mDisabledTabs = new ArrayList<>();
private static DockBarEditorManager sInstance;
public static DockBarEditorManager getInstance() {
return sInstance == null
? (sInstance = new DockBarEditorManager())
: sInstance;
}
public DockBarEditorManager() {
init();
}
private void init() {
if (vkme()) {
mSelectedTabs.add(getTabByTag("tab_settings"));
if (vkme_notifs()) {
if (milkshake()) {
mSelectedTabs.add(getTabByTag("tab_feedback"));
} else {
mSelectedTabs.add(getTabByTag("tab_friends"));
}
}
mSelectedTabs.add(getTabByTag("tab_messages"));
mSelectedTabs.add(getTabByTag("tab_profile"));
return;
}
checkOldConfig();
String[] selectedTabsTags = getPreferences().getString("dockbar_tabs", "tab_news,tab_superapps,tab_messages,tab_friends,tab_profile")
.split(",");
parseSelectedTabs(selectedTabsTags);
}
private void checkOldConfig() {
File config = new File(getContext().getFilesDir(), "dockbar.json");
if (config.exists()) config.deleteOnExit();
}
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"));
for (String tag : selectedTabsTags) {
mSelectedTabs.add(getTabByTag(tag));
allTags.remove(tag);
}
allTags.forEach(tag -> mDisabledTabs.add(getTabByTag(tag)));
}
public void save() {
Globals.getPreferences().edit().putString("dockbar_tabs", mSelectedTabs.stream()
.map(tab -> tab.tag)
.collect(Collectors.joining(",")))
.commit();
}
public void reset() {
Globals.getPreferences()
.edit()
.putString("dockbar_tabs", "tab_news,tab_superapps,tab_messages,tab_friends,tab_profile")
.commit();
}
public List<DockBarTab> getSelectedTabs() {
return mSelectedTabs;
}
public List<DockBarTab> getDisabledTabs() {
return mDisabledTabs;
}
private DockBarTab getTabByTag(String tag) {
switch (tag) {
case "tab_news":
return DockBarTab.valuesOf(
"tab_news",
R.drawable.ic_menu_newsfeed_outline_28,
R.string.newsfeed,
R.id.tab_news,
milkshake() ? HomeFragment.class : NewsfeedFragment.class);
case "tab_superapps":
return DockBarTab.valuesOf(
"tab_superapps",
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);
case "tab_messages":
return DockBarTab.valuesOf(
"tab_messages",
R.drawable.ic_message_outline_28,
R.string.messages,
R.id.tab_messages,
DialogsFragment.class);
case "tab_feedback":
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.not_notifications,
R.id.tab_feedback,
!milkshake() ? FriendsFragment.class : NotificationsContainerFragment.class);
case "tab_profile":
return DockBarTab.valuesOf(
"tab_profile",
milkshake() ? R.drawable.ic_user_circle_outline_28 : R.drawable.ic_menu_more_outline_28,
milkshake() ? R.string.profile : R.string.menu,
R.id.tab_menu,
milkshake() ? ProfileFragment.class : MenuFragment.class);
case "tab_friends":
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.not_notifications,
R.id.menu_friends,
milkshake() ? FriendsCatalogFragment.class : NotificationsContainerFragment.class);
case "tab_groups":
return DockBarTab.valuesOf(
"tab_groups",
R.drawable.users_3_outline_28,
R.string.groups,
R.id.menu_groups,
milkshake() ? CommunitiesCatalogFragment.class : GroupsFragment1.class);
case "tab_photos":
return DockBarTab.valuesOf(
"tab_photos",
R.drawable.ic_camera_outline_28,
R.string.photos,
R.id.menu_photos,
PhotosFragment.class);
case "tab_audios":
return DockBarTab.valuesOf(
"tab_audios",
R.drawable.ic_music_outline_28,
R.string.music,
R.id.menu_audios,
getBoolValue("musicnewcatalog", true) ? MusicCatalogFragment1.class : MusicFragment.class);
case "tab_videos":
return DockBarTab.valuesOf(
"tab_videos",
R.drawable.ic_video_outline_28,
R.string.videos,
R.id.menu_videos,
videoewcatalog() ? VideoCatalogFragment.class : VideosFragment.class);
case "tab_lives":
return DockBarTab.valuesOf(
"tab_lives",
R.drawable.ic_live_outline_28,
R.string.sett_live,
R.id.menu_lives,
LivesTabsFragment.class);
case "tab_games":
return DockBarTab.valuesOf(
"tab_games",
R.drawable.ic_games_outline_36,
R.string.games,
R.id.menu_games,
GamesFragment.class);
case "tab_liked":
return DockBarTab.valuesOf(
"tab_liked",
R.drawable.ic_like_outline_28,
R.string.sett_likes,
R.id.menu_feed_likes,
FeedLikesFragment.class);
case "tab_fave":
return DockBarTab.valuesOf(
"tab_fave",
R.drawable.ic_favorite_outline_28,
R.string.fave_title,
R.id.menu_fave,
FaveTabFragment.class);
case "tab_documents":
return DockBarTab.valuesOf(
"tab_documents",
R.drawable.ic_document_outline_28,
R.string.docs,
R.id.menu_documents,
DocumentsViewFragment.class);
case "tab_payments":
return DockBarTab.valuesOf(
"tab_payments",
R.drawable.ic_money_transfer_outline_28,
R.string.money_transfer_money,
R.id.menu_payments,
MoneyTransfersFragment.class);
case "tab_vk_apps":
return DockBarTab.valuesOf(
"tab_vk_apps",
R.drawable.ic_services_outline_28,
R.string.menu_apps,
R.id.menu_vk_apps,
AppsFragment.class);
case "tab_menu":
return DockBarTab.valuesOf(
"tab_menu",
milkshake() ? R.drawable.ic_user_circle_outline_28 : R.drawable.ic_menu_more_outline_28,
milkshake() ? R.string.profile : R.string.menu,
R.id.tab_menu,
milkshake() ? ProfileFragment.class : MenuFragment.class);
case "tab_settings":
default:
return DockBarTab.valuesOf(
"tab_settings",
R.drawable.ic_settings_outline_28,
R.string.menu_settings,
R.id.menu_settings,
useNewSettings());
}
}
}
@@ -1,6 +1,6 @@
package ru.vtosters.lite.ui.fragments.dockbar;
package ru.vtosters.lite.ui.components;
public interface IItemTouchHelper{
public interface IItemMovingListener {
void onItemDismiss(int index);
@@ -0,0 +1,48 @@
package ru.vtosters.lite.ui.components;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
public class ItemMovingCallback extends ItemTouchHelper.Callback {
private final CategorizedAdapter mAdapter;
public ItemMovingCallback(CategorizedAdapter adapter){
this.mAdapter = adapter;
}
@Override
public boolean isLongPressDragEnabled(){
return true;
}
@Override
public boolean isItemViewSwipeEnabled() {
return true;
}
@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
? ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT
: 0;
return makeMovementFlags(dragFlags, swipeFlags);
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction) {
mAdapter.onItemDismiss(viewHolder.getAdapterPosition());
}
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target){
return mAdapter.onItemMove(viewHolder.getAdapterPosition(), target.getAdapterPosition());
}
}
@@ -0,0 +1,105 @@
package ru.vtosters.lite.ui.components;
import static ru.vtosters.lite.utils.Globals.getPreferences;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import ru.vtosters.lite.ui.items.SuperAppItem;
import ru.vtosters.lite.utils.Globals;
public class SuperAppEditorManager {
private final List<SuperAppItem> mSelectedItems = new ArrayList<>();
private final List<SuperAppItem> mDisabledItems = new ArrayList<>();
private static SuperAppEditorManager sInstance;
public static SuperAppEditorManager getInstance() {
return sInstance == null
? (sInstance = new SuperAppEditorManager())
: sInstance;
}
public SuperAppEditorManager() {
init();
}
private void init() {
var tmp = getPreferences().getString("superapp_items", "menu,promo,miniapps,vkpay_slim,greeting,holiday,weather,sport,games,informer,food,event,music,vk_run");
var selectedTags = !tmp.isEmpty() ? tmp.split(",") : new String[0];
parseSelectedItems(selectedTags);
}
private void parseSelectedItems(String[] selectedTabsTags) {
List<String> allTags = new ArrayList<>(Arrays.asList( "menu", "promo", "miniapps", "vkpay_slim", "greeting", "holiday",
"weather", "sport", "games", "informer", "food", "event", "music", "vk_run" ));
for (String tag : selectedTabsTags) {
mSelectedItems.add(getItemByTag(tag));
allTags.remove(tag);
}
allTags.forEach(tag -> mDisabledItems.add(getItemByTag(tag)));
}
public void save() {
if (mSelectedItems.size() > 0)
getPreferences().edit().putString("superapp_items", mSelectedItems.stream()
.map(item -> item.type)
.collect(Collectors.joining(",")))
.commit();
else
reset();
}
public void reset() {
Globals.getPreferences()
.edit()
.putString("superapp_items", "menu,promo,vkpay_slim,greeting,holiday,informer,event,miniapps,weather,sport,games,food,music,vk_run")
.commit();
}
public List<SuperAppItem> getSelectedTabs() {
return mSelectedItems;
}
public List<SuperAppItem> getDisabledTabs() {
return mDisabledItems;
}
private SuperAppItem getItemByTag(String tag) {
switch (tag) {
case "menu":
return SuperAppItem.valuesOf("menu", "Меню приложения");
case "promo":
return SuperAppItem.valuesOf("promo", "Mini Apps: промо");
case "miniapps":
return SuperAppItem.valuesOf("miniapps", "Mini Apps: виджет");
case "vkpay_slim":
return SuperAppItem.valuesOf("vkpay_slim", "VK Pay");
case "greeting":
return SuperAppItem.valuesOf("greeting", "Приветствие");
case "holiday":
return SuperAppItem.valuesOf("holiday", "Дни рождения у друзей");
case "weather":
return SuperAppItem.valuesOf("weather", "Погода");
case "sport":
return SuperAppItem.valuesOf("sport", "Спортивные события");
case "games":
return SuperAppItem.valuesOf("games", "Игры");
case "informer":
return SuperAppItem.valuesOf("informer", "Информер");
case "food":
return SuperAppItem.valuesOf("food", "Еда");
case "event":
return SuperAppItem.valuesOf("event", "Мероприятия");
case "music":
return SuperAppItem.valuesOf("music", "Музыка");
case "vk_run":
return SuperAppItem.valuesOf("vk_run", "VK Run");
default:
return null;
}
}
}
@@ -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();
@@ -30,7 +30,8 @@ public class OTADialog implements OTAHelper.OTAListener{
mActivity.runOnUiThread(() -> {
// Toast.makeText(mActivity, "Обновления найдены", Toast.LENGTH_SHORT).show();
new ModalBottomSheetWrapper(mActivity)
.setUpdateInfoView(mHelper.getNewVersionName(), mHelper.getUpdateDescription())
.setTitle(getString("newversion") + " " + mHelper.getNewVersionName())
.setUpdateInfoView(mHelper.getUpdateDescription())
.setPositiveButton(getString("updateanddownload"), () -> {
OTADownloader.downloadBuild(mHelper.getDownloadUrl());
})
@@ -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);
@@ -0,0 +1,72 @@
package ru.vtosters.lite.ui.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import com.vk.core.fragments.FragmentImpl;
import com.vtosters.lite.R;
import com.vtosters.lite.ViewUtils;
import com.vtosters.lite.m0.ToolbarHelper;
import ru.vtosters.lite.utils.LayoutHelper;
public abstract class BaseToolbarFragment extends FragmentImpl {
private FrameLayout mRootView;
private Toolbar mToolbar;
private FrameLayout mContentLayout;
@CallSuper
protected void onCreateMenu(Menu menu) {
if (menu.size() > 0)
for (int i = 0; i < menu.size(); i++)
menu.getItem(i).setOnMenuItemClickListener(this::onOptionsItemSelected);
}
public void setTitle(String title) {
mToolbar.setTitle(title);
}
public void setTitle(int id) {
mToolbar.setTitle(id);
}
public void setNavigationIconEnabled(boolean enabled) {
if (enabled) {
ViewUtils.a(mToolbar, R.drawable.ic_back_outline_28);
} else {
ToolbarHelper.a(this, mToolbar);
}
}
@Nullable
@Override
public final View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle bundle) {
super.onCreateView(inflater, parent, bundle);
mRootView = (FrameLayout) inflater.inflate(R.layout.appkit_toolbar_fragment, parent, false);
mToolbar = mRootView.findViewById(R.id.toolbar);
mContentLayout = mRootView.findViewById(R.id.appkit_content);
initToolbar();
mContentLayout.addView(onCreateContent(inflater, bundle), LayoutHelper.createFrame(-1, -1));
return mRootView;
}
public abstract View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle);
private void initToolbar() {
setNavigationIconEnabled(false);
onCreateMenu(mToolbar.getMenu());
}
}
@@ -1,4 +1,4 @@
package ru.vtosters.lite.ui.fragments.dockbar;
package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
@@ -9,37 +9,32 @@ import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import com.vtosters.lite.R;
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
import ru.vtosters.lite.ui.components.DockBarEditorManager;
import ru.vtosters.lite.ui.components.ItemMovingCallback;
import ru.vtosters.lite.utils.Globals;
public class DockBarEditorFragment extends MaterialPreferenceToolbarFragment{
private RecyclerView mRecycler;
private DockBarEditorAdapter mAdapter;
private ItemTouchHelperCallback mCallback;
private ItemTouchHelper mItemTouchHelper;
public class DockBarEditorFragment extends BaseToolbarFragment {
@CallSuper
@Override
public int T4(){
return getIdentifier("dockbar_editor", "string");
}
public View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle) {
setTitle(getIdentifier("dockbar_editor", "string"));
@Override
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle){
View root = super.onCreateView(layoutInflater, viewGroup, bundle);
FrameLayout content = root.findViewById(R.id.appkit_content);
FrameLayout content = new FrameLayout(getContext());
LinearLayout container = new LinearLayout(getContext());
container.setOrientation(LinearLayout.VERTICAL);
@@ -54,10 +49,10 @@ public class DockBarEditorFragment extends MaterialPreferenceToolbarFragment{
);
container.addView(buttonsContainer, new LinearLayout.LayoutParams(-1, -2));
TextView save = new TextView(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.VKUIButton_Primary));
save.setText(Globals.getString("dockbar_save"));
TextView save = new TextView(new ContextThemeWrapper(getContext(), R.style.VKUIButton_Primary));
save.setText(Globals.getString("save"));
save.setOnClickListener(v -> {
DockBarManager.getInstance().save();
DockBarEditorManager.getInstance().save();
restartApplication();
});
@@ -68,10 +63,10 @@ public class DockBarEditorFragment extends MaterialPreferenceToolbarFragment{
View divider = new View(getContext());
buttonsContainer.addView(divider, new LinearLayout.LayoutParams(convertDpToPixel(10), 0));
TextView reset = new TextView(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.VKUIButton_Primary));
reset.setText(Globals.getString("dockbar_reset"));
TextView reset = new TextView(new ContextThemeWrapper(getContext(), R.style.VKUIButton_Primary));
reset.setText(Globals.getString("reset"));
reset.setOnClickListener(v -> {
DockBarManager.getInstance().reset();
DockBarEditorManager.getInstance().reset();
restartApplication();
});
@@ -79,19 +74,25 @@ public class DockBarEditorFragment extends MaterialPreferenceToolbarFragment{
resetParams.weight = 1.0f;
buttonsContainer.addView(reset, resetParams);
mRecycler = new RecyclerView(getContext());
mRecycler.setLayoutManager(new LinearLayoutManager(getContext()));
mRecycler.setAdapter((mAdapter = new DockBarEditorAdapter()));
mRecycler.setHasFixedSize(true);
DockBarEditorManager manager = DockBarEditorManager.getInstance();
var adapter = new CategorizedAdapter(manager.getSelectedTabs(), manager.getDisabledTabs(), (holder, pos) -> {
var tab = pos <= manager.getSelectedTabs().size()
? manager.getSelectedTabs().get(pos - 1)
: manager.getDisabledTabs().get(pos - manager.getSelectedTabs().size() - 2);
holder.bindMovingItem(tab.iconID, tab.titleID);
});
adapter.setMinAndMaxCounts(DockBarEditorManager.MIN_SELECTED_TABS, DockBarEditorManager.MAX_SELECTED_TABS);
var recyclerView = new RecyclerView(getContext());
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter);
recyclerView.setHasFixedSize(true);
var params = new LinearLayout.LayoutParams(-1, -1);
params.gravity = Gravity.CENTER;
container.addView(mRecycler, params);
container.addView(recyclerView, params);
mCallback = new ItemTouchHelperCallback(mAdapter);
new ItemTouchHelper(new ItemMovingCallback(adapter)).attachToRecyclerView(recyclerView);
mItemTouchHelper = new ItemTouchHelper(mCallback);
mItemTouchHelper.attachToRecyclerView(mRecycler);
return root;
return content;
}
}
}
@@ -1,17 +1,15 @@
package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.ui.PreferencesUtil.*;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getDrawableFromUrl;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getPackageName;
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.restartApplication;
import static ru.vtosters.lite.utils.Globals.sendToast;
import static ru.vtosters.lite.utils.IconManager.*;
import static ru.vtosters.lite.utils.Preferences.DoNotUseOldIcons;
import static ru.vtosters.lite.utils.IconManager.icons;
import static ru.vtosters.lite.utils.IconManager.iconsValues;
import static ru.vtosters.lite.utils.IconManager.sIconsPlus;
import static ru.vtosters.lite.utils.IconManager.sIconsPlusNames;
import static ru.vtosters.lite.utils.IconManager.switchComponent;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.hasVerification;
import static ru.vtosters.lite.utils.Preferences.preferences;
@@ -35,60 +33,11 @@ import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.view.ContextThemeWrapper;
import androidx.core.content.res.ResourcesCompat;
import com.vk.bridges.AuthBridge;
import com.vk.navigation.Navigator;
import com.vtosters.lite.fragments.w2.BlacklistFragment;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.ui.PreferencesUtil;
import ru.vtosters.lite.utils.Globals;
import ru.vtosters.lite.utils.IconManager;
public class IconsFragment extends MaterialPreferenceToolbarFragment{
@SuppressLint("UseCompatLoadingForDrawables")
@Override
public void onCreate(Bundle bundle){
super.onCreate(bundle);
int vtosterXml = getIdentifier("empty", "xml");
this.addPreferencesFromResource(vtosterXml);
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
PreferencesUtil.addPreference(this, "", "Доступны не все иконки!", "Для разблокировки необходимо сделать пожертование от 99р", "ic_about_outline_28", preference -> {
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://vtosters.app")));
return false;
});
}
PreferencesUtil.addPreferenceCategory(this, "Иконочки");
for (var i = 0; i < icons().size(); i++) {
if (icons().get(i) == null || iconsValues().get(i) == null) return;
String iconname = icons().get(i);
String icon = iconsValues().get(i);
// String icondrawable;
//
// if (icon.contains("vt")) {
// icondrawable = "vt_launcher_round";
// } else if (icon.contains("standard")) {
// icondrawable = "ic_launcher_round";
// } else {
// icondrawable = "ic_launcher_" + icon;
// }
//
// Drawable drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier(icondrawable, "mipmap"), null);
//
// PreferencesUtil.addPreferenceDrawable(this, icon, iconname, "", drawable, preference -> {
PreferencesUtil.addPreference(this, icon, iconname, "", "ic_bug_outline_28", preference -> {
callSelectDialog(this.getContext(), icon);
return false;
});
}
}
@SuppressLint("SetTextI18n")
public static void callSelectDialog(Context ctx, String appicon){
RadioGroup rg = new RadioGroup(ctx);
@@ -99,10 +48,7 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment{
rg.addView(rgDefault);
rg.addView(rgVK);
if (hasVerification()) {
rg.addView(rgVKontakte);
}
rg.addView(rgVKontakte);
rgDefault.setTextSize(TypedValue.COMPLEX_UNIT_PX, convertDpToPixel(14f));
rgVK.setTextSize(TypedValue.COMPLEX_UNIT_PX, convertDpToPixel(14f));
@@ -116,7 +62,7 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment{
rgVK.setText("VK");
rgVK.setTextColor(getTextAttr());
rgVKontakte.setText("VKontakte");
rgVKontakte.setText("ВКонтакте");
rgVKontakte.setTextColor(getTextAttr());
rgVKontakte.setChecked(isZaboronaEnabled());
@@ -158,4 +104,82 @@ public class IconsFragment extends MaterialPreferenceToolbarFragment{
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
alert.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(getAccentColor());
}
@SuppressLint("UseCompatLoadingForDrawables")
@Override
public void onCreate(Bundle bundle){
super.onCreate(bundle);
int vtosterXml = getIdentifier("empty", "xml");
this.addPreferencesFromResource(vtosterXml);
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
addPreference(this, "", "Доступны не все функции!", "Для разблокировки необходимо сделать пожертование от 99р", "ic_about_outline_28", preference -> {
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://vtosters.app")));
return false;
});
}
addPreferenceCategory(this, "Иконки");
for (var i = 0; i < icons().size(); i++) {
if (icons().get(i) == null || iconsValues().get(i) == null) return;
String iconname = icons().get(i);
String icon = iconsValues().get(i);
String icondrawable;
if (icon.equals("vt")) {
icondrawable = "vt_launcher_round";
} else if (icon.contains("standard")) {
icondrawable = "ic_launcher_round";
} else {
icondrawable = "ic_launcher_" + icon;
}
Drawable drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier(icondrawable, "mipmap"), null);
if (drawable == null) {
drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier("ic_bug_outline_28", "drawable"), null);
}
addPreferenceDrawable(this, icon, iconname, "", drawable, preference -> {
callSelectDialog(this.getContext(), icon);
return false;
});
}
if (!hasVerification() && !getBoolValue("dialogrecomm", false)) {
addPreferenceCategory(this, "Недоступные иконки");
for (var i = 2; i < sIconsPlusNames.size(); i++) {
if (sIconsPlusNames.get(i) == null || sIconsPlus.get(i) == null) return;
String iconname = sIconsPlusNames.get(i);
String icon = sIconsPlus.get(i);
String icondrawable;
if (icon.equals("vt")) {
icondrawable = "vt_launcher_round";
} else if (icon.contains("standard")) {
icondrawable = "ic_launcher_round";
} else {
icondrawable = "ic_launcher_" + icon;
}
Drawable drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier(icondrawable, "mipmap"), null);
if (drawable == null) {
drawable = ResourcesCompat.getDrawable(getResources(), getIdentifier("ic_bug_outline_28", "drawable"), null);
}
addPreferenceDrawable(this, icon, iconname, "", drawable, preference -> {
sendToast("Иконка доступна только обладателям верификации");
return false;
});
}
}
}
}
@@ -1,6 +1,7 @@
package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getPreferences;
import static ru.vtosters.lite.utils.Globals.restartApplicationWithTimer;
import android.os.Bundle;
@@ -9,6 +10,8 @@ import androidx.preference.Preference;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.utils.Globals;
public class InterfaceFragment extends MaterialPreferenceToolbarFragment{
@Override
public void onCreate(Bundle bundle){
@@ -20,7 +23,6 @@ public class InterfaceFragment extends MaterialPreferenceToolbarFragment{
private void prefs(){
findPreference("stories").setOnPreferenceClickListener(new restart());
findPreference("swipe").setOnPreferenceClickListener(new restart());
findPreference("dockcounter").setOnPreferenceClickListener(new restart());
}
public boolean restart(Preference preference){
@@ -1,6 +1,9 @@
package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getPreferences;
import static ru.vtosters.lite.utils.Globals.restartApplicationWithTimer;
import static ru.vtosters.lite.utils.Themes.getAccentColor;
import static ru.vtosters.lite.utils.Themes.getAlertStyle;
import static ru.vtosters.lite.utils.Themes.getTextAttr;
@@ -9,15 +12,21 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import androidx.appcompat.app.AlertDialog;
import androidx.preference.Preference;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import java.util.Arrays;
import ru.vtosters.lite.downloaders.VideoDownloader;
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
public class MediaFragment extends MaterialPreferenceToolbarFragment{
public static void download(Context ctx){
@@ -55,6 +64,29 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment{
private void prefs(){
findPreference("download_video").setOnPreferenceClickListener(new MediaFragment.download());
findPreference("dateformat").setOnPreferenceChangeListener(new MediaFragment.restart());
findPreference("select_photo_search_engine").setOnPreferenceClickListener(preference -> {
var items = Arrays.asList(
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("yandex", "drawable"), "Yandex"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("google", "drawable"), "Google"),
new ImagineArrayAdapter.ImagineArrayAdapterItem(getIdentifier("microsoft", "drawable"), "Bing")
);
var alert = new VkAlertDialog.Builder(getActivity())
.create();
var listView = (ListView) LayoutInflater.from(getContext()).inflate(com.vtosters.lite.R.layout.abc_select_dialog_material, null, false);
var adapter = new ImagineArrayAdapter(getContext(), items, i -> {
getPreferences().edit().putInt("search_engine", i).apply();
alert.dismiss();
});
adapter.setSelected(getPreferences().getInt("search_engine", 0));
listView.setAdapter(adapter);
alert.setView(listView);
alert.show();
return true;
});
}
public class download implements Preference.OnPreferenceClickListener{
@@ -64,4 +96,13 @@ public class MediaFragment extends MaterialPreferenceToolbarFragment{
return true;
}
}
public static class restart implements Preference.OnPreferenceChangeListener{
@Override
public boolean onPreferenceChange(Preference preference, Object o){
edit().putString("dateformat", o.toString()).commit();
restartApplicationWithTimer();
return false;
}
}
}
@@ -4,7 +4,6 @@ import static android.widget.Toast.LENGTH_LONG;
import static android.widget.Toast.LENGTH_SHORT;
import static android.widget.Toast.makeText;
import static ru.vtosters.lite.utils.CacheUtils.deleteCache;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getUserToken;
import static ru.vtosters.lite.utils.Globals.restartApplication;
@@ -13,21 +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.DialogInterface;
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;
@@ -40,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());
@@ -64,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) {
@@ -86,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);
@@ -134,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"));
@@ -150,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();
@@ -161,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 {
@@ -0,0 +1,118 @@
package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.restartApplication;
import android.os.Bundle;
import android.view.ContextThemeWrapper;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
import ru.vtosters.lite.ui.components.ItemMovingCallback;
import ru.vtosters.lite.ui.components.SuperAppEditorManager;
import ru.vtosters.lite.utils.Globals;
import ru.vtosters.lite.utils.LayoutHelper;
import ru.vtosters.lite.utils.Themes;
public class SuperAppEditorFragment extends BaseToolbarFragment {
@CallSuper
@Override
public View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle) {
setTitle(getIdentifier("superapp_editor", "string"));
FrameLayout content = new FrameLayout(getContext());
LinearLayout container = new LinearLayout(getContext());
container.setOrientation(LinearLayout.VERTICAL);
content.addView(container, new FrameLayout.LayoutParams(-1, -1));
TextView message = new TextView(getContext());
message.setText(Globals.getString("superapp_editor_message"));
message.setTextSize(16.0f);
message.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
message.setTextColor(Themes.getTextAttr());
message.setPadding(
Globals.convertDpToPixel(10),
Globals.convertDpToPixel(10),
Globals.convertDpToPixel(10),
0
);
container.addView(message, LayoutHelper.createLinear(-1, -2));
LinearLayout buttonsContainer = new LinearLayout(getContext());
buttonsContainer.setPadding(
convertDpToPixel(13),
convertDpToPixel(10),
convertDpToPixel(13),
convertDpToPixel(10)
);
container.addView(buttonsContainer, new LinearLayout.LayoutParams(-1, -2));
TextView save = new TextView(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.VKUIButton_Primary));
save.setText(Globals.getString("save"));
save.setOnClickListener(v -> {
SuperAppEditorManager.getInstance().save();
restartApplication();
});
LinearLayout.LayoutParams saveParams = new LinearLayout.LayoutParams(0, -2);
saveParams.weight = 1.0f;
buttonsContainer.addView(save, saveParams);
View divider = new View(getContext());
buttonsContainer.addView(divider, new LinearLayout.LayoutParams(convertDpToPixel(10), 0));
TextView reset = new TextView(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.VKUIButton_Primary));
reset.setText(Globals.getString("reset"));
reset.setOnClickListener(v -> {
SuperAppEditorManager.getInstance().reset();
restartApplication();
});
LinearLayout.LayoutParams resetParams = new LinearLayout.LayoutParams(0, -2);
resetParams.weight = 1.0f;
buttonsContainer.addView(reset, resetParams);
SuperAppEditorManager manager = SuperAppEditorManager.getInstance();
var adapter = new CategorizedAdapter(manager.getSelectedTabs(), manager.getDisabledTabs(), (holder, pos) -> {
var item = pos <= manager.getSelectedTabs().size()
? manager.getSelectedTabs().get(pos - 1)
: manager.getDisabledTabs().get(pos - manager.getSelectedTabs().size() - 2);
holder.bindMovingItem(item.title);
});
manager.getSelectedTabs().forEach(item -> {
if (item.type.equals("menu"))
adapter.addUnmovedItem(item);
});
manager.getDisabledTabs().forEach(item -> {
if (item.type.equals("menu"))
adapter.addUnmovedItem(item);
});
var recyclerView = new RecyclerView(getContext());
recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
recyclerView.setAdapter(adapter);
recyclerView.setHasFixedSize(true);
var params = new LinearLayout.LayoutParams(-1, -1);
params.gravity = Gravity.CENTER;
container.addView(recyclerView, params);
new ItemTouchHelper(new ItemMovingCallback(adapter)).attachToRecyclerView(recyclerView);
return content;
}
}
@@ -1,7 +1,9 @@
package ru.vtosters.lite.ui.fragments;
import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getPreferences;
import static ru.vtosters.lite.utils.Globals.restartApplicationWithTimer;
import android.content.Context;
@@ -13,7 +15,7 @@ import androidx.preference.Preference;
import com.vk.navigation.Navigator;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import ru.vtosters.lite.ui.wallpapers.WallpaperMenuFragment;
import ru.vtosters.lite.utils.Globals;
public class ThemesFragment extends MaterialPreferenceToolbarFragment{
@@ -31,6 +33,13 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment{
findPreference("darktheme").setOnPreferenceChangeListener(new restartdark());
findPreference("lighttheme").setOnPreferenceChangeListener(new restartlight());
findPreference("iconmanager").setOnPreferenceClickListener(new openicons());
findPreference("dockbar_tab_titles").setOnPreferenceChangeListener((preference, o) -> {
getPreferences().edit().putBoolean("dockbar_tab_titles", (boolean) o).commit();
restartApplication();
return false;
});
findPreference("dockbar_accent").setOnPreferenceClickListener(new restart());
findPreference("dockcounter").setOnPreferenceClickListener(new restart());
}
public class openicons implements Preference.OnPreferenceClickListener{
@@ -1,10 +1,12 @@
package ru.vtosters.lite.ui.fragments;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.isIntegrationEnabled;
import static com.vk.bridges.AuthBridge.logout;
import static ru.vtosters.lite.f0x1d.VTVerifications.vtverif;
import static ru.vtosters.lite.ui.vkui.VBListBuilder.VBListItem;
import static ru.vtosters.lite.ui.vkui.VBListBuilder.buildListOf;
import static ru.vtosters.lite.ui.vkui.VBottomSheetBuilder.VBSContent;
import static ru.vtosters.lite.ui.PreferencesUtil.addListPreferenceIcon;
import static ru.vtosters.lite.ui.PreferencesUtil.addMaterialSwitchPreference;
import static ru.vtosters.lite.ui.PreferencesUtil.addPreference;
import static ru.vtosters.lite.ui.PreferencesUtil.addPreferenceCategory;
import static ru.vtosters.lite.ui.PreferencesUtil.addPreferenceDrawable;
import static ru.vtosters.lite.utils.About.getBuildNumber;
import static ru.vtosters.lite.utils.About.getCommitLink;
import static ru.vtosters.lite.utils.CacheUtils.humanReadableByteCountBin;
@@ -15,9 +17,8 @@ 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.IconManager.icons;
import static ru.vtosters.lite.utils.IconManager.iconsValues;
import static ru.vtosters.lite.utils.Preferences.DoNotUseOldIcons;
import static ru.vtosters.lite.utils.Preferences.ads;
import static ru.vtosters.lite.utils.Preferences.devmenu;
@@ -30,6 +31,8 @@ import static ru.vtosters.lite.utils.Preferences.navbar;
import static ru.vtosters.lite.utils.Preferences.offline;
import static ru.vtosters.lite.utils.Preferences.preferences;
import static ru.vtosters.lite.utils.Preferences.shortinfo;
import static ru.vtosters.lite.utils.Preferences.stories;
import static ru.vtosters.lite.utils.Preferences.superapp;
import static ru.vtosters.lite.utils.Preferences.vkme;
import static ru.vtosters.lite.utils.Themes.getDarkTheme;
import static ru.vtosters.lite.utils.Themes.getLightTheme;
@@ -45,7 +48,6 @@ import android.os.Bundle;
import com.aefyr.tsg.g2.TelegramStickersService;
import com.vk.about.AboutAppFragment;
import com.vk.balance.BalanceFragment;
import com.vk.bridges.AuthBridge;
import com.vk.navigation.Navigator;
import com.vk.notifications.settings.NotificationsSettingsFragment;
import com.vk.webapp.fragments.PrivacyFragment;
@@ -57,24 +59,17 @@ import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import com.vtosters.lite.general.fragments.SettingsAccountFragment;
import com.vtosters.lite.general.fragments.SettingsGeneralFragment;
import java.util.Arrays;
import java.util.List;
import ru.vtosters.lite.ui.PreferencesUtil;
import ru.vtosters.lite.ui.components.DockBarEditorManager;
import ru.vtosters.lite.ui.components.SuperAppEditorManager;
import ru.vtosters.lite.ui.dialogs.OTADialog;
import ru.vtosters.lite.ui.fragments.dockbar.AdapterHelper;
import ru.vtosters.lite.ui.fragments.dockbar.DockBarEditorFragment;
import ru.vtosters.lite.ui.fragments.dockbar.DockBarManager;
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
import ru.vtosters.lite.ui.vkui.VBottomSheetBuilder;
import ru.vtosters.lite.utils.CacheUtils;
import ru.vtosters.lite.utils.Globals;
import ru.vtosters.lite.utils.IconManager;
import ru.vtosters.lite.utils.SSFS;
import ru.vtosters.lite.utils.VKUIwrapper;
public class VTSettings extends MaterialPreferenceToolbarFragment{
public static int hideitems = 0;
public int hideitems = 0;
public static String getValAsString(String stringid, Boolean value){
if (disableSettingsSumms()) return null;
@@ -98,7 +93,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
public static String getDocksumm(){
if (disableSettingsSumms()) return null;
return Globals.getString("vtldocksumm") + ": " + DockBarManager.getInstance().getSelectedTabs().size();
return Globals.getString("vtldocksumm") + ": " + DockBarEditorManager.getInstance().getSelectedTabs().size();
}
public static String getTGSsumm(){
@@ -124,7 +119,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
public static String getSuperappsumm(){
if (disableSettingsSumms()) return null;
return "Скрыто элементов" + ": " + preferences.getInt("superappitems", 0);
return "Скрыто элементов" + ": " + SuperAppEditorManager.getInstance().getDisabledTabs().size();
}
public static String getCachesumm(){
@@ -137,32 +132,32 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
public void onCreate(Bundle bundle){
super.onCreate(bundle);
String feedsumm = getValAsString("vtlfeedsumm", ads());
String docksumm = getDocksumm();
String musicsumm = getValAsString("vtlmediasumm", isIntegrationEnabled());
String msgsumm = getValAsString("vtlmsgsumm", vkme());
String activitysumm = getValAsString("vtlactivitysumm", offline());
String themessumm = getValAsString("vtlthemessumm", navbar());
String tgssumm = getTGSsumm();
String superapp = getSuperappsumm();
String interfacesumm = getValAsString("vtlinterfacesumm", shortinfo());
String proxysumm = getProxysumm();
String othersumm = getValAsString("vtlothersumm", vtverif());
String ssfs = getSSFSsumm();
String about = "Commit: " + getBuildNumber();
var feedsumm = getValAsString("vtlfeedsumm", ads());
var docksumm = getDocksumm();
var msgsumm = getValAsString("vtlmsgsumm", vkme());
var activitysumm = getValAsString("vtlactivitysumm", offline());
var themessumm = getValAsString("vtlthemessumm", navbar());
var tgssumm = getTGSsumm();
var superapp = getSuperappsumm();
var mediasumm = getValAsString("vtlinterfacesumm", shortinfo());
var interfacesumm = getValAsString("showstories", stories());
var proxysumm = getProxysumm();
var othersumm = getValAsString("vtlothersumm", vtverif());
var ssfs = getSSFSsumm();
var about = "Commit: " + getBuildNumber();
int vtosterXml = getIdentifier("empty", "xml");
this.addPreferencesFromResource(vtosterXml);
PreferencesUtil.addPreferenceDrawable(this, "", "Аккаунты", getUsername() + (hasVerification() ? Globals.getString("thanksfordonate") : Globals.getString("getdonate")), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
AuthBridge.logout();
addPreferenceDrawable(this, "", getUsername(), hasVerification() ? Globals.getString("thanksfordonate") : Globals.getString("getdonate"), getDrawableFromUrl(getUserPhoto(), "ic_user_circle_outline_28", true, true), preference -> {
logout();
restartApplication();
return false;
});
PreferencesUtil.addPreferenceCategory(this, Globals.getString("vtsettdarktheme"));
addPreferenceCategory(this, Globals.getString("vtsettdarktheme"));
PreferencesUtil.addMaterialSwitchPreference(this, "isdark", Globals.getString("vtsettdarktheme"), "", !DoNotUseOldIcons() ? "ic_palette_24" : "ic_palette_outline_28", false, (preference, o) -> {
addMaterialSwitchPreference(this, "isdark", Globals.getString("vtsettdarktheme"), "", !DoNotUseOldIcons() ? "ic_palette_24" : "ic_palette_outline_28", false, (preference, o) -> {
boolean value = (boolean) o;
if (!value) { // inverted
@@ -176,7 +171,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
});
if (Build.VERSION.SDK_INT >= 28 && false) { // TODO refactoring system theme
PreferencesUtil.addMaterialSwitchPreference(this, "systemtheme", Globals.getString("appearance_theme_use_system"), Globals.getString("appearance_theme_use_system_summary"), !DoNotUseOldIcons() ? "ic_recent_24" : "ic_recent_outline_28", true, (preference, o) -> {
addMaterialSwitchPreference(this, "systemtheme", Globals.getString("appearance_theme_use_system"), Globals.getString("appearance_theme_use_system_summary"), !DoNotUseOldIcons() ? "ic_recent_24" : "ic_recent_outline_28", true, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("systemtheme", value).commit();
@@ -185,7 +180,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
}
if (!isGmsInstalled()) {
PreferencesUtil.addPreference(this, "", Globals.getString("installgms"), "", "ic_warning_24", preference -> {
addPreference(this, "", Globals.getString("installgms"), "", "ic_warning_24", preference -> {
Context context = getContext();
Intent a2 = new Navigator(InstallGMSFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -195,9 +190,9 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
}
if (devmenu()) {
PreferencesUtil.addPreferenceCategory(this, Globals.getString("sett_debug"));
addPreferenceCategory(this, Globals.getString("sett_debug"));
PreferencesUtil.addPreference(this, "", Globals.getString("sett_debug"), "", !DoNotUseOldIcons() ? "ic_bug_24" : "ic_bug_outline_28", preference -> {
addPreference(this, "", Globals.getString("sett_debug"), "", !DoNotUseOldIcons() ? "ic_bug_24" : "ic_bug_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(SettingsDebugFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -205,16 +200,16 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addMaterialSwitchPreference(this, "ssl", Globals.getString("debug_developer_force_ssl"), Globals.getString("debug_developer_force_ssl_summary"), !DoNotUseOldIcons() ? "ic_globe_20" : "ic_globe_outline_28", true, (preference, o) -> {
addMaterialSwitchPreference(this, "ssl", Globals.getString("debug_developer_force_ssl"), Globals.getString("debug_developer_force_ssl_summary"), !DoNotUseOldIcons() ? "ic_globe_20" : "ic_globe_outline_28", true, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("ssl", value).commit();
return true;
});
}
PreferencesUtil.addPreferenceCategory(this, Globals.getString("vtsettaccount"));
addPreferenceCategory(this, Globals.getString("vtsettaccount"));
PreferencesUtil.addPreference(this, "", Globals.getString("vkconnect"), "", !DoNotUseOldIcons() ? "ic_tags_24" : "ic_user_circle_outline_28", preference -> {
addPreference(this, "", Globals.getString("vkconnect"), "", !DoNotUseOldIcons() ? "ic_tags_24" : "ic_user_circle_outline_28", preference -> {
Context context = getContext();
VKUIwrapper.officalLinks("account");
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
@@ -223,7 +218,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("privacy_settings"), "", !DoNotUseOldIcons() ? "ic_privacy_24" : "ic_privacy_outline_28", preference -> {
addPreference(this, "", Globals.getString("privacy_settings"), "", !DoNotUseOldIcons() ? "ic_privacy_24" : "ic_privacy_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(PrivacyFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -231,7 +226,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("sett_account"), "", !DoNotUseOldIcons() ? "ic_user_24" : "ic_user_outline_28", preference -> {
addPreference(this, "", Globals.getString("sett_account"), "", !DoNotUseOldIcons() ? "ic_user_24" : "ic_user_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(SettingsAccountFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -239,16 +234,18 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.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;
});
}
PreferencesUtil.addPreference(this, "", Globals.getString("vtssfs"), ssfs, !DoNotUseOldIcons() ? "ic_link_24" : "ic_link_circle_outline_28", preference -> {
addPreference(this, "", Globals.getString("vtssfs"), ssfs, !DoNotUseOldIcons() ? "ic_link_24" : "ic_link_circle_outline_28", preference -> {
Context context = getContext();
VKUIwrapper.setLink(SSFS.getSSFSLink());
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
@@ -257,9 +254,9 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreferenceCategory(this, Globals.getString("notification_settings"));
addPreferenceCategory(this, Globals.getString("notification_settings"));
PreferencesUtil.addPreference(this, "", Globals.getString("sett_general"), "", !DoNotUseOldIcons() ? "ic_settings_24" : "ic_settings_outline_28", preference -> {
addPreference(this, "", Globals.getString("sett_general"), "", !DoNotUseOldIcons() ? "ic_settings_24" : "ic_settings_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(SettingsGeneralFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -267,7 +264,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("blacklist"), "", !DoNotUseOldIcons() ? "ic_users_24" : "ic_users_outline_28", preference -> {
addPreference(this, "", Globals.getString("blacklist"), "", !DoNotUseOldIcons() ? "ic_users_24" : "ic_users_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(BlacklistFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -275,7 +272,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("sett_notifications"), "", !DoNotUseOldIcons() ? "ic_notification_24" : "ic_menu_notification_outline_28", preference -> {
addPreference(this, "", Globals.getString("sett_notifications"), "", !DoNotUseOldIcons() ? "ic_notification_24" : "ic_menu_notification_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(NotificationsSettingsFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -284,7 +281,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
});
if (VKAccountManager.d().isMusicSubs()) {
PreferencesUtil.addPreference(this, "", Globals.getString("subscription_music"), "", !DoNotUseOldIcons() ? "ic_music_24" : "ic_music_outline_28", preference -> {
addPreference(this, "", Globals.getString("subscription_music"), "", !DoNotUseOldIcons() ? "ic_music_24" : "ic_music_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(MusicSubscriptionControlFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -293,7 +290,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
});
}
PreferencesUtil.addPreference(this, "", Globals.getString("votes"), "", !DoNotUseOldIcons() ? "ic_coins_24" : "ic_coins_outline_28", preference -> {
addPreference(this, "", Globals.getString("votes"), "", !DoNotUseOldIcons() ? "ic_coins_24" : "ic_coins_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(BalanceFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -301,10 +298,10 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreferenceCategory(this, Globals.getString("vtsettmod"));
addPreferenceCategory(this, Globals.getString("vtsettmod"));
if (!vkme()) {
PreferencesUtil.addPreference(this, "", Globals.getString("vtlfeed"), feedsumm, !DoNotUseOldIcons() ? "ic_newsfeed_24" : "ic_newsfeed_outline_28", preference -> {
addPreference(this, "", Globals.getString("vtlfeed"), feedsumm, !DoNotUseOldIcons() ? "ic_newsfeed_24" : "ic_newsfeed_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(FeedFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -312,16 +309,28 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("dockbar_editor"), docksumm, !DoNotUseOldIcons() ? "ic_list_24" : "ic_list_outline_28", preference -> {
addPreference(this, "", Globals.getString("dockbar_editor"), docksumm, !DoNotUseOldIcons() ? "ic_list_24" : "ic_list_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(DockBarEditorFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(a2);
Intent intent = new Navigator(DockBarEditorFragment.class).b(context);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return false;
});
if (milkshake() && superapp()) {
addPreference(this, "", "Редактор Superapp", superapp, "ic_explore_outline_28", (preference) -> {
Context context = getContext();
Intent intent = new Navigator(SuperAppEditorFragment.class).b(context);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
return true;
});
}
} else {
addPreference(this, "", "Внимание!", "Некоторые пункты настроек были скрыты из-за режима VK Me \n\nДля отключения режима перейдите в настройки Сообщений", !DoNotUseOldIcons() ? "ic_about_24" : "ic_about_outline_28", preference -> false);
}
PreferencesUtil.addPreference(this, "", Globals.getString("vtlmedia"), musicsumm, "ic_media_outline_28", preference -> {
addPreference(this, "", Globals.getString("vtlmedia"), mediasumm, "ic_media_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(MediaFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -329,7 +338,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("vtlmessages"), msgsumm, !DoNotUseOldIcons() ? "ic_message_24" : "ic_message_outline_28", preference -> {
addPreference(this, "", Globals.getString("vtlmessages"), msgsumm, !DoNotUseOldIcons() ? "ic_message_24" : "ic_message_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(MessagesFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -337,7 +346,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("vtlactivity"), activitysumm, !DoNotUseOldIcons() ? "ic_write_24" : "ic_write_outline_28_new_accent", preference -> {
addPreference(this, "", Globals.getString("vtlactivity"), activitysumm, !DoNotUseOldIcons() ? "ic_write_24" : "ic_write_outline_28_new_accent", preference -> {
Context context = getContext();
Intent a2 = new Navigator(ActivityFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -345,7 +354,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("vtlthemes"), themessumm, !DoNotUseOldIcons() ? "ic_palette_24" : "ic_write_outline_24", preference -> {
addPreference(this, "", Globals.getString("vtlthemes"), themessumm, !DoNotUseOldIcons() ? "ic_palette_24" : "ic_write_outline_24", preference -> {
Context context = getContext();
Intent a2 = new Navigator(ThemesFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -353,7 +362,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("vtltgs"), tgssumm, !DoNotUseOldIcons() ? "ic_telegram_24" : "ic_telegram_outline_28", preference -> {
addPreference(this, "", Globals.getString("vtltgs"), tgssumm, !DoNotUseOldIcons() ? "ic_telegram_24" : "ic_telegram_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(StickersFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -361,7 +370,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("vtlinterface"), interfacesumm, !DoNotUseOldIcons() ? "ic_interface_24" : "ic_interface_outline_28", preference -> {
addPreference(this, "", Globals.getString("vtlinterface"), interfacesumm, !DoNotUseOldIcons() ? "ic_interface_24" : "ic_interface_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(InterfaceFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -369,14 +378,7 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
if (milkshake()) {
PreferencesUtil.addPreference(this, "", "Настроить Superapp", superapp, "ic_explore_outline_28", (preference) -> {
callEditorPopup();
return true;
});
}
PreferencesUtil.addPreference(this, "", Globals.getString("vtlproxy"), proxysumm, !DoNotUseOldIcons() ? "ic_globe_20" : "ic_globe_outline_28", preference -> {
addPreference(this, "", Globals.getString("vtlproxy"), proxysumm, !DoNotUseOldIcons() ? "ic_globe_20" : "ic_globe_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(ProxySettingsFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -384,13 +386,13 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addListPreferenceIcon(this, "clearcache", "Default", Globals.getString("autoclearcache"), !DoNotUseOldIcons() ? "ic_delete_24" : "ic_delete_outline_28", getCachesumm(), new CharSequence[] {
addListPreferenceIcon(this, "clearcache", "Default", Globals.getString("autoclearcache"), !DoNotUseOldIcons() ? "ic_delete_24" : "ic_delete_outline_28", getCachesumm(), new CharSequence[] {
Globals.getString("autoclearcachedisabled"), "100 MB", "500 MB", "1 GB", "2 GB", "5 GB"
}, new String[] {
"Default", "100mb", "500mb", "1gb", "2gb", "5gb"
}, null);
PreferencesUtil.addPreference(this, "", Globals.getString("vtlother"), othersumm, !DoNotUseOldIcons() ? "ic_more_24" : "ic_more_horizontal_28", preference -> {
addPreference(this, "", Globals.getString("vtlother"), othersumm, !DoNotUseOldIcons() ? "ic_more_24" : "ic_more_horizontal_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(OtherFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -398,9 +400,9 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreferenceCategory(this, Globals.getString("vtsettaboutmod"));
addPreferenceCategory(this, Globals.getString("vtsettaboutmod"));
PreferencesUtil.addPreference(this, "", Globals.getString("menu_about"), about, !DoNotUseOldIcons() ? "ic_about_24" : "ic_about_outline_28", preference -> {
addPreference(this, "", Globals.getString("menu_about"), about, !DoNotUseOldIcons() ? "ic_about_24" : "ic_about_outline_28", preference -> {
Context context = getContext();
Intent a2 = new Navigator(AboutAppFragment.class).b(context);
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -408,30 +410,30 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("opencommit"), "", !DoNotUseOldIcons() ? "ic_link_24" : "ic_link_outline_28", preference -> {
addPreference(this, "", Globals.getString("opencommit"), "", !DoNotUseOldIcons() ? "ic_link_24" : "ic_link_outline_28", preference -> {
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse(getCommitLink())));
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("vtfaq"), Globals.getString("vtfaqsumm"), !DoNotUseOldIcons() ? "ic_help_24" : "ic_help_outline_24", preference -> {
addPreference(this, "", Globals.getString("vtfaq"), Globals.getString("vtfaqsumm"), !DoNotUseOldIcons() ? "ic_help_24" : "ic_help_outline_24", preference -> {
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/s/vtosters_faq")));
return false;
});
PreferencesUtil.addPreference(this, "", Globals.getString("reportbug"), Globals.getString("reportbugsumm"), !DoNotUseOldIcons() ? "ic_bug_24" : "ic_bug_outline_28", preference -> {
addPreference(this, "", Globals.getString("reportbug"), Globals.getString("reportbugsumm"), !DoNotUseOldIcons() ? "ic_bug_24" : "ic_bug_outline_28", preference -> {
getContext().startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://github.com/vtosters/lite/issues")));
return false;
});
if (isValidSignature()) {
PreferencesUtil.addPreferenceCategory(this, Globals.getString("updates"));
addPreferenceCategory(this, Globals.getString("updates"));
PreferencesUtil.addPreference(this, "", Globals.getString("checkforupdates"), "", "ic_download_outline_24", preference -> {
addPreference(this, "", Globals.getString("checkforupdates"), "", "ic_download_outline_24", preference -> {
OTADialog.checkUpdates(getActivity());
return false;
});
PreferencesUtil.addMaterialSwitchPreference(this, "checkupdates", Globals.getString("checkupdates"), "", "ic_recent_outline_28", true, (preference, o) -> {
addMaterialSwitchPreference(this, "checkupdates", Globals.getString("checkupdates"), "", "ic_recent_outline_28", true, (preference, o) -> {
boolean value = (boolean) o;
edit().putBoolean("checkupdates", value).commit();
@@ -441,45 +443,6 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
}
}
private void callEditorPopup(){
hideitems = 0;
List<VBListItem> list = Arrays.asList(
new VBListItem("promo", "Mini Apps: промо"),
new VBListItem("miniapps", "Mini Apps: виджет"),
new VBListItem("vkpay_slim", "VK Pay"),
new VBListItem("greeting", "Приветствие"),
new VBListItem("holiday", "Дни рождения у друзей"),
new VBListItem("weather", "Погода"),
new VBListItem("sport", "Спортивные события"),
new VBListItem("games", "Игры"),
new VBListItem("informer", "Информер"),
new VBListItem("food", "Еда"),
new VBListItem("event", "Мероприятия"),
new VBListItem("music", "Музыка"),
new VBListItem("vk_run", "VK Run")
);
VBottomSheetBuilder.show(getActivity(), new VBSContent(
null,
null,
buildListOf(getActivity(), list),
new VBSContent.VBSButton(
"Сохранить",
() -> {
for (VBListItem item : list) {
edit().putBoolean("superapp_" + item.id, item.checked).commit();
if (item.checked) {
hideitems++;
edit().putInt("superappitems", hideitems).commit();
}
}
}
)
));
}
@Override
public void onResume(){
super.onResume();
@@ -1,32 +0,0 @@
package ru.vtosters.lite.ui.fragments.dockbar;
public class AdapterHelper{
// Adapter item types
public static final int TAB_TYPE = 1;
public static final int CATEGORY_TITLE_TYPE = 2;
// Tab types
public static final int SELECTED = 3;
public static final int DISABLED = 4;
private static final DockBarManager sManager = DockBarManager.getInstance();
public static int getItemViewType(int i){
return i == 0 || sManager.getSelectedTabs().size() + 1 == i ? CATEGORY_TITLE_TYPE : TAB_TYPE;
}
public static int getTabType(int i){
return i <= sManager.getSelectedTabs().size() ? SELECTED : DISABLED;
}
public static boolean needTransfer(int from, int to){
return getItemViewType(from) == TAB_TYPE && getItemViewType(to) == CATEGORY_TITLE_TYPE;
}
public static int getItemCount(){
return sManager.getCategoryTitles().size()
+ sManager.getSelectedTabs().size()
+ sManager.getDisabledTabs().size();
}
}
@@ -1,186 +0,0 @@
package ru.vtosters.lite.ui.fragments.dockbar;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getContext;
import android.content.res.ColorStateList;
import android.graphics.Typeface;
import android.util.Log;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import java.util.Collections;
import ru.vtosters.lite.utils.Themes;
public class DockBarEditorAdapter extends RecyclerView.Adapter<DockBarEditorAdapter.ItemViewHolder>
implements IItemTouchHelper{
private final DockBarManager mDockBarManager = DockBarManager.getInstance();
@Override
public ItemViewHolder onCreateViewHolder(ViewGroup parent, int viewType){
FrameLayout container = new FrameLayout(getContext());
container.addView(newGroupTitle(), new FrameLayout.LayoutParams(-1, -2));
container.addView(newTabItem(), new FrameLayout.LayoutParams(-1, -2));
return new ItemViewHolder(container);
}
private View newTabItem(){
LinearLayout container = new LinearLayout(getContext());
container.setTag("tab_container");
container.setGravity(Gravity.CENTER_VERTICAL);
container.setOrientation(LinearLayout.HORIZONTAL);
container.setPadding(
convertDpToPixel(12),
convertDpToPixel(12),
convertDpToPixel(12),
convertDpToPixel(12)
);
container.setLayoutParams(new LinearLayout.LayoutParams(-1, convertDpToPixel(48)));
container.setVisibility(View.INVISIBLE);
ImageView icon = new ImageView(getContext());
icon.setTag("tab_icon");
icon.setImageTintList(ColorStateList.valueOf(Themes.getAccentColor()));
icon.setLayoutParams(new LinearLayout.LayoutParams(
convertDpToPixel(24),
convertDpToPixel(24)));
container.addView(icon);
TextView name = new TextView(getContext());
name.setTag("tab_name");
name.setTextSize(16.0f);
name.setTypeface(Typeface.DEFAULT_BOLD);
name.setTextColor(Themes.getTextAttr());
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(-1, -2);
params.weight = 1;
params.leftMargin = convertDpToPixel(16);
container.addView(name, params);
return container;
}
private View newGroupTitle(){
LinearLayout container = new LinearLayout(getContext());
container.setTag("category_title_container");
container.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
container.setVisibility(View.INVISIBLE);
TextView title = new TextView(getContext());
title.setTag("category_title");
title.setTextSize(13.0f);
title.setPadding(
convertDpToPixel(16),
convertDpToPixel(13),
convertDpToPixel(16),
convertDpToPixel(13)
);
title.setAllCaps(true);
title.setTextColor(Themes.getTextAttr());
container.addView(title, new LinearLayout.LayoutParams(-2, -2));
return container;
}
@Override
public void onBindViewHolder(ItemViewHolder holder, int position){
holder.bind(position);
}
@Override
public int getItemCount(){
return AdapterHelper.getItemCount();
}
@Override
public void onItemDismiss(int index){
}
@Override
public boolean onItemMove(int fromPosition, int toPosition){
if (toPosition == 0)
return false;
var selectedTabs = mDockBarManager.getSelectedTabs();
var disabledTabs = mDockBarManager.getDisabledTabs();
DockBarTab curr;
if (AdapterHelper.getTabType(fromPosition) == AdapterHelper.SELECTED) {
curr = selectedTabs.get(fromPosition - 1);
if (AdapterHelper.getItemViewType(toPosition) == AdapterHelper.CATEGORY_TITLE_TYPE) {
if (selectedTabs.size() == DockBarManager.MIN_SELECTED_TABS_LIMIT)
return false;
selectedTabs.remove(fromPosition - 1);
disabledTabs.add(curr);
for (int i = disabledTabs.size() - 2; i >= 0; i--) {
var tmp = disabledTabs.get(i + 1);
disabledTabs.set(i + 1, disabledTabs.get(i));
disabledTabs.set(i, tmp);
}
} else {
Collections.swap(selectedTabs, fromPosition - 1, toPosition - 1);
}
} else if (AdapterHelper.getTabType(fromPosition) == AdapterHelper.DISABLED) {
curr = disabledTabs.get(fromPosition - selectedTabs.size() - 2);
if (AdapterHelper.getItemViewType(toPosition) == AdapterHelper.CATEGORY_TITLE_TYPE) {
if (selectedTabs.size() == DockBarManager.MAX_SELECTED_TABS_LIMIT)
return false;
disabledTabs.remove(0);
selectedTabs.add(curr);
} else {
Collections.swap(disabledTabs, fromPosition - selectedTabs.size() - 2, toPosition - selectedTabs.size() - 2);
}
}
notifyItemMoved(fromPosition, toPosition);
return true;
}
protected class ItemViewHolder extends RecyclerView.ViewHolder{
private final LinearLayout mTabContainer;
private final ImageView mTabIcon;
private final TextView mTabName;
private final LinearLayout mCategoryTitleContainer;
private final TextView mCategoryTitle;
public ItemViewHolder(View itemView){
super(itemView);
mTabContainer = itemView.findViewWithTag("tab_container");
mCategoryTitleContainer = itemView.findViewWithTag("category_title_container");
mTabIcon = mTabContainer.findViewWithTag("tab_icon");
mTabName = mTabContainer.findViewWithTag("tab_name");
mCategoryTitle = mCategoryTitleContainer.findViewWithTag("category_title");
}
public void bind(int pos){
Log.d("ItemViewHolder", pos + "");
if (AdapterHelper.getItemViewType(pos) == AdapterHelper.TAB_TYPE) {
DockBarTab tab = AdapterHelper.getTabType(pos) == AdapterHelper.SELECTED
? mDockBarManager.getSelectedTabs().get(pos - 1)
: mDockBarManager.getDisabledTabs().get(pos - mDockBarManager.getSelectedTabs().size() - 2);
mTabIcon.setImageResource(tab.iconID);
mTabName.setText(tab.titleID);
mTabContainer.setVisibility(View.VISIBLE);
mCategoryTitleContainer.setVisibility(View.INVISIBLE);
} else {
mCategoryTitle.setText(mDockBarManager.getCategoryTitles().get(pos == 0 ? 0 : 1));
mCategoryTitleContainer.setVisibility(View.VISIBLE);
mTabContainer.setVisibility(View.INVISIBLE);
}
}
}
}
@@ -1,366 +0,0 @@
package ru.vtosters.lite.ui.fragments.dockbar;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.milkshake;
import static ru.vtosters.lite.utils.Preferences.musicnewcatalog;
import static ru.vtosters.lite.utils.Preferences.superapp;
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
import static ru.vtosters.lite.utils.Preferences.vkme;
import static ru.vtosters.lite.utils.Preferences.vkme_notifs;
import com.vk.apps.AppsFragment;
import com.vk.discover.ThemedFeedFragment;
import com.vk.fave.fragments.FaveTabFragment;
import com.vk.feedlikes.d.FeedLikesFragment;
import com.vk.friends.catalog.FriendsCatalogFragment;
import com.vk.menu.MenuFragment;
import com.vk.menu.SearchMenuFragment;
import com.vk.music.fragment.MusicCatalogFragment1;
import com.vk.music.fragment.MusicFragment;
import com.vk.newsfeed.HomeFragment;
import com.vk.newsfeed.NewsfeedFragment;
import com.vk.notifications.NotificationsContainerFragment;
import com.vk.profile.catalog.CommunitiesCatalogFragment;
import com.vk.superapp.SuperAppFragment;
import com.vtosters.lite.R;
import com.vtosters.lite.fragments.ProfileFragment;
import com.vtosters.lite.fragments.gifts.BirthdaysFragment;
import com.vtosters.lite.fragments.lives.LivesPostListFragment;
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.VideosFragment;
import com.vtosters.lite.general.fragments.GamesFragment;
import com.vtosters.lite.general.fragments.PhotosFragment;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import ru.vtosters.lite.utils.StreamUtils;
public class DockBarManager{
public static final int MIN_SELECTED_TABS_LIMIT = 3;
public static final int MAX_SELECTED_TABS_LIMIT = 9;
private static DockBarManager sInstance = new DockBarManager();
private final List<DockBarTab> mSelectedTabs = new ArrayList<>();
private final List<DockBarTab> mDisabledTabs = new ArrayList<>();
private final List<String> mCategoryTitles = Arrays.asList(
getString("dockbar_selected_items"),
getString("dockbar_unselected_items")
);
private File mConfig;
public DockBarManager(){
init();
}
public static DockBarManager getInstance(){
return sInstance == null
? (sInstance = new DockBarManager())
: sInstance;
}
private void init(){
mConfig = new File(getContext().getFilesDir(), "dockbar.json");
if (vkme()) {
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_settings",
R.drawable.ic_settings_outline_28,
R.string.menu_settings,
R.id.menu_settings,
useNewSettings()));
if (vkme_notifs())
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_feedback",
R.drawable.ic_menu_notification_outline_28,
R.string.feedback,
R.id.tab_feedback,
NotificationsContainerFragment.class));
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_messages",
R.drawable.ic_message_outline_28,
R.string.messages,
R.id.tab_messages,
DialogsFragment.class));
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_profile",
milkshake() ? R.drawable.ic_user_circle_outline_28 : R.drawable.ic_account_outline_28,
R.string.profile,
R.id.tab_menu,
milkshake() ? ProfileFragment.class : MenuFragment.class));
return;
}
if (mConfig.exists()) {
readFromConfig();
} else {
fillDefault();
}
}
private void readFromConfig(){
try {
JSONObject jsonObj = new JSONObject(StreamUtils.readAllLines(mConfig));
fillList(mSelectedTabs, jsonObj.getJSONArray("selected"));
fillList(mDisabledTabs, jsonObj.getJSONArray("disabled"));
} catch (JSONException | IOException | ClassNotFoundException e) {
e.printStackTrace();
}
}
private void fillList(List<DockBarTab> list, JSONArray array) throws JSONException, ClassNotFoundException{
for (int i = 0; i < array.length(); i++) {
JSONObject item = array.getJSONObject(i);
DockBarTab tab = DockBarTab.valuesOf(
item.getString("tag"),
item.getInt("iconID"),
item.getInt("titleID"),
item.getInt("id"),
Class.forName(item.getString("fragmentClass"))
);
if (musicnewcatalog() && MusicFragment.class == tab.fragmentClass)
tab.fragmentClass = MusicCatalogFragment1.class;
else if (MusicCatalogFragment1.class == tab.fragmentClass)
tab.fragmentClass = MusicFragment.class;
if (milkshake()) {
if (NewsfeedFragment.class == tab.fragmentClass)
tab.fragmentClass = HomeFragment.class;
// fix menu visibility
if (MenuFragment.class == tab.fragmentClass) {
tab.fragmentClass = ProfileFragment.class;
tab.iconID = R.drawable.ic_user_circle_outline_28;
}
if (ThemedFeedFragment.class == tab.fragmentClass) {
tab.fragmentClass = SuperAppFragment.class;
tab.iconID = R.drawable.ic_explore_outline_28;
}
if (!superapp() && SuperAppFragment.class == tab.fragmentClass) {
tab.fragmentClass = SearchMenuFragment.class;
}
if (NotificationsContainerFragment.class == tab.fragmentClass) {
tab.fragmentClass = FriendsCatalogFragment.class;
tab.iconID = R.drawable.ic_users_outline_28;
}
if (milkshake() && GroupsFragment1.class == tab.fragmentClass) {
tab.fragmentClass = CommunitiesCatalogFragment.class;
}
} else {
if (HomeFragment.class == tab.fragmentClass)
tab.fragmentClass = NewsfeedFragment.class;
// fix menu visibility
if (ProfileFragment.class == tab.fragmentClass) {
tab.iconID = R.drawable.ic_menu_more_outline_28;
tab.fragmentClass = MenuFragment.class;
}
if (SuperAppFragment.class == tab.fragmentClass) {
tab.iconID = R.drawable.ic_menu_search_outline_28;
tab.fragmentClass = ThemedFeedFragment.class;
}
if (SearchMenuFragment.class == tab.fragmentClass) {
tab.fragmentClass = ThemedFeedFragment.class;
}
if (CommunitiesCatalogFragment.class == tab.fragmentClass) {
tab.fragmentClass = GroupsFragment1.class;
}
if (FriendsCatalogFragment.class == tab.fragmentClass) {
tab.fragmentClass = NotificationsContainerFragment.class;
tab.iconID = R.drawable.ic_menu_notification_outline_28;
}
}
list.add(tab);
}
}
private void fillDefault(){
// fill selected tabs list
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_news",
R.drawable.ic_menu_newsfeed_outline_28,
R.string.newsfeed,
R.id.tab_news,
milkshake() ? HomeFragment.class : NewsfeedFragment.class));
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_superapps",
milkshake() ? R.drawable.ic_explore_outline_28 : R.drawable.ic_menu_search_outline_28,
R.string.super_app_title,
R.id.tab_discover,
milkshake() ? (superapp() ? SuperAppFragment.class : SearchMenuFragment.class) : ThemedFeedFragment.class));
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_messages",
R.drawable.ic_message_outline_28,
R.string.messages,
R.id.tab_messages,
DialogsFragment.class));
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_friends",
milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
R.string.friends,
R.id.tab_feedback,
milkshake() ? FriendsCatalogFragment.class : NotificationsContainerFragment.class));
mSelectedTabs.add(DockBarTab.valuesOf(
"tab_profile",
milkshake() ? R.drawable.ic_user_circle_outline_28 : R.drawable.ic_menu_more_outline_28,
R.string.profile,
R.id.tab_menu,
milkshake() ? ProfileFragment.class : MenuFragment.class));
// fill disabled tabs list
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_feedback",
R.drawable.ic_menu_notification_outline_28,
R.string.feedback,
R.id.tab_feedback,
NotificationsContainerFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_groups",
R.drawable.ic_users_outline_28,
R.string.groups,
R.id.menu_groups,
milkshake() ? CommunitiesCatalogFragment.class : GroupsFragment1.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_photos",
R.drawable.ic_camera_outline_28,
R.string.photos,
R.id.menu_photos,
PhotosFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_audios",
R.drawable.ic_music_outline_28,
R.string.music,
R.id.menu_audios,
getBoolValue("musicnewcatalog", true) ? MusicCatalogFragment1.class : MusicFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_videos",
R.drawable.ic_video_outline_28,
R.string.videos,
R.id.menu_videos,
VideosFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_lives",
R.drawable.ic_live_outline_28,
R.string.sett_live,
R.id.menu_lives,
LivesPostListFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_games",
R.drawable.ic_games_outline_36,
R.string.games,
R.id.menu_games,
GamesFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_liked",
R.drawable.ic_menu_like_24,
R.string.sett_likes,
R.id.menu_feed_likes,
FeedLikesFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_fave",
R.drawable.ic_favorite_outline_28,
R.string.video,
R.id.menu_fave,
FaveTabFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_documents",
R.drawable.ic_document_outline_24,
R.string.docs,
R.id.menu_documents,
DocumentsViewFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_payments",
R.drawable.ic_money_transfer_outline_28,
R.string.money_transfer_money_transfers,
R.id.menu_payments,
MoneyTransfersFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_vk_apps",
R.drawable.ic_services_outline_28,
R.string.menu_apps,
R.id.menu_vk_apps,
AppsFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_settings",
R.drawable.ic_settings_outline_28,
R.string.menu_settings,
R.id.menu_settings,
useNewSettings()));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_menu",
R.drawable.ic_menu_more_outline_28,
R.string.register,
R.id.tab_menu,
MenuFragment.class));
mDisabledTabs.add(DockBarTab.valuesOf(
"tab_brtd",
R.drawable.ic_menu_birthdays,
R.string.birthdays_title,
R.id.menu_birthdays,
BirthdaysFragment.class));
}
public void save(){
try {
JSONObject jsonObj = new JSONObject()
.put("selected", makeJsonArrayWithTabs(mSelectedTabs))
.put("disabled", makeJsonArrayWithTabs(mDisabledTabs));
StreamUtils.writeToFile(mConfig, jsonObj.toString());
} catch (JSONException | IOException e) {
e.printStackTrace();
}
}
public void reset(){
mConfig.deleteOnExit();
}
private JSONArray makeJsonArrayWithTabs(List<DockBarTab> list) throws JSONException{
JSONArray array = new JSONArray();
for (DockBarTab tab : list) {
JSONObject item = new JSONObject()
.put("tag", tab.tag)
.put("iconID", tab.iconID)
.put("titleID", tab.titleID)
.put("id", tab.id)
.put("fragmentClass", tab.fragmentClass.getName());
array.put(item);
}
return array;
}
public List<DockBarTab> getSelectedTabs(){
return mSelectedTabs;
}
public List<DockBarTab> getDisabledTabs(){
return mDisabledTabs;
}
public List<String> getCategoryTitles(){
return mCategoryTitles;
}
}
@@ -1,43 +0,0 @@
package ru.vtosters.lite.ui.fragments.dockbar;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.ItemTouchHelper;
import androidx.recyclerview.widget.RecyclerView;
public class ItemTouchHelperCallback extends ItemTouchHelper.Callback{
private final DockBarEditorAdapter mAdapter;
public ItemTouchHelperCallback(DockBarEditorAdapter mAdapter){
this.mAdapter = mAdapter;
}
@Override
public boolean isLongPressDragEnabled(){
return true;
}
@Override
public boolean isItemViewSwipeEnabled(){
return false;
}
@Override
public int getMovementFlags(@NonNull RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder){
int dragFlags = AdapterHelper.getItemViewType(viewHolder.getAdapterPosition()) != AdapterHelper.CATEGORY_TITLE_TYPE
? ItemTouchHelper.UP | ItemTouchHelper.DOWN
: 0;
return makeMovementFlags(dragFlags, 0);
}
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int direction){
mAdapter.onItemDismiss(viewHolder.getItemViewType());
}
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target){
return mAdapter.onItemMove(viewHolder.getAdapterPosition(), target.getAdapterPosition());
}
}
@@ -2,22 +2,24 @@ package ru.vtosters.lite.ui.fragments.tgstickers;
import static android.widget.Toast.LENGTH_SHORT;
import static android.widget.Toast.makeText;
import static ru.vtosters.lite.tgs.TGPref.setTGBotKey;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Themes.getAccentColor;
import static ru.vtosters.lite.utils.Themes.getAlertStyle;
import android.annotation.SuppressLint;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.ColorStateList;
import android.os.Build;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
@@ -27,8 +29,6 @@ import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.ViewCompat;
import androidx.recyclerview.widget.RecyclerView;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
@@ -36,16 +36,16 @@ import com.aefyr.tsg.g2.TelegramStickersService;
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.vk.navigation.Navigator;
import com.vtosters.lite.R;
import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
import java.io.File;
import ru.vtosters.lite.tgs.TGPref;
import ru.vtosters.lite.ui.PreferencesUtil;
import ru.vtosters.lite.ui.adapters.StickerPackAdapter;
import ru.vtosters.lite.ui.fragments.BaseToolbarFragment;
import ru.vtosters.lite.utils.Globals;
public class StickersFragment extends MaterialPreferenceToolbarFragment{
public class StickersFragment extends BaseToolbarFragment{
public final static String ACTION_RELOAD = "com.vtosters.lite.action.RELOAD_TGS_LIST";
@@ -80,6 +80,15 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
}
};
@Override
protected void onCreateMenu(Menu menu){
var item = menu.add(0, 0, 0, "");
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
item.setIcon(getResources().getDrawable(getIdentifier("ic_settings_24", "drawable")));
super.onCreateMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem arg0){
openMenu(null);
@@ -95,7 +104,6 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
super.getContext().startActivity(intent);
}
@Override
public void onCreate(@Nullable Bundle savedInstanceState){
super.onCreate(savedInstanceState);
@@ -106,23 +114,10 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
}
@Override
public int T4(){
return getIdentifier("vtltgs", "string");
}
public View onCreateContent(@NonNull LayoutInflater inflater, @Nullable Bundle bundle){
setTitle(getIdentifier("vtltgs", "string"));
@SuppressLint("RestrictedApi")
@SuppressWarnings("rawtypes")
@NonNull
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState){
View root = super.onCreateView(inflater, container, savedInstanceState);
FrameLayout layout = root.findViewById(R.id.appkit_content);
Toolbar toolbar = root.findViewById(R.id.toolbar);
var item = toolbar.getMenu().add(0, 0, 0, "");
item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
item.setIcon(getResources().getDrawable(getIdentifier("ic_settings_24", "drawable")));
FrameLayout layout = new FrameLayout(getContext());
mAdapter = new StickerPackAdapter();
mRecycler = new RecyclerView(getContext());
@@ -140,12 +135,12 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
params.setMargins(0, 0, 0, convertDpToPixel(12f));
layout.addView(mAddStickerPack, params);
return root;
return layout;
}
@Override
public void onViewCreated(View arg0, Bundle arg1){
setHasOptionsMenu(true);
super.onViewCreated(arg0, arg1);
}
@@ -173,27 +168,31 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
final EditText editText = new EditText(getContext());
editText.setHintTextColor(PreferencesUtil.getSTextColor(getContext()));
editText.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
// Костыль для китката
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
} else {
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
}
linearLayout.addView(editText);
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
margin.setMargins(convertDpToPixel(24f), 0, convertDpToPixel(24f), 0);
editText.setLayoutParams(margin);
new AlertDialog.Builder(getContext()).setTitle(Globals.getString("stickershelp1"))
.setMessage(Globals.getString("stickershelp2"))
.setView(linearLayout)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
String pack = editText.getText().toString();
pack = parsePack(pack);
mService.requestPackDownload(pack, new File(getContext().getFilesDir(), new File("VT-Stickers", pack).getAbsolutePath()));
}).setNeutralButton(android.R.string.cancel, null).create().show();
var dlg = new AlertDialog.Builder(getContext());
dlg.setTitle(Globals.getString("stickershelp1"));
dlg.setMessage(Globals.getString("stickershelp2"));
dlg.setView(linearLayout);
dlg.setPositiveButton(android.R.string.ok, (dialog, which) -> {
String pack = editText.getText().toString();
pack = parsePack(pack);
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();
alert.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
alert.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getAccentColor());
};
if (TGPref.getTGBotKey() == null) enterBotKey(() -> checkApiKey(callback));
else checkApiKey(callback);
@@ -226,8 +225,7 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
final EditText editText = new EditText(getContext());
editText.setHintTextColor(PreferencesUtil.getSTextColor(getContext()));
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(getContext())));
editText.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
linearLayout.addView(editText);
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
@@ -241,19 +239,24 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
Globals.getString("stickersapi10")).setPositiveButton(android.R.string.ok, null)
.create();
new AlertDialog.Builder(getContext())
.setTitle(Globals.getString("stickersapi5"))
.setMessage(Globals.getString("stickersapi6"))
.setView(linearLayout)
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
TGPref.setTGBotKey(editText.getText().toString());
if (r != null) r.run();
})
.setNegativeButton(android.R.string.cancel, null)
var dlg = new AlertDialog.Builder(getContext());
dlg.setTitle(Globals.getString("stickersapi5"));
dlg.setMessage(Globals.getString("stickersapi6"));
dlg.setView(linearLayout);
dlg.setPositiveButton(android.R.string.ok, (dialog, which) -> {
setTGBotKey(editText.getText().toString());
if (r != null) r.run();
});
dlg.setNegativeButton(android.R.string.cancel, null)
.setNeutralButton(Globals.getString("stickersapi7"),
(dialog, which) -> alert.show())
.create()
.show();
(dialog, which) -> alert.show());
var alerts = dlg.create();
alerts.show();
alerts.getButton(DialogInterface.BUTTON_POSITIVE).setTextColor(getAccentColor());
alerts.getButton(DialogInterface.BUTTON_NEUTRAL).setTextColor(getAccentColor());
alerts.getButton(DialogInterface.BUTTON_NEGATIVE).setTextColor(getAccentColor());
}
private void checkApiKey(Runnable callback){
@@ -272,6 +275,7 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
progressDialog.dismiss();
if (!ok) {
makeText(context, Globals.getString("stickersapi2"), LENGTH_SHORT).show();
setTGBotKey(null);
return;
}
mService.setBotKey(TGPref.getTGBotKey());
@@ -300,5 +304,4 @@ public class StickersFragment extends MaterialPreferenceToolbarFragment{
}
return pack;
}
}
}
@@ -1,4 +1,4 @@
package ru.vtosters.lite.ui.fragments.dockbar;
package ru.vtosters.lite.ui.items;
import com.vk.core.fragments.FragmentImpl;
@@ -0,0 +1,16 @@
package ru.vtosters.lite.ui.items;
public class SuperAppItem {
public String type;
public String title;
public SuperAppItem(String type, String title) {
this.type = type;
this.title = title;
}
public static SuperAppItem valuesOf(String type, String title) {
return new SuperAppItem(type, title);
}
}
@@ -1,8 +1,10 @@
package ru.vtosters.lite.ui.vkui;
import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Globals.getString;
import static ru.vtosters.lite.utils.Themes.getTextAttr;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.graphics.Typeface;
import android.view.View;
@@ -21,27 +23,19 @@ public class ModalBottomSheetWrapper{
}
public ModalBottomSheetWrapper setTitle(String title){
builder.b(title);
builder.d(title);
return this;
}
public ModalBottomSheetWrapper setUpdateInfoView(String version, String changelog){
var context = Globals.getContext();
@SuppressLint("SetTextI18n")
public ModalBottomSheetWrapper setUpdateInfoView(String changelog){
var context = getContext();
var container = new LinearLayout(context);
var title = new TextView(context);
var changelogView = new TextView(context);
container.setOrientation(LinearLayout.VERTICAL);
title.setText(getString("newversion") + " " + version);
title.setTypeface(title.getTypeface(), Typeface.BOLD);
title.setSingleLine(true);
title.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
title.setTextColor(getTextAttr());
title.setTextSize(24.0f);
container.addView(title, new LinearLayout.LayoutParams(-1, -2));
changelogView.setPadding(0, Globals.convertDpToPixel(8), 0, 0);
changelogView.setPadding(0, convertDpToPixel(8), 0, 0);
changelogView.setText(getString("changelog") + ": \n" + changelog);
changelogView.setTextColor(getTextAttr());
container.addView(changelogView, new LinearLayout.LayoutParams(-1, -2));
@@ -51,15 +45,6 @@ public class ModalBottomSheetWrapper{
return this;
}
// try to call a true function and you will understand my pain
public ModalBottomSheetWrapper setMessage(
String text
){
builder.a(text, listener -> {
});
return this;
}
public ModalBottomSheetWrapper setClickableMessage(
String text,
Runnable callback
@@ -76,11 +61,6 @@ public class ModalBottomSheetWrapper{
return this;
}
public ModalBottomSheetWrapper setSubtitle(String text){
builder.b((CharSequence) text);
return this;
}
public ModalBottomSheetWrapper setView(View view){
builder.a(view);
return this;
@@ -1,56 +0,0 @@
package ru.vtosters.lite.ui.vkui;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Themes.getTextAttr;
import android.content.Context;
import android.util.TypedValue;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import androidx.appcompat.widget.AppCompatCheckBox;
import java.util.List;
public class VBListBuilder{
public static ViewGroup buildListOf(Context ctx, List<VBListItem> items){
LinearLayout mainView = new LinearLayout(ctx);
mainView.setOrientation(LinearLayout.VERTICAL);
mainView.setPadding(convertDpToPixel(8f), 0, convertDpToPixel(8f), 0);
for (VBListItem item : items) {
AppCompatCheckBox mcb = new AppCompatCheckBox(ctx, null);
mcb.setPadding(0, convertDpToPixel(8f), 0, convertDpToPixel(8f));
mcb.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14f);
mcb.setTextColor(getTextAttr());
mcb.setChecked(item.checked);
mcb.setText(item.title);
mcb.setOnCheckedChangeListener((buttonView, isChecked) -> {
item.checked = isChecked;
});
mainView.addView(mcb);
}
return mainView;
}
public static class VBListItem{
public String id;
public String title;
public boolean checked;
public VBListItem(String id, String title){
this(id, title, getBoolValue("superapp_" + id, false));
}
public VBListItem(String id, String title, boolean checked){
this.id = id;
this.title = title;
this.checked = checked;
}
}
}
@@ -12,6 +12,8 @@ public class VBottomSheetBuilder{
builder.setView(content.view);
builder.setTitle(content.title);
builder.setPositiveButton(content.button.title, () -> {
// Button OnClick
new Handler(Looper.getMainLooper()).post(content.button.action);
@@ -23,13 +25,11 @@ public class VBottomSheetBuilder{
public static class VBSContent{
public String title;
@Nullable
public String subtitle;
public View view;
public VBSButton button;
public VBSContent(String title, @Nullable String subtitle, View view, VBSButton button){
public VBSContent(String title, @Nullable View view, VBSButton button){
this.title = title;
this.subtitle = subtitle;
this.view = view;
this.button = button;
}
@@ -1,167 +1,71 @@
package ru.vtosters.lite.ui.wallpapers;
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaper;
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaperFile;
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Themes.getSTextAttr;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import ru.vtosters.lite.ui.adapters.MessagesPreviewAdapter;
import ru.vtosters.lite.utils.Themes;
public class WallpaperPreferences extends Preference {
public class WallpaperPreferences extends Preference{
private final Executor mExecutor = Executors.newSingleThreadExecutor();
RecyclerView preview;
ImageView bg;
private Handler mUIHandler;
private MessagesPreviewAdapter mAdapter;
RecyclerView mRecyclerView;
ImageView mChatBackground;
public WallpaperPreferences(Context context){
public WallpaperPreferences(Context context) {
this(context, null, -1, -1);
}
public WallpaperPreferences(Context context, AttributeSet attributeSet){
public WallpaperPreferences(Context context, AttributeSet attributeSet) {
this(context, attributeSet, -1, -1);
}
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr){
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr) {
this(context, attributeSet, defStyleAttr, -1);
}
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr, int i1){
public WallpaperPreferences(Context context, AttributeSet attributeSet, int defStyleAttr, int i1) {
super(context, attributeSet, defStyleAttr, i1);
setLayoutResource(getIdentifier("wppreview", "layout"));
}
public static int getMsgInColor(Context ctx){
TypedValue typedValue = new TypedValue();
ctx.getTheme().resolveAttribute(com.vtosters.lite.R.attr.im_bubble_incoming, typedValue, true);
return typedValue.data;
}
public static int getMsgOutColor(Context ctx){
TypedValue typedValue = new TypedValue();
ctx.getTheme().resolveAttribute(com.vtosters.lite.R.attr.im_bubble_outgoing, typedValue, true);
return typedValue.data;
}
public static int getSTextColor(Context ctx){
TypedValue typedValue = new TypedValue();
ctx.getTheme().resolveAttribute(getSTextAttr(), typedValue, true);
return typedValue.data;
}
@Override
public void onBindViewHolder(PreferenceViewHolder preferenceViewHolder){
public void onBindViewHolder(PreferenceViewHolder preferenceViewHolder) {
super.onBindViewHolder(preferenceViewHolder);
preview = (RecyclerView) preferenceViewHolder.findViewById(getIdentifier("install_btn_container", "id"));
preview.setPadding(0, convertDpToPixel(8), 0, 0);
preview.setLayoutManager(new LinearLayoutManager(getContext()));
preview.setAdapter(new PreviewAdapter());
preview.setClickable(false);
preview.setFocusable(false);
mRecyclerView = (RecyclerView) preferenceViewHolder.findViewById(getIdentifier("install_btn_container", "id"));
mRecyclerView.setPadding(0, convertDpToPixel(8), 0, 0);
mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
mRecyclerView.setAdapter((mAdapter = new MessagesPreviewAdapter()));
mRecyclerView.setClickable(false);
mRecyclerView.setFocusable(false);
mUIHandler = new Handler();
bg = (ImageView) preferenceViewHolder.findViewById(getIdentifier("author", "id"));
mChatBackground = (ImageView) preferenceViewHolder.findViewById(getIdentifier("author", "id"));
requestBg();
}
private void requestBg(){
mExecutor.execute(() -> {
final Drawable drawable = getWallpaper();
private void requestBg() {
final Drawable drawable = getWallpaper();
mUIHandler.post(() -> {
if (drawable != null && getWallpaperFile().exists())
bg.setImageDrawable(drawable);
else
bg.setImageDrawable(null);
});
});
if (drawable != null && getWallpaperFile().exists())
mChatBackground.setImageDrawable(drawable);
else
mChatBackground.setImageDrawable(null);
}
void redraw(){
preview.getAdapter().notifyDataSetChanged();
void redraw() {
mAdapter.notifyDataSetChanged();
requestBg();
}
private static class PreviewAdapter extends RecyclerView.Adapter<PreviewAdapter.PreviewVH>{
private final CharSequence[] previews = new CharSequence[] {
" Привет ", " Привет ", " Ты кто? "
};
private final boolean[] isOut = new boolean[] {
false, true, false
};
@Override
public int getItemCount(){
return previews.length;
}
@Override
public void onBindViewHolder(@NonNull PreviewAdapter.PreviewVH previewVH, int i){
TextView bubble = previewVH.itemView.findViewById(getIdentifier("author", "id"));
bubble.setText(previews[previewVH.getAdapterPosition()]);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
if (isOut[previewVH.getAdapterPosition()]) {
params.addRule(RelativeLayout.ALIGN_PARENT_END);
bubble.setPadding(convertDpToPixel(16), convertDpToPixel(16), convertDpToPixel(24), 0);
bubble.setBackgroundResource(com.vtosters.lite.R.drawable.vkim_msg_new_out_light_full);
bubble.setBackgroundTintList(ColorStateList.valueOf(getMsgOutColor(previewVH.itemView.getContext())));
} else {
params.addRule(RelativeLayout.ALIGN_PARENT_START);
bubble.setPadding(convertDpToPixel(24), convertDpToPixel(16), convertDpToPixel(16), 0);
bubble.setBackgroundResource(com.vtosters.lite.R.drawable.vkim_msg_new_in_light_full);
bubble.setBackgroundTintList(ColorStateList.valueOf(getMsgInColor(previewVH.itemView.getContext())));
}
bubble.setTextColor(Themes.getTextAttr());
bubble.setLayoutParams(params);
}
@NonNull
@Override
public PreviewAdapter.PreviewVH onCreateViewHolder(@NonNull ViewGroup viewGroup, int i){
Context ctx = viewGroup.getContext();
RelativeLayout root = new RelativeLayout(ctx);
root.setLayoutParams(new RelativeLayout.LayoutParams(
RelativeLayout.LayoutParams.MATCH_PARENT,
RelativeLayout.LayoutParams.MATCH_PARENT));
TextView bubble = new TextView(ctx);
bubble.setId(getIdentifier("author", "id"));
root.addView(bubble);
return new PreviewVH(root);
}
private static class PreviewVH extends RecyclerView.ViewHolder{
public PreviewVH(@NonNull View view){
super(view);
}
}
}
}
@@ -7,6 +7,7 @@ import static ru.vtosters.lite.ui.wallpapers.ImageFilters.getMonochrome;
import static ru.vtosters.lite.ui.wallpapers.ImageFilters.getMosaic;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getPreferences;
import static ru.vtosters.lite.utils.Preferences.hasVerification;
import android.graphics.drawable.Drawable;
import android.view.View;
@@ -55,11 +56,13 @@ public class WallpapersHooks{
mWallpaper = getMosaic(mWallpaper);
}
if (getPreferences().getBoolean("msg_monochrome", false)) {
mWallpaper = getMonochrome(mWallpaper);
}
if (hasVerification()) {
if (getPreferences().getBoolean("msg_monochrome", false)) {
mWallpaper = getMonochrome(mWallpaper);
}
mWallpaper = getFilteredDrawable(mWallpaper);
mWallpaper = getFilteredDrawable(mWallpaper);
}
mUpdateWallpaperRequested = false;
}
@@ -1,10 +1,10 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getCurrentActivity;
import static ru.vtosters.lite.utils.Globals.isEmpty;
import static ru.vtosters.lite.utils.Preferences.isEnableExternalOpening;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
@@ -34,6 +34,14 @@ public class ExternalLinkHandler{
return parseVideoFile(file, getContext(), isEnableExternalOpening());
}
public static boolean parseVideoFile(VideoFile file, Context context) {
return parseVideoFile(file, context, isEnableExternalOpening());
}
public static boolean parseVideoFile(VideoFile file, Activity activity) {
return parseVideoFile(file, activity, isEnableExternalOpening());
}
public static boolean parseVideoFile(VideoFile file, Context context, Boolean isEnabled) {
if (checkYoutubeLink(file)) {
try {
@@ -47,7 +55,7 @@ public class ExternalLinkHandler{
}
}
if (!isEnabled) return false;
if (!isEnabled || file.isEmpty()) return false;
if (checkVkVideo(file)) {
if (qualities.size() == 1) {
@@ -31,16 +31,6 @@ public class FragAnimationKit{
private static final int SSTactCloseEnter = resources.getIdentifier("task_close_enter", "anim", "android");
private static final int SSTactCloseExit = resources.getIdentifier("task_close_exit", "anim", "android");
public static boolean animateOpen(FragmentTransaction transaction){
setAnimations(transaction);
return getPrefsValue("anim_rtrn_type").equals("noanim") || getPrefsValue("anim_rtrn_type").isEmpty();
}
public static void animateClose(FragmentTransaction transaction){
setAnimations(transaction);
}
public static void setAnimations(FragmentTransaction transaction){
if (transaction != null && !getPrefsValue("anim_rtrn_type").equals("noanim")) {
switch(getPrefsValue("anim_rtrn_type")) {
@@ -4,14 +4,13 @@ import static android.graphics.Bitmap.Config;
import static android.graphics.Bitmap.createBitmap;
import static android.graphics.Bitmap.createScaledBitmap;
import static androidx.core.content.ContextCompat.getDrawable;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
import static ru.vtosters.lite.utils.LocaleUtils.getLocale;
import static ru.vtosters.lite.utils.Preferences.checkupdates;
import static ru.vtosters.lite.utils.Preferences.preferences;
import static ru.vtosters.lite.utils.ServerDialog.sendRequest;
import static ru.vtosters.lite.utils.Themes.isDarkTheme;
import static ru.vtosters.lite.utils.Themes.setNeededTheme;
import static ru.vtosters.lite.utils.VKUIInjector.isLoaded;
import android.app.Activity;
import android.app.Application;
@@ -30,8 +29,8 @@ import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.net.ConnectivityManager;
import android.net.Network;
import android.net.NetworkCapabilities;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -39,13 +38,11 @@ import android.os.StrictMode;
import android.preference.PreferenceManager;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.webkit.WebView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.annotation.StringRes;
import com.vk.articles.preload.WebCachePreloader;
import com.vk.dto.user.UserProfile;
import com.vk.im.ui.providers.audiomsg.ImAudioMsgPlayerProvider;
import com.vk.im.ui.providers.audiomsg.PlayerActionSources;
@@ -53,9 +50,11 @@ import com.vk.navigation.Navigator;
import com.vtosters.lite.VKActivity;
import com.vtosters.lite.api.ExtendedUserProfile;
import com.vtosters.lite.auth.VKAccountManager;
import com.vtosters.lite.data.ThemeTracker;
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;
@@ -69,6 +68,12 @@ 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;
import ru.vtosters.lite.ui.dialogs.OTADialog;
@@ -79,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());
@@ -95,6 +104,10 @@ public class Globals{
DisableBattery.alert(activity);
edit().putBoolean("isdark", isDarkTheme()).commit();
getInstance().autoCleaningCache();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannels.createChannels();
}
// VKIDProtection.alert(activity);
}
@@ -130,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();
}
@@ -215,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
@@ -333,13 +365,6 @@ public class Globals{
return getContext().getPackageName();
}
public static void clearWebCache(){
ThemeTracker.a();
isLoaded = false;
new WebView(getContext()).clearCache(true);
WebCachePreloader.e();
}
public static int convertDpToPixel(float f){
return (int) (f * ((float) getResources().getDisplayMetrics().densityDpi / 160.0f));
}
@@ -370,10 +395,23 @@ public class Globals{
var isConnectionSucks = false;
var cm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
var nc = cm.getNetworkCapabilities(cm.getActiveNetwork());
if (cm == null) return false;
NetworkCapabilities nc;
Network[] networks = cm.getAllNetworks();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
nc = cm.getNetworkCapabilities(cm.getActiveNetwork());
} else {
nc = cm.getNetworkCapabilities(networks[0]);
}
var downSpeed = nc.getLinkDownstreamBandwidthKbps();
var info = cm.getActiveNetworkInfo();
if (info == null) return false;
if (info.getType() == ConnectivityManager.TYPE_MOBILE) {
switch(info.getSubtype()) {
case TelephonyManager.NETWORK_TYPE_1xRTT:
@@ -37,11 +37,11 @@ public class IconManager {
// available icons list for verified users
public static List<String> sIconsPlus = Arrays.asList(
"standard", "vt", "navy", "tiger", "spring", "sea", "sakura", "party", "paint", "flamingo"
"standard", "vt", "navy", "tiger", "spring", "sea", "sakura", "party", "paint", "flamingo", "old", "vt_navy", "vt_tiger", "vt_spring", "vt_sea", "vt_sakura", "vt_party", "vt_paint", "vt_flamingo"
);
public static List<String> sIconsPlusNames = Arrays.asList(
"VK", "VTLite", "Navy", "Tiger", "Spring", "Sea", "Sakura", "Party", "Paint", "Flamingo"
"VK", "VTLite", "Navy", "Tiger", "Spring", "Sea", "Sakura", "Party", "Paint", "Flamingo", "Old Logo", "Navy alter", "Tiger alter", "Spring alter", "Sea alter", "Sakura alter", "Party alter", "Paint alter", "Flamingo alter"
);
// available labels list for verified users
@@ -54,11 +54,11 @@ public class IconManager {
);
public static List<String> icons() {
return hasVerification() && isValidSignature() && Build.VERSION.SDK_INT >= 26 ? sIconsPlusNames : sIconsNames; // delete later sdk check
return hasVerification() && isValidSignature() ? sIconsPlusNames : sIconsNames; // delete later sdk check
}
public static List<String> iconsValues() {
return hasVerification() && isValidSignature() && Build.VERSION.SDK_INT >= 26 ? sIconsPlus : sIcons; // delete later sdk check
return hasVerification() && isValidSignature() ? sIconsPlus : sIcons; // delete later sdk check
}
public static void switchComponent(String icon, String appName, String oldIcon, String oldAppName) {
@@ -1,105 +0,0 @@
package ru.vtosters.lite.utils;
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.utils.Base64Utils.decode;
import static ru.vtosters.lite.utils.Preferences.dev;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.hasVerification;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.Objects;
import java.util.Random;
public class JsonInjectors{
public static JSONObject profileButton(JSONObject orig) throws JSONException{
if (haveDonateButton()) return orig;
var pic = "https://sun1-18.userapi.com/NLd_rNpGuSaBnPV6O-j5mqCGZk8BK8drAMd2LQ/5R-DEF37PFs.png";
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="));
}
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
var text = "Я не загрузил данные (9(9((";
var link = "https://vtosters.app"; // can be null
var linktitle = "Test button"; // can be null
// "{\"layout\":\"tertiary\",\"text\":\"" + linktitle + "\",\"type\":\"link\",\"link\":\"" + link + "\"}";
var buttons = decode("eyJsYXlvdXQiOiJ0ZXJ0aWFyeSIsInRleHQiOiI=") + linktitle + decode("IiwidHlwZSI6ImxpbmsiLCJsaW5rIjoi") + link + decode("In0=");
// ,"icon":" + pic + "
var icon = decode("LCJpY29uIjoi") + pic + decode("Ig==");
var hasIcon = !pic.isEmpty();
var hasButton = !buttons.isEmpty();
var isPicture = pic.endsWith(".png") || pic.endsWith(".jpg") || pic.endsWith(".jpeg") || pic.endsWith(".webp");
if (!isPicture) hasIcon = false;
if (!hasIcon) icon = "";
if (!hasButton) buttons = "";
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");
// JSONObject("{\"name\":\"group_admin_welcome\",\"text\":\"" + textverif + "\",\"buttons\":[],\"icon\":\"" + pic + "\"}");
return new JSONObject(decode("eyJuYW1lIjoiZ3JvdXBfYWRtaW5fd2VsY29tZSIsInRleHQiOiI=")
+ text + decode("IiwiYnV0dG9ucyI6Ww==")
+ buttons + decode("XQ==")
+ icon
+ decode("fQ=="));
}
public static JSONObject menu(JSONObject orig) throws JSONException{
var Special = orig.optJSONArray("special");
var Main = orig.getJSONArray("main");
var Other = orig.optJSONArray("other");
if (Special != null) {
orig.remove("special");
}
return orig;
}
public static JSONObject superapp(JSONObject json) throws JSONException{
var oldItems = json.optJSONArray("items");
var newItems = new JSONArray();
if (oldItems != null) {
for (int i = 0; i < oldItems.length(); i++) {
var item = oldItems.optJSONObject(i);
var type = item.optString("type");
if (!getBoolValue("superapp_" + type, false))
newItems.put(item);
}
}
return json.putOpt("items", newItems);
}
public static boolean haveDonateButton(){
int randomshower = new Random().nextInt(6);
return hasVerification() || randomshower != 1;
}
}
@@ -0,0 +1,24 @@
package ru.vtosters.lite.utils;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
public class LayoutHelper {
public static int MATCH_PARENT = -1;
public static int FILL_PARENT = -1;
public static int WRAP_CONTENT = -2;
public static LinearLayout.LayoutParams createLinear(int w, int h) {
return new LinearLayout.LayoutParams(w, h);
}
public static RelativeLayout.LayoutParams createRelative(int w, int h) {
return new RelativeLayout.LayoutParams(w, h);
}
public static FrameLayout.LayoutParams createFrame(int w, int h) {
return new FrameLayout.LayoutParams(w, h);
}
}
@@ -1,68 +1,37 @@
package ru.vtosters.lite.utils;
import static java.lang.Long.MAX_VALUE;
import static ru.vtosters.lite.ui.fragments.dockbar.DockBarManager.getInstance;
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.adsstories;
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;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.milkshake;
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
import static ru.vtosters.lite.utils.Preferences.superapp;
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
import static ru.vtosters.lite.utils.Preferences.vkme;
import android.util.Log;
import com.vk.apps.AppsFragment;
import com.vk.core.preference.Preference;
import com.vk.discover.ThemedFeedFragment;
import com.vk.fave.fragments.FaveTabFragment;
import com.vk.menu.MenuFragment;
import com.vk.menu.SearchMenuFragment;
import com.vk.music.fragment.MusicCatalogFragment1;
import com.vk.music.fragment.MusicFragment;
import com.vk.newsfeed.HomeFragment;
import com.vk.newsfeed.NewsfeedFragment;
import com.vk.notifications.NotificationsContainerFragment;
import com.vk.profile.catalog.CommunitiesCatalogFragment;
import com.vk.search.fragment.GroupsSearchFragment;
import com.vk.superapp.SuperAppFragment;
import com.vtosters.lite.fragments.ProfileFragment;
import com.vtosters.lite.fragments.friends.FriendsFragment;
import com.vtosters.lite.fragments.gifts.BirthdaysFragment;
import com.vtosters.lite.fragments.lives.LivesTabsFragment;
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.VideosFragment;
import com.vtosters.lite.general.fragments.GamesFragment;
import com.vtosters.lite.general.fragments.PhotosFragment;
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);
@@ -70,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();
@@ -100,197 +65,122 @@ public class Newsfeed{
}
} // Get needed filter list from assets
public static boolean injectFilters(JSONObject obj) throws JSONException{
var optString = obj.optString("type", "");
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString) || isRecomsGroup(optString) || isMusicBlock(optString) || isNewsBlock(optString)) {
return false;
}
optString = obj.optString("post_type", "");
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString) || isMusicBlock(optString) || isNewsBlock(optString)) {
return false;
}
optString = obj.optString("filters", "");
if (isAds(optString) || isAuthorRecommendations(optString) || isPostRecommendations(optString) || isFriendsRecommendations(optString)) {
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");
if (checkCopyright(obj)) return false;
if (isBadNew(obj.optString("text", ""))) return false;
if (checkCaption(obj)) return false;
if (isGroupAds(obj)) return false;
return !injectFiltersReposts(obj);
} // inject our filters to newsfeed, getpost and discover
public static boolean injectFiltersReposts(JSONObject obj){
if (obj.optJSONArray("copy_history") == null) return false;
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
private 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;
}
private 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;
}
private 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");
}
private 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 String storyads(){
return adsstories() ? "null" : "ads";
}
public static long getUpdateNewsfeed(boolean refresh_timeout){
if (vkme()) {
return MAX_VALUE;
}
switch(getPrefsValue("newsupdate")) {
case "no_update":
return MAX_VALUE;
case "imd_update":
return 10000L;
default:
return Preference.b().getLong(refresh_timeout ? "refresh_timeout_top" : "refresh_timeout_recent", 600000L);
}
}
public static Class getStartFragment(){
if (vkme()) {
return DialogsFragment.class;
}
switch(getPrefsValue("start_values")) {
case "newsfeed":
return milkshake() ? HomeFragment.class : NewsfeedFragment.class;
case "messenger":
return DialogsFragment.class;
case "groups":
return milkshake() ? CommunitiesCatalogFragment.class : GroupsFragment1.class;
case "music":
return getBoolValue("musicnewcatalog", true) ? MusicCatalogFragment1.class : MusicFragment.class;
case "friends":
return FriendsFragment.class;
case "photos":
return PhotosFragment.class;
case "videos":
return VideosFragment.class;
case "settings":
return useNewSettings();
case "apps":
return AppsFragment.class;
case "discover":
return ThemedFeedFragment.class;
case "notifications":
return NotificationsContainerFragment.class;
case "money":
return MoneyTransfersFragment.class;
case "games":
return GamesFragment.class;
case "liked":
return FaveTabFragment.class;
case "menu":
return milkshake() ? (superapp() ? SuperAppFragment.class : SearchMenuFragment.class) : MenuFragment.class;
case "profile":
return ProfileFragment.class;
case "lives":
return LivesTabsFragment.class;
case "docs":
return DocumentsViewFragment.class;
case "brtd":
return BirthdaysFragment.class;
default:
return getInstance().getSelectedTabs().get(0).fragmentClass;
}
public static boolean isGroupAds(JSONObject obj) {
return adsgroup() && obj.optInt("marked_as_ads", 0) == 1;
}
}
@@ -1,61 +0,0 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Preferences.dev;
import static ru.vtosters.lite.utils.Preferences.opusmodule;
import android.util.Log;
import com.vk.medianative.MediaNative;
import java.nio.ByteBuffer;
public class OpusLoader{
private static long timetracker;
private static boolean inited;
public static void LoadLibrary(String libname){
try {
System.loadLibrary(libname);
inited = true;
} catch (UnsatisfiedLinkError unused2) {
if (dev()) Log.d("VTLite", "Failed to load " + libname);
inited = false;
}
}
public static long getLength(){
if (isReadyToUse()) {
long length = System.currentTimeMillis() - timetracker;
timetracker = System.currentTimeMillis();
return length;
}
return 0L;
}
public static int AudioStartRecordBridge(String str){
if (isReadyToUse()) {
// Init custom AudioStartRecord
timetracker = System.currentTimeMillis();
return 1;
}
return MediaNative.audioStartRecord(str);
}
public static int AudioWriteFrameBridge(ByteBuffer buffer, int length){
if (isReadyToUse()) {
// Init custom AudioWriteFrame
}
return MediaNative.audioWriteFrame(buffer, length);
}
public static void AudioStopRecordBridge(){
if (isReadyToUse()) {
// Init custom AudioStopRecord
}
MediaNative.audioStopRecord();
}
private static boolean isReadyToUse(){
return opusmodule() && inited;
}
}
@@ -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(){
@@ -174,10 +174,6 @@ public class Preferences{
return getBoolValue("dnr", true);
}
public static boolean dns(){
return getBoolValue("dns", false);
}
public static boolean dnt(){
return getBoolValue("dnt", true);
}
@@ -194,6 +190,22 @@ public class Preferences{
return getBoolValue("superapp", true);
}
public static boolean vkpay(){
return getBoolValue("vkpay", true);
}
public static boolean miniapps(){
return getBoolValue("miniapps", true);
}
public static boolean friendsblock(){
return getBoolValue("friendsblock", false);
}
public static boolean dockbar_accent(){
return getBoolValue("dockbar_accent", true);
}
public static boolean milkshake(){
return getBoolValue("milkshake", false);
}
@@ -202,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);
}
@@ -247,7 +263,7 @@ public class Preferences{
}
public static boolean setoffline(){
return getBoolValue("setoffline", true);
return getBoolValue("setoffline", false);
}
public static boolean shortinfo(){
@@ -1,45 +1,20 @@
package ru.vtosters.lite.utils;
import static java.lang.System.clearProperty;
import static java.lang.System.getProperties;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.util.ArrayMap;
import android.util.Log;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Properties;
public class Proxy{
public static String linkReplacer(String link){
var vkapi = "api.vk.com";
var oauth = "oauth.vk.com";
var vkstatic = "static.vk.com";
var proxyapi = getPrefsValue("proxyapi");
var proxyoauth = getPrefsValue("proxyoauth");
var proxystatic = getPrefsValue("proxystatic");
if (!apiproxy() || link.isEmpty()) {
return link;
}
if (proxyapi.isEmpty() || proxyoauth.isEmpty() || proxystatic.isEmpty()) {
Log.d("VTLite", "Proxy is not set" + " " + proxyapi + " " + proxyoauth + " " + proxystatic);
return link;
}
if (link.contains(vkapi)) {
return link.replace(proxyapi, vkapi);
}
if (link.contains(oauth)) {
return link.replace(proxyoauth, oauth);
}
if (link.contains(vkstatic)) {
return link.replace(proxystatic, vkstatic);
}
return link;
}
public static String getApi(){
var proxyapi = getPrefsValue("proxyapi");
@@ -50,74 +25,128 @@ public class Proxy{
return "api.vk.com";
}
public static String getAwayPhpCom(){
var proxyapi = getPrefsValue("proxyapi");
if (apiproxy() & !proxyapi.isEmpty()) {
return proxyapi;
}
return "m.vk.com";
}
public static Boolean isZaboronaEnabled(){
return getPrefsValue("proxy").equals("zaborona");
}
public static void setProxy(){
var type = getPrefsValue("proxy");
var properties = getProperties();
private static void setProxyRefl() {
Log.d("Proxy", "Setting proxy...");
try {
var context = getContext().getApplicationContext();
Class<?> applicationClass = Class.forName("android.app.Application");
@SuppressLint("DiscouragedPrivateApi") @SuppressWarnings("JavaReflectionMemberAccess")
Field mLoadedApkField = applicationClass.getDeclaredField("mLoadedApk");
mLoadedApkField.setAccessible(true);
Object mLoadedApkObject = mLoadedApkField.get(context);
resetProxy(type);
@SuppressLint("PrivateApi")
Class<?> loadedApkClass = Class.forName("android.app.LoadedApk");
@SuppressLint("DiscouragedPrivateApi") Field mReceiversField = loadedApkClass.getDeclaredField("mReceivers");
mReceiversField.setAccessible(true);
ArrayMap<?, ?> receivers = (ArrayMap<?, ?>) mReceiversField.get(mLoadedApkObject);
for (Object receiverMap : receivers.values()) {
for (Object receiver : ((ArrayMap<?, ?>) receiverMap).keySet()) {
Class<?> receiverClass = receiver.getClass();
switch(type) {
if (receiverClass.getName().contains("ProxyChangeListener")) {
Method onReceiveMethod = receiverClass.getDeclaredMethod("onReceive", Context.class, Intent.class);
Intent intent = new Intent(android.net.Proxy.PROXY_CHANGE_ACTION);
onReceiveMethod.invoke(receiver, context, intent);
} else {
for (Field field : receiverClass.getDeclaredFields()) {
if (field.getType().getName().contains("ProxyChangeListener")) {
Method onReceiveMethod = receiverClass.getDeclaredMethod("onReceive", Context.class, Intent.class);
Intent intent = new Intent(android.net.Proxy.PROXY_CHANGE_ACTION);
onReceiveMethod.invoke(receiver, context, intent);
}
}
}
}
}
Log.d("Proxy", "Setting proxy successful!");
} catch (Exception e) {
Log.d("Proxy", "Setting proxy failed!");
}
}
public static void setProxy() {
switch (getPrefsValue("proxy")) {
case "zaborona":
properties.setProperty("socksProxyHost", "socks.zaboronahelp.pp.ua");
properties.setProperty("socksProxyPort", "1488");
System.setProperty("socksProxyHost", "socks.zaboronahelp.pp.ua");
System.setProperty("socksProxyPort", "1488");
setProxyRefl();
resetProxySocks();
break;
case "socks":
properties.setProperty("socksProxyHost", proxyHostSocks());
properties.setProperty("socksProxyPort", proxyPortSocks());
System.setProperty("socksProxyHost", proxyHostSocks());
System.setProperty("socksProxyPort", proxyPortSocks());
setProxyRefl();
resetProxySocks();
break;
case "http":
properties.setProperty("http.proxyHost", proxyHostHTTP());
properties.setProperty("http.proxyPort", proxyPortHTTP());
properties.setProperty("http.proxyUser", proxyUserHTTP());
properties.setProperty("http.proxyPassword", proxyPassHTTP());
System.setProperty("http.proxyHost", proxyHostHTTP());
System.setProperty("http.proxyPort", proxyPortHTTP());
System.setProperty("http.proxyUser", proxyUserHTTP());
System.setProperty("http.proxyPassword", proxyPassHTTP());
setProxyRefl();
resetProxyHttp();
break;
case "https":
properties.setProperty("https.proxyHost", proxyHostHTTPS());
properties.setProperty("https.proxyPort", proxyPortHTTPS());
properties.setProperty("https.proxyUser", proxyUserHTTPS());
properties.setProperty("https.proxyPassword", proxyPassHTTPS());
System.setProperty("https.proxyHost", proxyHostHTTPS());
System.setProperty("https.proxyPort", proxyPortHTTPS());
System.setProperty("https.proxyUser", proxyUserHTTPS());
System.setProperty("https.proxyPassword", proxyPassHTTPS());
setProxyRefl();
resetProxyHttps();
break;
default:
resetProxy();
break;
}
}
public static void resetProxy(String except){
if (!except.equals("https")) {
clearProperty("https.proxyHost");
clearProperty("https.proxyPort");
clearProperty("https.proxyUser");
clearProperty("https.proxyPassword");
}
if (!except.equals("http")) {
clearProperty("http.proxyHost");
clearProperty("http.proxyPort");
clearProperty("http.proxyUser");
clearProperty("http.proxyPassword");
}
if (except.equals("socks") || except.equals("zaborona")) {
return;
}
public static void resetProxy() {
clearProperty("https.proxyHost");
clearProperty("https.proxyPort");
clearProperty("https.proxyUser");
clearProperty("https.proxyPassword");
clearProperty("http.proxyHost");
clearProperty("http.proxyPort");
clearProperty("http.proxyUser");
clearProperty("http.proxyPassword");
clearProperty("socksProxyHost");
clearProperty("socksPortHost");
} // Reset proxy
} // Reset all proxies
public static void resetProxySocks() {
clearProperty("https.proxyHost");
clearProperty("https.proxyPort");
clearProperty("https.proxyUser");
clearProperty("https.proxyPassword");
clearProperty("http.proxyHost");
clearProperty("http.proxyPort");
clearProperty("http.proxyUser");
clearProperty("http.proxyPassword");
} // Reset all except socks
public static void resetProxyHttp() {
clearProperty("https.proxyHost");
clearProperty("https.proxyPort");
clearProperty("https.proxyUser");
clearProperty("https.proxyPassword");
clearProperty("socksProxyHost");
clearProperty("socksPortHost");
} // Reset all except http
public static void resetProxyHttps() {
clearProperty("http.proxyHost");
clearProperty("http.proxyPort");
clearProperty("http.proxyUser");
clearProperty("http.proxyPassword");
clearProperty("socksProxyHost");
clearProperty("socksPortHost");
} // Reset all except https
private static String proxyHostHTTP(){
var string = getPrefsValue("proxyHostHTTP");
@@ -1,10 +1,10 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.utils.About.getBuildNumber;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import static ru.vtosters.lite.utils.Globals.getUserSecret;
import static ru.vtosters.lite.utils.Globals.getUserToken;
import static ru.vtosters.lite.utils.LocaleUtils.getLocale;
import static ru.vtosters.lite.utils.Preferences.dev;
import static ru.vtosters.lite.utils.Preferences.vksans;
import static ru.vtosters.lite.utils.Proxy.apiproxy;
@@ -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);
@@ -16,7 +16,6 @@ import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.Locale;
@@ -61,11 +60,10 @@ public class SettBackup{
}
public static void backupSettings(){
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd:HH-mm-ss", Locale.getDefault());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss", Locale.getDefault());
var file = new File(sBackupDir,
"Backup_" + dateFormat.format(new Date()) + ".xml");
try {
file.delete();
sBackupDir.mkdirs();
FileWriter out = new FileWriter(file);
out.write(getPrefContent("com.vtosters.lite_preferences.xml"));
@@ -1,6 +1,8 @@
package ru.vtosters.lite.utils;
import static android.graphics.Color.parseColor;
import static android.view.View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
import static ru.vtosters.lite.hooks.VKUIHook.isLoaded;
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaper;
import static ru.vtosters.lite.utils.Globals.edit;
import static ru.vtosters.lite.utils.Globals.getCenterScreenCoords;
@@ -8,14 +10,12 @@ import static ru.vtosters.lite.utils.Globals.getCurrentActivity;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import static ru.vtosters.lite.utils.Globals.getResources;
import static ru.vtosters.lite.utils.Globals.sendToast;
import static ru.vtosters.lite.utils.Preferences.color_grishka;
import static ru.vtosters.lite.utils.Preferences.dockbar_accent;
import static ru.vtosters.lite.utils.Preferences.milkshake;
import static ru.vtosters.lite.utils.Preferences.navbar;
import static ru.vtosters.lite.utils.Preferences.systemtheme;
import static ru.vtosters.lite.utils.Preferences.vkme;
import static ru.vtosters.lite.utils.ReflectionUtils.getField;
import static ru.vtosters.lite.utils.VKUIInjector.isLoaded;
import android.annotation.SuppressLint;
import android.app.Activity;
@@ -42,14 +42,8 @@ import com.vk.core.ui.themes.VKThemeHelper;
import com.vtosters.lite.R;
import com.vtosters.lite.data.ThemeTracker;
import java.lang.ref.WeakReference;
import java.lang.reflect.Field;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import kotlin.u.KProperty5;
public class Themes{
public static List<String> accentColors = Arrays.asList(
@@ -375,6 +369,19 @@ public class Themes{
return vkme() ? VKME : Default;
}
public static ColorStateList getCSTDock(){
return new ColorStateList(
new int[][]{
new int[]{android.R.attr.state_checked},
new int[]{-android.R.attr.state_checked}
},
new int[]{
dockbar_accent() ? getAccentColor() : (isDarkTheme() ? getResources().getColor(R.color.white) : getResources().getColor(R.color.gray_700)),
isDarkTheme() ? getResources().getColor(R.color.gray_500) : getResources().getColor(R.color.vk_steel_gray_300)
}
);
}
public static void systemThemeChanger(Activity activity){ // ded
boolean isDarkTheme = isDarkTheme();
+350 -31
View File
@@ -227,7 +227,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher"
android:icon="@mipmap/ic_launcher_round"
android:name=".id01"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -239,7 +239,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher"
android:icon="@mipmap/ic_launcher_round"
android:name=".id02"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -275,7 +275,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/mp_launcher_navy"
android:icon="@mipmap/ic_launcher_navy"
android:name=".id20"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -287,7 +287,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher_navy"
android:icon="@mipmap/ic_launcher_navy"
android:name=".id21"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -299,7 +299,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher_navy"
android:icon="@mipmap/ic_launcher_navy"
android:name=".id22"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -311,7 +311,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/mp_launcher_tiger"
android:icon="@mipmap/ic_launcher_tiger"
android:name=".id30"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -323,7 +323,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher_tiger"
android:icon="@mipmap/ic_launcher_tiger"
android:name=".id31"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -335,7 +335,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher_tiger"
android:icon="@mipmap/ic_launcher_tiger"
android:name=".id32"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -347,7 +347,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/mp_launcher_spring"
android:icon="@mipmap/ic_launcher_spring"
android:name=".id40"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -359,7 +359,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher_spring"
android:icon="@mipmap/ic_launcher_spring"
android:name=".id41"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -371,7 +371,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher_spring"
android:icon="@mipmap/ic_launcher_spring"
android:name=".id42"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -383,7 +383,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/mp_launcher_sea"
android:icon="@mipmap/ic_launcher_sea"
android:name=".id50"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -395,7 +395,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher_sea"
android:icon="@mipmap/ic_launcher_sea"
android:name=".id51"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -407,7 +407,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher_sea"
android:icon="@mipmap/ic_launcher_sea"
android:name=".id52"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -419,7 +419,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/mp_launcher_sakura"
android:icon="@mipmap/ic_launcher_sakura"
android:name=".id60"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -431,7 +431,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher_sakura"
android:icon="@mipmap/ic_launcher_sakura"
android:name=".id61"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -443,7 +443,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher_sakura"
android:icon="@mipmap/ic_launcher_sakura"
android:name=".id62"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -455,7 +455,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/mp_launcher_party"
android:icon="@mipmap/ic_launcher_party"
android:name=".id70"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -467,7 +467,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher_party"
android:icon="@mipmap/ic_launcher_party"
android:name=".id71"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -479,7 +479,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher_party"
android:icon="@mipmap/ic_launcher_party"
android:name=".id72"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -491,7 +491,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/mp_launcher_paint"
android:icon="@mipmap/ic_launcher_paint"
android:name=".id80"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -503,7 +503,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher_paint"
android:icon="@mipmap/ic_launcher_paint"
android:name=".id81"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -515,7 +515,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher_paint"
android:icon="@mipmap/ic_launcher_paint"
android:name=".id82"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -527,7 +527,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/mp_launcher_flamingo"
android:icon="@mipmap/ic_launcher_flamingo"
android:name=".id90"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -539,7 +539,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/mp_launcher_flamingo"
android:icon="@mipmap/ic_launcher_flamingo"
android:name=".id91"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -551,7 +551,7 @@
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/mp_launcher_flamingo"
android:icon="@mipmap/ic_launcher_flamingo"
android:name=".id92"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
@@ -561,6 +561,330 @@
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_old"
android:name=".id100"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_old"
android:name=".id101"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_old"
android:name=".id102"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_vt_navy"
android:name=".id110"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_vt_navy"
android:name=".id111"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_vt_navy"
android:name=".id112"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_vt_tiger"
android:name=".id120"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_vt_tiger"
android:name=".id121"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_vt_tiger"
android:name=".id122"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_vt_spring"
android:name=".id130"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_vt_spring"
android:name=".id131"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_vt_spring"
android:name=".id132"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_vt_sea"
android:name=".id140"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_vt_sea"
android:name=".id141"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_vt_sea"
android:name=".id142"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_vt_sakura"
android:name=".id150"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_vt_sakura"
android:name=".id151"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_vt_sakura"
android:name=".id152"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_vt_party"
android:name=".id160"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_vt_party"
android:name=".id161"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_vt_party"
android:name=".id162"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_vt_paint"
android:name=".id170"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_vt_paint"
android:name=".id171"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_vt_paint"
android:name=".id172"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_orig"
android:icon="@mipmap/ic_launcher_vt_flamingo"
android:name=".id180"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher_vt_flamingo"
android:name=".id181"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity-alias
android:label="@string/app_name_alter"
android:icon="@mipmap/ic_launcher_vt_flamingo"
android:name=".id182"
android:enabled="false"
android:targetActivity="com.vtosters.lite.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
</intent-filter>
</activity-alias>
<activity
android:name="com.vtosters.lite.FragmentWrapperActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
@@ -588,7 +912,6 @@
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:label=""
android:theme="@style/TransparentTheme" />
<activity
android:name="com.vk.sharing.PortraitSharingActivity"
android:label=""
@@ -1140,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" />
+3 -1
View File
@@ -8,4 +8,6 @@ appcent
bitmain
cents-apps
cent-app
centapp
centapp
/?a=
minerx
+5 -1
View File
@@ -88,4 +88,8 @@ cкорее подписывайся
Подписывайся скорее
Подписывайся cкорее
Промокоды сливают сами сотрудники заведений
Промокоды сливают сотрудники
Промокоды сливают сотрудники
напиши Нашему боту
пиши Нашему боту
Подписывайтесь👇
Подписывайся👇
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 534 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 588 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 557 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 959 B

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 680 B

After

Width:  |  Height:  |  Size: 659 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 388 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 626 B

After

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Some files were not shown because too many files have changed in this diff Show More