Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21fc171363 | ||
|
|
fb09513ca7 | ||
|
|
dc49c75992 | ||
|
|
dd289f1933 | ||
|
|
360c5db990 | ||
|
|
0df490dc55 | ||
|
|
064f5d8b31 | ||
|
|
40f3d74f07 | ||
|
|
cd08354b5e | ||
|
|
64a9a3c1e8 | ||
|
|
8770712687 | ||
|
|
009f856b33 | ||
|
|
022c264740 | ||
|
|
dd2d79e474 | ||
|
|
f2fe2ec362 | ||
|
|
46ef15d9c8 | ||
|
|
93a507a314 | ||
|
|
a3853a012d | ||
|
|
10ed61acfc | ||
|
|
8b434d4cae | ||
|
|
92a33995bd | ||
|
|
d994439561 | ||
|
|
ed751bdc30 | ||
|
|
ababaad45f | ||
|
|
9a76492c06 | ||
|
|
2d19254d51 | ||
|
|
d557abe6e9 | ||
|
|
658c4bcaf6 | ||
|
|
7b12be3736 | ||
|
|
9e2bfe83b8 | ||
|
|
817bdd8198 | ||
|
|
230f8e5cd3 | ||
|
|
cfce4cd1ff | ||
|
|
c9c602b1f9 | ||
|
|
8ca73197d6 | ||
|
|
2cf60aedac | ||
|
|
207a63117e | ||
|
|
14e92e7352 | ||
|
|
23c60bdf2d | ||
|
|
680dcf9cf2 | ||
|
|
5249600b76 | ||
|
|
bc5a401e0e | ||
|
|
125c2d3d69 | ||
|
|
db95b53d41 |
@@ -1,16 +1,21 @@
|
||||
package com.vk.api.audio;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.vk.api.base.ApiRequest;
|
||||
import com.vk.dto.music.MusicTrack;
|
||||
import com.vk.log.L;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.lite.music.Genius;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ru.vtosters.lite.music.Genius;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
public class AudioGetLyrics extends ApiRequest<AudioGetLyrics.a> {
|
||||
private final MusicTrack musicTrack;
|
||||
|
||||
@@ -65,7 +70,7 @@ public class AudioGetLyrics extends ApiRequest<AudioGetLyrics.a> {
|
||||
return aVar;
|
||||
} catch (Exception e) {
|
||||
L.e("vk", e);
|
||||
aVar.a = "Ошибка получения текста" + "\n\n" + "Ошибка: \n" + e.getLocalizedMessage();
|
||||
aVar.a = AndroidUtils.getString("failed_to_get_text") + "\n\n" + AndroidUtils.getString("error") + ": \n" + e.getLocalizedMessage();
|
||||
return aVar;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.vk.core.extensions;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.AttrRes;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import b.h.v.InitialValueObservable;
|
||||
import b.h.v.TextViewTextChangeEvent;
|
||||
import b.h.v.TextViewTextChangeEventObservable;
|
||||
import com.vk.core.util.ContextExtKt;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public final class TextViewExt {
|
||||
public static void a(TextView textView, Drawable drawable) {
|
||||
a(textView, null, drawable);
|
||||
}
|
||||
|
||||
public static boolean b(TextView textView) {
|
||||
return textView == null || TextUtils.isEmpty(textView.getEditableText());
|
||||
}
|
||||
|
||||
public static InitialValueObservable<TextViewTextChangeEvent> c(TextView textView) {
|
||||
return new TextViewTextChangeEventObservable(textView);
|
||||
}
|
||||
|
||||
public static void d(TextView textView, @DrawableRes int i, @AttrRes int i2) {
|
||||
b(textView, ThemesUtils.recolorDrawable(ContextExtKt.a(textView.getContext(), i, ContextExtKt.h(textView.getContext(), i2))));
|
||||
}
|
||||
|
||||
public static void a(TextView textView, Drawable drawable, ColorStateList colorStateList) {
|
||||
a(textView, null, a(drawable, colorStateList));
|
||||
}
|
||||
|
||||
public static void b(TextView textView, Drawable drawable) {
|
||||
a(textView, drawable, (Drawable) null);
|
||||
}
|
||||
|
||||
public static void c(TextView textView, @DrawableRes int i, @ColorRes int i2) {
|
||||
if (i == 0) {
|
||||
b(textView, null);
|
||||
} else if (i2 == 0) {
|
||||
b(textView, ContextCompat.getDrawable(textView.getContext(), i));
|
||||
} else {
|
||||
b(textView, ContextCompat.getDrawable(textView.getContext(), i), ContextCompat.getColorStateList(textView.getContext(), i2));
|
||||
}
|
||||
}
|
||||
|
||||
public static void d(TextView textView, int i) {
|
||||
textView.setTextSize(0, i);
|
||||
}
|
||||
|
||||
public static void a(TextView textView, @DrawableRes int i) {
|
||||
a(textView, i, 0);
|
||||
}
|
||||
|
||||
public static void b(TextView textView, Drawable drawable, ColorStateList colorStateList) {
|
||||
a(textView, a(drawable, colorStateList), (Drawable) null);
|
||||
}
|
||||
|
||||
public static void a(TextView textView, @DrawableRes int i, @ColorRes int i2) {
|
||||
if (i == 0) {
|
||||
a(textView, (Drawable) null);
|
||||
} else if (i2 == 0) {
|
||||
a(textView, ContextCompat.getDrawable(textView.getContext(), i));
|
||||
} else {
|
||||
a(textView, ContextCompat.getDrawable(textView.getContext(), i), ContextCompat.getColorStateList(textView.getContext(), i2));
|
||||
}
|
||||
}
|
||||
|
||||
public static void b(TextView textView, @DrawableRes int i) {
|
||||
c(textView, i, 0);
|
||||
}
|
||||
|
||||
public static void b(TextView textView, @DrawableRes int i, @AttrRes int i2) {
|
||||
if (i == 0) {
|
||||
a(textView, (Drawable) null);
|
||||
} else if (i2 == 0) {
|
||||
a(textView, ContextCompat.getDrawable(textView.getContext(), i));
|
||||
} else {
|
||||
Drawable drawable = ContextCompat.getDrawable(textView.getContext(), i);
|
||||
a(textView, drawable, ColorStateList.valueOf(ContextExtKt.h(textView.getContext(), i2)));
|
||||
}
|
||||
}
|
||||
|
||||
public static void c(TextView textView, @ColorRes int i) {
|
||||
textView.setTextColor(ContextExtKt.a(textView.getContext(), i));
|
||||
}
|
||||
|
||||
private static void a(TextView textView, Drawable drawable, Drawable drawable2) {
|
||||
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, null, drawable2, null);
|
||||
}
|
||||
|
||||
public static void a(TextView textView) {
|
||||
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, null, null);
|
||||
}
|
||||
|
||||
public static Drawable a(Drawable drawable, ColorStateList colorStateList) {
|
||||
if (colorStateList == null) return drawable;
|
||||
|
||||
if (drawable != null) {
|
||||
Drawable wrap = DrawableCompat.wrap(drawable.mutate());
|
||||
DrawableCompat.setTintList(wrap, colorStateList);
|
||||
return wrap;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void a(TextView textView, CharSequence charSequence) {
|
||||
if (TextUtils.isEmpty(charSequence)) {
|
||||
textView.setVisibility(View.GONE);
|
||||
return;
|
||||
}
|
||||
|
||||
textView.setVisibility(View.VISIBLE);
|
||||
textView.setText(charSequence);
|
||||
}
|
||||
|
||||
public static void a(TextView textView, float f) {
|
||||
textView.setTextSize(0, f);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.vk.extensions;
|
||||
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.AttrRes;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
|
||||
public final class TextViewExt {
|
||||
public static void a(TextView textView, @AttrRes int i) {
|
||||
VKThemeHelper.a(textView, i);
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,7 @@ public class OEMDetector {
|
||||
try {
|
||||
getPropMtd = ReflectionUtils.findMethod(Class.forName("android.os.SystemProperties"), "get", String.class);
|
||||
semPlatformIntField = ReflectionUtils.findField(Build.VERSION.class, "SEM_PLATFORM_INT");
|
||||
} catch (NoSuchFieldException | ClassNotFoundException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchFieldException | ClassNotFoundException | NoSuchMethodException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +57,7 @@ public class OEMDetector {
|
||||
}
|
||||
|
||||
public static boolean isOEM() {
|
||||
return isMIUI() || isEMUI() || isFlyme() || isZenUI() || isSamsung() || isVivo();
|
||||
return isMIUI() || isEMUI() || isFlyme() || isZenUI() || isSamsung() || isVivo() || isOneUi();
|
||||
}
|
||||
|
||||
public static boolean isMIUI() {
|
||||
|
||||
@@ -5,7 +5,6 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
public abstract class IMProcessor {
|
||||
@@ -84,4 +83,8 @@ public abstract class IMProcessor {
|
||||
public String getEncryptionKeyFor(int id) {
|
||||
return Preferences.getPreferences().getString("VT_IMEncodeKey_" + getPrefKey() + "_" + id, null);
|
||||
}
|
||||
|
||||
public void removeEncryptionKeyFor(int id) {
|
||||
Preferences.getPreferences().edit().remove("VT_IMEncodeKey_" + getPrefKey() + "_" + id).apply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public class CryptImHook {
|
||||
key = enabled.getEncryptionKeyFor(peerId);
|
||||
}
|
||||
|
||||
if (key.equals("VTAesDefault")) {
|
||||
if (Objects.equals(key, "VTAesDefault")) {
|
||||
key = null;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,9 @@ public class CryptImHook {
|
||||
Editable edit = editText.getText();
|
||||
finalEnabled.setEncryptionKeyFor(peerId, edit == null ? null : edit.toString());
|
||||
}).setNegativeButton(android.R.string.cancel, null)
|
||||
.setNeutralButton(AndroidUtils.getString("remove_encryption_key"), (dialog, which) -> {
|
||||
finalEnabled.removeEncryptionKeyFor(peerId);
|
||||
})
|
||||
.show();
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public class DeviceInfoHook {
|
||||
}
|
||||
|
||||
@SuppressLint("HardwareIds")
|
||||
private static String findDeviceId() {
|
||||
return Settings.Secure.getString(getGlobalContext().getContentResolver(), "android_id");
|
||||
public static String findDeviceId() {
|
||||
return Settings.Secure.getString(getGlobalContext().getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
|
||||
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
|
||||
import ru.vtosters.lite.ssfs.UsersList;
|
||||
import ru.vtosters.lite.themes.ThemesManager;
|
||||
import ru.vtosters.lite.ui.dialogs.DisableBattery;
|
||||
@@ -20,11 +21,10 @@ import static ru.vtosters.lite.ui.dialogs.ServerDialog.sendRequest;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
import static ru.vtosters.lite.utils.Preferences.checkupdates;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.setNeededTheme;
|
||||
|
||||
public class MainActivityInjector {
|
||||
public static void inject(Activity activity) {
|
||||
setNeededTheme(activity);
|
||||
SystemThemeChangerHook.themeOnStart(activity);
|
||||
sendRequest();
|
||||
UsersList.getUsersList();
|
||||
|
||||
@@ -40,7 +40,7 @@ public class MainActivityInjector {
|
||||
NotificationChannels.createChannels();
|
||||
}
|
||||
|
||||
if(Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && ThemesManager.canApplyCustomAccent()) {
|
||||
if (Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && ThemesManager.canApplyCustomAccent() && ThemesUtils.useNewColorEngine()) {
|
||||
Preferences.updateBuildNumber();
|
||||
updateBinsAndTmpArchive(activity);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class MainActivityInjector {
|
||||
private static void updateBinsAndTmpArchive(Activity activity) {
|
||||
final VKProgressDialog dialog = new VKProgressDialog(activity);
|
||||
|
||||
dialog.setMessage("Применение акцента");
|
||||
dialog.setMessage(AndroidUtils.getString("applying_accent"));
|
||||
dialog.show();
|
||||
|
||||
VTExecutors.getIoExecutor().execute(() -> {
|
||||
@@ -73,8 +73,8 @@ public class MainActivityInjector {
|
||||
activity.runOnUiThread(() -> {
|
||||
dialog.cancel();
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle("Ошикба")
|
||||
.setMessage("Ошибка при применении акцента:\n" + e)
|
||||
.setTitle(activity.getString(R.string.error))
|
||||
.setMessage(AndroidUtils.getString("error_applying_accent") + ":\n" + e)
|
||||
.setPositiveButton(R.string.ok, null)
|
||||
.show();
|
||||
});
|
||||
|
||||
@@ -12,7 +12,9 @@ import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
import android.content.Context;
|
||||
import android.os.PowerManager;
|
||||
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.vk.core.preference.Preference;
|
||||
import com.vk.discover.DiscoverItemDecorator;
|
||||
import com.vtosters.lite.api.ExtendedCommunityProfile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -37,6 +39,24 @@ public class NewsfeedHook {
|
||||
};
|
||||
}
|
||||
|
||||
public static boolean samsungFixRem(RecyclerView recyclerView, DiscoverItemDecorator discoverItemDecorator) {
|
||||
if (!recyclerView.isComputingLayout() && recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
recyclerView.removeItemDecoration(discoverItemDecorator);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean samsungFixAdd(RecyclerView recyclerView, DiscoverItemDecorator discoverItemDecorator) {
|
||||
if (!recyclerView.isComputingLayout() && recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_IDLE) {
|
||||
recyclerView.addItemDecoration(discoverItemDecorator);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List hideElement(ArrayList list) {
|
||||
if (!getBoolValue("whatsnew", true)) {
|
||||
list.clear();
|
||||
|
||||
@@ -10,7 +10,9 @@ import androidx.appcompat.view.ContextThemeWrapper;
|
||||
import com.vk.auth.ui.VkAuthTextView;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.ui.fragments.DataSettingsFragment;
|
||||
import ru.vtosters.lite.ui.fragments.ProxySettingsFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NavigatorUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
@@ -21,9 +23,13 @@ import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
public class ProxyHook {
|
||||
public static void hookAuth(View v) {
|
||||
VkAuthTextView button = (VkAuthTextView) v;
|
||||
VkAuthTextView button = v.findViewById(AndroidUtils.getIdentifier("already_have_account", "id"));
|
||||
button.setText(R.string.proxy_setup);
|
||||
button.setOnClickListener(v1 -> callProxyDialog(v1.getContext()));
|
||||
|
||||
VkAuthTextView recoverAccounts = v.findViewById(AndroidUtils.getIdentifier("account_backup_view", "id"));
|
||||
recoverAccounts.setText(AndroidUtils.getString("restore_accounts"));
|
||||
recoverAccounts.setOnClickListener(v1 -> NavigatorUtils.switchFragment(v.getContext(), DataSettingsFragment.class));
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package ru.vtosters.lite.hooks;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.CompoundButton;
|
||||
@@ -8,46 +9,50 @@ import androidx.appcompat.widget.SwitchCompat;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.drawable.DrawableCompat;
|
||||
import androidx.core.widget.CompoundButtonCompat;
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vk.core.util.ColorUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
import static com.vk.core.ui.themes.VKThemeHelper.r;
|
||||
import static com.vtosters.lite.R.color.*;
|
||||
|
||||
public class SwitchHook {
|
||||
private static final int[] SWITCH_COLORS = {
|
||||
getSwitchColor(),
|
||||
getDisabledSwitchColor(),
|
||||
ContextCompat.getColor(VKThemeHelper.u(), gray_20),
|
||||
ThemesUtils.getAccentColor()
|
||||
};
|
||||
private static final int[] TRACK_COLORS = {
|
||||
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill), 0.4f),
|
||||
ColorUtils.b(ThemesUtils.getAccentColor(), 0.12f),
|
||||
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill),
|
||||
ColorUtils.b(ThemesUtils.getAccentColor(), 0.48f)
|
||||
};
|
||||
private static int[] getSwitchColors(Context ctx) {
|
||||
return new int[] {
|
||||
ContextCompat.getColor(ctx, ThemesUtils.isDarkTheme() ? gray_800 : white),
|
||||
ContextCompat.getColor(ctx, ThemesUtils.isDarkTheme() ? switch_disabled_on_dark : switch_disabled_on_light),
|
||||
ContextCompat.getColor(ctx, gray_20),
|
||||
ThemesUtils.getAccentColor()
|
||||
};
|
||||
}
|
||||
|
||||
public static void setSwitchCompatColors(SwitchCompat switchCompat) {
|
||||
if (Preferences.getBoolValue("useCustomPrefsStyle", false)) {
|
||||
switchCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createTrackColorStateList(), SWITCH_COLORS)));
|
||||
switchCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createTrackColorStateList(), TRACK_COLORS)));
|
||||
private static int[] getTrackColors() {
|
||||
return new int[] {
|
||||
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill), 0.4f),
|
||||
ColorUtils.b(ThemesUtils.getAccentColor(), 0.12f),
|
||||
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill),
|
||||
ColorUtils.b(ThemesUtils.getAccentColor(), 0.48f)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static void setSwitchCompatColors(SwitchCompat switchCompat, Context ctx) {
|
||||
if (Preferences.getBoolValue("useCustomPrefsStyle", true)) {
|
||||
switchCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createColorStateList(), getSwitchColors(ctx))));
|
||||
switchCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createColorStateList(), getTrackColors())));
|
||||
} else {
|
||||
setTintList(switchCompat.getThumbDrawable(), new ColorStateList(createTrackColorStateList(), SWITCH_COLORS));
|
||||
setTintList(switchCompat.getTrackDrawable(), new ColorStateList(createTrackColorStateList(), TRACK_COLORS));
|
||||
setTintList(switchCompat.getThumbDrawable(), new ColorStateList(createColorStateList(), getSwitchColors(ctx)));
|
||||
setTintList(switchCompat.getTrackDrawable(), new ColorStateList(createColorStateList(), getTrackColors()));
|
||||
}
|
||||
}
|
||||
|
||||
public static void setSwitchColors(Switch drawableCompat) {
|
||||
if (Preferences.getBoolValue("useCustomPrefsStyle", false)) {
|
||||
drawableCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createTrackColorStateList(), SWITCH_COLORS)));
|
||||
drawableCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createTrackColorStateList(), TRACK_COLORS)));
|
||||
public static void setSwitchColors(Switch drawableCompat, Context ctx) {
|
||||
if (Preferences.getBoolValue("useCustomPrefsStyle", true)) {
|
||||
drawableCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createColorStateList(), getSwitchColors(ctx))));
|
||||
drawableCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createColorStateList(), getTrackColors())));
|
||||
} else {
|
||||
setTintList(drawableCompat.getThumbDrawable(), new ColorStateList(createTrackColorStateList(), SWITCH_COLORS));
|
||||
setTintList(drawableCompat.getTrackDrawable(), new ColorStateList(createTrackColorStateList(), TRACK_COLORS));
|
||||
setTintList(drawableCompat.getThumbDrawable(), new ColorStateList(createColorStateList(), getSwitchColors(ctx)));
|
||||
setTintList(drawableCompat.getTrackDrawable(), new ColorStateList(createColorStateList(), getTrackColors()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +60,7 @@ public class SwitchHook {
|
||||
CompoundButtonCompat.setButtonTintList(
|
||||
compoundButton,
|
||||
new ColorStateList(
|
||||
createTrackColorStateList(),
|
||||
createColorStateList(),
|
||||
new int[]{
|
||||
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.selection_off_icon), 0.4f),
|
||||
ColorUtils.b(ThemesUtils.getAccentColor(), 0.4f),
|
||||
@@ -63,7 +68,7 @@ public class SwitchHook {
|
||||
ThemesUtils.getAccentColor()}));
|
||||
}
|
||||
|
||||
private static int[][] createTrackColorStateList() {
|
||||
private static int[][] createColorStateList() {
|
||||
return new int[][]{
|
||||
new int[]{-android.R.attr.state_enabled, -android.R.attr.state_checked},
|
||||
new int[]{-android.R.attr.state_enabled, android.R.attr.state_checked},
|
||||
@@ -78,10 +83,6 @@ public class SwitchHook {
|
||||
return wrappedDrawable;
|
||||
}
|
||||
|
||||
private static int getSwitchColor() {
|
||||
return ContextCompat.getColor(VKThemeHelper.u(), r() ? gray_800 : white);
|
||||
}
|
||||
|
||||
private static Drawable getCustomTrack() {
|
||||
return AndroidUtils.getGlobalContext().getDrawable(AndroidUtils.getIdentifier("custom_track_selector", "drawable"));
|
||||
}
|
||||
@@ -89,8 +90,4 @@ public class SwitchHook {
|
||||
private static Drawable getCustomThumb() {
|
||||
return AndroidUtils.getGlobalContext().getDrawable(AndroidUtils.getIdentifier("custom_thumb_selector", "drawable"));
|
||||
}
|
||||
|
||||
private static int getDisabledSwitchColor() {
|
||||
return ContextCompat.getColor(VKThemeHelper.u(), r() ? switch_disabled_on_dark : switch_disabled_on_light);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.vk.toggle.Features;
|
||||
public class TogglesHook {
|
||||
public static boolean shouldPatch(Features.Type feature) {
|
||||
return switch (feature) {
|
||||
case AB_IM_LONGPOLL_MSG_BATCHING, FEATURE_MOZJPEG, AB_IM_VIEW_POOL, AB_MULTI_GIFTS, AB_NEWS_VIDEO_LAYOUT_TEXT, AB_STICKERS_DISCOVER, AB_GIFTS_FROM_KEYBOARD, FEATURE_FEED_DEFAULT_LIST_ALWAYS, EXPERIMENT_NEWS_VIDEO_LAYOUT_TEXT, FEATURE_MILKSHAKE_DISCOVER_IN_MENU, FEATURE_DISCOVER_CATEGORIES, FEATURE_FAVE_PERF_IMPROVE, FEATURE_GROUP_ADMIN_MESSAGES, FEATURE_GROUP_MSG_PUSH_PARAM, FEATURE_IMAGE_QUALITY_UPGRADE, FEATURE_IM_AUDIO_MSG_TRANSCRIPT, FEATURE_IM_CASPER_MSGS, FEATURE_IM_DISABLE_FORCE_OPEN_VK_ME, FEATURE_IM_GIF_AUTOPLAY, FEATURE_IM_MR_IN_VKAPP, FEATURE_MEMORIES_ENABLED, FEATURE_MENU_GAMES_CAROUSEL, FEATURE_MILKSHAKE, FEATURE_MILKSHAKE_CHANGE_FEED_BY_TIMEOUT, FEATURE_MILKSHAKE_NEWS_SCROLL_ON_BACK, FEATURE_MILKSHAKE_SWITCH_THEME_ON_TAP, FEATURE_ML_BRANDS, FEATURE_ML_FEATURES, FEATURE_ML_MODELS_LOADING, FEATURE_MONEY_TRANSFERS_VKPAY, FEATURE_MUSIC_ARTIST_CATALOG, FEATURE_MUSIC_NEW_CATALOG, FEATURE_NARRATIVE_SNIPPET_TYPE, FEATURE_NEWS_GAMES_IN_DISCOVER, FEATURE_NEWS_HEADER_SCROLL, FEATURE_NEW_FORMAT_SHOW_WPB, FEATURE_PODCASTS_PAGE, FEATURE_QR_CREATE_QR, FEATURE_QR_DYNAMIC_FRAME, FEATURE_QR_SCAN_FROM_PHOTO, FEATURE_QR_VISION_DECODER, FEATURE_QUEUE_COUNTERS, FEATURE_REEF, FEATURE_ROAMING_AUTOPLAY, FEATURE_SHARE_MSGS_ON_INVITE, FEATURE_STICKERS_BOT_LINK, FEATURE_STICKERS_NEW_CATALOG, FEATURE_STORIES_AVATAR, FEATURE_STORIES_FEED_TYPE, FEATURE_STORIES_SHOW_ALWAYS, FEATURE_STORY_ANSWER_PUBLIC, FEATURE_STORY_APP_STICKER, FEATURE_STORY_ARCHIVE, FEATURE_STORY_ARCHIVE_POST, FEATURE_STORY_BAKGROUND_ALL, FEATURE_STORY_BOX, FEATURE_STORY_CADRE, FEATURE_STORY_CAMERA_TOOLTIP, FEATURE_STORY_EDITOR_GALLERY, FEATURE_STORY_EDITOR_TYPE, FEATURE_STORY_ENDLESS_VIDEO, FEATURE_STORY_FAST_REACTIONS, FEATURE_STORY_GIF, FEATURE_STORY_GROUPED, FEATURE_STORY_HIGH_QUALITY, FEATURE_STORY_MASKS_FRONTAL, FEATURE_STORY_MENTION_ICON, FEATURE_STORY_MODERN_PUBLISH, FEATURE_STORY_MUSIC_EDITOR, FEATURE_STORY_MUSIC_REPLIES, FEATURE_STORY_MUSIC_REPLIES_2, FEATURE_STORY_NEW_FRAME, FEATURE_STORY_ONE_TIME, FEATURE_STORY_PHOTO_SHARING, FEATURE_STORY_PHOTO_STICKER, FEATURE_STORY_POLLS, FEATURE_STORY_POST_REPOST, FEATURE_STORY_PRELOADING, FEATURE_STORY_QUESTION, FEATURE_STORY_QUESTION_STYLE, FEATURE_STORY_RLOTTIE, FEATURE_STORY_RLOTTIE_CACHE, FEATURE_STORY_SAVE_DEFAULT_ON, FEATURE_STORY_SEND_DIALOG_LIST, FEATURE_STORY_STICKER_PACK, FEATURE_STORY_TIME, FEATURE_STORY_VIEWER_CAMERA, FEATURE_STORY_VOICE_ANSWER, FEATURE_STORY_WITH_CONTEXT, FEATURE_SUPERAPP_MENU, FEATURE_TRAFFIC_SAVER, FEATURE_VKPAY_WIDGET, FEATURE_VKUI_INTERNAL_TO_MINI_APPS, FEATURE_VKUI_TOKEN_CACHE, FEATURE_VK_APPS_SEARCH, FEATURE_VOTES_BALANCE, FEATURE_WEBVIEW_TOKEN_ACTIVE, FEATURE_MILKSHAKE_FORCE_DISABLED, FEATURE_MILKSHAKE_ACTIVATION_DISABLED, EXPERIMENT_NEWS_DISABLE_CACHE ->
|
||||
case AB_IM_LONGPOLL_MSG_BATCHING, FEATURE_MOZJPEG, AB_IM_VIEW_POOL, AB_MULTI_GIFTS, AB_NEWS_VIDEO_LAYOUT_TEXT, AB_STICKERS_DISCOVER, AB_GIFTS_FROM_KEYBOARD, FEATURE_FEED_DEFAULT_LIST_ALWAYS, EXPERIMENT_NEWS_VIDEO_LAYOUT_TEXT, FEATURE_DISCOVER_CATEGORIES, FEATURE_FAVE_PERF_IMPROVE, FEATURE_GROUP_ADMIN_MESSAGES, FEATURE_GROUP_MSG_PUSH_PARAM, FEATURE_IMAGE_QUALITY_UPGRADE, FEATURE_IM_AUDIO_MSG_TRANSCRIPT, FEATURE_IM_CASPER_MSGS, FEATURE_IM_DISABLE_FORCE_OPEN_VK_ME, FEATURE_IM_GIF_AUTOPLAY, FEATURE_IM_MR_IN_VKAPP, FEATURE_MEMORIES_ENABLED, FEATURE_MENU_GAMES_CAROUSEL, FEATURE_MILKSHAKE, FEATURE_MILKSHAKE_CHANGE_FEED_BY_TIMEOUT, FEATURE_MILKSHAKE_NEWS_SCROLL_ON_BACK, FEATURE_MILKSHAKE_SWITCH_THEME_ON_TAP, FEATURE_ML_BRANDS, FEATURE_ML_FEATURES, FEATURE_ML_MODELS_LOADING, FEATURE_MONEY_TRANSFERS_VKPAY, FEATURE_MUSIC_ARTIST_CATALOG, FEATURE_MUSIC_NEW_CATALOG, FEATURE_NARRATIVE_SNIPPET_TYPE, FEATURE_NEWS_GAMES_IN_DISCOVER, FEATURE_NEWS_HEADER_SCROLL, FEATURE_NEW_FORMAT_SHOW_WPB, FEATURE_PODCASTS_PAGE, FEATURE_QR_CREATE_QR, FEATURE_QR_DYNAMIC_FRAME, FEATURE_QR_SCAN_FROM_PHOTO, FEATURE_QR_VISION_DECODER, FEATURE_QUEUE_COUNTERS, FEATURE_REEF, FEATURE_ROAMING_AUTOPLAY, FEATURE_SHARE_MSGS_ON_INVITE, FEATURE_STICKERS_BOT_LINK, FEATURE_STICKERS_NEW_CATALOG, FEATURE_STORIES_AVATAR, FEATURE_STORIES_FEED_TYPE, FEATURE_STORIES_SHOW_ALWAYS, FEATURE_STORY_ANSWER_PUBLIC, FEATURE_STORY_APP_STICKER, FEATURE_STORY_ARCHIVE, FEATURE_STORY_ARCHIVE_POST, FEATURE_STORY_BAKGROUND_ALL, FEATURE_STORY_BOX, FEATURE_STORY_CADRE, FEATURE_STORY_CAMERA_TOOLTIP, FEATURE_STORY_EDITOR_GALLERY, FEATURE_STORY_EDITOR_TYPE, FEATURE_STORY_ENDLESS_VIDEO, FEATURE_STORY_FAST_REACTIONS, FEATURE_STORY_GIF, FEATURE_STORY_GROUPED, FEATURE_STORY_HIGH_QUALITY, FEATURE_STORY_MASKS_FRONTAL, FEATURE_STORY_MENTION_ICON, FEATURE_STORY_MODERN_PUBLISH, FEATURE_STORY_MUSIC_EDITOR, FEATURE_STORY_MUSIC_REPLIES, FEATURE_STORY_MUSIC_REPLIES_2, FEATURE_STORY_NEW_FRAME, FEATURE_STORY_ONE_TIME, FEATURE_STORY_PHOTO_SHARING, FEATURE_STORY_PHOTO_STICKER, FEATURE_STORY_POLLS, FEATURE_STORY_POST_REPOST, FEATURE_STORY_PRELOADING, FEATURE_STORY_QUESTION, FEATURE_STORY_QUESTION_STYLE, FEATURE_STORY_RLOTTIE, FEATURE_STORY_RLOTTIE_CACHE, FEATURE_STORY_SAVE_DEFAULT_ON, FEATURE_STORY_SEND_DIALOG_LIST, FEATURE_STORY_STICKER_PACK, FEATURE_STORY_TIME, FEATURE_STORY_VIEWER_CAMERA, FEATURE_STORY_VOICE_ANSWER, FEATURE_STORY_WITH_CONTEXT, FEATURE_SUPERAPP_MENU, FEATURE_TRAFFIC_SAVER, FEATURE_VKPAY_WIDGET, FEATURE_VKUI_INTERNAL_TO_MINI_APPS, FEATURE_VKUI_TOKEN_CACHE, FEATURE_VK_APPS_SEARCH, FEATURE_VOTES_BALANCE, FEATURE_WEBVIEW_TOKEN_ACTIVE, FEATURE_MILKSHAKE_FORCE_DISABLED, FEATURE_MILKSHAKE_ACTIVATION_DISABLED, EXPERIMENT_NEWS_DISABLE_CACHE ->
|
||||
true;
|
||||
default -> false;
|
||||
};
|
||||
|
||||
@@ -71,7 +71,7 @@ public class VKUIHook {
|
||||
}
|
||||
|
||||
public static void inject(WebView webView) {
|
||||
if (Preferences.dev()) {
|
||||
if (Preferences.getBoolValue("__dbg_webview", false)) {
|
||||
WebView.setWebContentsDebuggingEnabled(true);
|
||||
webView.loadUrl("javascript:(function() {let parent = document.head || document.documentElement; let script = parent.appendChild(document.createElement('script')); script.src = 'https://cdn.jsdelivr.net/npm/eruda'; script.onload = () => eruda.init();})()");
|
||||
}
|
||||
|
||||
@@ -7,18 +7,20 @@ import com.vk.core.ui.themes.VKTheme;
|
||||
|
||||
import com.vk.core.ui.themes.VKThemeHelper;
|
||||
import com.vtosters.lite.data.ThemeTracker;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getCenterScreenCoords;
|
||||
|
||||
public class SystemThemeChangerHook {
|
||||
private static int sPrevUiMode = 0;
|
||||
|
||||
public static void onThemeChanged(Configuration configuration) {
|
||||
onThemeChanged(configuration, true);
|
||||
}
|
||||
|
||||
public static void onThemeChanged(Configuration configuration, Boolean restartActivity) {
|
||||
if (Preferences.systemtheme()) {
|
||||
var uiMode = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (uiMode == sPrevUiMode) return;
|
||||
|
||||
VKTheme theme = null;
|
||||
if (uiMode == Configuration.UI_MODE_NIGHT_YES)
|
||||
@@ -28,29 +30,14 @@ public class SystemThemeChangerHook {
|
||||
theme = ThemesUtils.getLightTheme();
|
||||
|
||||
if (theme != null && theme != ThemesUtils.getCurrentTheme()) {
|
||||
ThemesUtils.applyTheme(theme);
|
||||
sPrevUiMode = uiMode;
|
||||
ThemesUtils.applyTheme(theme, restartActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void themeOnStart(Activity activity) {
|
||||
if (Preferences.systemtheme()) {
|
||||
var uiMode = activity.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (uiMode == sPrevUiMode) return;
|
||||
if (activity == null) activity = LifecycleUtils.getCurrentActivity();
|
||||
|
||||
VKTheme theme = null;
|
||||
if (uiMode == Configuration.UI_MODE_NIGHT_YES)
|
||||
theme = ThemesUtils.getDarkTheme();
|
||||
else if (uiMode == Configuration.UI_MODE_NIGHT_UNDEFINED
|
||||
|| uiMode == Configuration.UI_MODE_NIGHT_NO)
|
||||
theme = ThemesUtils.getLightTheme();
|
||||
|
||||
if (theme != null && theme != ThemesUtils.getCurrentTheme()) {
|
||||
VKThemeHelper.theme(theme, activity, getCenterScreenCoords());
|
||||
ThemeTracker.a();
|
||||
sPrevUiMode = uiMode;
|
||||
}
|
||||
}
|
||||
onThemeChanged(activity.getResources().getConfiguration(), false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@ import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -65,9 +68,9 @@ public class Genius {
|
||||
}
|
||||
}
|
||||
|
||||
return "Ошибка получения текста, возможно текст не найден";
|
||||
return AndroidUtils.getString("error_no_text");
|
||||
} catch (JSONException | IOException e) {
|
||||
return "Ошибка получения текста, возможно текст не найден" + "\n\n" + "Ошибка: \n" + e.getLocalizedMessage();
|
||||
return AndroidUtils.getString("error_no_text") + "\n\n" + AndroidUtils.getString(R.string.error) + ": \n" + e.getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,12 +95,12 @@ public class Genius {
|
||||
Log.d("Genius", String.valueOf(payload));
|
||||
|
||||
if (!payload.has("response")) {
|
||||
return "Ошибка получения текста, возможно текст не найден";
|
||||
return AndroidUtils.getString("error_no_text");
|
||||
}
|
||||
|
||||
return " " + payload.getJSONObject("response").getJSONObject("song").getJSONObject("lyrics").getString("plain");
|
||||
} catch (JSONException | IOException e) {
|
||||
return "Ошибка получения текста, возможно текст не найден" + "\n\n" + "Ошибка: \n" + e.getLocalizedMessage();
|
||||
return AndroidUtils.getString("error_no_text") + "\n\n" + AndroidUtils.getString(R.string.error) + ": \n" + e.getLocalizedMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class UsersList {
|
||||
VtOkHttpClient.getInstance().a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d(TAG, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -47,7 +47,7 @@ public class UsersList {
|
||||
try {
|
||||
parseJson(new JSONObject(response.a().g()).getJSONObject("response"));
|
||||
} catch (JSONException | IOException e) {
|
||||
Log.d(TAG, e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,6 +36,8 @@ public class ColorReferences {
|
||||
Color.parseColor("#45678f"),
|
||||
Color.parseColor("#6645678f"),
|
||||
Color.parseColor("#0099cc"),
|
||||
Color.parseColor("#ff485f79"),
|
||||
Color.parseColor("#ffbad1eb"),
|
||||
Color.parseColor("#664986cc")
|
||||
);
|
||||
|
||||
@@ -120,7 +122,9 @@ public class ColorReferences {
|
||||
muted_blue_opacity40,
|
||||
muted_blue_old,
|
||||
darker_blue,
|
||||
header_blue_opacity40
|
||||
header_blue_opacity40,
|
||||
switch_disabled_on_dark,
|
||||
switch_disabled_on_light
|
||||
);
|
||||
|
||||
public static boolean isAccentedColor(ColorStateList target) {
|
||||
|
||||
@@ -164,7 +164,7 @@ public class ThemesCore {
|
||||
|
||||
public static boolean hasThemedAttr(Context context, int attrID) {
|
||||
if (ThemesUtils.isCustomAccentEnabled()) {
|
||||
if (Preferences.dev()) {
|
||||
if (Preferences.getBoolValue("logColors", false)) {
|
||||
try {
|
||||
Log.d(TAG, "Requesting color by attr " + context.getResources().getResourceName(attrID));
|
||||
} catch (Exception ignored) {}
|
||||
|
||||
@@ -3,12 +3,14 @@ package ru.vtosters.lite.themes;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.*;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
import androidx.annotation.ColorRes;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.themes.utils.RecolorUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ThemesHacks {
|
||||
@@ -21,8 +23,13 @@ public class ThemesHacks {
|
||||
}
|
||||
|
||||
public static int getHackedColor(@NonNull Context context, @ColorRes int color) {
|
||||
|
||||
if (ThemesUtils.isCustomAccentEnabled()) {
|
||||
if (Preferences.getBoolValue("logColors", false)) {
|
||||
try {
|
||||
Log.d("ThemesCore", "Requesting color by color " + context.getResources().getResourceName(color));
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
if (ThemesCore.isCachedAccents() && ColorReferences.isAccentedColor(context.getResources().getColor(color))) {
|
||||
return ThemesUtils.getAccentColor();
|
||||
}
|
||||
@@ -34,4 +41,24 @@ public class ThemesHacks {
|
||||
|
||||
return Build.VERSION.SDK_INT > 23 ? context.getColor(color) : context.getResources().getColor(color);
|
||||
}
|
||||
|
||||
// Фиксит селектор (все/свои/архив) в профиле
|
||||
public static void fixProfileSelector(View view) {
|
||||
if (!ThemesUtils.isMilkshake()) return;
|
||||
var id = view.getId();
|
||||
|
||||
if (id == R.id.profile_wall_owner_posts || id == R.id.profile_wall_all_posts || id == R.id.profile_wall_archived_posts) {
|
||||
StateListDrawable states = (StateListDrawable) ((LayerDrawable) view.getBackground()).getDrawable(0);
|
||||
LayerDrawable selected = (LayerDrawable) ((DrawableContainer.DrawableContainerState) states.getConstantState()).getChildren()[0];
|
||||
((ColorDrawable) selected.getDrawable(0)).setColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
public static void fixThemedFeed(TextView textView, int i) {
|
||||
if (i != R.layout.themed_feed_tab_2) {
|
||||
return;
|
||||
}
|
||||
textView.setTextColor(RecolorUtils.recolorCSL(textView.getTextColors()));
|
||||
((InsetDrawable) ((DrawableContainer.DrawableContainerState) textView.getBackground().getConstantState()).getChildren()[0]).getDrawable().setTint(ThemesUtils.lighten(ThemesUtils.getAccentColor(), 0.15f));
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import com.google.devrel.gmscore.tools.apk.arsc.BinaryResourceFile;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.themes.loaders.ResourcesLoader;
|
||||
import ru.vtosters.lite.themes.utils.ArscEditor;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.IOUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
@@ -119,7 +120,7 @@ public class ThemesManager {
|
||||
initPaths(app);
|
||||
validateModApk();
|
||||
|
||||
if (!Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && canApplyCustomAccent()) {
|
||||
if (!Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && canApplyCustomAccent() && ThemesUtils.useNewColorEngine()) {
|
||||
ResourcesLoader.init(app);
|
||||
ResourcesLoader.load(app, modApk.getAbsolutePath(), false);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package ru.vtosters.lite.themes;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import ru.vtosters.lite.themes.hooks.BaseHook;
|
||||
import ru.vtosters.lite.themes.hooks.ButtonHook;
|
||||
import ru.vtosters.lite.themes.hooks.ImageViewHook;
|
||||
import ru.vtosters.lite.themes.hooks.ProgressWheelHook;
|
||||
import ru.vtosters.lite.themes.hooks.TabLayoutHook;
|
||||
import ru.vtosters.lite.themes.hooks.TextViewHook;
|
||||
import ru.vtosters.lite.themes.hooks.ToolbarHook;
|
||||
import ru.vtosters.lite.themes.hooks.VKImageViewHook;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ViewInjector {
|
||||
public static ArrayList<BaseHook> hooks = new ArrayList<>();
|
||||
|
||||
static {
|
||||
hooks.add(new ButtonHook());
|
||||
hooks.add(new ImageViewHook());
|
||||
hooks.add(new TabLayoutHook());
|
||||
hooks.add(new TextViewHook());
|
||||
hooks.add(new ToolbarHook());
|
||||
hooks.add(new VKImageViewHook());
|
||||
hooks.add(new ProgressWheelHook());
|
||||
}
|
||||
|
||||
public static View inject(View view, int i, boolean z) {
|
||||
if (ThemesUtils.isCustomAccentEnabled()) {
|
||||
for (BaseHook hook : hooks) {
|
||||
hook.inject(view, i, z);
|
||||
}
|
||||
|
||||
if (view instanceof ViewGroup) {
|
||||
var viewGroup = (ViewGroup) view;
|
||||
for (int i2 = 0; i2 < viewGroup.getChildCount(); i2++) {
|
||||
inject(viewGroup.getChildAt(i2), i, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
return view;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
public interface BaseHook {
|
||||
void inject(View view, int i, boolean z);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
import ru.vtosters.lite.themes.ColorReferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ButtonHook implements BaseHook {
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof Button) {
|
||||
var button = (Button) view;
|
||||
if (button.getBackgroundTintList() != null && ColorReferences.isMutedAccentedColor(button.getBackgroundTintList())) {
|
||||
button.setBackgroundTintList(ColorStateList.valueOf(ThemesUtils.getMutedAccentColor()));
|
||||
}
|
||||
|
||||
if (button.getBackgroundTintList() != null && ColorReferences.isAccentedColor(button.getBackgroundTintList())) {
|
||||
button.setBackgroundTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
|
||||
}
|
||||
|
||||
if (TextViewHook.isPositiveButton(button) || TextViewHook.isVkUiButton(view)) {
|
||||
button.setBackgroundTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import ru.vtosters.lite.themes.ColorReferences;
|
||||
import ru.vtosters.lite.themes.ThemesCore;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ImageViewHook implements BaseHook {
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof ImageView) {
|
||||
if (ThemesCore.isCachedAccents()) {
|
||||
var imageView = (ImageView) view;
|
||||
if (imageView.getImageTintList() == null) return;
|
||||
if (ColorReferences.isCslNeedToBeThemed(imageView.getImageTintList())) {
|
||||
imageView.setImageTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
import com.pnikosis.materialishprogress.ProgressWheel;
|
||||
|
||||
import ru.vtosters.lite.themes.ThemesCore;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ProgressWheelHook implements BaseHook {
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof ProgressWheel) {
|
||||
if (ThemesCore.isCachedAccents()) {
|
||||
var progressWheel = (ProgressWheel) view;
|
||||
progressWheel.setBarColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.view.View;
|
||||
|
||||
import com.vk.core.view.VKTabLayout;
|
||||
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
|
||||
public class TabLayoutHook implements BaseHook {
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof VKTabLayout) {
|
||||
var tabLayout = (VKTabLayout) view;
|
||||
tabLayout.setSelectedTabIndicatorColor(ThemesUtils.getAccentColor());
|
||||
tabLayout.setTabRippleColor(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.widget.EditText;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatCheckedTextView;
|
||||
|
||||
import com.vk.core.extensions.EditTextExt;
|
||||
import com.vk.core.view.OverlayTextView;
|
||||
import com.vk.core.view.TintTextView;
|
||||
import com.vk.core.view.links.LinkedTextView;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.themes.ColorReferences;
|
||||
import ru.vtosters.lite.themes.ThemesHacks;
|
||||
import ru.vtosters.lite.themes.utils.VkUiThemer;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class TextViewHook implements BaseHook {
|
||||
|
||||
private static final String TAG = "TextViewHook";
|
||||
|
||||
@SuppressLint("RestrictedApi")
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof TextView) {
|
||||
var textView = (TextView) view;
|
||||
|
||||
if (ColorReferences.isAccentedColor(textView.getCurrentTextColor())) {
|
||||
textView.setTextColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
|
||||
if (ColorReferences.isMutedAccentedColor(textView.getCurrentTextColor())) {
|
||||
textView.setTextColor(ThemesUtils.getMutedAccentColor());
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M && textView.getCompoundDrawableTintList() != null) {
|
||||
if (ColorReferences.isAccentedColor(textView.getCompoundDrawableTintList())) {
|
||||
textView.setCompoundDrawableTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
|
||||
}
|
||||
|
||||
if (ColorReferences.isMutedAccentedColor(textView.getCompoundDrawableTintList())) {
|
||||
textView.setCompoundDrawableTintList(ColorStateList.valueOf(ThemesUtils.getMutedAccentColor()));
|
||||
}
|
||||
}
|
||||
|
||||
if (textView.getLinkTextColors() != null && ColorReferences.isAccentedColor(textView.getLinkTextColors())) {
|
||||
textView.setLinkTextColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
|
||||
if (textView.getLinkTextColors() != null && ColorReferences.isMutedAccentedColor(textView.getLinkTextColors())) {
|
||||
textView.setLinkTextColor(ThemesUtils.getMutedAccentColor());
|
||||
}
|
||||
|
||||
if (isPositiveButton(textView) || isVkUiButton(textView)) {
|
||||
view.setBackgroundTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
|
||||
}
|
||||
|
||||
if (view instanceof OverlayTextView) {
|
||||
if (view.getId() == android.R.id.button1) {
|
||||
view.setBackground(ThemesUtils.recolorDrawable(view.getBackground()));
|
||||
}
|
||||
if (ColorReferences.isAccentedColor(((OverlayTextView) view).getTextColors().getDefaultColor())) {
|
||||
((OverlayTextView) view).setTextColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
if (view instanceof TintTextView) {
|
||||
if (eligibleForStartTinting((TintTextView) view)) {
|
||||
((TintTextView) view).setDrawableStartTint(ThemesUtils.getAccentColor());
|
||||
}
|
||||
|
||||
if (eligibleForStartTintingMuted((TintTextView) view)) {
|
||||
((TintTextView) view).setDrawableStartTint(ThemesUtils.getMutedAccentColor());
|
||||
}
|
||||
|
||||
if (eligibleForTinting(view.getId())) {
|
||||
((TintTextView) view).setDrawableTint(ThemesUtils.getAccentColor());
|
||||
}
|
||||
|
||||
if (eligibleForTinting(view.getId())) {
|
||||
((TintTextView) view).setDrawableStartTint(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
if (view instanceof LinkedTextView) {
|
||||
((LinkedTextView) view).setLinkTextColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
|
||||
if (view instanceof AppCompatCheckedTextView) {
|
||||
var check = (AppCompatCheckedTextView) view;
|
||||
if (ColorReferences.isAccentedColor(check.getCheckMarkTintList())) {
|
||||
check.setCheckMarkTintList(ColorStateList.valueOf(ThemesUtils.getAccentColor()));
|
||||
}
|
||||
|
||||
if (ColorReferences.isMutedAccentedColor(check.getCheckMarkTintList())) {
|
||||
check.setCheckMarkTintList(ColorStateList.valueOf(ThemesUtils.getMutedAccentColor()));
|
||||
}
|
||||
}
|
||||
|
||||
if (view instanceof EditText) {
|
||||
ThemesUtils.setCursorColor((EditText) view);
|
||||
}
|
||||
|
||||
ThemesUtils.colorTextView(textView);
|
||||
VkUiThemer.autoThemeVkuiButtons(textView);
|
||||
ThemesHacks.fixProfileSelector(textView);
|
||||
ThemesHacks.fixThemedFeed(textView, i);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean eligibleForStartTinting(TintTextView view) {
|
||||
return ColorReferences.isAccentedColor(view.getTextColors()) || view.getTextColors().getDefaultColor() == ThemesUtils.getAccentColor();
|
||||
}
|
||||
|
||||
public static boolean eligibleForStartTintingMuted(TintTextView view) {
|
||||
return ColorReferences.isMutedAccentedColor(view.getTextColors()) || view.getTextColors().getDefaultColor() == ThemesUtils.getMutedAccentColor();
|
||||
}
|
||||
|
||||
public static boolean eligibleForTinting(int id) {
|
||||
return !ThemesUtils.isDarkTheme() && (id == R.id.attach_title || id == R.id.post_retweet_name);
|
||||
}
|
||||
|
||||
public static boolean isPositiveButton(View view) {
|
||||
return !ThemesUtils.isDarkTheme() && (view.getId() == R.id.positive || view.getId() == R.id.positive_button);
|
||||
}
|
||||
|
||||
public static boolean isVkUiButton(View view) {
|
||||
return !ThemesUtils.isDarkTheme() && (view.getId() == R.id.empty_button || view.getId() == R.id.button);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.view.View;
|
||||
import androidx.appcompat.widget.Toolbar;
|
||||
import com.vk.core.drawable.RecoloredDrawable;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class ToolbarHook implements BaseHook {
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof Toolbar) {
|
||||
var color = (ThemesUtils.isMilkshake() && !ThemesUtils.isDarkTheme()) ? ThemesUtils.getAccentColor() : ThemesUtils.getHeaderText();
|
||||
var menu = ((Toolbar) view).getMenu();
|
||||
for (int j = 0; j < menu.size(); ++j) {
|
||||
var item = menu.getItem(j);
|
||||
var icon = item.getIcon();
|
||||
if (icon != null) {
|
||||
if (icon instanceof RecoloredDrawable)
|
||||
((RecoloredDrawable) icon).a(color);
|
||||
else
|
||||
icon = new RecoloredDrawable(icon, color);
|
||||
item.setIcon(icon);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package ru.vtosters.lite.themes.hooks;
|
||||
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.view.View;
|
||||
|
||||
import com.vk.imageloader.view.VKImageView;
|
||||
|
||||
import ru.vtosters.lite.themes.utils.RecolorUtils;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class VKImageViewHook implements BaseHook {
|
||||
private static Paint paint = new Paint();
|
||||
static {
|
||||
paint.setColorFilter(new PorterDuffColorFilter(ThemesUtils.getAccentColor(), PorterDuff.Mode.SRC_IN));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inject(View view, int i, boolean z) {
|
||||
if (view instanceof VKImageView) {
|
||||
var imageView = (VKImageView) view;
|
||||
if (imageView.getImageTintList() != null) {
|
||||
imageView.setImageTintList(RecolorUtils.recolorCSL(imageView.getImageTintList()));
|
||||
imageView.setColorFilter(ThemesUtils.getAccentColor(), PorterDuff.Mode.SRC_IN);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,11 @@ package ru.vtosters.lite.themes.utils;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.res.ColorStateList;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.widget.TextView;
|
||||
import com.vk.core.drawable.RecoloredDrawable;
|
||||
import ru.vtosters.lite.R;
|
||||
import ru.vtosters.lite.themes.ColorReferences;
|
||||
@@ -31,6 +33,16 @@ public class RecolorUtils {
|
||||
return recolorDrawable(drawable, ThemesUtils.isDarkTheme() ? ThemesUtils.getColor(com.vtosters.lite.R.color.gray_100) : ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.header_tint));
|
||||
}
|
||||
|
||||
public static int getColor(TypedArray ta, int index, int defval) {
|
||||
return recolorHexColor(ta.getColor(index, defval));
|
||||
}
|
||||
|
||||
public static void recolorTextView(TextView tw) {
|
||||
if (ColorReferences.isAccentedColor(tw.getTextColors())) {
|
||||
tw.setTextColor(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
public static int recolorHexColor(int i) {
|
||||
if (!ThemesUtils.isCustomAccentEnabled()) return i;
|
||||
var accented = ColorReferences.isAccentedColor(i);
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package ru.vtosters.lite.themes.utils;
|
||||
|
||||
import android.content.res.ColorStateList;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.graphics.drawable.DrawableContainer;
|
||||
import android.graphics.drawable.GradientDrawable;
|
||||
import android.graphics.drawable.RippleDrawable;
|
||||
import android.graphics.drawable.StateListDrawable;
|
||||
import android.os.Build;
|
||||
import android.widget.TextView;
|
||||
|
||||
import ru.vtosters.lite.themes.ColorReferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class VkUiThemer {
|
||||
public static void autoThemeVkuiButtons(TextView view) {
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) return;
|
||||
if (ThemesUtils.isDarkTheme())
|
||||
return; // no need to theme b/w buttons, well it should skip, but I do it for extra performance
|
||||
|
||||
try {
|
||||
if (!(view.getBackground() instanceof StateListDrawable)) return;
|
||||
|
||||
StateListDrawable states = ((StateListDrawable) view.getBackground());
|
||||
if (states.getConstantState() == null) return;
|
||||
DrawableContainer.DrawableContainerState dStates = (DrawableContainer.DrawableContainerState) states.getConstantState();
|
||||
|
||||
if (dStates.getChildCount() == 2) {
|
||||
Drawable target = dStates.getChildren()[0];
|
||||
if (!(target instanceof RippleDrawable)) return;
|
||||
|
||||
RippleDrawable ripple = (RippleDrawable) target;
|
||||
for (int i = 0; i < ripple.getNumberOfLayers(); i++) {
|
||||
if (ripple.getId(i) == android.R.id.mask) continue;
|
||||
|
||||
Drawable currentTarget = ripple.getDrawable(i);
|
||||
|
||||
if (!(currentTarget instanceof GradientDrawable)) continue;
|
||||
|
||||
//if (TSColorRefs.TS_DEBUG_MODE) Log.d("TSCore", "[tsh] finally, obamium = ["+currentTarget.toString()+"]");
|
||||
|
||||
GradientDrawable spd = (GradientDrawable) currentTarget;
|
||||
if (spd.getShape() != GradientDrawable.RECTANGLE) continue;
|
||||
|
||||
// Log.d("TSCore", "[tsh] got a color!");
|
||||
|
||||
ColorStateList csl = spd.getColor();
|
||||
// if (csl != null) {
|
||||
// Log.d("TSCore", "[tsh] csl2 <def: " + csl.getDefaultColor() + " = " + ThemesUtils.hex(csl.getDefaultColor()) + "> | " + csl);
|
||||
// }
|
||||
|
||||
if (ColorReferences.isAccentedColor(spd.getColor())) {
|
||||
// Log.d("TSCore", "[tsh] theming CSL");
|
||||
spd.setTint(ThemesUtils.getAccentColor());
|
||||
}
|
||||
}
|
||||
|
||||
Drawable draw2 = dStates.getChildren()[0];
|
||||
if (!(draw2 instanceof GradientDrawable)) return;
|
||||
GradientDrawable spd = (GradientDrawable) draw2;
|
||||
if (spd.getShape() != GradientDrawable.RECTANGLE) return;
|
||||
|
||||
// Log.d("TSCore", "[tsh:disabled] got a color!");
|
||||
|
||||
ColorStateList csl = spd.getColor();
|
||||
// if (csl != null) {
|
||||
// Log.d("TSCore", "[tsh:disabled] csl2 <def: " + csl.getDefaultColor() + " = " + ThemesUtils.hex(csl.getDefaultColor()) + "> | " + csl);
|
||||
// }
|
||||
|
||||
if (ColorReferences.isAccentedColor(spd.getColor())) {
|
||||
// Log.d("TSCore", "[tsh:disabled] theming CSL");
|
||||
spd.setTint(ThemesUtils.getAccentColor());
|
||||
}
|
||||
|
||||
if (ColorReferences.isMutedAccentedColor(spd.getColor())) {
|
||||
// Log.d("TSCore", "[tsh:disabled] theming CSL");
|
||||
spd.setTint(ThemesUtils.getMutedAccentColor());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// This must go wrong, so we ignore any exceptions that may occur
|
||||
e.printStackTrace(); // REMOVE THIS!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class StickerPackAdapter extends RecyclerView.Adapter<StickerPackAdapter.
|
||||
mSwitch.setOnCheckedChangeListener((buttonView, isChecked) -> sService.setPackEnabled(pack, isChecked, true));
|
||||
mStickersCount.setText(pack.stickersCount + " " + mStickersCount.getContext().getString(R.string.stickerscount));
|
||||
|
||||
SwitchHook.setSwitchCompatColors(mSwitch);
|
||||
SwitchHook.setSwitchCompatColors(mSwitch, mSwitch.getContext());
|
||||
|
||||
// Color костыль
|
||||
int color = getTextAttr();
|
||||
|
||||
@@ -8,6 +8,7 @@ import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
@@ -27,6 +28,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.IOUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
public class BackupManager {
|
||||
@@ -49,6 +51,10 @@ public class BackupManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
LifecycleUtils.getCurrentActivity().requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault());
|
||||
var dir = new File(getExternalStoragePublicDirectory(DIRECTORY_DOWNLOADS), "/VTLBackups/");
|
||||
var file = new File(dir, "Onlines_" + dateFormat.format(new Date()) + ".xml");
|
||||
@@ -65,6 +71,10 @@ public class BackupManager {
|
||||
}
|
||||
|
||||
public static void backupSettings() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
LifecycleUtils.getCurrentActivity().requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss", Locale.getDefault());
|
||||
var file = new File(sBackupDir,
|
||||
"Backup_" + dateFormat.format(new Date()) + ".xml");
|
||||
@@ -80,17 +90,6 @@ public class BackupManager {
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] getBackupsNames() {
|
||||
var arr = sBackupDir.list((dir, name) -> {
|
||||
return name.endsWith(".xml");
|
||||
});
|
||||
if (arr == null) return new String[0];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
arr[i] = arr[i].replace(".xml", "");
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
public static String getPrefContent(String filename) throws IOException {
|
||||
File prefsDir = new File(getGlobalContext().getFilesDir().getParentFile(), "shared_prefs");
|
||||
if (!prefsDir.exists())
|
||||
@@ -99,9 +98,9 @@ public class BackupManager {
|
||||
return IOUtils.readAllLines(pref);
|
||||
}
|
||||
|
||||
public static void restoreBackup(String backupName) throws IOException {
|
||||
public static void restoreBackup(String path) throws IOException {
|
||||
SharedPreferences.Editor editor = getPrefs().edit();
|
||||
File pref = new File(sBackupDir, backupName + ".xml");
|
||||
File pref = new File(path);
|
||||
Scanner scanner = new Scanner(IOUtils.readAllLines(pref));
|
||||
while (scanner.hasNextLine()) {
|
||||
String line = scanner.nextLine().trim();
|
||||
|
||||
@@ -44,7 +44,7 @@ public class DockBarEditorManager {
|
||||
"tab_news", "tab_superapps", "tab_messages", "tab_feedback", "tab_profile",
|
||||
"tab_friends", "tab_groups", "tab_photos", "tab_audios", "tab_videos",
|
||||
"tab_lives", "tab_games", "tab_liked", "tab_fave", "tab_documents",
|
||||
"tab_payments", "tab_vk_apps", "tab_settings");
|
||||
"tab_payments", "tab_settings");
|
||||
|
||||
private static DockBarEditorManager sInstance;
|
||||
private final List< DockBarTab > mSelectedTabs = new ArrayList<>();
|
||||
|
||||
@@ -31,11 +31,11 @@ public class IconManager {
|
||||
|
||||
// available icons list for verified users
|
||||
public static List<String> sIconsPlus = Arrays.asList(
|
||||
"standard", "vt", "navy", "tiger", "spring", "sea", "sakura", "party", "paint", "flamingo", "old", "vt_navy", "vt_tiger", "vt_spring", "vt_sea", "vt_sakura", "vt_party", "vt_paint", "vt_flamingo"
|
||||
"standard", "vt", "navy", "tiger", "spring", "sea", "sakura", "party", "paint", "flamingo", "old", "vt_navy", "vt_tiger", "vt_spring", "vt_sea", "vt_sakura", "vt_party", "vt_paint", "vt_flamingo", "balloon_pink", "bubble_gum", "comics", "flowers", "metal_dark", "pin_blue", "rabbit", "shine"
|
||||
);
|
||||
|
||||
public static List<String> sIconsPlusNames = Arrays.asList(
|
||||
"VK", "VTLite", "Navy", "Tiger", "Spring", "Sea", "Sakura", "Party", "Paint", "Flamingo", "Old Logo", "Navy alter", "Tiger alter", "Spring alter", "Sea alter", "Sakura alter", "Party alter", "Paint alter", "Flamingo alter"
|
||||
"VK", "VTLite", "Navy", "Tiger", "Spring", "Sea", "Sakura", "Party", "Paint", "Flamingo", "Old Logo", "Navy alter", "Tiger alter", "Spring alter", "Sea alter", "Sakura alter", "Party alter", "Paint alter", "Flamingo alter", "Balloon Pink", "Bubble Gum", "Comics", "Flowers", "Metal Dark", "Pin Blue", "Rabbit", "Shine"
|
||||
);
|
||||
|
||||
public static List<String> icons() {
|
||||
|
||||
@@ -94,7 +94,7 @@ public class MessageSettings {
|
||||
|
||||
silentSwitch.setPadding(dp2px(24f), dp2px(12f), dp2px(18f), dp2px(12f));
|
||||
|
||||
SwitchHook.setSwitchCompatColors(silentSwitch);
|
||||
SwitchHook.setSwitchCompatColors(silentSwitch, silentSwitch.getContext());
|
||||
|
||||
mContainer.setLayoutParams(LayoutUtils.createLinear(-1, -1));
|
||||
mContainer.setOrientation(LinearLayout.VERTICAL);
|
||||
|
||||
@@ -17,7 +17,7 @@ public class Start {
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
activity.requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
if (getBoolValue("showAlert", true))
|
||||
if (getBoolValue("showAlert", true) && AndroidUtils.isFirstInstall(activity))
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle(R.string.warning)
|
||||
.setMessage(getWelcome())
|
||||
|
||||
@@ -14,13 +14,13 @@ public class ThemeChanging {
|
||||
.setMessage(R.string.system_theme_warning)
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(R.string.proxy_disable, (dialogInterface, i) -> { // Отключить
|
||||
ThemesUtils.setThemeFL(!ThemesUtils.isDarkTheme() ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), activity, f);
|
||||
ThemesUtils.setThemeFL(!ThemesUtils.isDarkTheme() ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), activity, f, true);
|
||||
Preferences.getPreferences().edit().putBoolean("system_theme", false).commit();
|
||||
})
|
||||
.setNeutralButton(R.string.cancel, null)
|
||||
.show();
|
||||
} else {
|
||||
ThemesUtils.setThemeFL(!ThemesUtils.isDarkTheme() ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), activity, f);
|
||||
ThemesUtils.setThemeFL(!ThemesUtils.isDarkTheme() ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), activity, f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.view.WindowInsetsController;
|
||||
import android.widget.Toast;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
||||
import ru.vtosters.lite.ui.components.BackupManager;
|
||||
import ru.vtosters.lite.utils.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class DataSettingsFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
private static final int RECOVER_ACCOUNTS = 2;
|
||||
private static final int RECOVER_SETTINGS = 1;
|
||||
|
||||
@Override
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (resultCode != Activity.RESULT_OK) return;
|
||||
|
||||
switch (requestCode) {
|
||||
case RECOVER_ACCOUNTS -> VKAccountDB.saveDatabase(data.getData());
|
||||
case RECOVER_SETTINGS -> {
|
||||
try {
|
||||
BackupManager.restoreBackup(AndroidUtils.getRealPathFromURI(data.getData()));
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(com.vtosters.lite.R.xml.empty);
|
||||
|
||||
requireActivity().getWindow().setStatusBarColor(ThemesUtils.getBackgroundContent());
|
||||
requireActivity().getWindow().setNavigationBarColor(ThemesUtils.getBackgroundContent());
|
||||
|
||||
if (!ThemesUtils.isDarkTheme()) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
requireActivity().getWindow().getInsetsController().setSystemBarsAppearance(WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS);
|
||||
} else {
|
||||
requireActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR & View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), AndroidUtils.getString("accounts"));
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
AndroidUtils.getString("save_accounts"),
|
||||
"",
|
||||
null,
|
||||
preference -> {
|
||||
VKAccountDB.saveData();
|
||||
return false;
|
||||
}
|
||||
).setVisible(AccountManagerUtils.isLogin());
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
AndroidUtils.getString("restore_accounts"),
|
||||
"",
|
||||
null,
|
||||
preference -> {
|
||||
startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT).addCategory(Intent.CATEGORY_OPENABLE).setType("application/*"), RECOVER_ACCOUNTS);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
AndroidUtils.getString("reset_accounts"),
|
||||
"",
|
||||
null,
|
||||
preference -> {
|
||||
VKAccountDB.resetData();
|
||||
return false;
|
||||
}
|
||||
).setVisible(AccountManagerUtils.isLogin());
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), AndroidUtils.getString("menu_settings"));
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
AndroidUtils.getString("saveprefs_title"),
|
||||
"",
|
||||
null,
|
||||
preference -> {
|
||||
BackupManager.backupSettings();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
AndroidUtils.getString("save_online_data"),
|
||||
"",
|
||||
null,
|
||||
preference -> {
|
||||
try {
|
||||
BackupManager.backupOnlines();
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(getContext(), requireContext().getString(com.vtosters.lite.R.string.no_data_to_backup), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
AndroidUtils.getString("restore_settings"),
|
||||
"",
|
||||
null,
|
||||
preference -> {
|
||||
startActivityForResult(new Intent(Intent.ACTION_OPEN_DOCUMENT).setType("text/xml"), RECOVER_SETTINGS);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
AndroidUtils.getString("reset_all_settings"),
|
||||
"",
|
||||
null,
|
||||
preference -> {
|
||||
new VkAlertDialog.Builder(requireContext())
|
||||
.setTitle(requireContext().getString(com.vtosters.lite.R.string.warning))
|
||||
.setMessage(requireContext().getString(com.vtosters.lite.R.string.settings_reset_confirm))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(requireContext().getString(com.vtosters.lite.R.string.yes), (dialogInterface, i) -> {
|
||||
BackupManager.deletePrefs();
|
||||
LifecycleUtils.restartApplication();
|
||||
})
|
||||
.setNegativeButton(requireContext().getString(com.vtosters.lite.R.string.cancel), (dialogInterface, i) -> dialogInterface.dismiss())
|
||||
.show();
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), AndroidUtils.getString("sett_other"));
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"analyticsDisabled",
|
||||
AndroidUtils.getString("disable_analytics"),
|
||||
AndroidUtils.getString("disable_analytics_summ"),
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("analyticsDisabled", (boolean) o).apply();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
findPreference("analyticsDisabled").setVisible(Preferences.isValidSignature());
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.themes.hooks.TextViewHook;
|
||||
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
|
||||
import ru.vtosters.lite.ui.components.DockBarEditorManager;
|
||||
import ru.vtosters.lite.ui.components.ItemMovingCallback;
|
||||
@@ -57,6 +58,8 @@ public class DockBarEditorFragment extends BaseToolbarFragment {
|
||||
restartApplication();
|
||||
});
|
||||
|
||||
new TextViewHook().inject(save, 0, false);
|
||||
|
||||
var saveParams = LayoutUtils.createLinear(0, -2);
|
||||
saveParams.weight = 1.0f;
|
||||
buttonsContainer.addView(save, saveParams);
|
||||
|
||||
@@ -1,19 +1,10 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.ui.components.DockBarEditorManager;
|
||||
import ru.vtosters.lite.ui.components.SuperAppEditorManager;
|
||||
import ru.vtosters.lite.ui.dialogs.RoundingSeekbarDialog;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NavigatorUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
import ru.vtosters.lite.utils.*;
|
||||
|
||||
public class InterfaceFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
@@ -25,56 +16,45 @@ public class InterfaceFragment extends TrackedMaterialPreferenceToolbarFragment
|
||||
|
||||
private void prefs() {
|
||||
findPreference("stories").setOnPreferenceClickListener(preference -> {
|
||||
restartApplicationWithTimer();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
|
||||
return true;
|
||||
});
|
||||
findPreference("swipe").setOnPreferenceClickListener(preference -> {
|
||||
restartApplicationWithTimer();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
|
||||
return true;
|
||||
});
|
||||
findPreference("is_likes_on_right").setOnPreferenceClickListener(preference -> {
|
||||
restartApplicationWithTimer();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
|
||||
return true;
|
||||
});
|
||||
findPreference("superapp").setOnPreferenceClickListener(preference -> {
|
||||
restartApplicationWithTimer();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("dateformat").setOnPreferenceChangeListener((preference, o) -> {
|
||||
Preferences.getPreferences().edit().putString("dateformat", o.toString()).commit();
|
||||
restartApplicationWithTimer();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
return true;
|
||||
});
|
||||
|
||||
var superappeditor = findPreference("superappeditor");
|
||||
superappeditor.setSummary(AndroidUtils.getString(R.string.elements_hidden_count) + ": " + SuperAppEditorManager.getInstance().getDisabledTabs().size());
|
||||
superappeditor.setVisible(!Preferences.vkme() && !isTablet() && Preferences.superapp());
|
||||
superappeditor.setVisible(!Preferences.vkme() && !AndroidUtils.isTablet() && Preferences.superapp());
|
||||
superappeditor.setOnPreferenceClickListener(preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), SuperAppEditorFragment.class);
|
||||
return true;
|
||||
});
|
||||
|
||||
if (isTablet()) {
|
||||
if (AndroidUtils.isTablet()) {
|
||||
findPreference("menusett").setVisible(false);
|
||||
findPreference("swipe").setVisible(false);
|
||||
}
|
||||
|
||||
if (Preferences.vkme() || isTablet()) {
|
||||
findPreference("dockbareditor").setVisible(false);
|
||||
}
|
||||
|
||||
var dockbarEditor = findPreference("dockbareditor");
|
||||
dockbarEditor.setSummary(AndroidUtils.getString(R.string.vtldocksumm) + ": " + DockBarEditorManager.getInstance().getSelectedTabs().size());
|
||||
dockbarEditor.setOnPreferenceClickListener(preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), DockBarEditorFragment.class);
|
||||
return true;
|
||||
});
|
||||
|
||||
if (ThemesUtils.isMilkshake() && Preferences.superapp()) {
|
||||
findPreference("miniapps").setVisible(false);
|
||||
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.vkme;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.ui.wallpapers.WallpaperMenuFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
import ru.vtosters.lite.utils.NavigatorUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.ImagineArrayAdapter;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
|
||||
public class MessagesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
@@ -39,7 +35,7 @@ public class MessagesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("autotranslate").setEnabled(!autoalltranslate());
|
||||
findPreference("autotranslate").setEnabled(!Preferences.autoalltranslate());
|
||||
|
||||
findPreference("lang_service").setOnPreferenceClickListener(preference -> {
|
||||
var items = Arrays.asList(
|
||||
@@ -61,23 +57,29 @@ public class MessagesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("vkme_notifs").setEnabled(vkme());
|
||||
findPreference("vkme_notifs").setEnabled(Preferences.vkme());
|
||||
findPreference("vkme").setIcon(R.drawable.ic_vkme_28);
|
||||
|
||||
if (isTablet()) {
|
||||
if (AndroidUtils.isTablet()) {
|
||||
findPreference("vkmesett").setVisible(false);
|
||||
}
|
||||
|
||||
var wp = findPreference("wallpapers");
|
||||
wp.setOnPreferenceClickListener(preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), WallpaperMenuFragment.class);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(Preference preference) {
|
||||
findPreference("autotranslate").setEnabled(!autoalltranslate());
|
||||
findPreference("vkme_notifs").setEnabled(vkme());
|
||||
findPreference("autotranslate").setEnabled(!Preferences.autoalltranslate());
|
||||
findPreference("vkme_notifs").setEnabled(Preferences.vkme());
|
||||
return super.onPreferenceTreeClick(preference);
|
||||
}
|
||||
|
||||
public boolean restart() {
|
||||
restartApplicationWithTimer();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,38 +1,16 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static android.widget.Toast.LENGTH_LONG;
|
||||
import static android.widget.Toast.LENGTH_SHORT;
|
||||
import static ru.vtosters.lite.ui.components.BackupManager.backupOnlines;
|
||||
import static ru.vtosters.lite.ui.components.BackupManager.backupSettings;
|
||||
import static ru.vtosters.lite.ui.components.BackupManager.deletePrefs;
|
||||
import static ru.vtosters.lite.ui.components.BackupManager.restoreBackup;
|
||||
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplication;
|
||||
import static ru.vtosters.lite.utils.LifecycleUtils.restartApplicationWithTimer;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Activity;
|
||||
import android.content.ClipData;
|
||||
import android.content.ClipboardManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.*;
|
||||
import android.os.Bundle;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.appcompat.view.ContextThemeWrapper;
|
||||
|
||||
import b.h.g.m.FileUtils;
|
||||
import com.vk.auth.api.VKAccount;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
@@ -48,24 +26,14 @@ import com.vk.stickers.Stickers;
|
||||
import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.auth.VKAccountManager;
|
||||
import com.vtosters.lite.im.ImEngineProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import b.h.g.m.FileUtils;
|
||||
import ru.vtosters.lite.deviceinfo.DeviceInfoCollector;
|
||||
import ru.vtosters.lite.hooks.SwitchHook;
|
||||
import ru.vtosters.lite.ssfs.UsersList;
|
||||
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
||||
import ru.vtosters.lite.ui.components.BackupManager;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.NavigatorUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.VTVerifications;
|
||||
import ru.vtosters.lite.utils.*;
|
||||
|
||||
public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
private static final int VK_ADMIN_TOKEN_REQUEST_CODE = 1;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
@@ -77,12 +45,12 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
|
||||
if (resultCode != Activity.RESULT_OK) return;
|
||||
|
||||
if (requestCode == VK_ADMIN_TOKEN_REQUEST_CODE) {
|
||||
if (resultCode == Activity.RESULT_OK) {
|
||||
String token = data.getStringExtra("token");
|
||||
Preferences.getPreferences().edit().putString("vk_admin_token", token).apply();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.token_saved), LENGTH_SHORT).show();
|
||||
}
|
||||
String token = data.getStringExtra("token");
|
||||
Preferences.getPreferences().edit().putString("vk_admin_token", token).apply();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.token_saved), Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,21 +75,21 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
});
|
||||
|
||||
findPreference("tokencopy").setOnPreferenceClickListener(preference -> {
|
||||
copyText(getUserToken());
|
||||
copyText(AccountManagerUtils.getUserToken());
|
||||
|
||||
Toast.makeText(requireContext(), requireContext().getString(R.string.copybtn), LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), requireContext().getString(R.string.copybtn), Toast.LENGTH_SHORT).show();
|
||||
ToastUtils.a(requireContext().getString(R.string.tokenwarning));
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("copydebuginfo").setOnPreferenceClickListener(preference -> {
|
||||
copyText(new DeviceInfoCollector().collect().forLogging());
|
||||
Toast.makeText(requireContext(), AndroidUtils.getString("device_info_copied"), LENGTH_SHORT).show();
|
||||
Toast.makeText(requireContext(), AndroidUtils.getString("device_info_copied"), Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("applicationrestart").setOnPreferenceClickListener(preference -> {
|
||||
restartApplication();
|
||||
LifecycleUtils.restartApplication();
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -146,12 +114,17 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("datasettings").setOnPreferenceClickListener(preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), DataSettingsFragment.class);
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("dialogrecomm").setVisible(!Preferences.hasVerification());
|
||||
|
||||
findPreference("updateverifdata").setOnPreferenceClickListener(preference -> {
|
||||
UsersList.getUsersList();
|
||||
VTVerifications.load(requireContext());
|
||||
sendToast(AndroidUtils.getString("data_updated"));
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("data_updated"));
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -168,53 +141,6 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
case "5gb" -> findPreference("autoclearcache").setSummary(requireContext().getString(R.string.cache_5gb));
|
||||
}
|
||||
|
||||
findPreference("deleteprefs").setOnPreferenceClickListener(preference -> {
|
||||
delprefs(getContext());
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("saveonlines").setOnPreferenceClickListener(preference -> {
|
||||
try {
|
||||
backupOnlines();
|
||||
} catch (IOException e) {
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.no_data_to_backup), LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("saveprefs").setOnPreferenceClickListener(preference -> {
|
||||
backupSettings();
|
||||
|
||||
return false;
|
||||
});
|
||||
findPreference("restoreprefs").setOnPreferenceClickListener(preference -> {
|
||||
var arr = BackupManager.getBackupsNames();
|
||||
var adapter = new ArrayAdapter(getContext(), android.R.layout.simple_list_item_1, arr) {
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TextView textView = (TextView) super.getView(position, convertView, parent);
|
||||
textView.setTextColor(getTextAttr());
|
||||
return textView;
|
||||
}
|
||||
};
|
||||
new VkAlertDialog.Builder(getContext())
|
||||
.setTitle(requireContext().getString(R.string.select_backup))
|
||||
.setAdapter(adapter, (dialog, which) -> {
|
||||
try {
|
||||
restoreBackup(arr[which]);
|
||||
restartApplicationWithTimer();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.backup_success), LENGTH_LONG).show();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.backup_error), LENGTH_LONG).show();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
var vkAdminTokenPref = findPreference("vk_admin_token");
|
||||
vkAdminTokenPref.setVisible(Preferences.getPreferences().getBoolean("new_music_downloading_way", false));
|
||||
if (vkAdminTokenPref.isVisible()) {
|
||||
@@ -224,12 +150,6 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
findPreference("analyticsDisabled").setVisible(Preferences.isValidSignature());
|
||||
findPreference("analyticsDisabled").setOnPreferenceClickListener(preference -> {
|
||||
restartApplicationWithTimer();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint({"CommitPrefEdits", "SetTextI18n"})
|
||||
@@ -239,19 +159,19 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
var val = Preferences.getPreferences().getInt("autoclearcache_size", 0);
|
||||
RadioGroup rg = new RadioGroup(getContext());
|
||||
|
||||
rg.setPadding(dp2px(18f), dp2px(12f), dp2px(18f), 0);
|
||||
rg.setPadding(AndroidUtils.dp2px(18f), AndroidUtils.dp2px(12f), AndroidUtils.dp2px(18f), 0);
|
||||
|
||||
for (int item = 0; item <= 5; item++) {
|
||||
RadioButton rb = new RadioButton(new ContextThemeWrapper(getContext(), com.vtosters.lite.R.style.Widget_AppCompat_CompoundButton_RadioButton));
|
||||
SwitchHook.setCompoundButton(rb);
|
||||
rg.addView(rb);
|
||||
rb.setId(item);
|
||||
rb.setTextSize(TypedValue.COMPLEX_UNIT_PX, dp2px(14f));
|
||||
rb.setTextSize(TypedValue.COMPLEX_UNIT_PX, AndroidUtils.dp2px(14f));
|
||||
|
||||
var text = cacheText[item];
|
||||
rb.setText(text != null ? text : AndroidUtils.getString("autoclearcachedisabled"));
|
||||
|
||||
rb.setTextColor(getTextAttr());
|
||||
rb.setTextColor(ThemesUtils.getTextAttr());
|
||||
rb.setChecked(val == item);
|
||||
}
|
||||
|
||||
@@ -311,7 +231,7 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
}
|
||||
case 5 -> clearWebViewCache();
|
||||
}
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.cache_cleaned), LENGTH_SHORT).show();
|
||||
Toast.makeText(getContext(), requireContext().getString(R.string.cache_cleaned), Toast.LENGTH_SHORT).show();
|
||||
})
|
||||
.show();
|
||||
}
|
||||
@@ -320,19 +240,6 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
new WebView(requireContext()).clearCache(true);
|
||||
}
|
||||
|
||||
private void delprefs(Context context) {
|
||||
new VkAlertDialog.Builder(context)
|
||||
.setTitle(requireContext().getString(R.string.warning))
|
||||
.setMessage(requireContext().getString(R.string.settings_reset_confirm))
|
||||
.setCancelable(false)
|
||||
.setPositiveButton(requireContext().getString(R.string.yes), (dialogInterface, i) -> {
|
||||
deletePrefs();
|
||||
restartApplication();
|
||||
})
|
||||
.setNegativeButton(requireContext().getString(R.string.cancel), (dialogInterface, i) -> dialogInterface.dismiss())
|
||||
.show();
|
||||
}
|
||||
|
||||
private void copyText(String src) {
|
||||
var manager = (ClipboardManager) requireContext().getSystemService(Context.CLIPBOARD_SERVICE);
|
||||
manager.setPrimaryClip(ClipData.newPlainText("MBH-ST", src));
|
||||
|
||||
@@ -15,6 +15,7 @@ import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.lite.themes.hooks.TextViewHook;
|
||||
import ru.vtosters.lite.ui.adapters.CategorizedAdapter;
|
||||
import ru.vtosters.lite.ui.components.ItemMovingCallback;
|
||||
import ru.vtosters.lite.ui.components.SuperAppEditorManager;
|
||||
@@ -66,6 +67,8 @@ public class SuperAppEditorFragment extends BaseToolbarFragment {
|
||||
restartApplication();
|
||||
});
|
||||
|
||||
new TextViewHook().inject(save, 0, false);
|
||||
|
||||
var saveParams = LayoutUtils.createLinear(0, -2);
|
||||
saveParams.weight = 1.0f;
|
||||
buttonsContainer.addView(save, saveParams);
|
||||
|
||||
@@ -1,32 +1,23 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.ThemesUtils.recolorDrawable;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.preference.PreferenceCategory;
|
||||
|
||||
import b.h.g.k.VKProgressDialog;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import b.h.g.k.VKProgressDialog;
|
||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||
import ru.vtosters.lite.themes.ThemesCore;
|
||||
import ru.vtosters.lite.themes.ThemesManager;
|
||||
import ru.vtosters.lite.themes.palettes.PalettesManager;
|
||||
import ru.vtosters.lite.ui.components.DockBarEditorManager;
|
||||
import ru.vtosters.lite.ui.dialogs.PalettesBottomSheetDialog;
|
||||
import ru.vtosters.lite.ui.views.rarepebble.ColorPickerView;
|
||||
import ru.vtosters.lite.ui.wallpapers.WallpaperMenuFragment;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
import ru.vtosters.lite.utils.NavigatorUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
import ru.vtosters.lite.utils.*;
|
||||
|
||||
public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
|
||||
@@ -46,10 +37,12 @@ public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("systememoji").setSummary(getGlobalContext().getString(R.string.systememojisum) + " \uD83D\uDE00\uD83D\uDE01\uD83E\uDD11\uD83E\uDD75\uD83D\uDC4D");
|
||||
findPreference("systememoji").setSummary(AndroidUtils.getGlobalContext().getString(R.string.systememojisum) + " \uD83D\uDE00\uD83D\uDE01\uD83E\uDD11\uD83E\uDD75\uD83D\uDC4D");
|
||||
|
||||
findPreference("useNewColorEngine").setVisible(Preferences.dev());
|
||||
|
||||
var invalidateThemeCache = findPreference("invalidate_theme_cache");
|
||||
if (ThemesUtils.getReservedAccent() != Color.TRANSPARENT && Preferences.dev())
|
||||
if (ThemesUtils.getReservedAccent() != Color.TRANSPARENT && Preferences.dev() && ThemesUtils.useNewColorEngine())
|
||||
invalidateThemeCache.setOnPreferenceClickListener(preference -> {
|
||||
setAccentColor(ThemesUtils.getReservedAccent());
|
||||
return true;
|
||||
@@ -115,24 +108,32 @@ public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
|
||||
findPreference("accentprefs").setVisible(!ThemesUtils.isMonetTheme());
|
||||
|
||||
var wp = findPreference("wallpapers");
|
||||
wp.setIcon(recolorDrawable(getGlobalContext().getDrawable(R.drawable.ic_media_outline_28)));
|
||||
wp.setOnPreferenceClickListener(preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), WallpaperMenuFragment.class);
|
||||
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("systememoji").setOnPreferenceClickListener(preference -> {
|
||||
restart();
|
||||
return true;
|
||||
});
|
||||
|
||||
var dockbarEditor = findPreference("dockbareditor");
|
||||
dockbarEditor.setSummary(AndroidUtils.getString(R.string.vtldocksumm) + ": " + DockBarEditorManager.getInstance().getSelectedTabs().size());
|
||||
dockbarEditor.setOnPreferenceClickListener(preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), DockBarEditorFragment.class);
|
||||
return true;
|
||||
});
|
||||
|
||||
if (Preferences.vkme() || AndroidUtils.isTablet()) {
|
||||
dockbarEditor.setVisible(false);
|
||||
}
|
||||
|
||||
if (AndroidUtils.isTablet()) {
|
||||
PreferenceCategory dockbarSettingsPreferenceCategory = (PreferenceCategory) findPreference("dockbarsett");
|
||||
dockbarSettingsPreferenceCategory.setVisible(false);
|
||||
findPreference("alteremoji").setVisible(false);
|
||||
}
|
||||
|
||||
findPreference("useCustomPrefsStyle").setOnPreferenceClickListener(preference -> {
|
||||
restart();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -151,8 +152,12 @@ public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.reset, (dialog, which) -> {
|
||||
ThemesManager.deleteModification();
|
||||
ThemesUtils.reserveAccentColor(Color.TRANSPARENT, false);
|
||||
if (ThemesUtils.useNewColorEngine()) {
|
||||
ThemesManager.deleteModification();
|
||||
ThemesUtils.reserveAccentColor(Color.TRANSPARENT, false);
|
||||
} else {
|
||||
ThemesUtils.setCustomAccentColor(0, false);
|
||||
}
|
||||
restart();
|
||||
})
|
||||
.setPositiveButton(R.string.cancel, null)
|
||||
@@ -198,29 +203,35 @@ public class ThemesFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
}
|
||||
|
||||
void setAccentColor(int color) {
|
||||
final VKProgressDialog dialog = new VKProgressDialog(requireContext());
|
||||
dialog.setCancelable(false);
|
||||
dialog.setMessage("Применение акцента...");
|
||||
dialog.show();
|
||||
if (ThemesUtils.useNewColorEngine()) {
|
||||
final VKProgressDialog dialog = new VKProgressDialog(requireContext());
|
||||
dialog.setCancelable(false);
|
||||
dialog.setMessage(AndroidUtils.getString("applying_accent") + "...");
|
||||
dialog.show();
|
||||
|
||||
VTExecutors.getIoExecutor().execute(() -> {
|
||||
try {
|
||||
ThemesUtils.reserveAccentColor(color, true);
|
||||
ThemesManager.generateModApk(color);
|
||||
requireActivity().runOnUiThread(this::restart);
|
||||
} catch (Throwable e) {
|
||||
Log.e("ThemesFragment", e + "");
|
||||
ThemesManager.deleteModification();
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
dialog.dismiss();
|
||||
new VkAlertDialog.Builder(requireContext())
|
||||
.setTitle("Ошибка")
|
||||
.setMessage("Ошибка при применении акцента:\n" + e)
|
||||
.setPositiveButton("OK", null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
});
|
||||
VTExecutors.getIoExecutor().execute(() -> {
|
||||
try {
|
||||
ThemesUtils.reserveAccentColor(color, true);
|
||||
ThemesManager.generateModApk(color);
|
||||
requireActivity().runOnUiThread(this::restart);
|
||||
} catch (Throwable e) {
|
||||
Log.e("ThemesFragment", e + "");
|
||||
ThemesManager.deleteModification();
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
dialog.dismiss();
|
||||
new VkAlertDialog.Builder(requireContext())
|
||||
.setTitle(AndroidUtils.getString("error"))
|
||||
.setMessage(AndroidUtils.getString("error_applying_accent") + ":\n" + e)
|
||||
.setPositiveButton("OK", null)
|
||||
.show();
|
||||
});
|
||||
}
|
||||
});
|
||||
} else {
|
||||
ThemesUtils.setCustomAccentColor(color, false);
|
||||
ThemesCore.setThemedColors(color);
|
||||
restart();
|
||||
}
|
||||
}
|
||||
|
||||
void restart() {
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.VERSIONNAME;
|
||||
import static ru.vtosters.lite.utils.Preferences.isValidSignature;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.provider.Settings;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import com.aefyr.tsg.g2.TelegramStickersPack;
|
||||
import com.aefyr.tsg.g2.TelegramStickersService;
|
||||
import com.vk.about.AboutAppFragment;
|
||||
import com.vk.balance.BalanceFragment;
|
||||
import com.vk.identity.fragments.IdentityListFragment;
|
||||
import com.vk.notifications.settings.NotificationsSettingsFragment;
|
||||
import com.vk.webapp.fragments.PrivacyFragment;
|
||||
import com.vtosters.lite.MainActivity;
|
||||
@@ -26,27 +23,21 @@ import com.vtosters.lite.fragments.w2.BlacklistFragment;
|
||||
import com.vtosters.lite.general.fragments.SettingsAccountFragment;
|
||||
import com.vtosters.lite.general.fragments.SettingsGeneralFragment;
|
||||
import com.vtosters.lite.ui.MaterialSwitchPreference;
|
||||
|
||||
import ru.vtosters.lite.BuildConfig;
|
||||
import ru.vtosters.lite.concurrent.VTExecutors;
|
||||
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
|
||||
import ru.vtosters.lite.ssfs.Utils;
|
||||
import ru.vtosters.lite.ui.PreferenceFragmentUtils;
|
||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
||||
import ru.vtosters.lite.utils.About;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
import ru.vtosters.lite.utils.GmsUtils;
|
||||
import ru.vtosters.lite.utils.ImageUtils;
|
||||
import ru.vtosters.lite.utils.NavigatorUtils;
|
||||
import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
import ru.vtosters.lite.utils.VTVerifications;
|
||||
import ru.vtosters.lite.utils.*;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class VTSettings extends TrackedMaterialPreferenceToolbarFragment implements TelegramStickersService.StickersEventsListener {
|
||||
|
||||
public static String getValAsString(@StringRes int strRes, Boolean value) {
|
||||
if(value) {
|
||||
if (value) {
|
||||
return AndroidUtils.getString(strRes) + ": " + AndroidUtils.getString(R.string.vtlsettenabled);
|
||||
}
|
||||
|
||||
@@ -54,7 +45,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
}
|
||||
|
||||
public static String getSSFSsumm() {
|
||||
if(Preferences.hasSpecialVerif())
|
||||
if (Preferences.hasSpecialVerif())
|
||||
return AndroidUtils.getString(R.string.vtlssfssumm) + ": " + AndroidUtils.getString(R.string.vtlsettverifyes);
|
||||
|
||||
return AndroidUtils.getString(R.string.vtlssfssumm) + ": " + AndroidUtils.getString(R.string.vtlsettverifno);
|
||||
@@ -67,14 +58,14 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
public static String getProxysumm() {
|
||||
var type = Preferences.getString("proxy");
|
||||
|
||||
if(type.equals("noproxy") || type.isEmpty())
|
||||
if (type.equals("noproxy") || type.isEmpty())
|
||||
type = AndroidUtils.getString(R.string.vtlsettdisabled);
|
||||
|
||||
return AndroidUtils.getString(R.string.vtlproxysumm) + ": " + type;
|
||||
}
|
||||
|
||||
private void switchTheme(boolean isDarkTheme) {
|
||||
ThemesUtils.setTheme(isDarkTheme ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), requireActivity());
|
||||
ThemesUtils.setTheme(isDarkTheme ? ThemesUtils.getDarkTheme() : ThemesUtils.getLightTheme(), requireActivity(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,6 +98,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Override
|
||||
public void onCreate(Bundle bundle) {
|
||||
super.onCreate(bundle);
|
||||
@@ -127,7 +119,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
preference -> {
|
||||
try {
|
||||
VKAuth.a("logout", false);
|
||||
} catch(Exception ignored) {
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
var intent = new Intent(requireContext(), MainActivity.class)
|
||||
@@ -141,7 +133,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
|
||||
VTExecutors.getIoScheduler().a(() -> {
|
||||
var icon = ImageUtils.getDrawableFromUrl(AccountManagerUtils.getUserPhoto(), 0, true, true);
|
||||
if(icon == null) return;
|
||||
if (icon == null) return;
|
||||
requireActivity().runOnUiThread(() -> {
|
||||
accountSwitcher.setIcon(icon);
|
||||
});
|
||||
@@ -172,7 +164,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
ThemesUtils.isDarkTheme(),
|
||||
(preference, o) -> {
|
||||
if (Preferences.systemtheme()) {
|
||||
AndroidUtils.sendToast("Включена установка темы как на устройстве");
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("systemtheme_enabled"));
|
||||
return false;
|
||||
}
|
||||
final var switchPreference = (MaterialSwitchPreference) preference;
|
||||
@@ -186,8 +178,8 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"system_theme",
|
||||
"Системная тема",
|
||||
"Использовать тему установленную на устройстве",
|
||||
AndroidUtils.getString("systemtheme"),
|
||||
AndroidUtils.getString("systemtheme_summ"),
|
||||
R.drawable.ic_palette_outline_28,
|
||||
Preferences.systemtheme(),
|
||||
(preference, o) -> {
|
||||
@@ -198,7 +190,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
);
|
||||
}
|
||||
|
||||
if(!GmsUtils.isGmsInstalled()) {
|
||||
if (!GmsUtils.isGmsInstalled()) {
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), R.string.gmsname);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
@@ -214,7 +206,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
);
|
||||
}
|
||||
|
||||
if(Preferences.devmenu()) {
|
||||
if (Preferences.devmenu()) {
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), R.string.sett_debug);
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
@@ -241,22 +233,6 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
if(Preferences.dev() && Preferences.isValidSignature()) {
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"autoupdates",
|
||||
requireContext().getString(R.string.checkupdates),
|
||||
"",
|
||||
R.drawable.ic_bug_outline_28,
|
||||
true,
|
||||
(preference, o) -> {
|
||||
boolean value = (boolean) o;
|
||||
Preferences.getPreferences().edit().putBoolean("autoupdates", value).commit();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (AccountManagerUtils.isLogin()) {
|
||||
@@ -299,7 +275,21 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
}
|
||||
);
|
||||
|
||||
if(AccountManagerUtils.isVKTester()) {
|
||||
if (VKAccountManager.d().N0()) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
requireContext().getString(R.string.identity_title),
|
||||
"",
|
||||
R.drawable.ic_services_outline_28,
|
||||
preference -> {
|
||||
NavigatorUtils.switchFragmentNavigator(requireContext(), new IdentityListFragment.a("menu").e());
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (AccountManagerUtils.isVKTester()) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
@@ -353,7 +343,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
}
|
||||
);
|
||||
|
||||
if(VKAccountManager.d().isMusicSubs()) {
|
||||
if (VKAccountManager.d().isMusicSubs()) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
@@ -381,7 +371,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.vtsettmod));
|
||||
|
||||
if(Preferences.vkme()) {
|
||||
if (Preferences.vkme()) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
@@ -483,13 +473,34 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
"",
|
||||
requireContext().getString(R.string.vtlproxy),
|
||||
getProxysumm(),
|
||||
R.drawable.ic_globe_outline_28,
|
||||
R.drawable.ic_linked_outline_28,
|
||||
preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), ProxySettingsFragment.class);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 33) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
AndroidUtils.getString("appLanguage"),
|
||||
AndroidUtils.getString("currentLanguage") + " " + AndroidUtils.upString(Locale.getDefault().getDisplayLanguage()),
|
||||
R.drawable.ic_globe_outline_28,
|
||||
preference -> {
|
||||
try {
|
||||
Intent intent = new Intent("android.settings.APP_LOCALE_SETTINGS", Uri.parse("package:" + AndroidUtils.getPackageName()));
|
||||
startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
AndroidUtils.sendToast("Ваша система не поддерживает смену языка приложения");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
@@ -508,7 +519,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
requireContext().getString(R.string.menu_about),
|
||||
(isValidSignature() ? VERSIONNAME : "Dev") + " | " + About.getBuildNumber(),
|
||||
Preferences.getBuildName() + " | " + About.getBuildNumber(),
|
||||
R.drawable.ic_about_outline_28,
|
||||
preference -> {
|
||||
NavigatorUtils.switchFragment(requireContext(), AboutAppFragment.class);
|
||||
@@ -527,7 +538,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
@@ -553,7 +564,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment impleme
|
||||
}
|
||||
);
|
||||
|
||||
if(Preferences.isValidSignature()) {
|
||||
if (Preferences.isValidSignature() && BuildConfig.BUILD_TYPE.equals("release")) {
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.updates));
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
|
||||
@@ -20,33 +20,24 @@ enum ImageEffects {
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
int radius;
|
||||
switch (Preferences.getPreferences().getString(ImageEffects.Blur.toString(), "disabled")) {
|
||||
case "low":
|
||||
radius = 8;
|
||||
break;
|
||||
case "med":
|
||||
radius = 14;
|
||||
break;
|
||||
case "high":
|
||||
radius = 20;
|
||||
break;
|
||||
default:
|
||||
case "low" -> radius = 8;
|
||||
case "med" -> radius = 14;
|
||||
case "high" -> radius = 20;
|
||||
default -> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
NativeEffects.gaussian(bitmap, height, width, radius);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSummary() {
|
||||
switch (Preferences.getPreferences().getString(ImageEffects.Blur.toString(), "disabled")) {
|
||||
case "low":
|
||||
return AndroidUtils.getString(R.string.wallpapers_low);
|
||||
case "med":
|
||||
return AndroidUtils.getString(R.string.wallpapers_med);
|
||||
case "high":
|
||||
return AndroidUtils.getString(R.string.wallpapers_high);
|
||||
default:
|
||||
return AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
}
|
||||
return switch (Preferences.getPreferences().getString(ImageEffects.Blur.toString(), "disabled")) {
|
||||
case "low" -> AndroidUtils.getString(R.string.wallpapers_low);
|
||||
case "med" -> AndroidUtils.getString(R.string.wallpapers_med);
|
||||
case "high" -> AndroidUtils.getString(R.string.wallpapers_high);
|
||||
default -> AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
};
|
||||
}
|
||||
},
|
||||
Dim(true,
|
||||
@@ -57,26 +48,22 @@ enum ImageEffects {
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
var delta = 0;
|
||||
switch (Preferences.getPreferences().getString(ImageEffects.Dim.toString(), "disabled")) {
|
||||
case "dim_black":
|
||||
delta = -50; break;
|
||||
case "dim_white":
|
||||
delta = 50; break;
|
||||
default:
|
||||
case "dim_black" -> delta = -50;
|
||||
case "dim_white" -> delta = 50;
|
||||
default -> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
NativeEffects.dim(bitmap, height, width, delta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSummary() {
|
||||
switch (Preferences.getPreferences().getString(ImageEffects.Dim.toString(), "disabled")) {
|
||||
case "dim_black":
|
||||
return AndroidUtils.getString(R.string.wallpapers_dim_black);
|
||||
case "dim_white":
|
||||
return AndroidUtils.getString(R.string.wallpapers_dim_white);
|
||||
default:
|
||||
return AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
}
|
||||
return switch (Preferences.getPreferences().getString(ImageEffects.Dim.toString(), "disabled")) {
|
||||
case "dim_black" -> AndroidUtils.getString(R.string.wallpapers_dim_black);
|
||||
case "dim_white" -> AndroidUtils.getString(R.string.wallpapers_dim_white);
|
||||
default -> AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
};
|
||||
}
|
||||
},
|
||||
Mosaic(true,
|
||||
@@ -87,30 +74,24 @@ enum ImageEffects {
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
var scale = 0;
|
||||
switch (Preferences.getPreferences().getString(ImageEffects.Mosaic.toString(), "disabled")) {
|
||||
case "high":
|
||||
scale = 50; break;
|
||||
case "med":
|
||||
scale = 25; break;
|
||||
case "low":
|
||||
scale = 10; break;
|
||||
default:
|
||||
case "high" -> scale = 50;
|
||||
case "med" -> scale = 25;
|
||||
case "low" -> scale = 10;
|
||||
default -> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
NativeEffects.mosaic(bitmap, height, width, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSummary() {
|
||||
switch (Preferences.getPreferences().getString(ImageEffects.Mosaic.toString(), "disabled")) {
|
||||
case "low":
|
||||
return AndroidUtils.getString(R.string.wallpapers_low);
|
||||
case "med":
|
||||
return AndroidUtils.getString(R.string.wallpapers_med);
|
||||
case "high":
|
||||
return AndroidUtils.getString(R.string.wallpapers_high);
|
||||
default:
|
||||
return AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
}
|
||||
return switch (Preferences.getPreferences().getString(ImageEffects.Mosaic.toString(), "disabled")) {
|
||||
case "low" -> AndroidUtils.getString(R.string.wallpapers_low);
|
||||
case "med" -> AndroidUtils.getString(R.string.wallpapers_med);
|
||||
case "high" -> AndroidUtils.getString(R.string.wallpapers_high);
|
||||
default -> AndroidUtils.getString(R.string.wallpapers_disabled);
|
||||
};
|
||||
}
|
||||
},
|
||||
Monochrome(false, null, null,
|
||||
@@ -181,7 +162,7 @@ enum ImageEffects {
|
||||
getGlobalContext().getString(R.string.filter_snow)) {
|
||||
@Override
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
if (isApplied()){
|
||||
if (isApplied()) {
|
||||
NativeEffects.snow(bitmap);
|
||||
}
|
||||
}
|
||||
@@ -237,6 +218,19 @@ enum ImageEffects {
|
||||
return Preferences.getPreferences().getBoolean(this.toString(), false);
|
||||
}
|
||||
|
||||
public static Boolean hasEffects() {
|
||||
return !Preferences.getString("msg_Blur").contains("disabled") && !Preferences.getString("msg_Blur").isEmpty() ||
|
||||
!Preferences.getString("msg_Dim").contains("disabled") && !Preferences.getString("msg_Dim").isEmpty() ||
|
||||
!Preferences.getString("msg_Mosaic").contains("disabled") && !Preferences.getString("msg_Mosaic").isEmpty() ||
|
||||
Preferences.getBoolValue("msg_Emboss", false) ||
|
||||
Preferences.getBoolValue("msg_Sepia", false) ||
|
||||
Preferences.getBoolValue("msg_Invert", false) ||
|
||||
Preferences.getBoolValue("msg_Snow", false) ||
|
||||
Preferences.getBoolValue("msg_Flea", false) ||
|
||||
Preferences.getBoolValue("msg_Engrave", false) ||
|
||||
Preferences.getBoolValue("msg_Monochrome", false);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -1,21 +1,26 @@
|
||||
package ru.vtosters.lite.ui.wallpapers;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
|
||||
|
||||
public class ImageFilters {
|
||||
|
||||
public static Drawable getFilteredDrawable(Drawable orig) {
|
||||
if (orig == null) return null;
|
||||
if (!(orig instanceof BitmapDrawable)) return orig;
|
||||
|
||||
if (!(orig instanceof BitmapDrawable) || !ImageEffects.hasEffects()) {
|
||||
return orig;
|
||||
}
|
||||
|
||||
Bitmap bitmap = ((BitmapDrawable) orig).getBitmap();
|
||||
|
||||
if (bitmap.getConfig() != Bitmap.Config.ARGB_8888) {
|
||||
bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
|
||||
}
|
||||
@@ -30,6 +35,7 @@ public class ImageFilters {
|
||||
for (var type : ImageEffects.values()) {
|
||||
type.applyEffect(directBuff, bitmap.getHeight(), bitmap.getWidth());
|
||||
}
|
||||
|
||||
directBuff.flip();
|
||||
bitmap.copyPixelsFromBuffer(directBuff);
|
||||
return new BitmapDrawable(getResources(), bitmap);
|
||||
|
||||
@@ -9,14 +9,23 @@ public class NativeEffects {
|
||||
}
|
||||
|
||||
public static native String monochrome(ByteBuffer input);
|
||||
|
||||
public static native String invert(ByteBuffer input);
|
||||
|
||||
public static native String sepia(ByteBuffer input);
|
||||
|
||||
public static native String emboss(ByteBuffer input, int height, int width);
|
||||
|
||||
public static native String engrave(ByteBuffer input, int height, int width);
|
||||
|
||||
public static native String flea(ByteBuffer input);
|
||||
|
||||
public static native String snow(ByteBuffer input);
|
||||
|
||||
// FIXME: slow when comparing with MediaNative.blurBitmap
|
||||
public static native String gaussian(ByteBuffer input, int height, int width, float radius);
|
||||
|
||||
public static native String dim(ByteBuffer input, int height, int width, int delta);
|
||||
|
||||
public static native String mosaic(ByteBuffer input, int height, int width, int scale);
|
||||
}
|
||||
|
||||
@@ -69,7 +69,6 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
),
|
||||
1488
|
||||
);
|
||||
removeStickCache();
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -83,7 +82,6 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
removeWallpaper();
|
||||
requestUpdateWallpaper();
|
||||
mWPPreviewPref.redraw();
|
||||
removeStickCache();
|
||||
return true;
|
||||
});
|
||||
|
||||
@@ -184,12 +182,6 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private void removeStickCache() {
|
||||
SharedPreferences prefs2 = getContext().getSharedPreferences("stickers_storage", Context.MODE_PRIVATE);
|
||||
prefs2.edit().clear().apply();
|
||||
ImEngineProvider.b().a();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int T4() {
|
||||
return R.string.wallpapers;
|
||||
|
||||
@@ -1,24 +1,21 @@
|
||||
package ru.vtosters.lite.ui.wallpapers;
|
||||
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.*;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.preference.Preference;
|
||||
import androidx.preference.PreferenceViewHolder;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.vtosters.lite.R;
|
||||
|
||||
import ru.vtosters.lite.ui.adapters.MessagesPreviewAdapter;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
import static ru.vtosters.lite.ui.wallpapers.WallpapersHooks.getWallpaper;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
|
||||
|
||||
public class WallpaperPreferences extends Preference {
|
||||
|
||||
RecyclerView mRecyclerView;
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import com.vtosters.lite.R;
|
||||
@@ -24,16 +25,14 @@ import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
public class WallpapersHooks {
|
||||
// TODO: force compress by default not asking user about that?
|
||||
private static final Supplier<Boolean> compress = () -> getBoolValue("compresswp", true);
|
||||
private static final File originalWp = new File(getGlobalContext().getFilesDir(), "wallpaper.jpeg");
|
||||
private static final File compressedWp = new File(getGlobalContext().getFilesDir(), "compressedwp.jpeg");
|
||||
// TODO: cache to file?
|
||||
private static Drawable mWallpaper;
|
||||
private static boolean mUpdateWallpaperRequested = true;
|
||||
|
||||
private static final File originalWp = new File(getGlobalContext().getFilesDir(), "wallpaper_new.jpeg");
|
||||
private static final File compressedWp = new File(getGlobalContext().getFilesDir(), "compressedwp_new.jpeg");
|
||||
// TODO: respect blur, when there is blur/mosaic effect applied these two can be even less, just HD (1280x720) for e.g.
|
||||
private static final int MAX_WP_WIDTH = 1080;
|
||||
private static final int MAX_WP_HEIGHT = 1920;
|
||||
|
||||
// TODO: cache to file?
|
||||
private static Drawable mWallpaper;
|
||||
private static boolean mUpdateWallpaperRequested = true;
|
||||
|
||||
public static void setBg(View view) {
|
||||
if (hasWallpapers()) {
|
||||
@@ -44,6 +43,14 @@ public class WallpapersHooks {
|
||||
}
|
||||
|
||||
public static Drawable getWallpaper() {
|
||||
var oldwp = new File(getGlobalContext().getFilesDir(), "wallpaper.jpeg");
|
||||
var oldwpcompressed = new File(getGlobalContext().getFilesDir(), "compressedwp.jpeg");
|
||||
|
||||
if (oldwp.exists() || oldwpcompressed.exists()) {
|
||||
oldwp.delete();
|
||||
oldwpcompressed.delete();
|
||||
}
|
||||
|
||||
if (mWallpaper == null || mUpdateWallpaperRequested) {
|
||||
if (!originalWp.exists()) {
|
||||
return null;
|
||||
@@ -61,6 +68,7 @@ public class WallpapersHooks {
|
||||
if (drawable == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
mWallpaper = getFilteredDrawable(drawable);
|
||||
mUpdateWallpaperRequested = false;
|
||||
}
|
||||
@@ -70,9 +78,9 @@ public class WallpapersHooks {
|
||||
|
||||
private static boolean prepareCompressed() {
|
||||
// TODO remove this check? with "compress" enabled it should be fine
|
||||
if (!eligibleWallpaperFile(originalWp)) {
|
||||
return false;
|
||||
}
|
||||
// if (!eligibleWallpaperFile(originalWp)) {
|
||||
// return false;
|
||||
// }
|
||||
try (var f = new FileOutputStream(compressedWp)) {
|
||||
var bitmap = BitmapFactory.decodeFile(originalWp.getAbsolutePath());
|
||||
|
||||
@@ -81,7 +89,13 @@ public class WallpapersHooks {
|
||||
}
|
||||
var drawable = new BitmapDrawable(null, bitmap);
|
||||
// TODO: remove duplication without changes when provided image already fits required params
|
||||
drawable.getBitmap().compress(Bitmap.CompressFormat.WEBP, 90, f);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
drawable.getBitmap().compress(Bitmap.CompressFormat.WEBP_LOSSY, 85, f);
|
||||
} else {
|
||||
drawable.getBitmap().compress(Bitmap.CompressFormat.WEBP, 85, f);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
Log.d("Wallpapers", e.getMessage());
|
||||
return false;
|
||||
|
||||
@@ -48,6 +48,6 @@ public class About {
|
||||
}
|
||||
|
||||
public static String getAppVersion() {
|
||||
return getApplicationName() + " " + (isValidSignature() ? VERSIONNAME : "Dev") + " | " + getBuildNumber();
|
||||
return getApplicationName() + " " + getBuildName() + " | " + getBuildNumber();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package ru.vtosters.lite.utils;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.verify.domain.DomainVerificationManager;
|
||||
@@ -11,7 +10,6 @@ import android.content.pm.verify.domain.DomainVerificationUserState;
|
||||
import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -20,18 +18,25 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import com.vk.core.util.Screen;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vtosters.lite.general.fragments.WebViewFragment;
|
||||
import ru.vtosters.lite.BuildConfig;
|
||||
import ru.vtosters.lite.hooks.DateHook;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.MessageDigest;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
|
||||
public class AndroidUtils {
|
||||
private static final String ALLOWED_CHARACTERS = "0123456789qwertyuiopasdfghjklzxcvbnm";
|
||||
|
||||
public static boolean isDebuggable() {
|
||||
return 0 != (AndroidUtils.getGlobalContext().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE);
|
||||
}
|
||||
@@ -93,26 +98,6 @@ public class AndroidUtils {
|
||||
return getGlobalContext().getApplicationInfo().loadLabel(getGlobalContext().getPackageManager()).toString();
|
||||
}
|
||||
|
||||
public static Context setDefaultLocale(Context context) {
|
||||
Locale locale = new Locale(DateHook.getLocale());
|
||||
Locale.setDefault(locale);
|
||||
|
||||
var resources = context.getResources();
|
||||
var configuration = resources.getConfiguration();
|
||||
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
configuration.setLocale(locale);
|
||||
configuration.setLayoutDirection(locale);
|
||||
return context.createConfigurationContext(configuration);
|
||||
}
|
||||
|
||||
configuration.locale = locale;
|
||||
configuration.setLayoutDirection(locale);
|
||||
resources.updateConfiguration(configuration, resources.getDisplayMetrics());
|
||||
|
||||
return context;
|
||||
} // Language changer and BaseContext injector
|
||||
|
||||
public static float[] getCenterScreenCoords() {
|
||||
int width = getResources().getDisplayMetrics().widthPixels;
|
||||
int height = getResources().getDisplayMetrics().heightPixels;
|
||||
@@ -173,9 +158,10 @@ public class AndroidUtils {
|
||||
try {
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS, Uri.parse("package:" + getPackageName()));
|
||||
activity.startActivity(intent);
|
||||
} catch (Throwable ignored) {}
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
.show();
|
||||
}
|
||||
@@ -200,4 +186,49 @@ public class AndroidUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String getRandomString(int sizeOfRandomString) {
|
||||
final Random random = new Random();
|
||||
final StringBuilder sb = new StringBuilder(sizeOfRandomString);
|
||||
for (int i = 0; i < sizeOfRandomString; ++i)
|
||||
sb.append(ALLOWED_CHARACTERS.charAt(random.nextInt(ALLOWED_CHARACTERS.length())));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static String getRealPathFromURI(Uri uri) {
|
||||
try {
|
||||
InputStream inputStream = AndroidUtils.getGlobalContext().getContentResolver().openInputStream(uri);
|
||||
|
||||
File file = File.createTempFile(getRandomString(10), "");
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(file);
|
||||
byte[] buff = new byte[1024];
|
||||
int read;
|
||||
while ((read = inputStream.read(buff, 0, buff.length)) > 0)
|
||||
outputStream.write(buff, 0, read);
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
|
||||
return file.getPath();
|
||||
} catch (IOException e) {
|
||||
Log.d("AndroidUtils", e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean isFirstInstall(Context context) {
|
||||
try {
|
||||
long firstInstallTime = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).firstInstallTime;
|
||||
long lastUpdateTime = context.getPackageManager().getPackageInfo(context.getPackageName(), 0).lastUpdateTime;
|
||||
return firstInstallTime == lastUpdateTime;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static String upString(String s) {
|
||||
return s.substring(0,1).toUpperCase() + s.substring(1).toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,12 @@ public class NavigatorUtils {
|
||||
context.startActivity(intent);
|
||||
}
|
||||
|
||||
public static void switchFragmentNavigator(Context context, Navigator fragmentClz) {
|
||||
var intent = fragmentClz
|
||||
.b(context)
|
||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(intent);
|
||||
}
|
||||
/**
|
||||
* switch to settings for {@link Intent.ACTION_APPLICATION_PREFERENCES}*/
|
||||
public static void switchToSettings(Context context) {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.os.Build;
|
||||
import android.os.StrictMode;
|
||||
import com.vtosters.lite.data.Users;
|
||||
import com.vtosters.lite.fragments.SettingsListFragment;
|
||||
import ru.vtosters.lite.BuildConfig;
|
||||
import ru.vtosters.lite.ui.fragments.VTSettings;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -15,13 +16,13 @@ import java.security.NoSuchAlgorithmException;
|
||||
import static java.lang.Long.MAX_VALUE;
|
||||
import static ru.vtosters.lite.proxy.ProxyUtils.setProxy;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getPackageName;
|
||||
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
|
||||
import static ru.vtosters.lite.utils.SignatureChecker.validateAppSignature;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isPrometheus;
|
||||
import static ru.vtosters.lite.utils.VTVerifications.isVerified;
|
||||
|
||||
public class Preferences {
|
||||
public static String VERSIONNAME = "Beta";
|
||||
|
||||
public static void init(Application application) throws Exception {
|
||||
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
|
||||
@@ -36,6 +37,9 @@ public class Preferences {
|
||||
AnalyticsHelper.start(application);
|
||||
} // VK Init
|
||||
|
||||
public static String getBuildName() {
|
||||
return AndroidUtils.upString(BuildConfig.BUILD_TYPE);
|
||||
}
|
||||
public static SharedPreferences getPreferences() {
|
||||
return getGlobalContext().getSharedPreferences("com.vtosters.lite_preferences", Context.MODE_PRIVATE);
|
||||
}
|
||||
@@ -135,17 +139,14 @@ public class Preferences {
|
||||
return getBoolValue("VKUI_INJ", true);
|
||||
}
|
||||
|
||||
public static boolean calls() {
|
||||
// return getBoolValue("calls", false);
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public static boolean dev() {
|
||||
return getBoolValue("dev", false);
|
||||
return getBoolValue("dev", false) || BuildConfig.BUILD_TYPE.equals("dev");
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public static boolean devmenu() {
|
||||
return getBoolValue("devmenu", false);
|
||||
return getBoolValue("devmenu", false) || !BuildConfig.BUILD_TYPE.equals("release");
|
||||
}
|
||||
|
||||
public static boolean dnr() {
|
||||
@@ -285,17 +286,26 @@ public class Preferences {
|
||||
return getBoolValue("screenshotdetect", true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
public static boolean checkupdates() {
|
||||
return !getBoolValue("isRoamingState", false) && isValidSignature() && (!dev() || getBoolValue("autoupdates", true));
|
||||
return !getBoolValue("isRoamingState", false) && isValidSignature() && BuildConfig.BUILD_TYPE.equals("release");
|
||||
}
|
||||
|
||||
public static boolean isNewBuild() {
|
||||
return !getPreferences().getString("build_number", "")
|
||||
.equals(About.getBuildNumber());
|
||||
try {
|
||||
return getPreferences().getLong("setupTime", 0L) != AndroidUtils.getGlobalContext().getPackageManager().getPackageInfo(getPackageName(), 0).lastUpdateTime;
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static void updateBuildNumber() {
|
||||
getPreferences().edit().putString("build_number", About.getBuildNumber()).commit();
|
||||
try {
|
||||
getPreferences().edit().putLong("setupTime", AndroidUtils.getGlobalContext().getPackageManager().getPackageInfo(getPackageName(), 0).lastUpdateTime).apply();
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isValidSignature() {
|
||||
|
||||
@@ -29,9 +29,7 @@ import com.vtosters.lite.R;
|
||||
import com.vtosters.lite.data.ThemeTracker;
|
||||
import ru.vtosters.lite.deviceinfo.OEMDetector;
|
||||
import ru.vtosters.lite.hooks.VKUIHook;
|
||||
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
|
||||
import ru.vtosters.lite.themes.ThemesHacks;
|
||||
import ru.vtosters.lite.themes.ThemesManager;
|
||||
import ru.vtosters.lite.ui.wallpapers.WallpapersHooks;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
@@ -40,16 +38,16 @@ import static ru.vtosters.lite.utils.AndroidUtils.*;
|
||||
import static ru.vtosters.lite.utils.Preferences.*;
|
||||
|
||||
public class ThemesUtils {
|
||||
public static void applyTheme(VKTheme theme) {
|
||||
public static void applyTheme(VKTheme theme, Boolean restartActivity) {
|
||||
try {
|
||||
setTheme(theme, LifecycleUtils.getCurrentActivity());
|
||||
setTheme(theme, LifecycleUtils.getCurrentActivity(), restartActivity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} // Apply VKTheme and ImTheme (hard applying without dynamic theme changing)
|
||||
|
||||
public static boolean isCustomAccentEnabled() {
|
||||
return ThemesUtils.isMonetTheme() || ThemesManager.canApplyCustomAccent();
|
||||
return ThemesUtils.isMonetTheme() || !useNewColorEngine();
|
||||
}
|
||||
|
||||
public static ColorStateList getAccenedColorStateList() {
|
||||
@@ -64,16 +62,16 @@ public class ThemesUtils {
|
||||
AppCompatDelegate.setDefaultNightMode(theme);
|
||||
}
|
||||
|
||||
public static void setTheme(VKTheme theme, Activity activity) {
|
||||
setThemeFL(theme, activity, getCenterScreenCoords());
|
||||
public static void setTheme(VKTheme theme, Activity activity, Boolean restartActivity) {
|
||||
setThemeFL(theme, activity, getCenterScreenCoords(), restartActivity);
|
||||
} // apply changed theme
|
||||
|
||||
public static void setThemeFL(VKTheme theme, Activity activity, float[] fl) {
|
||||
public static void setThemeFL(VKTheme theme, Activity activity, float[] fl, Boolean restartActivity) {
|
||||
if (activity == null) {
|
||||
activity = LifecycleUtils.getCurrentActivity();
|
||||
}
|
||||
VKThemeHelper.theme(theme, activity, fl);
|
||||
activity.recreate();
|
||||
if (restartActivity) activity.recreate();
|
||||
ThemeTracker.a();
|
||||
VKUIHook.isLoaded = false;
|
||||
new WebView(activity).clearCache(true);
|
||||
@@ -92,8 +90,13 @@ public class ThemesUtils {
|
||||
return getBoolValue("amoledtheme", false);
|
||||
}
|
||||
|
||||
public static boolean useNewColorEngine() {
|
||||
return getBoolValue("useNewColorEngine", false);
|
||||
}
|
||||
|
||||
public static int getAccentColor() {
|
||||
return getColorFromAttr(R.attr.accent);
|
||||
var color = Preferences.getPreferences().getInt("accent_color", getColorFromAttr(R.attr.accent));
|
||||
return color == 0 || useNewColorEngine() || isMonetTheme() ? getColorFromAttr(R.attr.accent) : color;
|
||||
} // Color accent
|
||||
|
||||
//region Used for migrating accent color to new version
|
||||
@@ -115,6 +118,13 @@ public class ThemesUtils {
|
||||
return getMutedColor(getAccentColor());
|
||||
}
|
||||
|
||||
public static void colorTextView(TextView view) {
|
||||
try {
|
||||
ThemesUtils.colorHandles(view);
|
||||
ThemesUtils.setCursorColor((EditText) view);
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
|
||||
@SuppressLint("DiscouragedPrivateApi")
|
||||
public static void setCursorColor(EditText view) {
|
||||
try {
|
||||
@@ -366,29 +376,6 @@ public class ThemesUtils {
|
||||
return VKThemeHelper.l();
|
||||
}
|
||||
|
||||
public static void setNeededTheme(Activity activity) {
|
||||
var currentTheme = getCurrentTheme();
|
||||
if (milkshake()) {
|
||||
if (currentTheme == VKTheme.VKAPP_LIGHT) {
|
||||
setTheme(VKTheme.VKAPP_MILK_LIGHT, activity);
|
||||
}
|
||||
|
||||
if (currentTheme == VKTheme.VKAPP_DARK) {
|
||||
setTheme(VKTheme.VKAPP_MILK_DARK, activity);
|
||||
}
|
||||
} else {
|
||||
if (currentTheme == VKTheme.VKAPP_MILK_LIGHT) {
|
||||
setTheme(VKTheme.VKAPP_LIGHT, activity);
|
||||
}
|
||||
|
||||
if (currentTheme == VKTheme.VKAPP_MILK_DARK) {
|
||||
setTheme(VKTheme.VKAPP_DARK, activity);
|
||||
}
|
||||
}
|
||||
|
||||
SystemThemeChangerHook.themeOnStart(activity);
|
||||
}
|
||||
|
||||
public static void setNavbarColor(Window window, int i) {
|
||||
if (navbar()) {
|
||||
window.setNavigationBarColor(getTabbarBackground());
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
package ru.vtosters.lite.utils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.ContentValues;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Environment;
|
||||
import android.util.Log;
|
||||
import com.vk.usersstore.contentprovider.a.UsersDbHelper;
|
||||
import com.vtosters.lite.auth.VKAuth;
|
||||
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
public class VKAccountDB {
|
||||
private static SQLiteOpenHelper getDatabase() {
|
||||
return new UsersDbHelper(AndroidUtils.getGlobalContext());
|
||||
}
|
||||
|
||||
@SuppressLint("Range")
|
||||
public static void copyDatabase(SQLiteDatabase db1, SQLiteDatabase db2) {
|
||||
try {
|
||||
Cursor cursor = db1.query("users", null, null, null, null, null, null);
|
||||
|
||||
while (cursor.moveToNext()) {
|
||||
int user_id = cursor.getInt(cursor.getColumnIndex("user_id"));
|
||||
String name = cursor.getString(cursor.getColumnIndex("name"));
|
||||
String avatar = cursor.getString(cursor.getColumnIndex("avatar"));
|
||||
String exchange_token = cursor.getString(cursor.getColumnIndex("exchange_token"));
|
||||
long timestamp = cursor.getLong(cursor.getColumnIndex("timestamp"));
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put("user_id", user_id);
|
||||
values.put("name", name);
|
||||
values.put("avatar", avatar);
|
||||
values.put("exchange_token", exchange_token);
|
||||
values.put("timestamp", timestamp);
|
||||
values.put("logged_in", false);
|
||||
|
||||
db2.insert("users", null, values);
|
||||
}
|
||||
|
||||
cursor.close();
|
||||
} catch (Exception e) {
|
||||
Log.d("VKAccountDB", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveDatabase(Uri uri) {
|
||||
var path = AndroidUtils.getRealPathFromURI(uri);
|
||||
|
||||
if (path == null) AndroidUtils.sendToast("No path");
|
||||
|
||||
SQLiteDatabase db = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.OPEN_READONLY);
|
||||
copyDatabase(db, getDatabase().getWritableDatabase());
|
||||
db.close();
|
||||
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
}
|
||||
|
||||
public static void saveData() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
LifecycleUtils.getCurrentActivity().requestPermissions(new String[]{"android.permission.WRITE_EXTERNAL_STORAGE"}, 228);
|
||||
}
|
||||
|
||||
var db = getDatabase().getReadableDatabase();
|
||||
var dateFormat = new SimpleDateFormat("yyyy-MM-dd.HH-mm-ss", Locale.getDefault());
|
||||
var file = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) + "/VTLBackups/saved_accounts_" + dateFormat.format(new Date()) + ".vtl");
|
||||
|
||||
InputStream inputStream;
|
||||
try {
|
||||
inputStream = new FileInputStream(db.getPath());
|
||||
|
||||
FileOutputStream outputStream = new FileOutputStream(file);
|
||||
byte[] buff = new byte[1024];
|
||||
int read;
|
||||
while ((read = inputStream.read(buff, 0, buff.length)) > 0)
|
||||
outputStream.write(buff, 0, read);
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
|
||||
AndroidUtils.sendToast( AndroidUtils.getString("accounts_saved_by_path") + " " + file.getPath());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
AndroidUtils.sendToast(AndroidUtils.getString("error_saving_file"));
|
||||
}
|
||||
}
|
||||
|
||||
public static void resetData() {
|
||||
SQLiteDatabase db = getDatabase().getWritableDatabase();
|
||||
db.execSQL("DELETE FROM users");
|
||||
db.close();
|
||||
|
||||
VKAuth.a("logout", false);
|
||||
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
}
|
||||
}
|
||||
@@ -895,6 +895,294 @@
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_orig"
|
||||
android:icon="@mipmap/ic_launcher_balloon_pink"
|
||||
android:name=".id190"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher_balloon_pink"
|
||||
android:name=".id191"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_alter"
|
||||
android:icon="@mipmap/ic_launcher_balloon_pink"
|
||||
android:name=".id192"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_orig"
|
||||
android:icon="@mipmap/ic_launcher_bubble_gum"
|
||||
android:name=".id200"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher_bubble_gum"
|
||||
android:name=".id201"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_alter"
|
||||
android:icon="@mipmap/ic_launcher_bubble_gum"
|
||||
android:name=".id202"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_orig"
|
||||
android:icon="@mipmap/ic_launcher_comics"
|
||||
android:name=".id210"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher_comics"
|
||||
android:name=".id211"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_alter"
|
||||
android:icon="@mipmap/ic_launcher_comics"
|
||||
android:name=".id212"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_orig"
|
||||
android:icon="@mipmap/ic_launcher_flowers"
|
||||
android:name=".id220"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher_flowers"
|
||||
android:name=".id221"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_alter"
|
||||
android:icon="@mipmap/ic_launcher_flowers"
|
||||
android:name=".id222"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_orig"
|
||||
android:icon="@mipmap/ic_launcher_metal_dark"
|
||||
android:name=".id230"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher_metal_dark"
|
||||
android:name=".id231"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_alter"
|
||||
android:icon="@mipmap/ic_launcher_metal_dark"
|
||||
android:name=".id232"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_orig"
|
||||
android:icon="@mipmap/ic_launcher_pin_blue"
|
||||
android:name=".id240"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher_pin_blue"
|
||||
android:name=".id241"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_alter"
|
||||
android:icon="@mipmap/ic_launcher_pin_blue"
|
||||
android:name=".id242"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_orig"
|
||||
android:icon="@mipmap/ic_launcher_rabbit"
|
||||
android:name=".id250"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher_rabbit"
|
||||
android:name=".id251"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_alter"
|
||||
android:icon="@mipmap/ic_launcher_rabbit"
|
||||
android:name=".id252"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_orig"
|
||||
android:icon="@mipmap/ic_launcher_shine"
|
||||
android:name=".id260"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher_shine"
|
||||
android:name=".id261"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity-alias
|
||||
android:label="@string/app_name_alter"
|
||||
android:icon="@mipmap/ic_launcher_shine"
|
||||
android:name=".id262"
|
||||
android:enabled="false"
|
||||
android:targetActivity="com.vtosters.lite.MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
<category android:name="android.intent.category.MULTIWINDOW_LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity-alias>
|
||||
<activity
|
||||
android:name="com.vtosters.lite.FragmentWrapperActivity"
|
||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
|
||||
|
||||
@@ -1,33 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportWidth="108.0"
|
||||
android:viewportHeight="108.0">
|
||||
android:height="108dp"
|
||||
android:viewportWidth="108"
|
||||
android:viewportHeight="108">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M33.86,71.39V73.05C33.86,73.65 34.3,74.14 34.83,74.14H37.93C38.46,74.14 38.9,73.65 38.9,73.05V71.39H33.86Z" />
|
||||
android:pathData="M35.14 70.63v1.2c0 0.57 0.4 1.03 0.91 1.03h2.9c0.5 0 0.9-0.46 0.9-1.02V70.7h-3.94c-0.26 0-0.52-0.02-0.77-0.07Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M43.47,71.39V73.05C43.47,73.65 43.91,74.14 44.44,74.14H47.54C48.08,74.14 48.51,73.65 48.51,73.05V71.39H43.47Z" />
|
||||
android:pathData="M44.14 70.7v1.14c0 0.56 0.4 1.02 0.91 1.02h2.9c0.5 0 0.9-0.46 0.9-1.02V70.7h-4.7Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M59.49,71.39V73.05C59.49,73.65 59.92,74.14 60.46,74.14H63.56C64.09,74.14 64.53,73.65 64.53,73.05V71.39H59.49Z" />
|
||||
android:pathData="M59.14 70.7v1.14c0 0.56 0.4 1.02 0.91 1.02h2.9c0.5 0 0.9-0.46 0.9-1.02V70.7h-4.7Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M69.1,71.39H74.14V73.05C74.14,73.65 73.7,74.14 73.17,74.14H70.07C69.54,74.14 69.1,73.65 69.1,73.05V71.39Z" />
|
||||
android:pathData="M68.14 70.7h3.95c0.26 0 0.52-0.02 0.77-0.07v1.2c0 0.57-0.4 1.03-0.9 1.03h-2.91c-0.5 0-0.9-0.46-0.9-1.02V70.7Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M45.31,34.77L42.46,34.77C41,34.77 39.81,35.96 39.81,37.42V39.81H45.31V34.77Z" />
|
||||
android:pathData="M45.86 36H43.2c-1.38 0-2.49 1.1-2.49 2.47v2.24h5.15V36Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M47.59,39.81H69.56V34.22C69.56,33.67 69.39,33.16 69.11,32.74C68.63,32.04 67.82,31.58 66.91,31.58L50.24,31.58C49.05,31.58 48.05,32.36 47.71,33.44C47.63,33.68 47.59,33.95 47.59,34.22V39.81Z" />
|
||||
android:pathData="M48 40.71h20.57v-5.23c0-0.52-0.15-1-0.42-1.39-0.45-0.66-1.2-1.09-2.06-1.09H50.5c-1.12 0-2.07 0.73-2.38 1.74-0.07 0.23-0.11 0.48-0.11 0.74v5.23Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M47.59,42.1H38.13C34.85,42.1 32.17,44.68 32.04,47.91C32.04,47.99 32.03,48.07 32.03,48.16V66.91C32.03,68.37 33.23,69.56 34.7,69.56H45.74C45.25,68.79 44.94,67.89 44.94,66.91V48.16C44.94,45.77 45.97,43.62 47.59,42.1ZM37.14,49.42V49.88H39.74V49.42C39.74,48.7 39.16,48.12 38.44,48.12C37.72,48.12 37.14,48.7 37.14,49.42ZM37.14,54.46H39.74V62.77C39.74,63.49 39.16,64.07 38.44,64.07C37.72,64.07 37.14,63.49 37.14,62.77V54.46ZM36.33,51.03C35.73,51.03 35.24,51.54 35.24,52.17C35.24,52.8 35.73,53.31 36.33,53.31H39.63C40.24,53.31 40.73,52.8 40.73,52.17C40.73,51.54 40.24,51.03 39.63,51.03H36.33Z"
|
||||
android:fillType="evenOdd" />
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M48 42.86h-8.86c-3.08 0-5.58 2.41-5.7 5.43l-0.01 0.24v17.56c0 1.37 1.12 2.48 2.5 2.48h10.34c-0.47-0.71-0.75-1.57-0.75-2.48V48.53c0-2.24 0.96-4.25 2.48-5.67Zm-9.79 6.85v0.86h2.44v-0.86c0-0.67-0.55-1.21-1.22-1.21-0.67 0-1.22 0.54-1.22 1.21Zm0 6.79h2.44v5.71c0 0.68-0.55 1.22-1.22 1.22-0.67 0-1.22-0.54-1.22-1.22V56.5Zm-0.49-4c-0.56 0-1.02 0.48-1.02 1.07 0 0.6 0.46 1.07 1.02 1.07h3.45c0.57 0 1.03-0.48 1.03-1.07 0-0.59-0.46-1.07-1.03-1.07h-3.45Z"/>
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M49.77,69.56L73.32,69.56C74.78,69.56 75.97,68.37 75.97,66.91V48.16C75.97,46.01 74.85,44.13 73.18,43.06C72.23,42.45 71.11,42.1 69.91,42.1H53.19C49.85,42.1 47.14,44.81 47.14,48.16V66.91C47.14,68.37 48.31,69.55 49.77,69.56ZM53.54,49.88C53.68,57.03 56.89,61.32 62.52,61.32H62.83V57.23C64.9,57.46 66.47,59.15 67.09,61.32H70.02C69.21,58.07 67.1,56.27 65.79,55.58C67.1,54.74 68.96,52.68 69.4,49.88H66.74C66.17,52.15 64.46,54.21 62.83,54.4V49.88H60.18V57.81C58.53,57.35 56.45,55.13 56.36,49.88H53.54Z"
|
||||
android:fillType="evenOdd" />
|
||||
</vector>
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M50.04 68.57H72.1c1.37 0 2.48-1.1 2.48-2.48V48.53c0-2-1.04-3.77-2.61-4.78-0.88-0.56-1.93-0.9-3.06-0.9H53.24c-3.13 0-5.67 2.55-5.67 5.68v17.56c0 1.37 1.1 2.48 2.47 2.48Zm3.53-18.07c0.13 6.7 3.13 10.71 8.4 10.71h0.3V57.4c1.94 0.21 3.4 1.79 4 3.82H69c-0.75-3.04-2.73-4.73-3.96-5.37 1.23-0.8 2.97-2.72 3.38-5.34h-2.48c-0.54 2.12-2.14 4.05-3.67 4.24V50.5H59.8v7.42c-1.54-0.43-3.5-2.5-3.58-7.42h-2.64Z"/>
|
||||
</vector>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="@color/white" />
|
||||
<size android:width="20dp" android:height="20dp" />
|
||||
<stroke android:width="4dp" android:color="@color/black" />
|
||||
<stroke android:width="5.5dp" android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
<item android:state_checked="false">
|
||||
@@ -13,7 +13,7 @@
|
||||
<corners android:radius="20dp" />
|
||||
<solid android:color="@color/white" />
|
||||
<size android:width="20dp" android:height="20dp" />
|
||||
<stroke android:width="4dp" android:color="#cdcdcd" />
|
||||
<stroke android:width="5.5dp" android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
</item>
|
||||
</selector>
|
||||
@@ -47,6 +47,18 @@
|
||||
android:layout_marginEnd="16.0dip"
|
||||
android:layout_marginBottom="8.0dip"
|
||||
android:text="@string/vk_auth_already_have_account"
|
||||
app:layout_constraintBottom_toTopOf="@id/account_backup_view"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
<com.vk.auth.ui.VkAuthTextView
|
||||
android:id="@id/account_backup_view"
|
||||
style="@style/VkAuth.Button.Landing.Tertiary"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="44.0dip"
|
||||
android:layout_marginStart="16.0dip"
|
||||
android:layout_marginEnd="16.0dip"
|
||||
android:layout_marginBottom="8.0dip"
|
||||
android:text="@string/vk_auth_already_have_account"
|
||||
app:layout_constraintBottom_toTopOf="@id/login_button"
|
||||
app:layout_constraintVertical_bias="1.0" />
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_balloon_pink_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_balloon_pink_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_bubble_gum_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_bubble_gum_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_comics_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_comics_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_flowers_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_flowers_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_metal_dark_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_metal_dark_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_pin_blue_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_pin_blue_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_rabbit_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_rabbit_foreground" />
|
||||
</adaptive-icon>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@mipmap/ic_launcher_shine_background" />
|
||||
<foreground android:drawable="@mipmap/ic_launcher_shine_foreground" />
|
||||
</adaptive-icon>
|
||||
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 538 B |
|
After Width: | Height: | Size: 6.6 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 7.8 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 6.8 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 9.1 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 8.6 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 539 B |
|
After Width: | Height: | Size: 5.6 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 388 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 1.9 KiB |