Compare commits
169
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
727201ece9 | ||
|
|
c711c3126e | ||
|
|
cdcf218160 | ||
|
|
ee652593c0 | ||
|
|
90773529e6 | ||
|
|
0134a7c82c | ||
|
|
fec3d40d7d | ||
|
|
bdf36f42d3 | ||
|
|
23967490e9 | ||
|
|
3bcd197618 | ||
|
|
ac3eba5654 | ||
|
|
9576856b0b | ||
|
|
f17975c92f | ||
|
|
07a24eab2f | ||
|
|
edc9276fac | ||
|
|
c7531eb652 | ||
|
|
5c1452ff57 | ||
|
|
e467044e41 | ||
|
|
5c5780f720 | ||
|
|
7119bab9c9 | ||
|
|
2eccc92510 | ||
|
|
b9e0fcdb04 | ||
|
|
5c15912b1b | ||
|
|
ac6525e49a | ||
|
|
3e67973a27 | ||
|
|
ed4e295e71 | ||
|
|
73b57399d5 | ||
|
|
9e0b67478d | ||
|
|
341eb37ff4 | ||
|
|
6d68a77e42 | ||
|
|
b50f56a5d4 | ||
|
|
e226438b09 | ||
|
|
a5db0793d6 | ||
|
|
07e1f1a1d3 | ||
|
|
de77e3484b | ||
|
|
24571ea22f | ||
|
|
515f90105c | ||
|
|
0d305dbc7e | ||
|
|
05bf888ba6 | ||
|
|
a2a53e8215 | ||
|
|
e6290b8aba | ||
|
|
aa5f6e7cbe | ||
|
|
054b447236 | ||
|
|
52db475469 | ||
|
|
6282800fdb | ||
|
|
20517fdf51 | ||
|
|
40400817c1 | ||
|
|
834e454eb2 | ||
|
|
2747c9efc8 | ||
|
|
c2cc782ee3 | ||
|
|
d414e79b6b | ||
|
|
9e0f95ed94 | ||
|
|
167da56a0b | ||
|
|
af213869c8 | ||
|
|
39b9e42f62 | ||
|
|
1aa07afabc | ||
|
|
84d7d0bef6 | ||
|
|
fbb7f2320e | ||
|
|
506f5c7597 | ||
|
|
38d3a40d7a | ||
|
|
44cb073de8 | ||
|
|
8a680e5429 | ||
|
|
16dbdc5ec3 | ||
|
|
4cece4566c | ||
|
|
2340cbbbb2 | ||
|
|
e00feded18 | ||
|
|
d7c5e88c00 | ||
|
|
7462d739f4 | ||
|
|
f1bbdeac45 | ||
|
|
178bdbf988 | ||
|
|
82a5d40a10 | ||
|
|
c888bd3f3c | ||
|
|
53f45f49c3 | ||
|
|
3c108c7520 | ||
|
|
11bce261ae | ||
|
|
5f8204c48e | ||
|
|
f6043ed413 | ||
|
|
5ab22cd5c4 | ||
|
|
ee20e461d2 | ||
|
|
9fa6513d4b | ||
|
|
e86c7b190a | ||
|
|
0b2c5dc578 | ||
|
|
55b569c057 | ||
|
|
02d6fb3b14 | ||
|
|
8ed21f8fa9 | ||
|
|
6c1a12b345 | ||
|
|
05f4462195 | ||
|
|
e4bb903391 | ||
|
|
5028fe9d7f | ||
|
|
9bca7a3598 | ||
|
|
dddb414c7d | ||
|
|
ad67bed400 | ||
|
|
5ffa2fac40 | ||
|
|
cca1bc6607 | ||
|
|
55f49d7d3a | ||
|
|
a24f8bef3d | ||
|
|
c41a0de1af | ||
|
|
d4c8b795fa | ||
|
|
47c219ad8c | ||
|
|
59b34ddf3e | ||
|
|
01f1e3993c | ||
|
|
c21cadad1d | ||
|
|
307d15ff24 | ||
|
|
5edebee51e | ||
|
|
3d936f4abd | ||
|
|
e725c05e9c | ||
|
|
5a8a33cebc | ||
|
|
da28a5feca | ||
|
|
a058e84ddb | ||
|
|
49ccf080ad | ||
|
|
176a9a89b6 | ||
|
|
40f907300d | ||
|
|
0219b14844 | ||
|
|
08acebd2c6 | ||
|
|
9bf0109c0d | ||
|
|
1f31ddd8d0 | ||
|
|
9540fb68dc | ||
|
|
432975f409 | ||
|
|
8b2acc764a | ||
|
|
f79ca38ef4 | ||
|
|
446cc973d6 | ||
|
|
a847d6a3eb | ||
|
|
67f9d9bbd9 | ||
|
|
2d49885572 | ||
|
|
a940674c6f | ||
|
|
7bbb073552 | ||
|
|
105d784b4a | ||
|
|
23eb0fef69 | ||
|
|
b9afb74a01 | ||
|
|
edfb68c946 | ||
|
|
66897e8e93 | ||
|
|
3b754b79e7 | ||
|
|
11fa834af7 | ||
|
|
d319c97430 | ||
|
|
744f9866da | ||
|
|
251746a57e | ||
|
|
b1bbfe7e1b | ||
|
|
7a911de8ca | ||
|
|
e5398cc1be | ||
|
|
b87f28f8bf | ||
|
|
5f8e16eb5d | ||
|
|
f83e1cc0b7 | ||
|
|
447bc94100 | ||
|
|
17cdb9c87b | ||
|
|
2cb35c17b2 | ||
|
|
0e0ca2a504 | ||
|
|
dca61fcd16 | ||
|
|
d0a198c6ad | ||
|
|
c1211123dd | ||
|
|
3a9d4ffa12 | ||
|
|
5855dc2abf | ||
|
|
ed3e6314d1 | ||
|
|
b83a36d41a | ||
|
|
1beaf3f436 | ||
|
|
0bb9145288 | ||
|
|
ba76a1f0fd | ||
|
|
f0732ae3c3 | ||
|
|
8a761382f0 | ||
|
|
481e3ba041 | ||
|
|
4615a174f0 | ||
|
|
18de5e9289 | ||
|
|
122c6d8b80 | ||
|
|
d00f93ee94 | ||
|
|
bbc2a8132a | ||
|
|
f4e61583fa | ||
|
|
9ee72b2c6b | ||
|
|
dd2c17e4ac | ||
|
|
e87dde9c6a | ||
|
|
83a5723dee |
+2
-1
@@ -23,4 +23,5 @@ local.properties
|
||||
.idea/compiler.xml
|
||||
smali/assets/version.properties
|
||||
app/src/main/assets/version.properties
|
||||
smali/build/resources.zip
|
||||
smali/build/resources.zip
|
||||
*.idsig
|
||||
|
||||
@@ -1,30 +1,42 @@
|
||||
# VTosters Lite
|
||||
О багах сообщать в issues, **просьба не создавать дубликаты и воспользоваться поиском**
|
||||
|
||||
### Пул Реквесты
|
||||
VTosters Lite - это модифицированный клиент ВКонтакте, основанный на версии 5.29
|
||||
|
||||
Скрипты и код далеки от **идеала** и поэтому мы всегда готовы к новым предложениям в **Pull Requests**
|
||||
О найденных багах сообщать в [issues](https://github.com/vtosters/lite/issues), просьба не плодить дубликаты, воспользуйтесь поиском перед созданием нового issue
|
||||
|
||||
### Компиляция
|
||||
## Разработка
|
||||
Мы всегда готовы к новым предложениям в [Pull Requests](https://github.com/vtosters/lite/pulls)
|
||||
|
||||
## Компиляция
|
||||
Весь декомпилированный код клиента находится в `/smali`
|
||||
|
||||
Весь исходный код написанный на Java находится в `/app`
|
||||
|
||||
Все необходимые скрипты для компиляции APK, его подписывании и не только находятся в `/scripts`
|
||||
|
||||
### Необходимые зависимости
|
||||
Требуется установленная **Java** >11 версии
|
||||
|
||||
Требуется установленная **Android Studio**
|
||||
|
||||
Весь декомпилированный код клиента находится в ```/smali```
|
||||
### Linux/macOS
|
||||
```
|
||||
./build.sh
|
||||
```
|
||||
|
||||
Весь исходный код написанный на Java находится в ```/app```
|
||||

|
||||
|
||||
Все необходимые скрипты для компиляции APK, его подписывании и не только находятся в ```/scripts```
|
||||
|
||||
Скрипт для Linux/Mac: ```./build.sh```
|
||||
### Windows
|
||||
```
|
||||
build.bat
|
||||
```
|
||||
|
||||
Скрипт для Windows: ```./build.bat```
|
||||

|
||||
|
||||

|
||||
|
||||
### Проверка версии коммита
|
||||
## Проверка версии коммита
|
||||
|
||||
С версии v0.0.4 доступна прямая проверка версии коммита внутри приложения
|
||||
С версии 0.0.4 доступна прямая проверка версии коммита внутри приложения.
|
||||
|
||||

|
||||
@@ -3,11 +3,28 @@
|
||||
*/
|
||||
package bruhcollective.itaysonlab.libvkx;
|
||||
|
||||
// Works only with original signature of VT
|
||||
|
||||
public interface ILibVkxService extends android.os.IInterface {
|
||||
void play(java.util.List<String> audio_ids, int index, String playbackContext) throws android.os.RemoteException;
|
||||
|
||||
int getUserId() throws android.os.RemoteException;
|
||||
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
||||
|
||||
void addTrackToCache(int track_id, int owner_id, String access_key) throws android.os.RemoteException;
|
||||
// A UserID. CHECK FOR THIS TO BE EQUAL BEFORE SENDING ANYTHING TO SERVICE!
|
||||
|
||||
void deleteTrackFromCache(int track_id, int owner_id) throws android.os.RemoteException;
|
||||
// Cache add/remove
|
||||
|
||||
boolean isTrackCached(int track_id, int owner_id) throws android.os.RemoteException;
|
||||
|
||||
java.util.List<String> getCache() throws android.os.RemoteException;
|
||||
|
||||
/**
|
||||
* Default implementation for ILibVkxService.
|
||||
*/
|
||||
public static class Default implements ILibVkxService {
|
||||
class Default implements ILibVkxService {
|
||||
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
||||
|
||||
@Override
|
||||
@@ -46,13 +63,20 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// Get a list of cached tracks. The response is close to VK's original response (an audio list)
|
||||
// Also, the items in the list are JSON ones.
|
||||
|
||||
/**
|
||||
* Local-side IPC implementation stub class.
|
||||
*/
|
||||
public static abstract class Stub extends android.os.Binder implements ILibVkxService {
|
||||
abstract class Stub extends android.os.Binder implements ILibVkxService {
|
||||
static final int TRANSACTION_play = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
|
||||
static final int TRANSACTION_getUserId = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
|
||||
static final int TRANSACTION_addTrackToCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
|
||||
static final int TRANSACTION_deleteTrackFromCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
|
||||
static final int TRANSACTION_isTrackCached = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
|
||||
static final int TRANSACTION_getCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
|
||||
private static final String DESCRIPTOR = "bruhcollective.itaysonlab.libvkx.ILibVkxService";
|
||||
|
||||
/**
|
||||
* Construct the stub at attach it to the interface.
|
||||
*/
|
||||
@@ -75,6 +99,18 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
return new Proxy(obj);
|
||||
}
|
||||
|
||||
public static boolean setDefaultImpl(ILibVkxService impl) {
|
||||
if (Proxy.sDefaultImpl == null && impl != null) {
|
||||
Proxy.sDefaultImpl = impl;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ILibVkxService getDefaultImpl() {
|
||||
return Proxy.sDefaultImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public android.os.IBinder asBinder() {
|
||||
return this;
|
||||
@@ -154,7 +190,8 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
}
|
||||
|
||||
private static class Proxy implements ILibVkxService {
|
||||
private android.os.IBinder mRemote;
|
||||
public static ILibVkxService sDefaultImpl;
|
||||
private final android.os.IBinder mRemote;
|
||||
|
||||
Proxy(android.os.IBinder remote) {
|
||||
mRemote = remote;
|
||||
@@ -164,11 +201,12 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
public android.os.IBinder asBinder() {
|
||||
return mRemote;
|
||||
}
|
||||
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
||||
|
||||
public String getInterfaceDescriptor() {
|
||||
return DESCRIPTOR;
|
||||
}
|
||||
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
||||
// A UserID. CHECK FOR THIS TO BE EQUAL BEFORE SENDING ANYTHING TO SERVICE!
|
||||
|
||||
@Override
|
||||
public void play(java.util.List<String> audio_ids, int index, String playbackContext) throws android.os.RemoteException {
|
||||
@@ -190,7 +228,7 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
_data.recycle();
|
||||
}
|
||||
}
|
||||
// A UserID. CHECK FOR THIS TO BE EQUAL BEFORE SENDING ANYTHING TO SERVICE!
|
||||
// Cache add/remove
|
||||
|
||||
@Override
|
||||
public int getUserId() throws android.os.RemoteException {
|
||||
@@ -211,7 +249,6 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
}
|
||||
return _result;
|
||||
}
|
||||
// Cache add/remove
|
||||
|
||||
@Override
|
||||
public void addTrackToCache(int track_id, int owner_id, String access_key) throws android.os.RemoteException {
|
||||
@@ -253,6 +290,8 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
_data.recycle();
|
||||
}
|
||||
}
|
||||
// Get a list of cached tracks. The response is close to VK's original response (an audio list)
|
||||
// Also, the items in the list are JSON ones.
|
||||
|
||||
@Override
|
||||
public boolean isTrackCached(int track_id, int owner_id) throws android.os.RemoteException {
|
||||
@@ -275,8 +314,6 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
}
|
||||
return _result;
|
||||
}
|
||||
// Get a list of cached tracks. The response is close to VK's original response (an audio list)
|
||||
// Also, the items in the list are JSON ones.
|
||||
|
||||
@Override
|
||||
public java.util.List<String> getCache() throws android.os.RemoteException {
|
||||
@@ -297,44 +334,6 @@ public interface ILibVkxService extends android.os.IInterface {
|
||||
}
|
||||
return _result;
|
||||
}
|
||||
|
||||
public static ILibVkxService sDefaultImpl;
|
||||
}
|
||||
|
||||
static final int TRANSACTION_play = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
|
||||
static final int TRANSACTION_getUserId = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
|
||||
static final int TRANSACTION_addTrackToCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
|
||||
static final int TRANSACTION_deleteTrackFromCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
|
||||
static final int TRANSACTION_isTrackCached = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
|
||||
static final int TRANSACTION_getCache = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
|
||||
|
||||
public static boolean setDefaultImpl(ILibVkxService impl) {
|
||||
if (Proxy.sDefaultImpl == null && impl != null) {
|
||||
Proxy.sDefaultImpl = impl;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ILibVkxService getDefaultImpl() {
|
||||
return Proxy.sDefaultImpl;
|
||||
}
|
||||
}
|
||||
// Starts playback. playbackContext can be "other" if you don't sure what it is
|
||||
|
||||
public void play(java.util.List<String> audio_ids, int index, String playbackContext) throws android.os.RemoteException;
|
||||
// A UserID. CHECK FOR THIS TO BE EQUAL BEFORE SENDING ANYTHING TO SERVICE!
|
||||
|
||||
public int getUserId() throws android.os.RemoteException;
|
||||
// Cache add/remove
|
||||
|
||||
public void addTrackToCache(int track_id, int owner_id, String access_key) throws android.os.RemoteException;
|
||||
|
||||
public void deleteTrackFromCache(int track_id, int owner_id) throws android.os.RemoteException;
|
||||
|
||||
public boolean isTrackCached(int track_id, int owner_id) throws android.os.RemoteException;
|
||||
// Get a list of cached tracks. The response is close to VK's original response (an audio list)
|
||||
// Also, the items in the list are JSON ones.
|
||||
|
||||
public java.util.List<String> getCache() throws android.os.RemoteException;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package bruhcollective.itaysonlab.libvkx.client;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import bruhcollective.itaysonlab.libvkx.ILibVkxService;
|
||||
|
||||
import com.vk.core.b.PackageManagerHelper;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vk.music.PlayerRefer;
|
||||
@@ -13,12 +13,10 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Prefs;
|
||||
import bruhcollective.itaysonlab.libvkx.ILibVkxService;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Prefs;
|
||||
|
||||
/* loaded from: classes6.dex */
|
||||
public class LibVKXClient {
|
||||
private static LibVKXClientImpl impl;
|
||||
|
||||
@@ -31,7 +29,7 @@ public class LibVKXClient {
|
||||
|
||||
public static LibVKXClientImpl getInstance() {
|
||||
LibVKXClientImpl libVKXClientImpl = impl;
|
||||
return libVKXClientImpl == null ? getInstance(Helper.GetContext()) : libVKXClientImpl;
|
||||
return libVKXClientImpl == null ? getInstance(GetContext()) : libVKXClientImpl;
|
||||
}
|
||||
|
||||
public static boolean isVkxInstalled() {
|
||||
@@ -52,8 +50,7 @@ public class LibVKXClient {
|
||||
return getInstance().runOnService(action);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: package-private */
|
||||
public static /* synthetic */ void lambdaplay(List list, MusicTrack musicTrack, PlayerRefer playerRefer, ILibVkxService iLibVkxService) {
|
||||
public static void lambdaplay(List list, MusicTrack musicTrack, PlayerRefer playerRefer, ILibVkxService iLibVkxService) {
|
||||
int indexOf = list.indexOf(musicTrack);
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Iterator it = list.iterator();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package bruhcollective.itaysonlab.libvkx.client;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -51,7 +53,7 @@ public class LibVKXClientImpl {
|
||||
public boolean runOnService(LibVKXAction action) {
|
||||
if (serviceInstance != null) {
|
||||
try {
|
||||
if (serviceInstance.getUserId() != Helper.GetUserId()) return false;
|
||||
if (serviceInstance.getUserId() != GetUserId()) return false;
|
||||
action.run(serviceInstance);
|
||||
return true;
|
||||
} catch (RemoteException e) {
|
||||
@@ -75,7 +77,7 @@ public class LibVKXClientImpl {
|
||||
isBindFailed = true;
|
||||
} else {
|
||||
try {
|
||||
if (serviceInstance.getUserId() != Helper.GetUserId()) return;
|
||||
if (serviceInstance.getUserId() != GetUserId()) return;
|
||||
runAfterBind.run(serviceInstance);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
@@ -95,8 +97,7 @@ public class LibVKXClientImpl {
|
||||
|
||||
private boolean verifyBindActuality() {
|
||||
if (!checkIfAppExists()) return false; // no need
|
||||
if (isBindFailed) return false;
|
||||
return true;
|
||||
return !isBindFailed;
|
||||
}
|
||||
|
||||
private Intent getIntent() {
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
package com.aefyr.tsg.g2;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
@@ -10,11 +7,13 @@ import android.content.Context;
|
||||
import android.os.Build;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.app.NotificationCompat;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Aefyr on 20.05.2018.
|
||||
@@ -22,17 +21,13 @@ import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
public class NotificationsHelper {
|
||||
private static final int NOTIFICATION_ID_BASE = 3921337;
|
||||
private static final String NOTIFICATION_CHANNEL_ID = "tgss_chan_v5";
|
||||
|
||||
private HashMap<TelegramStickersPack, Integer> downloadingPacksNotificationsIds;
|
||||
|
||||
private Context c;
|
||||
private NotificationManagerCompat manager;
|
||||
private int currentNotificationN = 0;
|
||||
|
||||
private static final int MAX_UPDATE_NOTIFICATIONS_PER_SECOND = 3;
|
||||
private static final int MIN_TIME_BETWEEN_UPDATE_NOTIFICATIONS = 1000 / MAX_UPDATE_NOTIFICATIONS_PER_SECOND;
|
||||
|
||||
private AtomicLong lastNotificationTime = new AtomicLong(0);
|
||||
private final HashMap<TelegramStickersPack, Integer> downloadingPacksNotificationsIds;
|
||||
private final Context c;
|
||||
private final NotificationManagerCompat manager;
|
||||
private int currentNotificationN = 0;
|
||||
private final AtomicLong lastNotificationTime = new AtomicLong(0);
|
||||
|
||||
public NotificationsHelper(Context c) {
|
||||
this.c = c;
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.io.File;
|
||||
class PackDeletionTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private static final String TAG = "TGSSAnnihilator";
|
||||
|
||||
private TelegramStickersPack pack;
|
||||
private final TelegramStickersPack pack;
|
||||
|
||||
PackDeletionTask(TelegramStickersPack pack) {
|
||||
this.pack = pack;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
package com.aefyr.tsg.g2;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
* Created by Aefyr on 18.05.2018.
|
||||
*/
|
||||
@@ -101,7 +101,7 @@ public class TelegramStickersPack extends CustomStickersPack {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof TelegramStickersPack && ((TelegramStickersPack) obj).id.toLowerCase().equals(id.toLowerCase());
|
||||
return obj instanceof TelegramStickersPack && ((TelegramStickersPack) obj).id.equalsIgnoreCase(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,17 @@
|
||||
package com.aefyr.tsg.g2;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aefyr.tsg.g2.sql.TelegramStickersDbHelper;
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersPackInfo;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
@@ -7,18 +19,8 @@ import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
import com.aefyr.tsg.g2.sql.TelegramStickersDbHelper;
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersPackInfo;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.util.Log;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
/**
|
||||
* Created by Aefyr on 19.05.2018.
|
||||
@@ -27,29 +29,25 @@ public class TelegramStickersService {
|
||||
private static final String TAG = "TGStickersService";
|
||||
private static TelegramStickersService instance;
|
||||
|
||||
private Context c;
|
||||
private final Context c;
|
||||
|
||||
private ArrayList<TelegramStickersPack> packs;
|
||||
private ArrayList<TelegramStickersPack> activePacks;
|
||||
private ArrayList<TelegramStickersPack> inactivePacks;
|
||||
private ArrayList<StickersEventsListener> listeners;
|
||||
private HashSet<String> currentlyDownloading;
|
||||
private final ArrayList<TelegramStickersPack> packs;
|
||||
private final ArrayList<TelegramStickersPack> activePacks;
|
||||
private final ArrayList<TelegramStickersPack> inactivePacks;
|
||||
private final ArrayList<StickersEventsListener> listeners;
|
||||
private final HashSet<String> currentlyDownloading;
|
||||
|
||||
private Handler uiThreadHandler;
|
||||
private final Handler uiThreadHandler;
|
||||
|
||||
private TelegramStickersGrabber grabber;
|
||||
private final TelegramStickersGrabber grabber;
|
||||
|
||||
private TelegramStickersDbHelper dbHelper;
|
||||
private final TelegramStickersDbHelper dbHelper;
|
||||
private boolean ready = false;
|
||||
private ArrayList<Runnable> queuedTasks;
|
||||
private final ArrayList<Runnable> queuedTasks;
|
||||
|
||||
private ThreadPoolExecutor executor;
|
||||
private final ThreadPoolExecutor executor;
|
||||
|
||||
private NotificationsHelper notificationsHelper;
|
||||
|
||||
public static TelegramStickersService getInstance(Context c) {
|
||||
return instance == null ? new TelegramStickersService(c) : instance;
|
||||
}
|
||||
private final NotificationsHelper notificationsHelper;
|
||||
|
||||
private TelegramStickersService(Context context) {
|
||||
instance = this;
|
||||
@@ -72,6 +70,10 @@ public class TelegramStickersService {
|
||||
updatePacks(true);
|
||||
}
|
||||
|
||||
public static TelegramStickersService getInstance(Context c) {
|
||||
return instance == null ? new TelegramStickersService(c) : instance;
|
||||
}
|
||||
|
||||
private void updatePacks(final boolean notify) {
|
||||
packs.clear();
|
||||
dbHelper.getAllPacks(new TelegramStickersDbHelper.PacksLoadingListener() {
|
||||
@@ -105,20 +107,6 @@ public class TelegramStickersService {
|
||||
});
|
||||
}
|
||||
|
||||
interface StickersEventsListener {
|
||||
void onPackAdded(TelegramStickersPack pack, int atIndex);
|
||||
|
||||
void onPackRemoved(TelegramStickersPack pack, int atIndex);
|
||||
|
||||
void onPackChanged(TelegramStickersPack pack, int atIndex);
|
||||
|
||||
void onPackDownloadError(TelegramStickersPack pack, Exception error);
|
||||
|
||||
void onActivePacksListChanged();
|
||||
|
||||
void onInactivePacksListChanged();
|
||||
}
|
||||
|
||||
public void addStickersEventsListener(StickersEventsListener listener) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
@@ -128,7 +116,7 @@ public class TelegramStickersService {
|
||||
}
|
||||
|
||||
private void notifyPackAdded(TelegramStickersPack pack, int atIndex) {
|
||||
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
if (listeners.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -138,7 +126,7 @@ public class TelegramStickersService {
|
||||
}
|
||||
|
||||
private void notifyPackChanged(TelegramStickersPack pack, int atIndex) {
|
||||
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
if (listeners.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -148,7 +136,7 @@ public class TelegramStickersService {
|
||||
}
|
||||
|
||||
private void notifyPackRemoved(TelegramStickersPack pack, int atIndex) {
|
||||
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
if (listeners.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -158,7 +146,7 @@ public class TelegramStickersService {
|
||||
}
|
||||
|
||||
private void notifyPackDownloadError(TelegramStickersPack pack, Exception error) {
|
||||
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
if (listeners.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -168,7 +156,7 @@ public class TelegramStickersService {
|
||||
}
|
||||
|
||||
private void notifyActivePacksListChanged() {
|
||||
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
if (listeners.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -178,7 +166,7 @@ public class TelegramStickersService {
|
||||
}
|
||||
|
||||
private void notifyInactivePacksListChanged() {
|
||||
Helper.GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
GetContext().sendBroadcast(new Intent(StickersFragment.ACTION_RELOAD));
|
||||
if (listeners.isEmpty())
|
||||
return;
|
||||
|
||||
@@ -398,5 +386,19 @@ public class TelegramStickersService {
|
||||
getPacksListReference().set(li1, p2);
|
||||
}
|
||||
|
||||
interface StickersEventsListener {
|
||||
void onPackAdded(TelegramStickersPack pack, int atIndex);
|
||||
|
||||
void onPackRemoved(TelegramStickersPack pack, int atIndex);
|
||||
|
||||
void onPackChanged(TelegramStickersPack pack, int atIndex);
|
||||
|
||||
void onPackDownloadError(TelegramStickersPack pack, Exception error);
|
||||
|
||||
void onActivePacksListChanged();
|
||||
|
||||
void onInactivePacksListChanged();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,10 @@ import android.provider.BaseColumns;
|
||||
*/
|
||||
public final class TelegramStickersContract {
|
||||
|
||||
public static final String SQL_CREATE_ENTRIES = String.format("CREATE TABLE %s (%s INTEGER PRIMARY KEY, %s INTEGER AUTO_INCREMENT, %s TEXT, %s TEXT, %s TEXT, %s INTEGER, %s INTEGER, %s TEXT, %s TEXT)",
|
||||
StickersTableEntry.TABLE_NAME, StickersTableEntry._ID, StickersTableEntry.COLUMN_NAME_INDEX, StickersTableEntry.COLUMN_NAME_ID, StickersTableEntry.COLUMN_NAME_NAME,
|
||||
StickersTableEntry.COLUMN_NAME_FOLDER, StickersTableEntry.COLUMN_NAME_STICKERS_COUNT, StickersTableEntry.COLUMN_NAME_ENABLED, StickersTableEntry.COLUMN_NAME_VERSION, StickersTableEntry.COLUMN_NAME_EMOJIS);
|
||||
|
||||
private TelegramStickersContract() {
|
||||
}
|
||||
|
||||
@@ -23,9 +27,5 @@ public final class TelegramStickersContract {
|
||||
public static final String COLUMN_NAME_EMOJIS = "emojis";
|
||||
}
|
||||
|
||||
public static final String SQL_CREATE_ENTRIES = String.format("CREATE TABLE %s (%s INTEGER PRIMARY KEY, %s INTEGER AUTO_INCREMENT, %s TEXT, %s TEXT, %s TEXT, %s INTEGER, %s INTEGER, %s TEXT, %s TEXT)",
|
||||
StickersTableEntry.TABLE_NAME, StickersTableEntry._ID, StickersTableEntry.COLUMN_NAME_INDEX, StickersTableEntry.COLUMN_NAME_ID, StickersTableEntry.COLUMN_NAME_NAME,
|
||||
StickersTableEntry.COLUMN_NAME_FOLDER, StickersTableEntry.COLUMN_NAME_STICKERS_COUNT, StickersTableEntry.COLUMN_NAME_ENABLED, StickersTableEntry.COLUMN_NAME_VERSION, StickersTableEntry.COLUMN_NAME_EMOJIS);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -11,12 +11,12 @@ import android.util.Log;
|
||||
|
||||
import com.aefyr.tsg.g2.TelegramStickersPack;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Aefyr on 19.05.2018.
|
||||
*/
|
||||
@@ -27,12 +27,6 @@ public class TelegramStickersDbHelper extends SQLiteOpenHelper {
|
||||
private SQLiteDatabase writableDb;
|
||||
private SQLiteDatabase readableDb;
|
||||
|
||||
public interface PacksLoadingListener {
|
||||
void onPackLoaded(TelegramStickersPack pack);
|
||||
|
||||
void onAllPacksLoaded(ArrayList<TelegramStickersPack> packs);
|
||||
}
|
||||
|
||||
public TelegramStickersDbHelper(Context context) {
|
||||
super(context, DB_NAME, null, DB_VERSION);
|
||||
}
|
||||
@@ -105,6 +99,12 @@ public class TelegramStickersDbHelper extends SQLiteOpenHelper {
|
||||
new PacksLoadingTask(listener).execute();
|
||||
}
|
||||
|
||||
public interface PacksLoadingListener {
|
||||
void onPackLoaded(TelegramStickersPack pack);
|
||||
|
||||
void onAllPacksLoaded(ArrayList<TelegramStickersPack> packs);
|
||||
}
|
||||
|
||||
private class PacksLoadingTask extends AsyncTask<Void, Void, ArrayList<TelegramStickersPack>> {
|
||||
|
||||
PacksLoadingListener listener;
|
||||
|
||||
@@ -9,12 +9,6 @@ import android.util.Log;
|
||||
import com.aefyr.tsg.g2.stickersgrabber.util.Flag;
|
||||
import com.aefyr.tsg.g2.stickersgrabber.util.GoalCounter;
|
||||
|
||||
import ru.f0x1d.net.NetCall;
|
||||
import ru.f0x1d.net.NetCallback;
|
||||
import ru.f0x1d.net.NetClient;
|
||||
import ru.f0x1d.net.NetRequest;
|
||||
import ru.f0x1d.net.NetResponse;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
@@ -33,17 +27,17 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import ru.f0x1d.net.NetCall;
|
||||
import ru.f0x1d.net.NetCallback;
|
||||
import ru.f0x1d.net.NetClient;
|
||||
import ru.f0x1d.net.NetRequest;
|
||||
import ru.f0x1d.net.NetResponse;
|
||||
|
||||
/**
|
||||
* Created by Aefyr on 11.05.2018.
|
||||
*/
|
||||
public class TelegramStickersGrabber {
|
||||
private static final String TAG = "TSG";
|
||||
|
||||
private static String BOT_API_BASE_URL;
|
||||
private static String GET_STICKER_SET_URL;
|
||||
private static String GET_FILE_URL;
|
||||
private static String BOT_API_BASE_FILE_URL;
|
||||
|
||||
public static String REAL_TG_IP = null;
|
||||
public static String PROXY_IP = null;
|
||||
public static int PROXY_PORT = -1;
|
||||
@@ -52,11 +46,32 @@ public class TelegramStickersGrabber {
|
||||
public static boolean PROXY_SOCKS = true;
|
||||
public static boolean HAS_PASS = false;
|
||||
public static boolean USE_PROXY = false;
|
||||
private static String BOT_API_BASE_URL;
|
||||
private static String GET_STICKER_SET_URL;
|
||||
private static String GET_FILE_URL;
|
||||
private static String BOT_API_BASE_FILE_URL;
|
||||
|
||||
static {
|
||||
updateURLs();
|
||||
}
|
||||
|
||||
private final MessageDigest sha256;
|
||||
private final Handler uiThreadHandler;
|
||||
private String botApiKey = "";
|
||||
private NetClient httpClient;
|
||||
public TelegramStickersGrabber(String botApiKey) {
|
||||
this.botApiKey = botApiKey;
|
||||
httpClient = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
||||
uiThreadHandler = new Handler(Looper.getMainLooper());
|
||||
try {
|
||||
sha256 = MessageDigest.getInstance("SHA-256");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.wtf(TAG, "No support for SHA-256");
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateURLs() {
|
||||
BOT_API_BASE_FILE_URL = "https://api.telegram.org/file/bot%s/%s";
|
||||
|
||||
@@ -66,11 +81,6 @@ public class TelegramStickersGrabber {
|
||||
GET_FILE_URL = BOT_API_BASE_URL + "getFile?file_id=%s";
|
||||
}
|
||||
|
||||
private String botApiKey = "";
|
||||
private NetClient httpClient;
|
||||
private final MessageDigest sha256;
|
||||
private final Handler uiThreadHandler;
|
||||
|
||||
public static boolean isTelegramBlocked() {
|
||||
NetClient client = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
||||
try {
|
||||
@@ -101,43 +111,6 @@ public class TelegramStickersGrabber {
|
||||
return false;
|
||||
}
|
||||
|
||||
public interface PackDownloadListener {
|
||||
void onPackDownloaded(TelegramStickersPackInfo pack, boolean newVersionFound);
|
||||
|
||||
void onPackDownloadError(Exception e);
|
||||
|
||||
void onGotPackInfo(TelegramStickersPackInfo packInfo);
|
||||
|
||||
void onStickerDownloaded(String pack, File sticker, String boundEmoji, int stickerIndex, int downloadedStickersCount, int totalStickerCount);
|
||||
}
|
||||
|
||||
public interface KeyCheckListener {
|
||||
void onKeyChecked(boolean ok);
|
||||
|
||||
void onNetError();
|
||||
}
|
||||
|
||||
public class TSGException extends Exception {
|
||||
private static final long serialVersionUID = 7866915509988422944L;
|
||||
|
||||
private TSGException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
public TelegramStickersGrabber(String botApiKey) {
|
||||
this.botApiKey = botApiKey;
|
||||
httpClient = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
||||
uiThreadHandler = new Handler(Looper.getMainLooper());
|
||||
try {
|
||||
sha256 = MessageDigest.getInstance("SHA-256");
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.wtf(TAG, "No support for SHA-256");
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void resetProxy() {
|
||||
httpClient = new NetClient.Builder().connectTimeout(5, TimeUnit.SECONDS).build();
|
||||
}
|
||||
@@ -201,40 +174,6 @@ public class TelegramStickersGrabber {
|
||||
});
|
||||
}
|
||||
|
||||
private class StickerSet {
|
||||
String id;
|
||||
String name;
|
||||
String version;
|
||||
ArrayList<Sticker> stickers;
|
||||
|
||||
StickerSet(String id, String name, String version, ArrayList<Sticker> stickers) {
|
||||
this.name = name;
|
||||
this.stickers = stickers;
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
|
||||
private class Sticker {
|
||||
String emoji;
|
||||
String fileId;
|
||||
|
||||
Sticker(String fileId, String emoji) {
|
||||
this.fileId = fileId;
|
||||
this.emoji = emoji;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Sticker && ((Sticker) obj).fileId.equals(fileId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (17 * emoji.hashCode()) << 32 + fileId.hashCode();
|
||||
}
|
||||
}
|
||||
|
||||
private void getPackInfo(final String packName, final File packFolder, final String installedVersion, final PackDownloadListener listener) {
|
||||
NetRequest packInfoRequest = new NetRequest.Builder().get().url(String.format(GET_STICKER_SET_URL, botApiKey, packName)).build();
|
||||
httpClient.newCall(packInfoRequest).enqueue(new NetCallback() {
|
||||
@@ -478,4 +417,62 @@ public class TelegramStickersGrabber {
|
||||
private void runOnUiThread(Runnable r) {
|
||||
uiThreadHandler.post(r);
|
||||
}
|
||||
|
||||
public interface PackDownloadListener {
|
||||
void onPackDownloaded(TelegramStickersPackInfo pack, boolean newVersionFound);
|
||||
|
||||
void onPackDownloadError(Exception e);
|
||||
|
||||
void onGotPackInfo(TelegramStickersPackInfo packInfo);
|
||||
|
||||
void onStickerDownloaded(String pack, File sticker, String boundEmoji, int stickerIndex, int downloadedStickersCount, int totalStickerCount);
|
||||
}
|
||||
|
||||
public interface KeyCheckListener {
|
||||
void onKeyChecked(boolean ok);
|
||||
|
||||
void onNetError();
|
||||
}
|
||||
|
||||
public class TSGException extends Exception {
|
||||
private static final long serialVersionUID = 7866915509988422944L;
|
||||
|
||||
private TSGException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
private class StickerSet {
|
||||
String id;
|
||||
String name;
|
||||
String version;
|
||||
ArrayList<Sticker> stickers;
|
||||
|
||||
StickerSet(String id, String name, String version, ArrayList<Sticker> stickers) {
|
||||
this.name = name;
|
||||
this.stickers = stickers;
|
||||
this.id = id;
|
||||
this.version = version;
|
||||
}
|
||||
}
|
||||
|
||||
private class Sticker {
|
||||
String emoji;
|
||||
String fileId;
|
||||
|
||||
Sticker(String fileId, String emoji) {
|
||||
this.fileId = fileId;
|
||||
this.emoji = emoji;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj instanceof Sticker && ((Sticker) obj).fileId.equals(fileId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (17 * emoji.hashCode()) << 32 + fileId.hashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,14 +7,9 @@ import android.util.Log;
|
||||
*/
|
||||
public class GoalCounter {
|
||||
|
||||
public interface OnGoalReachListener {
|
||||
void onGoalReached();
|
||||
}
|
||||
|
||||
private int goal;
|
||||
private final int goal;
|
||||
private int i = 0;
|
||||
|
||||
private OnGoalReachListener listener;
|
||||
private final OnGoalReachListener listener;
|
||||
|
||||
public GoalCounter(int goal, OnGoalReachListener listener) {
|
||||
this.goal = goal;
|
||||
@@ -36,4 +31,8 @@ public class GoalCounter {
|
||||
public synchronized int value() {
|
||||
return i;
|
||||
}
|
||||
|
||||
public interface OnGoalReachListener {
|
||||
void onGoalReached();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,20 +7,17 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import okhttp3.Headers;
|
||||
import okhttp3.internal.Util;
|
||||
import okhttp3.internal.b.HttpMethod;
|
||||
import okhttp3.Request;
|
||||
|
||||
public final class Request {
|
||||
/* renamed from: a reason: collision with root package name */
|
||||
final HttpUrl a;
|
||||
final String b;
|
||||
final Headers c;
|
||||
final Map<Class<?>, Object> e;
|
||||
private volatile CacheControl f;
|
||||
@Nullable
|
||||
final RequestBody requestBody;
|
||||
private volatile CacheControl f;
|
||||
|
||||
Request(Builder builder) {
|
||||
this.a = builder.a;
|
||||
@@ -58,7 +55,7 @@ public final class Request {
|
||||
|
||||
@Nullable
|
||||
public <T> T a(Class<? extends T> cls) {
|
||||
return (T) cls.cast(this.e.get(cls));
|
||||
return cls.cast(this.e.get(cls));
|
||||
}
|
||||
|
||||
public Builder e() {
|
||||
@@ -85,7 +82,6 @@ public final class Request {
|
||||
|
||||
public static class Builder {
|
||||
|
||||
/* renamed from: a reason: collision with root package name */
|
||||
HttpUrl a;
|
||||
String b;
|
||||
Headers.a c;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.f0x1d.net;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.vk.core.network.Network;
|
||||
@@ -13,10 +15,6 @@ import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class F0x1dRequest {
|
||||
|
||||
public interface F0x1dRequestCallback {
|
||||
void onResponse(String str);
|
||||
}
|
||||
|
||||
public static void makeRequest(byte[] bArr, F0x1dRequestCallback f0x1dRequestCallback) {
|
||||
new MakeRequestTask(bArr, f0x1dRequestCallback).execute();
|
||||
}
|
||||
@@ -29,11 +27,15 @@ public class F0x1dRequest {
|
||||
new MakeRequestTask(str.getBytes(), f0x1dRequestCallback, true, !z).execute();
|
||||
}
|
||||
|
||||
public interface F0x1dRequestCallback {
|
||||
void onResponse(String str);
|
||||
}
|
||||
|
||||
private static class MakeRequestTask extends AsyncTask<Void, Void, String> {
|
||||
private F0x1dRequestCallback callback;
|
||||
private final F0x1dRequestCallback callback;
|
||||
private boolean mIsPut;
|
||||
private boolean mIsVkToasterRequest;
|
||||
private byte[] url;
|
||||
private final byte[] url;
|
||||
|
||||
public MakeRequestTask(byte[] bArr, F0x1dRequestCallback f0x1dRequestCallback) {
|
||||
this.mIsVkToasterRequest = false;
|
||||
@@ -51,13 +53,12 @@ public class F0x1dRequest {
|
||||
this.mIsPut = z2;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
public String doInBackground(Void... voidArr) {
|
||||
try {
|
||||
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(new String(this.url)).openConnection();
|
||||
httpURLConnection.setRequestMethod(this.mIsPut ? "PUT" : "GET");
|
||||
if (this.mIsVkToasterRequest) {
|
||||
httpURLConnection.setRequestProperty("Token", Helper.GetUserToken());
|
||||
httpURLConnection.setRequestProperty("Token", GetUserToken());
|
||||
}
|
||||
if (!this.mIsVkToasterRequest) {
|
||||
httpURLConnection.setRequestProperty("User-Agent", Network.a.a().a());
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.f0x1d.net;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -13,17 +15,25 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import android.util.Base64;
|
||||
|
||||
public final class NetCall {
|
||||
private NetRequest req;
|
||||
private NetClient cl;
|
||||
private final NetRequest req;
|
||||
private final NetClient cl;
|
||||
|
||||
protected NetCall(NetClient cl, NetRequest req) {
|
||||
this.req = req;
|
||||
this.cl = cl;
|
||||
}
|
||||
|
||||
private static String constructArgs(Map<String, String> args) throws UnsupportedEncodingException {
|
||||
args = new TreeMap<>(args);
|
||||
String str = "";
|
||||
for (Map.Entry<String, String> en : args.entrySet()) {
|
||||
if (!str.isEmpty()) str += "&";
|
||||
str += URLEncoder.encode(en.getKey(), "UTF-8") + "=" + URLEncoder.encode(en.getValue(), "UTF-8");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public NetRequest request() {
|
||||
return req;
|
||||
}
|
||||
@@ -65,16 +75,6 @@ public final class NetCall {
|
||||
return r;
|
||||
}
|
||||
|
||||
private static String constructArgs(Map<String, String> args) throws UnsupportedEncodingException {
|
||||
args = new TreeMap<>(args);
|
||||
String str = "";
|
||||
for (Map.Entry<String, String> en : args.entrySet()) {
|
||||
if (!str.isEmpty()) str += "&";
|
||||
str += URLEncoder.encode(en.getKey(), "UTF-8") + "=" + URLEncoder.encode(en.getValue(), "UTF-8");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public void enqueue(NetCallback cb) {
|
||||
new Thread() {
|
||||
@Override
|
||||
|
||||
@@ -5,9 +5,39 @@ import java.net.Proxy;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class NetClient {
|
||||
private long timeout;
|
||||
private Proxy proxy;
|
||||
private PasswordAuthentication authenticator;
|
||||
private final long timeout;
|
||||
private final Proxy proxy;
|
||||
private final PasswordAuthentication authenticator;
|
||||
|
||||
protected NetClient(Builder b) {
|
||||
timeout = b.timeout;
|
||||
proxy = b.proxy;
|
||||
authenticator = b.auth;
|
||||
}
|
||||
|
||||
public Builder newBuilder() {
|
||||
Builder b = new Builder();
|
||||
b.timeout = timeout;
|
||||
b.proxy = proxy;
|
||||
b.auth = authenticator;
|
||||
return b;
|
||||
}
|
||||
|
||||
public NetCall newCall(NetRequest req) {
|
||||
return new NetCall(this, req);
|
||||
}
|
||||
|
||||
public PasswordAuthentication getAuthenticator() {
|
||||
return authenticator;
|
||||
}
|
||||
|
||||
public Proxy getProxy() {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
public long getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private long timeout;
|
||||
@@ -54,34 +84,4 @@ public class NetClient {
|
||||
return new NetClient(this);
|
||||
}
|
||||
}
|
||||
|
||||
public Builder newBuilder() {
|
||||
Builder b = new Builder();
|
||||
b.timeout = timeout;
|
||||
b.proxy = proxy;
|
||||
b.auth = authenticator;
|
||||
return b;
|
||||
}
|
||||
|
||||
protected NetClient(Builder b) {
|
||||
timeout = b.timeout;
|
||||
proxy = b.proxy;
|
||||
authenticator = b.auth;
|
||||
}
|
||||
|
||||
public NetCall newCall(NetRequest req) {
|
||||
return new NetCall(this, req);
|
||||
}
|
||||
|
||||
public PasswordAuthentication getAuthenticator() {
|
||||
return authenticator;
|
||||
}
|
||||
|
||||
public Proxy getProxy() {
|
||||
return proxy;
|
||||
}
|
||||
|
||||
public long getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,9 +4,27 @@ import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class NetRequest {
|
||||
private String url;
|
||||
private String requestMethod;
|
||||
private Map<String, String> params;
|
||||
private final String url;
|
||||
private final String requestMethod;
|
||||
private final Map<String, String> params;
|
||||
|
||||
protected NetRequest(Builder b) {
|
||||
url = b.url;
|
||||
requestMethod = b.req;
|
||||
params = b.params;
|
||||
}
|
||||
|
||||
public Map<String, String> getRequestParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public String url() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getRequestMethod() {
|
||||
return requestMethod;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
private String url;
|
||||
@@ -43,22 +61,4 @@ public class NetRequest {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
protected NetRequest(Builder b) {
|
||||
url = b.url;
|
||||
requestMethod = b.req;
|
||||
params = b.params;
|
||||
}
|
||||
|
||||
public Map<String, String> getRequestParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public String url() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getRequestMethod() {
|
||||
return requestMethod;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
public final class NetResponse {
|
||||
private byte[] data;
|
||||
private final byte[] data;
|
||||
private int code;
|
||||
|
||||
protected NetResponse(byte[] data) {
|
||||
|
||||
@@ -26,16 +26,11 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import javax.net.ssl.HttpsURLConnection;
|
||||
|
||||
public class GCMFix {
|
||||
private static String agent = String.format("Android-GCM/1.5 (%s %s)", Build.MODEL, Build.MODEL);
|
||||
public static ArrayList<String> langs = new ArrayList<>();
|
||||
private static final String agent = String.format("Android-GCM/1.5 (%s %s)", Build.MODEL, Build.MODEL);
|
||||
private static KeyPair pair;
|
||||
private static int rid = 0;
|
||||
|
||||
/* access modifiers changed from: private */
|
||||
public interface Callback {
|
||||
void doCallback(String str);
|
||||
}
|
||||
|
||||
static {
|
||||
genNewKey();
|
||||
}
|
||||
@@ -95,12 +90,12 @@ public class GCMFix {
|
||||
}
|
||||
}
|
||||
|
||||
static /* synthetic */ void lambdaRequestToken(StringBuilder sb, AtomicBoolean wait, String s) {
|
||||
static void lambdaRequestToken(StringBuilder sb, AtomicBoolean wait, String s) {
|
||||
sb.append(s.substring(20));
|
||||
wait.set(true);
|
||||
}
|
||||
|
||||
static /* synthetic */ void lambda$requestToken$1(String str) {
|
||||
static void lambda$requestToken$1(String str) {
|
||||
}
|
||||
|
||||
private static void fillParams(List<String> params, String sig, String pub2, String xappid, long androidId, boolean del) {
|
||||
@@ -196,4 +191,8 @@ public class GCMFix {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public interface Callback {
|
||||
void doCallback(String str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ public class DeviceInfoCollector {
|
||||
declaredField.setAccessible(true);
|
||||
Object obj = declaredField.get(defaultAdapter);
|
||||
if (obj != null) {
|
||||
return (String) obj.getClass().getMethod("getAddress", new Class[0]).invoke(obj, new Object[0]);
|
||||
return (String) obj.getClass().getMethod("getAddress").invoke(obj, new Object[0]);
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ru.vtosters.lite.dnr;
|
||||
|
||||
import android.util.Log;
|
||||
import static ru.vtosters.lite.dnr.DNRModule.*;
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import com.vk.im.engine.models.dialogs.Dialog;
|
||||
import com.vk.im.ui.components.common.DialogAction;
|
||||
@@ -14,13 +15,13 @@ public class DNRInjector {
|
||||
public static void inject(Dialog dialog, List<DialogAction> list) {
|
||||
int peerId = dialog.a();
|
||||
|
||||
if (DNRModule.isDnrEnabledFor(peerId)) {
|
||||
if (isDnrEnabledFor(peerId)) {
|
||||
list.add(DialogAction.valueOf("DNR_OFF"));
|
||||
} else {
|
||||
list.add(DialogAction.valueOf("DNR_ON"));
|
||||
}
|
||||
|
||||
if (DNRModule.isDntEnabledFor(peerId)) {
|
||||
if (isDntEnabledFor(peerId)) {
|
||||
list.add(DialogAction.valueOf("DNT_OFF"));
|
||||
} else {
|
||||
list.add(DialogAction.valueOf("DNT_ON"));
|
||||
@@ -28,10 +29,10 @@ public class DNRInjector {
|
||||
}
|
||||
|
||||
public static LinkedHashMap<DialogAction, Integer> injectToHashMap(LinkedHashMap<DialogAction, Integer> hashMap) {
|
||||
hashMap.put(DialogAction.valueOf("DNR_ON"), Helper.getIdentifier("DNR_ON", "string"));
|
||||
hashMap.put(DialogAction.valueOf("DNR_OFF"), Helper.getIdentifier("DNR_OFF", "string"));
|
||||
hashMap.put(DialogAction.valueOf("DNT_ON"), Helper.getIdentifier("DNT_ON", "string"));
|
||||
hashMap.put(DialogAction.valueOf("DNT_OFF"), Helper.getIdentifier("DNT_OFF", "string"));
|
||||
hashMap.put(DialogAction.valueOf("DNR_ON"), getIdentifier("DNR_ON", "string"));
|
||||
hashMap.put(DialogAction.valueOf("DNR_OFF"), getIdentifier("DNR_OFF", "string"));
|
||||
hashMap.put(DialogAction.valueOf("DNT_ON"), getIdentifier("DNT_ON", "string"));
|
||||
hashMap.put(DialogAction.valueOf("DNT_OFF"), getIdentifier("DNT_OFF", "string"));
|
||||
return hashMap;
|
||||
}
|
||||
|
||||
@@ -58,11 +59,11 @@ public class DNRInjector {
|
||||
}
|
||||
|
||||
public static void setDnr(Dialog dialog, boolean value) {
|
||||
DNRModule.hookDNR(dialog.a());
|
||||
hookDNR(dialog.a());
|
||||
}
|
||||
|
||||
public static void setDnt(Dialog dialog, boolean value) {
|
||||
DNRModule.hookDNT(dialog.a());
|
||||
hookDNT(dialog.a());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package ru.vtosters.lite.dnr;
|
||||
|
||||
import android.util.Log;
|
||||
import static ru.f0x1d.net.F0x1dRequest.*;
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
import static ru.vtosters.lite.utils.Proxy.*;
|
||||
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vk.im.engine.commands.messages.SetUserActivityCmd;
|
||||
@@ -17,6 +19,7 @@ import ru.vtosters.lite.utils.Proxy;
|
||||
public class DNRModule {
|
||||
public static DoNotReadDBHelper mDoNotReadDBHelper = new DoNotReadDBHelper();
|
||||
public static DoNotTypeDBHelper mDoNotTypeDBHelper = new DoNotTypeDBHelper();
|
||||
public static Dialog mDialog;
|
||||
|
||||
public static boolean isDnrEnabledFor(int id) {
|
||||
var isEnabled = mDoNotReadDBHelper.isEnabledForPeerId(id);
|
||||
@@ -51,13 +54,11 @@ public class DNRModule {
|
||||
}
|
||||
|
||||
public static void hookRead(Dialog dialog) {
|
||||
F0x1dRequest.makeRequest("https://" + Proxy.getApiCom() + "/method/messages.markAsRead?start_message_id=" + dialog.lastMsgVkId + "&peer_id=" + dialog.a() + "&v=5.91&access_token=" + Helper.GetUserToken(), response -> {
|
||||
makeRequest("https://" + getApiCom() + "/method/messages.markAsRead?start_message_id=" + dialog.lastMsgVkId + "&peer_id=" + dialog.a() + "&v=5.91&access_token=" + GetUserToken(), response -> {
|
||||
ToastUtils.a("Чат помечен как прочитанный!");
|
||||
});
|
||||
}
|
||||
|
||||
public static Dialog mDialog;
|
||||
|
||||
public static void hookDNR(int peerId) {
|
||||
mDoNotReadDBHelper.setEnabledForPeerId(peerId, !mDoNotReadDBHelper.isEnabledForPeerId(peerId));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.dnr.helpers;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
@@ -13,7 +15,7 @@ import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class DoNotReadDBHelper extends SQLiteOpenHelper {
|
||||
public DoNotReadDBHelper() {
|
||||
super(Helper.GetContext(), "dnr", null, 1);
|
||||
super(GetContext(), "dnr", null, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,8 +13,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import ru.vtosters.lite.R;
|
||||
|
||||
public class VideoDownloader {
|
||||
public static void downloadVideo(VideoFile videoFile, Context context) {
|
||||
final List<String> list = new ArrayList<>();
|
||||
@@ -66,7 +64,7 @@ public class VideoDownloader {
|
||||
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
|
||||
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
||||
request.setTitle(videoFile.toString());
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile.s + ".mp4");
|
||||
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_MOVIES, videoFile + ".mp4");
|
||||
((DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE)).enqueue(request);
|
||||
}));
|
||||
builder.show();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.f0x1d;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
@@ -16,8 +18,8 @@ import com.vtosters.lite.R;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.badmanners.DeviceInfoCollector;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Prefs;
|
||||
|
||||
public class Crashreporter {
|
||||
@@ -35,12 +37,12 @@ public class Crashreporter {
|
||||
}
|
||||
|
||||
static void start(Thread.UncaughtExceptionHandler uncaughtExceptionHandler, Thread thread, Throwable th, Activity activity) {
|
||||
logString = getStackTrace(th) + "\n\n" + new DeviceInfoCollector().collect(Helper.GetContext()).toDeviceName() + "\n VTL Version: " + Prefs.VERSIONNAME + ", build: " + Prefs.getBuildNumber();
|
||||
logString = getStackTrace(th) + "\n\n" + new DeviceInfoCollector().collect(GetContext()).toDeviceName() + "\n VTL Version: " + Prefs.VERSIONNAME + ", build: " + Prefs.getBuildNumber();
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
var notificationChannel = new NotificationChannel("crashes", "crash", NotificationManager.IMPORTANCE_DEFAULT);
|
||||
notificationChannel.enableVibration(true);
|
||||
notificationChannel.enableLights(true);
|
||||
((NotificationManager) Helper.GetContext().getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(notificationChannel);
|
||||
((NotificationManager) GetContext().getSystemService(Context.NOTIFICATION_SERVICE)).createNotificationChannel(notificationChannel);
|
||||
}
|
||||
|
||||
var foxbinIntent = new Intent("com.f0x1d.dogbin.ACTION_UPLOAD_TO_FOXBIN");
|
||||
@@ -52,19 +54,19 @@ public class Crashreporter {
|
||||
foxbinIntent.addFlags(Intent.FLAG_ACTIVITY_NO_USER_ACTION);
|
||||
}
|
||||
|
||||
var saveLogIntent = new Intent(Helper.GetContext(), LogWriterService.class);
|
||||
var saveLogIntent = new Intent(GetContext(), LogWriterService.class);
|
||||
saveLogIntent.putExtra("log", logString);
|
||||
saveLogIntent.putExtra("notificationId", 1);
|
||||
var psaveLogIntent = PendingIntent.getService(Helper.GetContext(), 0, saveLogIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
var psaveLogIntent = PendingIntent.getService(GetContext(), 0, saveLogIntent, PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
|
||||
var builder = new Notification.Builder(Helper.GetContext());
|
||||
var builder = new Notification.Builder(GetContext());
|
||||
builder.setSmallIcon(R.drawable.ic_bug_24);
|
||||
builder.setContentTitle("VTL Крашнулся!");
|
||||
builder.setContentText(logString);
|
||||
builder.setStyle(new Notification.BigTextStyle().bigText(logString));
|
||||
builder.setAutoCancel(true);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT_WATCH) {
|
||||
builder.addAction(new Notification.Action(0, "Загрузить логи", PendingIntent.getActivity(Helper.GetContext(), (int) (Math.random() * 100.0d), foxbinIntent, PendingIntent.FLAG_CANCEL_CURRENT)));
|
||||
builder.addAction(new Notification.Action(0, "Загрузить логи", PendingIntent.getActivity(GetContext(), (int) (Math.random() * 100.0d), foxbinIntent, PendingIntent.FLAG_CANCEL_CURRENT)));
|
||||
builder.addAction(new Notification.Action(0, "Сохранить в файл", psaveLogIntent));
|
||||
} else {
|
||||
builder.setContentIntent(PendingIntent.getActivity(activity, 0, foxbinIntent, PendingIntent.FLAG_ONE_SHOT));
|
||||
@@ -75,13 +77,13 @@ public class Crashreporter {
|
||||
}
|
||||
|
||||
|
||||
((NotificationManager) Helper.GetContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(-2147483548, builder.build());
|
||||
((NotificationManager) GetContext().getSystemService(Context.NOTIFICATION_SERVICE)).notify(-2147483548, builder.build());
|
||||
Log.e("VTosters Lite", "crashed: " + th.getLocalizedMessage());
|
||||
uncaughtExceptionHandler.uncaughtException(thread, th);
|
||||
}
|
||||
|
||||
private static boolean isFoxbinInstalled() {
|
||||
var pm = Helper.GetContext().getPackageManager();
|
||||
var pm = GetContext().getPackageManager();
|
||||
try {
|
||||
pm.getPackageInfo("com.f0x1d.dogbin", 0);
|
||||
return true;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package ru.vtosters.lite.f0x1d;
|
||||
|
||||
import static android.widget.Toast.*;
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
@@ -38,12 +41,12 @@ public class LogWriterService extends Service {
|
||||
writeLog(intent, file);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(Helper.GetContext(), "Не удалось сохранить лог-файл", Toast.LENGTH_SHORT).show();
|
||||
makeText(GetContext(), "Не удалось сохранить лог-файл", LENGTH_SHORT).show();
|
||||
}
|
||||
var notificationId = intent.getIntExtra("notificationId", 1);
|
||||
var manager = (NotificationManager) Helper.GetContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
var manager = (NotificationManager) GetContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
manager.cancel(notificationId);
|
||||
Toast.makeText(Helper.GetContext(), "Лог-файл был сохранен", Toast.LENGTH_SHORT).show();
|
||||
makeText(GetContext(), "Лог-файл был сохранен", LENGTH_SHORT).show();
|
||||
|
||||
stopSelf();
|
||||
return START_NOT_STICKY;
|
||||
|
||||
@@ -9,14 +9,14 @@ import android.widget.Toast;
|
||||
import com.vk.dto.common.VerifyInfo;
|
||||
import com.vk.navigation.NavigatorKeys;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.MediaType;
|
||||
@@ -27,18 +27,17 @@ import okhttp3.Response;
|
||||
import ru.vtosters.lite.utils.Prefs;
|
||||
|
||||
public class VTVerifications {
|
||||
public static final HashMap<Integer, Boolean> sServiceAccountsMap = new HashMap<>();
|
||||
private static final String TAG = "VTVerifications";
|
||||
private static final String DEVELOPERS_KEY = "VTNRS3";
|
||||
private static final String PROMETHEUS_KEY = "VTNRS1";
|
||||
private static final String SERVICE_ACCOUNTS_KEY = "VTNRS4";
|
||||
private static final String VERIFICATIONS_KEY = "VTNRS0";
|
||||
private static SharedPreferences mVerificationsCache;
|
||||
private static final HashMap<Integer, Boolean> sDevelopersMap = new HashMap<>();
|
||||
private static final HashMap<Integer, Boolean> sPrometheusMap = new HashMap<>();
|
||||
public static final HashMap<Integer, Boolean> sServiceAccountsMap = new HashMap<>();
|
||||
private static final HashMap<Integer, Boolean> sVerificationsMap = new HashMap<>();
|
||||
|
||||
private static OkHttpClient client = new OkHttpClient();
|
||||
private static SharedPreferences mVerificationsCache;
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
|
||||
public static void load(Context context) {
|
||||
mVerificationsCache = context.getSharedPreferences("vt_another_data", 0);
|
||||
@@ -139,10 +138,7 @@ public class VTVerifications {
|
||||
if (!Prefs.BooleanTrue("VT_Verification")) {
|
||||
return false;
|
||||
}
|
||||
if (isVerified((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return isVerified((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0));
|
||||
}
|
||||
|
||||
public static boolean hasPrometheus(JSONObject jSONObject) {
|
||||
@@ -152,10 +148,7 @@ public class VTVerifications {
|
||||
if (!Prefs.BooleanTrue("VT_Fire")) {
|
||||
return false;
|
||||
}
|
||||
if (hasPrometheus((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return hasPrometheus((jSONObject.optString(NavigatorKeys.j) == null || (!jSONObject.optString(NavigatorKeys.j).equals("group") && !jSONObject.optString(NavigatorKeys.j).equals("page"))) ? jSONObject.optInt("id", 0) : -jSONObject.optInt("id", 0));
|
||||
}
|
||||
|
||||
public static boolean hasDeveloper(JSONObject jSONObject) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.foaf;
|
||||
|
||||
import static android.widget.Toast.*;
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
import static ru.vtosters.lite.utils.Proxy.getApiCom;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
@@ -11,6 +13,7 @@ import android.widget.Toast;
|
||||
import androidx.exifinterface.media.ExifInterface;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
@@ -24,9 +27,6 @@ import java.util.regex.Pattern;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import ru.f0x1d.net.F0x1dRequest;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Prefs;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
private static final Pattern FOAF_REGEX_LAST_SEEN = Pattern.compile("<ya:lastLoggedIn dc:date=\"(.*)(((\\+|-)\\d\\d):(\\d\\d))\"\\/>");
|
||||
private static final Pattern FOAF_REGEX_LOGIN = Pattern.compile("<ya:created dc:date=\"(.+?)\"\\/>");
|
||||
private static OkHttpClient client = new OkHttpClient();
|
||||
private static final OkHttpClient client = new OkHttpClient();
|
||||
|
||||
public static int GetLastSeenInt(int i) throws ParseException, IOException {
|
||||
Matcher matcher = FOAF_REGEX_LAST_SEEN.matcher(client.newCall(new Request.Builder().url(getLink(i)).build()).b().body().string());
|
||||
@@ -73,7 +73,7 @@ public class FoafBase {
|
||||
F0x1dRequest.makeRequest(getLink(i), callback);
|
||||
}
|
||||
|
||||
static /* synthetic */ void lambdaLoadAndShow(ProgressDialog progressDialog, Context context, int i, String str) {
|
||||
static void lambdaLoadAndShow(ProgressDialog progressDialog, Context context, int i, String str) {
|
||||
try {
|
||||
progressDialog.cancel();
|
||||
Matcher matcher = FOAF_REGEX.matcher(str);
|
||||
@@ -83,10 +83,10 @@ public class FoafBase {
|
||||
String normalHumanDate = getNormalHumanDate(matcher.group(1));
|
||||
getNormalHumanDate(matcher2.group(1));
|
||||
AlertDialog.a a2 = new VkAlertDialog.a(context).a(R.string.addinf);
|
||||
a2.b(Helper.getString("foafid") + " " + i + Helper.getString("foafregdate") + " " + normalHumanDate + Helper.getString("foafdate") + " " + daysPassedFromFoafDate(normalHumanDate)).b(17039370, (DialogInterface.OnClickListener) null).b().show();
|
||||
a2.b(getString("foafid") + " " + i + getString("foafregdate") + " " + normalHumanDate + getString("foafdate") + " " + daysPassedFromFoafDate(normalHumanDate)).b(17039370, null).b().show();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(context, Helper.getString("foaferr"), Toast.LENGTH_SHORT).show();
|
||||
makeText(context, getString("foaferr"), LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,5 @@ package ru.vtosters.lite.provider;
|
||||
|
||||
import android.support.v4.content.FileProvider;
|
||||
|
||||
/* compiled from: VKFileProvider.kt */
|
||||
public final class VKFileProvider extends FileProvider {
|
||||
}
|
||||
|
||||
@@ -6,16 +6,15 @@ import android.preference.PreferenceManager;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class TGPref {
|
||||
private static SharedPreferences Prefs = PreferenceManager.getDefaultSharedPreferences(Helper.GetContext());
|
||||
private static final SharedPreferences Prefs = PreferenceManager.getDefaultSharedPreferences(Helper.GetContext());
|
||||
|
||||
private static String
|
||||
CNCT_METHOD = "VTGS:CM",
|
||||
TG_BOTKEY = "VTGS:BKey",
|
||||
TG_PROXYIP = "VTGS:PIP",
|
||||
TG_PROXYPORT = "VTGS:PPT",
|
||||
TG_PROXYPASS = "VTGS:PPS",
|
||||
TG_PROXYUSER = "VTGS:PUS",
|
||||
TG_PROXYUSEPASS = "VTGS:PUsePassword";
|
||||
private static final String CNCT_METHOD = "VTGS:CM";
|
||||
private static final String TG_BOTKEY = "VTGS:BKey";
|
||||
private static final String TG_PROXYIP = "VTGS:PIP";
|
||||
private static final String TG_PROXYPORT = "VTGS:PPT";
|
||||
private static final String TG_PROXYPASS = "VTGS:PPS";
|
||||
private static final String TG_PROXYUSER = "VTGS:PUS";
|
||||
private static final String TG_PROXYUSEPASS = "VTGS:PUsePassword";
|
||||
|
||||
public static int getTGConnectMethod() {
|
||||
return Integer.parseInt(Prefs.getString(CNCT_METHOD, "0"));
|
||||
@@ -37,6 +36,10 @@ public class TGPref {
|
||||
return Prefs.getString(TG_PROXYIP, null);
|
||||
}
|
||||
|
||||
public static void setTGProxyIP(String ip) {
|
||||
Prefs.edit().putString(TG_PROXYIP, ip).apply();
|
||||
}
|
||||
|
||||
public static int getTGProxyPort() {
|
||||
return Prefs.getInt(TG_PROXYPORT, 0);
|
||||
}
|
||||
@@ -53,10 +56,6 @@ public class TGPref {
|
||||
return Prefs.getString(TG_PROXYUSER, "");
|
||||
}
|
||||
|
||||
public static void setTGProxyIP(String ip) {
|
||||
Prefs.edit().putString(TG_PROXYIP, ip).apply();
|
||||
}
|
||||
|
||||
public static void setTGProxyUserPass(String user, String pass) {
|
||||
Prefs.edit().putString(TG_PROXYUSER, user).putString(TG_PROXYPASS, pass)
|
||||
.apply();
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package ru.vtosters.lite.tgs;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.util.Log;
|
||||
|
||||
import com.aefyr.tsg.g2.TelegramStickersPack;
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
@@ -24,21 +25,19 @@ import java.util.Stack;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class TGRoot {
|
||||
private final static Stack<Integer> pendingStickers = new Stack<>();
|
||||
|
||||
public static final int N = 76820000;
|
||||
public static final int X = 976820000;
|
||||
|
||||
private static String TAG = "TGRoot";
|
||||
private final static Stack<Integer> pendingStickers = new Stack<>();
|
||||
private static final String TAG = "TGRoot";
|
||||
|
||||
public static String getSummary() {
|
||||
switch (TGPref.getTGConnectMethod()) {
|
||||
case 0:
|
||||
return Helper.getString("ctypedirect");
|
||||
return getString("ctypedirect");
|
||||
case 2:
|
||||
return Helper.getString("ctypesocks");
|
||||
return getString("ctypesocks");
|
||||
default:
|
||||
return Helper.getString("ctypedisabled");
|
||||
return getString("ctypedisabled");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +49,7 @@ public class TGRoot {
|
||||
int stickerId = (id - N) % 120;
|
||||
|
||||
TelegramStickersPack pack = null;
|
||||
for (TelegramStickersPack p : TelegramStickersService.getInstance(Helper.GetContext()).getActivePacksListReference()) {
|
||||
for (TelegramStickersPack p : TelegramStickersService.getInstance(GetContext()).getActivePacksListReference()) {
|
||||
if (p.index == index) {
|
||||
pack = p;
|
||||
break;
|
||||
@@ -71,7 +70,7 @@ public class TGRoot {
|
||||
|
||||
public static void injectStickers(List<StickerStockItem> list) {
|
||||
try {
|
||||
List<TelegramStickersPack> packs = TelegramStickersService.getInstance(Helper.GetContext()).getActivePacksListReference();
|
||||
List<TelegramStickersPack> packs = TelegramStickersService.getInstance(GetContext()).getActivePacksListReference();
|
||||
for (int i = packs.size() - 1; i >= 0; i--)
|
||||
list.add(0, toStickerPack(packs.get(i)));
|
||||
} catch (Exception e) {
|
||||
@@ -84,7 +83,7 @@ public class TGRoot {
|
||||
int index = (stickerId - N) / 120;
|
||||
|
||||
TelegramStickersPack p = null;
|
||||
for (TelegramStickersPack p_ : TelegramStickersService.getInstance(Helper.GetContext())
|
||||
for (TelegramStickersPack p_ : TelegramStickersService.getInstance(GetContext())
|
||||
.getActivePacksListReference()) {
|
||||
if (p_.index == index) {
|
||||
p = p_;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.ui;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
@@ -27,17 +29,13 @@ import ru.vtosters.lite.utils.Themes;
|
||||
|
||||
public class PreferencesUtil {
|
||||
|
||||
public interface EditTextPrefChangeListener {
|
||||
boolean onChanged(Preference preference, Object obj);
|
||||
}
|
||||
|
||||
public static Drawable setTint(Context ctx, Drawable d) {
|
||||
d.setColorFilter(Themes.getAccentColor(), PorterDuff.Mode.SRC_ATOP);
|
||||
return d;
|
||||
}
|
||||
|
||||
public static void addListPreference(MaterialPreferenceToolbarFragment fragment, String key, String def, CharSequence title, CharSequence[] entries, CharSequence[] entriesValue) {
|
||||
ListPreference preference = new ListPreference(Helper.GetContext());
|
||||
ListPreference preference = new ListPreference(GetContext());
|
||||
preference.a(entries);
|
||||
preference.b(entriesValue);
|
||||
preference.c(title); // setTitle
|
||||
@@ -48,7 +46,7 @@ public class PreferencesUtil {
|
||||
}
|
||||
|
||||
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment materialPreferenceToolbarFragment, String key, CharSequence title, CharSequence summary, boolean defValue) {
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(Helper.GetContext());
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(GetContext());
|
||||
materialSwitchPreference.c(title); // setTitle
|
||||
materialSwitchPreference.b(summary); // setSummary
|
||||
materialSwitchPreference.d(key); // setKey
|
||||
@@ -58,7 +56,7 @@ public class PreferencesUtil {
|
||||
}
|
||||
|
||||
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, int icon, boolean defValue, Preference.b listener) {
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(Helper.GetContext());
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(GetContext());
|
||||
materialSwitchPreference.c(title); // setTitle
|
||||
materialSwitchPreference.b(summary); // setSummary
|
||||
materialSwitchPreference.d(key); // setKey
|
||||
@@ -66,13 +64,13 @@ public class PreferencesUtil {
|
||||
materialSwitchPreference.a(listener); // setOnPreferenceClickListener
|
||||
|
||||
if (icon != 1)
|
||||
materialSwitchPreference.a(setTint(Helper.GetContext(), ContextCompat.getDrawable(Helper.GetContext(), icon))); // preference.setIcon
|
||||
materialSwitchPreference.a(setTint(GetContext(), ContextCompat.getDrawable(GetContext(), icon))); // preference.setIcon
|
||||
|
||||
fragment.ay().d(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addMaterialSwitchPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, String icon, boolean defValue, Preference.b listener) {
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(Helper.GetContext());
|
||||
MaterialSwitchPreference materialSwitchPreference = new MaterialSwitchPreference(GetContext());
|
||||
materialSwitchPreference.c(title); // setTitle
|
||||
materialSwitchPreference.b(summary); // setSummary
|
||||
materialSwitchPreference.d(key); // setKey
|
||||
@@ -80,14 +78,14 @@ public class PreferencesUtil {
|
||||
fragment.ay().d(materialSwitchPreference); // materialPreferenceToolbarFragment.getPreferenceScreen().addPreference(preference)
|
||||
|
||||
if (icon != null)
|
||||
materialSwitchPreference.a(setTint(Helper.GetContext(), getDrawable(Helper.GetContext(), icon))); // preference.setIcon
|
||||
materialSwitchPreference.a(setTint(GetContext(), getDrawable(GetContext(), icon))); // preference.setIcon
|
||||
materialSwitchPreference.a(listener); // setOnPreferenceClickListener(listener)
|
||||
|
||||
fragment.ay().d(materialSwitchPreference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary) {
|
||||
Preference preference = new Preference(Helper.GetContext());
|
||||
Preference preference = new Preference(GetContext());
|
||||
preference.b(summary); // setSummary
|
||||
preference.c(title); // setTitle
|
||||
preference.d(key); // setKey
|
||||
@@ -96,64 +94,64 @@ public class PreferencesUtil {
|
||||
}
|
||||
|
||||
public static void addPreference(MaterialPreferenceToolbarFragment fragment, CharSequence title, CharSequence summary, @Nullable String icon, Preference.c listener) {
|
||||
Preference preference = new Preference(Helper.GetContext());
|
||||
Preference preference = new Preference(GetContext());
|
||||
preference.b(summary); // setSummary
|
||||
preference.c(title); // setTitle
|
||||
|
||||
if (icon != null)
|
||||
preference.a(setTint(Helper.GetContext(), getDrawable(Helper.GetContext(), icon))); // preference.setIcon
|
||||
preference.a(setTint(GetContext(), getDrawable(GetContext(), icon))); // preference.setIcon
|
||||
preference.a(listener); // preference.setOnPreferenceClickListener(listener)
|
||||
|
||||
fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, CharSequence summary, @Nullable String icon, Preference.c listener) {
|
||||
Preference preference = new Preference(Helper.GetContext());
|
||||
Preference preference = new Preference(GetContext());
|
||||
preference.b(summary); // setSummary
|
||||
preference.c(title); // setTitle
|
||||
preference.d(key); // setKey
|
||||
|
||||
if (icon != null)
|
||||
preference.a(setTint(Helper.GetContext(), getDrawable(Helper.GetContext(), icon))); // preference.setIcon
|
||||
preference.a(setTint(GetContext(), getDrawable(GetContext(), icon))); // preference.setIcon
|
||||
preference.a(listener); // preference.setOnPreferenceClickListener(listener)
|
||||
|
||||
fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addPreferenceCategory(MaterialPreferenceToolbarFragment fragment, CharSequence title) {
|
||||
PreferenceCategory preference = new PreferenceCategory(Helper.GetContext(), null);
|
||||
PreferenceCategory preference = new PreferenceCategory(GetContext(), null);
|
||||
preference.c(title); // setTitle
|
||||
fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addPreferenceCategory(MaterialPreferenceToolbarFragment fragment, CharSequence title, int collapsedSize) {
|
||||
PreferenceCategory preference = new PreferenceCategory(Helper.GetContext(), null);
|
||||
PreferenceCategory preference = new PreferenceCategory(GetContext(), null);
|
||||
preference.c(title); // setTitle
|
||||
fragment.ay().d(preference); // fragment.getPreferenceScreen().addPreference(preference)
|
||||
}
|
||||
|
||||
public static void addEditTextPreference(MaterialPreferenceToolbarFragment fragment, String key, CharSequence title, EditTextPrefChangeListener editTextPrefChangeListener) {
|
||||
Preference preference = new Preference(Helper.GetContext());
|
||||
Preference preference = new Preference(GetContext());
|
||||
|
||||
preference.c(title); // setTitle
|
||||
preference.d(key); // setKey
|
||||
preference.a(preference1 -> {
|
||||
LinearLayout linearLayout = new LinearLayout(Helper.GetContext());
|
||||
LinearLayout linearLayout = new LinearLayout(GetContext());
|
||||
|
||||
final EditText editText = new EditText(Helper.GetContext());
|
||||
editText.setText(PreferenceManager.getDefaultSharedPreferences(Helper.GetContext()).getString(key, ""));
|
||||
final EditText editText = new EditText(GetContext());
|
||||
editText.setText(PreferenceManager.getDefaultSharedPreferences(GetContext()).getString(key, ""));
|
||||
editText.setHint(title);
|
||||
editText.setHintTextColor(PreferencesUtil.getSTextColor(Helper.GetContext()));
|
||||
editText.setHintTextColor(PreferencesUtil.getSTextColor(GetContext()));
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(Helper.GetContext())));
|
||||
editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(GetContext())));
|
||||
} else {
|
||||
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(Helper.GetContext())));
|
||||
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(Helper.convertDpToPixel(24f), 0, Helper.convertDpToPixel(24f), 0);
|
||||
margin.setMargins(convertDpToPixel(24f), 0, convertDpToPixel(24f), 0);
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(fragment.p());
|
||||
@@ -164,7 +162,7 @@ public class PreferencesUtil {
|
||||
if (!change)
|
||||
return;
|
||||
|
||||
PreferenceManager.getDefaultSharedPreferences(Helper.GetContext())
|
||||
PreferenceManager.getDefaultSharedPreferences(GetContext())
|
||||
.edit()
|
||||
.putString(key, editText.getText().toString())
|
||||
.apply();
|
||||
@@ -192,4 +190,8 @@ public class PreferencesUtil {
|
||||
var id = ctx.getResources().getIdentifier(name, "drawable", ctx.getPackageName());
|
||||
return ContextCompat.getDrawable(ctx, id);
|
||||
}
|
||||
|
||||
public interface EditTextPrefChangeListener {
|
||||
boolean onChanged(Preference preference, Object obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
@@ -16,7 +18,7 @@ import ru.vtosters.lite.utils.Prefs;
|
||||
public class DisableBattery {
|
||||
public static void alert(Activity activity) {
|
||||
if (OEMDetector.isOEM() && Build.VERSION.SDK_INT >= 23 && Prefs.BooleanTrue("showDoze")) {
|
||||
final Context context = Helper.GetContext();
|
||||
final Context context = GetContext();
|
||||
if (!((PowerManager) context.getSystemService(Context.POWER_SERVICE)).isIgnoringBatteryOptimizations(context.getPackageName())) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle("Выключите оптимизацию батареи!");
|
||||
@@ -36,7 +38,7 @@ public class DisableBattery {
|
||||
builder.setNeutralButton("Игнорировать", new DialogInterface.OnClickListener() {
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Helper.edit().putBoolean("showDoze", false).apply();
|
||||
edit().putBoolean("showDoze", false).apply();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
@@ -8,13 +10,13 @@ import android.content.Intent;
|
||||
|
||||
import com.vk.navigation.Navigator;
|
||||
|
||||
import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Prefs;
|
||||
import ru.vtosters.lite.ui.fragments.InstallGMSFragment;
|
||||
|
||||
public class InstallGMS {
|
||||
public static void alert(final Activity activity) {
|
||||
if (!Helper.IsGmsInstalled()) {
|
||||
if (!IsGmsInstalled()) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
||||
builder.setTitle("Внимание!");
|
||||
builder.setMessage(Text());
|
||||
@@ -23,15 +25,15 @@ public class InstallGMS {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Helper.edit().putBoolean("showAlertGms", false).apply();
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton("Установить GMS", new DialogInterface.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Helper.edit().putBoolean("showAlertGms", false).apply();
|
||||
Context context = Helper.GetContext();
|
||||
edit().putBoolean("showAlertGms", false).apply();
|
||||
Context context = GetContext();
|
||||
Intent a2 = new Navigator(InstallGMSFragment.class).a(context);
|
||||
context.startActivity(a2);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
@@ -21,19 +23,17 @@ public class Start {
|
||||
builder.setMessage(getWelcome());
|
||||
builder.setCancelable(false);
|
||||
builder.setPositiveButton("Продолжить", new DialogInterface.OnClickListener() {
|
||||
/* class ru.vtosters.lite.utils.lite.dialog.Start.AnonymousClass1 */
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Helper.edit().putBoolean("showAlert", false).apply();
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
}
|
||||
});
|
||||
builder.setNeutralButton("Новости", new DialogInterface.OnClickListener() {
|
||||
/* class ru.vtosters.lite.utils.lite.dialog.Start.AnonymousClass2 */
|
||||
|
||||
@Override // android.content.DialogInterface.OnClickListener
|
||||
public void onClick(DialogInterface dialogInterface, int i) {
|
||||
Helper.edit().putBoolean("showAlert", false).apply();
|
||||
edit().putBoolean("showAlert", false).apply();
|
||||
activity.startActivity(new Intent("android.intent.action.VIEW").setData(Uri.parse("https://t.me/vtosters")));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,13 +2,11 @@ package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
public class ActivityFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
a(R.xml.preferences_activity);
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
public class FeedFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
a(R.xml.preferences_feed);
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
public class InstallGMSFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
a(R.xml.preferences_gms);
|
||||
|
||||
@@ -7,34 +7,32 @@ import com.vk.core.util.ToastUtils;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
/* renamed from: ru.vtosters.lite.utils.lite.ui.activities.interface reason: invalid class name */
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class InterfaceFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
a(R.xml.preferences_interface);
|
||||
prefs();
|
||||
}
|
||||
|
||||
/* access modifiers changed from: package-private */
|
||||
/* renamed from: ru.vtosters.lite.utils.lite.ui.activities.interface$a */
|
||||
private void prefs() {
|
||||
a("newfeed").a(new a());
|
||||
}
|
||||
|
||||
public boolean restart(Preference preference, Object obj) {
|
||||
ToastUtils.a(Helper.getString("restartapp"));
|
||||
return true;
|
||||
}
|
||||
|
||||
public class a implements Preference.b {
|
||||
a() {
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.b
|
||||
public boolean a(Preference preference, Object obj) {
|
||||
return InterfaceFragment.this.restart(preference, obj);
|
||||
}
|
||||
|
||||
a() {
|
||||
}
|
||||
}
|
||||
|
||||
private void prefs() {
|
||||
a("newfeed").a((Preference.b) new a());
|
||||
}
|
||||
|
||||
public /* synthetic */ boolean restart(Preference preference, Object obj) {
|
||||
ToastUtils.a("Пожалуйста перезапустите приложение");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
public class MessagesFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
a(R.xml.preferences_messages);
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static android.widget.Toast.*;
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
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 android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.widget.Toast;
|
||||
@@ -23,49 +30,58 @@ import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
/* access modifiers changed from: package-private */
|
||||
static class c implements Preference.c {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
copy(Helper.GetContext(), Helper.GetUserToken());
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void copy(Context context, String str) {
|
||||
((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", str));
|
||||
Toast.makeText(context, Helper.getString("copybtn"), Toast.LENGTH_SHORT).show();
|
||||
ToastUtils.a(Helper.getString("tokenwarning"));
|
||||
}
|
||||
|
||||
c() {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
a(R.xml.preferences_other);
|
||||
prefs();
|
||||
}
|
||||
|
||||
/* access modifiers changed from: package-private */
|
||||
private void prefs() {
|
||||
a("firebasefix").a(new a());
|
||||
a("applicationstop").a(new b());
|
||||
a("tokencopy").a(new c());
|
||||
a("applicationrestart").a(new d());
|
||||
a("clearcache").a(new e());
|
||||
a("stickfix").a(new f());
|
||||
a("deleteprefs").a(new deleteprefs());
|
||||
|
||||
// a("saveprefs").a((Preference.c) new saveprefs());
|
||||
// a("restoreprefs").a((Preference.c) new restoreprefs());
|
||||
}
|
||||
|
||||
static class c implements Preference.c {
|
||||
c() {
|
||||
}
|
||||
|
||||
public static void copy(Context context, String str) {
|
||||
((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", str));
|
||||
makeText(context, getString("copybtn"), LENGTH_SHORT).show();
|
||||
ToastUtils.a(getString("tokenwarning"));
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
copy(GetContext(), GetUserToken());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class e implements Preference.c {
|
||||
e() {
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
VKImageLoader.b();
|
||||
ImEngineProvider.a().h();
|
||||
AudioMessageUtils.j();
|
||||
FileUtils.l();
|
||||
ToastUtils.a(Helper.getString("cachecleaned"));
|
||||
ToastUtils.a(getString("cachecleaned"));
|
||||
return true;
|
||||
}
|
||||
|
||||
e() {
|
||||
}
|
||||
}
|
||||
|
||||
/* access modifiers changed from: package-private */
|
||||
public class b implements Preference.c {
|
||||
b() {
|
||||
}
|
||||
@@ -77,19 +93,17 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
}
|
||||
|
||||
/* access modifiers changed from: package-private */
|
||||
public class d implements Preference.c {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
Helper.restarting();
|
||||
return true;
|
||||
d() {
|
||||
}
|
||||
|
||||
d() {
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
restarting();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* access modifiers changed from: package-private */
|
||||
public class a implements Preference.c {
|
||||
a() {
|
||||
}
|
||||
@@ -98,22 +112,61 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||
public boolean a(Preference preference) {
|
||||
VKAccount b = VKAccountManager.b();
|
||||
PushSubscriber.a.a(b.b(), b.c());
|
||||
ToastUtils.a(Helper.getString("fcmtokenrem"));
|
||||
ToastUtils.a(getString("fcmtokenrem"));
|
||||
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
||||
OtherFragment.this.aB().postDelayed(() -> {
|
||||
PushSubscriber.a.a(true);
|
||||
ToastUtils.a(Helper.getString("fcmtokenget"));
|
||||
ToastUtils.a(Helper.getString("fcmtokenfixed"));
|
||||
ToastUtils.a(getString("fcmtokenget"));
|
||||
ToastUtils.a(getString("fcmtokenfixed"));
|
||||
}, 1000);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void prefs() {
|
||||
a("firebasefix").a((Preference.c) new a());
|
||||
a("applicationstop").a((Preference.c) new b());
|
||||
a("tokencopy").a((Preference.c) new c());
|
||||
a("applicationrestart").a((Preference.c) new d());
|
||||
a("clearcache").a((Preference.c) new e());
|
||||
public class f implements Preference.c {
|
||||
f() {
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
SharedPreferences prefs = GetContext().getSharedPreferences("stickers", Context.MODE_PRIVATE);
|
||||
prefs.edit().clear().commit();
|
||||
restarting();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class deleteprefs implements Preference.c {
|
||||
deleteprefs() {
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
deletePrefs();
|
||||
restarting();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class saveprefs implements Preference.c {
|
||||
saveprefs() {
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
backupSettings();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class restoreprefs implements Preference.c {
|
||||
restoreprefs() {
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.c
|
||||
public boolean a(Preference preference) {
|
||||
restoreBackup();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
public class ProxySettingsFragment extends MaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
a(R.xml.preferences_proxy);
|
||||
|
||||
@@ -12,26 +12,14 @@ import ru.vtosters.lite.utils.IconHelper;
|
||||
|
||||
public class ThemesFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
/* access modifiers changed from: package-private */
|
||||
public class a implements Preference.b {
|
||||
public /* synthetic */ a() {
|
||||
}
|
||||
|
||||
@Override // android.support.v7.preference.Preference.b
|
||||
public boolean a(Preference preference, Object obj) {
|
||||
return ThemesFragment.this.apply(preference, obj);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
// com.vtosters.lite.fragments.MaterialPreferenceFragment, android.support.v4.app.DialogFragment, android.support.v4.app.Fragment
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
a(R.xml.preferences_themes);
|
||||
prefs();
|
||||
}
|
||||
|
||||
public /* synthetic */ boolean apply(Preference preference, Object obj) {
|
||||
public boolean apply(Preference preference, Object obj) {
|
||||
if (((Boolean) obj).booleanValue()) {
|
||||
IconHelper.switchToVK();
|
||||
} else {
|
||||
@@ -42,6 +30,23 @@ public class ThemesFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
private void prefs() {
|
||||
a("iconvk").a((Preference.b) new a());
|
||||
a("iconvk").a(new a());
|
||||
a("darktheme").a(new b());
|
||||
a("lighttheme").a(new b());
|
||||
}
|
||||
|
||||
public static class b implements Preference.b {
|
||||
@Override // android.support.v7.preference.Preference.b
|
||||
public boolean a(Preference preference, Object obj) {
|
||||
ToastUtils.a(Helper.getString("restartapp"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public class a implements Preference.b {
|
||||
@Override // android.support.v7.preference.Preference.b
|
||||
public boolean a(Preference preference, Object obj) {
|
||||
return ThemesFragment.this.apply(preference, obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,190 @@
|
||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.Typeface;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Themes;
|
||||
|
||||
public class DockBarAdapter extends RecyclerView.a
|
||||
implements IItemTouchHelper {
|
||||
|
||||
public static final int SELECTED_TAB_TYPE = 1;
|
||||
public static final int DISABLED_TAB_TYPE = 2;
|
||||
public static final int GROUP_TITLE_TYPE = 3;
|
||||
|
||||
|
||||
private final DockBarManager mDockBarManager = DockBarManager.getInstance();
|
||||
|
||||
@Override
|
||||
public RecyclerView.x b(ViewGroup parent, int viewType) {
|
||||
if (viewType == GROUP_TITLE_TYPE) {
|
||||
return new GroupViewHolder(createGroupTitle());
|
||||
} else {
|
||||
return new DockBarEditViewHolder(createTabItem());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int b(int i) {
|
||||
return getItemType(i);
|
||||
}
|
||||
|
||||
private View createTabItem() {
|
||||
LinearLayout container = new LinearLayout(GetContext());
|
||||
container.setTag("tab_item_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)));
|
||||
|
||||
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 title = new TextView(GetContext());
|
||||
title.setTag("title");
|
||||
title.setTextSize(16.0f);
|
||||
title.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
title.setTextColor(Themes.getTextAttr());
|
||||
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(-1, -2);
|
||||
params.weight = 1;
|
||||
params.leftMargin = convertDpToPixel(16);
|
||||
container.addView(title, params);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
private View createGroupTitle() {
|
||||
LinearLayout layout = new LinearLayout(GetContext());
|
||||
layout.setLayoutParams(new LinearLayout.LayoutParams(-1, -2));
|
||||
|
||||
TextView title = new TextView(GetContext());
|
||||
title.setTag("group_title");
|
||||
title.setTextSize(13.0f);
|
||||
title.setPadding(
|
||||
convertDpToPixel(16),
|
||||
convertDpToPixel(13),
|
||||
convertDpToPixel(16),
|
||||
convertDpToPixel(13)
|
||||
);
|
||||
title.setAllCaps(true);
|
||||
title.setTextColor(Themes.getTextAttr());
|
||||
layout.addView(title, new LinearLayout.LayoutParams(-2, -2));
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(RecyclerView.x holder, int position) {
|
||||
if (holder instanceof GroupViewHolder) {
|
||||
((GroupViewHolder) holder).bind(mDockBarManager.getGroupTitle(position));
|
||||
} else {
|
||||
int viewType = getItemType(position);
|
||||
if (viewType == SELECTED_TAB_TYPE) {
|
||||
((DockBarEditViewHolder) holder).bind(mDockBarManager.getSelectedTab(position));
|
||||
} else if (viewType == DISABLED_TAB_TYPE) {
|
||||
((DockBarEditViewHolder) holder).bind(mDockBarManager.getDisabledTab(position));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int au_() {
|
||||
return mDockBarManager.getItemCount();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onItemDismiss(int index) {
|
||||
mDockBarManager.move(this, index);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemMove(int fromPosition, int toPosition) {
|
||||
int fromViewType = getItemType(fromPosition);
|
||||
int toViewType = getItemType(toPosition);
|
||||
|
||||
if (fromPosition < toPosition) {
|
||||
|
||||
if (fromViewType != toViewType) {
|
||||
mDockBarManager.swapAndMigrate(this, fromPosition, toPosition);
|
||||
} else {
|
||||
List<DockBarTab> list = fromViewType == SELECTED_TAB_TYPE ? mDockBarManager.getSelectedTabs() : mDockBarManager.getDisabledTabs();
|
||||
mDockBarManager.swap(this, list, fromViewType, fromPosition, toPosition);
|
||||
}
|
||||
|
||||
} else if (toPosition != 0) {
|
||||
|
||||
if (fromViewType != toViewType) {
|
||||
mDockBarManager.swapAndMigrate(this, fromPosition, toPosition);
|
||||
} else {
|
||||
List<DockBarTab> list = fromViewType == SELECTED_TAB_TYPE ? mDockBarManager.getSelectedTabs() : mDockBarManager.getDisabledTabs();
|
||||
mDockBarManager.swap(this, list, fromViewType, fromPosition, toPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int getIndexByViewType(int position, int viewType) {
|
||||
return mDockBarManager.getIndexByViewType(position, viewType);
|
||||
}
|
||||
|
||||
public int getItemType(int position) {
|
||||
return mDockBarManager.getItemType(position);
|
||||
}
|
||||
|
||||
static class DockBarEditViewHolder extends RecyclerView.x {
|
||||
|
||||
private final ImageView mIcon;
|
||||
private final TextView mTitle;
|
||||
|
||||
public DockBarEditViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
mIcon = itemView.findViewWithTag("icon");
|
||||
mTitle = itemView.findViewWithTag("title");
|
||||
}
|
||||
|
||||
public void bind(DockBarTab tab) {
|
||||
mIcon.setImageResource(tab.iconID);
|
||||
mTitle.setText(tab.titleID);
|
||||
}
|
||||
}
|
||||
|
||||
static class GroupViewHolder extends RecyclerView.x {
|
||||
|
||||
private final TextView mGroupTitle;
|
||||
|
||||
public GroupViewHolder(View view) {
|
||||
super(view);
|
||||
|
||||
mGroupTitle = view.findViewWithTag("group_title");
|
||||
}
|
||||
|
||||
public void bind(String groupTitle) {
|
||||
mGroupTitle.setText(groupTitle);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
||||
|
||||
public class DockBarDragItem {
|
||||
|
||||
public boolean active;
|
||||
public int index;
|
||||
public DockBarTab dockBarTab;
|
||||
|
||||
public DockBarDragItem(boolean active, int index, DockBarTab dockBarTab) {
|
||||
this.active = active;
|
||||
this.index = index;
|
||||
this.dockBarTab = dockBarTab;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.a.ItemTouchHelper;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import me.grishka.appkit.fragments.ToolbarFragment;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class DockBarFragment extends ToolbarFragment {
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private DockBarAdapter mAdapter;
|
||||
private ItemTouchHelper mItemTouchHelper;
|
||||
|
||||
@Override
|
||||
public View d(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
super.b(bundle);
|
||||
|
||||
LinearLayout container = new LinearLayout(n());
|
||||
container.setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
|
||||
container.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
LinearLayout buttonsContainer = new LinearLayout(n());
|
||||
buttonsContainer.setPadding(
|
||||
convertDpToPixel(13),
|
||||
convertDpToPixel(10),
|
||||
convertDpToPixel(13),
|
||||
convertDpToPixel(10)
|
||||
);
|
||||
container.addView(buttonsContainer, new LinearLayout.LayoutParams(-1, -2));
|
||||
|
||||
Button save = new Button(n());
|
||||
save.setText("Сохранить");
|
||||
save.setOnClickListener(v -> {
|
||||
DockBarManager.getInstance().save();
|
||||
restarting();
|
||||
});
|
||||
|
||||
LinearLayout.LayoutParams saveParams = new LinearLayout.LayoutParams(0, -2);
|
||||
saveParams.weight = 1.0f;
|
||||
buttonsContainer.addView(save, saveParams);
|
||||
|
||||
View divider = new View(n());
|
||||
buttonsContainer.addView(divider, new LinearLayout.LayoutParams(convertDpToPixel(10), 0));
|
||||
|
||||
Button reset = new Button(n());
|
||||
reset.setText("Сбросить");
|
||||
reset.setOnClickListener(v -> {
|
||||
DockBarManager.getInstance().delete();
|
||||
restarting();
|
||||
});
|
||||
|
||||
LinearLayout.LayoutParams resetParams = new LinearLayout.LayoutParams(0, -2);
|
||||
resetParams.weight = 1.0f;
|
||||
buttonsContainer.addView(reset, resetParams);
|
||||
|
||||
mRecyclerView = new RecyclerView(n());
|
||||
mRecyclerView.setHasFixedSize(true);
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(n()));
|
||||
mAdapter = new DockBarAdapter();
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
container.addView(mRecyclerView, new LinearLayout.LayoutParams(-1, -1));
|
||||
|
||||
mItemTouchHelper = new ItemTouchHelper(new ItemTouchHelperCallback(mAdapter));
|
||||
mItemTouchHelper.a(mRecyclerView);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(View arg0, Bundle arg1) {
|
||||
o_(true);
|
||||
|
||||
super.a(arg0, arg1);
|
||||
|
||||
a("Редактор докбара");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.vk.apps.AppsFragment;
|
||||
import com.vk.core.d.RecoloredDrawable;
|
||||
import com.vk.core.fragments.FragmentImpl;
|
||||
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationMenuView;
|
||||
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationView;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class DockBarInjector {
|
||||
private static final DockBarManager sManager = DockBarManager.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);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static void inject(BottomNavigationView navigationView) {
|
||||
Menu menu = navigationView.getMenu();
|
||||
menu.clear();
|
||||
try {
|
||||
Field field = BottomNavigationMenuView.class.getDeclaredField("h");
|
||||
field.setAccessible(true);
|
||||
|
||||
Object synchronizedPool = field.get(null);
|
||||
|
||||
Class<?> synchronisedPoolCls = Class.forName("android.support.v4.f.Pools$a");
|
||||
|
||||
Method acquire = synchronisedPoolCls.getDeclaredMethod("a");
|
||||
|
||||
if (synchronizedPool != null) {
|
||||
do {
|
||||
} while (acquire.invoke(synchronizedPool) != null);
|
||||
}
|
||||
|
||||
} catch (NoSuchFieldException | IllegalAccessException | ClassNotFoundException | NoSuchMethodException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
||||
MenuItem add = menu.add(0, tab.id, 0, tab.titleID);
|
||||
Drawable drawable = GetContext().getResources().getDrawable(tab.iconID);
|
||||
ColorStateList colorStateList = GetContext().getResources().getColorStateList(com.vtosters.lite.R.color.bottom_navigation_item);
|
||||
// if (isAndroidMonet()) {
|
||||
// colorStateList = ColorStateList.valueOf(Themes.getAccentColor());
|
||||
// }
|
||||
add.setIcon(new RecoloredDrawable(drawable, colorStateList));
|
||||
add.setShowAsAction(1);
|
||||
add.setCheckable(true);
|
||||
}
|
||||
}
|
||||
|
||||
public static int injectId(String tag) {
|
||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
||||
if (tag.equals(tab.tag))
|
||||
return tab.id;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void injectMenuFragment(Menu menu) {
|
||||
List<MenuItem> menuItems = new ArrayList<>();
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
menuItems.add(menu.getItem(i));
|
||||
}
|
||||
menu.clear();
|
||||
|
||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
||||
if (tab.id != com.vtosters.lite.R.id.tab_menu) {
|
||||
int itemId = tab.id;
|
||||
if (tab.id == com.vtosters.lite.R.id.tab_news) {
|
||||
itemId = com.vtosters.lite.R.id.menu_newsfeed;
|
||||
} else if (tab.id == com.vtosters.lite.R.id.tab_discover) {
|
||||
itemId = com.vtosters.lite.R.id.menu_search;
|
||||
} else if (tab.id == com.vtosters.lite.R.id.tab_feedback) {
|
||||
itemId = com.vtosters.lite.R.id.menu_feedback;
|
||||
} else if (tab.id == com.vtosters.lite.R.id.tab_messages) {
|
||||
itemId = com.vtosters.lite.R.id.menu_messages;
|
||||
}
|
||||
|
||||
MenuItem add = menu.add(0, itemId, 0, tab.titleID);
|
||||
add.setIcon(tab.iconID);
|
||||
add.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
for (MenuItem menuItem : menuItems) {
|
||||
MenuItem item = menu.add(menuItem.getGroupId(), menuItem.getItemId(), menuItem.getOrder(), menuItem.getTitle());
|
||||
item.setIcon(menuItem.getIcon());
|
||||
}
|
||||
menuItems.clear();
|
||||
|
||||
for (int i = 0; i < menu.size(); i++) {
|
||||
MenuItem menuItem = menu.getItem(i);
|
||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
||||
int itemId = menuItem.getItemId();
|
||||
if (itemId == com.vtosters.lite.R.id.menu_newsfeed) {
|
||||
itemId = com.vtosters.lite.R.id.tab_news;
|
||||
} else if (itemId == com.vtosters.lite.R.id.menu_search) {
|
||||
itemId = com.vtosters.lite.R.id.tab_discover;
|
||||
} else if (itemId == com.vtosters.lite.R.id.menu_feedback) {
|
||||
itemId = com.vtosters.lite.R.id.tab_feedback;
|
||||
} else if (itemId == com.vtosters.lite.R.id.menu_messages) {
|
||||
itemId = com.vtosters.lite.R.id.tab_messages;
|
||||
}
|
||||
if (itemId == tab.id && tab.id != com.vtosters.lite.R.id.menu_vk_pay) {
|
||||
menuItems.add(menuItem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (MenuItem menuItem : menuItems) {
|
||||
menu.removeItem(menuItem.getItemId());
|
||||
}
|
||||
}
|
||||
|
||||
public static JSONArray injectMenuJSON(JSONArray arr) {
|
||||
List<String> arrayList = new ArrayList(Arrays.asList(
|
||||
"news",
|
||||
"messages",
|
||||
"feedback",
|
||||
"discover"
|
||||
));
|
||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
||||
if (tab.id == com.vtosters.lite.R.id.tab_discover) {
|
||||
arrayList.remove("discover");
|
||||
} else if (tab.id == com.vtosters.lite.R.id.tab_feedback) {
|
||||
arrayList.remove("feedback");
|
||||
} else if (tab.id == com.vtosters.lite.R.id.tab_messages) {
|
||||
arrayList.remove("messages");
|
||||
} else if (tab.id == com.vtosters.lite.R.id.tab_news) {
|
||||
arrayList.remove("news");
|
||||
}
|
||||
}
|
||||
try {
|
||||
JSONArray jSONArray = new JSONArray();
|
||||
for (int i = 0; i < arrayList.size(); i++) {
|
||||
jSONArray.put(new JSONObject().put("name", arrayList.get(i)));
|
||||
}
|
||||
for (int i2 = 0; i2 < arr.length(); i2++) {
|
||||
jSONArray.put(arr.getJSONObject(i2));
|
||||
}
|
||||
return jSONArray;
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
return arr;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getItemCount() {
|
||||
return sManager.getSelectedTabs().size();
|
||||
}
|
||||
|
||||
public static boolean isDockOpenAllowed(FragmentImpl fragment) {
|
||||
return isDockOpenAllowed(fragment.getClass());
|
||||
}
|
||||
|
||||
public static boolean isDockOpenAllowed(Class<?> cls) {
|
||||
for (DockBarTab tab : sManager.getSelectedTabs())
|
||||
if (tab.fragmentClass == cls)
|
||||
return true;
|
||||
for (DockBarTab tab : sManager.getDisabledTabs())
|
||||
if (tab.fragmentClass == cls)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Class<?> interceptClick(int id) {
|
||||
for (DockBarTab tab : sManager.getSelectedTabs()) {
|
||||
if (id == tab.id)
|
||||
return tab.fragmentClass;
|
||||
}
|
||||
for (DockBarTab tab : sManager.getDisabledTabs()) {
|
||||
if (id == tab.id)
|
||||
return tab.fragmentClass;
|
||||
}
|
||||
return AppsFragment.class;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,313 @@
|
||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
||||
|
||||
import com.vk.apps.AppsFragment;
|
||||
import com.vk.discover.DiscoverFeedFragment;
|
||||
import com.vk.discover.DiscoverFragment;
|
||||
import com.vk.fave.fragments.FaveTabFragment;
|
||||
import com.vk.feedlikes.fragments.FeedLikesFragment;
|
||||
import com.vk.menu.MenuFragment;
|
||||
import com.vk.music.fragment.MusicFragment;
|
||||
import com.vk.newsfeed.Feed2049;
|
||||
import com.vk.newsfeed.NewsfeedFragment;
|
||||
import com.vk.notifications.NotificationsContainerFragment;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.fragments.GamesFragment;
|
||||
import com.vtosters.lite.fragments.PhotosFragment;
|
||||
import com.vtosters.lite.fragments.ProfileFragment;
|
||||
import com.vtosters.lite.fragments.SettingsListFragment;
|
||||
import com.vtosters.lite.fragments.d.DocumentsViewFragment;
|
||||
import com.vtosters.lite.fragments.f.FriendsFragment;
|
||||
import com.vtosters.lite.fragments.g.BirthdaysFragment;
|
||||
import com.vtosters.lite.fragments.h.GroupsFragment;
|
||||
import com.vtosters.lite.fragments.lives.LivesPostListFragment;
|
||||
import com.vtosters.lite.fragments.m.VideosFragment;
|
||||
import com.vtosters.lite.fragments.messages.dialogs.DialogsFragment;
|
||||
import com.vtosters.lite.fragments.money.MoneyTransfersFragment;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Prefs;
|
||||
|
||||
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> mGroups = Arrays.asList(
|
||||
"Выбранные элементы докбара",
|
||||
"Невыбранные элементы"
|
||||
);
|
||||
public DockBarManager() {
|
||||
load();
|
||||
}
|
||||
|
||||
public static DockBarManager getInstance() {
|
||||
if (sInstance == null)
|
||||
sInstance = new DockBarManager();
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private static String readFully(InputStream is) throws IOException {
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[2048];
|
||||
int len;
|
||||
while ((len = is.read(buffer)) > 0) {
|
||||
bos.write(buffer, 0, len);
|
||||
}
|
||||
return bos.toString();
|
||||
}
|
||||
|
||||
private void load() {
|
||||
File dockbar = new File(Helper.GetContext().getFilesDir(), "dockbar.json");
|
||||
|
||||
if (!dockbar.exists()) {
|
||||
mSelectedTabs.add(new DockBarTab("tab_news", Prefs.olddock() ? R.drawable.ic_newsfeed_28 : R.drawable.ic_menu_newsfeed_outline_28, R.string.newsfeed, R.id.tab_news, Prefs.isUseAlternativeFragments() ? Feed2049.b.c() : NewsfeedFragment.class));
|
||||
mSelectedTabs.add(new DockBarTab("tab_discover", Prefs.olddock() ? R.drawable.ic_search_28 : R.drawable.ic_menu_search_outline_28, R.string.search, R.id.tab_discover, Prefs.isUseAlternativeFragments() ? DiscoverFragment.class : DiscoverFeedFragment.class));
|
||||
mSelectedTabs.add(new DockBarTab("tab_messages", Prefs.olddock() ? R.drawable.ic_menu_messages_28 : R.drawable.ic_message_28_outline, R.string.messages, R.id.tab_messages, DialogsFragment.class));
|
||||
mSelectedTabs.add(new DockBarTab("tab_feedback", Prefs.olddock() ? R.drawable.ic_menu_notifications_28 : R.drawable.ic_menu_notification_outline_28, R.string.feedback, R.id.tab_feedback, NotificationsContainerFragment.class));
|
||||
mSelectedTabs.add(new DockBarTab("tab_menu", Prefs.olddock() ? R.drawable.ic_menu_more_28 : R.drawable.ic_menu_more_outline_28, R.string.menu, R.id.tab_menu, MenuFragment.class));
|
||||
|
||||
mDisabledTabs.add(new DockBarTab("tab_friends", R.drawable.ic_user_24, R.string.friends, R.id.menu_friends, FriendsFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_groups", R.drawable.ic_users_24, R.string.groups, R.id.menu_groups, GroupsFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_photos", R.drawable.ic_camera_24, R.string.photos, R.id.menu_photos, PhotosFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_audios", R.drawable.ic_music_24, R.string.music, R.id.menu_audios, MusicFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_videos", R.drawable.ic_video_24, R.string.videos, R.id.menu_videos, VideosFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_lives", R.drawable.ic_live_filter_24dp, R.string.sett_live, R.id.menu_lives, LivesPostListFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_games", R.drawable.ic_games_24, R.string.games, R.id.menu_games, GamesFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_liked", R.drawable.ic_menu_like_24, R.string.sett_likes, R.id.menu_feed_likes, FeedLikesFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_fave", R.drawable.ic_favorite_24, R.string.exo_track_selection_title_video_res_0x7f11031e, R.id.menu_fave, FaveTabFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_documents", R.drawable.ic_document_24, R.string.docs, R.id.menu_documents, DocumentsViewFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_payments", R.drawable.ic_money_transfer_24, R.string.money_transfer_money_transfers, R.id.menu_payments, MoneyTransfersFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_vk_apps", R.drawable.ic_services_24, R.string.menu_apps, R.id.menu_vk_apps, AppsFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_profile", R.drawable.libverify_ic_account_circle_white, R.string.profile, R.id.profile, ProfileFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_settings", R.drawable.ic_settings_24, R.string.menu_settings, R.id.menu_settings, SettingsListFragment.class));
|
||||
mDisabledTabs.add(new DockBarTab("tab_brtd", R.drawable.ic_menu_birthdays, R.string.birthdays_title, R.id.menu_birthdays, BirthdaysFragment.class));
|
||||
|
||||
} else {
|
||||
try {
|
||||
JSONObject json = new JSONObject(readFully(new FileInputStream(dockbar)));
|
||||
|
||||
JSONArray selected = json.getJSONArray("selected");
|
||||
for (int i = 0; i < selected.length(); i++) {
|
||||
JSONObject item = selected.getJSONObject(i);
|
||||
DockBarTab tab = new DockBarTab(
|
||||
item.getString("tag"),
|
||||
item.getInt("iconID"),
|
||||
item.getInt("titleID"),
|
||||
item.getInt("id"),
|
||||
Class.forName(item.getString("fragmentClass"))
|
||||
);
|
||||
if (Prefs.isUseAlternativeFragments()) {
|
||||
if (tab.fragmentClass == NewsfeedFragment.class) {
|
||||
tab.fragmentClass = Feed2049.b.c();
|
||||
} else if (tab.fragmentClass == DiscoverFeedFragment.class) {
|
||||
tab.fragmentClass = DiscoverFragment.class;
|
||||
}
|
||||
} else {
|
||||
if (tab.fragmentClass == Feed2049.b.c()) {
|
||||
tab.fragmentClass = NewsfeedFragment.class;
|
||||
} else if (tab.fragmentClass == DiscoverFragment.class) {
|
||||
tab.fragmentClass = DiscoverFeedFragment.class;
|
||||
}
|
||||
}
|
||||
mSelectedTabs.add(tab);
|
||||
}
|
||||
|
||||
JSONArray disabled = json.getJSONArray("disabled");
|
||||
for (int i = 0; i < disabled.length(); i++) {
|
||||
JSONObject item = disabled.getJSONObject(i);
|
||||
DockBarTab tab = new DockBarTab(
|
||||
item.getString("tag"),
|
||||
item.getInt("iconID"),
|
||||
item.getInt("titleID"),
|
||||
item.getInt("id"),
|
||||
Class.forName(item.getString("fragmentClass"))
|
||||
);
|
||||
if (Prefs.isUseAlternativeFragments()) {
|
||||
if (tab.fragmentClass == NewsfeedFragment.class) {
|
||||
tab.fragmentClass = Feed2049.b.c();
|
||||
} else if (tab.fragmentClass == DiscoverFeedFragment.class) {
|
||||
tab.fragmentClass = DiscoverFragment.class;
|
||||
}
|
||||
} else {
|
||||
if (tab.fragmentClass == Feed2049.b.c()) {
|
||||
tab.fragmentClass = NewsfeedFragment.class;
|
||||
} else if (tab.fragmentClass == DiscoverFragment.class) {
|
||||
tab.fragmentClass = DiscoverFeedFragment.class;
|
||||
}
|
||||
}
|
||||
mDisabledTabs.add(tab);
|
||||
}
|
||||
|
||||
} catch (JSONException | IOException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void delete() {
|
||||
File dockbar = new File(Helper.GetContext().getFilesDir(), "dockbar.json");
|
||||
if (dockbar.exists()) dockbar.delete();
|
||||
}
|
||||
|
||||
public void save() {
|
||||
try {
|
||||
File dockbar = new File(Helper.GetContext().getFilesDir(), "dockbar.json");
|
||||
|
||||
JSONArray selected = new JSONArray();
|
||||
for (DockBarTab tab : mSelectedTabs) {
|
||||
|
||||
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());
|
||||
selected.put(item);
|
||||
}
|
||||
|
||||
JSONArray disabled = new JSONArray();
|
||||
for (DockBarTab tab : mDisabledTabs) {
|
||||
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());
|
||||
disabled.put(item);
|
||||
}
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("selected", selected).put("disabled", disabled);
|
||||
|
||||
FileOutputStream fos = new FileOutputStream(dockbar);
|
||||
fos.write(json.toString().getBytes(StandardCharsets.UTF_8));
|
||||
} catch (JSONException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void swap(DockBarAdapter adapter, List<DockBarTab> list, int itemType, int fromPosition, int toPosition) {
|
||||
int curr = adapter.getIndexByViewType(fromPosition, itemType);
|
||||
int target = adapter.getIndexByViewType(toPosition, itemType);
|
||||
if (fromPosition < toPosition) {
|
||||
for (int i = curr; i < target; i++) {
|
||||
Collections.swap(list, i, i + 1);
|
||||
}
|
||||
} else {
|
||||
for (int i = curr; i > target; i--) {
|
||||
Collections.swap(list, i, i - 1);
|
||||
}
|
||||
}
|
||||
adapter.b(fromPosition, toPosition);// notifyItemMoved
|
||||
}
|
||||
|
||||
public void swapAndMigrate(DockBarAdapter adapter, int fromPosition, int toPosition) {
|
||||
int curr = adapter.getIndexByViewType(fromPosition, adapter.getItemType(fromPosition));
|
||||
int target = adapter.getIndexByViewType(toPosition, adapter.getItemType(toPosition));
|
||||
if (fromPosition < toPosition) {
|
||||
|
||||
if (mSelectedTabs.size() <= MIN_SELECTED_TABS_LIMIT || mSelectedTabs.get(curr).tag.equals("tab_menu"))
|
||||
return;
|
||||
|
||||
DockBarTab tab = mSelectedTabs.get(curr);
|
||||
mSelectedTabs.remove(tab);
|
||||
mDisabledTabs.add(tab);
|
||||
|
||||
for (int i = mDisabledTabs.size() - 1; i > target; i--) {
|
||||
Collections.swap(mDisabledTabs, i, i - 1);
|
||||
}
|
||||
|
||||
for (int i = 0; i < target; i++) {
|
||||
Collections.swap(mDisabledTabs, i, i + 1);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (mSelectedTabs.size() >= MAX_SELECTED_TABS_LIMIT) return;
|
||||
|
||||
DockBarTab tab = mDisabledTabs.get(curr);
|
||||
mDisabledTabs.remove(tab);
|
||||
mSelectedTabs.add(tab);
|
||||
}
|
||||
adapter.b(fromPosition, toPosition);// notifyItemMoved
|
||||
}
|
||||
|
||||
public void move(DockBarAdapter adapter, int index) {
|
||||
if (getItemType(index) == 1) {
|
||||
DockBarTab item = mSelectedTabs.get(getIndexByViewType(index, 1));
|
||||
|
||||
mSelectedTabs.remove(item);
|
||||
|
||||
mDisabledTabs.add(item);
|
||||
|
||||
for (int i = mDisabledTabs.size() - 1; i > 0; i--) {
|
||||
Collections.swap(mDisabledTabs, i, i - 1);
|
||||
}
|
||||
|
||||
adapter.e_(index); // notifyItemRemoved
|
||||
adapter.d_(getItemCount() - mDisabledTabs.size()); // notifyItemInserted
|
||||
}
|
||||
}
|
||||
|
||||
public int getItemCount() {
|
||||
return mSelectedTabs.size() + mDisabledTabs.size() + mGroups.size();
|
||||
}
|
||||
|
||||
public int getIndexByViewType(int position, int viewType) {
|
||||
if (viewType == DockBarAdapter.SELECTED_TAB_TYPE) {
|
||||
return position - 1;
|
||||
} else if (viewType == DockBarAdapter.DISABLED_TAB_TYPE) {
|
||||
return position - mSelectedTabs.size() - mGroups.size();
|
||||
} else {
|
||||
return position != 0 ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int getItemType(int position) {
|
||||
if (position == 0 || position == mSelectedTabs.size() + 1) {
|
||||
return DockBarAdapter.GROUP_TITLE_TYPE;
|
||||
} else if (position - 1 < mSelectedTabs.size()) {
|
||||
return DockBarAdapter.SELECTED_TAB_TYPE;
|
||||
} else if (position - 1 >= mSelectedTabs.size()) {
|
||||
return DockBarAdapter.DISABLED_TAB_TYPE;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public DockBarTab getSelectedTab(int pos) {
|
||||
return mSelectedTabs.get(getIndexByViewType(pos, 1));
|
||||
}
|
||||
|
||||
public DockBarTab getDisabledTab(int pos) {
|
||||
return mDisabledTabs.get(getIndexByViewType(pos, 2));
|
||||
}
|
||||
|
||||
public String getGroupTitle(int pos) {
|
||||
return mGroups.get(getIndexByViewType(pos, -1));
|
||||
}
|
||||
|
||||
public List<DockBarTab> getSelectedTabs() {
|
||||
return mSelectedTabs;
|
||||
}
|
||||
|
||||
public List<DockBarTab> getDisabledTabs() {
|
||||
return mDisabledTabs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
||||
|
||||
import com.vk.core.fragments.FragmentImpl;
|
||||
|
||||
public class DockBarTab {
|
||||
|
||||
public String tag;
|
||||
public int iconID;
|
||||
public int titleID;
|
||||
public int id;
|
||||
public Class<? extends FragmentImpl> fragmentClass;
|
||||
|
||||
public DockBarTab(String tag, int iconID, int titleID, int resID, Class<?> fragmentClass) {
|
||||
this.tag = tag;
|
||||
this.iconID = iconID;
|
||||
this.titleID = titleID;
|
||||
this.id = resID;
|
||||
this.fragmentClass = (Class<? extends FragmentImpl>) fragmentClass;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
||||
|
||||
public interface IItemTouchHelper {
|
||||
|
||||
void onItemDismiss(int index);
|
||||
|
||||
boolean onItemMove(int fromPosition, int toPosition);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package ru.vtosters.lite.ui.fragments.dockbar;
|
||||
|
||||
import static androidx.recyclerview.widget.ItemTouchHelper.Callback.makeMovementFlags;
|
||||
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.support.v7.widget.a.ItemTouchHelper;
|
||||
|
||||
public class ItemTouchHelperCallback extends ItemTouchHelper.a {
|
||||
|
||||
private final DockBarAdapter mAdapter;
|
||||
|
||||
public ItemTouchHelperCallback(DockBarAdapter mAdapter) {
|
||||
this.mAdapter = mAdapter;
|
||||
}
|
||||
|
||||
@Override // isLongPressDragEnabled
|
||||
public boolean a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // isItemViewSwipeEnabled
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int a(RecyclerView recyclerView, RecyclerView.x viewHolder) {
|
||||
int pos = mAdapter.getItemType(viewHolder.d());
|
||||
int dragFlags = pos != DockBarAdapter.GROUP_TITLE_TYPE ? androidx.recyclerview.widget.ItemTouchHelper.UP | androidx.recyclerview.widget.ItemTouchHelper.DOWN : 0;
|
||||
int swipeFlags = pos == 1 ? androidx.recyclerview.widget.ItemTouchHelper.START | androidx.recyclerview.widget.ItemTouchHelper.END : 0;
|
||||
return makeMovementFlags(dragFlags, swipeFlags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(RecyclerView.x viewHolder, int direction) {
|
||||
mAdapter.onItemDismiss(viewHolder.d());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean b(RecyclerView recyclerView, RecyclerView.x viewHolder, RecyclerView.x target) {
|
||||
if (mAdapter.getItemType(viewHolder.d()) == DockBarAdapter.GROUP_TITLE_TYPE)
|
||||
return false;
|
||||
return mAdapter.onItemMove(viewHolder.d(), target.d());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package ru.vtosters.lite.ui.fragments.multiaccount;
|
||||
|
||||
class MultiAccountItem {
|
||||
public String nickname;
|
||||
public String imageUrl;
|
||||
public int index;
|
||||
|
||||
public MultiAccountItem(String name, String imageUrl, int index) {
|
||||
this.nickname = name;
|
||||
this.imageUrl = imageUrl;
|
||||
this.index = index;
|
||||
}
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
package ru.vtosters.lite.ui.fragments.multiaccount;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
import static ru.vtosters.lite.utils.Themes.*;
|
||||
|
||||
import android.graphics.Typeface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.vk.audio.AudioMessageUtils;
|
||||
import com.vk.auth.api.VKAccount;
|
||||
import com.vk.core.f.FileUtils;
|
||||
import com.vk.core.util.AppContextHolder;
|
||||
import com.vk.imageloader.VKImageLoader;
|
||||
import com.vk.imageloader.view.VKCircleImageView;
|
||||
import com.vk.pushes.PushSubscriber;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Themes;
|
||||
|
||||
public class MultiAccountAdapter extends RecyclerView.a<MultiAccountAdapter.MultiAccountViewHolder> {
|
||||
|
||||
private final List<MultiAccountItem> mAccounts = MultiAccountManager.buildList();
|
||||
|
||||
@Override
|
||||
public MultiAccountViewHolder b(ViewGroup parent, int viewType) {
|
||||
RelativeLayout layout = new RelativeLayout(parent.getContext());
|
||||
layout.setPadding(
|
||||
convertDpToPixel(12),
|
||||
convertDpToPixel(6),
|
||||
convertDpToPixel(6),
|
||||
convertDpToPixel(6)
|
||||
);
|
||||
|
||||
VKCircleImageView avatar = new VKCircleImageView(parent.getContext());
|
||||
avatar.setId(1);
|
||||
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(
|
||||
convertDpToPixel(48),
|
||||
convertDpToPixel(48)
|
||||
);
|
||||
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
|
||||
params.addRule(RelativeLayout.CENTER_VERTICAL);
|
||||
layout.addView(avatar, params);
|
||||
|
||||
TextView nickname = new TextView(parent.getContext());
|
||||
nickname.setId(2);
|
||||
nickname.setPaddingRelative(
|
||||
convertDpToPixel(12),
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
nickname.setEllipsize(TextUtils.TruncateAt.END);
|
||||
nickname.setSingleLine(true);
|
||||
nickname.setTextSize(15.0f);
|
||||
nickname.setTextColor(getTextAttr());
|
||||
nickname.setTypeface(Typeface.create("sans-serif-medium", Typeface.NORMAL));
|
||||
RelativeLayout.LayoutParams params1 = new RelativeLayout.LayoutParams(-2, -2);
|
||||
params1.addRule(RelativeLayout.CENTER_VERTICAL);
|
||||
params1.addRule(RelativeLayout.RIGHT_OF, 1);
|
||||
layout.addView(nickname, params1);
|
||||
|
||||
ImageButton action = new ImageButton(parent.getContext());
|
||||
action.setId(3);
|
||||
action.setBackgroundResource(com.vtosters.lite.R.drawable.rounded_list_selector);
|
||||
Drawable drawable = recolorDrawable(getResources().getDrawable(R.drawable.ic_list_remove));
|
||||
action.setImageDrawable(drawable);
|
||||
RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams(
|
||||
convertDpToPixel(48),
|
||||
convertDpToPixel(48)
|
||||
);
|
||||
params2.addRule(RelativeLayout.CENTER_VERTICAL);
|
||||
params2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
|
||||
layout.addView(action, params2);
|
||||
|
||||
return new MultiAccountViewHolder(layout);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(MultiAccountViewHolder holder, int pos) {
|
||||
holder.bind(pos == 0 ? null : mAccounts.get(pos - 1), pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int au_() {
|
||||
return mAccounts.size() + 1;
|
||||
}
|
||||
|
||||
static class MultiAccountViewHolder extends RecyclerView.x {
|
||||
|
||||
private final RelativeLayout mContainer;
|
||||
private final VKCircleImageView mAvatar;
|
||||
private final TextView mNickname;
|
||||
private final ImageButton mAction;
|
||||
|
||||
public MultiAccountViewHolder(View view) {
|
||||
super(view);
|
||||
|
||||
mContainer = (RelativeLayout) view;
|
||||
mAvatar = view.findViewById(1);
|
||||
mNickname = view.findViewById(2);
|
||||
mAction = view.findViewById(3);
|
||||
}
|
||||
|
||||
public void bind(MultiAccountItem item, int pos) {
|
||||
if (pos == 0) {
|
||||
mNickname.setText("Добавить новый аккаунт");
|
||||
mContainer.setOnClickListener(v -> {
|
||||
MultiAccountManager.addAccount();
|
||||
|
||||
VKImageLoader.b();
|
||||
ImEngineProvider.a().h();
|
||||
AudioMessageUtils.j();
|
||||
FileUtils.l();
|
||||
VKAccount b = VKAccountManager.b();
|
||||
PushSubscriber.a.a(b.b(), b.c());
|
||||
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
||||
restarting();
|
||||
});
|
||||
Drawable drawable = recolorDrawable(getResources().getDrawable(R.drawable.ic_list_add));
|
||||
mAction.setImageDrawable(drawable);
|
||||
mAction.setClickable(false);
|
||||
} else {
|
||||
mContainer.setOnClickListener(v -> {
|
||||
MultiAccountManager.switchAccount(item.index);
|
||||
|
||||
VKImageLoader.b();
|
||||
ImEngineProvider.a().h();
|
||||
AudioMessageUtils.j();
|
||||
FileUtils.l();
|
||||
VKAccount b = VKAccountManager.b();
|
||||
PushSubscriber.a.a(b.b(), b.c());
|
||||
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
||||
restarting();
|
||||
|
||||
});
|
||||
|
||||
if (isNetworkConnected())
|
||||
mAvatar.a(item.imageUrl);
|
||||
else
|
||||
mAvatar.a(R.drawable.vkim_ic_placeholder_user_square_64dp);
|
||||
|
||||
mNickname.setText(item.nickname);
|
||||
|
||||
mAction.setOnClickListener(v -> {
|
||||
MultiAccountManager.deleteAccount(item.index);
|
||||
|
||||
VKImageLoader.b();
|
||||
ImEngineProvider.a().h();
|
||||
AudioMessageUtils.j();
|
||||
FileUtils.l();
|
||||
VKAccount b = VKAccountManager.b();
|
||||
PushSubscriber.a.a(b.b(), b.c());
|
||||
AppContextHolder.a.getSharedPreferences("gcm", 0).edit().clear().apply();
|
||||
restarting();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package ru.vtosters.lite.ui.fragments.multiaccount;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import me.grishka.appkit.fragments.ToolbarFragment;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class MultiAccountFragment extends ToolbarFragment {
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private MultiAccountAdapter mAdapter;
|
||||
|
||||
@Override
|
||||
public View d(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
||||
|
||||
LinearLayout layout = new LinearLayout(n());
|
||||
|
||||
mRecyclerView = new RecyclerView(n());
|
||||
mRecyclerView.setLayoutManager(new LinearLayoutManager(n()));
|
||||
mAdapter = new MultiAccountAdapter();
|
||||
mRecyclerView.setAdapter(mAdapter);
|
||||
layout.addView(mRecyclerView, new LinearLayout.LayoutParams(-1, -1));
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(View arg0, Bundle arg1) {
|
||||
o_(true);
|
||||
|
||||
super.a(arg0, arg1);
|
||||
|
||||
a(Helper.getString("accounts"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package ru.vtosters.lite.ui.fragments.multiaccount;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
import static ru.vtosters.lite.utils.Helper.GetContext;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class MultiAccountManager {
|
||||
|
||||
public static void migrate() {
|
||||
SharedPreferences OldPrefs = GetContext().getSharedPreferences("pref_account_manager", Context.MODE_PRIVATE);
|
||||
String OldPrefsValue = OldPrefs.getString("key_vk_account", "");
|
||||
SharedPreferences NewPrefs = GetContext().getSharedPreferences("pref_account_manager0", Context.MODE_PRIVATE);
|
||||
SharedPreferences.Editor editor = NewPrefs.edit();
|
||||
editor.putString("key_vk_account", OldPrefsValue);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static SharedPreferences getCurrentAccount() {
|
||||
int account = GetPreferences().getInt("account", 0);
|
||||
return GetContext().getSharedPreferences("pref_account_manager" + (account != 0 ? account : ""), Context.MODE_PRIVATE);
|
||||
}
|
||||
|
||||
private static int getAccountPrefsCount() {
|
||||
File[] prefs = new File(GetContext().getFilesDir().getParent(), "shared_prefs")
|
||||
.listFiles((dir, name) -> {
|
||||
return name.matches("pref_account_manager\\d+\\.xml");
|
||||
});
|
||||
return prefs != null ? prefs.length : 0;
|
||||
}
|
||||
|
||||
private static String withRegex(String base, String regex, String def) {
|
||||
Pattern pattern = Pattern.compile(regex);
|
||||
Matcher matcher = pattern.matcher(base);
|
||||
if (matcher.find()) {
|
||||
return matcher.group(1);
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
public static List<MultiAccountItem> buildList() {
|
||||
List<MultiAccountItem> list = new ArrayList<>();
|
||||
for (int i = 0; i <= getAccountPrefsCount(); i++) {
|
||||
SharedPreferences prefs = GetContext().getSharedPreferences("pref_account_manager" + i, Context.MODE_PRIVATE);
|
||||
String keyVKAccount = prefs.getString("key_vk_account", "");
|
||||
if (!keyVKAccount.isEmpty()) {
|
||||
String name = withRegex(keyVKAccount, ".*\"name\":\\{.*?:\"(.*?)\"\\}.*", "");
|
||||
String avatarUrl = withRegex(keyVKAccount, ".*\"photo\":\\{.*?:\"(.*?)\"\\}.*", "https://vk.com/images/camera_200.png")
|
||||
.replace("\\/", "/");
|
||||
list.add(new MultiAccountItem(
|
||||
name, avatarUrl, i
|
||||
));
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static boolean switchAccount(int i) {
|
||||
int account = GetPreferences().getInt("account", 0);
|
||||
if (account == i) return false;
|
||||
|
||||
GetPreferences().edit().putInt("account", i).commit();
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void addAccount() {
|
||||
GetPreferences().edit().putInt("account", getAccountPrefsCount()).commit();
|
||||
}
|
||||
|
||||
public static void deleteAccount(int i) {
|
||||
int account = GetPreferences().getInt("account", 0);
|
||||
SharedPreferences prefs = GetContext().getSharedPreferences("pref_account_manager" + i, Context.MODE_PRIVATE);
|
||||
prefs.edit().clear().commit();
|
||||
File file = new File(new File(GetContext().getFilesDir().getParent(), "shared_prefs"), "pref_account_manager" + i);
|
||||
if (file.exists()) file.delete();
|
||||
if (account == i && getAccountPrefsCount() > 0)
|
||||
switchAccount(buildList().get(0).index);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,9 @@
|
||||
package ru.vtosters.lite.ui.fragments.tgstickers;
|
||||
|
||||
import static android.widget.Toast.*;
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
import static ru.vtosters.lite.utils.Themes.*;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.BroadcastReceiver;
|
||||
@@ -42,8 +46,8 @@ import java.io.File;
|
||||
|
||||
import me.grishka.appkit.fragments.ToolbarFragment;
|
||||
import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.ui.PreferencesUtil;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.utils.Prefs;
|
||||
import ru.vtosters.lite.utils.Themes;
|
||||
|
||||
@@ -52,23 +56,15 @@ public class StickersFragment extends ToolbarFragment {
|
||||
public final static String ACTION_RELOAD = "com.vtosters.lite.action.RELOAD_TGS_LIST";
|
||||
|
||||
private final static int TYPE_DIRECT = 0, TYPE_SOCKS = 2, TYPE_TOASTER_SERVER = 3;
|
||||
|
||||
private static final String TAG = "StickersFragment";
|
||||
public int from;
|
||||
public int to;
|
||||
private TelegramStickersGrabber grabber;
|
||||
private TelegramStickersService stickersService;
|
||||
private FloatingActionButton fab;
|
||||
|
||||
private static final String TAG = "StickersFragment";
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private RecyclerView.Adapter adapter;
|
||||
|
||||
private boolean movePending = false;
|
||||
public int from;
|
||||
public int to;
|
||||
|
||||
private int editPadding;
|
||||
private RecyclerView recycler;
|
||||
|
||||
private final BroadcastReceiver receiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
@@ -90,6 +86,8 @@ public class StickersFragment extends ToolbarFragment {
|
||||
}
|
||||
}
|
||||
};
|
||||
private int editPadding;
|
||||
private RecyclerView recycler;
|
||||
|
||||
private void initGrabber() {
|
||||
int method = TGPref.getTGConnectMethod();
|
||||
@@ -118,7 +116,7 @@ public class StickersFragment extends ToolbarFragment {
|
||||
|
||||
private void openMenu(String toast) {
|
||||
if (toast != null) {
|
||||
Toast.makeText(super.n(), toast, Toast.LENGTH_SHORT).show();
|
||||
makeText(super.n(), toast, LENGTH_SHORT).show();
|
||||
}
|
||||
var intent = new Navigator(StickersPreferencesFragment.class, new Bundle()).a(super.n());
|
||||
super.n().startActivity(intent);
|
||||
@@ -130,7 +128,7 @@ public class StickersFragment extends ToolbarFragment {
|
||||
super.a(menu, menuInflater);
|
||||
MenuItem add = menu.add(0, 0, 0, "");
|
||||
add.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||
add.setIcon(Helper.getResources().getDrawable(com.vtosters.lite.R.drawable.ic_settings_24));
|
||||
add.setIcon(getResources().getDrawable(com.vtosters.lite.R.drawable.ic_settings_24));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -155,21 +153,21 @@ public class StickersFragment extends ToolbarFragment {
|
||||
linearLayout.addView(editText);
|
||||
editText.getLayoutParams().width = ViewGroup.LayoutParams.MATCH_PARENT;
|
||||
ViewGroup.MarginLayoutParams margin = ((ViewGroup.MarginLayoutParams) editText.getLayoutParams());
|
||||
margin.setMargins(Helper.convertDpToPixel(24f), 0, Helper.convertDpToPixel(24f), 0);
|
||||
margin.setMargins(convertDpToPixel(24f), 0, convertDpToPixel(24f), 0);
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
new AlertDialog.Builder(super.n())
|
||||
.setTitle(Helper.getString("stickersapi5"))
|
||||
.setMessage(Helper.getString("stickersapi6"))
|
||||
.setTitle(getString("stickersapi5"))
|
||||
.setMessage(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).setNeutralButton(Helper.getString("stickersapi7"), (dialog, which) -> new AlertDialog.Builder(super.n())
|
||||
.setTitle(Helper.getString("stickersapi8"))
|
||||
.setMessage(Helper.getString("stickersapi9") +
|
||||
Helper.getString("stickersapi10")).setPositiveButton(android.R.string.ok, null)
|
||||
.create().show()).create().show();
|
||||
}).setNegativeButton(android.R.string.cancel, null).setNeutralButton(getString("stickersapi7"), (dialog, which) -> new AlertDialog.Builder(super.n())
|
||||
.setTitle(getString("stickersapi8"))
|
||||
.setMessage(getString("stickersapi9") +
|
||||
getString("stickersapi10")).setPositiveButton(android.R.string.ok, null)
|
||||
.create().show()).create().show();
|
||||
}
|
||||
|
||||
private void checkApiKey(final Runnable r) {
|
||||
@@ -179,7 +177,7 @@ public class StickersFragment extends ToolbarFragment {
|
||||
|
||||
final ProgressDialog progressDialog = new ProgressDialog(context);
|
||||
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
|
||||
progressDialog.setMessage(Helper.getString("stickersapi1"));
|
||||
progressDialog.setMessage(getString("stickersapi1"));
|
||||
progressDialog.show();
|
||||
|
||||
grabber.checkKey(new TelegramStickersGrabber.KeyCheckListener() {
|
||||
@@ -187,7 +185,7 @@ public class StickersFragment extends ToolbarFragment {
|
||||
public void onKeyChecked(boolean ok) {
|
||||
progressDialog.dismiss();
|
||||
if (!ok) {
|
||||
Toast.makeText(context, Helper.getString("stickersapi2"), Toast.LENGTH_SHORT).show();
|
||||
makeText(context, getString("stickersapi2"), LENGTH_SHORT).show();
|
||||
return;
|
||||
}
|
||||
stickersService.setBotKey(TGPref.getTGBotKey());
|
||||
@@ -199,9 +197,9 @@ public class StickersFragment extends ToolbarFragment {
|
||||
public void onNetError() {
|
||||
progressDialog.dismiss();
|
||||
new AlertDialog.Builder(context)
|
||||
.setMessage(Helper.getString("stickersapi3"))
|
||||
.setMessage(getString("stickersapi3"))
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.setPositiveButton(Helper.getString("stickersapi4"), (arg0, arg1) -> checkApiKey(r)).create().show();
|
||||
.setPositiveButton(getString("stickersapi4"), (arg0, arg1) -> checkApiKey(r)).create().show();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -211,9 +209,9 @@ public class StickersFragment extends ToolbarFragment {
|
||||
@Override
|
||||
public View d(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
grabber = new TelegramStickersGrabber(TGPref.getTGBotKey());
|
||||
stickersService = TelegramStickersService.getInstance(Helper.GetContext());
|
||||
stickersService = TelegramStickersService.getInstance(GetContext());
|
||||
|
||||
editPadding = Helper.convertDpToPixel(24f);
|
||||
editPadding = convertDpToPixel(24f);
|
||||
|
||||
FrameLayout v = new FrameLayout(container.getContext());
|
||||
|
||||
@@ -222,11 +220,11 @@ public class StickersFragment extends ToolbarFragment {
|
||||
|
||||
fab = new FloatingActionButton(container.getContext());
|
||||
fab.setImageResource(R.drawable.ic_add_24);
|
||||
fab.setBackgroundTintList(ColorStateList.valueOf(Themes.getAccentColor()));
|
||||
fab.setBackgroundTintList(ColorStateList.valueOf(getAccentColor()));
|
||||
fab.setOnClickListener(v2 -> fabClick());
|
||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(FrameLayout.LayoutParams.WRAP_CONTENT, FrameLayout.LayoutParams.WRAP_CONTENT);
|
||||
params.gravity = Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL;
|
||||
params.setMargins(0, 0, 0, Helper.convertDpToPixel(12f));
|
||||
params.setMargins(0, 0, 0, convertDpToPixel(12f));
|
||||
fab.setLayoutParams(params);
|
||||
|
||||
v.addView(recycler);
|
||||
@@ -245,7 +243,7 @@ public class StickersFragment extends ToolbarFragment {
|
||||
switch (method) {
|
||||
case TYPE_SOCKS:
|
||||
if (TGPref.getTGProxyIP() == null) {
|
||||
openMenu(Helper.getString("stickersproxy1"));
|
||||
openMenu(getString("stickersproxy1"));
|
||||
return;
|
||||
}
|
||||
case TYPE_TOASTER_SERVER:
|
||||
@@ -254,27 +252,27 @@ public class StickersFragment extends ToolbarFragment {
|
||||
LinearLayout linearLayout = new LinearLayout(super.n());
|
||||
|
||||
final EditText editText = new EditText(super.n());
|
||||
editText.setHintTextColor(PreferencesUtil.getSTextColor(Helper.GetContext()));
|
||||
editText.setHintTextColor(PreferencesUtil.getSTextColor(GetContext()));
|
||||
|
||||
// Костыль для китката
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(Helper.GetContext())));
|
||||
editText.setBackgroundTintList(ColorStateList.valueOf(PreferencesUtil.getTextColor(GetContext())));
|
||||
} else {
|
||||
ViewCompat.setBackgroundTintList(editText, ColorStateList.valueOf(PreferencesUtil.getTextColor(Helper.GetContext())));
|
||||
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(Helper.convertDpToPixel(24f), 0, Helper.convertDpToPixel(24f), 0);
|
||||
margin.setMargins(convertDpToPixel(24f), 0, convertDpToPixel(24f), 0);
|
||||
editText.setLayoutParams(margin);
|
||||
|
||||
new AlertDialog.Builder(super.n()).setTitle(Helper.getString("stickershelp1"))
|
||||
.setMessage(Helper.getString("stickershelp2"))
|
||||
new AlertDialog.Builder(super.n()).setTitle(getString("stickershelp1"))
|
||||
.setMessage(getString("stickershelp2"))
|
||||
.setView(linearLayout)
|
||||
.setPositiveButton(android.R.string.ok, (dialog, which) -> {
|
||||
String pack = editText.getText().toString();
|
||||
pack = parsePack(pack);
|
||||
stickersService.requestPackDownload(pack, new File(Helper.GetContext().getFilesDir(), new File("VT-Stickers", pack).getAbsolutePath()));
|
||||
stickersService.requestPackDownload(pack, new File(GetContext().getFilesDir(), new File("VT-Stickers", pack).getAbsolutePath()));
|
||||
}).setNeutralButton(android.R.string.cancel, null).create().show();
|
||||
};
|
||||
if (TGPref.getTGBotKey() == null) enterBotKey(() -> checkApiKey(work));
|
||||
@@ -284,7 +282,7 @@ public class StickersFragment extends ToolbarFragment {
|
||||
};
|
||||
|
||||
if (method == -1) {
|
||||
openMenu(Helper.getString("stickersconnection"));
|
||||
openMenu(getString("stickersconnection"));
|
||||
} else {
|
||||
r.run();
|
||||
}
|
||||
@@ -293,7 +291,7 @@ public class StickersFragment extends ToolbarFragment {
|
||||
@Override
|
||||
public void b(@Nullable Bundle savedInstanceState) {
|
||||
super.b(savedInstanceState);
|
||||
Helper.GetContext().registerReceiver(receiver, new IntentFilter(ACTION_RELOAD));
|
||||
GetContext().registerReceiver(receiver, new IntentFilter(ACTION_RELOAD));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -302,13 +300,13 @@ public class StickersFragment extends ToolbarFragment {
|
||||
|
||||
super.a(arg0, arg1);
|
||||
|
||||
a(Helper.getString("vtltgs"));
|
||||
a(getString("vtltgs"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void A_() {
|
||||
super.A_();
|
||||
Helper.GetContext().unregisterReceiver(receiver);
|
||||
GetContext().unregisterReceiver(receiver);
|
||||
}
|
||||
|
||||
private String parsePack(String pack) {
|
||||
@@ -321,31 +319,12 @@ public class StickersFragment extends ToolbarFragment {
|
||||
}
|
||||
|
||||
public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.StickerPackViewHolder> {
|
||||
private String TAG = "StickerPackAdapter";
|
||||
|
||||
public class StickerPackViewHolder extends RecyclerView.ViewHolder {
|
||||
private SwitchCompat switchCompat;
|
||||
private ImageView stickerImage, updateButton, deleteButton;
|
||||
private TextView name, count;
|
||||
private LinearLayout layout;
|
||||
|
||||
StickerPackViewHolder(@NonNull View view) {
|
||||
super(view);
|
||||
|
||||
switchCompat = (SwitchCompat) view.findViewById(R.id.choose_btn);
|
||||
stickerImage = (ImageView) view.findViewById(R.id.photo);
|
||||
updateButton = (ImageView) view.findViewById(R.id.button_update);
|
||||
deleteButton = (ImageView) view.findViewById(R.id.action_delete);
|
||||
name = (TextView) view.findViewById(R.id.vkim_cancel);
|
||||
count = (TextView) view.findViewById(R.id.vkim_cancel_label_text);
|
||||
layout = (LinearLayout) view.findViewById(R.id.linearLayout5);
|
||||
}
|
||||
}
|
||||
private final String TAG = "StickerPackAdapter";
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public StickerPackViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
var view = LayoutInflater.from(parent.getContext()).inflate(Helper.getIdentifier("tgs_entry", "layout"), parent, false);
|
||||
var view = LayoutInflater.from(parent.getContext()).inflate(getIdentifier("tgs_entry", "layout"), parent, false);
|
||||
return new StickerPackViewHolder(view);
|
||||
}
|
||||
|
||||
@@ -365,19 +344,19 @@ public class StickersFragment extends ToolbarFragment {
|
||||
if (f.exists()) {
|
||||
holder.stickerImage.setImageURI(Uri.parse("file://" + f.getAbsolutePath()));
|
||||
} else {
|
||||
holder.stickerImage.setImageDrawable(Helper.getResources().getDrawable(R.drawable.icon_vk_104));
|
||||
holder.stickerImage.setImageDrawable(getResources().getDrawable(R.drawable.icon_vk_104));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
holder.updateButton.setImageDrawable(Themes.recolorDrawable(Helper.getResources().getDrawable(R.drawable.ic_camera_switch_48)));
|
||||
holder.updateButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.ic_camera_switch_48)));
|
||||
holder.updateButton.setOnClickListener(listener -> {
|
||||
stickersService.setBotKey(TGPref.getTGBotKey());
|
||||
stickersService.requestPackDownload(pack.id, new File(Helper.GetContext().getFilesDir(), new File("VT-Stickers", pack.id).getAbsolutePath()));
|
||||
stickersService.requestPackDownload(pack.id, new File(GetContext().getFilesDir(), new File("VT-Stickers", pack.id).getAbsolutePath()));
|
||||
});
|
||||
|
||||
holder.deleteButton.setImageDrawable(Themes.recolorDrawable(Helper.getResources().getDrawable(R.drawable.vkim_ic_msg_delete)));
|
||||
holder.deleteButton.setImageDrawable(recolorDrawable(getResources().getDrawable(R.drawable.vkim_ic_msg_delete)));
|
||||
holder.deleteButton.setOnClickListener(listener -> {
|
||||
stickersService.deletePack(pack);
|
||||
notifyItemRemoved(position);
|
||||
@@ -386,13 +365,13 @@ public class StickersFragment extends ToolbarFragment {
|
||||
holder.name.setText(pack.title);
|
||||
holder.switchCompat.setChecked(pack.enabled);
|
||||
holder.switchCompat.setOnCheckedChangeListener((buttonView, isChecked) -> stickersService.setPackEnabled(pack, isChecked, false));
|
||||
holder.count.setText(pack.stickersCount + " " + Helper.getString("stickerscount"));
|
||||
holder.count.setText(pack.stickersCount + " " + getString("stickerscount"));
|
||||
|
||||
holder.layout.setBackgroundColor(Prefs.getNavbarColor());
|
||||
|
||||
// Color костыль
|
||||
int color = Themes.getTextAttr();
|
||||
int secondary = Themes.getSTextAttr();
|
||||
int color = getTextAttr();
|
||||
int secondary = getSTextAttr();
|
||||
|
||||
holder.name.setTextColor(color);
|
||||
holder.count.setTextColor(secondary);
|
||||
@@ -402,6 +381,28 @@ public class StickersFragment extends ToolbarFragment {
|
||||
public int getItemCount() {
|
||||
return stickersService.getPacksListReference().size();
|
||||
}
|
||||
|
||||
public class StickerPackViewHolder extends RecyclerView.ViewHolder {
|
||||
private final SwitchCompat switchCompat;
|
||||
private final ImageView stickerImage;
|
||||
private final ImageView updateButton;
|
||||
private final ImageView deleteButton;
|
||||
private final TextView name;
|
||||
private final TextView count;
|
||||
private final LinearLayout layout;
|
||||
|
||||
StickerPackViewHolder(@NonNull View view) {
|
||||
super(view);
|
||||
|
||||
switchCompat = view.findViewById(R.id.choose_btn);
|
||||
stickerImage = view.findViewById(R.id.photo);
|
||||
updateButton = view.findViewById(R.id.button_update);
|
||||
deleteButton = view.findViewById(R.id.action_delete);
|
||||
name = view.findViewById(R.id.vkim_cancel);
|
||||
count = view.findViewById(R.id.vkim_cancel_label_text);
|
||||
layout = view.findViewById(R.id.linearLayout5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+18
-16
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.ui.fragments.tgstickers;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.aefyr.tsg.g2.stickersgrabber.TelegramStickersGrabber;
|
||||
@@ -8,8 +10,8 @@ import com.vtosters.lite.fragments.MaterialPreferenceToolbarFragment;
|
||||
|
||||
import ru.vtosters.lite.tgs.TGPref;
|
||||
import ru.vtosters.lite.tgs.TGRoot;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
import ru.vtosters.lite.ui.PreferencesUtil;
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
@@ -17,19 +19,19 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
||||
public void b(Bundle bundle) {
|
||||
super.b(bundle);
|
||||
|
||||
int vtosterXml = Helper.GetContext().getResources().getIdentifier("empty", "xml", Helper.GetContext().getPackageName());
|
||||
int vtosterXml = GetContext().getResources().getIdentifier("empty", "xml", GetContext().getPackageName());
|
||||
this.a(vtosterXml);
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, Helper.getString("sprefsstickers"));
|
||||
PreferencesUtil.addPreference(this, "", Helper.getString("sprefsdelkey"), "", null, preference -> {
|
||||
PreferencesUtil.addPreferenceCategory(this, getString("sprefsstickers"));
|
||||
PreferencesUtil.addPreference(this, "", getString("sprefsdelkey"), "", null, preference -> {
|
||||
TGPref.setTGBotKey(null);
|
||||
ToastUtils.a(Helper.getString("sprefsdelkey2"));
|
||||
ToastUtils.a(getString("sprefsdelkey2"));
|
||||
return false;
|
||||
});
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, Helper.getString("sprefsnetwork"));
|
||||
PreferencesUtil.addListPreference(this, "VTGS:CM", "0", Helper.getString("sprefsctype"), new CharSequence[]{
|
||||
Helper.getString("ctypedirect"), Helper.getString("ctypesocks")
|
||||
PreferencesUtil.addPreferenceCategory(this, getString("sprefsnetwork"));
|
||||
PreferencesUtil.addListPreference(this, "VTGS:CM", "0", getString("sprefsctype"), new CharSequence[]{
|
||||
getString("ctypedirect"), getString("ctypesocks")
|
||||
}, new String[]{
|
||||
"0", "2"
|
||||
});
|
||||
@@ -44,22 +46,22 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
||||
return true;
|
||||
});
|
||||
|
||||
PreferencesUtil.addPreferenceCategory(this, Helper.getString("ssocks"));
|
||||
PreferencesUtil.addPreferenceCategory(this, getString("ssocks"));
|
||||
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_host", Helper.getString("ssockshost"), (preference, o) -> {
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_host", getString("ssockshost"), (preference, o) -> {
|
||||
TGPref.setTGProxyIP((String) o);
|
||||
return true;
|
||||
});
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_port", Helper.getString("ssocksport"), (preference, o) -> {
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_port", getString("ssocksport"), (preference, o) -> {
|
||||
try {
|
||||
TGPref.setTGProxyPort(Integer.parseInt((String) o));
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
ToastUtils.a(Helper.getString("ssockswport"));
|
||||
ToastUtils.a(getString("ssockswport"));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "tg_proxy_auth", Helper.getString("ssocksauth"), "", null, false, (preference, o) -> {
|
||||
PreferencesUtil.addMaterialSwitchPreference(this, "tg_proxy_auth", getString("ssocksauth"), "", null, false, (preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
|
||||
a("tg_proxy_login").a(value); // findPreference("tg_proxy_login").setEnabled(value);
|
||||
@@ -68,11 +70,11 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
||||
TGPref.setTGProxyPassEnabled(value);
|
||||
return true;
|
||||
});
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_login", Helper.getString("ssockslogin"), (preference, o) -> {
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_login", getString("ssockslogin"), (preference, o) -> {
|
||||
TGPref.setTGProxyUserPass((String) o, TGPref.getTGProxyPass());
|
||||
return true;
|
||||
});
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_pass", Helper.getString("ssockspass"), (preference, o) -> {
|
||||
PreferencesUtil.addEditTextPreference(this, "tg_proxy_pass", getString("ssockspass"), (preference, o) -> {
|
||||
TGPref.setTGProxyUserPass(TGPref.getTGProxyUser(), (String) o);
|
||||
return true;
|
||||
});
|
||||
@@ -83,7 +85,7 @@ public class StickersPreferencesFragment extends MaterialPreferenceToolbarFragme
|
||||
|
||||
@Override
|
||||
public int aq() {
|
||||
return Helper.GetContext().getResources().getIdentifier("vtltgs", "string", Helper.GetContext().getPackageName());
|
||||
return GetContext().getResources().getIdentifier("vtltgs", "string", GetContext().getPackageName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package ru.vtosters.lite.ui.vkui;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.view.View;
|
||||
|
||||
import com.vk.core.dialogs.bottomsheet.ModalBottomSheet;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.utils.Helper;
|
||||
|
||||
public class ModalBottomSheetProxy {
|
||||
public final ModalBottomSheet.a builder;
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.app.AlertDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
|
||||
import com.vk.dto.common.VideoFile;
|
||||
|
||||
@@ -27,51 +28,41 @@ public class ExternalLinkHandler {
|
||||
private static final Map<String, String> qualities = new HashMap<>();
|
||||
|
||||
public static boolean parseVideoFile(VideoFile file, Context context) {
|
||||
if (!Prefs.isEnableExternalOpening()) return false;
|
||||
|
||||
if (checkYoutubeLink(file)) {
|
||||
|
||||
try {
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW);
|
||||
intent.setData(Uri.parse(file.n));
|
||||
|
||||
context.startActivity(intent);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
} else if (checkVkVideo(file)) {
|
||||
|
||||
if (qualities.size() == 1) {
|
||||
|
||||
startExternalVideo((String) qualities.values().toArray()[0]);
|
||||
|
||||
} else {
|
||||
|
||||
String[] titles = qualities.keySet().toArray(new String[0]);
|
||||
|
||||
new AlertDialog.Builder(context)
|
||||
.setItems(titles, ((dialog, which) -> {
|
||||
|
||||
startExternalVideo(qualities.get(titles[which]));
|
||||
|
||||
}))
|
||||
.show();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (!Prefs.isEnableExternalOpening()) return false;
|
||||
|
||||
if (checkVkVideo(file)) {
|
||||
if (qualities.size() == 1) {
|
||||
startExternalVideo((String) qualities.values().toArray()[0]);
|
||||
} else {
|
||||
String[] titles = qualities.keySet().toArray(new String[0]);
|
||||
new AlertDialog.Builder(context)
|
||||
.setItems(titles, ((dialog, which) -> {
|
||||
startExternalVideo(qualities.get(titles[which]));
|
||||
}))
|
||||
.show();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean checkYoutubeLink(VideoFile file) {
|
||||
if (!Helper.isEmpty(file.n)) {
|
||||
if (!isEmpty(file.n)) {
|
||||
for (String filter : filters) {
|
||||
if (file.n.contains(filter))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -85,25 +76,25 @@ public class ExternalLinkHandler {
|
||||
* this.k = var3.optString("mp4_2160");
|
||||
*/
|
||||
public static boolean checkVkVideo(VideoFile videoFile) {
|
||||
if (!Helper.isEmpty(videoFile.e)) {
|
||||
if (!isEmpty(videoFile.e)) {
|
||||
qualities.put("240", videoFile.e);
|
||||
}
|
||||
if (!Helper.isEmpty(videoFile.f)) {
|
||||
if (!isEmpty(videoFile.f)) {
|
||||
qualities.put("360", videoFile.f);
|
||||
}
|
||||
if (!Helper.isEmpty(videoFile.g)) {
|
||||
if (!isEmpty(videoFile.g)) {
|
||||
qualities.put("480", videoFile.g);
|
||||
}
|
||||
if (!Helper.isEmpty(videoFile.h)) {
|
||||
if (!isEmpty(videoFile.h)) {
|
||||
qualities.put("720", videoFile.h);
|
||||
}
|
||||
if (!Helper.isEmpty(videoFile.i)) {
|
||||
if (!isEmpty(videoFile.i)) {
|
||||
qualities.put("1080", videoFile.i);
|
||||
}
|
||||
if (!Helper.isEmpty(videoFile.j)) {
|
||||
if (!isEmpty(videoFile.j)) {
|
||||
qualities.put("1440", videoFile.j);
|
||||
}
|
||||
if (!Helper.isEmpty(videoFile.k)) {
|
||||
if (!isEmpty(videoFile.k)) {
|
||||
qualities.put("2160", videoFile.k);
|
||||
}
|
||||
|
||||
@@ -118,34 +109,27 @@ public class ExternalLinkHandler {
|
||||
Intent intent = new Intent();
|
||||
|
||||
String packageName = getMXPlayerPackageName();
|
||||
if (!Helper.isEmpty(packageName)) {
|
||||
|
||||
if (!isEmpty(packageName)) {
|
||||
intent.setPackage(packageName);
|
||||
intent.setDataAndType(uri, "application/mp4");
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
|
||||
} else {
|
||||
|
||||
intent.setAction(Intent.ACTION_VIEW);
|
||||
intent.setDataAndType(uri, "video/mp4");
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
|
||||
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
|
||||
|
||||
}
|
||||
|
||||
Helper.GetContext().startActivity(intent);
|
||||
|
||||
GetContext().startActivity(intent);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static String getMXPlayerPackageName() {
|
||||
for (ApplicationInfo info : Helper.GetContext().getPackageManager().getInstalledApplications(0)) {
|
||||
for (ApplicationInfo info : GetContext().getPackageManager().getInstalledApplications(0)) {
|
||||
String packName = info.packageName;
|
||||
if (packName.equals("com.mxtech.videoplayer.ad") || packName.equals("com.mxtech.videoplayer.pro"))
|
||||
return packName;
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static android.content.Context.ACTIVITY_SERVICE;
|
||||
import static ru.vtosters.lite.utils.Proxy.*;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.res.Resources;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
@@ -22,7 +21,6 @@ import com.vtosters.lite.auth.VKAccountManager;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.List;
|
||||
|
||||
public class Helper {
|
||||
public static int GetUserId() {
|
||||
@@ -42,7 +40,7 @@ public class Helper {
|
||||
}
|
||||
|
||||
public static String getConnectorDomain(String str) {
|
||||
return Proxy.GetConnector(str);
|
||||
return GetConnector(str);
|
||||
}
|
||||
|
||||
public static void reloadMSG() {
|
||||
@@ -70,7 +68,11 @@ public class Helper {
|
||||
}
|
||||
|
||||
public static void restarting() {
|
||||
GetContext().startActivity(Intent.makeRestartActivityTask(GetContext().getPackageManager().getLaunchIntentForPackage(GetContext().getPackageName()).getComponent()));
|
||||
Context ctx = GetContext();
|
||||
PackageManager pm = ctx.getPackageManager();
|
||||
Intent intent = pm.getLaunchIntentForPackage(ctx.getPackageName());
|
||||
Intent mainIntent = Intent.makeRestartActivityTask(intent.getComponent());
|
||||
ctx.startActivity(mainIntent);
|
||||
Runtime.getRuntime().exit(0);
|
||||
}
|
||||
|
||||
@@ -107,7 +109,7 @@ public class Helper {
|
||||
}
|
||||
|
||||
public static String getString(String str) {
|
||||
return Helper.GetContext().getString(Integer.parseInt(String.valueOf(Helper.GetContext().getResources().getIdentifier(str, "string", Helper.GetContext().getPackageName()))));
|
||||
return GetContext().getString(Integer.parseInt(String.valueOf(GetContext().getResources().getIdentifier(str, "string", GetContext().getPackageName()))));
|
||||
}
|
||||
|
||||
public static String getPackageName() {
|
||||
@@ -137,4 +139,10 @@ public class Helper {
|
||||
public static boolean isEmpty(String str) {
|
||||
return str == null || str.isEmpty();
|
||||
}
|
||||
|
||||
public static boolean isNetworkConnected() {
|
||||
ConnectivityManager cm = (ConnectivityManager) GetContext().getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
|
||||
return activeNetwork != null && activeNetwork.isConnectedOrConnecting();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,22 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.content.ComponentName;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
public class IconHelper {
|
||||
public static void switchToVK() {
|
||||
var packageManager = Helper.GetContext().getPackageManager();
|
||||
var packageName = Helper.getPackageName();
|
||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, Helper.getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, Helper.getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
var packageManager = GetContext().getPackageManager();
|
||||
var packageName = getPackageName();
|
||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
|
||||
public static void switchToDefault() {
|
||||
var packageManager = Helper.GetContext().getPackageManager();
|
||||
var packageName = Helper.getPackageName();
|
||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, Helper.getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, Helper.getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
var packageManager = GetContext().getPackageManager();
|
||||
var packageName = getPackageName();
|
||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconDefault"), PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
|
||||
packageManager.setComponentEnabledSetting(new ComponentName(packageName, getPackageName() + ".VTIconVK"), PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
import static ru.vtosters.lite.utils.Proxy.setProxy;
|
||||
|
||||
import android.app.Activity;
|
||||
@@ -11,7 +12,6 @@ import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
|
||||
import com.vk.about.Items;
|
||||
@@ -20,7 +20,6 @@ import com.vk.about.Items2;
|
||||
import com.vk.apps.AppsFragment;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.core.util.Screen;
|
||||
import com.vk.discover.DiscoverFragment;
|
||||
import com.vk.fave.fragments.FaveTabFragment;
|
||||
import com.vk.menu.MenuFragment;
|
||||
import com.vk.music.fragment.MusicFragment;
|
||||
@@ -55,20 +54,21 @@ import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Scanner;
|
||||
|
||||
import kotlin.jvm.internal.Intrinsics;
|
||||
import ru.vtosters.lite.ui.fragments.dockbar.DockBarManager;
|
||||
import ru.vtosters.lite.ui.fragments.multiaccount.MultiAccountManager;
|
||||
|
||||
public class Prefs {
|
||||
public static String VERSIONNAME = "2.0 DEV";
|
||||
private static final List<Activity> activities = new ArrayList<>();
|
||||
public static String VERSIONNAME = "2.0 Beta";
|
||||
private static List<String> mFilters;
|
||||
private static List<Activity> activities = new ArrayList<>();
|
||||
|
||||
public static boolean BooleanFalse(String key) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Helper.GetContext());
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(GetContext());
|
||||
return prefs.getBoolean(key, false);
|
||||
}
|
||||
|
||||
public static boolean BooleanTrue(String key) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Helper.GetContext());
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(GetContext());
|
||||
return prefs.getBoolean(key, true);
|
||||
}
|
||||
|
||||
@@ -106,6 +106,10 @@ public class Prefs {
|
||||
return BooleanFalse("adsgroup");
|
||||
}
|
||||
|
||||
public static boolean olddock() {
|
||||
return BooleanFalse("olddock");
|
||||
}
|
||||
|
||||
public static boolean adsslider() {
|
||||
return BooleanFalse("__dbg_no_slider_ads");
|
||||
}
|
||||
@@ -238,11 +242,11 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static String getBuildNumber() {
|
||||
return Prefs.getBuild(Helper.GetContext(), "version.properties");
|
||||
return Prefs.getBuild(GetContext(), "version.properties");
|
||||
}
|
||||
|
||||
public static String getCommitLink() {
|
||||
return "https://github.com/vtosters/lite/commit/" + Prefs.getBuild(Helper.GetContext(), "version.properties");
|
||||
return "https://github.com/vtosters/lite/commit/" + Prefs.getBuild(GetContext(), "version.properties");
|
||||
}
|
||||
|
||||
public static String getBuild(Context context, String name) {
|
||||
@@ -252,6 +256,7 @@ public class Prefs {
|
||||
String line = scanner.findInLine("VERSION_BUILD=.+");
|
||||
if (line != null)
|
||||
return line.replace("VERSION_BUILD=", "");
|
||||
return "0000000";
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -261,27 +266,50 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static String getBranch() {
|
||||
return Helper.GetPreferences().getString("ota_branches", "Stable");
|
||||
return GetPreferences().getString("ota_branches", "Stable");
|
||||
}
|
||||
|
||||
public static String getDarkVKUI() {
|
||||
return !VKThemeHelper.d() ? "1" : "0";
|
||||
}
|
||||
|
||||
public static String getAmoledVKUI() {
|
||||
String string = GetPreferences().getString("darktheme", "");
|
||||
return string.equals("amoled") ? "1" : "0";
|
||||
}
|
||||
|
||||
public static String getCommentsSort(String def) {
|
||||
String string = GetPreferences().getString("commentssort", "");
|
||||
if (string.isEmpty()) {
|
||||
return def;
|
||||
}
|
||||
if (string.equals("new")) {
|
||||
return "desc";
|
||||
}
|
||||
if (string.equals("old")) {
|
||||
return "asc";
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
public static String getMeToken() {
|
||||
return Helper.GetPreferences().getString("me_token", "");
|
||||
return GetPreferences().getString("me_token", "");
|
||||
}
|
||||
|
||||
public static void setMeToken(String str) {
|
||||
GetPreferences().edit().putString("me_token", str).apply();
|
||||
}
|
||||
|
||||
public static int getNavbarColor() {
|
||||
return VKThemeHelper.a((int) R.attr.tabbar_background);
|
||||
return VKThemeHelper.a(R.attr.tabbar_background);
|
||||
}
|
||||
|
||||
public static String getSSFSLink() {
|
||||
return SSFSDomain() + "?token=" + ru.vtosters.lite.utils.Helper.GetUserToken() + "&vt_dark=" + getDarkVKUI() + "&secret=" + ru.vtosters.lite.utils.Helper.GetUserSecret() + "&proxy=" + getUserProxy() + "&lang=" + getLocale() + "&vt=1&vtl=1&vksans=" + isVKSansEnabled() + "&vt_version=" + getBuildNumber() + "&vt_debug=" + isDEVModEnabled();
|
||||
return SSFSDomain() + "?token=" + GetUserToken() + "&vt_dark=" + getDarkVKUI() + "&vt_amoled=" + getAmoledVKUI() + "&secret=" + GetUserSecret() + "&proxy=" + getUserProxy() + "&lang=" + getLocale() + "&vt=1&vtl=1&vksans=" + isVKSansEnabled() + "&vt_version=" + getBuildNumber() + "&vt_debug=" + isDEVModEnabled();
|
||||
}
|
||||
|
||||
public static String getString(String key, String defValue) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(Helper.GetContext());
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(GetContext());
|
||||
return prefs.getString(key, defValue);
|
||||
}
|
||||
|
||||
@@ -354,32 +382,32 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static String proxyHostHTTP() {
|
||||
String string = Helper.GetPreferences().getString("proxyHostHTTP", "");
|
||||
String string = GetPreferences().getString("proxyHostHTTP", "");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
public static String proxyHostHTTPS() {
|
||||
String string = Helper.GetPreferences().getString("proxyHostHTTPS", "");
|
||||
String string = GetPreferences().getString("proxyHostHTTPS", "");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
public static String proxyHostSocks() {
|
||||
String string = Helper.GetPreferences().getString("proxyHostSocks", "");
|
||||
String string = GetPreferences().getString("proxyHostSocks", "");
|
||||
return string.isEmpty() ? "192.168.0.1" : string;
|
||||
}
|
||||
|
||||
public static String proxyPortHTTP() {
|
||||
String string = Helper.GetPreferences().getString("proxyPortHTTP", "");
|
||||
String string = GetPreferences().getString("proxyPortHTTP", "");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
public static String proxyPortHTTPS() {
|
||||
String string = ru.vtosters.lite.utils.Helper.GetPreferences().getString("proxyPortHTTPS", "");
|
||||
String string = GetPreferences().getString("proxyPortHTTPS", "");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
public static String proxyPortSocks() {
|
||||
String string = Helper.GetPreferences().getString("proxyPortSocks", "");
|
||||
String string = GetPreferences().getString("proxyPortSocks", "");
|
||||
return string.isEmpty() ? "8888" : string;
|
||||
}
|
||||
|
||||
@@ -399,10 +427,6 @@ public class Prefs {
|
||||
return BooleanFalse("rightLikes");
|
||||
}
|
||||
|
||||
public static void setMeToken(String str) {
|
||||
ru.vtosters.lite.utils.Helper.GetPreferences().edit().putString("me_token", str).apply();
|
||||
}
|
||||
|
||||
public static boolean setoffline() {
|
||||
return BooleanFalse("setoffline");
|
||||
}
|
||||
@@ -460,23 +484,21 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static boolean newvideo() {
|
||||
return BooleanFalse("newvideo");
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String widgetads() {
|
||||
return ads() ? "null" : "app_widget";
|
||||
}
|
||||
|
||||
public static int getMsgCount() {
|
||||
String customvalue = GetPreferences().getString("msgcount", "");
|
||||
return customvalue.isEmpty() ? 30 : Integer.parseInt(customvalue);
|
||||
}
|
||||
|
||||
public static void setNavbarColor(Window window, int i) {
|
||||
if (navbar()) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
window.setNavigationBarColor(getNavbarColor());
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 31 && VKThemeHelper.d()) {
|
||||
View decorView = window.getDecorView();
|
||||
Intrinsics.a((Object) decorView, "view");
|
||||
decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | 8192);
|
||||
if (navbar() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
window.setNavigationBarColor(getNavbarColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,7 +535,7 @@ public class Prefs {
|
||||
StandardFilterPut();
|
||||
ShortLinkPut();
|
||||
IDontWantToReadIt();
|
||||
String string = Helper.GetPreferences().getString("spamfilters", "");
|
||||
String string = GetPreferences().getString("spamfilters", "");
|
||||
if (!string.isEmpty()) {
|
||||
mFilters.addAll(Arrays.asList(string.split(", ")));
|
||||
}
|
||||
@@ -522,7 +544,7 @@ public class Prefs {
|
||||
public static void ReferalsPut() {
|
||||
if (BooleanTrue("refsfilter")) {
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Helper.GetContext().getAssets().open("Referals.txt")));
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(GetContext().getAssets().open("Referals.txt")));
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine != null) {
|
||||
@@ -541,7 +563,7 @@ public class Prefs {
|
||||
public static void ShortLinkPut() {
|
||||
if (BooleanTrue("shortlinkfilter")) {
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Helper.GetContext().getAssets().open("LinkShorter.txt")));
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(GetContext().getAssets().open("LinkShorter.txt")));
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine != null) {
|
||||
@@ -560,7 +582,7 @@ public class Prefs {
|
||||
public static void StandardFilterPut() {
|
||||
if (BooleanTrue("default_ad_list")) {
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Helper.GetContext().getAssets().open("StandartFilter.txt")));
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(GetContext().getAssets().open("StandartFilter.txt")));
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine != null) {
|
||||
@@ -579,7 +601,7 @@ public class Prefs {
|
||||
public static void IDontWantToReadIt() {
|
||||
if (BooleanTrue("shitposting")) {
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(Helper.GetContext().getAssets().open("IDontWantToReadIt.txt")));
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(GetContext().getAssets().open("IDontWantToReadIt.txt")));
|
||||
while (true) {
|
||||
String readLine = bufferedReader.readLine();
|
||||
if (readLine != null) {
|
||||
@@ -596,7 +618,7 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static String SSFSDomain() {
|
||||
String string = Helper.GetPreferences().getString("ssfscustom", "");
|
||||
String string = GetPreferences().getString("ssfscustom", "");
|
||||
if (!string.isEmpty()) {
|
||||
return string;
|
||||
}
|
||||
@@ -604,7 +626,7 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static String VKVersion() {
|
||||
String string = Helper.GetPreferences().getString("vkversion", "");
|
||||
String string = GetPreferences().getString("vkversion", "");
|
||||
if (!string.isEmpty()) {
|
||||
return string;
|
||||
}
|
||||
@@ -652,7 +674,7 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static String getLocale() {
|
||||
String string = Helper.GetPreferences().getString("lang_value", "");
|
||||
String string = GetPreferences().getString("lang_value", "");
|
||||
if (string.equals("system")) {
|
||||
return Locale.getDefault().getLanguage();
|
||||
}
|
||||
@@ -660,7 +682,7 @@ public class Prefs {
|
||||
}
|
||||
|
||||
public static boolean proxy() {
|
||||
return ru.vtosters.lite.utils.Helper.GetPreferences().getString("proxy", "").equals("apiproxy");
|
||||
return GetPreferences().getString("proxy", "").equals("apiproxy");
|
||||
}
|
||||
|
||||
public static boolean authors_rec(String str) {
|
||||
@@ -707,7 +729,7 @@ public class Prefs {
|
||||
setupFilters();
|
||||
fixGapps();
|
||||
setProxy();
|
||||
|
||||
MultiAccountManager.migrate();
|
||||
registerActivities(application);
|
||||
}
|
||||
|
||||
@@ -747,8 +769,15 @@ public class Prefs {
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isUseAlternativeFragments() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static Class getStartFragment() {
|
||||
String string = ru.vtosters.lite.utils.Helper.GetPreferences().getString("start_value", "");
|
||||
String string = GetPreferences().getString("start_values", "");
|
||||
if (string.equals("default")) {
|
||||
return DockBarManager.getInstance().getSelectedTabs().get(0).fragmentClass;
|
||||
}
|
||||
if (string.equals("newsfeed")) {
|
||||
return Feed2049.b.c();
|
||||
}
|
||||
@@ -764,7 +793,7 @@ public class Prefs {
|
||||
if (string.equals("friends")) {
|
||||
return FriendsFragment.class;
|
||||
}
|
||||
if (string.equals(NavigatorKeys.v)) {
|
||||
if (string.equals("photos")) {
|
||||
return PhotosFragment.class;
|
||||
}
|
||||
if (string.equals("videos")) {
|
||||
@@ -777,7 +806,7 @@ public class Prefs {
|
||||
return AppsFragment.class;
|
||||
}
|
||||
if (string.equals("discover")) {
|
||||
return DiscoverFragment.class;
|
||||
return Feed2049.b.e();
|
||||
}
|
||||
if (string.equals("notifications")) {
|
||||
return NotificationsContainerFragment.class;
|
||||
@@ -803,7 +832,7 @@ public class Prefs {
|
||||
if (string.equals("docs")) {
|
||||
return DocumentsViewFragment.class;
|
||||
}
|
||||
return string.equals("brtd") ? BirthdaysFragment.class : Feed2049.b.c();
|
||||
return string.equals("brtd") ? BirthdaysFragment.class : DockBarManager.getInstance().getSelectedTabs().get(0).fragmentClass;
|
||||
}
|
||||
|
||||
public static Context BaseContextLocale(Context context) {
|
||||
@@ -853,7 +882,7 @@ public class Prefs {
|
||||
public static void fixGapps() {
|
||||
try {
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
NotificationManager notificationManager = (NotificationManager) ru.vtosters.lite.utils.Helper.GetContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
NotificationManager notificationManager = (NotificationManager) GetContext().getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
boolean z = false;
|
||||
try {
|
||||
if (notificationManager.getNotificationChannel("audio_playback_channel") != null) {
|
||||
@@ -862,7 +891,7 @@ public class Prefs {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
if (!z) {
|
||||
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", ru.vtosters.lite.utils.Helper.getResources().getString(R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
|
||||
notificationManager.createNotificationChannel(new NotificationChannel("audio_playback_channel", getResources().getString(R.string.audio_message_play_error), NotificationManager.IMPORTANCE_LOW));
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
|
||||
@@ -3,8 +3,6 @@ package ru.vtosters.lite.utils;
|
||||
public class ProfileHide {
|
||||
// private static final OkHttpClient client = new OkHttpClient();
|
||||
//
|
||||
// /* JADX WARN: Type inference failed for: r1v1, types: [boolean] */
|
||||
// /* JADX WARNING: Unknown variable types count: 1 */
|
||||
// public static void injectMap(HashMap<Integer, AdministratorProfileFragment.a.a> hashMap) {
|
||||
// for (int i = 0; VTVerifications.sServiceAccountsMap.valueOf(i) < 0; i++) {
|
||||
// boolean valueOf = VTVerifications.sServiceAccountsMap.valueOf(Helper.getId());
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
import static ru.vtosters.lite.utils.Prefs.proxyHostHTTP;
|
||||
import static ru.vtosters.lite.utils.Prefs.proxyHostHTTPS;
|
||||
import static ru.vtosters.lite.utils.Prefs.proxyHostSocks;
|
||||
@@ -43,7 +44,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getApiCom() {
|
||||
String string = Helper.GetPreferences().getString("proxyapi", "");
|
||||
String string = GetPreferences().getString("proxyapi", "");
|
||||
if (!Prefs.proxy() & string.isEmpty()) {
|
||||
return "api.vk.com";
|
||||
}
|
||||
@@ -51,7 +52,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getAwayPhpCom() {
|
||||
String string = Helper.GetPreferences().getString("proxyapi", "");
|
||||
String string = GetPreferences().getString("proxyapi", "");
|
||||
if (!Prefs.proxy() & string.isEmpty()) {
|
||||
return "m.vk.com";
|
||||
}
|
||||
@@ -59,7 +60,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getOauthCom() {
|
||||
String string = Helper.GetPreferences().getString("proxyoauth", "");
|
||||
String string = GetPreferences().getString("proxyoauth", "");
|
||||
if (!Prefs.proxy() & string.isEmpty()) {
|
||||
return "oauth.vk.com";
|
||||
}
|
||||
@@ -67,7 +68,7 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static String getStaticCom() {
|
||||
String string = Helper.GetPreferences().getString("proxystatic", "");
|
||||
String string = GetPreferences().getString("proxystatic", "");
|
||||
if (!Prefs.proxy() & string.isEmpty()) {
|
||||
return "static.vk.com";
|
||||
}
|
||||
@@ -76,7 +77,7 @@ public class Proxy {
|
||||
|
||||
public static String staticFix(String str) {
|
||||
String str2;
|
||||
String string = Helper.GetPreferences().getString("proxystatic", "");
|
||||
String string = GetPreferences().getString("proxystatic", "");
|
||||
if (!Prefs.proxy() & string.isEmpty()) {
|
||||
return str;
|
||||
}
|
||||
@@ -100,10 +101,10 @@ public class Proxy {
|
||||
}
|
||||
|
||||
public static void setProxy() {
|
||||
switch (Helper.GetPreferences().getString("proxy", "")) {
|
||||
switch (GetPreferences().getString("proxy", "")) {
|
||||
case "zaborona":
|
||||
Properties properties = System.getProperties();
|
||||
properties.setProperty("socksProxyHost", "socks.zaborona.help");
|
||||
properties.setProperty("socksProxyHost", "socks.zaboronahelp.pp.ua");
|
||||
properties.setProperty("socksProxyPort", "1488");
|
||||
System.clearProperty("https.proxyHost");
|
||||
System.clearProperty("https.proxyPort");
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static android.os.Environment.DIRECTORY_DOWNLOADS;
|
||||
import static android.os.Environment.getExternalStoragePublicDirectory;
|
||||
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.Helper.GetContext;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.util.Base64;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
public class SettBackup {
|
||||
static SharedPreferences prefs = GetContext().getSharedPreferences("com.vtosters.lite_preferences", Context.MODE_PRIVATE);
|
||||
|
||||
public static void deletePrefs() {
|
||||
prefs.edit().clear().commit();
|
||||
File file = new File(new File(GetContext().getFilesDir().getParent(), "shared_prefs"), "com.vtosters.lite_preferences");
|
||||
if (file.exists()) file.delete();
|
||||
}
|
||||
|
||||
public static void backupSettings() {
|
||||
SimpleDateFormat date = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault());
|
||||
String currentDateandTime = date.format(new Date());
|
||||
var directory = getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS) + "/VTLBackup_" + currentDateandTime + ".txt";
|
||||
var file = new File(directory);
|
||||
try {
|
||||
var exists = file.createNewFile();
|
||||
|
||||
if (!exists) {
|
||||
file.delete();
|
||||
file.createNewFile();
|
||||
}
|
||||
try {
|
||||
FileWriter out = new FileWriter(file);
|
||||
out.write(getAllPrefs());
|
||||
out.close();
|
||||
makeText(GetContext(), "Сохранено в файл " + directory, LENGTH_LONG).show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
makeText(GetContext(), "Не удалось сохранить файл", LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
makeText(GetContext(), "Не удалось сохранить файл", LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
public static String getAllPrefs() {
|
||||
Map<String, ?> allPrefs = prefs.getAll();
|
||||
return Base64.encodeToString(allPrefs.toString().getBytes(), 1);
|
||||
}
|
||||
|
||||
public static void restoreBackup() {
|
||||
Intent intent = new Intent();
|
||||
intent.setAction(Intent.ACTION_GET_CONTENT);
|
||||
intent.setType("text/plain");
|
||||
GetContext().startActivity(intent);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -8,27 +10,80 @@ import android.support.v7.widget.Toolbar;
|
||||
import android.widget.ImageButton;
|
||||
|
||||
import com.vk.core.d.RecoloredDrawable;
|
||||
import com.vk.core.ui.themes.VKTheme;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.im.ui.themes.ImTheme;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
|
||||
import ru.vtosters.lite.f0x1d.VTVerifications;
|
||||
|
||||
public class Themes {
|
||||
public static int getAccentColor() {
|
||||
return VKThemeHelper.a((int) R.attr.accent);
|
||||
return VKThemeHelper.a(R.attr.accent);
|
||||
}
|
||||
|
||||
public static int getTextAttr() {
|
||||
return VKThemeHelper.a((int) R.attr.text_primary);
|
||||
return VKThemeHelper.a(R.attr.text_primary);
|
||||
}
|
||||
|
||||
public static int getSTextAttr() {
|
||||
return VKThemeHelper.a((int) R.attr.text_secondary);
|
||||
return VKThemeHelper.a(R.attr.text_secondary);
|
||||
}
|
||||
|
||||
public static int getTabbarBackground() {
|
||||
return VKThemeHelper.a((int) R.attr.tabbar_background);
|
||||
return VKThemeHelper.a(R.attr.tabbar_background);
|
||||
}
|
||||
|
||||
public static int getHeaderBackground() {
|
||||
return VKThemeHelper.a(R.attr.header_background);
|
||||
}
|
||||
|
||||
public static int getAmoledTheme() {
|
||||
return GetContext().getResources().getIdentifier("BaseAmoledStyle", "style", GetContext().getPackageName());
|
||||
}
|
||||
|
||||
public static int picFix() {
|
||||
return GetContext().getResources().getIdentifier("ActionBarThemeFix", "style", GetContext().getPackageName());
|
||||
}
|
||||
|
||||
public static int getAmoledImTheme() {
|
||||
return GetContext().getResources().getIdentifier("VkIm.Theme.VkApp.Amoled", "style", GetContext().getPackageName());
|
||||
}
|
||||
|
||||
public static VKTheme getDarkTheme() {
|
||||
String string = GetPreferences().getString("darktheme", "");
|
||||
if (string.isEmpty()) {
|
||||
return VKTheme.DARK;
|
||||
}
|
||||
if (string.equals("amoled")) {
|
||||
return VKTheme.AMOLED;
|
||||
}
|
||||
return VKTheme.DARK;
|
||||
}
|
||||
|
||||
public static ImTheme getImDarkTheme() {
|
||||
String string = GetPreferences().getString("darktheme", "");
|
||||
if (string.isEmpty()) {
|
||||
return ImTheme.VKAPP_DARK;
|
||||
}
|
||||
if (string.equals("amoled")) {
|
||||
return ImTheme.VKAPP_AMOLED;
|
||||
}
|
||||
return ImTheme.VKAPP_DARK;
|
||||
}
|
||||
|
||||
public static VKTheme getLightTheme() {
|
||||
String string = GetPreferences().getString("lighttheme", "");
|
||||
if (string.isEmpty()) {
|
||||
return VKTheme.DEFAULT_LIGHT;
|
||||
}
|
||||
return VKTheme.DEFAULT_LIGHT;
|
||||
}
|
||||
|
||||
public static ImTheme getImLightTheme() {
|
||||
String string = GetPreferences().getString("lighttheme", "");
|
||||
if (string.isEmpty()) {
|
||||
return ImTheme.VKAPP_LIGHT;
|
||||
}
|
||||
return ImTheme.VKAPP_LIGHT;
|
||||
}
|
||||
|
||||
public static int getColorFromAttr(int attr) {
|
||||
@@ -36,7 +91,7 @@ public class Themes {
|
||||
}
|
||||
|
||||
public static int getHeaderText() {
|
||||
return VKThemeHelper.a((int) R.attr.header_text);
|
||||
return VKThemeHelper.a(R.attr.header_text);
|
||||
}
|
||||
|
||||
public static boolean isAndroidMonet() {
|
||||
@@ -66,6 +121,10 @@ public class Themes {
|
||||
return ru.vtosters.lite.utils.Prefs.BooleanFalse("vkim_msg");
|
||||
}
|
||||
|
||||
public static boolean amoled() {
|
||||
return ru.vtosters.lite.utils.Prefs.BooleanFalse("amoled");
|
||||
}
|
||||
|
||||
public static boolean vkme_msg() {
|
||||
return ru.vtosters.lite.utils.Prefs.BooleanFalse("vkme_msg");
|
||||
}
|
||||
@@ -77,6 +136,13 @@ public class Themes {
|
||||
return new RecoloredDrawable(drawable, getAccentColor());
|
||||
}
|
||||
|
||||
public static Drawable recolorDrawableToolbar(Drawable drawable) {
|
||||
if (drawable == null) {
|
||||
return null;
|
||||
}
|
||||
return new RecoloredDrawable(drawable, getHeaderText());
|
||||
}
|
||||
|
||||
public static ColorStateList recolorCSL(ColorStateList colorStateList) {
|
||||
if (colorStateList == null) {
|
||||
return null;
|
||||
@@ -98,10 +164,10 @@ public class Themes {
|
||||
if (isColorRefAccented(i) && isAndroidMonet()) {
|
||||
return getAccentColor();
|
||||
}
|
||||
return Helper.GetContext().getResources().getColor(i);
|
||||
return GetContext().getResources().getColor(i);
|
||||
}
|
||||
|
||||
public static String hex(int i) {
|
||||
return String.format("#%06X", new Object[]{Integer.valueOf(i & 16777215)});
|
||||
return String.format("#%06X", Integer.valueOf(i & 16777215));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import static ru.vtosters.lite.utils.Helper.*;
|
||||
import static ru.vtosters.lite.utils.Themes.*;
|
||||
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.webkit.WebView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
public class VKUIInjector {
|
||||
private static boolean isLoaded = false;
|
||||
private static String loadedCSS = "";
|
||||
@@ -25,7 +27,7 @@ public class VKUIInjector {
|
||||
|
||||
private static String load(String str) {
|
||||
try {
|
||||
InputStream open = Helper.GetContext().getAssets().open(str);
|
||||
InputStream open = GetContext().getAssets().open(str);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(open, StandardCharsets.UTF_8));
|
||||
while (true) {
|
||||
@@ -45,12 +47,15 @@ public class VKUIInjector {
|
||||
|
||||
public static void load() {
|
||||
loadedCSS = load("vt_ui_accent.css")
|
||||
.replace("%accent%", Themes.hex(Themes.getAccentColor()))
|
||||
.replace("%background_page%", Themes.hex(Themes.getColorFromAttr(R.attr.background_page)))
|
||||
.replace("%background_content%", Themes.hex(Themes.getColorFromAttr(R.attr.background_content)))
|
||||
.replace("%text_primary%", Themes.hex(Themes.getColorFromAttr(R.attr.text_primary)));
|
||||
.replace("%header_background%", hex(getColorFromAttr(R.attr.header_background)))
|
||||
.replace("%background_content%", hex(getColorFromAttr(R.attr.background_content)))
|
||||
.replace("%header_text%", hex(getColorFromAttr(R.attr.header_text)))
|
||||
.replace("%accent%", hex(getColorFromAttr(R.attr.accent)))
|
||||
.replace("%background_page%", hex(getColorFromAttr(R.attr.background_page)))
|
||||
.replace("%background_content%", hex(getColorFromAttr(R.attr.background_content)))
|
||||
.replace("%text_primary%", hex(getColorFromAttr(R.attr.text_primary)));
|
||||
|
||||
// loadedCSSAmoled = load("vt_ui_oled.css");
|
||||
loadedCSSAmoled = load("vt_ui_oled.css");
|
||||
isLoaded = true;
|
||||
}
|
||||
|
||||
@@ -59,17 +64,20 @@ public class VKUIInjector {
|
||||
}
|
||||
|
||||
public static void inject(WebView webView) {
|
||||
String string = GetPreferences().getString("darktheme", "");
|
||||
if (Prefs.BooleanTrue("VKUI_INJ")) {
|
||||
if (!isLoaded) {
|
||||
load();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
if (true/*Themes.isAccentedCache()*/) {
|
||||
Log.d("VKUI", "Injecting Accent");
|
||||
sb.append("\n\n");
|
||||
sb.append(loadedCSS);
|
||||
}
|
||||
Log.d("VKUI", "Final CSS: " + sb.toString());
|
||||
if (string.equals("amoled")) {
|
||||
sb.append("\n\n");
|
||||
sb.append(loadedCSSAmoled);
|
||||
}
|
||||
inject(webView, Base64.encodeToString(sb.toString().getBytes(), 2));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ buildscript {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:7.3.0-alpha01'
|
||||
classpath 'com.android.tools.build:gradle:7.2.0-rc01'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
android.useAndroidX=true
|
||||
android.enableJetifier=true
|
||||
android.jetifier.ignorelist = classes-dex2jar.jar, classes2-dex2jar.jar, classes3-dex2jar.jar, classes4-dex2jar.jar, classes5-dex2jar.jar, classes6-dex2jar.jar, classes7-dex2jar.jar
|
||||
android.jetifier.ignorelist=classes-dex2jar.jar, classes2-dex2jar.jar, classes3-dex2jar.jar, classes4-dex2jar.jar, classes5-dex2jar.jar, classes6-dex2jar.jar, classes7-dex2jar.jar
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
#Fri Jan 28 23:46:30 MSK 2022
|
||||
#Fri Apr 22 13:33:27 MSK 2022
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-rc-1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
|
||||
distributionPath=wrapper/dists
|
||||
zipStorePath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
+4
-5
@@ -16,6 +16,7 @@ echo %ESC%[1;4mBuild dex...%ESC%[0m
|
||||
echo.
|
||||
call gradlew clean
|
||||
del app\src\main\assets\version.properties
|
||||
del smali\assets\version.properties
|
||||
call gradlew versionFile
|
||||
call gradlew assembleDebug
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
@@ -67,14 +68,13 @@ if "%ERRORLEVEL%" == "0" (
|
||||
echo %ESC%[92mSuccessful%ESC%[0m
|
||||
) else (
|
||||
echo %ESC%[31mFailed%ESC%[0m
|
||||
exit /B 1
|
||||
)
|
||||
|
||||
echo.
|
||||
echo %ESC%[1;4mBuild apk...%ESC%[0m
|
||||
echo.
|
||||
cd smali\
|
||||
call java -jar ../scripts/apktool.jar b . -o VTLite.apk --use-aapt2 -p ../scripts/framework/
|
||||
call java -jar ../scripts/apktool.jar b . -o ../scripts/VTLite.apk --use-aapt2 -p ../scripts/framework/
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
echo %ESC%[92mSuccessful%ESC%[0m
|
||||
) else (
|
||||
@@ -88,8 +88,7 @@ del assets\version.properties
|
||||
echo.
|
||||
echo %ESC%[1;4mSign apk...%ESC%[0m
|
||||
echo.
|
||||
call java -jar ../apksigner.jar sign --ks debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android VTLite.apk
|
||||
del VTLite.apk
|
||||
call java -jar ../scripts/apksigner.jar sign --ks ../scripts/debug.keystore --ks-key-alias androiddebugkey --ks-pass pass:android ../scripts/VTLite.apk
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
echo %ESC%[92mSuccessful%ESC%[0m
|
||||
) else (
|
||||
@@ -121,7 +120,7 @@ GOTO startinstall
|
||||
echo.
|
||||
echo %ESC%[1;4mInstall apk...%ESC%[0m
|
||||
echo.
|
||||
call adb install VTLite_signed.apk
|
||||
call adb install ../scripts/VTLite.apk
|
||||
if "%ERRORLEVEL%" == "0" (
|
||||
echo %ESC%[92mSuccessful%ESC%[0m
|
||||
) else (
|
||||
|
||||
+1
-2
@@ -1,4 +1,4 @@
|
||||
œ#!/bin/bash
|
||||
#!/bin/bash
|
||||
RED='\033[31m'
|
||||
GREEN='\033[92m'
|
||||
NC='\033[0m'
|
||||
@@ -51,7 +51,6 @@ if [ $? -eq 0 ]; then
|
||||
echo -e "${GREEN}Успех!${NC}\n"
|
||||
else
|
||||
echo -e "${RED}Провал.${NC}\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${BOLD}${UNDERLINE}Сборка apk..${NC}"
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_READ"/>
|
||||
<uses-permission android:name="me.everything.badger.permission.BADGE_COUNT_WRITE"/>
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
|
||||
<application android:allowBackup="false" android:debuggable="false" android:hardwareAccelerated="true" android:icon="@mipmap/vt_launcher" android:label="@string/app_name" android:largeHeap="true" android:name="com.vtosters.lite.VKApplication" android:networkSecurityConfig="@xml/network_security_config" android:resizeableActivity="true" android:roundIcon="@mipmap/vt_launcher_round" android:supportsRtl="true" android:theme="@style/BaseStyle">
|
||||
<application android:allowBackup="false" android:debuggable="false" android:hardwareAccelerated="true" android:icon="@mipmap/vt_launcher" android:label="@string/app_name" android:largeHeap="true" android:requestLegacyExternalStorage="true" android:preserveLegacyExternalStorage="true" android:name="com.vtosters.lite.VKApplication" android:networkSecurityConfig="@xml/network_security_config" android:resizeableActivity="true" android:roundIcon="@mipmap/vt_launcher_round" android:supportsRtl="true" android:theme="@style/BaseStyle">
|
||||
<meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyBlTHhNGPj7ktPWrUo_d4YJs_Sn_zsISZg"/>
|
||||
<meta-data android:name="com.google.android.geo.API_SECRET" android:value="yu6ZAA0OWO3kmr4es7fGtSmiyfk="/>
|
||||
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/fb_app_id"/>
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
санкции
|
||||
Санкций
|
||||
санкций
|
||||
Санкциями
|
||||
санкциями
|
||||
Россия
|
||||
россия
|
||||
россии
|
||||
@@ -90,6 +92,8 @@
|
||||
всу
|
||||
ВС РФ
|
||||
вс рф
|
||||
ВС Украины
|
||||
вс украины
|
||||
Шойгу
|
||||
шойгу
|
||||
Зеленский
|
||||
@@ -104,8 +108,6 @@
|
||||
Евросоюз
|
||||
евросоюзу
|
||||
Евросоюзу
|
||||
ес
|
||||
ЕС
|
||||
Войск
|
||||
войск
|
||||
армия
|
||||
@@ -127,12 +129,18 @@
|
||||
Нато
|
||||
Песков
|
||||
песков
|
||||
Пескову
|
||||
Пескова
|
||||
пескова
|
||||
пескову
|
||||
Кремль
|
||||
кремль
|
||||
Кремлю
|
||||
кремлю
|
||||
денацификация
|
||||
Денацификация
|
||||
денацификацию
|
||||
Денацификацию
|
||||
нацис
|
||||
Нацис
|
||||
нациз
|
||||
@@ -182,6 +190,4 @@
|
||||
наказать Русских
|
||||
наказать русских
|
||||
вооружение
|
||||
Вооружение
|
||||
пво
|
||||
ПВО
|
||||
Вооружение
|
||||
@@ -41,8 +41,16 @@ cпocоб зaрaбoтать
|
||||
в источник
|
||||
В источник
|
||||
в источнике
|
||||
в иcтoчнике
|
||||
В иcтoчнике
|
||||
в Иcтoчнике
|
||||
в Источнике
|
||||
В источнике
|
||||
В Источнике
|
||||
в иcтoчник
|
||||
В иcтoчник
|
||||
в Иcтoчник
|
||||
в Источник
|
||||
В Источник
|
||||
в закрепленном комментарии
|
||||
в Закрепленном комментарии
|
||||
в закрепленном Комментарии
|
||||
|
||||
@@ -19,10 +19,6 @@ body[scheme=bright_light] {
|
||||
--cell_button_foreground: %accent% !important;
|
||||
--control_foreground: %accent% !important;
|
||||
--counter_primary_background: %accent% !important;
|
||||
--header_alternate_tab_active_indicator: %accent% !important;
|
||||
--header_tab_active_indicator: %accent% !important;
|
||||
--header_tint: %accent% !important;
|
||||
--header_tint_alternate: %accent% !important;
|
||||
--im_attach_tint: %accent% !important;
|
||||
--im_reply_sender_text: %accent% !important;
|
||||
--im_reply_separator: %accent% !important;
|
||||
@@ -42,24 +38,70 @@ body[scheme=bright_light] {
|
||||
--writebar_icon: %accent% !important;
|
||||
--dynamic_blue: %accent% !important;
|
||||
/* backgrounds */
|
||||
--background_content: %background_page% !important;
|
||||
--background_content: %background_content% !important;
|
||||
--background_page: %background_page% !important;
|
||||
--content_tint_background: %background_page% !important;
|
||||
--loader_background: %background_page% !important;
|
||||
--header_background: %background_page% !important;
|
||||
--header_background_before_blur: %background_page% !important;
|
||||
--header_background_before_blur_alternate: %background_page% !important;
|
||||
--header_alternate_background: %background_page% !important;
|
||||
--header_background: %header_background% !important;
|
||||
--header_background_before_blur: %header_background% !important;
|
||||
--header_background_before_blur_alternate: %header_background% !important;
|
||||
--header_alternate_background: %header_background% !important;
|
||||
|
||||
--header_text_alternate: %header_text% !important;
|
||||
--header_text: %header_text% !important;
|
||||
--header_text_secondary: %header_text% !important;
|
||||
--header_tint: %header_text% !important;
|
||||
--header_tint_alternate: %header_text% !important;
|
||||
}
|
||||
|
||||
|
||||
|
||||
body[scheme=space_gray] {
|
||||
--accent: %accent% !important;
|
||||
--action_sheet_action_foreground: %accent% !important;
|
||||
--attach_picker_tab_active_background: %accent% !important;
|
||||
--attach_picker_tab_active_text: %accent% !important;
|
||||
--button_muted_foreground: %accent% !important;
|
||||
--button_outline_border: %accent% !important;
|
||||
--button_outline_foreground: %accent% !important;
|
||||
--button_primary_background: %accent% !important;
|
||||
--button_secondary_foreground: %accent% !important;
|
||||
--button_tertiary_foreground: %accent% !important;
|
||||
--cell_button_foreground: %accent% !important;
|
||||
--control_foreground: %accent% !important;
|
||||
--counter_primary_background: %accent% !important;
|
||||
--im_attach_tint: %accent% !important;
|
||||
--im_reply_sender_text: %accent% !important;
|
||||
--im_reply_separator: %accent% !important;
|
||||
--im_text_name: %accent% !important;
|
||||
--landing_login_button_background: %accent% !important;
|
||||
--landing_primary_button_background: %accent% !important;
|
||||
--landing_tertiary_button_foreground: %accent% !important;
|
||||
--landing_text_title: %accent% !important;
|
||||
--landing_secondary_button_foreground: %accent% !important;
|
||||
--link_alternate: %accent% !important;
|
||||
--loader_track_value_fill: %accent% !important;
|
||||
--feed_recommended_friend_promo_background: %accent% !important;
|
||||
--tabbar_active_icon: %accent% !important;
|
||||
--tabbar_tablet_active_icon: %accent% !important;
|
||||
--text_link: %accent% !important;
|
||||
--text_link_hightlighted_background: %accent% !important;
|
||||
--text_name: %accent% !important;
|
||||
--writebar_icon: %accent% !important;
|
||||
--dynamic_blue: %accent% !important;
|
||||
--background_content: %background_content% !important;
|
||||
--background_page: %background_page% !important;
|
||||
--content_tint_background: %background_page% !important;
|
||||
--loader_background: %background_page% !important;
|
||||
--header_background: %header_background% !important;
|
||||
--header_background_before_blur: %header_background% !important;
|
||||
--header_background_before_blur_alternate: %header_background% !important;
|
||||
--header_alternate_background: %header_background% !important;
|
||||
--header_tint: %header_text% !important;
|
||||
--header_tint_alternate: %header_text% !important;
|
||||
|
||||
--header_text_alternate: %header_text% !important;
|
||||
--header_text: %header_text% !important;
|
||||
--header_text_secondary: %header_text% !important;
|
||||
}
|
||||
|
||||
/* фиксы статей */
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/* vkui.css V2 by iTaysonLab */
|
||||
/* Articles */
|
||||
body.article_body.article_dark {
|
||||
background-color: #000000 !important;
|
||||
}
|
||||
|
||||
.article_dark .articleView__content {
|
||||
border-top: #000000 !important;
|
||||
background-color: #000000 !important;
|
||||
}
|
||||
|
||||
.article_dark .article {
|
||||
background-color: #000000 !important;
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.articleView__content_misc_block .articleView__content_views_info {
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.article_dark .article>h1 {
|
||||
color: %textColorPrimary% !important;
|
||||
}
|
||||
|
||||
.article__info_line {
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.Audio__duration, .r .ai_dur {
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.Audio__texts, .r .ai_label {
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.article_dark .ai_title {
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
.article>figure figcaption:not(.article_ed__figcaption) {
|
||||
color: #FFFFFF !important;
|
||||
}
|
||||
|
||||
/* VK Support fixes */
|
||||
[scheme="client_dark"] .CatalogSearch__input, [scheme="space_gray"] .CatalogSearch__input {
|
||||
background: #000000 !important;
|
||||
}
|
||||
|
||||
/* Generic VKUI */
|
||||
body[scheme=space_gray] {
|
||||
/* light background */
|
||||
--attach_picker_tab_active_icon: #000000 !important;
|
||||
--background_content: #000000 !important;
|
||||
--button_bot_shadow: #000000 !important;
|
||||
--button_primary_foreground: #000000 !important;
|
||||
--content_tint_background: #000000 !important;
|
||||
--counter_secondary_text: #000000 !important;
|
||||
--loader_background: #000000 !important;
|
||||
--overlay_status_background: #000000 !important;
|
||||
--header_background: #19191a !important;
|
||||
--header_alternate_background: #19191a !important;
|
||||
--separator_alternate: #000000 !important;
|
||||
--segmented_control_bar_background: #000000 !important;
|
||||
--search_bar_background: #000000 !important;
|
||||
/* background */
|
||||
--background_page: #000000 !important;
|
||||
--header_background_before_blur: #19191a !important;
|
||||
--header_background_before_blur_alternate: #19191a !important;
|
||||
/* lighter BG (text fields) */
|
||||
--attach_picker_tab_inactive_background: #121212 !important;
|
||||
--background_keyboard: #121212 !important;
|
||||
--background_suggestions: #121212 !important;
|
||||
--field_background: #121212 !important;
|
||||
--im_bubble_incoming: #121212 !important;
|
||||
--input_border: #121212 !important;
|
||||
--modal_card_background: #121212 !important;
|
||||
--separator_common: #121212 !important;
|
||||
--snippet_background: #121212 !important;
|
||||
--android_active_color: #121212 !important;
|
||||
--switch_ios_off_border: #121212 !important;
|
||||
/* third BG (buttons) */
|
||||
--button_secondary_background: #212121 !important;
|
||||
--header_search_field_background: #212121 !important;
|
||||
--icon_tertiary: #212121 !important;
|
||||
--im_bubble_outgoing: #212121 !important;
|
||||
--input_background: #212121 !important;
|
||||
--loader_track_fill: #212121 !important;
|
||||
--search_bar_field_background: #212121 !important;
|
||||
--selection_off_icon: #212121 !important;
|
||||
--panel_tab_active_background: #212121 !important;
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@android:interpolator/linear_out_slow_in" android:duration="225"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromYDelta="100.0%p" android:toYDelta="0.0" />
|
||||
<set android:interpolator="@android:interpolator/linear_out_slow_in"
|
||||
android:duration="225"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="100.0%p"
|
||||
android:toYDelta="0.0" />
|
||||
</set>
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@android:interpolator/fast_out_linear_in" android:duration="195"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromYDelta="0.0%p" android:toYDelta="100.0%p" />
|
||||
<set android:interpolator="@android:interpolator/fast_out_linear_in"
|
||||
android:duration="195"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="0.0%p"
|
||||
android:toYDelta="100.0%p" />
|
||||
</set>
|
||||
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@android:interpolator/fast_out_linear_in" android:duration="@integer/bottom_sheet_slide_duration"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromYDelta="20.000004%p" android:toYDelta="0.0" />
|
||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" />
|
||||
<set android:interpolator="@android:interpolator/fast_out_linear_in"
|
||||
android:duration="@integer/bottom_sheet_slide_duration"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="20.000004%p"
|
||||
android:toYDelta="0.0" />
|
||||
<alpha
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0" />
|
||||
</set>
|
||||
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@android:interpolator/fast_out_slow_in" android:duration="@integer/bottom_sheet_slide_duration"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromYDelta="0.0" android:toYDelta="20.000004%p" />
|
||||
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" />
|
||||
<set android:interpolator="@android:interpolator/fast_out_slow_in"
|
||||
android:duration="@integer/bottom_sheet_slide_duration"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="0.0"
|
||||
android:toYDelta="20.000004%p" />
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
||||
@@ -1,3 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:controlX1="0.4" android:controlY1="0.0" android:controlX2="1.0" android:controlY2="1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
<pathInterpolator android:controlX1="0.4"
|
||||
android:controlY1="0.0"
|
||||
android:controlX2="1.0"
|
||||
android:controlY2="1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
@@ -1,3 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:controlX1="0.0" android:controlY1="0.0" android:controlX2="0.2" android:controlY2="1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
<pathInterpolator android:controlX1="0.0"
|
||||
android:controlY1="0.0"
|
||||
android:controlX2="0.2"
|
||||
android:controlY2="1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
@@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@anim/linear_out_slow_in" android:shareInterpolator="true"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:duration="300" android:fromYDelta="-100.0%p" android:toYDelta="0.0" />
|
||||
<set android:interpolator="@anim/linear_out_slow_in"
|
||||
android:shareInterpolator="true"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="300"
|
||||
android:fromYDelta="-100.0%p"
|
||||
android:toYDelta="0.0" />
|
||||
</set>
|
||||
@@ -1,5 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@anim/fast_out_linear_in" android:shareInterpolator="true" android:ordering="together"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:duration="300" android:fromYDelta="0.0" android:toYDelta="-100.0%p" />
|
||||
<set android:interpolator="@anim/fast_out_linear_in"
|
||||
android:shareInterpolator="true"
|
||||
android:ordering="together"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="300"
|
||||
android:fromYDelta="0.0"
|
||||
android:toYDelta="-100.0%p" />
|
||||
</set>
|
||||
@@ -1,6 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@android:interpolator/fast_out_slow_in" android:duration="300"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:fromYDelta="0.0" android:toYDelta="14.999998%" />
|
||||
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" />
|
||||
<set android:interpolator="@android:interpolator/fast_out_slow_in"
|
||||
android:duration="300"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:fromYDelta="0.0"
|
||||
android:toYDelta="14.999998%" />
|
||||
<alpha
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
||||
@@ -1,3 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<pathInterpolator android:controlX1="0.4" android:controlY1="0.0" android:controlX2="0.2" android:controlY2="1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
<pathInterpolator android:controlX1="0.4"
|
||||
android:controlY1="0.0"
|
||||
android:controlX2="0.2"
|
||||
android:controlY2="1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
@@ -1,6 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:shareInterpolator="false"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<scale android:interpolator="@android:anim/decelerate_interpolator" android:duration="@integer/abc_config_activityDefaultDur" android:pivotX="50.0%" android:pivotY="100.0%" android:fromXScale="0.9" android:toXScale="1.0" android:fromYScale="0.9" android:toYScale="1.0" />
|
||||
<alpha android:interpolator="@android:anim/decelerate_interpolator" android:duration="@integer/abc_config_activityShortDur" android:fromAlpha="0.0" android:toAlpha="1.0" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<scale
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="@integer/abc_config_activityDefaultDur"
|
||||
android:pivotX="50.0%"
|
||||
android:pivotY="100.0%"
|
||||
android:fromXScale="0.9"
|
||||
android:toXScale="1.0"
|
||||
android:fromYScale="0.9"
|
||||
android:toYScale="1.0" />
|
||||
<alpha
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="@integer/abc_config_activityShortDur"
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0" />
|
||||
</set>
|
||||
@@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:shareInterpolator="false"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha android:interpolator="@android:anim/decelerate_interpolator" android:duration="@integer/abc_config_activityShortDur" android:fromAlpha="0.0" android:toAlpha="1.0" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="@integer/abc_config_activityShortDur"
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0" />
|
||||
</set>
|
||||
@@ -1,5 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:shareInterpolator="false"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha android:interpolator="@android:anim/decelerate_interpolator" android:duration="@integer/abc_config_activityShortDur" android:fromAlpha="1.0" android:toAlpha="0.0" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="@integer/abc_config_activityShortDur"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
||||
@@ -1,6 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:shareInterpolator="false"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<scale android:interpolator="@android:anim/decelerate_interpolator" android:duration="@integer/abc_config_activityDefaultDur" android:pivotX="50.0%" android:pivotY="100.0%" android:fromXScale="1.0" android:toXScale="0.9" android:fromYScale="1.0" android:toYScale="0.9" />
|
||||
<alpha android:interpolator="@android:anim/decelerate_interpolator" android:duration="@integer/abc_config_activityShortDur" android:fromAlpha="1.0" android:toAlpha="0.0" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<scale
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="@integer/abc_config_activityDefaultDur"
|
||||
android:pivotX="50.0%"
|
||||
android:pivotY="100.0%"
|
||||
android:fromXScale="1.0"
|
||||
android:toXScale="0.9"
|
||||
android:fromYScale="1.0"
|
||||
android:toYScale="0.9" />
|
||||
<alpha
|
||||
android:interpolator="@android:anim/decelerate_interpolator"
|
||||
android:duration="@integer/abc_config_activityShortDur"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0" />
|
||||
</set>
|
||||
@@ -1,3 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha android:interpolator="@android:interpolator/decelerate_quad" android:duration="@integer/config_tooltipAnimTime" android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
<alpha android:interpolator="@android:interpolator/decelerate_quad"
|
||||
android:duration="@integer/config_tooltipAnimTime"
|
||||
android:fromAlpha="0.0"
|
||||
android:toAlpha="1.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
@@ -1,3 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<alpha android:interpolator="@android:interpolator/accelerate_quad" android:duration="@integer/config_tooltipAnimTime" android:fromAlpha="1.0" android:toAlpha="0.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
<alpha android:interpolator="@android:interpolator/accelerate_quad"
|
||||
android:duration="@integer/config_tooltipAnimTime"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android" />
|
||||
@@ -1,5 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:zAdjustment="normal"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha android:duration="300" android:fillBefore="true" android:fillAfter="true" android:fromAlpha="1.0" android:toAlpha="1.0" android:fillEnabled="true" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha
|
||||
android:duration="300"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="1.0"
|
||||
android:fillEnabled="true" />
|
||||
</set>
|
||||
@@ -1,6 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:shareInterpolator="false" android:zAdjustment="top"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha android:interpolator="@android:interpolator/decelerate_cubic" android:duration="300" android:fillBefore="true" android:fillAfter="true" android:fromAlpha="1.0" android:toAlpha="0.0" android:fillEnabled="true" />
|
||||
<scale android:interpolator="@android:interpolator/decelerate_cubic" android:duration="300" android:pivotX="50.0%p" android:pivotY="50.0%p" android:fillBefore="true" android:fillAfter="true" android:fromXScale="1.0" android:toXScale="0.8" android:fromYScale="1.0" android:toYScale="0.8" android:fillEnabled="true" />
|
||||
<set android:shareInterpolator="false"
|
||||
android:zAdjustment="top"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<alpha
|
||||
android:interpolator="@android:interpolator/decelerate_cubic"
|
||||
android:duration="300"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:fromAlpha="1.0"
|
||||
android:toAlpha="0.0"
|
||||
android:fillEnabled="true" />
|
||||
<scale
|
||||
android:interpolator="@android:interpolator/decelerate_cubic"
|
||||
android:duration="300"
|
||||
android:pivotX="50.0%p"
|
||||
android:pivotY="50.0%p"
|
||||
android:fillBefore="true"
|
||||
android:fillAfter="true"
|
||||
android:fromXScale="1.0"
|
||||
android:toXScale="0.8"
|
||||
android:fromYScale="1.0"
|
||||
android:toYScale="0.8"
|
||||
android:fillEnabled="true" />
|
||||
</set>
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@android:anim/decelerate_interpolator"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:duration="300" android:fromYDelta="100.0%p" android:toYDelta="0.0%p" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="300"
|
||||
android:fromYDelta="100.0%p"
|
||||
android:toYDelta="0.0%p" />
|
||||
</set>
|
||||
@@ -1,5 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<set android:interpolator="@android:anim/accelerate_interpolator"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate android:duration="300" android:fromYDelta="0.0%p" android:toYDelta="100.0%p" />
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<translate
|
||||
android:duration="300"
|
||||
android:fromYDelta="0.0%p"
|
||||
android:toYDelta="100.0%p" />
|
||||
</set>
|
||||
@@ -1,10 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_enabled="true" android:state_pressed="true">
|
||||
<objectAnimator android:duration="200" android:valueTo="2.0dip" android:valueType="floatType" android:propertyName="translationZ" />
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:state_enabled="true"
|
||||
android:state_pressed="true">
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:valueTo="2.0dip"
|
||||
android:valueType="floatType"
|
||||
android:propertyName="translationZ" />
|
||||
</item>
|
||||
<item>
|
||||
<objectAnimator android:duration="200" android:valueTo="1.0dip" android:valueType="floatType" android:propertyName="translationZ" />
|
||||
<objectAnimator
|
||||
android:duration="200"
|
||||
android:valueTo="1.0dip"
|
||||
android:valueType="floatType"
|
||||
android:propertyName="translationZ" />
|
||||
</item>
|
||||
</selector>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user