Merge remote-tracking branch 'origin/main' into music
This commit is contained in:
@@ -7,6 +7,7 @@ import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.autotranslate;
|
||||
import static ru.vtosters.lite.utils.Preferences.savemsgsett;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
@@ -16,6 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import ru.vtosters.lite.translators.BaseTranslator;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
public class MessagesHook {
|
||||
public static String injectOwnText(String oldText) {
|
||||
@@ -72,6 +74,14 @@ public class MessagesHook {
|
||||
});
|
||||
}
|
||||
|
||||
public static Context fixCTX(Context ctx) {
|
||||
if (ctx == null){
|
||||
return LifecycleUtils.getCurrentActivity();
|
||||
} else {
|
||||
return ctx;
|
||||
}
|
||||
}
|
||||
|
||||
public static void injRequest(MethodCall.a req) {
|
||||
var time = expireTime();
|
||||
|
||||
|
||||
@@ -6,17 +6,24 @@ import ru.vtosters.lite.utils.Preferences;
|
||||
import ru.vtosters.lite.utils.ThemesUtils;
|
||||
|
||||
public class SystemThemeChangerHook {
|
||||
private static int latestTheme = 0;
|
||||
|
||||
public static void onThemeChanged(Configuration configuration) {
|
||||
if (Preferences.systemtheme()) {
|
||||
switch (configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK) {
|
||||
var theme = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
|
||||
if (theme == latestTheme) return;
|
||||
|
||||
switch (theme) {
|
||||
case Configuration.UI_MODE_NIGHT_YES:
|
||||
// Night mode is active, we're using dark theme
|
||||
ThemesUtils.applyTheme(ThemesUtils.getDarkTheme());
|
||||
latestTheme = theme;
|
||||
break;
|
||||
case Configuration.UI_MODE_NIGHT_NO:
|
||||
case Configuration.UI_MODE_NIGHT_UNDEFINED:
|
||||
// Night mode is not active, we're using light theme
|
||||
ThemesUtils.applyTheme(ThemesUtils.getLightTheme());
|
||||
latestTheme = theme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4409,6 +4409,10 @@
|
||||
|
||||
move-result-object v6
|
||||
|
||||
invoke-static {v6}, Lru/vtosters/lite/hooks/MessagesHook;->fixCTX(Landroid/content/Context;)Landroid/content/Context;
|
||||
|
||||
move-result-object v6
|
||||
|
||||
iput-object v6, p0, Lcom/vk/im/ui/fragments/ChatFragment;->L:Landroid/content/Context;
|
||||
|
||||
.line 8
|
||||
@@ -6119,6 +6123,10 @@
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/im/ui/fragments/ChatFragment;->L:Landroid/content/Context;
|
||||
|
||||
invoke-static {v0}, Lru/vtosters/lite/hooks/MessagesHook;->fixCTX(Landroid/content/Context;)Landroid/content/Context;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
const/4 v1, 0x0
|
||||
|
||||
if-eqz v0, :cond_1
|
||||
|
||||
@@ -5871,12 +5871,14 @@
|
||||
.line 1
|
||||
iget-object v0, p0, Lcom/vk/profile/ui/BaseProfileFragment;->P0:Landroid/view/View;
|
||||
|
||||
if-nez v0, :cond_229
|
||||
|
||||
return-void
|
||||
|
||||
:cond_229
|
||||
invoke-static {v0}, Lcom/vk/core/ui/themes/VKThemeHelper;->a(Landroid/view/View;)V
|
||||
|
||||
.line 2
|
||||
iget-object v0, p0, Lcom/vk/profile/ui/BaseProfileFragment;->P0:Landroid/view/View;
|
||||
|
||||
.line 3
|
||||
invoke-virtual {v0}, Landroid/view/View;->getContext()Landroid/content/Context;
|
||||
|
||||
move-result-object v0
|
||||
|
||||
Reference in New Issue
Block a user