Merge branch 'vtl-remaster' into theming
This commit is contained in:
+26
-9
@@ -2,14 +2,17 @@ package com.vtosters.lite.ui.bottomnavigation;
|
|||||||
|
|
||||||
import static ru.vtosters.lite.utils.Themes.getCSTDock;
|
import static ru.vtosters.lite.utils.Themes.getCSTDock;
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.res.ColorStateList;
|
import android.content.res.ColorStateList;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
|
import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.util.TypedValue;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
@@ -43,14 +46,12 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
private MenuItemImpl mItemData;
|
private MenuItemImpl mItemData;
|
||||||
private ColorStateList mColorStateList;
|
private ColorStateList mColorStateList;
|
||||||
private final int mMargin;
|
private final int mMargin;
|
||||||
private final int mDiff;
|
|
||||||
private final float mSmallScale;
|
private final float mSmallScale;
|
||||||
private final float mLargeScale;
|
|
||||||
private boolean mShiftingModeEnabled;
|
private boolean mShiftingModeEnabled;
|
||||||
private boolean mIconsModeEnabled;
|
private boolean mIconsModeEnabled;
|
||||||
private boolean mStaticModeEnabled;
|
private boolean mStaticModeEnabled;
|
||||||
private ImageView mIcon;
|
private final ImageView mIcon;
|
||||||
private ImageView mActionIcon;
|
private final ImageView mActionIcon;
|
||||||
|
|
||||||
public BottomNavigationItemView(@NonNull Context context) {
|
public BottomNavigationItemView(@NonNull Context context) {
|
||||||
this(context, null);
|
this(context, null);
|
||||||
@@ -64,12 +65,9 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
this.mItemPos = -1;
|
this.mItemPos = -1;
|
||||||
|
|
||||||
var textSize = (float) getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_text_size);
|
|
||||||
var activeTextSize = (float) getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_active_text_size);
|
|
||||||
this.mMargin = getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_margin);
|
this.mMargin = getResources().getDimensionPixelSize(R.dimen.design_bottom_navigation_margin);
|
||||||
this.mDiff = (int) (textSize - activeTextSize);
|
this.mSmallScale = 10.0f;
|
||||||
this.mSmallScale = activeTextSize / textSize;
|
float mLargeScale = 10.0f;
|
||||||
this.mLargeScale = textSize / activeTextSize;
|
|
||||||
|
|
||||||
LayoutInflater.from(context).inflate(R.layout.design_bottom_navigation_item, this, true);
|
LayoutInflater.from(context).inflate(R.layout.design_bottom_navigation_item, this, true);
|
||||||
this.setBackgroundResource(R.drawable.design_bottom_navigation_item_background);
|
this.setBackgroundResource(R.drawable.design_bottom_navigation_item_background);
|
||||||
@@ -102,6 +100,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.mActionIcon.setVisibility(VISIBLE);
|
this.mActionIcon.setVisibility(VISIBLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public MenuItemImpl getItemData() {
|
public MenuItemImpl getItemData() {
|
||||||
return this.mItemData;
|
return this.mItemData;
|
||||||
}
|
}
|
||||||
@@ -110,6 +109,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
return this.mItemPos;
|
return this.mItemPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void initialize(MenuItemImpl impl, int i) {
|
public void initialize(MenuItemImpl impl, int i) {
|
||||||
this.mItemData = impl;
|
this.mItemData = impl;
|
||||||
this.setCheckable(impl.isCheckable());
|
this.setCheckable(impl.isCheckable());
|
||||||
@@ -121,6 +121,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.setContentDescription(impl.getTitle());
|
this.setContentDescription(impl.getTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public int[] onCreateDrawableState(int extraSpace) {
|
public int[] onCreateDrawableState(int extraSpace) {
|
||||||
int[] baseState = super.onCreateDrawableState(extraSpace + 1);
|
int[] baseState = super.onCreateDrawableState(extraSpace + 1);
|
||||||
if (this.mItemData != null && this.mItemData.isCheckable() && this.mItemData.isChecked()) {
|
if (this.mItemData != null && this.mItemData.isCheckable() && this.mItemData.isChecked()) {
|
||||||
@@ -146,14 +147,17 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public boolean prefersCondensedTitle() {
|
public boolean prefersCondensedTitle() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setCheckable(boolean var1) {
|
public void setCheckable(boolean var1) {
|
||||||
this.refreshDrawableState();
|
this.refreshDrawableState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setChecked(boolean checked) {
|
public void setChecked(boolean checked) {
|
||||||
this.mItemData.setChecked(checked);
|
this.mItemData.setChecked(checked);
|
||||||
|
|
||||||
@@ -220,6 +224,14 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
// ViewCompat.setScaleY(mLargeLabel, !mStaticModeEnabled && !checked ? mLargeScale : 1.0f);
|
// ViewCompat.setScaleY(mLargeLabel, !mStaticModeEnabled && !checked ? mLargeScale : 1.0f);
|
||||||
ViewCompat.setScaleX(mSmallLabel, !mStaticModeEnabled && checked ? mSmallScale : 1.0f);
|
ViewCompat.setScaleX(mSmallLabel, !mStaticModeEnabled && checked ? mSmallScale : 1.0f);
|
||||||
ViewCompat.setScaleY(mSmallLabel, !mStaticModeEnabled && checked ? mSmallScale : 1.0f);
|
ViewCompat.setScaleY(mSmallLabel, !mStaticModeEnabled && checked ? mSmallScale : 1.0f);
|
||||||
|
// make mLargeLabel and mSmallLabel are bold
|
||||||
|
mLargeLabel.setTypeface(null, Typeface.BOLD);
|
||||||
|
mSmallLabel.setTypeface(null, Typeface.BOLD);
|
||||||
|
|
||||||
|
// make mLargeLabel and mSmallLabel text size is 10sp
|
||||||
|
mLargeLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
|
||||||
|
mSmallLabel.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
|
||||||
|
|
||||||
mLargeLabel.setVisibility(/*checked ? VISIBLE :*/ INVISIBLE);
|
mLargeLabel.setVisibility(/*checked ? VISIBLE :*/ INVISIBLE);
|
||||||
mSmallLabel.setVisibility(VISIBLE);//checked ? INVISIBLE : VISIBLE);
|
mSmallLabel.setVisibility(VISIBLE);//checked ? INVISIBLE : VISIBLE);
|
||||||
|
|
||||||
@@ -264,6 +276,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.mIcon.setEnabled(b);
|
this.mIcon.setEnabled(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setIcon(Drawable drawable) {
|
public void setIcon(Drawable drawable) {
|
||||||
if (drawable != null) {
|
if (drawable != null) {
|
||||||
if (drawable.getConstantState() != null)
|
if (drawable.getConstantState() != null)
|
||||||
@@ -276,6 +289,7 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.mIcon.setImageDrawable(drawable);
|
this.mIcon.setImageDrawable(drawable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setIconTintList(ColorStateList colorStateList) {
|
public void setIconTintList(ColorStateList colorStateList) {
|
||||||
this.mColorStateList = colorStateList;
|
this.mColorStateList = colorStateList;
|
||||||
MenuItemImpl impl = this.mItemData;
|
MenuItemImpl impl = this.mItemData;
|
||||||
@@ -305,17 +319,20 @@ public class BottomNavigationItemView extends FrameLayout implements MenuView.It
|
|||||||
this.mShiftingModeEnabled = var1;
|
this.mShiftingModeEnabled = var1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setShortcut(boolean b, char c) {
|
public void setShortcut(boolean b, char c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTextColor(ColorStateList colorStateList) {
|
public void setTextColor(ColorStateList colorStateList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public void setTitle(CharSequence title) {
|
public void setTitle(CharSequence title) {
|
||||||
this.mSmallLabel.setText(title);
|
this.mSmallLabel.setText(title);
|
||||||
this.mLargeLabel.setText(title);
|
this.mLargeLabel.setText(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressLint("RestrictedApi")
|
||||||
public boolean showsIcon() {
|
public boolean showsIcon() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,30 +15,40 @@ import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
|||||||
import ru.vtosters.lite.music.Callback;
|
import ru.vtosters.lite.music.Callback;
|
||||||
import ru.vtosters.lite.music.FFMpeg;
|
import ru.vtosters.lite.music.FFMpeg;
|
||||||
import ru.vtosters.lite.music.M3UDownloader;
|
import ru.vtosters.lite.music.M3UDownloader;
|
||||||
|
import ru.vtosters.lite.music.MP3Downloader;
|
||||||
import ru.vtosters.lite.utils.Globals;
|
import ru.vtosters.lite.utils.Globals;
|
||||||
|
|
||||||
public class AudioDownloader{
|
public class AudioDownloader {
|
||||||
private static NotificationManagerCompat notificationManager = NotificationManagerCompat.from(Globals.getContext());
|
private static NotificationManagerCompat notificationManager = NotificationManagerCompat.from(Globals.getContext());
|
||||||
|
|
||||||
public static void downloadAudio(MusicTrack track){
|
public static void downloadAudio(MusicTrack track) {
|
||||||
|
if (Globals.getDefprefs().getBoolean("new_music_downloading_way", false)) {
|
||||||
|
downloadMP3(track);
|
||||||
|
} else {
|
||||||
|
downloadM3U8(track);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void downloadM3U8(MusicTrack track) {
|
||||||
if (track.D == null) {
|
if (track.D == null) {
|
||||||
ToastUtils.a("Не удалось найти ссылку на аудиозапись");
|
ToastUtils.a("Не удалось найти ссылку на аудиозапись");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var musicPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath();
|
var musicPath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath();
|
||||||
var tempId = track.d;
|
var tempId = track.d;
|
||||||
var downloadPath = musicPath + File.separator + tempId;
|
var downloadPath = musicPath + File.separator + tempId;
|
||||||
var notification = buildDownloadNotification(track, tempId);
|
|
||||||
|
|
||||||
downloadM3U8(track, downloadPath, new Callback(){
|
var notification = buildDownloadNotification(track, tempId);
|
||||||
|
downloadM3U8(track, downloadPath, new Callback() {
|
||||||
@Override
|
@Override
|
||||||
public void onProgress(int progress){
|
public void onProgress(int progress) {
|
||||||
notification.setProgress(100, progress, false);
|
notification.setProgress(100, progress, false);
|
||||||
notificationManager.notify(tempId, notification.build());
|
notificationManager.notify(tempId, notification.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSuccess(){
|
public void onSuccess() {
|
||||||
try {
|
try {
|
||||||
var fileName = track.toString();
|
var fileName = track.toString();
|
||||||
var success = FFMpeg.convert(downloadPath, musicPath + File.separator + fileName + ".mp3");
|
var success = FFMpeg.convert(downloadPath, musicPath + File.separator + fileName + ".mp3");
|
||||||
@@ -59,19 +69,19 @@ public class AudioDownloader{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(){
|
public void onFailure() {
|
||||||
notification.setContentText("Не удалось загрузить аудиозапись").setProgress(0, 0, false);
|
notification.setContentText("Не удалось загрузить аудиозапись").setProgress(0, 0, false);
|
||||||
notificationManager.notify(tempId, notification.build());
|
notificationManager.notify(tempId, notification.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSizeReceived(long size, long header){
|
public void onSizeReceived(long size, long header) {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void downloadM3U8(MusicTrack track, String path, Callback callback){
|
private static void downloadM3U8(MusicTrack track, String path, Callback callback) {
|
||||||
File outDir = new File(path);
|
File outDir = new File(path);
|
||||||
if (!outDir.exists())
|
if (!outDir.exists())
|
||||||
if (outDir.mkdir())
|
if (outDir.mkdir())
|
||||||
@@ -82,7 +92,11 @@ public class AudioDownloader{
|
|||||||
new M3UDownloader(track.D, outDir, callback).execute();
|
new M3UDownloader(track.D, outDir, callback).execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static NotificationCompat.Builder buildDownloadNotification(MusicTrack track, int id){
|
private static void downloadMP3(MusicTrack track) {
|
||||||
|
new MP3Downloader().execute(track);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static NotificationCompat.Builder buildDownloadNotification(MusicTrack track, int id) {
|
||||||
var notificationBuilder = new NotificationCompat.Builder(Globals.getContext(), NotificationChannels.MUSIC_DOWNLOAD_CHANNEL_ID)
|
var notificationBuilder = new NotificationCompat.Builder(Globals.getContext(), NotificationChannels.MUSIC_DOWNLOAD_CHANNEL_ID)
|
||||||
.setSmallIcon(android.R.drawable.stat_sys_download)
|
.setSmallIcon(android.R.drawable.stat_sys_download)
|
||||||
.setContentTitle("Загрузка аудиозаписи")
|
.setContentTitle("Загрузка аудиозаписи")
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import static ru.vtosters.lite.utils.Globals.getContext;
|
|||||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||||
import static ru.vtosters.lite.utils.Globals.getUserId;
|
import static ru.vtosters.lite.utils.Globals.getUserId;
|
||||||
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
import static ru.vtosters.lite.utils.Globals.getUserToken;
|
||||||
|
import static ru.vtosters.lite.utils.Globals.isVKTester;
|
||||||
import static ru.vtosters.lite.utils.Newsfeed.checkCaption;
|
import static ru.vtosters.lite.utils.Newsfeed.checkCaption;
|
||||||
import static ru.vtosters.lite.utils.Newsfeed.checkCopyright;
|
import static ru.vtosters.lite.utils.Newsfeed.checkCopyright;
|
||||||
import static ru.vtosters.lite.utils.Newsfeed.isBadNews;
|
import static ru.vtosters.lite.utils.Newsfeed.isBadNews;
|
||||||
@@ -24,10 +25,14 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
|||||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||||
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
|
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
|
||||||
|
|
||||||
|
import android.net.Uri;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.vk.core.network.Network;
|
import com.vk.core.network.Network;
|
||||||
import com.vk.core.util.DeviceIdProvider;
|
import com.vk.core.util.DeviceIdProvider;
|
||||||
|
import com.vk.core.util.LangUtils;
|
||||||
|
import com.vk.core.util.UriExt;
|
||||||
|
import com.vk.webapp.VkUiFragment;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
@@ -48,22 +53,107 @@ public class JsonInjectors{
|
|||||||
private static final OkHttpClient mClient = new OkHttpClient();
|
private static final OkHttpClient mClient = new OkHttpClient();
|
||||||
|
|
||||||
public static JSONObject profileButton(JSONObject orig) throws JSONException{
|
public static JSONObject profileButton(JSONObject orig) throws JSONException{
|
||||||
if (haveDonateButton()) return orig;
|
var id = orig.getInt("id");
|
||||||
|
|
||||||
var pic = "https://sun1-18.userapi.com/NLd_rNpGuSaBnPV6O-j5mqCGZk8BK8drAMd2LQ/5R-DEF37PFs.png";
|
var newItem = new JSONArray();
|
||||||
|
|
||||||
|
if (orig.has("buttons")) {
|
||||||
|
newItem = orig.getJSONArray("buttons");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!haveDonateButton() && id == getUserId()) {
|
||||||
|
newItem.put(donateRecomm());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!orig.has("type") && isVKTester()) {
|
||||||
|
newItem.put(vktesters(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
orig.put("buttons", newItem);
|
||||||
|
|
||||||
|
return orig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject donateRecomm() throws JSONException{
|
||||||
var title = "Помоги проекту донатом и получи бонус!";
|
var title = "Помоги проекту донатом и получи бонус!";
|
||||||
var link = "https://vk.com/vtosters_official";
|
var link = "https://vk.com/vtosters_official";
|
||||||
var text_color = "2D81E0";
|
var text_color = "2D81E0";
|
||||||
|
|
||||||
// JSONObject jsonObj = new JSONObject("{\"action\":{\"target\":\"internal\",\"type\":\"open_url\",\"url\":\"" + link + "\"},\"title\":\"" + title + "\",\"icons\":[{\"url\":\"" + pic + "\",\"width\":20,\"height\":20},{\"url\":\"" + pic + "\",\"width\":40,\"height\":40},{\"url\":\"" + pic + "\",\"width\":60,\"height\":60},{\"url\":\"" + pic + "\",\"width\":80,\"height\":80}],\"text_color\":\"" + text_color + "\"}");
|
var json = new JSONObject();
|
||||||
return new JSONObject(decode("eyJhY3Rpb24iOnsidGFyZ2V0IjoiaW50ZXJuYWwiLCJ0eXBlIjoib3Blbl91cmwiLCJ1cmwiOiI=")
|
var icons = new JSONArray();
|
||||||
+ link + decode("In0sInRpdGxlIjoi")
|
|
||||||
+ title + decode("IiwiaWNvbnMiOlt7InVybCI6Ig==")
|
var action = new JSONObject();
|
||||||
+ pic + decode("Iiwid2lkdGgiOjIwLCJoZWlnaHQiOjIwfSx7InVybCI6Ig==")
|
action.put("target", "internal");
|
||||||
+ pic + decode("Iiwid2lkdGgiOjQwLCJoZWlnaHQiOjQwfSx7InVybCI6Ig==")
|
action.put("type", "open_url"); // may be open_url, open_internal_vkui, open_game, help_hint, show_full_post, open_vkapp, show_recommendations_for_post and groups_advertisement
|
||||||
+ pic + decode("Iiwid2lkdGgiOjYwLCJoZWlnaHQiOjYwfSx7InVybCI6Ig==")
|
action.put("url", link);
|
||||||
+ pic + decode("Iiwid2lkdGgiOjgwLCJoZWlnaHQiOjgwfV0sInRleHRfY29sb3IiOiI=")
|
json.put("action", action);
|
||||||
+ text_color + decode("In0="));
|
|
||||||
|
json.put("title", title);
|
||||||
|
|
||||||
|
var icon1 = new JSONObject();
|
||||||
|
icon1.put("url", "https://sun2-10.userapi.com/NLd_rNpGuSaBnPV6O-j5mqCGZk8BK8drAMd2LQ/5R-DEF37PFs.png");
|
||||||
|
icon1.put("width", "20");
|
||||||
|
icon1.put("height", "20");
|
||||||
|
icons.put(icon1);
|
||||||
|
|
||||||
|
var icon2 = new JSONObject();
|
||||||
|
icon2.put("url", "https://sun2-12.userapi.com/N8y9pU1meJq_eug-wB1u-HUuGyMqDfdq7A025w/A4Aio-xuLY8.png");
|
||||||
|
icon2.put("width", "40");
|
||||||
|
icon2.put("height", "40");
|
||||||
|
icons.put(icon2);
|
||||||
|
|
||||||
|
var icon3 = new JSONObject();
|
||||||
|
icon3.put("url", "https://sun2-9.userapi.com/3Hx4hff63_2Lt6wjjthJMF_3QLUswNNlQKoAXQ/oyzEu1NL9T8.png");
|
||||||
|
icon3.put("width", "80");
|
||||||
|
icon3.put("height", "80");
|
||||||
|
icons.put(icon3);
|
||||||
|
|
||||||
|
json.put("icons", icons);
|
||||||
|
|
||||||
|
json.put("text_color", text_color);
|
||||||
|
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static JSONObject vktesters(int id) throws JSONException{
|
||||||
|
var title = "Карточка Тестера";
|
||||||
|
var text_color = "2D81E0";
|
||||||
|
var link = "https://static.vk.com/bugs?lang=" + LangUtils.a() + "#/reporter" + id;
|
||||||
|
|
||||||
|
var json = new JSONObject();
|
||||||
|
var icons = new JSONArray();
|
||||||
|
|
||||||
|
var action = new JSONObject();
|
||||||
|
action.put("target", "internal");
|
||||||
|
action.put("type", "open_internal_vkui");
|
||||||
|
action.put("url", link);
|
||||||
|
json.put("action", action);
|
||||||
|
|
||||||
|
json.put("title", title);
|
||||||
|
|
||||||
|
var icon1 = new JSONObject();
|
||||||
|
icon1.put("url", "https://sun2-10.userapi.com/NLd_rNpGuSaBnPV6O-j5mqCGZk8BK8drAMd2LQ/5R-DEF37PFs.png");
|
||||||
|
icon1.put("width", "20");
|
||||||
|
icon1.put("height", "20");
|
||||||
|
icons.put(icon1);
|
||||||
|
|
||||||
|
var icon2 = new JSONObject();
|
||||||
|
icon2.put("url", "https://sun2-12.userapi.com/N8y9pU1meJq_eug-wB1u-HUuGyMqDfdq7A025w/A4Aio-xuLY8.png");
|
||||||
|
icon2.put("width", "40");
|
||||||
|
icon2.put("height", "40");
|
||||||
|
icons.put(icon2);
|
||||||
|
|
||||||
|
var icon3 = new JSONObject();
|
||||||
|
icon3.put("url", "https://sun2-9.userapi.com/3Hx4hff63_2Lt6wjjthJMF_3QLUswNNlQKoAXQ/oyzEu1NL9T8.png");
|
||||||
|
icon3.put("width", "80");
|
||||||
|
icon3.put("height", "80");
|
||||||
|
icons.put(icon3);
|
||||||
|
|
||||||
|
json.put("icons", icons);
|
||||||
|
|
||||||
|
json.put("text_color", text_color);
|
||||||
|
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JSONObject convBar(JSONObject orig) throws JSONException{
|
public static JSONObject convBar(JSONObject orig) throws JSONException{
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package ru.vtosters.lite.music;
|
||||||
|
|
||||||
|
import android.app.DownloadManager;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Environment;
|
||||||
|
import android.util.Log;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.vk.dto.music.MusicTrack;
|
||||||
|
|
||||||
|
import org.json.JSONException;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import okhttp3.Call;
|
||||||
|
import okhttp3.Callback;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import ru.vtosters.lite.downloaders.AudioDownloader;
|
||||||
|
import ru.vtosters.lite.utils.Globals;
|
||||||
|
|
||||||
|
public class MP3Downloader {
|
||||||
|
|
||||||
|
private static final String URL_FORMAT = "https://api.vk.com/method/audio.getById?v=5.131&access_token=%s&audios=%s©right=https://vtosters.app/";
|
||||||
|
private static final OkHttpClient client = new OkHttpClient();
|
||||||
|
|
||||||
|
public MP3Downloader() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void execute(MusicTrack track) {
|
||||||
|
var token = Globals.getPreferences().getString("vk_admin_token", "");
|
||||||
|
if (token.isEmpty()) {
|
||||||
|
Toast.makeText(Globals.getContext(), "Обновите токен VK Admin в настройках", Toast.LENGTH_SHORT).show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var request = new Request.a()
|
||||||
|
.b(String.format(URL_FORMAT, token, track.y1()))
|
||||||
|
.a();
|
||||||
|
client.a(request).a(new Callback() {
|
||||||
|
@Override
|
||||||
|
public void a(Call call, IOException e) {
|
||||||
|
Log.d("MP3Downloader", e+"");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void a(Call call, Response response) throws IOException {
|
||||||
|
var payload = response.a().g();
|
||||||
|
Log.d("MP3Downloader", payload);
|
||||||
|
try {
|
||||||
|
JSONObject jsonObj = new JSONObject(payload);
|
||||||
|
if (jsonObj.has("response")) {
|
||||||
|
JSONObject responseNode = new JSONObject(payload).getJSONArray("response")
|
||||||
|
.getJSONObject(0);
|
||||||
|
if (responseNode.has("url")) {
|
||||||
|
var url = responseNode.optString("url");
|
||||||
|
Log.d("MP3Downloader", url);
|
||||||
|
if (url != null) {
|
||||||
|
if (url.endsWith(".mp3")) {
|
||||||
|
downloadMP3(track.toString(), url);
|
||||||
|
} else if (VKM3UParser.isM3U8(url)) {
|
||||||
|
AudioDownloader.downloadM3U8(track);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (JSONException e) {
|
||||||
|
Log.d("MP3Downloader", e+"");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void downloadMP3(String title, String url) {
|
||||||
|
var downloadManager = Globals.getContext().getSystemService(DownloadManager.class);
|
||||||
|
var request = new DownloadManager.Request(Uri.parse(url))
|
||||||
|
.setAllowedOverRoaming(true)
|
||||||
|
.setTitle("Downloading " + title)
|
||||||
|
.setDestinationInExternalFilesDir(Globals.getContext(),
|
||||||
|
Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath(),
|
||||||
|
title + ".mp3")
|
||||||
|
.setVisibleInDownloadsUi(true);
|
||||||
|
downloadManager.enqueue(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,7 +40,7 @@ public class VKM3UParser{
|
|||||||
} else if (line.startsWith("#EXTINF")) {
|
} else if (line.startsWith("#EXTINF")) {
|
||||||
if (mTransportStreams.size() == i)
|
if (mTransportStreams.size() == i)
|
||||||
mTransportStreams.add(new TransportStream());
|
mTransportStreams.add(new TransportStream());
|
||||||
} else if (line.endsWith(".ts") || line.endsWith(".tp") || line.endsWith(".mpeg-ts") || line.endsWith(".m2ts")) {
|
} else if (isM3U8(line)) {
|
||||||
mTransportStreams.get(i).setName(line);
|
mTransportStreams.get(i).setName(line);
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
@@ -51,6 +51,10 @@ public class VKM3UParser{
|
|||||||
return directive.substring(directive.indexOf(":") + 1);
|
return directive.substring(directive.indexOf(":") + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isM3U8(String str) {
|
||||||
|
return str.endsWith(".ts") || str.endsWith(".tp") || str.endsWith(".mpeg-ts") || str.endsWith(".m2ts");
|
||||||
|
}
|
||||||
|
|
||||||
public int getHeapSize(){
|
public int getHeapSize(){
|
||||||
return mHeapSize;
|
return mHeapSize;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package ru.vtosters.lite.ui.activities;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.webkit.WebResourceRequest;
|
||||||
|
import android.webkit.WebView;
|
||||||
|
import android.webkit.WebViewClient;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
import androidx.appcompat.app.AppCompatActivity;
|
||||||
|
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import ru.vtosters.lite.utils.LayoutHelper;
|
||||||
|
|
||||||
|
public class VKAdminTokenActivity extends AppCompatActivity {
|
||||||
|
|
||||||
|
private static final String URL = "https://oauth.vk.com/authorize?client_id=6121396&scope=1073737727&redirect_uri=https://oauth.vk.com/blank.html&display=page&response_type=token&revoke=1";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(@Nullable Bundle bundle) {
|
||||||
|
super.onCreate(bundle);
|
||||||
|
|
||||||
|
var container = new FrameLayout(this);
|
||||||
|
container.setLayoutParams(LayoutHelper.createFrame(-1, -1));
|
||||||
|
setContentView(container);
|
||||||
|
|
||||||
|
var webView = new WebView(this);
|
||||||
|
container.addView(webView, LayoutHelper.createFrame(-1, -1));
|
||||||
|
|
||||||
|
webView.setWebViewClient(new WebViewClient() {
|
||||||
|
@Override
|
||||||
|
public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) {
|
||||||
|
var url = request.getUrl().toString();
|
||||||
|
if (url.startsWith("https://oauth.vk.com/auth_redirect?")) {
|
||||||
|
var redirectUri = Uri.parse(URLDecoder.decode(url));
|
||||||
|
var authorizeUrl = redirectUri.getQueryParameter("authorize_url");
|
||||||
|
var accessToken = authorizeUrl.substring(authorizeUrl.indexOf("=") + 1, authorizeUrl.indexOf("&"));
|
||||||
|
|
||||||
|
var data = new Intent();
|
||||||
|
data.putExtra("token", accessToken);
|
||||||
|
setResult(Activity.RESULT_OK, data);
|
||||||
|
finish();
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return super.shouldOverrideUrlLoading(view, request);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, String> headers = new HashMap<>();
|
||||||
|
headers.put("User-Agent", System.getProperty("http.agent"));
|
||||||
|
|
||||||
|
webView.loadUrl(URL, headers);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -95,7 +95,7 @@ public class DockBarEditorManager {
|
|||||||
private void parseSelectedTabs(String[] selectedTabsTags) {
|
private void parseSelectedTabs(String[] selectedTabsTags) {
|
||||||
List<String> allTags = new ArrayList<>(Arrays.asList( "tab_news", "tab_superapps", "tab_messages", "tab_feedback", "tab_profile",
|
List<String> allTags = new ArrayList<>(Arrays.asList( "tab_news", "tab_superapps", "tab_messages", "tab_feedback", "tab_profile",
|
||||||
"tab_friends", "tab_groups", "tab_photos", "tab_audios", "tab_videos", "tab_lives", "tab_games", "tab_liked",
|
"tab_friends", "tab_groups", "tab_photos", "tab_audios", "tab_videos", "tab_lives", "tab_games", "tab_liked",
|
||||||
"tab_fave", "tab_documents", "tab_payments", "tab_vk_apps", "tab_settings", "tab_menu", "tab_brtd" ));
|
"tab_fave", "tab_documents", "tab_payments", "tab_vk_apps", "tab_settings", "tab_menu"));
|
||||||
for (String tag : selectedTabsTags) {
|
for (String tag : selectedTabsTags) {
|
||||||
mSelectedTabs.add(getTabByTag(tag));
|
mSelectedTabs.add(getTabByTag(tag));
|
||||||
allTags.remove(tag);
|
allTags.remove(tag);
|
||||||
@@ -152,7 +152,7 @@ public class DockBarEditorManager {
|
|||||||
return DockBarTab.valuesOf(
|
return DockBarTab.valuesOf(
|
||||||
"tab_feedback",
|
"tab_feedback",
|
||||||
!milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
!milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
||||||
!milkshake() ? R.string.friends : R.string.notification,
|
!milkshake() ? R.string.friends : R.string.not_notifications,
|
||||||
R.id.tab_feedback,
|
R.id.tab_feedback,
|
||||||
!milkshake() ? FriendsFragment.class : NotificationsContainerFragment.class);
|
!milkshake() ? FriendsFragment.class : NotificationsContainerFragment.class);
|
||||||
case "tab_profile":
|
case "tab_profile":
|
||||||
@@ -166,7 +166,7 @@ public class DockBarEditorManager {
|
|||||||
return DockBarTab.valuesOf(
|
return DockBarTab.valuesOf(
|
||||||
"tab_friends",
|
"tab_friends",
|
||||||
milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
milkshake() ? R.drawable.ic_users_outline_28 : R.drawable.ic_menu_notification_outline_28,
|
||||||
milkshake() ? R.string.friends : R.string.notification,
|
milkshake() ? R.string.friends : R.string.not_notifications,
|
||||||
R.id.menu_friends,
|
R.id.menu_friends,
|
||||||
milkshake() ? FriendsCatalogFragment.class : NotificationsContainerFragment.class);
|
milkshake() ? FriendsCatalogFragment.class : NotificationsContainerFragment.class);
|
||||||
case "tab_groups":
|
case "tab_groups":
|
||||||
@@ -236,7 +236,7 @@ public class DockBarEditorManager {
|
|||||||
return DockBarTab.valuesOf(
|
return DockBarTab.valuesOf(
|
||||||
"tab_payments",
|
"tab_payments",
|
||||||
R.drawable.ic_money_transfer_outline_28,
|
R.drawable.ic_money_transfer_outline_28,
|
||||||
R.string.money_transfer_money_transfers,
|
R.string.money_transfer_money,
|
||||||
R.id.menu_payments,
|
R.id.menu_payments,
|
||||||
MoneyTransfersFragment.class);
|
MoneyTransfersFragment.class);
|
||||||
case "tab_vk_apps":
|
case "tab_vk_apps":
|
||||||
@@ -246,13 +246,6 @@ public class DockBarEditorManager {
|
|||||||
R.string.menu_apps,
|
R.string.menu_apps,
|
||||||
R.id.menu_vk_apps,
|
R.id.menu_vk_apps,
|
||||||
AppsFragment.class);
|
AppsFragment.class);
|
||||||
case "tab_settings":
|
|
||||||
return DockBarTab.valuesOf(
|
|
||||||
"tab_settings",
|
|
||||||
R.drawable.ic_settings_outline_28,
|
|
||||||
R.string.menu_settings,
|
|
||||||
R.id.menu_settings,
|
|
||||||
useNewSettings());
|
|
||||||
case "tab_menu":
|
case "tab_menu":
|
||||||
return DockBarTab.valuesOf(
|
return DockBarTab.valuesOf(
|
||||||
"tab_menu",
|
"tab_menu",
|
||||||
@@ -260,15 +253,14 @@ public class DockBarEditorManager {
|
|||||||
milkshake() ? R.string.profile : R.string.menu,
|
milkshake() ? R.string.profile : R.string.menu,
|
||||||
R.id.tab_menu,
|
R.id.tab_menu,
|
||||||
milkshake() ? ProfileFragment.class : MenuFragment.class);
|
milkshake() ? ProfileFragment.class : MenuFragment.class);
|
||||||
case "tab_brtd":
|
case "tab_settings":
|
||||||
return DockBarTab.valuesOf(
|
|
||||||
"tab_brtd",
|
|
||||||
R.drawable.ic_menu_birthdays,
|
|
||||||
R.string.birthdays_title,
|
|
||||||
R.id.menu_birthdays,
|
|
||||||
BirthdaysFragment.class);
|
|
||||||
default:
|
default:
|
||||||
return null;
|
return DockBarTab.valuesOf(
|
||||||
|
"tab_settings",
|
||||||
|
R.drawable.ic_settings_outline_28,
|
||||||
|
R.string.menu_settings,
|
||||||
|
R.id.menu_settings,
|
||||||
|
useNewSettings());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,14 @@ import static ru.vtosters.lite.utils.SettBackup.deletePrefs;
|
|||||||
import static ru.vtosters.lite.utils.SettBackup.restoreBackup;
|
import static ru.vtosters.lite.utils.SettBackup.restoreBackup;
|
||||||
import static ru.vtosters.lite.utils.Themes.getAlertStyle;
|
import static ru.vtosters.lite.utils.Themes.getAlertStyle;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.ClipData;
|
import android.content.ClipData;
|
||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.util.Log;
|
||||||
import android.webkit.WebView;
|
import android.webkit.WebView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
@@ -38,19 +41,36 @@ import com.vtosters.lite.im.ImEngineProvider;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import b.h.g.m.FileUtils;
|
import b.h.g.m.FileUtils;
|
||||||
|
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
||||||
import ru.vtosters.lite.utils.Globals;
|
import ru.vtosters.lite.utils.Globals;
|
||||||
import ru.vtosters.lite.utils.SettBackup;
|
import ru.vtosters.lite.utils.SettBackup;
|
||||||
|
|
||||||
public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
public class OtherFragment extends MaterialPreferenceToolbarFragment {
|
||||||
|
|
||||||
|
private static final int VK_ADMIN_TOKEN_REQUEST_CODE = 1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle bundle){
|
public void onCreate(Bundle bundle) {
|
||||||
super.onCreate(bundle);
|
super.onCreate(bundle);
|
||||||
addPreferencesFromResource(getIdentifier("preferences_other", "xml"));
|
addPreferencesFromResource(getIdentifier("preferences_other", "xml"));
|
||||||
prefs();
|
prefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prefs(){
|
@Override
|
||||||
|
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||||
|
super.onActivityResult(requestCode, resultCode, data);
|
||||||
|
|
||||||
|
if (requestCode == VK_ADMIN_TOKEN_REQUEST_CODE) {
|
||||||
|
if (resultCode == Activity.RESULT_OK) {
|
||||||
|
String token = data.getStringExtra("token");
|
||||||
|
Globals.getPreferences().edit().putString("vk_admin_token", token).apply();
|
||||||
|
Log.d("VkAdminToken", token);
|
||||||
|
Toast.makeText(getContext(), "Токен успешно сохранён", LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void prefs() {
|
||||||
findPreference("firebasefix").setOnPreferenceClickListener(new a());
|
findPreference("firebasefix").setOnPreferenceClickListener(new a());
|
||||||
findPreference("applicationstop").setOnPreferenceClickListener(new b());
|
findPreference("applicationstop").setOnPreferenceClickListener(new b());
|
||||||
findPreference("tokencopy").setOnPreferenceClickListener(new c());
|
findPreference("tokencopy").setOnPreferenceClickListener(new c());
|
||||||
@@ -62,19 +82,30 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
|||||||
|
|
||||||
findPreference("saveprefs").setOnPreferenceClickListener(new saveprefs());
|
findPreference("saveprefs").setOnPreferenceClickListener(new saveprefs());
|
||||||
findPreference("restoreprefs").setOnPreferenceClickListener(new restoreprefs());
|
findPreference("restoreprefs").setOnPreferenceClickListener(new restoreprefs());
|
||||||
|
|
||||||
|
var vkAdminTokenPref = findPreference("vk_admin_token");
|
||||||
|
vkAdminTokenPref.setVisible(Globals.getDefprefs().getBoolean("new_music_downloading_way", false));
|
||||||
|
if (vkAdminTokenPref.isVisible()) {
|
||||||
|
vkAdminTokenPref.setOnPreferenceClickListener(preference -> {
|
||||||
|
|
||||||
|
startActivityForResult(new Intent(getContext(), VKAdminTokenActivity.class), VK_ADMIN_TOKEN_REQUEST_CODE);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class d implements Preference.OnPreferenceClickListener{
|
public static class d implements Preference.OnPreferenceClickListener {
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
restartApplication();
|
restartApplication();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class onlines implements Preference.OnPreferenceClickListener{
|
public class onlines implements Preference.OnPreferenceClickListener {
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
try {
|
try {
|
||||||
backupOnlines();
|
backupOnlines();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -84,40 +115,40 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class b implements Preference.OnPreferenceClickListener{
|
public static class b implements Preference.OnPreferenceClickListener {
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class deleteprefs implements Preference.OnPreferenceClickListener{
|
public static class deleteprefs implements Preference.OnPreferenceClickListener {
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
deletePrefs();
|
deletePrefs();
|
||||||
restartApplication();
|
restartApplication();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class c implements Preference.OnPreferenceClickListener{
|
class c implements Preference.OnPreferenceClickListener {
|
||||||
public void copy(Context context, String str){
|
public void copy(Context context, String str) {
|
||||||
((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", str));
|
((ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE)).setPrimaryClip(ClipData.newPlainText("MBH-ST", str));
|
||||||
makeText(context, Globals.getString("copybtn"), LENGTH_SHORT).show();
|
makeText(context, Globals.getString("copybtn"), LENGTH_SHORT).show();
|
||||||
ToastUtils.a(Globals.getString("tokenwarning"));
|
ToastUtils.a(Globals.getString("tokenwarning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
copy(getContext(), getUserToken());
|
copy(getContext(), getUserToken());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class e implements Preference.OnPreferenceClickListener{
|
public class e implements Preference.OnPreferenceClickListener {
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||||
prefs2.edit().clear().commit();
|
prefs2.edit().clear().commit();
|
||||||
new WebView(getActivity()).clearCache(true);
|
new WebView(getActivity()).clearCache(true);
|
||||||
@@ -132,9 +163,9 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class a implements Preference.OnPreferenceClickListener{
|
public class a implements Preference.OnPreferenceClickListener {
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
VKAccount b = VKAccountManager.d();
|
VKAccount b = VKAccountManager.d();
|
||||||
PushSubscriber.e.a();
|
PushSubscriber.e.a();
|
||||||
ToastUtils.a(Globals.getString("fcmtokenrem"));
|
ToastUtils.a(Globals.getString("fcmtokenrem"));
|
||||||
@@ -148,9 +179,9 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class f implements Preference.OnPreferenceClickListener{
|
public class f implements Preference.OnPreferenceClickListener {
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||||
prefs2.edit().clear().commit();
|
prefs2.edit().clear().commit();
|
||||||
deleteCache();
|
deleteCache();
|
||||||
@@ -159,20 +190,20 @@ public class OtherFragment extends MaterialPreferenceToolbarFragment{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class saveprefs implements Preference.OnPreferenceClickListener{
|
public class saveprefs implements Preference.OnPreferenceClickListener {
|
||||||
saveprefs(){
|
saveprefs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
backupSettings();
|
backupSettings();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class restoreprefs implements Preference.OnPreferenceClickListener{
|
public class restoreprefs implements Preference.OnPreferenceClickListener {
|
||||||
@Override // android.support.v7.preference.Preference.c
|
@Override // android.support.v7.preference.Preference.c
|
||||||
public boolean onPreferenceClick(Preference preference){
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
var arr = SettBackup.getBackupsNames();
|
var arr = SettBackup.getBackupsNames();
|
||||||
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr);
|
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr);
|
||||||
new AlertDialog.Builder(getContext(), getAlertStyle())
|
new AlertDialog.Builder(getContext(), getAlertStyle())
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
|||||||
import static ru.vtosters.lite.utils.Globals.getUserPhoto;
|
import static ru.vtosters.lite.utils.Globals.getUserPhoto;
|
||||||
import static ru.vtosters.lite.utils.Globals.getUsername;
|
import static ru.vtosters.lite.utils.Globals.getUsername;
|
||||||
import static ru.vtosters.lite.utils.Globals.isGmsInstalled;
|
import static ru.vtosters.lite.utils.Globals.isGmsInstalled;
|
||||||
|
import static ru.vtosters.lite.utils.Globals.isVKTester;
|
||||||
import static ru.vtosters.lite.utils.Globals.restartApplication;
|
import static ru.vtosters.lite.utils.Globals.restartApplication;
|
||||||
import static ru.vtosters.lite.utils.Preferences.DoNotUseOldIcons;
|
import static ru.vtosters.lite.utils.Preferences.DoNotUseOldIcons;
|
||||||
import static ru.vtosters.lite.utils.Preferences.ads;
|
import static ru.vtosters.lite.utils.Preferences.ads;
|
||||||
@@ -233,14 +234,16 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
addPreference(this, "", Globals.getString("bugs"), "", !DoNotUseOldIcons() ? "ic_bug_24" : "ic_bug_outline_28", preference -> {
|
if (isVKTester()) {
|
||||||
Context context = getContext();
|
addPreference(this, "", Globals.getString("bugs"), "", !DoNotUseOldIcons() ? "ic_bug_24" : "ic_bug_outline_28", preference -> {
|
||||||
VKUIwrapper.officalLinks("bugs");
|
Context context = getContext();
|
||||||
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
VKUIwrapper.officalLinks("bugs");
|
||||||
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
Intent a2 = new Navigator(VKUIwrapper.class).b(context);
|
||||||
context.startActivity(a2);
|
a2.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||||
return false;
|
context.startActivity(a2);
|
||||||
});
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
addPreference(this, "", Globals.getString("vtssfs"), ssfs, !DoNotUseOldIcons() ? "ic_link_24" : "ic_link_circle_outline_28", preference -> {
|
addPreference(this, "", Globals.getString("vtssfs"), ssfs, !DoNotUseOldIcons() ? "ic_link_24" : "ic_link_circle_outline_28", preference -> {
|
||||||
Context context = getContext();
|
Context context = getContext();
|
||||||
|
|||||||
@@ -41,7 +41,6 @@ import android.util.Log;
|
|||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.RequiresApi;
|
|
||||||
import androidx.annotation.StringRes;
|
import androidx.annotation.StringRes;
|
||||||
|
|
||||||
import com.vk.dto.user.UserProfile;
|
import com.vk.dto.user.UserProfile;
|
||||||
@@ -132,6 +131,10 @@ public class Globals{
|
|||||||
return VKAccountManager.d().D0();
|
return VKAccountManager.d().D0();
|
||||||
} // Current UserId
|
} // Current UserId
|
||||||
|
|
||||||
|
public static boolean isVKTester(){
|
||||||
|
return VKAccountManager.d().i();
|
||||||
|
} // is vk tester
|
||||||
|
|
||||||
public static String getUserSecret(){
|
public static String getUserSecret(){
|
||||||
return VKAccountManager.d().l0();
|
return VKAccountManager.d().l0();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -400,8 +400,8 @@ public class Themes{
|
|||||||
new int[]{-android.R.attr.state_checked}
|
new int[]{-android.R.attr.state_checked}
|
||||||
},
|
},
|
||||||
new int[]{
|
new int[]{
|
||||||
dockbar_accent() ? parseColor("#ff528bcc") : (isDarkTheme() ? parseColor("#ffefefef") : parseColor("#ff545454")),
|
dockbar_accent() ? getAccentColor() : (isDarkTheme() ? getResources().getColor(R.color.white) : getResources().getColor(R.color.gray_700)),
|
||||||
dockbar_accent() ? parseColor("#ffaaaeb3") : (isDarkTheme() ? parseColor("#ff8a8d92") : parseColor("#ffaaaeb3"))
|
isDarkTheme() ? getResources().getColor(R.color.gray_500) : getResources().getColor(R.color.vk_steel_gray_300)
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,10 @@
|
|||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="musicFixNew"
|
android:key="musicFixNew"
|
||||||
android:title="Фикс музыки v2" />
|
android:title="Фикс музыки v2" />
|
||||||
|
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="new_music_downloading_way"
|
||||||
|
android:title="Новый способ скачивания музыки" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="@string/debug_developer_functions">
|
<PreferenceCategory android:title="@string/debug_developer_functions">
|
||||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||||
|
|||||||
@@ -28,6 +28,9 @@
|
|||||||
<Preference
|
<Preference
|
||||||
android:key="tokencopy"
|
android:key="tokencopy"
|
||||||
android:title="@string/copytokenbtn" />
|
android:title="@string/copytokenbtn" />
|
||||||
|
<Preference
|
||||||
|
android:key="vk_admin_token"
|
||||||
|
android:title="Токен от VK Admin" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
<PreferenceCategory android:title="Бэкапы">
|
<PreferenceCategory android:title="Бэкапы">
|
||||||
<Preference
|
<Preference
|
||||||
|
|||||||
@@ -39,10 +39,6 @@
|
|||||||
.method public static a(Lorg/json/JSONObject;)Lcom/vtosters/lite/api/ExtendedUserProfile$d;
|
.method public static a(Lorg/json/JSONObject;)Lcom/vtosters/lite/api/ExtendedUserProfile$d;
|
||||||
.locals 3
|
.locals 3
|
||||||
|
|
||||||
invoke-static {p0}, Lru/vtosters/lite/hooks/JsonInjectors;->profileButton(Lorg/json/JSONObject;)Lorg/json/JSONObject;
|
|
||||||
|
|
||||||
move-result-object p0
|
|
||||||
|
|
||||||
.line 1
|
.line 1
|
||||||
new-instance v0, Lcom/vtosters/lite/api/ExtendedUserProfile$d;
|
new-instance v0, Lcom/vtosters/lite/api/ExtendedUserProfile$d;
|
||||||
|
|
||||||
|
|||||||
@@ -1513,6 +1513,10 @@
|
|||||||
iput-object v0, v15, Lcom/vtosters/lite/api/ExtendedUserProfile;->l1:Ljava/util/ArrayList;
|
iput-object v0, v15, Lcom/vtosters/lite/api/ExtendedUserProfile;->l1:Ljava/util/ArrayList;
|
||||||
|
|
||||||
:cond_22
|
:cond_22
|
||||||
|
invoke-static {v14}, Lru/vtosters/lite/hooks/JsonInjectors;->profileButton(Lorg/json/JSONObject;)Lorg/json/JSONObject;
|
||||||
|
|
||||||
|
move-result-object v14
|
||||||
|
|
||||||
const-string v0, "buttons"
|
const-string v0, "buttons"
|
||||||
|
|
||||||
.line 122
|
.line 122
|
||||||
|
|||||||
Reference in New Issue
Block a user